@oliasoft-open-source/react-ui-library 5.12.1 → 5.13.0-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/global.css +1 -1
  2. package/dist/index.js +1275 -1159
  3. package/package.json +37 -41
package/dist/index.js CHANGED
@@ -498,7 +498,7 @@ const AccordionWithDefaultToggle = ({ heading: e, toggleLabel: t, onClickDefault
498
498
  children: /* @__PURE__ */ jsx(CheckBox, {
499
499
  label: t,
500
500
  onChange: (e) => {
501
- c({ type: AccordionActionType.TOGGLE_ENABLE }), n?.(e);
501
+ c({ type: AccordionActionType.TOGGLE_ENABLE }), n == null || n(e);
502
502
  },
503
503
  checked: s.defaultEnabled
504
504
  })
@@ -586,7 +586,7 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
586
586
  type: v === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
587
587
  className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !c ? button_module_default.iconOnly : "", w ? button_module_default.inverted : "", A, d ? button_module_default.pill : "", f ? button_module_default.round : "", p ? button_module_default.small : "", m),
588
588
  disabled: j,
589
- name: u ?? "",
589
+ name: u == null ? "" : u,
590
590
  onClick: y,
591
591
  ..._ ? { title: _ } : {},
592
592
  style: { width: h },
@@ -667,26 +667,27 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
667
667
  e.preventDefault();
668
668
  return;
669
669
  }
670
- f || (s && c?.(), r?.(e));
670
+ f || (s && (c == null || c()), r == null || r(e));
671
671
  }, y = (e) => {
672
- let { files: t } = e?.target ?? {};
673
- if (t) {
674
- let n = {
672
+ var t;
673
+ let { files: n } = (t = e == null ? void 0 : e.target) == null ? {} : t;
674
+ if (n) {
675
+ let t = {
675
676
  ...e,
676
677
  target: {
677
678
  ...e.target,
678
- value: t,
679
+ value: n,
679
680
  name: e.target.name,
680
- files: t
681
+ files: n
681
682
  }
682
683
  };
683
- m?.(n), c?.();
684
+ m == null || m(t), c == null || c();
684
685
  }
685
686
  };
686
687
  return /* @__PURE__ */ jsxs(_, {
687
688
  href: n,
688
689
  to: n,
689
- className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default?.selected : ""),
690
+ className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default == null ? void 0 : menu_module_default.selected : ""),
690
691
  onClick: v,
691
692
  "data-testid": h,
692
693
  children: [
@@ -719,7 +720,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
719
720
  children: [o && /* @__PURE__ */ jsx("span", {
720
721
  className: menu_module_default.check,
721
722
  children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
722
- }), !!e?.length && /* @__PURE__ */ jsx("div", {
723
+ }), !!(e != null && e.length) && /* @__PURE__ */ jsx("div", {
723
724
  className: menu_module_default.actions,
724
725
  children: /* @__PURE__ */ jsx(Actions, { actions: e })
725
726
  })]
@@ -735,34 +736,39 @@ let MenuType = /* @__PURE__ */ function(e) {
735
736
  const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path: i, maxHeight: a }) => {
736
737
  let o = useContext(DisabledContext);
737
738
  switch (e.type) {
738
- case MenuType.HEADING: return /* @__PURE__ */ jsx(Heading$3, {
739
- label: e?.label ?? "",
740
- onClick: e.onClick,
741
- icon: e.icon,
742
- testId: e.testId
743
- });
739
+ case MenuType.HEADING:
740
+ var c;
741
+ return /* @__PURE__ */ jsx(Heading$3, {
742
+ label: (c = e == null ? void 0 : e.label) == null ? "" : c,
743
+ onClick: e.onClick,
744
+ icon: e.icon,
745
+ testId: e.testId
746
+ });
744
747
  case MenuType.DIVIDER: return /* @__PURE__ */ jsx(Divider$1, {});
745
- case MenuType.OPTION: return /* @__PURE__ */ jsx(Option$2, {
746
- actions: e?.actions,
747
- label: e?.label ?? "",
748
- url: e?.url,
749
- onClick: e?.onClick,
750
- description: e?.description,
751
- icon: e?.icon,
752
- selected: e?.selected,
753
- closeOnOptionClick: t,
754
- close: n,
755
- disabled: e?.disabled || o,
756
- inline: e?.inline,
757
- title: e?.title,
758
- upload: e?.upload,
759
- uploadType: e?.uploadType,
760
- onChange: e?.onChange,
761
- testId: e?.testId,
762
- component: e?.component
763
- });
748
+ case MenuType.OPTION:
749
+ var l;
750
+ return /* @__PURE__ */ jsx(Option$2, {
751
+ actions: e == null ? void 0 : e.actions,
752
+ label: (l = e == null ? void 0 : e.label) == null ? "" : l,
753
+ url: e == null ? void 0 : e.url,
754
+ onClick: e == null ? void 0 : e.onClick,
755
+ description: e == null ? void 0 : e.description,
756
+ icon: e == null ? void 0 : e.icon,
757
+ selected: e == null ? void 0 : e.selected,
758
+ closeOnOptionClick: t,
759
+ close: n,
760
+ disabled: (e == null ? void 0 : e.disabled) || o,
761
+ inline: e == null ? void 0 : e.inline,
762
+ title: e == null ? void 0 : e.title,
763
+ upload: e == null ? void 0 : e.upload,
764
+ uploadType: e == null ? void 0 : e.uploadType,
765
+ onChange: e == null ? void 0 : e.onChange,
766
+ testId: e == null ? void 0 : e.testId,
767
+ component: e == null ? void 0 : e.component
768
+ });
764
769
  case MenuType.MENU:
765
- let s = !!e?.menu?.sections?.find((e) => e?.selected);
770
+ var u;
771
+ let s = !!(!(e == null || (u = e.menu) == null || (u = u.sections) == null) && u.find((e) => e == null ? void 0 : e.selected));
766
772
  return /* @__PURE__ */ jsx(DropDownMenu, {
767
773
  menu: e.menu,
768
774
  selected: s,
@@ -778,22 +784,23 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
778
784
  default: return null;
779
785
  }
780
786
  }, parentPath = (e) => e.includes("[") ? e.substr(0, e.lastIndexOf("[")) : e, childPath = (e, t) => `${e}.sections[${t}]`.replace(/^\./, ""), closePath = (e) => `${e}.close`.replace(/^\./, ""), siblings = (e, t) => get(e, parentPath(t), []), registerClose = (e, t, n) => set(e, closePath(t), n), Layer$2 = ({ sections: e, isNested: t, width: n, closeOnOptionClick: r, close: a = () => {}, tree: o, path: s, maxHeight: c, showAllButton: l, testId: u }) => {
787
+ var d, f;
781
788
  if (isValidElement(e)) return /* @__PURE__ */ jsx(Fragment$1, { children: e });
782
- let [d, f] = useState(!l?.visible), p = e, h = l?.additionalSections?.map((e) => ({
789
+ let [p, h] = useState(!(l != null && l.visible)), _ = e, v = (d = l == null || (f = l.additionalSections) == null ? void 0 : f.map((e) => ({
783
790
  ...e,
784
791
  closeOnOptionClick: r,
785
792
  visible: !0
786
- })) ?? [], _ = p.length > 4 ? [{
793
+ }))) == null ? [] : d, y = _.length > 4 ? [{
787
794
  type: MenuType.OPTION,
788
- label: d ? l?.showLessTitle || "Show less" : l?.showAllTitle || "Show all",
789
- onClick: () => f(!d),
795
+ label: p ? (l == null ? void 0 : l.showLessTitle) || "Show less" : (l == null ? void 0 : l.showAllTitle) || "Show all",
796
+ onClick: () => h(!p),
790
797
  visible: !0,
791
798
  closeOnOptionClick: !1
792
- }] : [], v = l?.visible ? p.map((e, t) => d || t <= 3 ? {
799
+ }] : [], b = l != null && l.visible ? _.map((e, t) => p || t <= 3 ? {
793
800
  ...e,
794
801
  visible: !0,
795
802
  closeOnOptionClick: r
796
- } : e).concat(_, h).filter((e) => e?.visible) : p.map((e) => ({
803
+ } : e).concat(y, v).filter((e) => e == null ? void 0 : e.visible) : _.map((e) => ({
797
804
  ...e,
798
805
  closeOnOptionClick: r
799
806
  }));
@@ -804,7 +811,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
804
811
  maxHeight: c
805
812
  },
806
813
  "data-testid": u,
807
- children: /* @__PURE__ */ jsx("ul", { children: v.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
814
+ children: /* @__PURE__ */ jsx("ul", { children: b.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
808
815
  section: e,
809
816
  closeOnOptionClick: e.closeOnOptionClick,
810
817
  close: a,
@@ -877,7 +884,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
877
884
  }, Text$1 = ({ label: e, title: t, carat: n, disabled: r, isOpen: i, selected: a }) => {
878
885
  let o;
879
886
  return t ? o = t : (typeof e == "string" || typeof e == "number") && (o = String(e)), /* @__PURE__ */ jsxs("div", {
880
- className: cx(menu_module_default.trigger, r ? menu_module_default.disabled : null, i ? menu_module_default.active : null, a ? menu_module_default?.selected : null),
887
+ className: cx(menu_module_default.trigger, r ? menu_module_default.disabled : null, i ? menu_module_default.active : null, a ? menu_module_default == null ? void 0 : menu_module_default.selected : null),
881
888
  children: [/* @__PURE__ */ jsx("span", {
882
889
  className: menu_module_default.label,
883
890
  title: o,
@@ -902,10 +909,10 @@ var TriggerTooltip = ({ tooltip: e, error: t, warning: n, children: r }) => !isS
902
909
  display: "inline-flex",
903
910
  children: r
904
911
  });
905
- const Trigger$1 = React.forwardRef(({ active: e, isDisabled: t, badgeTitle: n, badgeDot: r, loading: i, width: a, trigger: o, label: s, title: c, onClickTrigger: l, colored: u, small: d, isNested: f, contextMenu: p, component: m, groupOrder: h, fullHeight: g, isOpen: _, error: v, warning: y, tooltip: b, testId: x, selected: S, tabIndex: C,...w }, T) => {
912
+ const Trigger$1 = React.forwardRef(({ active: e, isDisabled: t, badgeTitle: n, badgeDot: r, loading: i, width: a, trigger: o, label: s, title: c, onClickTrigger: l, colored: u, small: d, isNested: f, contextMenu: p, component: m, groupOrder: h, fullHeight: g, isOpen: _, error: v, warning: y, tooltip: b, testId: x, selected: S, tabIndex: C, ...w }, T) => {
906
913
  let E = o === TriggerType.BUTTON || o === TriggerType.DROP_DOWN_BUTTON ? /* @__PURE__ */ jsx(Button$1, {
907
914
  trigger: o,
908
- label: s ?? "",
915
+ label: s == null ? "" : s,
909
916
  colored: u,
910
917
  small: d,
911
918
  width: a,
@@ -917,7 +924,7 @@ const Trigger$1 = React.forwardRef(({ active: e, isDisabled: t, badgeTitle: n, b
917
924
  active: _ || e,
918
925
  tabIndex: C
919
926
  }) : o === TriggerType.TEXT ? /* @__PURE__ */ jsx(Text$1, {
920
- label: s ?? "",
927
+ label: s == null ? "" : s,
921
928
  title: c,
922
929
  disabled: t,
923
930
  carat: p ? void 0 : f ? MenuCarat.RIGHT : MenuCarat.DOWN,
@@ -1111,12 +1118,13 @@ var SubmenuActions = (e) => {
1111
1118
  testId: i,
1112
1119
  tooltip: a
1113
1120
  });
1114
- if (t.length) {
1115
- let e = {
1116
- trigger: TriggerType.COMPONENT,
1117
- component: o,
1118
- sections: t.map((e) => ({
1119
- type: e.type ?? "Option",
1121
+ return t.length ? /* @__PURE__ */ jsx(Menu, { menu: {
1122
+ trigger: TriggerType.COMPONENT,
1123
+ component: o,
1124
+ sections: t.map((e) => {
1125
+ var t;
1126
+ return {
1127
+ type: (t = e.type) == null ? "Option" : t,
1120
1128
  label: e.label,
1121
1129
  icon: e.icon,
1122
1130
  testId: e.testId,
@@ -1125,18 +1133,16 @@ var SubmenuActions = (e) => {
1125
1133
  onClick: (t) => {
1126
1134
  t.stopPropagation(), t.preventDefault(), isFunction(e.onClick) && e.onClick(t);
1127
1135
  }
1128
- }))
1129
- };
1130
- return /* @__PURE__ */ jsx(Menu, { menu: e });
1131
- }
1132
- return null;
1136
+ };
1137
+ })
1138
+ } }) : null;
1133
1139
  };
1134
1140
  const Actions = (t) => {
1135
1141
  let n = useContext(DisabledContext), { actions: r = [], closeLayer: i } = t;
1136
1142
  return /* @__PURE__ */ jsx("div", {
1137
1143
  className: cx(actions_module_default.actions),
1138
1144
  children: r.map((t, r) => {
1139
- if (!(t?.hidden || !t || !Object.keys(t).length)) return t.childComponent && React.isValidElement(t.childComponent) ? /* @__PURE__ */ jsx("div", {
1145
+ if (!(t != null && t.hidden || !t || !Object.keys(t).length)) return t.childComponent && React.isValidElement(t.childComponent) ? /* @__PURE__ */ jsx("div", {
1140
1146
  "data-testid": t.testId,
1141
1147
  className: actions_module_default.childComponent,
1142
1148
  children: t.childComponent
@@ -1209,7 +1215,10 @@ var button_group_module_default = {
1209
1215
  const ButtonGroup = (e) => {
1210
1216
  let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId: c = void 0, disabled: l } = e, u = useContext(DisabledContext), d = (e, t, n, r, a) => {
1211
1217
  e.preventDefault(), e.stopPropagation(), !(l || a || u) && i(t, n, r);
1212
- }, f = (e, t) => t === "string" ? e : t === "object" ? e.label : t === "array" ? e[1] : null, p = (e, t) => t === "string" ? e : t === "object" ? e.value ?? "" : t === "array" ? e[0] ?? "" : "", m = (e, t, n) => t === "object" && "key" in e ? e.key : n, h = (e, t) => t === "object" ? e.hidden : !1, g = (e, t) => t === "object" ? e.icon : void 0, _ = (e, t, n) => e === "object" ? String(t) === String(o) : n === o, v = () => {
1218
+ }, f = (e, t) => t === "string" ? e : t === "object" ? e.label : t === "array" ? e[1] : null, p = (e, t) => {
1219
+ var n, r;
1220
+ return t === "string" ? e : t === "object" ? (n = e.value) == null ? "" : n : t === "array" ? (r = e[0]) == null ? "" : r : "";
1221
+ }, m = (e, t, n) => t === "object" && "key" in e ? e.key : n, h = (e, t) => t === "object" ? e.hidden : !1, g = (e, t) => t === "object" ? e.icon : void 0, _ = (e, t, n) => e === "object" ? String(t) === String(o) : n === o, v = () => {
1213
1222
  if (r) return /* @__PURE__ */ jsx("label", {
1214
1223
  className: button_group_module_default.label,
1215
1224
  children: r
@@ -1370,7 +1379,8 @@ var heading_module_default = {
1370
1379
  icons: "_icons_yhdiy_20"
1371
1380
  };
1372
1381
  const Heading = ({ children: e, helpText: t, onClick: n, onClickHelp: r, onIconClick: i, icon: a, libraryIcon: o, marginBottom: s, top: c = !1, testId: l }) => {
1373
- let u = !!t || !!r;
1382
+ var u;
1383
+ let d = !!t || !!r;
1374
1384
  return /* @__PURE__ */ jsxs("div", {
1375
1385
  className: cx(heading_module_default.heading, c ? heading_module_default.top : ""),
1376
1386
  style: { marginBottom: s },
@@ -1383,12 +1393,12 @@ const Heading = ({ children: e, helpText: t, onClick: n, onClickHelp: r, onIconC
1383
1393
  onClick: i,
1384
1394
  icon: a
1385
1395
  }),
1386
- u && /* @__PURE__ */ jsx(HelpIcon, {
1396
+ d && /* @__PURE__ */ jsx(HelpIcon, {
1387
1397
  text: t,
1388
1398
  onClick: r
1389
1399
  }),
1390
1400
  o && /* @__PURE__ */ jsx(HelpIcon, {
1391
- text: o?.tooltip ?? "",
1401
+ text: (u = o == null ? void 0 : o.tooltip) == null ? "" : u,
1392
1402
  onClick: o.onClick,
1393
1403
  icon: IconType.LIBRARY
1394
1404
  })
@@ -1418,7 +1428,7 @@ const Dialog = ({ dialog: e }) => {
1418
1428
  width: s,
1419
1429
  height: c
1420
1430
  },
1421
- "data-testid": u ?? null,
1431
+ "data-testid": u == null ? null : u,
1422
1432
  children: [
1423
1433
  /* @__PURE__ */ jsxs("div", {
1424
1434
  className: dialog_module_default.header,
@@ -1516,7 +1526,7 @@ const DrawerTabs = ({ tabs: e, activeTab: t, open: n, background: r, handleTabCl
1516
1526
  }, r);
1517
1527
  })] });
1518
1528
  var ResizeHandle = forwardRef((e, t) => {
1519
- let { handleAxis: n,...r } = e;
1529
+ let { handleAxis: n, ...r } = e;
1520
1530
  return /* @__PURE__ */ jsx("div", {
1521
1531
  ref: t,
1522
1532
  className: drawer_module_default.resizeHandle,
@@ -1525,7 +1535,7 @@ var ResizeHandle = forwardRef((e, t) => {
1525
1535
  });
1526
1536
  }), Resizable$1 = Resizable;
1527
1537
  const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1, onResize: r, setOpen: i, maxOpenWidth: a }) => {
1528
- let [o, s] = useState(!1), c = a ?? window.innerWidth / 2;
1538
+ let [o, s] = useState(!1), c = a == null ? window.innerWidth / 2 : a;
1529
1539
  return r ? /* @__PURE__ */ jsx(Resizable$1, {
1530
1540
  width: toNumber(t),
1531
1541
  height: 100,
@@ -1653,8 +1663,8 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
1653
1663
  ref: E,
1654
1664
  type: _ || "text",
1655
1665
  size: T || 20,
1656
- placeholder: o ?? "",
1657
- value: c ?? "",
1666
+ placeholder: o == null ? "" : o,
1667
+ value: c == null ? "" : c,
1658
1668
  onChange: a,
1659
1669
  onKeyPress: l,
1660
1670
  onKeyDown: p,
@@ -1697,13 +1707,19 @@ const readFile = (e = new Blob(), t = InputReaderMethods.READ_AS_TEXT) => {
1697
1707
  };
1698
1708
  var getName = (e, t) => {
1699
1709
  let n;
1700
- return e ? (n = t ? `Selected - ${Object.keys(e)?.length} files` : e?.name, n || null) : null;
1710
+ if (!e) return null;
1711
+ if (t) {
1712
+ var r;
1713
+ n = `Selected - ${(r = Object.keys(e)) == null ? void 0 : r.length} files`;
1714
+ } else n = e == null ? void 0 : e.name;
1715
+ return n || null;
1701
1716
  };
1702
1717
  const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name: c, width: l, onChange: u = noop, testId: d }) => {
1703
1718
  let f = useContext(DisabledContext), m = useRef(null), h = getName(i, o);
1704
1719
  return /* @__PURE__ */ jsxs("div", {
1705
1720
  onClick: () => {
1706
- r || f || m.current?.click();
1721
+ var e;
1722
+ r || f || (e = m.current) == null || e.click();
1707
1723
  },
1708
1724
  style: { width: l },
1709
1725
  children: [/* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(Input, {
@@ -1723,15 +1739,15 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
1723
1739
  accept: a,
1724
1740
  multiple: o,
1725
1741
  onChange: (e) => {
1726
- let { files: t } = e.target, n = o ? t ? [...t] : null : t?.[0], r = {
1742
+ let { files: t } = e.target, n = o ? t ? [...t] : null : t == null ? void 0 : t[0];
1743
+ u({
1727
1744
  ...e,
1728
1745
  target: {
1729
1746
  ...e.target,
1730
1747
  value: n,
1731
1748
  name: e.target.name
1732
1749
  }
1733
- };
1734
- u(r), m.current && (m.current.value = "");
1750
+ }), m.current && (m.current.value = "");
1735
1751
  },
1736
1752
  "data-testid": d
1737
1753
  })]
@@ -1745,8 +1761,9 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
1745
1761
  } }), useKeyboardEvent = (e, t, n = [], r) => {
1746
1762
  useEffect(() => {
1747
1763
  let n = (n) => {
1748
- let i = n?.key?.toLowerCase() === e?.toLowerCase(), a = r?.ctrl ?? !1, o = r?.meta ?? !1, s = n?.ctrlKey, c = n?.metaKey;
1749
- i && (!a && !o || a && s || o && c) && t();
1764
+ var i, a, o;
1765
+ let s = (n == null || (i = n.key) == null ? void 0 : i.toLowerCase()) === (e == null ? void 0 : e.toLowerCase()), c = (a = r == null ? void 0 : r.ctrl) == null ? !1 : a, l = (o = r == null ? void 0 : r.meta) == null ? !1 : o, u = n == null ? void 0 : n.ctrlKey, d = n == null ? void 0 : n.metaKey;
1766
+ s && (!c && !l || c && u || l && d) && t();
1750
1767
  };
1751
1768
  return window.addEventListener("keydown", n), () => {
1752
1769
  window.removeEventListener("keydown", n);
@@ -1852,13 +1869,13 @@ const ProgressBar = ({ width: e = "auto", inverted: t = !1, colored: n = !0, sho
1852
1869
  })]
1853
1870
  })
1854
1871
  });
1855
- var REQUEST_TIME = 4e4;
1872
+ var INTERVAL_TIME = 250, REQUEST_TIME = 4e4, FINISH_INTERVALS = 20, FINISH_TIME = 500;
1856
1873
  const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r, onComplete: i, onFailed: a, onError: o, width: s, heading: l, dialogText: u, fileInputText: d, fileInputPlaceholder: f, uploadText: p, cancelText: h, testId: g }) => {
1857
1874
  let [_, v] = useState(null), [y, b] = useState(!1), [x, S] = useState(0), C = 0, w = () => {
1858
- C += 250, S(C);
1875
+ C += INTERVAL_TIME, S(C);
1859
1876
  }, T = (e) => {
1860
1877
  let t = C + e;
1861
- t >= .99 * 4e4 && (t = REQUEST_TIME), C = t, S(C);
1878
+ t >= .99 * REQUEST_TIME && (t = REQUEST_TIME), C = t, S(C);
1862
1879
  };
1863
1880
  useEffect(() => {
1864
1881
  v(null);
@@ -1867,7 +1884,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
1867
1884
  e.target.value && v(e.target.value);
1868
1885
  }, D = async () => {
1869
1886
  S(0);
1870
- let n = setInterval(w, 250);
1887
+ let n = setInterval(w, INTERVAL_TIME);
1871
1888
  try {
1872
1889
  if (!_) return;
1873
1890
  b(!0);
@@ -1875,13 +1892,13 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
1875
1892
  if (!e) return;
1876
1893
  if (o) {
1877
1894
  clearInterval(n);
1878
- let e = setInterval(T, 500 / 20, (REQUEST_TIME - C) / 19);
1895
+ let e = setInterval(T, FINISH_TIME / FINISH_INTERVALS, (REQUEST_TIME - C) / (FINISH_INTERVALS - 1));
1879
1896
  setTimeout(() => {
1880
1897
  i(o), clearInterval(e), b(!1);
1881
- }, 500);
1882
- } else a?.(), b(!1);
1898
+ }, FINISH_TIME);
1899
+ } else a == null || a(), b(!1);
1883
1900
  } catch (e) {
1884
- o?.(e), b(!1);
1901
+ o == null || o(e), b(!1);
1885
1902
  } finally {
1886
1903
  clearInterval(n);
1887
1904
  }
@@ -1900,7 +1917,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
1900
1917
  testId: `${g}-file-input`,
1901
1918
  accept: "image/*"
1902
1919
  }),
1903
- y && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Spacer, {}), /* @__PURE__ */ jsx(ProgressBar, { percentage: roundByMagnitudeToFixed(100 * x / 4e4, 3) })] })
1920
+ y && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Spacer, {}), /* @__PURE__ */ jsx(ProgressBar, { percentage: roundByMagnitudeToFixed(100 * x / REQUEST_TIME, 3) })] })
1904
1921
  ] }), j = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
1905
1922
  label: p || "Upload",
1906
1923
  colored: !0,
@@ -2152,15 +2169,15 @@ var footer_module_default = {
2152
2169
  groupOrderLast: "_groupOrderLast_sl2b5_198"
2153
2170
  };
2154
2171
  const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, tooltip: r = null, options: i, onChange: a = noop, onFocus: o = noop, onBlur: c = noop, right: l = !1, small: u = !1, tabIndex: d = 0, selectedOption: f, width: p = null, groupOrder: m, testId: h, isInTable: _ = !1, clearable: v, placeholder: y, hasNonExistentValue: b, maxTooltipWidth: x, borderRadius: S }) => {
2155
- let C = useContext(DisabledContext), w = f === null || f?.value === null ? "unselected" : f?.value, T = w === "unselected", E = (w === "unselected" || v ? [/* @__PURE__ */ jsx("option", {
2172
+ let C = useContext(DisabledContext), w = f === null || (f == null ? void 0 : f.value) === null ? "unselected" : f == null ? void 0 : f.value, T = w === "unselected", E = (w === "unselected" || v ? [/* @__PURE__ */ jsx("option", {
2156
2173
  value: "unselected",
2157
2174
  disabled: !v,
2158
2175
  hidden: !v,
2159
2176
  children: y || "Select..."
2160
2177
  }, "unselected")] : []).concat(b ? [/* @__PURE__ */ jsx("option", {
2161
- value: f?.value,
2178
+ value: f == null ? void 0 : f.value,
2162
2179
  disabled: e || C,
2163
- children: f?.label
2180
+ children: f == null ? void 0 : f.label
2164
2181
  }, "selectedNonExistentValue")] : []).concat(i.map((e, t) => /* @__PURE__ */ jsx("option", {
2165
2182
  value: e.value,
2166
2183
  "data-testid": e.testId,
@@ -2247,7 +2264,7 @@ const Heading$2 = ({ label: e }) => /* @__PURE__ */ jsx("div", {
2247
2264
  className: custom_select_module_default.heading,
2248
2265
  children: e
2249
2266
  }), Option$1 = ({ details: e, label: t, icon: n, disabled: r = !1, selected: i = !1, focused: a = !1, onSelectOption: o, actions: s, closeLayer: c, testId: l }) => /* @__PURE__ */ jsxs("div", {
2250
- className: cx(custom_select_module_default.option, r ? custom_select_module_default.disabled : "", i ? custom_select_module_default?.selected : "", a ? custom_select_module_default.focused : ""),
2267
+ className: cx(custom_select_module_default.option, r ? custom_select_module_default.disabled : "", i ? custom_select_module_default == null ? void 0 : custom_select_module_default.selected : "", a ? custom_select_module_default.focused : ""),
2251
2268
  onClick: !r && o ? o : void 0,
2252
2269
  "data-testid": l,
2253
2270
  children: [
@@ -2269,7 +2286,7 @@ const Heading$2 = ({ label: e }) => /* @__PURE__ */ jsx("div", {
2269
2286
  children: e
2270
2287
  })
2271
2288
  }),
2272
- !!s?.length && /* @__PURE__ */ jsx("div", {
2289
+ !!(s != null && s.length) && /* @__PURE__ */ jsx("div", {
2273
2290
  className: cx(custom_select_module_default.actions),
2274
2291
  children: /* @__PURE__ */ jsx(Actions, {
2275
2292
  actions: s,
@@ -2303,15 +2320,16 @@ const Heading$2 = ({ label: e }) => /* @__PURE__ */ jsx("div", {
2303
2320
  let n = document.createElement("canvas").getContext("2d");
2304
2321
  return n ? (n.font = t, n.measureText(e).width) : 0;
2305
2322
  };
2306
- var FONT_SIZE = "13px", FONT_SIZE_SMALL = "12px", FONT_FAMILY = "Roobert", FONT_FAMILY_FALLBACK = "sans-serif", getFont = (e = !1, t = !1) => `${e ? FONT_SIZE_SMALL : FONT_SIZE} ${t ? FONT_FAMILY : FONT_FAMILY_FALLBACK}`, getExtraOptionWidth = (e = !1, t = !1) => (e ? 8 : 12) + (e ? 24 : 30) + (t ? 17 : 0);
2323
+ var FONT_SIZE = "13px", FONT_SIZE_SMALL = "12px", FONT_FAMILY = "Roobert", FONT_FAMILY_FALLBACK = "sans-serif", PADDING = 12, PADDING_SMALL = 8, TOGGLE_SIZE = 30, TOGGLE_SIZE_SMALL = 24, TAG_PADDING = 5, TAG_PADDING_SMALL = 3, TAG_BORDER_WIDTH = 1, TAG_MARGIN = 2, getFont = (e = !1, t = !1) => `${e ? FONT_SIZE_SMALL : FONT_SIZE} ${t ? FONT_FAMILY : FONT_FAMILY_FALLBACK}`, getExtraOptionWidth = (e = !1, t = !1) => (e ? PADDING_SMALL : PADDING) + (e ? TOGGLE_SIZE_SMALL : TOGGLE_SIZE) + (t ? 17 : 0);
2307
2324
  const getWidestOptionWidth = (e, t, n, r) => {
2308
- let i = getFont(t, n), a = r ? getTextWidth(r, i) : 0, o = Math.ceil(e.reduce((e, n) => {
2309
- let r = (n?.actions?.length ?? 0) * 24, a = n.icon ? (t ? parseInt(FONT_SIZE_SMALL) : parseInt(FONT_SIZE)) + 7 : 0, o = `${n.label} ${n.details || ""}`, s = getTextWidth(o, i) + r + a;
2310
- return e = s > e ? s : e, e;
2311
- }, a)), s = getExtraOptionWidth(t, !0);
2312
- return o + s;
2325
+ let i = getFont(t, n), a = r ? getTextWidth(r, i) : 0;
2326
+ return Math.ceil(e.reduce((e, n) => {
2327
+ var r, a;
2328
+ let o = ((r = n == null || (a = n.actions) == null ? void 0 : a.length) == null ? 0 : r) * 24, s = n.icon ? (t ? parseInt(FONT_SIZE_SMALL) : parseInt(FONT_SIZE)) + 7 : 0, c = getTextWidth(`${n.label} ${n.details || ""}`, i) + o + s;
2329
+ return e = c > e ? c : e, e;
2330
+ }, a)) + getExtraOptionWidth(t, !0);
2313
2331
  }, getMultiOptionWidth = (e, t, n) => {
2314
- let r = getFont(!0, n), i = getTextWidth(e.label, r), a = (t ? 3 : 5) * 2 + 2 + 2;
2332
+ let r = getFont(!0, n), i = getTextWidth(e.label, r), a = (t ? TAG_PADDING_SMALL : TAG_PADDING) * 2 + TAG_BORDER_WIDTH * 2 + TAG_MARGIN;
2315
2333
  return Math.ceil(i + a);
2316
2334
  };
2317
2335
  var List$1 = FixedSizeList;
@@ -2329,16 +2347,22 @@ const Layer$1 = ({ listRef: e, isMulti: t, sections: n, selectedOptions: r, onSe
2329
2347
  itemCount: n.length,
2330
2348
  itemSize: f,
2331
2349
  width: o,
2332
- children: ({ index: e, style: o }) => /* @__PURE__ */ jsx("div", {
2333
- style: o,
2334
- children: /* @__PURE__ */ jsx(Section, {
2335
- closeLayer: u,
2336
- section: n[e],
2337
- selected: t && n[e].type !== MenuType.HEADING && Array.isArray(r) ? r?.some((t) => t && t?.value === n?.[e]?.value) : !Array.isArray(r) && n?.[e]?.value === r?.value,
2338
- focused: a === e,
2339
- onSelectOption: (t) => i(t, n[e])
2340
- })
2341
- })
2350
+ children: ({ index: e, style: o }) => {
2351
+ var s;
2352
+ return /* @__PURE__ */ jsx("div", {
2353
+ style: o,
2354
+ children: /* @__PURE__ */ jsx(Section, {
2355
+ closeLayer: u,
2356
+ section: n[e],
2357
+ selected: t && n[e].type !== MenuType.HEADING && Array.isArray(r) ? r == null ? void 0 : r.some((t) => {
2358
+ var r;
2359
+ return t && (t == null ? void 0 : t.value) === (n == null || (r = n[e]) == null ? void 0 : r.value);
2360
+ }) : !Array.isArray(r) && (n == null || (s = n[e]) == null ? void 0 : s.value) === (r == null ? void 0 : r.value),
2361
+ focused: a === e,
2362
+ onSelectOption: (t) => i(t, n[e])
2363
+ })
2364
+ });
2365
+ }
2342
2366
  }) : /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("div", {
2343
2367
  className: custom_select_module_default.message,
2344
2368
  style: { width: o },
@@ -2415,17 +2439,17 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
2415
2439
  selectedOptions: e,
2416
2440
  small: s,
2417
2441
  width: (() => {
2418
- let e = l.current?.offsetWidth || 0, t = i.current?.offsetWidth || 0;
2419
- return e - t;
2442
+ var e, t;
2443
+ return (((e = l.current) == null ? void 0 : e.offsetWidth) || 0) - (((t = i.current) == null ? void 0 : t.offsetWidth) || 0);
2420
2444
  })(),
2421
2445
  testId: c
2422
2446
  }) : /* @__PURE__ */ jsx("span", {
2423
2447
  className: trigger_module_default.selectedSingleValue,
2424
2448
  "data-testid": c && `${c}-value`,
2425
- children: n?.length ? "" : e?.label
2449
+ children: n != null && n.length ? "" : e == null ? void 0 : e.label
2426
2450
  }) : /* @__PURE__ */ jsx("span", {
2427
2451
  className: trigger_module_default.placeHolder,
2428
- children: n?.length ? "" : o
2452
+ children: n != null && n.length ? "" : o
2429
2453
  }), t ? /* @__PURE__ */ jsx("input", {
2430
2454
  tabIndex: -1,
2431
2455
  ref: i,
@@ -2438,14 +2462,15 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
2438
2462
  }) : null]
2439
2463
  });
2440
2464
  }, Trigger = ({ selectedOptions: e, searchValue: t, searchable: n, clearable: r, onClickTrigger: i, element: a, error: o, warning: s, tooltip: c, small: l, isInTable: u, disabled: d, onChangeSearch: f, onClickDeselect: p, onClickClear: m, tabIndex: h, isOpen: _, triggerRef: v, clearAllIsFocused: y, focusedSelectedOptionIndex: b, onFocus: x, onBlur: S, groupOrder: C, maxTooltipWidth: w, placeholder: T, right: E, testId: D }) => {
2441
- let [O, k] = useFocus(), A = Array.isArray(e) ? e.length > 0 && e[0]?.value : e?.value, j = r && A, M = (() => {
2465
+ var O;
2466
+ let [k, A] = useFocus(), j = Array.isArray(e) ? e.length > 0 && ((O = e[0]) == null ? void 0 : O.value) : e == null ? void 0 : e.value, M = r && j, N = (() => {
2442
2467
  if (C) switch (C) {
2443
2468
  case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
2444
2469
  case GroupOrder.LAST: return trigger_module_default.groupOrderLast;
2445
2470
  default: return trigger_module_default.groupOrderMiddle;
2446
2471
  }
2447
2472
  return "";
2448
- })(), N = !Array.isArray(e) && e?.details ? {
2473
+ })(), P = !Array.isArray(e) && e != null && e.details ? {
2449
2474
  ...e,
2450
2475
  label: /* @__PURE__ */ jsxs("div", {
2451
2476
  className: cx(trigger_module_default.detailedLabel),
@@ -2454,13 +2479,13 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
2454
2479
  children: e.details
2455
2480
  })]
2456
2481
  })
2457
- } : e, P = /* @__PURE__ */ jsxs(Fragment$1, { children: [a, /* @__PURE__ */ jsxs("div", {
2482
+ } : e, F = /* @__PURE__ */ jsxs(Fragment$1, { children: [a, /* @__PURE__ */ jsxs("div", {
2458
2483
  ref: v,
2459
2484
  tabIndex: h,
2460
- className: cx(trigger_module_default.trigger, _ ? trigger_module_default.isOpen : "", d ? trigger_module_default.disabled : "", l ? trigger_module_default.small : "", u ? trigger_module_default.isInTable : "", E ? trigger_module_default.right : "", M),
2485
+ className: cx(trigger_module_default.trigger, _ ? trigger_module_default.isOpen : "", d ? trigger_module_default.disabled : "", l ? trigger_module_default.small : "", u ? trigger_module_default.isInTable : "", E ? trigger_module_default.right : "", N),
2461
2486
  onClick: (e) => {
2462
2487
  e.stopPropagation(), requestAnimationFrame(() => {
2463
- i(e), typeof k == "function" && k();
2488
+ i(e), typeof A == "function" && A();
2464
2489
  });
2465
2490
  },
2466
2491
  onFocus: x,
@@ -2469,18 +2494,18 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
2469
2494
  "data-warning": s || null,
2470
2495
  "data-testid": D,
2471
2496
  children: [/* @__PURE__ */ jsx(Input$1, {
2472
- selectedOptions: N,
2497
+ selectedOptions: P,
2473
2498
  placeholder: T,
2474
2499
  searchable: n,
2475
2500
  searchValue: t,
2476
- inputRef: O,
2501
+ inputRef: k,
2477
2502
  onChange: f,
2478
2503
  error: o,
2479
2504
  small: l,
2480
2505
  testId: D
2481
2506
  }), /* @__PURE__ */ jsx("span", {
2482
2507
  className: trigger_module_default.icons,
2483
- children: j ? /* @__PURE__ */ jsx("span", {
2508
+ children: M ? /* @__PURE__ */ jsx("span", {
2484
2509
  className: cx(trigger_module_default.clearAll, y ? trigger_module_default.focus : ""),
2485
2510
  onClick: (e) => {
2486
2511
  e.stopPropagation(), m && m(e);
@@ -2499,7 +2524,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
2499
2524
  text: c || o || s,
2500
2525
  enabled: c && isStringNumberOrNode(c) || o && isStringNumberOrNode(o) || s && isStringNumberOrNode(s) || !1,
2501
2526
  maxWidth: w,
2502
- children: P
2527
+ children: F
2503
2528
  }) });
2504
2529
  };
2505
2530
  let ReducerAction = /* @__PURE__ */ function(e) {
@@ -2609,16 +2634,17 @@ let ActionTypes = /* @__PURE__ */ function(e) {
2609
2634
  return e.RIGHT = "ArrowRight", e.LEFT = "ArrowLeft", e.UP = "ArrowUp", e.DOWN = "ArrowDown", e.ENTER = "Enter", e.ESC = "Escape", e.TAB = "Tab", e;
2610
2635
  }({});
2611
2636
  const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFocus: r, disabled: i, disabledContext: a, onCreate: s, onChange: l, selectedOptions: u, width: d, small: f, isFontLoaded: m, placeholder: h, firstSelectedOptionIndex: g, createAble: _, listRef: v, autoLayerWidth: y }) => {
2612
- let b = () => {
2637
+ var b;
2638
+ let x = () => {
2613
2639
  e.isLayerOpen && t({ type: ActionTypes.CLOSE_LAYER }), r();
2614
- }, x = () => t({ type: ActionTypes.OPEN_LAYER }), S = useRef(!0);
2640
+ }, S = () => t({ type: ActionTypes.OPEN_LAYER }), C = useRef(!0);
2615
2641
  useEffect(() => {
2616
- S.current ? S.current = !1 : t({
2642
+ C.current ? C.current = !1 : t({
2617
2643
  type: ActionTypes.SET_VISIBLE_OPTIONS,
2618
2644
  options: n
2619
2645
  });
2620
2646
  }, [n]);
2621
- let C = (e, o, c) => {
2647
+ let w = (e, o, c) => {
2622
2648
  if (!(i || a)) {
2623
2649
  if (c && c(), o) {
2624
2650
  if (o.createAble && s) s(o.value);
@@ -2632,85 +2658,86 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2632
2658
  options: n
2633
2659
  }), r();
2634
2660
  }
2635
- }, w = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f, m, h) : d : "100%", [n, m]), T = useCallback((e) => y ? Math.max(getWidestOptionWidth(n, f, m, h), e?.width) : e?.width, [n, m]), { renderLayer: E, layerProps: D, triggerProps: O, triggerBounds: k } = useLayer({
2636
- isOpen: e?.isLayerOpen ?? !1,
2661
+ }, T = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f, m, h) : d : "100%", [n, m]), E = useCallback((e) => y ? Math.max(getWidestOptionWidth(n, f, m, h), e == null ? void 0 : e.width) : e == null ? void 0 : e.width, [n, m]), { renderLayer: D, layerProps: O, triggerProps: k, triggerBounds: A } = useLayer({
2662
+ isOpen: (b = e == null ? void 0 : e.isLayerOpen) == null ? !1 : b,
2637
2663
  overflowContainer: !0,
2638
2664
  ...placementOptions,
2639
2665
  ResizeObserver,
2640
- onOutsideClick: b,
2641
- onParentClose: b
2642
- }), A = () => {
2666
+ onOutsideClick: x,
2667
+ onParentClose: x
2668
+ }), j = () => {
2643
2669
  if (!(i || a)) {
2644
2670
  if (e.isLayerOpen) {
2645
- b();
2671
+ x();
2646
2672
  return;
2647
2673
  }
2648
2674
  r(), t({
2649
2675
  type: ActionTypes.RESET_LAYER_FOCUS,
2650
2676
  options: n,
2651
2677
  firstSelectedOptionIndex: g
2652
- }), x();
2678
+ }), S();
2653
2679
  }
2654
- }, j = useRef(!0);
2680
+ }, M = useRef(!0);
2655
2681
  useEffect(() => {
2656
- j.current ? j.current = !1 : e.isLayerOpen || t({
2682
+ M.current ? M.current = !1 : e.isLayerOpen || t({
2657
2683
  type: ActionTypes.CLEAR_SEARCH,
2658
2684
  options: n
2659
2685
  });
2660
2686
  }, [e.isLayerOpen]);
2661
- let M = (e, t) => {
2687
+ let N = (e, t) => {
2662
2688
  let n = u instanceof Array ? u.filter((e) => e.value !== t.value) : null;
2663
2689
  l && l(e, n);
2664
- }, N = (e) => {
2690
+ }, P = (e) => {
2665
2691
  let t = u instanceof Array ? [] : { value: null };
2666
2692
  l && l(e, t);
2667
- }, P = (e) => t({
2693
+ }, F = (e) => t({
2668
2694
  type: ActionTypes.ON_CHANGE_SEARCH,
2669
2695
  options: n,
2670
2696
  value: e,
2671
2697
  createAble: _
2672
- }), F = () => {
2673
- x(), t({ type: ActionTypes.BLUR_TRIGGER_INPUTS });
2674
- }, I = (e) => {
2698
+ }), I = () => {
2699
+ S(), t({ type: ActionTypes.BLUR_TRIGGER_INPUTS });
2700
+ }, L = (e) => {
2675
2701
  v.current && Number.isInteger(e) && v.current.scrollToItem(e);
2676
- }, L = (n) => {
2702
+ }, R = (n) => {
2677
2703
  let r = nextLayerFocus(n, e.layerFocus);
2678
2704
  t({
2679
2705
  type: ActionTypes.FOCUS_LAYER_OPTIONS,
2680
2706
  nextLayerFocus: r
2681
- }), I(r.current);
2682
- }, R = (e) => {
2707
+ }), L(r.current);
2708
+ }, z = (e) => {
2683
2709
  t({
2684
2710
  type: ActionTypes.FOCUS_TRIGGER_INPUTS,
2685
2711
  ICustomSelectDirection: e,
2686
2712
  selectedOptions: u
2687
2713
  });
2688
- }, z = (e) => N(e), B = u && u[e.triggerFocus.currentOption], V = (t) => {
2689
- M(t, u[e.triggerFocus.currentOption]);
2690
- }, H = (t) => {
2691
- C(t, e?.visibleOptions?.[e.layerFocus.current], b);
2692
- }, U = e.triggerFocus.clearAll;
2714
+ }, B = (e) => P(e), V = u && u[e.triggerFocus.currentOption], H = (t) => {
2715
+ N(t, u[e.triggerFocus.currentOption]);
2716
+ }, U = (t) => {
2717
+ var n;
2718
+ w(t, e == null || (n = e.visibleOptions) == null ? void 0 : n[e.layerFocus.current], x);
2719
+ }, W = e.triggerFocus.clearAll;
2693
2720
  return {
2694
- getTriggerWidth: w,
2721
+ getTriggerWidth: T,
2695
2722
  onKeyEvent: (n, r) => {
2696
2723
  switch (n) {
2697
2724
  case EventKey.UP:
2698
- L("up");
2725
+ R("up");
2699
2726
  break;
2700
2727
  case EventKey.DOWN:
2701
- e.isLayerOpen ? L("down") : F();
2728
+ e.isLayerOpen ? R("down") : I();
2702
2729
  break;
2703
2730
  case EventKey.LEFT:
2704
- R("left");
2731
+ z("left");
2705
2732
  break;
2706
2733
  case EventKey.RIGHT:
2707
- R("right");
2734
+ z("right");
2708
2735
  break;
2709
2736
  case EventKey.ENTER:
2710
- U ? z(r) : B ? V(r) : H(r);
2737
+ W ? B(r) : V ? H(r) : U(r);
2711
2738
  break;
2712
2739
  case EventKey.ESC:
2713
- b();
2740
+ x();
2714
2741
  break;
2715
2742
  case EventKey.TAB:
2716
2743
  t({ type: ActionTypes.CLOSE_LAYER });
@@ -2718,18 +2745,18 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2718
2745
  default:
2719
2746
  }
2720
2747
  },
2721
- clearAllIsFocused: U,
2722
- triggerProps: O,
2723
- onClickTrigger: A,
2724
- onChangeSearch: P,
2725
- onClickDeselectOption: M,
2726
- onClickClearAll: N,
2727
- renderLayer: E,
2728
- layerProps: D,
2729
- closeLayer: b,
2730
- onSelectOption: C,
2731
- getLayerWidth: T,
2732
- triggerBounds: k
2748
+ clearAllIsFocused: W,
2749
+ triggerProps: k,
2750
+ onClickTrigger: j,
2751
+ onChangeSearch: F,
2752
+ onClickDeselectOption: N,
2753
+ onClickClearAll: P,
2754
+ renderLayer: D,
2755
+ layerProps: O,
2756
+ closeLayer: x,
2757
+ onSelectOption: w,
2758
+ getLayerWidth: E,
2759
+ triggerBounds: A
2733
2760
  };
2734
2761
  }, CustomSelect = (e) => {
2735
2762
  let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions: c, onCreate: l = null, placeholder: u = "", small: d = !1, tabIndex: m = 0, onFocus: h = () => {}, onBlur: g = () => {}, searchable: _ = !0, clearable: v = !1, maxTooltipWidth: y, closeOnOptionActionClick: b, isInTable: x = !1, groupOrder: S, firstSelectedOptionIndex: C = 0, right: w = !1, testId: T = void 0 } = e, E = useContext(DisabledContext), D = l !== null, O = useRef(null), k = useRef(null), [A, j] = useFocus(), M = useFontsReady(), [N, P] = useReducer(reducer, {
@@ -2738,10 +2765,10 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2738
2765
  }, ({ options: e }) => ({
2739
2766
  searchValue: "",
2740
2767
  visibleOptions: e,
2741
- layerFocus: initialLayerFocus(e, C ?? 0),
2768
+ layerFocus: initialLayerFocus(e, C == null ? 0 : C),
2742
2769
  triggerFocus: initialTriggerFocus,
2743
2770
  isLayerOpen: !1
2744
- })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Rd } = useCustomSelectLogic({
2771
+ })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: J } = useCustomSelectLogic({
2745
2772
  ...e,
2746
2773
  state: N,
2747
2774
  dispatch: P,
@@ -2809,10 +2836,10 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2809
2836
  closeLayer: () => {
2810
2837
  b && G();
2811
2838
  },
2812
- width: q(Rd),
2839
+ width: q(J),
2813
2840
  small: d,
2814
2841
  focusedOptionIndex: N.layerFocus.current,
2815
- firstSelectedOptionIndex: C ?? 0,
2842
+ firstSelectedOptionIndex: C == null ? 0 : C,
2816
2843
  testId: T && `${T}-layer`
2817
2844
  })
2818
2845
  })) })
@@ -2833,15 +2860,18 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2833
2860
  }, standardizeSelectedOptions = (e, t) => isMulti(t) ? t.map((t) => standardizeSelectedOption(e, t)).filter((e) => e !== void 0) : t === null ? void 0 : standardizeSelectedOption(e, t), isSimpleOptions = (e) => Array.isArray(e) && e.some((e) => typeof e == "string" || typeof e == "number"), getFirstSelectedOptionIndex = (e, t) => {
2834
2861
  let n = t instanceof Array ? t.length ? t[0] : null : t, r = n == null ? null : typeof n == "string" || typeof n == "number" || typeof n == "boolean" ? n : n.value, i = e.filter((e) => e.type !== MenuType.HEADING).findIndex((e) => typeof e == "string" || typeof e == "number" ? e == r : e.value == r);
2835
2862
  return i === -1 ? null : i;
2836
- }, nonExistentValue = (e, t) => !(isMulti(t) ? t : isEmptyNullOrUndefined(t) ? [] : [t])?.every((t) => e?.find((e) => e?.value === t?.value) !== void 0), standardizeInputs = (e, t, n, r) => {
2837
- let i = Array.isArray(e) ? e : [], a = isMulti(t), o = isSimpleOptions(i), s = standardizeOptions(i, o), c = n ? getFirstSelectedOptionIndex(i, t) : null, l = standardizeSelectedOptions(s, t), u = r && l !== void 0 ? nonExistentValue(s, l) : !1;
2863
+ }, nonExistentValue = (e, t) => {
2864
+ let n = isMulti(t) ? t : isEmptyNullOrUndefined(t) ? [] : [t];
2865
+ return !(n != null && n.every((t) => (e == null ? void 0 : e.find((e) => (e == null ? void 0 : e.value) === (t == null ? void 0 : t.value))) !== void 0));
2866
+ }, standardizeInputs = (e, t, n, r) => {
2867
+ let i = Array.isArray(e) ? e : [], a = isMulti(t), o = isSimpleOptions(i), s = standardizeOptions(i, o), c = n ? getFirstSelectedOptionIndex(i, t) : null, l = standardizeSelectedOptions(s, t);
2838
2868
  return {
2839
2869
  options: s,
2840
2870
  selectedOptions: l,
2841
2871
  multi: a,
2842
2872
  simpleInputs: o,
2843
2873
  firstSelectedOptionIndex: c,
2844
- hasNonExistentValue: u
2874
+ hasNonExistentValue: r && l !== void 0 ? nonExistentValue(s, l) : !1
2845
2875
  };
2846
2876
  }, Select = (e) => {
2847
2877
  let { name: t = "", options: n = [], value: r, native: i = !1, onChange: a = noop, deprecatedEventHandler: o = !1, autoScroll: s = !0, warning: c, error: l, checkNonExistentValues: u = !0, closeOnOptionActionClick: d = !0, testId: f, disabled: p } = e, { multi: m, simpleInputs: h, options: g, selectedOptions: _, firstSelectedOptionIndex: v, hasNonExistentValue: y } = standardizeInputs(n, r, !i && s === !0, u), b = !m, x = i && b;
@@ -2852,19 +2882,15 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2852
2882
  e && a(e);
2853
2883
  } else {
2854
2884
  let r = !(e instanceof Event), i = m ? n : n.value;
2855
- if (r) e.target.name = t, e.target.value = i, m || (e.target.label = n.label), a(e);
2856
- else {
2857
- let r = {
2858
- ...e,
2859
- target: {
2860
- ...e.target,
2861
- name: t,
2862
- value: i,
2863
- label: m ? void 0 : n.label
2864
- }
2865
- };
2866
- a(r);
2867
- }
2885
+ r ? (e.target.name = t, e.target.value = i, m || (e.target.label = n.label), a(e)) : a({
2886
+ ...e,
2887
+ target: {
2888
+ ...e.target,
2889
+ name: t,
2890
+ value: i,
2891
+ label: m ? void 0 : n.label
2892
+ }
2893
+ });
2868
2894
  }
2869
2895
  };
2870
2896
  return x ? /* @__PURE__ */ jsx(NativeSelect, {
@@ -2888,7 +2914,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2888
2914
  testId: f,
2889
2915
  closeOnOptionActionClick: d
2890
2916
  });
2891
- }, selectedRowsPerPage = (e, t) => t || e && e.reduce((e, t) => t?.selected ? Number(t?.value) : e, 10) || 10, numberOfPages = (e, t) => {
2917
+ }, selectedRowsPerPage = (e, t) => t || e && e.reduce((e, t) => t != null && t.selected ? Number(t == null ? void 0 : t.value) : e, 10) || 10, numberOfPages = (e, t) => {
2892
2918
  if (!t || !e) return 10;
2893
2919
  let { options: n, value: r } = t, i = Number(r);
2894
2920
  return i === 0 ? 1 : Math.ceil(e / selectedRowsPerPage(n, i));
@@ -2923,7 +2949,7 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
2923
2949
  children: e
2924
2950
  });
2925
2951
  }, Pagination = ({ pagination: e }) => {
2926
- let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e, l = Number(a?.value) === 0, u = numberOfPages(t, a), [d, f] = useState(String(n));
2952
+ let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e, l = Number(a == null ? void 0 : a.value) === 0, u = numberOfPages(t, a), [d, f] = useState(String(n));
2927
2953
  useEffect(() => {
2928
2954
  f(String(n));
2929
2955
  }, [n]);
@@ -2991,21 +3017,22 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
2991
3017
  icon: IconType.CHEVRON_DOUBLE_RIGHT,
2992
3018
  onClick: () => h(String(u)),
2993
3019
  disabled: l || n === u,
2994
- testId: s?.doubleRightBtn
3020
+ testId: s == null ? void 0 : s.doubleRightBtn
2995
3021
  })
2996
3022
  ]
2997
3023
  });
2998
3024
  }, Footer = ({ colSpan: e, pagination: t, actions: n, content: r, testId: i }) => {
2999
3025
  let a = n && n.length, o = r != null, s = () => {
3000
3026
  if (t) {
3001
- let { rowCount: e, rowsPerPage: n } = t, r = Number(n?.options?.[0]?.value);
3002
- return e > r;
3027
+ var e;
3028
+ let { rowCount: n, rowsPerPage: r } = t;
3029
+ return n > Number(r == null || (e = r.options) == null || (e = e[0]) == null ? void 0 : e.value);
3003
3030
  }
3004
3031
  return !1;
3005
3032
  };
3006
3033
  return a || o || s() ? /* @__PURE__ */ jsxs("div", {
3007
3034
  className: footer_module_default.footer,
3008
- "data-testid": `${i ?? "pagination"}-footer`,
3035
+ "data-testid": `${i == null ? "pagination" : i}-footer`,
3009
3036
  children: [o ? /* @__PURE__ */ jsx("div", {
3010
3037
  className: footer_module_default.section,
3011
3038
  children: /* @__PURE__ */ jsx("div", { children: r })
@@ -3093,10 +3120,16 @@ var cell_module_default = {
3093
3120
  const InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => /* @__PURE__ */ jsx(Input, {
3094
3121
  name: e.name,
3095
3122
  value: e.value,
3096
- onChange: (t) => e.onChange?.(t),
3123
+ onChange: (t) => {
3124
+ var n;
3125
+ return (n = e.onChange) == null ? void 0 : n.call(e, t);
3126
+ },
3097
3127
  onFocus: e.onFocus,
3098
3128
  onBlur: e.onBlur,
3099
- onPaste: (t) => e.onPaste?.(t),
3129
+ onPaste: (t) => {
3130
+ var n;
3131
+ return (n = e.onPaste) == null ? void 0 : n.call(e, t);
3132
+ },
3100
3133
  placeholder: e.placeholder,
3101
3134
  error: e.error,
3102
3135
  warning: e.warning,
@@ -3109,7 +3142,9 @@ const InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => /* @_
3109
3142
  tabIndex: e.disabled ? -1 : 0,
3110
3143
  tooltip: e.tooltip,
3111
3144
  type: r
3112
- }), safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
3145
+ });
3146
+ var COSMETIC_ROUNDING_DEFAULT_PRECISION = 14;
3147
+ const safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), COSMETIC_ROUNDING_DEFAULT_PRECISION));
3113
3148
  var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
3114
3149
  const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f = !0, tabIndex: h = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
3115
3150
  let O = (e) => {
@@ -3123,8 +3158,9 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
3123
3158
  errors: void 0
3124
3159
  } : n;
3125
3160
  }, k = (e) => {
3126
- let t = !!e?.endsWith("0"), n = C && e && !t && O(e)?.valid ? roundNumberCosmetic(e) : e;
3127
- return safeToString(n);
3161
+ var t;
3162
+ let n = !!(e != null && e.endsWith("0"));
3163
+ return safeToString(C && e && !n && (t = O(e)) != null && t.valid ? roundNumberCosmetic(e) : e);
3128
3164
  }, A = useRef(null), [j, M] = useState(k(safeToString(s))), [N, P] = useState(!1), F = getStringName$1(e), { valid: I, errors: L } = O(j), R = L && L.length && !E ? L[0] : null;
3129
3165
  useEffect(() => {
3130
3166
  let e = k(safeToString(s));
@@ -3141,43 +3177,39 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
3141
3177
  r
3142
3178
  ]);
3143
3179
  let z = (e) => {
3144
- let n = "key" in e ? j : e?.target?.value, r = cleanNumStr(n.replaceAll(" ", "").replaceAll("|", ""));
3145
- if (M(r), O(r)?.valid || t && isEmptyNullOrUndefined(n)) {
3146
- let t = {
3147
- ...e,
3148
- target: {
3149
- ...e.target,
3150
- value: stripLeadingZeros(safeToString(r)),
3151
- name: F
3152
- }
3153
- };
3154
- l(t);
3155
- }
3180
+ var n, r;
3181
+ let i = "key" in e ? j : e == null || (n = e.target) == null ? void 0 : n.value, a = cleanNumStr(i.replaceAll(" ", "").replaceAll("|", ""));
3182
+ M(a), ((r = O(a)) != null && r.valid || t && isEmptyNullOrUndefined(i)) && l({
3183
+ ...e,
3184
+ target: {
3185
+ ...e.target,
3186
+ value: stripLeadingZeros(safeToString(a)),
3187
+ name: F
3188
+ }
3189
+ });
3156
3190
  };
3157
- useEffect(() => {
3158
- if (A && A?.current && w && N) {
3191
+ return useEffect(() => {
3192
+ if (A && A != null && A.current && w && N) {
3159
3193
  let e = A.current;
3160
3194
  e && !f && setTimeout(() => {
3161
3195
  let { length: t } = safeToString(j);
3162
3196
  e.setSelectionRange(t, t);
3163
3197
  }, 0);
3164
3198
  }
3165
- }, [N]);
3166
- let B = (e) => {
3167
- P(!0), u(e);
3168
- }, V = (e) => {
3169
- P(!1), d(e);
3170
- }, H = w && !N && I ? T ? safeToString(T(j)) : ((e) => x ? roundToFixed(e, 2) : roundByMagnitude(e, 4))(s) : j;
3171
- return /* @__PURE__ */ jsx(Input, {
3199
+ }, [N]), /* @__PURE__ */ jsx(Input, {
3172
3200
  type: "text",
3173
3201
  name: F,
3174
3202
  testId: g,
3175
3203
  disabled: n,
3176
3204
  placeholder: t,
3177
- value: H,
3205
+ value: w && !N && I ? T ? safeToString(T(j)) : ((e) => x ? roundToFixed(e, 2) : roundByMagnitude(e, 4))(s) : j,
3178
3206
  onChange: z,
3179
- onFocus: B,
3180
- onBlur: V,
3207
+ onFocus: (e) => {
3208
+ P(!0), u(e);
3209
+ },
3210
+ onBlur: (e) => {
3211
+ P(!1), d(e);
3212
+ },
3181
3213
  onKeyDown: (e) => {
3182
3214
  e.key === EventKey.ENTER && z(e);
3183
3215
  },
@@ -3193,33 +3225,42 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
3193
3225
  tooltip: _,
3194
3226
  ref: A
3195
3227
  }, F);
3196
- }, NumberInputCell = ({ cell: e, columnAlignment: t, testId: n }) => /* @__PURE__ */ jsx(NumberInput, {
3197
- name: e.name,
3198
- value: e.value,
3199
- onChange: (t) => e.onChange?.(t),
3200
- onFocus: e.onFocus,
3201
- onBlur: e.onBlur,
3202
- placeholder: e.placeholder,
3203
- error: e.error,
3204
- warning: e.warning,
3205
- disabled: e.disabled,
3206
- isInTable: !0,
3207
- left: e.left ?? t === Align.LEFT,
3208
- selectOnFocus: e.selectOnFocus,
3209
- tabIndex: e.disabled ? -1 : 0,
3210
- testId: n,
3211
- tooltip: e.tooltip,
3212
- validationCallback: e.validationCallback,
3213
- allowEmpty: e.allowEmpty,
3214
- enableCosmeticRounding: e.enableCosmeticRounding,
3215
- enableDisplayRounding: e.enableDisplayRounding,
3216
- roundDisplayValue: e.roundDisplayValue,
3217
- disableValidationOnFocus: e.disableValidationOnFocus
3218
- }), SelectCell = ({ cell: e, columnAlignment: t, testId: n }) => /* @__PURE__ */ jsx(Select, {
3228
+ }, NumberInputCell = ({ cell: e, columnAlignment: t, testId: n }) => {
3229
+ var r;
3230
+ return /* @__PURE__ */ jsx(NumberInput, {
3231
+ name: e.name,
3232
+ value: e.value,
3233
+ onChange: (t) => {
3234
+ var n;
3235
+ return (n = e.onChange) == null ? void 0 : n.call(e, t);
3236
+ },
3237
+ onFocus: e.onFocus,
3238
+ onBlur: e.onBlur,
3239
+ placeholder: e.placeholder,
3240
+ error: e.error,
3241
+ warning: e.warning,
3242
+ disabled: e.disabled,
3243
+ isInTable: !0,
3244
+ left: (r = e.left) == null ? t === Align.LEFT : r,
3245
+ selectOnFocus: e.selectOnFocus,
3246
+ tabIndex: e.disabled ? -1 : 0,
3247
+ testId: n,
3248
+ tooltip: e.tooltip,
3249
+ validationCallback: e.validationCallback,
3250
+ allowEmpty: e.allowEmpty,
3251
+ enableCosmeticRounding: e.enableCosmeticRounding,
3252
+ enableDisplayRounding: e.enableDisplayRounding,
3253
+ roundDisplayValue: e.roundDisplayValue,
3254
+ disableValidationOnFocus: e.disableValidationOnFocus
3255
+ });
3256
+ }, SelectCell = ({ cell: e, columnAlignment: t, testId: n }) => /* @__PURE__ */ jsx(Select, {
3219
3257
  name: e.name,
3220
3258
  borderRadius: 0,
3221
3259
  options: e.options,
3222
- onChange: (t) => e.onChange?.(t),
3260
+ onChange: (t) => {
3261
+ var n;
3262
+ return (n = e.onChange) == null ? void 0 : n.call(e, t);
3263
+ },
3223
3264
  onCreate: e.onCreate ? (t) => e.onCreate && e.onCreate(t) : void 0,
3224
3265
  error: e.error,
3225
3266
  warning: e.warning,
@@ -3274,7 +3315,8 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
3274
3315
  children: /* @__PURE__ */ jsx("a", {
3275
3316
  className: cx((e.disabled || n) && cell_module_default.disabledLink),
3276
3317
  onClick: e.disabled || n ? void 0 : (t) => {
3277
- t.stopPropagation(), e.onClick?.(t);
3318
+ var n;
3319
+ t.stopPropagation(), (n = e.onClick) == null || n.call(e, t);
3278
3320
  },
3279
3321
  "data-testid": t,
3280
3322
  children: e.value
@@ -3304,7 +3346,7 @@ var slider_module_default = {
3304
3346
  text: /* @__PURE__ */ jsxs(Fragment$1, { children: [
3305
3347
  n,
3306
3348
  n ? ": " : "",
3307
- t ?? r
3349
+ t == null ? r : t
3308
3350
  ] }),
3309
3351
  children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
3310
3352
  }), e), {}), isEqual$1);
@@ -3315,7 +3357,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
3315
3357
  }, onChange: v = noop }) => {
3316
3358
  let y = useContext(DisabledContext), b = memoizedFormatMarkers(l), x = (n) => {
3317
3359
  v({ target: {
3318
- name: e ?? "",
3360
+ name: e == null ? "" : e,
3319
3361
  value: n,
3320
3362
  label: typeof t == "string" ? t : String(t)
3321
3363
  } });
@@ -3325,7 +3367,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
3325
3367
  basic: !0,
3326
3368
  small: !0,
3327
3369
  round: !0,
3328
- onClick: () => x(m ? [a, i?.[1]] : a),
3370
+ onClick: () => x(m ? [a, i == null ? void 0 : i[1]] : a),
3329
3371
  disabled: p || i === a || y,
3330
3372
  icon: IconType.FAST_BACKWARD
3331
3373
  })
@@ -3335,7 +3377,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
3335
3377
  basic: !0,
3336
3378
  small: !0,
3337
3379
  round: !0,
3338
- onClick: () => x(m ? [i?.[0], o] : o),
3380
+ onClick: () => x(m ? [i == null ? void 0 : i[0], o] : o),
3339
3381
  disabled: p || i === o || y,
3340
3382
  icon: IconType.FAST_FORWARD
3341
3383
  })
@@ -3360,21 +3402,18 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
3360
3402
  onChange: (e) => x(e),
3361
3403
  disabled: p || y,
3362
3404
  vertical: _.enabled,
3363
- handleRender: (e, t) => {
3364
- let n = d && t.dragging;
3365
- return /* @__PURE__ */ jsxs("div", {
3366
- style: { position: "relative" },
3367
- children: [e, n && /* @__PURE__ */ jsx(Tooltip, {
3368
- display: "block",
3369
- text: f(i),
3370
- forceOpen: !0,
3371
- children: /* @__PURE__ */ jsx("div", { style: {
3372
- position: "absolute",
3373
- inset: 0
3374
- } })
3375
- })]
3376
- });
3377
- }
3405
+ handleRender: (e, t) => /* @__PURE__ */ jsxs("div", {
3406
+ style: { position: "relative" },
3407
+ children: [e, d && t.dragging && /* @__PURE__ */ jsx(Tooltip, {
3408
+ display: "block",
3409
+ text: f(i),
3410
+ forceOpen: !0,
3411
+ children: /* @__PURE__ */ jsx("div", { style: {
3412
+ position: "absolute",
3413
+ inset: 0
3414
+ } })
3415
+ })]
3416
+ })
3378
3417
  }),
3379
3418
  u && (_.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
3380
3419
  t && /* @__PURE__ */ jsx("label", {
@@ -3582,26 +3621,27 @@ let CellType = /* @__PURE__ */ function(e) {
3582
3621
  return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
3583
3622
  }({});
3584
3623
  const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
3624
+ var o;
3585
3625
  if (!e) return null;
3586
- let { style: o, colSpan: s, rowSpan: c, width: l } = e, u = useRef(null), d = {
3626
+ let { style: s, colSpan: c, rowSpan: l, width: u } = e, d = useRef(null), f = {
3587
3627
  bodyAlignment: r,
3588
3628
  headerAlignment: n,
3589
3629
  isHeader: t
3590
- }, f = getCellAlignment(d, cell_module_default), m = getCellAlignment(d, cell_module_default, !0), h = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, _ = cx(cell_module_default.cell, h, e.hasSort ? cell_module_default.sortingCell : null, f, e.breakWord ? cell_module_default.breakWord : ""), v = l ?? i ?? void 0, y = e.type === CellType.STATIC || !e.type, b = t && y ? TextTransform.CAPITALIZE : void 0, x = {
3591
- width: v,
3592
- minWidth: v,
3593
- textTransform: b,
3594
- ...o
3630
+ }, m = getCellAlignment(f, cell_module_default), h = getCellAlignment(f, cell_module_default, !0), _ = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, v = cx(cell_module_default.cell, _, e.hasSort ? cell_module_default.sortingCell : null, m, e.breakWord ? cell_module_default.breakWord : ""), y = (o = u == null ? i : u) == null ? void 0 : o, b = e.type === CellType.STATIC || !e.type, x = {
3631
+ width: y,
3632
+ minWidth: y,
3633
+ textTransform: t && b ? TextTransform.CAPITALIZE : void 0,
3634
+ ...s
3595
3635
  };
3596
3636
  return /* @__PURE__ */ jsx(t ? "th" : "td", {
3597
- ref: u,
3598
- className: _,
3637
+ ref: d,
3638
+ className: v,
3599
3639
  style: x,
3600
- colSpan: s,
3601
- rowSpan: c,
3640
+ colSpan: c,
3641
+ rowSpan: l,
3602
3642
  children: /* @__PURE__ */ jsx(CellWrapper, {
3603
3643
  cell: e,
3604
- columnAlignment: m ?? Align.RIGHT,
3644
+ columnAlignment: h == null ? Align.RIGHT : h,
3605
3645
  isHeader: t,
3606
3646
  testId: a
3607
3647
  })
@@ -3689,7 +3729,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3689
3729
  p(null), _(!1);
3690
3730
  let { active: t, over: n } = e;
3691
3731
  if (!t || !n || t.id === n.id) return;
3692
- let r = Number(t.id), i = Number(n?.id);
3732
+ let r = Number(t.id), i = Number(n == null ? void 0 : n.id);
3693
3733
  s({
3694
3734
  from: r,
3695
3735
  to: i
@@ -3699,11 +3739,11 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3699
3739
  });
3700
3740
  },
3701
3741
  onDragOver: (e) => {
3702
- let { active: t, over: n } = e, r = Number(t.id), i = Number(n?.id), a = r !== i && !s({
3742
+ let { active: t, over: n } = e, r = Number(t.id), i = Number(n == null ? void 0 : n.id);
3743
+ _(r !== i && !s({
3703
3744
  from: r,
3704
3745
  to: i
3705
- });
3706
- _(a);
3746
+ }));
3707
3747
  },
3708
3748
  children: [/* @__PURE__ */ jsx(SortableContext, {
3709
3749
  items: v,
@@ -3718,11 +3758,11 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3718
3758
  row: l[Number(f)],
3719
3759
  columnCount: i,
3720
3760
  columnWidths: (() => {
3721
- if (!u?.current) return [];
3722
- let e = u.current.querySelectorAll("tr")[Number(f)]?.querySelectorAll("td");
3723
- if (!e) return [];
3724
- let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
3725
- return t.shift(), t;
3761
+ if (!(u != null && u.current)) return [];
3762
+ let e = u.current.querySelectorAll("tr")[Number(f)], t = e == null ? void 0 : e.querySelectorAll("td");
3763
+ if (!t) return [];
3764
+ let n = Array.from(t).map((e) => `${e.getBoundingClientRect().width}px`);
3765
+ return n.shift(), n;
3726
3766
  })(),
3727
3767
  colSpan: n,
3728
3768
  hasRowActions: c,
@@ -3734,20 +3774,21 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3734
3774
  }), document.body)]
3735
3775
  }) : t({});
3736
3776
  }, TableVirtualScrollWrapper = ({ table: e, children: t }) => {
3737
- let n = useRef(null), r = useVirtualizer({
3738
- count: e?.rowCount ?? e.rows?.length ?? 0,
3739
- getScrollElement: () => n.current,
3777
+ var n, r, i;
3778
+ let a = useRef(null), o = useVirtualizer({
3779
+ count: (n = (r = e == null ? void 0 : e.rowCount) == null ? (i = e.rows) == null ? void 0 : i.length : r) == null ? 0 : n,
3780
+ getScrollElement: () => a.current,
3740
3781
  estimateSize: () => 31,
3741
3782
  overscan: 10
3742
3783
  });
3743
3784
  return /* @__PURE__ */ jsx("div", {
3744
3785
  id: "scrollWrapper",
3745
3786
  className: cx(table_module_default.scroll, table_module_default.virtualScroll),
3746
- ref: n,
3787
+ ref: a,
3747
3788
  children: t({
3748
- virtualizer: r,
3789
+ virtualizer: o,
3749
3790
  tableStyle: (() => {
3750
- let e = r.getVirtualItems(), t = e.length > 0 ? e[0].start : 0, n = e.length > 0 ? r.getTotalSize() - e[e.length - 1].end : 0;
3791
+ let e = o.getVirtualItems(), t = e.length > 0 ? e[0].start : 0, n = e.length > 0 ? o.getTotalSize() - e[e.length - 1].end : 0;
3751
3792
  return {
3752
3793
  "--virtualPaddingTop": t + "px",
3753
3794
  "--virtualPaddingBottom": n + "px"
@@ -3799,135 +3840,137 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
3799
3840
  }), t({})]
3800
3841
  });
3801
3842
  }, Table = (e) => {
3802
- let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths: a, footer: o, name: s, rows: c = [], actions: l, actionsRight: u, columnHeaderAlignments: d, columnAlignment: f, striped: m = !0, testId: h, draggable: _, defaultEmptyRow: v = null, onAddRow: y = null, bordered: b = !0, maxHeight: x, fixedWidth: S } = i, C = useRef(null), w = get(e, "table.headers", []), T = getColumnCount(c, w), E = hasRowActions(c, w), D = T + (E ? 1 : 0), O = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, k = v?.cells?.length && y && O, A = {
3803
- cells: k ? v.cells.map((e, t) => e?.type === "Input" ? {
3843
+ var t, n, r, i, a;
3844
+ let { onListReorder: o = () => {}, canListReorder: s = () => !0, beforeRenderRow: c, table: l } = e, { columnWidths: u, footer: d, name: f, rows: m = [], actions: h, actionsRight: _, columnHeaderAlignments: v, columnAlignment: y, striped: b = !0, testId: x, draggable: S, defaultEmptyRow: C = null, onAddRow: w = null, bordered: T = !0, maxHeight: E, fixedWidth: D } = l, O = useRef(null), k = get(e, "table.headers", []), A = getColumnCount(m, k), j = hasRowActions(m, k), M = A + (j ? 1 : 0), N = d ? (d == null || (t = d.pagination) == null || (t = t.rowsPerPage) == null ? void 0 : t.value) === 0 || Number(d == null || (n = d.pagination) == null ? void 0 : n.selectedPage) >= Number(d == null || (r = d.pagination) == null ? void 0 : r.rowCount) / Number(d == null || (i = d.pagination) == null || (i = i.rowsPerPage) == null ? void 0 : i.value) : !0, P = (C == null || (a = C.cells) == null ? void 0 : a.length) && w && N, F = {
3845
+ cells: P ? C.cells.map((e, t) => (e == null ? void 0 : e.type) === "Input" ? {
3804
3846
  ...e,
3805
3847
  onChange: (e) => {
3806
- let n = e?.target?.value, r = {
3807
- ...v,
3808
- cells: v.cells.map((e, r) => ({
3848
+ var n;
3849
+ let r = e == null || (n = e.target) == null ? void 0 : n.value;
3850
+ w({ newRow: {
3851
+ ...C,
3852
+ cells: C.cells.map((e, n) => ({
3809
3853
  ...e,
3810
- value: r === t ? n : e?.value
3854
+ value: n === t ? r : e == null ? void 0 : e.value
3811
3855
  }))
3812
- };
3813
- y({ newRow: r });
3856
+ } });
3814
3857
  }
3815
3858
  } : {
3816
3859
  ...e,
3817
3860
  disabled: !0
3818
3861
  }) : null,
3819
- testId: h ? `${h}-last-empty-row` : void 0
3820
- }, j = k ? c.concat(A) : c, M = {
3821
- ...i,
3822
- rows: j
3823
- }, N = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
3862
+ testId: x ? `${x}-last-empty-row` : void 0
3863
+ }, I = P ? m.concat(F) : m, L = {
3864
+ ...l,
3865
+ rows: I
3866
+ };
3824
3867
  return /* @__PURE__ */ jsxs("div", {
3825
- className: N,
3868
+ className: cx(table_module_default.wrapper, T ? table_module_default.bordered : ""),
3826
3869
  style: {
3827
- maxHeight: x,
3828
- width: S,
3829
- display: S === "auto" ? "inline-flex" : "flex"
3870
+ maxHeight: E,
3871
+ width: D,
3872
+ display: D === "auto" ? "inline-flex" : "flex"
3830
3873
  },
3831
3874
  children: [
3832
3875
  /* @__PURE__ */ jsx(Title$1, {
3833
- actions: l,
3834
- actionsRight: u,
3835
- name: s,
3836
- testId: h && `${h}-title`
3876
+ actions: h,
3877
+ actionsRight: _,
3878
+ name: f,
3879
+ testId: x && `${x}-title`
3837
3880
  }),
3838
3881
  /* @__PURE__ */ jsx(TableDragWrapper, {
3839
- colSpan: D,
3840
- columnAlignment: f,
3841
- columnCount: T,
3842
- draggable: _,
3843
- onListReorder: t,
3844
- rowActions: E,
3845
- rows: j,
3846
- tbodyRef: C,
3847
- canListReorder: n,
3882
+ colSpan: M,
3883
+ columnAlignment: y,
3884
+ columnCount: A,
3885
+ draggable: S,
3886
+ onListReorder: o,
3887
+ rowActions: j,
3888
+ rows: I,
3889
+ tbodyRef: O,
3890
+ canListReorder: s,
3848
3891
  children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
3849
- table: M,
3892
+ table: L,
3850
3893
  children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsxs("table", {
3851
- className: cx(table_module_default.table, m ? table_module_default.striped : ""),
3852
- "data-testid": h,
3894
+ className: cx(table_module_default.table, b ? table_module_default.striped : ""),
3895
+ "data-testid": x,
3853
3896
  style: n,
3854
- children: [/* @__PURE__ */ jsx("thead", { children: w.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
3897
+ children: [/* @__PURE__ */ jsx("thead", { children: k.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
3855
3898
  rowIndex: t,
3856
3899
  isHeader: !0,
3857
3900
  row: e,
3858
- columnCount: T,
3859
- columnWidths: a,
3860
- colSpan: D,
3861
- hasRowActions: E,
3862
- columnAlignment: f,
3863
- columnHeaderAlignments: d,
3864
- draggableTable: _
3901
+ columnCount: A,
3902
+ columnWidths: u,
3903
+ colSpan: M,
3904
+ hasRowActions: j,
3905
+ columnAlignment: y,
3906
+ columnHeaderAlignments: v,
3907
+ draggableTable: S
3865
3908
  }, `0_${t}`)) }), /* @__PURE__ */ jsx("tbody", {
3866
- ref: C,
3909
+ ref: O,
3867
3910
  children: t ? t.getVirtualItems().map((t) => {
3868
- let n = t.index, i = j[n], o = r ? r({
3869
- row: i,
3870
- rowIndex: n
3871
- }) : i;
3911
+ let n = t.index, r = I[n];
3872
3912
  return /* @__PURE__ */ jsx(Row$1, {
3873
3913
  rowIndex: n,
3874
- row: o,
3875
- columnCount: T,
3876
- columnWidths: a,
3877
- colSpan: D,
3878
- hasRowActions: E,
3879
- columnAlignment: f,
3880
- draggableTable: _,
3914
+ row: c ? c({
3915
+ row: r,
3916
+ rowIndex: n
3917
+ }) : r,
3918
+ columnCount: A,
3919
+ columnWidths: u,
3920
+ colSpan: M,
3921
+ hasRowActions: j,
3922
+ columnAlignment: y,
3923
+ draggableTable: S,
3881
3924
  height: t.size,
3882
3925
  dropDisabled: e
3883
3926
  }, `1_${n}`);
3884
- }) : j.map((t, n) => {
3885
- let i = r ? r({
3927
+ }) : I.map((t, n) => /* @__PURE__ */ jsx(Row$1, {
3928
+ rowIndex: n,
3929
+ row: c ? c({
3886
3930
  row: t,
3887
3931
  rowIndex: n
3888
- }) : t;
3889
- return /* @__PURE__ */ jsx(Row$1, {
3890
- rowIndex: n,
3891
- row: i,
3892
- columnCount: T,
3893
- columnWidths: a,
3894
- colSpan: D,
3895
- hasRowActions: E,
3896
- columnAlignment: f,
3897
- draggableTable: _,
3898
- dropDisabled: e
3899
- }, `1_${n}`);
3900
- })
3932
+ }) : t,
3933
+ columnCount: A,
3934
+ columnWidths: u,
3935
+ colSpan: M,
3936
+ hasRowActions: j,
3937
+ columnAlignment: y,
3938
+ draggableTable: S,
3939
+ dropDisabled: e
3940
+ }, `1_${n}`))
3901
3941
  })]
3902
3942
  })
3903
3943
  })
3904
3944
  }),
3905
- o && /* @__PURE__ */ jsx(Footer, {
3906
- pagination: o.pagination,
3907
- actions: o.actions,
3908
- content: o.content
3945
+ d && /* @__PURE__ */ jsx(Footer, {
3946
+ pagination: d.pagination,
3947
+ actions: d.actions,
3948
+ content: d.content
3909
3949
  })
3910
3950
  ]
3911
3951
  });
3912
- }, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
3913
- let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
3952
+ }, placeholder$1 = "blank", MAX_IMPORT_ROWS = 1e4, getUpdatedErrors = (e, t, n, r) => {
3953
+ let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a;
3914
3954
  return {
3915
3955
  updatedErrors: o,
3916
- isValid: s
3956
+ isValid: o.length === 0
3917
3957
  };
3918
- }, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
3919
- let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(20), [l, u] = useState(1), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y = useMemo(() => {
3958
+ };
3959
+ var ROW_PER_PAGE = 20, FIRST_PAGE = 1;
3960
+ const Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
3961
+ let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(ROW_PER_PAGE), [l, u] = useState(FIRST_PAGE), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y = useMemo(() => {
3920
3962
  let n = e.filter((e) => !e.optionalColumn);
3921
3963
  return t.fields.length === n.length ? n : e;
3922
3964
  }, [e, t.fields.length]), b = useCallback((e, r) => (!f.current.length && t.rows.length && (f.current = t.rows[0].map((e) => isNumericLike(e) ? "NumberInput" : "Input")), {
3923
3965
  cells: e.map((e, a) => {
3924
- let { columnMessage: o = {}, validator: s = () => null } = y?.[a] ?? {}, c = i?.[a]?.value, l = `${`Row ${r + 1}`} → ${c}:`, u = s(e), d = t?.errors?.find((e) => e.startsWith(l)) ?? null, p = u || d || null;
3966
+ var o, s, c, l, u;
3967
+ let { columnMessage: d = {}, validator: p = () => null } = (o = y == null ? void 0 : y[a]) == null ? {} : o, m = i == null || (s = i[a]) == null ? void 0 : s.value, h = `${`Row ${r + 1}`} → ${m}:`, g = p(e), _ = (c = t == null || (l = t.errors) == null ? void 0 : l.find((e) => e.startsWith(h))) == null ? null : c, x = g || _ || null;
3925
3968
  return {
3926
- name: c,
3969
+ name: m,
3927
3970
  value: e,
3928
- type: f.current[a] ?? "Input",
3971
+ type: (u = f.current[a]) == null ? "Input" : u,
3929
3972
  disableValidationOnFocus: !0,
3930
- error: p,
3973
+ error: x,
3931
3974
  validationCallback: (e, i) => {
3932
3975
  let a = `Row ${r + 1}`, { updatedErrors: o, isValid: s } = getUpdatedErrors(t.errors, a, e, i);
3933
3976
  n({ parsedResult: {
@@ -3937,18 +3980,19 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
3937
3980
  } });
3938
3981
  },
3939
3982
  onChange: (e) => {
3940
- let { value: i } = e?.target ?? {}, o = `Row ${r + 1}`, l = s(i), { updatedErrors: u, isValid: d } = getUpdatedErrors(t.errors, o, c, l), f = t.rows.map((e, t) => t === r ? e.map((e, t) => t === a ? i : e) : e);
3983
+ var i;
3984
+ let { value: o } = (i = e == null ? void 0 : e.target) == null ? {} : i, s = `Row ${r + 1}`, c = p(o), { updatedErrors: l, isValid: u } = getUpdatedErrors(t.errors, s, m, c), d = t.rows.map((e, t) => t === r ? e.map((e, t) => t === a ? o : e) : e);
3941
3985
  n({ parsedResult: {
3942
3986
  ...t,
3943
- rows: f,
3944
- errors: u,
3945
- isValid: d
3987
+ rows: d,
3988
+ errors: l,
3989
+ isValid: u
3946
3990
  } }), v((e) => {
3947
3991
  let t = [...e];
3948
- return t[r] = b(f[r], r), t;
3992
+ return t[r] = b(d[r], r), t;
3949
3993
  });
3950
3994
  },
3951
- ...o
3995
+ ...d
3952
3996
  };
3953
3997
  }),
3954
3998
  actions: [{
@@ -3978,23 +4022,25 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
3978
4022
  t.isValid
3979
4023
  ]);
3980
4024
  let x = useMemo(() => t.fields.map((e, r) => {
3981
- let a = y?.[r], o = Array.isArray(a?.validUnits) ? a.validUnits : [], s = o?.some((e) => toLower(e) === placeholder$1);
3982
- if (!o.length || s) return {};
3983
- let c = t?.units?.[r], l = toLower(c), u = o?.some((e) => toLower(e) === l) ? c : a?.defaultUnit ?? "";
4025
+ var a, o, s;
4026
+ let c = y == null ? void 0 : y[r], l = Array.isArray(c == null ? void 0 : c.validUnits) ? c.validUnits : [], u = l == null ? void 0 : l.some((e) => toLower(e) === placeholder$1);
4027
+ if (!l.length || u) return {};
4028
+ let d = t == null || (a = t.units) == null ? void 0 : a[r], f = toLower(d), p = l != null && l.some((e) => toLower(e) === f) ? d : (o = c == null ? void 0 : c.defaultUnit) == null ? "" : o;
3984
4029
  return {
3985
- key: i?.[r]?.value,
3986
- value: u,
4030
+ key: i == null || (s = i[r]) == null ? void 0 : s.value,
4031
+ value: p,
3987
4032
  type: "Select",
3988
- disabled: !o.length || !u,
3989
- options: o.map((e) => ({
4033
+ disabled: !l.length || !p,
4034
+ options: l.map((e) => ({
3990
4035
  label: e,
3991
4036
  value: e
3992
4037
  })),
3993
4038
  onChange: (e) => {
3994
- let { value: i } = e?.target ?? {}, a = t.units.map((e, t) => t === r ? i : e);
4039
+ var i;
4040
+ let { value: a } = (i = e == null ? void 0 : e.target) == null ? {} : i, o = t.units.map((e, t) => t === r ? a : e);
3995
4041
  n({ parsedResult: {
3996
4042
  ...t,
3997
- units: a
4043
+ units: o
3998
4044
  } });
3999
4045
  }
4000
4046
  };
@@ -4014,19 +4060,19 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
4014
4060
  _,
4015
4061
  h,
4016
4062
  g
4017
- ]), T = useCallback(({ rowIndex: e }) => {
4018
- let n = h + e, r = t.rows[n];
4019
- return r ? b(r, n) : {
4020
- cells: [],
4021
- actions: []
4022
- };
4023
- }, [
4024
- t.rows,
4025
- b,
4026
- h
4027
4063
  ]);
4028
4064
  return /* @__PURE__ */ jsx(Table, {
4029
- beforeRenderRow: T,
4065
+ beforeRenderRow: useCallback(({ rowIndex: e }) => {
4066
+ let n = h + e, r = t.rows[n];
4067
+ return r ? b(r, n) : {
4068
+ cells: [],
4069
+ actions: []
4070
+ };
4071
+ }, [
4072
+ t.rows,
4073
+ b,
4074
+ h
4075
+ ]),
4030
4076
  onListReorder: ({ from: e, to: r }) => {
4031
4077
  let i = [...t.rows], [a] = i.splice(e, 1);
4032
4078
  i.splice(r, 0, a), n({ parsedResult: {
@@ -4041,18 +4087,21 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
4041
4087
  testId: `${r}-paste-with-review-modal-table`,
4042
4088
  draggable: !0,
4043
4089
  headers: C,
4044
- rows: Array.from({ length: w?.length || 0 }, () => ({
4090
+ rows: Array.from({ length: (w == null ? void 0 : w.length) || 0 }, () => ({
4045
4091
  cells: [],
4046
4092
  actions: []
4047
4093
  })),
4048
- rowCount: w?.length,
4094
+ rowCount: w == null ? void 0 : w.length,
4049
4095
  infiniteScroll: !0,
4050
4096
  footer: { pagination: {
4051
4097
  rowCount: t.rows.length,
4052
4098
  selectedPage: l,
4053
4099
  rowsPerPage: {
4054
4100
  value: a,
4055
- onChange: (e) => s(Number(e?.target?.value)),
4101
+ onChange: (e) => {
4102
+ var t;
4103
+ return s(Number(e == null || (t = e.target) == null ? void 0 : t.value));
4104
+ },
4056
4105
  options: [
4057
4106
  {
4058
4107
  label: "10 / page",
@@ -4088,7 +4137,8 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
4088
4137
  };
4089
4138
  var errors_module_default = { listStyle: "_listStyle_yjfjw_1" };
4090
4139
  const errorMessage = ({ errors: e, t }) => {
4091
- let n = [...e]?.sort((e, t) => {
4140
+ var n;
4141
+ let r = (n = [...e]) == null ? void 0 : n.sort((e, t) => {
4092
4142
  let n = (e) => {
4093
4143
  let t = e.match(/^Row (\d+)/);
4094
4144
  return t ? parseInt(t[1], 10) : Infinity;
@@ -4099,11 +4149,11 @@ const errorMessage = ({ errors: e, t }) => {
4099
4149
  visible: !0,
4100
4150
  icon: !0,
4101
4151
  width: "100%",
4102
- content: t("unableToImportPleaseCorrectError", { rows: e?.length }),
4152
+ content: t("unableToImportPleaseCorrectError", { rows: e == null ? void 0 : e.length }),
4103
4153
  type: "Error",
4104
4154
  details: /* @__PURE__ */ jsx("ul", {
4105
4155
  className: errors_module_default.listStyle,
4106
- children: n.map((e, t) => /* @__PURE__ */ jsx("li", { children: e }, t))
4156
+ children: r.map((e, t) => /* @__PURE__ */ jsx("li", { children: e }, t))
4107
4157
  })
4108
4158
  };
4109
4159
  }, Errors = ({ errors: e, t }) => e.length ? /* @__PURE__ */ jsx(Message, { message: errorMessage({
@@ -4159,15 +4209,28 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
4159
4209
  }),
4160
4210
  r
4161
4211
  ]
4162
- }), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
4163
- let t = e?.match(/[.,]/g);
4164
- return t && t.length > 1;
4165
- }), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1);
4212
+ }), extraSeparators = (e) => {
4213
+ var t;
4214
+ return e == null || (t = e.split(/;|\t|\n/)) == null ? void 0 : t.some((e) => {
4215
+ let t = e == null ? void 0 : e.match(/[.,]/g);
4216
+ return t && t.length > 1;
4217
+ });
4218
+ }, hasOneComma = (e) => {
4219
+ var t;
4220
+ return e == null || (t = e.split(/;|\t|\n/)) == null ? void 0 : t.some((e) => {
4221
+ var t;
4222
+ return !(e != null && e.includes(".")) && (e == null || (t = e.match(/,/g)) == null ? void 0 : t.length) === 1;
4223
+ });
4224
+ };
4166
4225
  var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
4167
4226
  let s = [], c = r.filter((e) => e.optionalColumn).length, l = r.length, u = c ? `${l - c} or ${l}` : `${l}`, d = i && a ? 2 : i || a ? 1 : 0;
4168
4227
  if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
4169
- let e = r.filter((e) => !e.optionalColumn && Array.isArray(e?.validUnits) && e?.validUnits?.some(isNonPlaceholderUnit)).length, n = t?.filter(isNonPlaceholderUnit)?.length, i = r?.filter((e) => e?.optionalColumn || !Array.isArray(e?.validUnits) || e.validUnits.includes("blank"))?.length;
4170
- isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
4228
+ var f, p;
4229
+ let e = r.filter((e) => {
4230
+ var t;
4231
+ return !e.optionalColumn && Array.isArray(e == null ? void 0 : e.validUnits) && (e == null || (t = e.validUnits) == null ? void 0 : t.some(isNonPlaceholderUnit));
4232
+ }).length;
4233
+ isValidLength(t == null || (f = t.filter(isNonPlaceholderUnit)) == null ? void 0 : f.length, e, r == null || (p = r.filter((e) => (e == null ? void 0 : e.optionalColumn) || !Array.isArray(e == null ? void 0 : e.validUnits) || e.validUnits.includes("blank"))) == null ? void 0 : p.length) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
4171
4234
  }
4172
4235
  return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
4173
4236
  expectedLengthMessage: u,
@@ -4179,36 +4242,45 @@ var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e &
4179
4242
  }));
4180
4243
  }), s;
4181
4244
  }, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
4182
- let n = normalize(e);
4183
- return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
4184
- }, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
4245
+ var n;
4246
+ let r = normalize(e);
4247
+ return (n = t == null ? void 0 : t.some((e) => normalize(e).includes(r) || r.includes(normalize(e)))) == null ? !1 : n;
4248
+ }, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => {
4249
+ var n;
4250
+ return (n = t == null ? void 0 : t.includes(e)) == null ? !1 : n;
4251
+ }, validateHeadings = (e, t, n, r, i, a) => {
4185
4252
  let o = [];
4186
4253
  if (r) {
4187
4254
  let r = n.map((e) => e.fieldName).filter(Boolean);
4188
4255
  e.forEach((i, s) => {
4189
- let c = n[s];
4190
- !c || !c?.fieldName || (n[s]?.fieldNameValidator ?? defaultFieldNameValidator)({
4256
+ var c, l;
4257
+ let u = n[s];
4258
+ if (!(!u || !(u != null && u.fieldName)) && !((c = (l = n[s]) == null ? void 0 : l.fieldNameValidator) == null ? defaultFieldNameValidator : c)({
4191
4259
  value: i,
4192
4260
  defaultAllowedValues: r,
4193
4261
  columnIndex: s,
4194
4262
  fields: e,
4195
4263
  units: t
4196
- }) || o.push(a("incorrectFieldName", {
4197
- i: s + 1,
4198
- correctName: n[s]?.fieldName || a("notExist"),
4199
- wrongName: i || a("notApplicable")
4200
- }));
4264
+ })) {
4265
+ var d;
4266
+ o.push(a("incorrectFieldName", {
4267
+ i: s + 1,
4268
+ correctName: ((d = n[s]) == null ? void 0 : d.fieldName) || a("notExist"),
4269
+ wrongName: i || a("notApplicable")
4270
+ }));
4271
+ }
4201
4272
  });
4202
4273
  }
4203
4274
  if (i) {
4204
- let i = n.map((e) => e?.validUnits), s = r ? 1 : 0;
4275
+ let i = n.map((e) => e == null ? void 0 : e.validUnits), s = r ? 1 : 0;
4205
4276
  t.forEach((r, c) => {
4206
- let l = n[c];
4207
- if (!l || l?.optionalColumn) return;
4208
- let u = l.unitsValidator ?? defaultUnitsValidator, d = i?.[c] ?? [];
4209
- u({
4277
+ var l, u;
4278
+ let d = n[c];
4279
+ if (!d || d != null && d.optionalColumn) return;
4280
+ let f = (l = d.unitsValidator) == null ? defaultUnitsValidator : l, p = (u = i == null ? void 0 : i[c]) == null ? [] : u;
4281
+ f({
4210
4282
  value: r,
4211
- defaultAllowedValues: d,
4283
+ defaultAllowedValues: p,
4212
4284
  columnIndex: c,
4213
4285
  fields: e,
4214
4286
  units: t
@@ -4216,7 +4288,7 @@ var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e &
4216
4288
  unitRowIndex: s,
4217
4289
  i: c + 1,
4218
4290
  wrongUnit: r || a("notApplicable"),
4219
- correctUnit: d?.join(",") || a("notExist")
4291
+ correctUnit: (p == null ? void 0 : p.join(",")) || a("notExist")
4220
4292
  }));
4221
4293
  });
4222
4294
  }
@@ -4242,23 +4314,29 @@ const validate = (e, t, n, r, i, a, o) => {
4242
4314
  errors: s
4243
4315
  };
4244
4316
  }, hasHeaders = (e, t, n) => {
4245
- let r = (e) => e.replace(/,/g, "."), i = e[0]?.some((e) => isNaN(Number(r(e)))) ?? !1, a = e[1]?.some((e) => isNaN(Number(r(e)))) ?? !1, o = e[0]?.some((e) => t.includes(e)) ?? !1, s = e[0]?.some((e) => n.includes(e)) ?? !1, c = e[1]?.some((e) => n.includes(e)) ?? !1, l = e[0]?.some((e) => !isNaN(Number(r(e)))) ?? !1, u = e[1]?.some((e) => !isNaN(Number(r(e)))) ?? !1;
4317
+ var r, i, a, o, s, c, l, u, d, f, p, m, h, g;
4318
+ let _ = (e) => e.replace(/,/g, "."), v = (r = (i = e[0]) == null ? void 0 : i.some((e) => isNaN(Number(_(e))))) == null ? !1 : r, y = (a = (o = e[1]) == null ? void 0 : o.some((e) => isNaN(Number(_(e))))) == null ? !1 : a, b = (s = (c = e[0]) == null ? void 0 : c.some((e) => t.includes(e))) == null ? !1 : s, x = (l = (u = e[0]) == null ? void 0 : u.some((e) => n.includes(e))) == null ? !1 : l, S = (d = (f = e[1]) == null ? void 0 : f.some((e) => n.includes(e))) == null ? !1 : d, C = (p = (m = e[0]) == null ? void 0 : m.some((e) => !isNaN(Number(_(e))))) == null ? !1 : p, w = (h = (g = e[1]) == null ? void 0 : g.some((e) => !isNaN(Number(_(e))))) == null ? !1 : h;
4246
4319
  return {
4247
- hasFieldNameHeader: o || i && !s && !l || i && a && !l,
4248
- hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
4320
+ hasFieldNameHeader: b || v && !x && !C || v && y && !C,
4321
+ hasUnitHeader: x || S || v && y && !x && !C && !w || v && y && !C && !w
4249
4322
  };
4250
4323
  }, guessMissingHeaders = (e, { validationRules: t }) => {
4251
- let n = t?.length === (e?.[0]?.length ?? 0) ? t : t?.filter((e) => !e?.optionalColumn), r = n?.map((e) => e?.fieldName), i = (e) => Array.isArray(e) && e.length ? e[0] : "", a = n?.map((e) => e?.defaultUnit ?? i(e?.validUnits)), o = n?.map((e) => e?.validUnits)?.filter((e) => !!e)?.flat(), { hasFieldNameHeader: s, hasUnitHeader: c } = hasHeaders(e, r, o);
4252
- return s || e?.unshift(r), c || e?.splice(1, 0, a), {
4253
- hasFieldNameHeader: s,
4254
- hasUnitHeader: c
4324
+ var n, r, i;
4325
+ let a = (t == null ? void 0 : t.length) === ((n = e == null || (r = e[0]) == null ? void 0 : r.length) == null ? 0 : n) ? t : t == null ? void 0 : t.filter((e) => !(e != null && e.optionalColumn)), o = a == null ? void 0 : a.map((e) => e == null ? void 0 : e.fieldName), s = (e) => Array.isArray(e) && e.length ? e[0] : "", c = a == null ? void 0 : a.map((e) => {
4326
+ var t;
4327
+ return (t = e == null ? void 0 : e.defaultUnit) == null ? s(e == null ? void 0 : e.validUnits) : t;
4328
+ }), { hasFieldNameHeader: l, hasUnitHeader: u } = hasHeaders(e, o, a == null || (i = a.map((e) => e == null ? void 0 : e.validUnits)) == null || (i = i.filter((e) => !!e)) == null ? void 0 : i.flat());
4329
+ return l || e == null || e.unshift(o), u || e == null || e.splice(1, 0, c), {
4330
+ hasFieldNameHeader: l,
4331
+ hasUnitHeader: u
4255
4332
  };
4256
4333
  }, depthRound = (e) => Math.round(e * 100) / 100;
4257
4334
  var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
4258
4335
  skipEmptyLines: !0,
4259
4336
  delimiter: (e) => {
4260
- let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
4261
- return n === 0 && r === 0 ? "," : n > r ? " " : ";";
4337
+ var t, n;
4338
+ let r = e.substring(0, 200), i = ((t = r.match(/\t/g)) == null ? [] : t).length, a = ((n = r.match(/;/g)) == null ? [] : n).length;
4339
+ return i === 0 && a === 0 ? "," : i > a ? " " : ";";
4262
4340
  }
4263
4341
  }, allowedMimes = [
4264
4342
  "text/csv",
@@ -4267,7 +4345,8 @@ var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
4267
4345
  "application/vnd.ms-excel"
4268
4346
  ], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
4269
4347
  try {
4270
- return !!JSON.parse(e)?.path;
4348
+ var t;
4349
+ return !!((t = JSON.parse(e)) != null && t.path);
4271
4350
  } catch {
4272
4351
  return !1;
4273
4352
  }
@@ -4278,9 +4357,8 @@ const readFile$1 = (e) => new Promise((t, n) => {
4278
4357
  });
4279
4358
  var parseJson = async (e, t, n) => {
4280
4359
  try {
4281
- let r = JSON.parse(e);
4282
4360
  return onCompleteParse({
4283
- data: r,
4361
+ data: JSON.parse(e),
4284
4362
  errors: []
4285
4363
  }, t, n);
4286
4364
  } catch (e) {
@@ -4306,7 +4384,7 @@ var parseJson = async (e, t, n) => {
4306
4384
  }
4307
4385
  };
4308
4386
  const replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e)));
4309
- var parseDSV = (e, { importLimit: t,...n }, r) => new Promise((i) => {
4387
+ var parseDSV = (e, { importLimit: t, ...n }, r) => new Promise((i) => {
4310
4388
  Papa.parse(e, {
4311
4389
  ...basePapaConfig,
4312
4390
  preview: t,
@@ -4335,15 +4413,16 @@ const parse = async (e, t, n) => {
4335
4413
  return r.errors.push(e.message), r;
4336
4414
  }
4337
4415
  }, unParse = (e, t, n, r) => {
4338
- let i = r?.delimiter ?? ",", a = [
4416
+ var i;
4417
+ let a = (i = r == null ? void 0 : r.delimiter) == null ? "," : i, o = [
4339
4418
  e,
4340
4419
  t,
4341
4420
  ...n
4342
4421
  ].filter(Boolean);
4343
- return Papa.unparse(a, {
4422
+ return Papa.unparse(o, {
4344
4423
  quotes: !1,
4345
4424
  header: !0,
4346
- delimiter: i
4425
+ delimiter: a
4347
4426
  });
4348
4427
  };
4349
4428
  var onCompleteParse = (e, t, n) => {
@@ -4368,7 +4447,7 @@ const toast = ({ id: e, message: t = {
4368
4447
  type: MessageType.INFO,
4369
4448
  content: ""
4370
4449
  }, autoClose: n = 6e3, onClose: r }) => {
4371
- let { type: i = MessageType.INFO } = t ?? {}, a = ({ closeToast: t }) => /* @__PURE__ */ jsx(Dismiss, {
4450
+ let { type: i = MessageType.INFO } = t == null ? {} : t, a = ({ closeToast: t }) => /* @__PURE__ */ jsx(Dismiss, {
4372
4451
  type: i,
4373
4452
  onClose: t,
4374
4453
  isInToast: !0,
@@ -4380,7 +4459,7 @@ const toast = ({ id: e, message: t = {
4380
4459
  maxHeight: "500px",
4381
4460
  withDismiss: !1
4382
4461
  } }), s = (() => {
4383
- switch (t?.type) {
4462
+ switch (t == null ? void 0 : t.type) {
4384
4463
  case MessageType.SUCCESS: return toast$1.TYPE.SUCCESS;
4385
4464
  case MessageType.WARNING: return toast$1.TYPE.WARNING;
4386
4465
  case MessageType.ERROR: return toast$1.TYPE.ERROR;
@@ -4432,7 +4511,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4432
4511
  /* @__PURE__ */ jsx("input", {
4433
4512
  type: InputType.CHECKBOX,
4434
4513
  name: e,
4435
- value: n?.toString(),
4514
+ value: n == null ? void 0 : n.toString(),
4436
4515
  disabled: h,
4437
4516
  checked: n,
4438
4517
  onChange: () => {}
@@ -4449,7 +4528,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4449
4528
  ]
4450
4529
  });
4451
4530
  }, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules: s = [], onCompleteImport: c = () => {}, prevalidationConfig: l, t: u, loading: d, startTransition: f, testId: h }) => {
4452
- let { modalVisibility: { reviewPasteModal: g, pasteModalHelpVisible: _, helpModal: v } } = t, { warningMessage: y, actionButtonLabel: b, changeRulesAction: x, checkPrevalidationNeed: S } = l ?? {}, C = useRef(null), [w, T] = useState(!1), [E, D] = useState({
4531
+ let { modalVisibility: { reviewPasteModal: g, pasteModalHelpVisible: _, helpModal: v } } = t, { warningMessage: y, actionButtonLabel: b, changeRulesAction: x, checkPrevalidationNeed: S } = l == null ? {} : l, C = useRef(null), [w, T] = useState(!1), [E, D] = useState({
4453
4532
  pastedText: "",
4454
4533
  parsedResult: {
4455
4534
  isValid: !1,
@@ -4468,10 +4547,11 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4468
4547
  });
4469
4548
  let O = useCallback((t) => {
4470
4549
  if (t) {
4471
- let t = SimplifyAP(N?.rows?.map(([e, t]) => [Number(e), Number(t)]), .001).map(([e, t]) => [e.toString(), t.toString()]), n = e.importLimit ?? 1e4, r = {
4550
+ var n, r, i;
4551
+ let t = SimplifyAP(N == null || (n = N.rows) == null ? void 0 : n.map(([e, t]) => [Number(e), Number(t)]), .001).map(([e, t]) => [e.toString(), t.toString()]), a = {
4472
4552
  validationRules: s,
4473
- importLimit: n
4474
- }, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), o = unParse(i, a, t, r);
4553
+ importLimit: (r = e.importLimit) == null ? MAX_IMPORT_ROWS : r
4554
+ }, o = unParse(N.fields.slice(0, 2), ((i = N.units) == null ? [] : i).slice(0, 2), t, a);
4475
4555
  f(() => D({
4476
4556
  parsedResult: {
4477
4557
  ...N,
@@ -4645,12 +4725,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4645
4725
  onClose: i
4646
4726
  } })
4647
4727
  });
4648
- }, ModalsRenderer = ({ modals: e = [], modalVisibility: n, onCloseModal: r, testId: i }) => e.length ? /* @__PURE__ */ jsx(Fragment$1, { children: e.map(({ name: e, component: a, props: o = {} }) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(a, {
4649
- testId: `${i}-modal-render-${e}`,
4650
- visible: n?.[e] ?? !1,
4651
- onClose: () => r({ name: e }),
4652
- ...o
4653
- }) }, e)) }) : null, MenuComponent = ({ sections: e, iconName: t, testId: n, tooltip: r }) => /* @__PURE__ */ jsx(Menu, {
4728
+ }, ModalsRenderer = ({ modals: e = [], modalVisibility: n, onCloseModal: r, testId: i }) => e.length ? /* @__PURE__ */ jsx(Fragment$1, { children: e.map(({ name: e, component: a, props: o = {} }) => {
4729
+ var s;
4730
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(a, {
4731
+ testId: `${i}-modal-render-${e}`,
4732
+ visible: (s = n == null ? void 0 : n[e]) == null ? !1 : s,
4733
+ onClose: () => r({ name: e }),
4734
+ ...o
4735
+ }) }, e);
4736
+ }) }) : null, MenuComponent = ({ sections: e, iconName: t, testId: n, tooltip: r }) => /* @__PURE__ */ jsx(Menu, {
4654
4737
  loading: !0,
4655
4738
  menu: {
4656
4739
  component: /* @__PURE__ */ jsx(Button, {
@@ -4736,10 +4819,10 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
4736
4819
  smartUpload_description: "Upload image and extract table content using a LLM",
4737
4820
  smartUpload_smartUpload: "Smart Upload",
4738
4821
  toUploadOrImportFromClipboardMessage: "To upload or import from clipboard please select your preferred unit in the table header and upload or paste numbers only for Depth, Inc, Azi. Follow example below"
4739
- }, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
4822
+ }, interpolate = (e, t = {}) => e == null ? void 0 : e.replace(/\{\{(\w+)\}\}/g, (e, n) => (t == null ? void 0 : t[n]) === void 0 ? "" : String(t == null ? void 0 : t[n])), useTranslationMap = (e) => useMemo(() => {
4740
4823
  let t = Object.keys(enTranslations).reduce((t, n) => {
4741
- let r = enTranslations?.[n];
4742
- return t[n] = e?.[n] ?? r, t;
4824
+ let r = enTranslations == null ? void 0 : enTranslations[n], i = e == null ? void 0 : e[n];
4825
+ return t[n] = i == null ? r : i, t;
4743
4826
  }, {});
4744
4827
  return (e, n) => {
4745
4828
  let r = t[e];
@@ -4750,19 +4833,20 @@ var numericLike = /^\s*-?\d+(?:[.,]\d+)?(?:e[+-]?\d+)?\s*$/i;
4750
4833
  const normalizeParsedResult = (e) => {
4751
4834
  let { rows: t } = e, n = Array(t.length);
4752
4835
  for (let e = 0; e < t.length; e++) {
4753
- let r = t[e], i = Array(r.length);
4754
- for (let e = 0; e < r.length; e++) {
4755
- let t = String(r[e] ?? "");
4756
- i[e] = numericLike.test(t) ? cleanNumStr(t) : t;
4836
+ let i = t[e], a = Array(i.length);
4837
+ for (let e = 0; e < i.length; e++) {
4838
+ var r;
4839
+ let t = String((r = i[e]) == null ? "" : r);
4840
+ a[e] = numericLike.test(t) ? cleanNumStr(t) : t;
4757
4841
  }
4758
- n[e] = i;
4842
+ n[e] = a;
4759
4843
  }
4760
4844
  return {
4761
4845
  ...e,
4762
4846
  rows: n
4763
4847
  };
4764
4848
  }, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
4765
- let { exportData: a, beforeExportData: s, importLimit: c = 1e4, validationRules: l = [], translations: u, onImportComplete: d = () => {}, disablePasteSuccessfulToast: f, prevalidationConfig: p, onDeleteRows: m } = e ?? {}, { parsedResult: h } = t, { checkPrevalidationNeed: g } = p ?? {}, _ = useTranslationMap(u), v = useExportData(_, a, s), y = useCallback((e) => {
4849
+ let { exportData: a, beforeExportData: s, importLimit: c = MAX_IMPORT_ROWS, validationRules: l = [], translations: u, onImportComplete: d = () => {}, disablePasteSuccessfulToast: f, prevalidationConfig: p, onDeleteRows: m } = e == null ? {} : e, { parsedResult: h } = t, { checkPrevalidationNeed: g } = p == null ? {} : p, _ = useTranslationMap(u), v = useExportData(_, a, s), y = useCallback((e) => {
4766
4850
  n((t) => ({
4767
4851
  ...t,
4768
4852
  ...e
@@ -4770,7 +4854,7 @@ const normalizeParsedResult = (e) => {
4770
4854
  }, [n]), b = useCallback(({ name: e, callback: n } = {}) => {
4771
4855
  let r = { ...t.modalVisibility }, i = !e, a = [];
4772
4856
  if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
4773
- else r?.[e] && (a.push(e), r[e] = !1);
4857
+ else r != null && r[e] && (a.push(e), r[e] = !1);
4774
4858
  a.length > 0 && y({
4775
4859
  modalVisibility: r,
4776
4860
  pastedText: "",
@@ -4792,7 +4876,7 @@ const normalizeParsedResult = (e) => {
4792
4876
  units: [],
4793
4877
  errors: []
4794
4878
  }
4795
- })), m?.("all");
4879
+ })), m == null || m("all");
4796
4880
  }, [
4797
4881
  i,
4798
4882
  y,
@@ -4806,18 +4890,18 @@ const normalizeParsedResult = (e) => {
4806
4890
  let t = {
4807
4891
  validationRules: l,
4808
4892
  importLimit: c
4809
- }, n = await parse(e, t, _), r = normalizeParsedResult(n);
4893
+ }, n = normalizeParsedResult(await parse(e, t, _));
4810
4894
  if (g && g(h)) {
4811
- let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
4895
+ let { fields: e, units: r, rows: a, isValid: o } = n, s = unParse(e, r == null ? [] : r, a, t);
4812
4896
  return i(() => y({
4813
4897
  pastedText: s,
4814
4898
  parsedResult: h
4815
- })), r;
4899
+ })), n;
4816
4900
  }
4817
4901
  return i(() => y({
4818
4902
  pastedText: e,
4819
- parsedResult: r
4820
- })), r;
4903
+ parsedResult: n
4904
+ })), n;
4821
4905
  }, [
4822
4906
  l,
4823
4907
  c,
@@ -4825,159 +4909,168 @@ const normalizeParsedResult = (e) => {
4825
4909
  g,
4826
4910
  h,
4827
4911
  y
4828
- ]), w = useCallback(async (e) => {
4829
- let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
4830
- try {
4831
- if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
4912
+ ]);
4913
+ return {
4914
+ updateState: y,
4915
+ closeModals: b,
4916
+ setModalVisibility: S,
4917
+ readAndParseInput: useCallback(async (e) => {
4918
+ let { fromFile: t, showSuccessToast: n = !0 } = e == null ? {} : e, r;
4919
+ try {
4920
+ if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
4921
+ transitionToast({ message: {
4922
+ type: "Error",
4923
+ content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
4924
+ } }, i);
4925
+ return;
4926
+ }
4927
+ let e = normalizeParsedResult(await parse(r, {
4928
+ validationRules: l,
4929
+ importLimit: c
4930
+ }, _));
4931
+ return e != null && e.isValid || transitionToast({ message: {
4932
+ type: "Error",
4933
+ content: _("clipboardReadFailed")
4934
+ } }, i), n && transitionToast({ message: {
4935
+ type: "Success",
4936
+ content: _("pasteSuccessful")
4937
+ } }, i), {
4938
+ pastedText: r,
4939
+ parsedResult: e
4940
+ };
4941
+ } catch (e) {
4832
4942
  transitionToast({ message: {
4833
4943
  type: "Error",
4834
- content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
4944
+ content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
4945
+ details: e.message
4835
4946
  } }, i);
4836
4947
  return;
4837
4948
  }
4838
- let e = await parse(r, {
4839
- validationRules: l,
4840
- importLimit: c
4841
- }, _), a = normalizeParsedResult(e);
4842
- return a?.isValid || transitionToast({ message: {
4843
- type: "Error",
4844
- content: _("clipboardReadFailed")
4845
- } }, i), n && transitionToast({ message: {
4949
+ }, [l, c]),
4950
+ onFileChange: useCallback(async (e) => {
4951
+ var t;
4952
+ let n = e == null || (t = e.target) == null || (t = t.files) == null ? void 0 : t[0];
4953
+ if (!n) return;
4954
+ let r = await C(await n.text());
4955
+ r.isValid ? (f || transitionToast({ message: {
4846
4956
  type: "Success",
4847
4957
  content: _("pasteSuccessful")
4848
- } }, i), {
4849
- pastedText: r,
4850
- parsedResult: a
4851
- };
4852
- } catch (e) {
4853
- transitionToast({ message: {
4958
+ } }, i), i(() => d(r))) : transitionToast({ message: {
4854
4959
  type: "Error",
4855
- content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
4856
- details: e.message
4960
+ content: _("fileParsingFailed")
4857
4961
  } }, i);
4858
- return;
4859
- }
4860
- }, [l, c]), T = useCallback(async (e) => {
4861
- let t = e?.target?.files?.[0];
4862
- if (!t) return;
4863
- let n = await t.text(), r = await C(n);
4864
- r.isValid ? (f || transitionToast({ message: {
4865
- type: "Success",
4866
- content: _("pasteSuccessful")
4867
- } }, i), i(() => d(r))) : transitionToast({ message: {
4868
- type: "Error",
4869
- content: _("fileParsingFailed")
4870
- } }, i);
4871
- }, [
4872
- l,
4873
- c,
4874
- y,
4875
- d
4876
- ]), E = useCallback(async (e = !0) => {
4877
- try {
4878
- let t = await navigator.clipboard.readText();
4879
- if (!t) {
4962
+ }, [
4963
+ l,
4964
+ c,
4965
+ y,
4966
+ d
4967
+ ]),
4968
+ onClickQuickPasteFromClipBoard: useCallback(async (e = !0) => {
4969
+ try {
4970
+ let t = await navigator.clipboard.readText();
4971
+ if (!t) {
4972
+ transitionToast({ message: {
4973
+ type: "Error",
4974
+ content: _("clipboardIsEmpty")
4975
+ } }, i);
4976
+ return;
4977
+ }
4978
+ let n = await C(t);
4979
+ if (!n.isValid) {
4980
+ transitionToast({ message: {
4981
+ type: "Error",
4982
+ content: _("clipboardReadFailed")
4983
+ } }, i);
4984
+ return;
4985
+ }
4986
+ f || transitionToast({ message: {
4987
+ type: "Success",
4988
+ content: _("pasteSuccessful")
4989
+ } }, i), e && i(() => d(n));
4990
+ } catch {
4991
+ transitionToast({ message: {
4992
+ type: "Error",
4993
+ content: _("clipboardReadNotAllowed")
4994
+ } }, i);
4995
+ }
4996
+ }, [
4997
+ l,
4998
+ c,
4999
+ _,
5000
+ y,
5001
+ d
5002
+ ]),
5003
+ onClickCopyClipboard: useCallback(async (e) => {
5004
+ let t = await v();
5005
+ if (!t) return;
5006
+ let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r == null ? [] : r).map((e) => e != null && e.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = unParse(n, o, a.map((t) => t.map((t) => isNullOrUndefined(t) ? "" : s(t.toString(), e))), { delimiter: " " });
5007
+ try {
5008
+ await navigator.clipboard.writeText(c), transitionToast({ message: {
5009
+ type: "Success",
5010
+ content: _("copiedToClipboard")
5011
+ } }, i);
5012
+ } catch (e) {
5013
+ transitionToast({ message: {
5014
+ type: "Error",
5015
+ content: _("unableToCopyToClipboard"),
5016
+ details: e.message
5017
+ } }, i);
5018
+ }
5019
+ }, [v, _]),
5020
+ onSmartUploadResult: useCallback((e) => {
5021
+ let t = isPlainObject(e) && isString(e.errorMessage) ? e.errorMessage : void 0;
5022
+ if (t) {
4880
5023
  transitionToast({ message: {
4881
5024
  type: "Error",
4882
- content: _("clipboardIsEmpty")
5025
+ content: t || "Smart upload failed."
4883
5026
  } }, i);
4884
5027
  return;
4885
5028
  }
4886
- let n = await C(t);
4887
- if (!n.isValid) {
5029
+ if (!isArray(e) || e.length < 2 || !every(e, (e) => isPlainObject(e) && every(values(e), isString))) {
4888
5030
  transitionToast({ message: {
4889
5031
  type: "Error",
4890
- content: _("clipboardReadFailed")
5032
+ content: "Smart upload returned unexpected format.",
5033
+ details: JSON.stringify(e)
4891
5034
  } }, i);
4892
5035
  return;
4893
5036
  }
4894
- f || transitionToast({ message: {
4895
- type: "Success",
4896
- content: _("pasteSuccessful")
4897
- } }, i), e && i(() => d(n));
4898
- } catch {
4899
- transitionToast({ message: {
4900
- type: "Error",
4901
- content: _("clipboardReadNotAllowed")
4902
- } }, i);
4903
- }
4904
- }, [
4905
- l,
4906
- c,
4907
- _,
4908
- y,
4909
- d
4910
- ]), D = useCallback(async (e) => {
4911
- let t = await v();
4912
- if (!t) return;
4913
- let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = a.map((t) => t.map((t) => isNullOrUndefined(t) ? "" : s(t.toString(), e))), l = unParse(n, o, c, { delimiter: " " });
4914
- try {
4915
- await navigator.clipboard.writeText(l), transitionToast({ message: {
4916
- type: "Success",
4917
- content: _("copiedToClipboard")
4918
- } }, i);
4919
- } catch (e) {
4920
- transitionToast({ message: {
4921
- type: "Error",
4922
- content: _("unableToCopyToClipboard"),
4923
- details: e.message
4924
- } }, i);
4925
- }
4926
- }, [v, _]), O = useCallback((e) => {
4927
- let t = isPlainObject(e) && isString(e.errorMessage) ? e.errorMessage : void 0;
4928
- if (t) {
4929
- transitionToast({ message: {
4930
- type: "Error",
4931
- content: t || "Smart upload failed."
4932
- } }, i);
4933
- return;
4934
- }
4935
- if (!isArray(e) || e.length < 2 || !every(e, (e) => isPlainObject(e) && every(values(e), isString))) {
4936
- transitionToast({ message: {
4937
- type: "Error",
4938
- content: "Smart upload returned unexpected format.",
4939
- details: JSON.stringify(e)
4940
- } }, i);
4941
- return;
4942
- }
4943
- let [n, ...a] = e, o = keys(a[0]), s = {
4944
- isValid: !0,
4945
- fields: o,
4946
- units: o.map((e) => n[e] ?? ""),
4947
- rows: a.map((e) => o.map((t) => e[t] ?? "")),
4948
- errors: []
4949
- };
4950
- i(() => y({ parsedResult: s })), i(() => d(s));
4951
- let { onComplete: c } = r ?? {};
4952
- isFunction(c) && c(s), b();
4953
- }, [
4954
- y,
4955
- d,
4956
- r,
4957
- b,
4958
- i
4959
- ]);
4960
- return {
4961
- updateState: y,
4962
- closeModals: b,
4963
- setModalVisibility: S,
4964
- readAndParseInput: w,
4965
- onFileChange: T,
4966
- onClickQuickPasteFromClipBoard: E,
4967
- onClickCopyClipboard: D,
4968
- onSmartUploadResult: O,
5037
+ let [n, ...a] = e, o = keys(a[0]), s = {
5038
+ isValid: !0,
5039
+ fields: o,
5040
+ units: o.map((e) => {
5041
+ var t;
5042
+ return (t = n[e]) == null ? "" : t;
5043
+ }),
5044
+ rows: a.map((e) => o.map((t) => {
5045
+ var n;
5046
+ return (n = e[t]) == null ? "" : n;
5047
+ })),
5048
+ errors: []
5049
+ };
5050
+ i(() => y({ parsedResult: s })), i(() => d(s));
5051
+ let { onComplete: c } = r == null ? {} : r;
5052
+ isFunction(c) && c(s), b();
5053
+ }, [
5054
+ y,
5055
+ d,
5056
+ r,
5057
+ b,
5058
+ i
5059
+ ]),
4969
5060
  deleteAllRows: x
4970
5061
  };
4971
5062
  }, onClickDownLoad = (e, t) => {
4972
- let { fields: n, rows: r } = e, i = e.units?.map((e) => e || "blank") ?? [], a = unParse(n, i, r, { delimiter: " " }), o = new Blob([a], { type: "text/plain" }), s = document.createElement("a");
4973
- s.href = window.URL.createObjectURL(o), s.download = `${t}.csv`, document.body.appendChild(s), s.click(), document.body.removeChild(s);
5063
+ var n, r;
5064
+ let { fields: i, rows: a } = e, o = unParse(i, (n = (r = e.units) == null ? void 0 : r.map((e) => e || "blank")) == null ? [] : n, a, { delimiter: " " }), s = new Blob([o], { type: "text/plain" }), c = document.createElement("a");
5065
+ c.href = window.URL.createObjectURL(s), c.download = `${t}.csv`, document.body.appendChild(c), c.click(), document.body.removeChild(c);
4974
5066
  };
4975
5067
  var hasModalKey = (e) => isObject(e) && "modalKey" in e, injectHandlersDeep = (e, t, n) => cloneDeepWith(e, (e) => {
4976
5068
  if (isArray(e) || !isPlainObject(e)) return;
4977
- let { modalKey: r } = e ?? {};
5069
+ let { modalKey: r } = e == null ? {} : e;
4978
5070
  if (hasModalKey(e) && typeof e.onClick != "function") {
4979
5071
  let i = () => {
4980
- n(r, !t.modalVisibility?.[r]);
5072
+ var e;
5073
+ n(r, !((e = t.modalVisibility) != null && e[r]));
4981
5074
  };
4982
5075
  return {
4983
5076
  ...e,
@@ -5003,174 +5096,177 @@ var initialState = {
5003
5096
  }
5004
5097
  };
5005
5098
  const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
5006
- let { exportData: r, beforeExportData: i, prevalidationConfig: a, validationRules: o, title: s, translations: c, textOnly: l = !1, showImportOptions: u = !0, copyFromClipBoard: d = !0, showDeleteOptions: f = !0, showHelpOption: p = !0, modals: g = [], dynamicOptions: _, onImportComplete: v } = e ?? {}, [y, b] = useState(initialState), { modalVisibility: { smartUploadModal: x = !1, reviewPasteModal: S = !1, helpModal: C = !1 } } = y, { enabled: w, prompt: T = "", onClose: E, onError: D, service: O = () => Promise.resolve() } = t ?? {}, k = useTranslationMap(c), A = useExportData(k, r, i), [j, M] = useTransition(), { readAndParseInput: N, updateState: P, closeModals: F, setModalVisibility: I, onFileChange: L, onClickQuickPasteFromClipBoard: R, onClickCopyClipboard: z, onSmartUploadResult: B, deleteAllRows: V } = useDataImportActions({
5099
+ var r, i, a, o;
5100
+ let { exportData: s, beforeExportData: c, prevalidationConfig: l, validationRules: u, title: d, translations: f, textOnly: p = !1, showImportOptions: g = !0, copyFromClipBoard: _ = !0, showDeleteOptions: v = !0, showHelpOption: y = !0, modals: b = [], dynamicOptions: x, onImportComplete: S } = e == null ? {} : e, [C, w] = useState(initialState), { modalVisibility: { smartUploadModal: T = !1, reviewPasteModal: E = !1, helpModal: D = !1 } } = C, { enabled: O, prompt: k = "", onClose: A, onError: j, service: M = () => Promise.resolve() } = t == null ? {} : t, N = useTranslationMap(f), P = useExportData(N, s, c), [F, I] = useTransition(), L = useDataImportActions({
5007
5101
  config: e,
5008
- state: y,
5009
- setState: b,
5102
+ state: C,
5103
+ setState: w,
5010
5104
  smartUploadConfig: t,
5011
- startTransition: M
5012
- }) ?? {};
5013
- useKeyboardEvent("Escape", () => F());
5014
- let H = u ? [
5105
+ startTransition: I
5106
+ }), { readAndParseInput: R, updateState: z, closeModals: B, setModalVisibility: V, onFileChange: H, onClickQuickPasteFromClipBoard: U, onClickCopyClipboard: W, onSmartUploadResult: G, deleteAllRows: K } = L == null ? {} : L;
5107
+ useKeyboardEvent("Escape", () => B());
5108
+ let q = g ? [
5015
5109
  {
5016
5110
  type: "Option",
5017
- label: k("uploadFile"),
5111
+ label: N("uploadFile"),
5018
5112
  upload: !0,
5019
5113
  uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
5020
- onChange: L,
5114
+ onChange: H,
5021
5115
  testId: `${n}-option-upload-file`
5022
5116
  },
5023
- ...d ? [{
5117
+ ..._ ? [{
5024
5118
  type: "Option",
5025
- label: k("quickPasteFromClipboard"),
5026
- onClick: R,
5119
+ label: N("quickPasteFromClipboard"),
5120
+ onClick: U,
5027
5121
  testId: `${n}-option-quick-paste-from-clipboard`
5028
5122
  }] : [],
5029
- ...d ? [{
5123
+ ..._ ? [{
5030
5124
  type: "Option",
5031
- label: k("pasteWithReview"),
5032
- onClick: () => I("reviewPasteModal", !S),
5125
+ label: N("pasteWithReview"),
5126
+ onClick: () => V("reviewPasteModal", !E),
5033
5127
  testId: `${n}-paste-with-review`
5034
5128
  }] : [],
5035
- ...T && w && t ? [{
5129
+ ...k && O && t ? [{
5036
5130
  type: "Option",
5037
- label: k("smartUpload_smartUpload"),
5038
- onClick: () => I("smartUploadModal", !x),
5131
+ label: N("smartUpload_smartUpload"),
5132
+ onClick: () => V("smartUploadModal", !T),
5039
5133
  testId: `${n}-smart-upload`
5040
5134
  }] : [],
5041
- ...applyModalHandlers(_?.importOptions ?? [], y, I)
5042
- ] : [], U = [
5135
+ ...applyModalHandlers((r = x == null ? void 0 : x.importOptions) == null ? [] : r, C, V)
5136
+ ] : [], J = [
5043
5137
  {
5044
5138
  type: "Option",
5045
- label: k("downloadFile"),
5139
+ label: N("downloadFile"),
5046
5140
  onClick: async () => {
5047
- let e = await A();
5048
- e && e && onClickDownLoad(e, s);
5141
+ let e = await P();
5142
+ e && e && onClickDownLoad(e, d);
5049
5143
  }
5050
5144
  },
5051
- ...l ? [{
5145
+ ...p ? [{
5052
5146
  type: "Option",
5053
- label: k("copyToClipboard"),
5054
- onClick: () => z("dot")
5147
+ label: N("copyToClipboard"),
5148
+ onClick: () => W("dot")
5055
5149
  }] : [{
5056
5150
  type: "Menu",
5057
5151
  testId: `${n}-menu-copy-to-clipboard`,
5058
5152
  menu: {
5059
5153
  trigger: "Text",
5060
- label: k("copyToClipboard"),
5154
+ label: N("copyToClipboard"),
5061
5155
  sections: [{
5062
5156
  type: "Option",
5063
- label: k("copyDecimalDot"),
5064
- onClick: () => z("dot"),
5157
+ label: N("copyDecimalDot"),
5158
+ onClick: () => W("dot"),
5065
5159
  testId: `${n}-option-copy-decimal-dot`
5066
5160
  }, {
5067
5161
  type: "Option",
5068
- label: k("copyDecimalComma"),
5069
- onClick: () => z("comma")
5162
+ label: N("copyDecimalComma"),
5163
+ onClick: () => W("comma")
5070
5164
  }]
5071
5165
  }
5072
5166
  }],
5073
- ...applyModalHandlers(_?.exportOptions ?? [], y, I)
5074
- ], W = f ? [{
5167
+ ...applyModalHandlers((i = x == null ? void 0 : x.exportOptions) == null ? [] : i, C, V)
5168
+ ], Y = v ? [{
5075
5169
  type: "Option",
5076
- label: k("deleteAllRows"),
5077
- onClick: () => V(),
5170
+ label: N("deleteAllRows"),
5171
+ onClick: () => K(),
5078
5172
  testId: `${n}-delete-all-rows`
5079
- }, ...applyModalHandlers(_?.deleteOptions ?? [], y, I)] : [], G = p ? [
5173
+ }, ...applyModalHandlers((a = x == null ? void 0 : x.deleteOptions) == null ? [] : a, C, V)] : [], ee = y ? [
5080
5174
  { type: "Divider" },
5081
5175
  {
5082
5176
  type: "Option",
5083
- label: k("help"),
5084
- onClick: () => I("helpModal", !C)
5177
+ label: N("help"),
5178
+ onClick: () => V("helpModal", !D)
5085
5179
  },
5086
- ...applyModalHandlers(_?.helpOptions ?? [], y, I)
5087
- ] : [], K = [
5088
- ...H.length ? [{
5089
- section: [...H, ...G],
5180
+ ...applyModalHandlers((o = x == null ? void 0 : x.helpOptions) == null ? [] : o, C, V)
5181
+ ] : [], te = [
5182
+ ...q.length ? [{
5183
+ section: [...q, ...ee],
5090
5184
  name: "import-options",
5091
5185
  iconName: "import",
5092
- tooltip: k("import")
5186
+ tooltip: N("import")
5093
5187
  }] : [],
5094
- ...U.length ? [{
5095
- section: U,
5188
+ ...J.length ? [{
5189
+ section: J,
5096
5190
  name: "export-options",
5097
5191
  iconName: "export",
5098
- tooltip: k("export")
5192
+ tooltip: N("export")
5099
5193
  }] : [],
5100
- ...W.length ? [{
5101
- section: W,
5194
+ ...Y.length ? [{
5195
+ section: Y,
5102
5196
  name: "delete-options",
5103
5197
  iconName: "delete",
5104
- tooltip: k("deleteAllRows")
5198
+ tooltip: N("deleteAllRows")
5105
5199
  }] : []
5106
5200
  ];
5107
5201
  return /* @__PURE__ */ jsxs("span", { children: [
5108
- j && /* @__PURE__ */ jsx(Spinner, {
5202
+ F && /* @__PURE__ */ jsx(Spinner, {
5109
5203
  small: !0,
5110
5204
  dark: !0
5111
5205
  }),
5112
- K.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
5206
+ te.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
5113
5207
  sections: e.section,
5114
5208
  iconName: e.iconName,
5115
5209
  tooltip: e.tooltip,
5116
- testId: `data-${e?.name}-menu`
5210
+ testId: `data-${e == null ? void 0 : e.name}-menu`
5117
5211
  }, t)),
5118
- S && /* @__PURE__ */ jsx(PasteWithReviewModal, {
5212
+ E && /* @__PURE__ */ jsx(PasteWithReviewModal, {
5119
5213
  config: e,
5120
- state: y,
5121
- updateState: P,
5122
- setModalVisibility: I,
5123
- readAndParseInput: N,
5124
- onCloseModal: F,
5125
- validationRules: o,
5126
- onCompleteImport: v,
5127
- prevalidationConfig: a,
5128
- t: k,
5129
- loading: j,
5130
- startTransition: M,
5214
+ state: C,
5215
+ updateState: z,
5216
+ setModalVisibility: V,
5217
+ readAndParseInput: R,
5218
+ onCloseModal: B,
5219
+ validationRules: u,
5220
+ onCompleteImport: S,
5221
+ prevalidationConfig: l,
5222
+ t: N,
5223
+ loading: F,
5224
+ startTransition: I,
5131
5225
  testId: n
5132
5226
  }),
5133
- C && /* @__PURE__ */ jsx(HelpModal, {
5134
- visible: C,
5135
- setModalVisibility: I,
5136
- validationRules: o,
5137
- t: k
5227
+ D && /* @__PURE__ */ jsx(HelpModal, {
5228
+ visible: D,
5229
+ setModalVisibility: V,
5230
+ validationRules: u,
5231
+ t: N
5138
5232
  }),
5139
- w && t && /* @__PURE__ */ jsx(SmartUploadModal, {
5140
- visible: x,
5141
- prompt: T,
5142
- onUpload: O,
5143
- onCloseModal: () => F({ callback: E }),
5144
- onComplete: B,
5145
- onError: D,
5146
- heading: k("smartUpload_smartUpload"),
5147
- dialogText: k("smartUpload_description"),
5148
- fileInputText: k("chooseFile"),
5149
- fileInputPlaceholder: k("noFileSelected"),
5150
- uploadText: k("uploadCapitalized"),
5151
- cancelText: k("cancel"),
5233
+ O && t && /* @__PURE__ */ jsx(SmartUploadModal, {
5234
+ visible: T,
5235
+ prompt: k,
5236
+ onUpload: M,
5237
+ onCloseModal: () => B({ callback: A }),
5238
+ onComplete: G,
5239
+ onError: j,
5240
+ heading: N("smartUpload_smartUpload"),
5241
+ dialogText: N("smartUpload_description"),
5242
+ fileInputText: N("chooseFile"),
5243
+ fileInputPlaceholder: N("noFileSelected"),
5244
+ uploadText: N("uploadCapitalized"),
5245
+ cancelText: N("cancel"),
5152
5246
  testId: n
5153
5247
  }),
5154
5248
  /* @__PURE__ */ jsx(ModalsRenderer, {
5155
- modals: g,
5156
- modalVisibility: y?.modalVisibility,
5157
- onCloseModal: F,
5249
+ modals: b,
5250
+ modalVisibility: C == null ? void 0 : C.modalVisibility,
5251
+ onCloseModal: B,
5158
5252
  testId: n
5159
5253
  })
5160
5254
  ] });
5161
- }, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
5255
+ }, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop, ...o }) => {
5162
5256
  let c = useContext(DisabledContext), l = useRef(null), u = () => {
5163
- i || c || l.current?.click();
5257
+ var e;
5258
+ i || c || (e = l.current) == null || e.click();
5164
5259
  }, d = (e) => {
5165
- let t = n ? e.target.files : e.target.files?.[0], r = {
5260
+ var t;
5261
+ let r = n ? e.target.files : (t = e.target.files) == null ? void 0 : t[0];
5262
+ a({
5166
5263
  ...e,
5167
5264
  target: {
5168
5265
  ...e.target,
5169
- value: t,
5266
+ value: r,
5170
5267
  name: e.target.name
5171
5268
  }
5172
- };
5173
- a(r), l.current && (l.current.value = "");
5269
+ }), l.current && (l.current.value = "");
5174
5270
  };
5175
5271
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
5176
5272
  ...o,
@@ -5196,40 +5292,43 @@ const Label = ({ label: e = null, width: t = "auto", helpText: n = "", helpTextM
5196
5292
  onClick: () => {},
5197
5293
  tooltip: "",
5198
5294
  testId: void 0
5199
- }, info: o, libraryIcon: s, labelLeft: c = !1, textTransform: l = TextTransform.CAPITALIZE }) => /* @__PURE__ */ jsx("div", {
5200
- className: cx(label_module_default.label, c ? label_module_default.labelLeft : ""),
5201
- children: /* @__PURE__ */ jsxs("label", {
5202
- style: {
5203
- textTransform: l,
5204
- width: t || ""
5205
- },
5206
- children: [e, /* @__PURE__ */ jsxs("div", {
5207
- className: label_module_default.icons,
5208
- children: [
5209
- (n || i) && /* @__PURE__ */ jsx(HelpIcon, {
5210
- text: n,
5211
- onClick: i,
5212
- maxWidth: r
5213
- }),
5214
- o && /* @__PURE__ */ jsx(HelpIcon, {
5215
- text: o,
5216
- icon: IconType.INFO
5217
- }),
5218
- a && a.visible && a.onClick && /* @__PURE__ */ jsx(HelpIcon, {
5219
- onClick: a.onClick,
5220
- icon: a.active ? IconType.LOCK : IconType.UNLOCK,
5221
- active: a.active,
5222
- testId: a.testId
5223
- }),
5224
- s && /* @__PURE__ */ jsx(HelpIcon, {
5225
- text: s?.tooltip ?? "",
5226
- onClick: s.onClick,
5227
- icon: IconType.LIBRARY
5228
- })
5229
- ]
5230
- })]
5231
- })
5232
- });
5295
+ }, info: o, libraryIcon: s, labelLeft: c = !1, textTransform: l = TextTransform.CAPITALIZE }) => {
5296
+ var u;
5297
+ return /* @__PURE__ */ jsx("div", {
5298
+ className: cx(label_module_default.label, c ? label_module_default.labelLeft : ""),
5299
+ children: /* @__PURE__ */ jsxs("label", {
5300
+ style: {
5301
+ textTransform: l,
5302
+ width: t || ""
5303
+ },
5304
+ children: [e, /* @__PURE__ */ jsxs("div", {
5305
+ className: label_module_default.icons,
5306
+ children: [
5307
+ (n || i) && /* @__PURE__ */ jsx(HelpIcon, {
5308
+ text: n,
5309
+ onClick: i,
5310
+ maxWidth: r
5311
+ }),
5312
+ o && /* @__PURE__ */ jsx(HelpIcon, {
5313
+ text: o,
5314
+ icon: IconType.INFO
5315
+ }),
5316
+ a && a.visible && a.onClick && /* @__PURE__ */ jsx(HelpIcon, {
5317
+ onClick: a.onClick,
5318
+ icon: a.active ? IconType.LOCK : IconType.UNLOCK,
5319
+ active: a.active,
5320
+ testId: a.testId
5321
+ }),
5322
+ s && /* @__PURE__ */ jsx(HelpIcon, {
5323
+ text: (u = s == null ? void 0 : s.tooltip) == null ? "" : u,
5324
+ onClick: s.onClick,
5325
+ icon: IconType.LIBRARY
5326
+ })
5327
+ ]
5328
+ })]
5329
+ })
5330
+ });
5331
+ };
5233
5332
  var form_module_default = {
5234
5333
  field: "_field_1xoss_1",
5235
5334
  labelLeft: "_labelLeft_1xoss_5",
@@ -5432,46 +5531,44 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
5432
5531
  }, MetaCount = ({ item: e }) => e.metaCount === void 0 ? null : /* @__PURE__ */ jsx(Badge, {
5433
5532
  color: "rgba(0,0,0,0.25)",
5434
5533
  title: e.metaCount
5435
- }), ItemContent = ({ item: e, expanding: t }) => {
5436
- let n = (e) => {
5437
- e.preventDefault(), e.stopPropagation();
5438
- }, r = !!t && !!e.active && !!e.content;
5439
- return /* @__PURE__ */ jsx(Collapse, {
5440
- expanded: r,
5441
- children: /* @__PURE__ */ jsx("div", {
5442
- className: list_module_default.itemContent,
5443
- onClick: n,
5444
- children: e.content
5445
- })
5446
- });
5447
- }, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
5448
- let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: c, title: l, name: u, icon: d, testId: f } = e;
5534
+ }), ItemContent = ({ item: e, expanding: t }) => /* @__PURE__ */ jsx(Collapse, {
5535
+ expanded: !!t && !!e.active && !!e.content,
5536
+ children: /* @__PURE__ */ jsx("div", {
5537
+ className: list_module_default.itemContent,
5538
+ onClick: (e) => {
5539
+ e.preventDefault(), e.stopPropagation();
5540
+ },
5541
+ children: e.content
5542
+ })
5543
+ }), ListSubheading = forwardRef(({ item: e, index: t }, n) => {
5544
+ var r;
5545
+ let i = useContext(DisabledContext), { actions: a, disabled: o, expanded: c, onClick: l, title: u, name: d, icon: f, testId: p } = e;
5449
5546
  return /* @__PURE__ */ jsx("div", {
5450
5547
  ref: (e) => {
5451
5548
  n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
5452
5549
  },
5453
- "data-testid": f ?? null,
5454
- className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", c ? list_module_default.action : ""),
5550
+ "data-testid": p == null ? null : p,
5551
+ className: cx(list_module_default.item, list_module_default.heading, o || i ? list_module_default.disabled : "", l ? list_module_default.action : ""),
5455
5552
  onClick: (e) => {
5456
- c && c(e);
5553
+ l && l(e);
5457
5554
  },
5458
- title: l,
5555
+ title: u,
5459
5556
  children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
5460
5557
  className: list_module_default.itemHeader,
5461
5558
  children: [
5462
- typeof o == "boolean" && /* @__PURE__ */ jsx("div", {
5463
- className: cx(list_module_default.expandIcon, o && list_module_default.expanded),
5559
+ typeof c == "boolean" && /* @__PURE__ */ jsx("div", {
5560
+ className: cx(list_module_default.expandIcon, c && list_module_default.expanded),
5464
5561
  children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHEVRON_RIGHT })
5465
5562
  }),
5466
5563
  /* @__PURE__ */ jsx(Name, {
5467
- name: u,
5468
- icon: d
5564
+ name: d,
5565
+ icon: f
5469
5566
  }),
5470
5567
  /* @__PURE__ */ jsxs("div", {
5471
5568
  className: list_module_default.right,
5472
- children: [/* @__PURE__ */ jsx(MetaCount, { item: e }), !(a || r) && i && /* @__PURE__ */ jsx("div", {
5569
+ children: [/* @__PURE__ */ jsx(MetaCount, { item: e }), !(o || i) && a && /* @__PURE__ */ jsx("div", {
5473
5570
  className: list_module_default.actions,
5474
- children: /* @__PURE__ */ jsx(Actions, { actions: e.actions ?? [] })
5571
+ children: /* @__PURE__ */ jsx(Actions, { actions: (r = e.actions) == null ? [] : r })
5475
5572
  })]
5476
5573
  })
5477
5574
  ]
@@ -5479,8 +5576,11 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
5479
5576
  });
5480
5577
  }), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
5481
5578
  let o = useContext(DisabledContext), c = (e, t, s, c, l, u) => {
5482
- let d = t.actions && t.actions.find((e) => e.label && String(e.label)?.toLowerCase() === "edit"), f = !!(d || t.url || t.onClick), p = t.level && t.level > 1 ? (t.level - 1) * 20 : 0, m = t.component || "a";
5483
- return /* @__PURE__ */ jsx(m, {
5579
+ let d = t.actions && t.actions.find((e) => {
5580
+ var t;
5581
+ return e.label && ((t = String(e.label)) == null ? void 0 : t.toLowerCase()) === "edit";
5582
+ }), f = !!(d || t.url || t.onClick), p = t.level && t.level > 1 ? (t.level - 1) * 20 : 0;
5583
+ return /* @__PURE__ */ jsx(t.component || "a", {
5484
5584
  href: t.url,
5485
5585
  to: t.url,
5486
5586
  ref: u,
@@ -5535,19 +5635,19 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
5535
5635
  let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = useSortable({
5536
5636
  id: e.toString(),
5537
5637
  animateLayoutChanges: () => !1
5538
- }), l = {
5638
+ });
5639
+ return c(e, t, {
5539
5640
  transform: CSS.Translate.toString(a),
5540
5641
  transition: o,
5541
5642
  opacity: s ? 0 : 1
5542
- };
5543
- return c(e, t, l, n, r, i);
5643
+ }, n, r, i);
5544
5644
  })(t, e) : c(t, e);
5545
5645
  }), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
5546
5646
  let [i, a] = useState(null), o = (e) => {
5547
5647
  a(e.active.id);
5548
5648
  }, s = (e) => {
5549
5649
  a(null);
5550
- let { active: t, over: n } = e, i = t?.id, o = n?.id;
5650
+ let { active: t, over: n } = e, i = t == null ? void 0 : t.id, o = n == null ? void 0 : n.id;
5551
5651
  o !== void 0 && i !== o && r({
5552
5652
  from: Number(i),
5553
5653
  to: Number(o)
@@ -5593,10 +5693,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
5593
5693
  });
5594
5694
  };
5595
5695
  return useEffect(() => {
5596
- if (a) {
5597
- let t = d(e);
5598
- f(t);
5599
- }
5696
+ a && f(d(e));
5600
5697
  }, [a]), /* @__PURE__ */ jsx("div", {
5601
5698
  className: cx(list_module_default.listContent, r || s ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
5602
5699
  ref: l,
@@ -5718,7 +5815,7 @@ var option_dropdown_module_default = {
5718
5815
  heading: "_heading_12x4u_32"
5719
5816
  };
5720
5817
  const Option = ({ option: e, onChange: t }) => {
5721
- let { key: n, label: r, selected: i, testId: a } = e ?? {};
5818
+ let { key: n, label: r, selected: i, testId: a } = e == null ? {} : e;
5722
5819
  return /* @__PURE__ */ jsx("div", {
5723
5820
  className: option_dropdown_module_default.item,
5724
5821
  children: /* @__PURE__ */ jsx(CheckBox, {
@@ -5745,31 +5842,28 @@ const Layer = ({ options: e, onChangeOptions: t, showHeader: n, maxHeight: r, te
5745
5842
  children: [
5746
5843
  /* @__PURE__ */ jsx("a", {
5747
5844
  onClick: (n) => {
5748
- let r = e.map((e) => ({
5845
+ t(n, e.map((e) => ({
5749
5846
  ...e,
5750
5847
  selected: !0
5751
- }));
5752
- t(n, r);
5848
+ })));
5753
5849
  },
5754
5850
  children: "All"
5755
5851
  }),
5756
5852
  /* @__PURE__ */ jsx("a", {
5757
5853
  onClick: (n) => {
5758
- let r = e.map((e) => ({
5854
+ t(n, e.map((e) => ({
5759
5855
  ...e,
5760
5856
  selected: !1
5761
- }));
5762
- t(n, r);
5857
+ })));
5763
5858
  },
5764
5859
  children: "Clear"
5765
5860
  }),
5766
5861
  /* @__PURE__ */ jsx("a", {
5767
5862
  onClick: (n) => {
5768
- let r = e.map((e) => ({
5863
+ t(n, e.map((e) => ({
5769
5864
  ...e,
5770
- selected: !e?.selected
5771
- }));
5772
- t(n, r);
5865
+ selected: !(e != null && e.selected)
5866
+ })));
5773
5867
  },
5774
5868
  children: "Invert"
5775
5869
  })
@@ -5781,11 +5875,11 @@ const Layer = ({ options: e, onChangeOptions: t, showHeader: n, maxHeight: r, te
5781
5875
  default: return /* @__PURE__ */ jsx(Option, {
5782
5876
  option: n,
5783
5877
  onChange: (r) => {
5784
- let { value: i } = n, a = e.map((e) => e.value === i ? {
5878
+ let { value: i } = n;
5879
+ t(r, e.map((e) => e.value === i ? {
5785
5880
  ...e,
5786
- selected: !e?.selected
5787
- } : e);
5788
- t(r, a);
5881
+ selected: !(e != null && e.selected)
5882
+ } : e));
5789
5883
  }
5790
5884
  }, r);
5791
5885
  }
@@ -5883,7 +5977,7 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
5883
5977
  className: cx(u && radio_button_module_default.labelMargin),
5884
5978
  children: x
5885
5979
  }), v.map((t, n) => {
5886
- let r = t?.checked || t?.value === b || !1;
5980
+ let r = (t == null ? void 0 : t.checked) || (t == null ? void 0 : t.value) === b || !1;
5887
5981
  return /* @__PURE__ */ jsx(RadioInput, {
5888
5982
  name: t.name || t.value,
5889
5983
  label: t.label,
@@ -6138,7 +6232,7 @@ var tabs_module_default = {
6138
6232
  const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick: a, right: o, invalid: s, badge: c, testId: l }) => {
6139
6233
  let u = getComputedStyle(document.body).getPropertyValue("--color-text-error");
6140
6234
  return /* @__PURE__ */ jsx("a", {
6141
- id: e?.toString(),
6235
+ id: e == null ? void 0 : e.toString(),
6142
6236
  href: t,
6143
6237
  className: cx(tabs_module_default.item, i ? tabs_module_default.active : "", r ? tabs_module_default.disabled : "", n && !i ? tabs_module_default.hidden : "", o ? tabs_module_default.right : tabs_module_default.left),
6144
6238
  onClick: a,
@@ -6152,7 +6246,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
6152
6246
  }) : c ? /* @__PURE__ */ jsx(Badge, {
6153
6247
  small: !0,
6154
6248
  margin: "-4px",
6155
- title: c?.toString(),
6249
+ title: c == null ? void 0 : c.toString(),
6156
6250
  children: e
6157
6251
  }) : e
6158
6252
  });
@@ -6160,23 +6254,24 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
6160
6254
  className: cx(n ? tabs_module_default.contentPadding : ""),
6161
6255
  children: e.map((e, n) => t === n && e)
6162
6256
  }) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding: c = !0, onChangeTab: l, activeTabIndex: u = void 0, tabs: d = void 0, testId: f }) => {
6163
- let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
6164
- value: t,
6165
- url: e.props.url,
6166
- label: e.props.label,
6167
- hidden: e.props.hidden,
6168
- disabled: e.props.disabled || p,
6169
- badge: e.props.badge,
6170
- testId: e.props?.testId && `${e.props.testId}-${t}`
6171
- })) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
6257
+ let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => {
6258
+ var n;
6259
+ return {
6260
+ value: t,
6261
+ url: e.props.url,
6262
+ label: e.props.label,
6263
+ hidden: e.props.hidden,
6264
+ disabled: e.props.disabled || p,
6265
+ badge: e.props.badge,
6266
+ testId: ((n = e.props) == null ? void 0 : n.testId) && `${e.props.testId}-${t}`
6267
+ };
6268
+ }) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
6172
6269
  simpleInputs: !1,
6173
6270
  options: h,
6174
6271
  selectedOptions: void 0
6175
- } : standardizeInputs(h, r), b = m || y == null ? void 0 : _ ? y : y.value, x = u === void 0 ? v?.findIndex((e) => e.value === b) : u, S = x === -1 ? 0 : x, C = (t, n, r) => {
6176
- if (m) {
6177
- let e = n.key || n.label || null;
6178
- l(t, e);
6179
- } else {
6272
+ } : standardizeInputs(h, r), b = m || y == null ? void 0 : _ ? y : y.value, x = u === void 0 ? v == null ? void 0 : v.findIndex((e) => e.value === b) : u, S = x === -1 ? 0 : x, C = (t, n, r) => {
6273
+ if (m) l(t, n.key || n.label || null);
6274
+ else {
6180
6275
  let t = r.target;
6181
6276
  t.name = e, t.value = n.value, t.label = n.label, i(r);
6182
6277
  }
@@ -6200,7 +6295,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
6200
6295
  "data-testid": f,
6201
6296
  children: v.map(w)
6202
6297
  }), /* @__PURE__ */ jsx(Content$1, {
6203
- activeTabIndex: S ?? 0,
6298
+ activeTabIndex: S == null ? 0 : S,
6204
6299
  contentPadding: c,
6205
6300
  children: n
6206
6301
  })] }) : null;
@@ -6328,7 +6423,7 @@ const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, t
6328
6423
  href: t || "#",
6329
6424
  to: t,
6330
6425
  onClick: (e) => {
6331
- (a || l) && e.preventDefault(), r?.(e);
6426
+ (a || l) && e.preventDefault(), r == null || r(e);
6332
6427
  },
6333
6428
  "aria-disabled": a || l,
6334
6429
  "data-testid": o,
@@ -6477,7 +6572,7 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6477
6572
  }, C = (e) => {
6478
6573
  e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
6479
6574
  }, w = (e) => {
6480
- e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
6575
+ e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c == null || c(e);
6481
6576
  };
6482
6577
  return /* @__PURE__ */ jsx("div", {
6483
6578
  className: cx(list_module_default.item, list_module_default.action, d ? list_module_default.active : "", n > 0 ? list_module_default.indented : "", h ? list_module_default.bordered : ""),
@@ -6500,7 +6595,7 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6500
6595
  colored: r ? !0 : Color.MUTED,
6501
6596
  small: !0,
6502
6597
  round: !0,
6503
- icon: r ? s?.collapse || IconType.COLLAPSE : s?.expand || IconType.EXPAND,
6598
+ icon: r ? (s == null ? void 0 : s.collapse) || IconType.COLLAPSE : (s == null ? void 0 : s.expand) || IconType.EXPAND,
6504
6599
  onClick: b
6505
6600
  })
6506
6601
  }),
@@ -6523,38 +6618,49 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6523
6618
  className: tree_module_default.placeholder,
6524
6619
  style: { left: e * 24 }
6525
6620
  }), Tree = ({ list: e, canDrop: t, draggable: n = !1, onListReorder: r, onChangeOpen: i, testId: a, isInitialOpen: o = !1, autoOpenActiveItems: s = !1, treeRef: l, itemHasChild: u, onItemToggle: d, icons: f, allowParentReassignment: m, stickyHeader: h, height: g, render: _ }) => {
6526
- let v = l ?? useRef(null), y = (e) => {
6621
+ var v;
6622
+ let y = l == null ? useRef(null) : l, b = (e) => {
6527
6623
  i && i(e);
6528
- }, b = (t) => {
6624
+ }, x = (t) => {
6529
6625
  let n = e.items.find((e) => e.id === t);
6530
- return n && n.parent ? [n.parent, ...b(n.parent)] : [];
6626
+ return n && n.parent ? [n.parent, ...x(n.parent)] : [];
6531
6627
  };
6532
6628
  useEffect(() => {
6533
6629
  if (s) {
6534
- let t = e.items.find((e) => e.active);
6535
- if (t) {
6536
- let e = b(t.id);
6537
- v.current?.open(e);
6630
+ let n = e.items.find((e) => e.active);
6631
+ if (n) {
6632
+ var t;
6633
+ let e = x(n.id);
6634
+ (t = y.current) == null || t.open(e);
6538
6635
  }
6539
6636
  }
6540
6637
  }, [s, e.items]);
6541
- let x = (e, t) => e?.findIndex((e) => e?.id === t) ?? -1, S = (e, t) => {
6542
- let n = x(t, e?.parent);
6638
+ let S = (e, t) => {
6639
+ var n;
6640
+ return (n = e == null ? void 0 : e.findIndex((e) => (e == null ? void 0 : e.id) === t)) == null ? -1 : n;
6641
+ }, C = (e, t) => {
6642
+ let n = S(t, e == null ? void 0 : e.parent);
6543
6643
  if (n >= 0) {
6544
- let r = t?.find((e) => e?.id === t[n]?.parent);
6644
+ let r = t == null ? void 0 : t.find((e) => {
6645
+ var r;
6646
+ return (e == null ? void 0 : e.id) === ((r = t[n]) == null ? void 0 : r.parent);
6647
+ });
6545
6648
  e.parent = r ? r.id : 0;
6546
6649
  }
6547
- }, C = (e, t) => t?.filter((t) => t?.id !== e?.id) ?? [], w = (e, t, n) => (n?.splice(t, 0, e), n), T = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
6650
+ }, w = (e, t) => {
6651
+ var n;
6652
+ return (n = t == null ? void 0 : t.filter((t) => (t == null ? void 0 : t.id) !== (e == null ? void 0 : e.id))) == null ? [] : n;
6653
+ }, T = (e, t, n) => (n == null || n.splice(t, 0, e), n), E = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
6548
6654
  id: e,
6549
6655
  parent: t,
6550
6656
  droppable: n,
6551
6657
  ...r
6552
- })), E = (e, t) => {
6658
+ })), D = (e, t) => {
6553
6659
  let { dragSource: n, dropTarget: i } = t, a = [...e];
6554
6660
  if (!r) return;
6555
- let o = x(a, n?.id), s = x(a, n?.parent), c = [];
6556
- n?.parent === i?.id && o === 0 && m && (S(n, a), a = C(n, a), a = w(n, s, a)), c = T(a), r(c);
6557
- }, D = e?.items?.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i,...a }) => ({
6661
+ let o = S(a, n == null ? void 0 : n.id), s = S(a, n == null ? void 0 : n.parent), c = [];
6662
+ (n == null ? void 0 : n.parent) === (i == null ? void 0 : i.id) && o === 0 && m && (C(n, a), a = w(n, a), a = T(n, s, a)), c = E(a), r(c);
6663
+ }, O = e == null || (v = e.items) == null ? void 0 : v.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i, ...a }) => ({
6558
6664
  id: e,
6559
6665
  text: r,
6560
6666
  droppable: t,
@@ -6578,36 +6684,39 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6578
6684
  options: getBackendOptions(),
6579
6685
  context: window,
6580
6686
  children: /* @__PURE__ */ jsx(Tree$1, {
6581
- ref: v,
6582
- tree: D,
6687
+ ref: y,
6688
+ tree: O,
6583
6689
  sort: !1,
6584
6690
  insertDroppableFirst: !1,
6585
6691
  canDrag: () => n,
6586
6692
  canDrop: t || ((e, { dragSource: t, dropTargetId: n }) => {
6587
- if (t?.parent === n) return !0;
6693
+ if ((t == null ? void 0 : t.parent) === n) return !0;
6588
6694
  }),
6589
6695
  rootId: 0,
6590
- render: (e, { depth: t, hasChild: r, handleRef: i, isOpen: a, onToggle: o }) => _ ? _(e, {
6591
- depth: t,
6592
- draggable: n,
6593
- handleRef: i,
6594
- hasChild: r,
6595
- isOpen: a,
6596
- onToggle: o
6597
- }) : /* @__PURE__ */ jsx(TreeItem, {
6598
- hasChild: u ? u(e) : r,
6599
- node: e,
6600
- depth: t,
6601
- isOpen: a,
6602
- onToggle: () => {
6603
- d?.(e, !a), o();
6604
- },
6605
- draggable: n,
6606
- icons: f,
6607
- onDrop: e.data?.onDrop
6608
- }),
6609
- onDrop: E,
6610
- onChangeOpen: y,
6696
+ render: (e, { depth: t, hasChild: r, handleRef: i, isOpen: a, onToggle: o }) => {
6697
+ var s;
6698
+ return _ ? _(e, {
6699
+ depth: t,
6700
+ draggable: n,
6701
+ handleRef: i,
6702
+ hasChild: r,
6703
+ isOpen: a,
6704
+ onToggle: o
6705
+ }) : /* @__PURE__ */ jsx(TreeItem, {
6706
+ hasChild: u ? u(e) : r,
6707
+ node: e,
6708
+ depth: t,
6709
+ isOpen: a,
6710
+ onToggle: () => {
6711
+ d == null || d(e, !a), o();
6712
+ },
6713
+ draggable: n,
6714
+ icons: f,
6715
+ onDrop: (s = e.data) == null ? void 0 : s.onDrop
6716
+ });
6717
+ },
6718
+ onDrop: D,
6719
+ onChangeOpen: b,
6611
6720
  dropTargetOffset: 10,
6612
6721
  placeholderRender: (e, { depth: t }) => /* @__PURE__ */ jsx(TreePlaceholder, { depth: t }),
6613
6722
  placeholderComponent: "div",
@@ -6627,7 +6736,7 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6627
6736
  }, useRunAfterUpdate = () => {
6628
6737
  let e = useRef(null);
6629
6738
  return useLayoutEffect(() => {
6630
- e.current &&= (e.current(), null);
6739
+ e.current && (e.current(), e.current = null);
6631
6740
  }), (t) => {
6632
6741
  e.current = t;
6633
6742
  };
@@ -6636,7 +6745,14 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6636
6745
  return useEffect(() => {
6637
6746
  t.current = e;
6638
6747
  }, [e]), t.current;
6639
- }, getPreferredUnit = (e, t) => t?.[e] || (console.log(`Warning: 'unitTemplate' missing for '${e}'. Using initial unit, preferred unit or value unit.`), unitFromQuantity(e) ?? "");
6748
+ }, getPreferredUnit = (e, t) => {
6749
+ let n = t == null ? void 0 : t[e];
6750
+ if (!n) {
6751
+ var r;
6752
+ return console.log(`Warning: 'unitTemplate' missing for '${e}'. Using initial unit, preferred unit or value unit.`), (r = unitFromQuantity(e)) == null ? "" : r;
6753
+ }
6754
+ return n;
6755
+ };
6640
6756
  let PredefinedOptionsMenuState = /* @__PURE__ */ function(e) {
6641
6757
  return e.CUSTOM = "custom", e.PREDEFINED = "predefined", e;
6642
6758
  }({});
@@ -6645,18 +6761,20 @@ const isWrongValue = (e) => e === "undefined" || e === void 0 || e === "" || e =
6645
6761
  let t = getUnit(e);
6646
6762
  return !KNOWN_UNITS.includes(t);
6647
6763
  }, checkConversion = ({ value: e, unitkey: t, toUnit: n }) => {
6648
- let r = ALT_UNITS[t];
6649
- if (!r || r.length === 0 || !validateNumber(e)?.valid || !r.includes(n)) return !1;
6650
- let i = getUnit(String(e));
6651
- return !(i && !r.includes(i));
6764
+ var r;
6765
+ let i = ALT_UNITS[t];
6766
+ if (!i || i.length === 0 || !((r = validateNumber(e)) != null && r.valid) || !i.includes(n)) return !1;
6767
+ let a = getUnit(String(e));
6768
+ return !(a && !i.includes(a));
6652
6769
  }, convertUnit = ({ value: e, unitkey: t, toUnit: n, fromUnit: r, doNotConvertValue: i = !1, exactPrecision: a = !1 }) => {
6653
- let o = isValueWithUnit(e) ? getValue(e) : e, s = [Infinity, -Infinity].includes(Number(o));
6654
- if (i || s) return {
6655
- value: o,
6770
+ var o;
6771
+ let s = isValueWithUnit(e) ? getValue(e) : e, c = [Infinity, -Infinity].includes(Number(s));
6772
+ if (i || c) return {
6773
+ value: s,
6656
6774
  error: null
6657
6775
  };
6658
- let c = r || (isValueWithUnit(e) ? getUnit(e) : unitFromQuantity(t));
6659
- if (!validateNumber(o)?.valid) return {
6776
+ let l = r || (isValueWithUnit(e) ? getUnit(e) : unitFromQuantity(t));
6777
+ if (!((o = validateNumber(s)) != null && o.valid)) return {
6660
6778
  value: void 0,
6661
6779
  error: "Invalid number format"
6662
6780
  };
@@ -6664,28 +6782,24 @@ const isWrongValue = (e) => e === "undefined" || e === void 0 || e === "" || e =
6664
6782
  value: void 0,
6665
6783
  error: "Target unit is missing"
6666
6784
  };
6667
- if (!c) return {
6785
+ if (!l) return {
6668
6786
  value: void 0,
6669
6787
  error: "Source unit is missing"
6670
6788
  };
6671
- if (isWrongValue(o)) return {
6789
+ if (isWrongValue(s)) return {
6672
6790
  value: void 0,
6673
6791
  error: "Value is invalid for conversion"
6674
6792
  };
6675
6793
  try {
6676
- let e = withUnit(o, c);
6677
- if (checkConversion({
6794
+ let e = withUnit(s, l);
6795
+ return checkConversion({
6678
6796
  value: e,
6679
6797
  toUnit: n,
6680
6798
  unitkey: t
6681
- })) {
6682
- let t = a ? convertSamePrecision(e, n) : convertAndGetValue(e, n);
6683
- return {
6684
- value: getValue(safeToString(t)),
6685
- error: null
6686
- };
6687
- }
6688
- return {
6799
+ }) ? {
6800
+ value: getValue(safeToString(a ? convertSamePrecision(e, n) : convertAndGetValue(e, n))),
6801
+ error: null
6802
+ } : {
6689
6803
  value: getValue(e),
6690
6804
  error: null
6691
6805
  };
@@ -6710,7 +6824,7 @@ const isWrongValue = (e) => e === "undefined" || e === void 0 || e === "" || e =
6710
6824
  exactPrecision: !0
6711
6825
  }) : { value: e };
6712
6826
  }, getStringName = (e) => isObject(e) && !isArray(e) && !isFunction(e) ? get(e, "fieldName", "") : typeof e == "string" ? e : "";
6713
- var isUnitKnown = (e = "") => KNOWN_UNITS?.includes(e);
6827
+ var isUnitKnown = (e = "") => KNOWN_UNITS == null ? void 0 : KNOWN_UNITS.includes(e);
6714
6828
  const isKnownUnit = (e, t) => {
6715
6829
  let n = getUnit(e || "");
6716
6830
  return isUnitKnown(t) && isUnitKnown(n);
@@ -6731,10 +6845,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6731
6845
  }), disabledValidation: O = !1, allowEmpty: k = !1, convertBackToStorageUnit: A = !1, enableCosmeticRounding: j = !0, enableDisplayRounding: M = !1, roundDisplayValue: N, selectOnFocus: P = !0, groupOrder: F, tooltip: I = null }) => {
6732
6846
  let L = useUnitContext(), R = useRunAfterUpdate();
6733
6847
  typeof l == "number" && (l = `${l}`);
6734
- let [z = "", B = ""] = l === void 0 ? [] : split(l), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
6848
+ let [z = "", B = ""] = l === void 0 ? [] : split(l), V = useMemo(() => getPreferredUnit(u, b || (L == null ? void 0 : L.unitTemplate)), [
6735
6849
  u,
6736
6850
  b,
6737
- L?.unitTemplate
6851
+ L == null ? void 0 : L.unitTemplate
6738
6852
  ]), H = isKnownUnit(l, V), U = f || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
6739
6853
  value: l,
6740
6854
  toUnit: U,
@@ -6747,8 +6861,8 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6747
6861
  } : {
6748
6862
  value: G,
6749
6863
  unit: U
6750
- }), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
6751
- if (!e?.value) return;
6864
+ }), J = k || (K == null ? void 0 : K.value) === void 0, [Y, ee] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), te = !!(O || n), X = C && C.find((e) => {
6865
+ if (!(e != null && e.value)) return;
6752
6866
  if (E) return E === e.valueKey;
6753
6867
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
6754
6868
  value: String(l),
@@ -6756,34 +6870,36 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6756
6870
  toUnit: t
6757
6871
  });
6758
6872
  return withUnit(n, t) === e.value;
6759
- }), Vd = () => {
6760
- let e = l ?? "", t = K.unit;
6761
- if (checkConversion({
6762
- value: e,
6873
+ }), ne = () => {
6874
+ var e;
6875
+ let t = (e = l) == null ? "" : e, n = K.unit;
6876
+ if (!checkConversion({
6877
+ value: t,
6763
6878
  unitkey: u,
6764
- toUnit: t
6879
+ toUnit: n
6765
6880
  })) {
6766
- if (u) try {
6767
- let t = altUnitsList(e, u);
6768
- return getValue(e) === "" ? t.map((e) => ["", e[1]]) : t;
6769
- } catch {
6770
- return null;
6771
- }
6772
- } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6773
- }, Hd = (t) => {
6774
- let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
6881
+ let e = getAltUnitsListByQuantity(u);
6882
+ return e == null ? void 0 : e.map((e) => ["", e == null ? void 0 : e.unit]);
6883
+ } else if (u) try {
6884
+ let e = altUnitsList(t, u);
6885
+ return getValue(t) === "" ? e.map((e) => ["", e[1]]) : e;
6886
+ } catch {
6887
+ return null;
6888
+ }
6889
+ }, re = (t) => {
6890
+ let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, (K == null ? void 0 : K.unit) || "");
6775
6891
  h({ target: {
6776
- value: s,
6892
+ value: A ? withUnit(convertAndGetValue(o, B), B) : o,
6777
6893
  name: n
6778
6894
  } });
6779
- let [c, l] = split(o);
6895
+ let [s, c] = split(o);
6780
6896
  q({
6781
- value: c,
6782
- unit: l
6897
+ value: s,
6898
+ unit: c
6783
6899
  }), R(() => {
6784
6900
  r.selectionStart = a, r.selectionEnd = a;
6785
6901
  });
6786
- }, Ud = (e, t) => {
6902
+ }, ie = (e, t) => {
6787
6903
  t === K.unit || isNaN(Number(e)) || (q({
6788
6904
  value: e,
6789
6905
  unit: t
@@ -6814,7 +6930,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6814
6930
  e !== void 0 && q({
6815
6931
  value: e,
6816
6932
  unit: t
6817
- }), zd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6933
+ }), ee(C && X && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6818
6934
  }
6819
6935
  }, [
6820
6936
  U,
@@ -6822,8 +6938,8 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6822
6938
  i,
6823
6939
  T
6824
6940
  ]);
6825
- let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
6826
- let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6941
+ let Z = ne(), Q = label(K.unit) || K.unit || "", ae = p || !Z || Z && Z.length === 1, oe = getStringName(e), $, se = (t) => {
6942
+ let r = t != null && t.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6827
6943
  if (checkConversion({
6828
6944
  value: r,
6829
6945
  unitkey: u,
@@ -6842,9 +6958,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6842
6958
  type: MenuType.OPTION,
6843
6959
  inline: !0,
6844
6960
  onClick: () => {
6845
- validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6961
+ validateNumber(i).valid && !n && (ee(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6846
6962
  value: r,
6847
- name: typeof e == "string" ? e : e?.fieldName || "",
6963
+ name: typeof e == "string" ? e : (e == null ? void 0 : e.fieldName) || "",
6848
6964
  predefinedSelected: !0,
6849
6965
  predefinedOption: t
6850
6966
  } }));
@@ -6854,25 +6970,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6854
6970
  height: "0"
6855
6971
  })] }),
6856
6972
  description: o,
6857
- selected: Y === t && J === PredefinedOptionsMenuState.PREDEFINED
6973
+ selected: X === t && Y === PredefinedOptionsMenuState.PREDEFINED
6858
6974
  };
6859
6975
  };
6860
6976
  if ($ = [{
6861
6977
  type: MenuType.OPTION,
6862
6978
  inline: !0,
6863
6979
  onClick: () => {
6864
- J !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
6980
+ Y !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
6865
6981
  value: withUnit(K.value, K.unit),
6866
- name: typeof e == "string" ? e : e?.fieldName || ""
6982
+ name: typeof e == "string" ? e : (e == null ? void 0 : e.fieldName) || ""
6867
6983
  } });
6868
6984
  },
6869
6985
  label: "Custom",
6870
- selected: J === PredefinedOptionsMenuState.CUSTOM
6871
- }], C?.length) {
6872
- let e = C.map(Gd);
6986
+ selected: Y === PredefinedOptionsMenuState.CUSTOM
6987
+ }], C != null && C.length) {
6988
+ let e = C.map(se);
6873
6989
  $ = [...$, ...e];
6874
6990
  }
6875
- let Kd = (e) => {
6991
+ let ce = (e) => {
6876
6992
  if (isValueWithUnit(e)) {
6877
6993
  let t = getUnit(e), { value: n } = safeConvertValue({
6878
6994
  value: e,
@@ -6884,9 +7000,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6884
7000
  return n;
6885
7001
  }
6886
7002
  return e;
6887
- }, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
7003
+ }, le = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, ue = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6888
7004
  return /* @__PURE__ */ jsx("div", {
6889
- className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
7005
+ className: Y === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6890
7006
  children: /* @__PURE__ */ jsxs(InputGroup, {
6891
7007
  small: o,
6892
7008
  width: s,
@@ -6901,65 +7017,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6901
7017
  trigger: "Component",
6902
7018
  component: /* @__PURE__ */ jsx(Button, {
6903
7019
  groupOrder: "first",
6904
- active: J === PredefinedOptionsMenuState.PREDEFINED,
6905
- icon: J === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
7020
+ active: Y === PredefinedOptionsMenuState.PREDEFINED,
7021
+ icon: Y === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
6906
7022
  small: o
6907
7023
  }),
6908
7024
  small: o,
6909
7025
  sections: $
6910
7026
  },
6911
- tooltip: J === PredefinedOptionsMenuState.PREDEFINED ? Y?.label : ""
7027
+ tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? X == null ? void 0 : X.label : ""
6912
7028
  }),
6913
7029
  /* @__PURE__ */ jsx("div", {
6914
7030
  className: unit_input_module_default.inputWrapper,
6915
7031
  children: /* @__PURE__ */ jsx(NumberInput, {
6916
- name: Q,
7032
+ name: oe,
6917
7033
  testId: x,
6918
7034
  disabled: n,
6919
- placeholder: Kd(t),
7035
+ placeholder: ce(t),
6920
7036
  value: K.value,
6921
- onChange: Hd,
7037
+ onChange: re,
6922
7038
  onFocus: v,
6923
7039
  error: i === null ? void 0 : i,
6924
7040
  warning: S === null ? void 0 : S,
6925
7041
  left: a,
6926
- allowEmpty: Rd,
6927
- validationCallback: (e, t) => D(Q, t),
7042
+ allowEmpty: J,
7043
+ validationCallback: (e, t) => D(oe, t),
6928
7044
  enableCosmeticRounding: j,
6929
7045
  enableDisplayRounding: M,
6930
7046
  roundDisplayValue: N,
6931
- groupOrder: qd,
6932
- disableInternalErrorValidationMessages: Bd,
7047
+ groupOrder: le,
7048
+ disableInternalErrorValidationMessages: te,
6933
7049
  small: o,
6934
7050
  selectOnFocus: P,
6935
7051
  tooltip: I
6936
- }, Q)
7052
+ }, oe)
6937
7053
  }),
6938
- Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6939
- groupOrder: Jd,
7054
+ Q && (ae || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
7055
+ groupOrder: ue,
6940
7056
  small: o,
6941
- children: Z
7057
+ children: Q
6942
7058
  }) : /* @__PURE__ */ jsx(Menu, {
6943
- groupOrder: Jd,
7059
+ groupOrder: ue,
6944
7060
  maxHeight: 380,
6945
7061
  disabled: r,
6946
7062
  testId: x && `${x}-menu`,
6947
7063
  tabIndex: -1,
6948
7064
  menu: {
6949
- label: Z,
7065
+ label: Q,
6950
7066
  trigger: "DropDownButton",
6951
7067
  small: o,
6952
- sections: X.map(([e = "", t = "", n]) => {
7068
+ sections: Z.map(([e = "", t = "", n]) => {
6953
7069
  let r = n || t || "", i = isValidNum(e) ? e : "";
6954
7070
  return {
6955
7071
  type: "Option",
6956
7072
  label: j ? safeRoundNumbers(i) : i,
6957
7073
  inline: !0,
6958
7074
  onClick: (n) => {
6959
- n.stopPropagation(), Ud(e, t);
7075
+ n.stopPropagation(), ie(e, t);
6960
7076
  },
6961
7077
  description: r,
6962
- selected: r === Z,
7078
+ selected: r === Q,
6963
7079
  testId: `${x}-unit-${r}`
6964
7080
  };
6965
7081
  })
@@ -7003,7 +7119,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
7003
7119
  unknown: "Unknown"
7004
7120
  }, getTranslations = (e) => Object.keys(TRANSLATION_FALLBACK).reduce((t, n) => ({
7005
7121
  ...t,
7006
- [n]: e?.[n] || TRANSLATION_FALLBACK?.[n]
7122
+ [n]: (e == null ? void 0 : e[n]) || (TRANSLATION_FALLBACK == null ? void 0 : TRANSLATION_FALLBACK[n])
7007
7123
  }), {});
7008
7124
  var config = {
7009
7125
  [ConfigKeyType.Translations]: getTranslations(),
@@ -7013,8 +7129,9 @@ const getConfig = (e) => e ? config[e] : config, setConfig = (e, t) => {
7013
7129
  config[e] = t;
7014
7130
  };
7015
7131
  var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, { unitKey: n, preferredUnit: r, storageUnit: i }) => {
7016
- let { unitTemplate: a = null } = useUnitContext() ?? {};
7017
- return e[n] = r ?? getPreferredUnit(n, a), t[n] = i, {
7132
+ var a;
7133
+ let { unitTemplate: o = null } = (a = useUnitContext()) == null ? {} : a;
7134
+ return e[n] = r == null ? getPreferredUnit(n, o) : r, t[n] = i, {
7018
7135
  preferredUnits: e,
7019
7136
  storageUnits: t
7020
7137
  };
@@ -7024,8 +7141,8 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
7024
7141
  }), convertRow = ({ row: e, rowIndex: t, selectedUnits: n, storageUnits: r, convertBackToStorageUnit: i, enableCosmeticRounding: a, enableDisplayRounding: o }) => ({
7025
7142
  ...e,
7026
7143
  cells: e.cells.map((e, s) => {
7027
- if ("autoUnit" in e && e?.autoUnit && (typeof e?.value == "string" || typeof e?.value == "number")) {
7028
- let { unitKey: c, value: l, formatDisplayValue: u } = e, d = o && "roundDisplayValue" in e ? e?.roundDisplayValue : null, f = n[c], p = r[c], m = p && f !== p, { value: h = l } = convertUnit({
7144
+ if ("autoUnit" in e && e != null && e.autoUnit && (typeof (e == null ? void 0 : e.value) == "string" || typeof (e == null ? void 0 : e.value) == "number")) {
7145
+ let { unitKey: c, value: l, formatDisplayValue: u } = e, d = o && "roundDisplayValue" in e ? e == null ? void 0 : e.roundDisplayValue : null, f = n[c], p = r[c], m = p && f !== p, { value: h = l } = convertUnit({
7029
7146
  value: safeToString(l),
7030
7147
  unitkey: c,
7031
7148
  toUnit: f,
@@ -7046,7 +7163,8 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
7046
7163
  fromUnit: f
7047
7164
  }), l = m ? o : r;
7048
7165
  if ("onChange" in e) {
7049
- let { onChange: r } = e, i = {
7166
+ let { onChange: r } = e;
7167
+ r({
7050
7168
  ...n,
7051
7169
  target: {
7052
7170
  ...n.target,
@@ -7055,8 +7173,7 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
7055
7173
  cellIndex: s,
7056
7174
  unit: a
7057
7175
  }
7058
- };
7059
- r(i);
7176
+ });
7060
7177
  }
7061
7178
  }
7062
7179
  };
@@ -7069,23 +7186,24 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
7069
7186
  ...e,
7070
7187
  cells: e.cells.map((e) => {
7071
7188
  if (e.type === CellType.AUTO_UNIT) {
7072
- let { testId: a, unitKey: o, disabled: s = !1, error: c } = e, l = n[o];
7189
+ var a;
7190
+ let { testId: o, unitKey: s, disabled: c = !1, error: l } = e, u = n[s];
7073
7191
  return {
7074
- value: l && t[o],
7192
+ value: u && t[s],
7075
7193
  type: CellType.SELECT,
7076
- error: !l && i?.unitIsMissing || c,
7077
- disabled: s || !l,
7194
+ error: !u && (i == null ? void 0 : i.unitIsMissing) || l,
7195
+ disabled: c || !u,
7078
7196
  searchable: !1,
7079
- options: getUnitsForQuantity(o)?.map((e) => ({
7197
+ options: (a = getUnitsForQuantity(s)) == null ? void 0 : a.map((e) => ({
7080
7198
  label: label(e),
7081
7199
  value: e
7082
7200
  })),
7083
7201
  native: e.native,
7084
7202
  onChange: (e) => r({
7085
- unitKey: o,
7203
+ unitKey: s,
7086
7204
  value: e.target.value
7087
7205
  }),
7088
- testId: a,
7206
+ testId: o,
7089
7207
  style: e.style
7090
7208
  };
7091
7209
  }
@@ -7094,7 +7212,7 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
7094
7212
  })) : [];
7095
7213
  };
7096
7214
  const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: s, beforeRenderRow: l }) => {
7097
- let { headers: u,...d } = e, { storageUnits: f, preferredUnits: p } = normalizeUnits(t), h = usePrevious(p), [g, _] = useState(p), v = ({ unitKey: e, value: n }) => {
7215
+ let { headers: u, ...d } = e, { storageUnits: f, preferredUnits: p } = normalizeUnits(t), h = usePrevious(p), [g, _] = useState(p), v = ({ unitKey: e, value: n }) => {
7098
7216
  _({
7099
7217
  ...g,
7100
7218
  [e]: n
@@ -7105,21 +7223,18 @@ const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0,
7105
7223
  newUnit: n,
7106
7224
  unitKey: e
7107
7225
  });
7108
- }, y = useCallback(({ row: e, rowIndex: t }) => {
7109
- let a = l ? l({
7226
+ }, y = useCallback(({ row: e, rowIndex: t }) => convertRow({
7227
+ row: l ? l({
7110
7228
  row: e,
7111
7229
  rowIndex: t
7112
- }) : e;
7113
- return convertRow({
7114
- row: a,
7115
- rowIndex: t,
7116
- selectedUnits: g,
7117
- storageUnits: f,
7118
- convertBackToStorageUnit: n,
7119
- enableCosmeticRounding: r,
7120
- enableDisplayRounding: i
7121
- });
7122
- }, [
7230
+ }) : e,
7231
+ rowIndex: t,
7232
+ selectedUnits: g,
7233
+ storageUnits: f,
7234
+ convertBackToStorageUnit: n,
7235
+ enableCosmeticRounding: r,
7236
+ enableDisplayRounding: i
7237
+ }), [
7123
7238
  g,
7124
7239
  f,
7125
7240
  n,
@@ -7128,7 +7243,7 @@ const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0,
7128
7243
  ]);
7129
7244
  return useEffect(() => {
7130
7245
  isEqual(p, h) || Object.keys(p).forEach((e) => {
7131
- let t = h?.[e], n = p[e];
7246
+ let t = h == null ? void 0 : h[e], n = p[e];
7132
7247
  t !== n && v({
7133
7248
  unitKey: e,
7134
7249
  value: n
@@ -7153,18 +7268,18 @@ var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
7153
7268
  const SettingField = ({ helpText: t, disabled: n = !1, showCustom: r = !1, children: i, userValue: a = void 0, companyValue: o = void 0, noPermission: s = !1, selectedOption: c, handleSelectChange: l, testId: u }) => {
7154
7269
  let { translations: d } = getConfig(), f = (t) => t.replace(/\\n/g, "\n").split(/\n/).map((t, n) => /* @__PURE__ */ jsxs(React.Fragment, { children: [t, /* @__PURE__ */ jsx("br", {})] }, n)), p = [
7155
7270
  ...r ? [] : [{
7156
- label: d?.allUsers,
7271
+ label: d == null ? void 0 : d.allUsers,
7157
7272
  value: !1
7158
7273
  }],
7159
7274
  {
7160
- label: d?.adminOnly,
7275
+ label: d == null ? void 0 : d.adminOnly,
7161
7276
  value: !0
7162
7277
  },
7163
7278
  ...r ? [{
7164
- label: d?.custom,
7279
+ label: d == null ? void 0 : d.custom,
7165
7280
  value: void 0
7166
7281
  }] : []
7167
- ], m = a !== void 0 && o !== void 0 && !isEqual(a, o), h = () => validateNumber(o).valid ? `${d?.companySetting}: ${isValueWithUnit(o) ? withPrettyUnitLabel(o) : o}` : d?.companySettingDifferent;
7282
+ ], m = a !== void 0 && o !== void 0 && !isEqual(a, o), h = () => validateNumber(o).valid ? `${d == null ? void 0 : d.companySetting}: ${isValueWithUnit(o) ? withPrettyUnitLabel(o) : o}` : d == null ? void 0 : d.companySettingDifferent;
7168
7283
  return /* @__PURE__ */ jsxs("div", {
7169
7284
  className: setting_field_module_default.settingField,
7170
7285
  "data-testid": u,
@@ -7209,10 +7324,10 @@ var SPLIT_VIEW = "split", UNIFIED_VIEW = "unified";
7209
7324
  const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
7210
7325
  let { translations: r } = getConfig(), [i, a] = useState(n), o = [{
7211
7326
  value: SPLIT_VIEW,
7212
- label: r?.split
7327
+ label: r == null ? void 0 : r.split
7213
7328
  }, {
7214
7329
  value: UNIFIED_VIEW,
7215
- label: r?.unified
7330
+ label: r == null ? void 0 : r.unified
7216
7331
  }];
7217
7332
  useEffect(() => {
7218
7333
  a(n);
@@ -7247,7 +7362,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
7247
7362
  style: { padding: "5px" },
7248
7363
  children: /* @__PURE__ */ jsx(Text, {
7249
7364
  muted: !0,
7250
- children: r?.changesTooLarge
7365
+ children: r == null ? void 0 : r.changesTooLarge
7251
7366
  })
7252
7367
  }) : /* @__PURE__ */ jsx(ReactDiffViewer, {
7253
7368
  oldValue: e,
@@ -7270,9 +7385,10 @@ function formatDate({ date: e, showTime: t, showSeconds: n, timeZone: r, showTim
7270
7385
  }) : null;
7271
7386
  }
7272
7387
  function cloneRegExp(e) {
7273
- let t = /^\/(.*)\/([gimyu]*)$/.exec(e.toString());
7274
- if (!t) throw Error("Invalid RegExp");
7275
- return new RegExp(t[1] ?? "", t[2]);
7388
+ var t;
7389
+ let n = /^\/(.*)\/([gimyu]*)$/.exec(e.toString());
7390
+ if (!n) throw Error("Invalid RegExp");
7391
+ return new RegExp((t = n[1]) == null ? "" : t, n[2]);
7276
7392
  }
7277
7393
  function clone(e) {
7278
7394
  if (typeof e != "object") return e;
@@ -7298,13 +7414,14 @@ var Context = class {
7298
7414
  push(e, t) {
7299
7415
  return e.parent = this, t !== void 0 && (e.childName = t), e.root = this.root || this, e.options = e.options || this.options, this.children ? (assertNonEmptyArray(this.children), lastNonEmpty(this.children).next = e, this.children.push(e)) : (this.children = [e], this.nextAfterChildren = this.next || null, this.next = e), e.next = this, this;
7300
7416
  }
7301
- }, diff_default = class extends Context {
7417
+ }, DiffContext = class extends Context {
7302
7418
  constructor(e, t) {
7303
7419
  super(), this.left = e, this.right = t, this.pipe = "diff";
7304
7420
  }
7305
7421
  prepareDeltaResult(e) {
7306
- if (typeof e == "object" && (this.options?.omitRemovedValues && Array.isArray(e) && e.length > 1 && (e.length === 2 || e[2] === 0 || e[2] === 3) && (e[0] = 0), this.options?.cloneDiffValues)) {
7307
- let t = typeof this.options?.cloneDiffValues == "function" ? this.options?.cloneDiffValues : clone;
7422
+ var t, n, r, i;
7423
+ if (typeof e == "object" && ((t = this.options) != null && t.omitRemovedValues && Array.isArray(e) && e.length > 1 && (e.length === 2 || e[2] === 0 || e[2] === 3) && (e[0] = 0), (n = this.options) != null && n.cloneDiffValues)) {
7424
+ let t = typeof ((r = this.options) == null ? void 0 : r.cloneDiffValues) == "function" ? (i = this.options) == null ? void 0 : i.cloneDiffValues : clone;
7308
7425
  typeof e[0] == "object" && (e[0] = t(e[0])), typeof e[1] == "object" && (e[1] = t(e[1]));
7309
7426
  }
7310
7427
  return e;
@@ -7312,15 +7429,15 @@ var Context = class {
7312
7429
  setResult(e) {
7313
7430
  return this.prepareDeltaResult(e), super.setResult(e);
7314
7431
  }
7315
- }, patch_default = class extends Context {
7432
+ }, PatchContext = class extends Context {
7316
7433
  constructor(e, t) {
7317
7434
  super(), this.left = e, this.delta = t, this.pipe = "patch";
7318
7435
  }
7319
- }, reverse_default = class extends Context {
7436
+ }, ReverseContext = class extends Context {
7320
7437
  constructor(e) {
7321
7438
  super(), this.delta = e, this.pipe = "reverse";
7322
7439
  }
7323
- }, pipe_default = class {
7440
+ }, Pipe = class {
7324
7441
  constructor(e) {
7325
7442
  this.name = e, this.filters = [];
7326
7443
  }
@@ -7347,7 +7464,10 @@ var Context = class {
7347
7464
  }
7348
7465
  indexOf(e) {
7349
7466
  if (!e) throw Error("a filter name is required");
7350
- for (let t = 0; t < this.filters.length; t++) if (this.filters[t]?.filterName === e) return t;
7467
+ for (let t = 0; t < this.filters.length; t++) {
7468
+ let n = this.filters[t];
7469
+ if ((n == null ? void 0 : n.filterName) === e) return t;
7470
+ }
7351
7471
  throw Error(`filter not found: ${e}`);
7352
7472
  }
7353
7473
  list() {
@@ -7373,15 +7493,15 @@ var Context = class {
7373
7493
  return this.filters.length = 0, this;
7374
7494
  }
7375
7495
  shouldHaveResult(e) {
7376
- return e === !1 ? (this.resultCheck = null, this) : (this.resultCheck ||= (e) => {
7496
+ return e === !1 ? (this.resultCheck = null, this) : (this.resultCheck || (this.resultCheck = (e) => {
7377
7497
  if (!e.hasResult) {
7378
7498
  console.log(e);
7379
7499
  let t = /* @__PURE__ */ Error(`${this.name} failed`);
7380
7500
  throw t.noResult = !0, t;
7381
7501
  }
7382
- }, this);
7502
+ }), this);
7383
7503
  }
7384
- }, processor_default = class {
7504
+ }, Processor = class {
7385
7505
  constructor(e) {
7386
7506
  this.selfOptions = e || {}, this.pipes = {};
7387
7507
  }
@@ -7409,20 +7529,21 @@ var Context = class {
7409
7529
  return n.hasResult ? n.result : void 0;
7410
7530
  }
7411
7531
  }, defaultMatch = (e, t, n, r) => e[n] === t[r], lengthMatrix = (e, t, n, r) => {
7412
- let i = e.length, a = t.length, o, s, c = Array(i + 1);
7413
- for (o = 0; o < i + 1; o++) {
7414
- let e = Array(a + 1);
7415
- for (s = 0; s < a + 1; s++) e[s] = 0;
7416
- c[o] = e;
7417
- }
7418
- for (c.match = n, o = 1; o < i + 1; o++) {
7419
- let i = c[o];
7420
- if (i === void 0) throw Error("LCS matrix row is undefined");
7421
- let l = c[o - 1];
7422
- if (l === void 0) throw Error("LCS matrix row is undefined");
7423
- for (s = 1; s < a + 1; s++) n(e, t, o - 1, s - 1, r) ? i[s] = (l[s - 1] ?? 0) + 1 : i[s] = Math.max(l[s] ?? 0, i[s - 1] ?? 0);
7424
- }
7425
- return c;
7532
+ var i, a, o;
7533
+ let s = e.length, c = t.length, l, u, d = Array(s + 1);
7534
+ for (l = 0; l < s + 1; l++) {
7535
+ let e = Array(c + 1);
7536
+ for (u = 0; u < c + 1; u++) e[u] = 0;
7537
+ d[l] = e;
7538
+ }
7539
+ for (d.match = n, l = 1; l < s + 1; l++) {
7540
+ let s = d[l];
7541
+ if (s === void 0) throw Error("LCS matrix row is undefined");
7542
+ let f = d[l - 1];
7543
+ if (f === void 0) throw Error("LCS matrix row is undefined");
7544
+ for (u = 1; u < c + 1; u++) n(e, t, l - 1, u - 1, r) ? s[u] = ((i = f[u - 1]) == null ? 0 : i) + 1 : s[u] = Math.max((a = f[u]) == null ? 0 : a, (o = s[u - 1]) == null ? 0 : o);
7545
+ }
7546
+ return d;
7426
7547
  }, backtrack = (e, t, n, r) => {
7427
7548
  let i = t.length, a = n.length, o = {
7428
7549
  sequence: [],
@@ -7446,9 +7567,9 @@ var Context = class {
7446
7567
  }
7447
7568
  return o;
7448
7569
  }, lcs_default = { get: (e, t, n, r) => {
7449
- let i = r || {}, a = lengthMatrix(e, t, n || defaultMatch, i);
7450
- return backtrack(a, e, t, i);
7451
- } };
7570
+ let i = r || {};
7571
+ return backtrack(lengthMatrix(e, t, n || defaultMatch, i), e, t, i);
7572
+ } }, ARRAY_MOVE = 3;
7452
7573
  function arraysHaveMatchByRef(e, t, n, r) {
7453
7574
  for (let i = 0; i < n; i++) {
7454
7575
  let n = e[i];
@@ -7473,70 +7594,71 @@ function matchItems(e, t, n, r, i) {
7473
7594
  return l === void 0 && (i.hashCache2[r] = l = s(o, r)), l === void 0 ? !1 : c === l;
7474
7595
  }
7475
7596
  const diffFilter$3 = function(e) {
7597
+ var t, n, r, i, a;
7476
7598
  if (!e.leftIsArray) return;
7477
- let t = {
7478
- objectHash: e.options?.objectHash,
7479
- matchByPosition: e.options?.matchByPosition
7480
- }, n = 0, r = 0, i, a, o, s = e.left, c = e.right, l = s.length, u = c.length, d;
7481
- for (l > 0 && u > 0 && !t.objectHash && typeof t.matchByPosition != "boolean" && (t.matchByPosition = !arraysHaveMatchByRef(s, c, l, u)); n < l && n < u && matchItems(s, c, n, n, t);) i = n, d = new diff_default(s[i], c[i]), e.push(d, i), n++;
7482
- for (; r + n < l && r + n < u && matchItems(s, c, l - 1 - r, u - 1 - r, t);) a = l - 1 - r, o = u - 1 - r, d = new diff_default(s[a], c[o]), e.push(d, o), r++;
7483
- let f;
7484
- if (n + r === l) {
7485
- if (l === u) {
7599
+ let o = {
7600
+ objectHash: (t = e.options) == null ? void 0 : t.objectHash,
7601
+ matchByPosition: (n = e.options) == null ? void 0 : n.matchByPosition
7602
+ }, s = 0, c = 0, l, u, d, f = e.left, p = e.right, m = f.length, h = p.length, g;
7603
+ for (m > 0 && h > 0 && !o.objectHash && typeof o.matchByPosition != "boolean" && (o.matchByPosition = !arraysHaveMatchByRef(f, p, m, h)); s < m && s < h && matchItems(f, p, s, s, o);) l = s, g = new DiffContext(f[l], p[l]), e.push(g, l), s++;
7604
+ for (; c + s < m && c + s < h && matchItems(f, p, m - 1 - c, h - 1 - c, o);) u = m - 1 - c, d = h - 1 - c, g = new DiffContext(f[u], p[d]), e.push(g, d), c++;
7605
+ let _;
7606
+ if (s + c === m) {
7607
+ if (m === h) {
7486
7608
  e.setResult(void 0).exit();
7487
7609
  return;
7488
7610
  }
7489
- for (f ||= { _t: "a" }, i = n; i < u - r; i++) f[i] = [c[i]], e.prepareDeltaResult(f[i]);
7490
- e.setResult(f).exit();
7611
+ for (_ = _ || { _t: "a" }, l = s; l < h - c; l++) _[l] = [p[l]], e.prepareDeltaResult(_[l]);
7612
+ e.setResult(_).exit();
7491
7613
  return;
7492
7614
  }
7493
- if (n + r === u) {
7494
- for (f ||= { _t: "a" }, i = n; i < l - r; i++) {
7495
- let t = `_${i}`;
7496
- f[t] = [
7497
- s[i],
7615
+ if (s + c === h) {
7616
+ for (_ = _ || { _t: "a" }, l = s; l < m - c; l++) {
7617
+ let t = `_${l}`;
7618
+ _[t] = [
7619
+ f[l],
7498
7620
  0,
7499
7621
  0
7500
- ], e.prepareDeltaResult(f[t]);
7622
+ ], e.prepareDeltaResult(_[t]);
7501
7623
  }
7502
- e.setResult(f).exit();
7624
+ e.setResult(_).exit();
7503
7625
  return;
7504
7626
  }
7505
- t.hashCache1 = void 0, t.hashCache2 = void 0;
7506
- let p = s.slice(n, l - r), m = c.slice(n, u - r), h = lcs_default.get(p, m, matchItems, t), g = [];
7507
- for (f ||= { _t: "a" }, i = n; i < l - r; i++) if (h.indices1.indexOf(i - n) < 0) {
7508
- let t = `_${i}`;
7509
- f[t] = [
7510
- s[i],
7627
+ o.hashCache1 = void 0, o.hashCache2 = void 0;
7628
+ let v = f.slice(s, m - c), y = p.slice(s, h - c), b = lcs_default.get(v, y, matchItems, o), x = [];
7629
+ for (_ = _ || { _t: "a" }, l = s; l < m - c; l++) if (b.indices1.indexOf(l - s) < 0) {
7630
+ let t = `_${l}`;
7631
+ _[t] = [
7632
+ f[l],
7511
7633
  0,
7512
7634
  0
7513
- ], e.prepareDeltaResult(f[t]), g.push(i);
7514
- }
7515
- let _ = !0;
7516
- e.options?.arrays && e.options.arrays.detectMove === !1 && (_ = !1);
7517
- let v = !1;
7518
- e.options?.arrays?.includeValueOnMove && (v = !0);
7519
- let y = g.length;
7520
- for (i = n; i < u - r; i++) {
7521
- let r = h.indices2.indexOf(i - n);
7522
- if (r < 0) {
7523
- let r = !1;
7524
- if (_ && y > 0) for (let l = 0; l < y; l++) {
7525
- a = g[l];
7526
- let u = a === void 0 ? void 0 : f[`_${a}`];
7527
- if (a !== void 0 && u && matchItems(p, m, a - n, i - n, t)) {
7528
- u.splice(1, 2, i, 3), u.splice(1, 2, i, 3), v || (u[0] = ""), o = i, d = new diff_default(s[a], c[o]), e.push(d, o), g.splice(l, 1), r = !0;
7635
+ ], e.prepareDeltaResult(_[t]), x.push(l);
7636
+ }
7637
+ let S = !0;
7638
+ (r = e.options) != null && r.arrays && e.options.arrays.detectMove === !1 && (S = !1);
7639
+ let C = !1;
7640
+ (a = (i = e.options) == null ? void 0 : i.arrays) != null && a.includeValueOnMove && (C = !0);
7641
+ let w = x.length;
7642
+ for (l = s; l < h - c; l++) {
7643
+ let t = b.indices2.indexOf(l - s);
7644
+ if (t < 0) {
7645
+ let t = !1;
7646
+ if (S && w > 0) for (let n = 0; n < w; n++) {
7647
+ u = x[n];
7648
+ let r = u === void 0 ? void 0 : _[`_${u}`];
7649
+ if (u !== void 0 && r && matchItems(v, y, u - s, l - s, o)) {
7650
+ r.splice(1, 2, l, ARRAY_MOVE), r.splice(1, 2, l, ARRAY_MOVE), C || (r[0] = ""), d = l, g = new DiffContext(f[u], p[d]), e.push(g, d), x.splice(n, 1), t = !0;
7529
7651
  break;
7530
7652
  }
7531
7653
  }
7532
- r || (f[i] = [c[i]], e.prepareDeltaResult(f[i]));
7654
+ t || (_[l] = [p[l]], e.prepareDeltaResult(_[l]));
7533
7655
  } else {
7534
- if (h.indices1[r] === void 0) throw Error(`Invalid indexOnArray2: ${r}, seq.indices1: ${h.indices1}`);
7535
- if (a = h.indices1[r] + n, h.indices2[r] === void 0) throw Error(`Invalid indexOnArray2: ${r}, seq.indices2: ${h.indices2}`);
7536
- o = h.indices2[r] + n, d = new diff_default(s[a], c[o]), e.push(d, o);
7656
+ if (b.indices1[t] === void 0) throw Error(`Invalid indexOnArray2: ${t}, seq.indices1: ${b.indices1}`);
7657
+ if (u = b.indices1[t] + s, b.indices2[t] === void 0) throw Error(`Invalid indexOnArray2: ${t}, seq.indices2: ${b.indices2}`);
7658
+ d = b.indices2[t] + s, g = new DiffContext(f[u], p[d]), e.push(g, d);
7537
7659
  }
7538
7660
  }
7539
- e.setResult(f).exit();
7661
+ e.setResult(_).exit();
7540
7662
  };
7541
7663
  diffFilter$3.filterName = "arrays";
7542
7664
  var compare = {
@@ -7548,47 +7670,48 @@ var compare = {
7548
7670
  }
7549
7671
  };
7550
7672
  const patchFilter$3 = function(e) {
7673
+ var t;
7551
7674
  if (!e.nested) return;
7552
- let t = e.delta;
7553
- if (t._t !== "a") return;
7554
- let n, r, i = t, a = e.left, o = [], s = [], c = [];
7555
- for (n in i) if (n !== "_t") if (n[0] === "_") {
7556
- let e = n;
7557
- if (i[e] !== void 0 && (i[e][2] === 0 || i[e][2] === 3)) o.push(Number.parseInt(n.slice(1), 10));
7558
- else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${i[e]?.[2]}`);
7675
+ let n = e.delta;
7676
+ if (n._t !== "a") return;
7677
+ let r, i, a = n, o = e.left, s = [], c = [], l = [];
7678
+ for (r in a) if (r !== "_t") if (r[0] === "_") {
7679
+ let e = r;
7680
+ if (a[e] !== void 0 && (a[e][2] === 0 || a[e][2] === ARRAY_MOVE)) s.push(Number.parseInt(r.slice(1), 10));
7681
+ else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${(t = a[e]) == null ? void 0 : t[2]}`);
7559
7682
  } else {
7560
- let e = n;
7561
- i[e].length === 1 ? s.push({
7683
+ let e = r;
7684
+ a[e].length === 1 ? c.push({
7562
7685
  index: Number.parseInt(e, 10),
7563
- value: i[e][0]
7564
- }) : c.push({
7686
+ value: a[e][0]
7687
+ }) : l.push({
7565
7688
  index: Number.parseInt(e, 10),
7566
- delta: i[e]
7689
+ delta: a[e]
7567
7690
  });
7568
7691
  }
7569
- for (o = o.sort(compare.numerically), n = o.length - 1; n >= 0; n--) {
7570
- if (r = o[n], r === void 0) continue;
7571
- let e = i[`_${r}`], t = a.splice(r, 1)[0];
7572
- e?.[2] === 3 && s.push({
7692
+ for (s = s.sort(compare.numerically), r = s.length - 1; r >= 0; r--) {
7693
+ if (i = s[r], i === void 0) continue;
7694
+ let e = a[`_${i}`], t = o.splice(i, 1)[0];
7695
+ (e == null ? void 0 : e[2]) === ARRAY_MOVE && c.push({
7573
7696
  index: e[1],
7574
7697
  value: t
7575
7698
  });
7576
7699
  }
7577
- s = s.sort(compare.numericallyBy("index"));
7578
- let l = s.length;
7579
- for (n = 0; n < l; n++) {
7580
- let e = s[n];
7581
- e !== void 0 && a.splice(e.index, 0, e.value);
7582
- }
7700
+ c = c.sort(compare.numericallyBy("index"));
7583
7701
  let u = c.length;
7584
- if (u > 0) for (n = 0; n < u; n++) {
7585
- let t = c[n];
7702
+ for (r = 0; r < u; r++) {
7703
+ let e = c[r];
7704
+ e !== void 0 && o.splice(e.index, 0, e.value);
7705
+ }
7706
+ let d = l.length;
7707
+ if (d > 0) for (r = 0; r < d; r++) {
7708
+ let t = l[r];
7586
7709
  if (t === void 0) continue;
7587
- let r = new patch_default(a[t.index], t.delta);
7588
- e.push(r, t.index);
7710
+ let n = new PatchContext(o[t.index], t.delta);
7711
+ e.push(n, t.index);
7589
7712
  }
7590
7713
  if (!e.children) {
7591
- e.setResult(a).exit();
7714
+ e.setResult(o).exit();
7592
7715
  return;
7593
7716
  }
7594
7717
  e.exit();
@@ -7609,12 +7732,12 @@ collectChildrenPatchFilter$1.filterName = "arraysCollectChildren";
7609
7732
  const reverseFilter$3 = function(e) {
7610
7733
  if (!e.nested) {
7611
7734
  let t = e.delta;
7612
- if (t[2] === 3) {
7735
+ if (t[2] === ARRAY_MOVE) {
7613
7736
  let n = t;
7614
7737
  e.newName = `_${n[1]}`, e.setResult([
7615
7738
  n[0],
7616
7739
  Number.parseInt(e.childName.substring(1), 10),
7617
- 3
7740
+ ARRAY_MOVE
7618
7741
  ]).exit();
7619
7742
  }
7620
7743
  return;
@@ -7624,7 +7747,7 @@ const reverseFilter$3 = function(e) {
7624
7747
  let n = t;
7625
7748
  for (let t in n) {
7626
7749
  if (t === "_t") continue;
7627
- let r = new reverse_default(n[t]);
7750
+ let r = new ReverseContext(n[t]);
7628
7751
  e.push(r, t);
7629
7752
  }
7630
7753
  e.exit();
@@ -7636,7 +7759,7 @@ var reverseArrayDeltaIndex = (e, t, n) => {
7636
7759
  let r = +t;
7637
7760
  for (let n in e) {
7638
7761
  let i = e[n];
7639
- if (Array.isArray(i)) if (i[2] === 3) {
7762
+ if (Array.isArray(i)) if (i[2] === ARRAY_MOVE) {
7640
7763
  let e = Number.parseInt(n.substring(1), 10), a = i[1];
7641
7764
  if (a === +t) return e;
7642
7765
  e <= r && a > r ? r++ : e >= r && a < r && r--;
@@ -7672,7 +7795,7 @@ const collectChildrenDiffFilter = (e) => {
7672
7795
  for (let r = 0; r < t; r++) {
7673
7796
  let t = e.children[r];
7674
7797
  if (t !== void 0 && t.result !== void 0) {
7675
- if (n ||= {}, t.childName === void 0) throw Error("diff child.childName is undefined");
7798
+ if (n = n || {}, t.childName === void 0) throw Error("diff child.childName is undefined");
7676
7799
  n[t.childName] = t.result;
7677
7800
  }
7678
7801
  }
@@ -7680,19 +7803,17 @@ const collectChildrenDiffFilter = (e) => {
7680
7803
  };
7681
7804
  collectChildrenDiffFilter.filterName = "collectChildren";
7682
7805
  const objectsDiffFilter = (e) => {
7806
+ var t;
7683
7807
  if (e.leftIsArray || e.leftType !== "object") return;
7684
- let t = e.left, n = e.right, r = e.options?.propertyFilter;
7685
- for (let i in t) {
7686
- if (!Object.prototype.hasOwnProperty.call(t, i) || r && !r(i, e)) continue;
7687
- let a = new diff_default(t[i], n[i]);
7688
- e.push(a, i);
7689
- }
7690
- for (let i in n) {
7691
- if (!Object.prototype.hasOwnProperty.call(n, i) || r && !r(i, e)) continue;
7692
- if (t[i] === void 0) {
7693
- let t = new diff_default(void 0, n[i]);
7694
- e.push(t, i);
7695
- }
7808
+ let n = e.left, r = e.right, i = (t = e.options) == null ? void 0 : t.propertyFilter;
7809
+ for (let t in n) {
7810
+ if (!Object.prototype.hasOwnProperty.call(n, t) || i && !i(t, e)) continue;
7811
+ let a = new DiffContext(n[t], r[t]);
7812
+ e.push(a, t);
7813
+ }
7814
+ for (let t in r) if (Object.prototype.hasOwnProperty.call(r, t) && !(i && !i(t, e)) && n[t] === void 0) {
7815
+ let n = new DiffContext(void 0, r[t]);
7816
+ e.push(n, t);
7696
7817
  }
7697
7818
  if (!e.children || e.children.length === 0) {
7698
7819
  e.setResult(void 0).exit();
@@ -7707,7 +7828,7 @@ const patchFilter$2 = function(e) {
7707
7828
  if (t._t) return;
7708
7829
  let n = t;
7709
7830
  for (let t in n) {
7710
- let r = new patch_default(e.left[t], n[t]);
7831
+ let r = new PatchContext(e.left[t], n[t]);
7711
7832
  e.push(r, t);
7712
7833
  }
7713
7834
  e.exit();
@@ -7729,7 +7850,7 @@ const reverseFilter$2 = function(e) {
7729
7850
  if (!e.nested || e.delta._t) return;
7730
7851
  let t = e.delta;
7731
7852
  for (let n in t) {
7732
- let r = new reverse_default(t[n]);
7853
+ let r = new ReverseContext(t[n]);
7733
7854
  e.push(r, n);
7734
7855
  }
7735
7856
  e.exit();
@@ -7747,88 +7868,91 @@ const collectChildrenReverseFilter = (e) => {
7747
7868
  e.setResult(n).exit();
7748
7869
  };
7749
7870
  collectChildrenReverseFilter.filterName = "collectChildren";
7750
- var cachedDiffPatch = null;
7871
+ var TEXT_DIFF = 2, DEFAULT_MIN_LENGTH = 60, cachedDiffPatch = null;
7751
7872
  function getDiffMatchPatch(e, t) {
7873
+ var n;
7752
7874
  if (!cachedDiffPatch) {
7753
- let n;
7754
- if (e?.textDiff?.diffMatchPatch) n = new e.textDiff.diffMatchPatch();
7875
+ let r;
7876
+ if ((n = e == null ? void 0 : e.textDiff) != null && n.diffMatchPatch) r = new e.textDiff.diffMatchPatch();
7755
7877
  else {
7756
7878
  if (!t) return null;
7757
7879
  let e = /* @__PURE__ */ Error("The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.");
7758
7880
  throw e.diff_match_patch_not_found = !0, e;
7759
7881
  }
7760
7882
  cachedDiffPatch = {
7761
- diff: (e, t) => n.patch_toText(n.patch_make(e, t)),
7883
+ diff: (e, t) => r.patch_toText(r.patch_make(e, t)),
7762
7884
  patch: (e, t) => {
7763
- let r = n.patch_apply(n.patch_fromText(t), e);
7764
- for (let e of r[1]) if (!e) {
7885
+ let n = r.patch_apply(r.patch_fromText(t), e);
7886
+ for (let e of n[1]) if (!e) {
7765
7887
  let e = /* @__PURE__ */ Error("text patch failed");
7766
7888
  throw e.textPatchFailed = !0, e;
7767
7889
  }
7768
- return r[0];
7890
+ return n[0];
7769
7891
  }
7770
7892
  };
7771
7893
  }
7772
7894
  return cachedDiffPatch;
7773
7895
  }
7774
7896
  const diffFilter$1 = function(e) {
7897
+ var t, n;
7775
7898
  if (e.leftType !== "string") return;
7776
- let t = e.left, n = e.right, r = e.options?.textDiff?.minLength || 60;
7777
- if (t.length < r || n.length < r) {
7778
- e.setResult([t, n]).exit();
7899
+ let r = e.left, i = e.right, a = ((n = (t = e.options) == null ? void 0 : t.textDiff) == null ? void 0 : n.minLength) || DEFAULT_MIN_LENGTH;
7900
+ if (r.length < a || i.length < a) {
7901
+ e.setResult([r, i]).exit();
7779
7902
  return;
7780
7903
  }
7781
- let i = getDiffMatchPatch(e.options);
7782
- if (!i) {
7783
- e.setResult([t, n]).exit();
7904
+ let o = getDiffMatchPatch(e.options);
7905
+ if (!o) {
7906
+ e.setResult([r, i]).exit();
7784
7907
  return;
7785
7908
  }
7786
- let a = i.diff;
7909
+ let s = o.diff;
7787
7910
  e.setResult([
7788
- a(t, n),
7911
+ s(r, i),
7789
7912
  0,
7790
- 2
7913
+ TEXT_DIFF
7791
7914
  ]).exit();
7792
7915
  };
7793
7916
  diffFilter$1.filterName = "texts";
7794
7917
  const patchFilter$1 = function(e) {
7795
7918
  if (e.nested) return;
7796
7919
  let t = e.delta;
7797
- if (t[2] !== 2) return;
7920
+ if (t[2] !== TEXT_DIFF) return;
7798
7921
  let n = t, r = getDiffMatchPatch(e.options, !0).patch;
7799
7922
  e.setResult(r(e.left, n[0])).exit();
7800
7923
  };
7801
7924
  patchFilter$1.filterName = "texts";
7802
7925
  var textDeltaReverse = (e) => {
7803
- let t = /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/, n = e.split("\n");
7804
- for (let e = 0; e < n.length; e++) {
7805
- let r = n[e];
7806
- if (r === void 0) continue;
7807
- let i = r.slice(0, 1);
7808
- if (i === "@") {
7809
- let i = t.exec(r);
7810
- if (i !== null) {
7811
- let t = e;
7812
- n[t] = `@@ -${i[3]},${i[4]} +${i[1]},${i[2]} @@`;
7926
+ var t, n, r;
7927
+ let i = /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/, a = e.split("\n");
7928
+ for (let e = 0; e < a.length; e++) {
7929
+ let o = a[e];
7930
+ if (o === void 0) continue;
7931
+ let s = o.slice(0, 1);
7932
+ if (s === "@") {
7933
+ let t = i.exec(o);
7934
+ if (t !== null) {
7935
+ let n = e;
7936
+ a[n] = `@@ -${t[3]},${t[4]} +${t[1]},${t[2]} @@`;
7813
7937
  }
7814
- } else if (i === "+") {
7815
- if (n[e] = `-${n[e]?.slice(1)}`, n[e - 1]?.slice(0, 1) === "+") {
7816
- let t = n[e];
7817
- n[e] = n[e - 1], n[e - 1] = t;
7938
+ } else if (s === "+") {
7939
+ if (a[e] = `-${(t = a[e]) == null ? void 0 : t.slice(1)}`, ((n = a[e - 1]) == null ? void 0 : n.slice(0, 1)) === "+") {
7940
+ let t = a[e];
7941
+ a[e] = a[e - 1], a[e - 1] = t;
7818
7942
  }
7819
- } else i === "-" && (n[e] = `+${n[e]?.slice(1)}`);
7943
+ } else s === "-" && (a[e] = `+${(r = a[e]) == null ? void 0 : r.slice(1)}`);
7820
7944
  }
7821
- return n.join("\n");
7945
+ return a.join("\n");
7822
7946
  };
7823
7947
  const reverseFilter$1 = function(e) {
7824
7948
  if (e.nested) return;
7825
7949
  let t = e.delta;
7826
- if (t[2] !== 2) return;
7950
+ if (t[2] !== TEXT_DIFF) return;
7827
7951
  let n = t;
7828
7952
  e.setResult([
7829
7953
  textDeltaReverse(n[0]),
7830
7954
  0,
7831
- 2
7955
+ TEXT_DIFF
7832
7956
  ]).exit();
7833
7957
  };
7834
7958
  reverseFilter$1.filterName = "texts";
@@ -7880,7 +8004,7 @@ const patchFilter = function(e) {
7880
8004
  if (t.length === 2) {
7881
8005
  if (e.left instanceof RegExp) {
7882
8006
  let n = /^\/(.*)\/([gimyu]+)$/.exec(t[1]);
7883
- if (n?.[1]) {
8007
+ if (n != null && n[1]) {
7884
8008
  e.setResult(new RegExp(n[1], n[2])).exit();
7885
8009
  return;
7886
8010
  }
@@ -7913,21 +8037,21 @@ const reverseFilter = function(e) {
7913
8037
  t.length === 3 && t[2] === 0 && e.setResult([t[0]]).exit();
7914
8038
  };
7915
8039
  reverseFilter.filterName = "trivial";
7916
- var diffpatcher_default = class {
8040
+ var DiffPatcher = class {
7917
8041
  constructor(e) {
7918
- this.processor = new processor_default(e), this.processor.pipe(new pipe_default("diff").append(collectChildrenDiffFilter, diffFilter, diffFilter$2, diffFilter$1, objectsDiffFilter, diffFilter$3).shouldHaveResult()), this.processor.pipe(new pipe_default("patch").append(collectChildrenPatchFilter, collectChildrenPatchFilter$1, patchFilter, patchFilter$1, patchFilter$2, patchFilter$3).shouldHaveResult()), this.processor.pipe(new pipe_default("reverse").append(collectChildrenReverseFilter, collectChildrenReverseFilter$1, reverseFilter, reverseFilter$1, reverseFilter$2, reverseFilter$3).shouldHaveResult());
8042
+ this.processor = new Processor(e), this.processor.pipe(new Pipe("diff").append(collectChildrenDiffFilter, diffFilter, diffFilter$2, diffFilter$1, objectsDiffFilter, diffFilter$3).shouldHaveResult()), this.processor.pipe(new Pipe("patch").append(collectChildrenPatchFilter, collectChildrenPatchFilter$1, patchFilter, patchFilter$1, patchFilter$2, patchFilter$3).shouldHaveResult()), this.processor.pipe(new Pipe("reverse").append(collectChildrenReverseFilter, collectChildrenReverseFilter$1, reverseFilter, reverseFilter$1, reverseFilter$2, reverseFilter$3).shouldHaveResult());
7919
8043
  }
7920
8044
  options(e) {
7921
8045
  return this.processor.options(e);
7922
8046
  }
7923
8047
  diff(e, t) {
7924
- return this.processor.process(new diff_default(e, t));
8048
+ return this.processor.process(new DiffContext(e, t));
7925
8049
  }
7926
8050
  patch(e, t) {
7927
- return this.processor.process(new patch_default(e, t));
8051
+ return this.processor.process(new PatchContext(e, t));
7928
8052
  }
7929
8053
  reverse(e) {
7930
- return this.processor.process(new reverse_default(e));
8054
+ return this.processor.process(new ReverseContext(e));
7931
8055
  }
7932
8056
  unpatch(e, t) {
7933
8057
  return this.patch(e, this.reverse(t));
@@ -7937,7 +8061,7 @@ var diffpatcher_default = class {
7937
8061
  }
7938
8062
  };
7939
8063
  function create(e) {
7940
- return new diffpatcher_default(e);
8064
+ return new DiffPatcher(e);
7941
8065
  }
7942
8066
  const diff_match_patch = function() {
7943
8067
  this.Diff_Timeout = 1, this.Diff_EditCost = 4, this.Match_Threshold = .5, this.Match_Distance = 1e3, this.Patch_DeleteThreshold = .5, this.Patch_Margin = 4, this.Match_MaxBits = 32;
@@ -8047,11 +8171,9 @@ diff_match_patch.Diff = function(e, t) {
8047
8171
  return t;
8048
8172
  }
8049
8173
  var a = 4e4, o = i(e);
8050
- a = 65535;
8051
- var s = i(t);
8052
- return {
8174
+ return a = 65535, {
8053
8175
  chars1: o,
8054
- chars2: s,
8176
+ chars2: i(t),
8055
8177
  lineArray: n
8056
8178
  };
8057
8179
  }, diff_match_patch.prototype.diff_charsToLines_ = function(e, t) {
@@ -8348,7 +8470,7 @@ diff_match_patch.Diff = function(e, t) {
8348
8470
  g[h + 1] = (1 << p) - 1;
8349
8471
  for (var _ = h; _ >= m; _--) {
8350
8472
  var v = r[e.charAt(_ - 1)];
8351
- if (p === 0 ? g[_] = (g[_ + 1] << 1 | 1) & v : g[_] = (g[_ + 1] << 1 | 1) & v | ((f[_ + 1] | f[_]) << 1 | 1) | f[_ + 1], g[_] & c) {
8473
+ if (p === 0 ? g[_] = (g[_ + 1] << 1 | 1) & v : g[_] = (g[_ + 1] << 1 | 1) & v | (f[_ + 1] | f[_]) << 1 | 1 | f[_ + 1], g[_] & c) {
8352
8474
  var y = a(p, _ - 1);
8353
8475
  if (y <= o) if (o = y, s = _ - 1, s > n) m = Math.max(1, 2 * n - s);
8354
8476
  else break;
@@ -8577,14 +8699,11 @@ const countDeltas = (e) => (Array.isArray(e) ? e : e ? [e] : []).reduce((e, t) =
8577
8699
  }), getSectionName = (e, t) => {
8578
8700
  let n = Object.fromEntries((e || []).map((e) => [e.sectionKey, e.sectionLabel]));
8579
8701
  for (let e = t.length - 1; e >= 0; e--) {
8580
- let r = t[e], i = n[r];
8581
- if (i) return i;
8702
+ let r = n[t[e]];
8703
+ if (r) return r;
8582
8704
  }
8583
8705
  return "";
8584
- }, toText = (e) => {
8585
- let t = (e) => isValueWithUnit(e) ? withPrettyUnitLabel(e) : String(e);
8586
- return Array.isArray(e) ? e.length === 0 ? "" : e.some((e) => e && typeof e == "object") ? "Multiple changes..." : e.map(t).join(", ") : e && typeof e == "object" ? Object.keys(e).length === 0 ? "" : "Multiple changes..." : t(e);
8587
- }, defaultMessage = (e) => {
8706
+ }, toText = (e) => Array.isArray(e) ? e.length === 0 ? "" : e.some((e) => e && typeof e == "object") ? "Multiple changes..." : String(e) : e && typeof e == "object" ? Object.keys(e).length === 0 ? "" : "Multiple changes..." : String(e), defaultMessage = (e) => {
8588
8707
  switch (e.length) {
8589
8708
  case 1: {
8590
8709
  let [t] = e;
@@ -8624,7 +8743,8 @@ const createDiffJson = (e, t, n) => {
8624
8743
  let a = "", o = "";
8625
8744
  try {
8626
8745
  for (let e = 0; e < r.length; e++) {
8627
- let t = r[e]?.diffs ?? null;
8746
+ var s, c;
8747
+ let t = (s = (c = r[e]) == null ? void 0 : c.diffs) == null ? null : s;
8628
8748
  if (!t) {
8629
8749
  i[e + 1] = i[e];
8630
8750
  continue;
@@ -8632,7 +8752,7 @@ const createDiffJson = (e, t, n) => {
8632
8752
  i[e + 1] = unpatchWith(i[e], t);
8633
8753
  }
8634
8754
  let e = r.length > 0 ? i[r.length - 1] : n, t = r.length > 0 ? i[r.length] : n;
8635
- a = JSON.stringify(t ?? "", null, 2), o = JSON.stringify(e ?? "", null, 2);
8755
+ a = JSON.stringify(t == null ? "" : t, null, 2), o = JSON.stringify(e == null ? "" : e, null, 2);
8636
8756
  } catch (e) {
8637
8757
  console.error("err", e);
8638
8758
  }
@@ -8640,28 +8760,25 @@ const createDiffJson = (e, t, n) => {
8640
8760
  oldJson: a,
8641
8761
  newJson: o
8642
8762
  };
8643
- }, ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => {
8644
- let r = {
8645
- headers: [{ cells: [
8646
- { value: "Modified By" },
8647
- { value: "Type" },
8648
- { value: "Before" },
8649
- { value: "After" },
8650
- { value: "" }
8651
- ] }],
8652
- rows: n.map((n) => {
8653
- let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
8654
- return { cells: [
8655
- { value: t },
8656
- { value: o },
8657
- { value: s },
8658
- { value: c },
8659
- { value: a }
8660
- ] };
8661
- })
8662
- };
8663
- return /* @__PURE__ */ jsx(Table, { table: r });
8664
- }, viewTypes = Object.freeze({
8763
+ }, ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => /* @__PURE__ */ jsx(Table, { table: {
8764
+ headers: [{ cells: [
8765
+ { value: "Modified By" },
8766
+ { value: "Type" },
8767
+ { value: "Before" },
8768
+ { value: "After" },
8769
+ { value: "" }
8770
+ ] }],
8771
+ rows: n.map((n) => {
8772
+ let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
8773
+ return { cells: [
8774
+ { value: t },
8775
+ { value: o },
8776
+ { value: s },
8777
+ { value: c },
8778
+ { value: a }
8779
+ ] };
8780
+ })
8781
+ } }), viewTypes = Object.freeze({
8665
8782
  summary: {
8666
8783
  label: "Summary",
8667
8784
  value: "summary"
@@ -8785,13 +8902,16 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
8785
8902
  heading: /* @__PURE__ */ jsxs(Flex, {
8786
8903
  gap: !0,
8787
8904
  wrap: !0,
8788
- children: [/* @__PURE__ */ jsx(Heading, { children: "CHANGES" }), s?.map((e) => /* @__PURE__ */ jsx(Toggle, {
8789
- small: e.small ?? !0,
8790
- checked: e.checked,
8791
- onChange: e.onChange,
8792
- label: e.label,
8793
- disabled: e.disabled
8794
- }, e.id))]
8905
+ children: [/* @__PURE__ */ jsx(Heading, { children: "CHANGES" }), s == null ? void 0 : s.map((e) => {
8906
+ var t;
8907
+ return /* @__PURE__ */ jsx(Toggle, {
8908
+ small: (t = e.small) == null ? !0 : t,
8909
+ checked: e.checked,
8910
+ onChange: e.onChange,
8911
+ label: e.label,
8912
+ disabled: e.disabled
8913
+ }, e.id);
8914
+ })]
8795
8915
  }),
8796
8916
  padding: !1,
8797
8917
  children: r ? /* @__PURE__ */ jsx(Loader, {
@@ -8852,11 +8972,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
8852
8972
  }, [e, t]), null;
8853
8973
  }, isPrimitiveValue = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null, initializeGuiLibrary = (e) => {
8854
8974
  setConfig(ConfigKeyType.LanguageKey, e.languageKey), Object.entries(e).forEach(([e, t]) => {
8855
- if (e === ConfigKeyType.Translations) setConfig(e, getTranslations(t));
8856
- else {
8857
- let n = isPrimitiveValue(t) ? t : { ...t };
8858
- setConfig(e, n);
8859
- }
8975
+ e === ConfigKeyType.Translations ? setConfig(e, getTranslations(t)) : setConfig(e, isPrimitiveValue(t) ? t : { ...t });
8860
8976
  });
8861
8977
  };
8862
8978
  export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };