@compill/admin 1.0.93 → 1.0.98

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.
package/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var tslib = require('tslib');
6
4
  var jsxRuntime = require('@soperio/jsx-runtime');
7
5
  var api = require('@compill/api');
@@ -28,12 +26,6 @@ var reactQuery = require('@tanstack/react-query');
28
26
  var Image = require('next/image');
29
27
  var auth = require('@compill/auth');
30
28
 
31
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
32
-
33
- var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
34
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
- var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
36
-
37
29
  function SectionTitle(_a) {
38
30
  var {
39
31
  children
@@ -70,20 +62,8 @@ var mdiPublish = "M5,4V6H19V4H5M5,14H9V20H15V14H19L12,7L5,14Z";
70
62
  var mdiPublishOff = "M20.8 22.7L15 16.9V20H9V14H5L8.6 10.4L1.1 3L2.4 1.7L22.1 21.4L20.8 22.7M19 6V4H7.2L9.2 6H19M17.2 14H19L12 7L11.1 7.9L17.2 14Z";
71
63
  var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
72
64
 
73
- function noop() { }
74
-
75
- function isPlainObject(value) {
76
- if (!value || typeof value !== 'object') {
77
- return false;
78
- }
79
- const proto = Object.getPrototypeOf(value);
80
- const hasObjectPrototype = proto === null ||
81
- proto === Object.prototype ||
82
- Object.getPrototypeOf(proto) === null;
83
- if (!hasObjectPrototype) {
84
- return false;
85
- }
86
- return Object.prototype.toString.call(value) === '[object Object]';
65
+ function eq(value, other) {
66
+ return value === other || (Number.isNaN(value) && Number.isNaN(other));
87
67
  }
88
68
 
89
69
  function getSymbols(object) {
@@ -124,8 +104,22 @@ const bigInt64ArrayTag = '[object BigInt64Array]';
124
104
  const float32ArrayTag = '[object Float32Array]';
125
105
  const float64ArrayTag = '[object Float64Array]';
126
106
 
127
- function eq(value, other) {
128
- return value === other || (Number.isNaN(value) && Number.isNaN(other));
107
+ function isArray(value) {
108
+ return Array.isArray(value);
109
+ }
110
+
111
+ function isPlainObject(value) {
112
+ if (!value || typeof value !== 'object') {
113
+ return false;
114
+ }
115
+ const proto = Object.getPrototypeOf(value);
116
+ const hasObjectPrototype = proto === null ||
117
+ proto === Object.prototype ||
118
+ Object.getPrototypeOf(proto) === null;
119
+ if (!hasObjectPrototype) {
120
+ return false;
121
+ }
122
+ return Object.prototype.toString.call(value) === '[object Object]';
129
123
  }
130
124
 
131
125
  function isEqualWith(a, b, areValuesEqual) {
@@ -306,6 +300,8 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
306
300
  }
307
301
  }
308
302
 
303
+ function noop() { }
304
+
309
305
  function isEqual(a, b) {
310
306
  return isEqualWith(a, b, noop);
311
307
  }
@@ -314,10 +310,6 @@ function capitalize(str) {
314
310
  return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
315
311
  }
316
312
 
317
- function isArray(value) {
318
- return Array.isArray(value);
319
- }
320
-
321
313
  function Breadcrumbs(_a) {
322
314
  var {
323
315
  breadcrumbs
@@ -391,7 +383,7 @@ function BreadcrumbItem({
391
383
  children: [showSeparator && jsxRuntime.jsx(ui.Icon, {
392
384
  path: mdiCircleSmall,
393
385
  mx: "1"
394
- }), jsxRuntime.jsx(Link__default["default"], {
386
+ }), jsxRuntime.jsx(Link, {
395
387
  href: `/${breadcrumb.path || "#"}`,
396
388
  children: jsxRuntime.jsx("span", {
397
389
  // onClick={breadcrumb.path ? handleClick : undefined}
@@ -408,13 +400,13 @@ function DialogButton(_a) {
408
400
  buildDialog
409
401
  } = _a,
410
402
  props = tslib.__rest(_a, ["buildDialog"]);
411
- const [showDialog, setShowDialog] = React__default["default"].useState(false);
412
- const onShowDialog = React__default["default"].useCallback(event => {
403
+ const [showDialog, setShowDialog] = React.useState(false);
404
+ const onShowDialog = React.useCallback(event => {
413
405
  event === null || event === void 0 ? void 0 : event.preventDefault();
414
406
  event === null || event === void 0 ? void 0 : event.stopPropagation();
415
407
  setShowDialog(true);
416
408
  }, [setShowDialog]);
417
- const onCloseDialog = React__default["default"].useCallback(() => {
409
+ const onCloseDialog = React.useCallback(() => {
418
410
  setShowDialog(false);
419
411
  }, [setShowDialog]);
420
412
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -441,7 +433,7 @@ function ButtonBar(_a) {
441
433
  children: children
442
434
  }));
443
435
  }
444
- const ButtonBarButton = /*#__PURE__*/React__default["default"].forwardRef(function (_a, ref) {
436
+ const ButtonBarButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
445
437
  var {
446
438
  icon,
447
439
  children
@@ -464,7 +456,7 @@ const ButtonBarButton = /*#__PURE__*/React__default["default"].forwardRef(functi
464
456
  }), children]
465
457
  }));
466
458
  });
467
- const ButtonBarSubmitButton = /*#__PURE__*/React__default["default"].forwardRef(function (_a, ref) {
459
+ const ButtonBarSubmitButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
468
460
  var _b;
469
461
  var {
470
462
  useDirty,
@@ -478,10 +470,8 @@ const ButtonBarSubmitButton = /*#__PURE__*/React__default["default"].forwardRef(
478
470
  handleSubmit
479
471
  } = (_b = formik.useFormikContext()) !== null && _b !== void 0 ? _b : {
480
472
  dirty: false,
481
- handleSubmit: undefined,
482
- values: {}
483
- };
484
- const onSubmit = React__default["default"].useCallback(() => handleSubmit(), [handleSubmit]);
473
+ handleSubmit: undefined};
474
+ const onSubmit = React.useCallback(() => handleSubmit(), [handleSubmit]);
485
475
  return jsxRuntime.jsxs(ui.Button, Object.assign({
486
476
  scheme: "dark",
487
477
  size: "sm",
@@ -548,7 +538,7 @@ function NavigateButton(_a) {
548
538
  } = _a,
549
539
  props = tslib.__rest(_a, ["path"]);
550
540
  const navigate = reactRouterDom.useNavigate();
551
- const handleClick = React__default["default"].useCallback(() => {
541
+ const handleClick = React.useCallback(() => {
552
542
  navigate(path);
553
543
  }, [navigate, path]);
554
544
  return jsxRuntime.jsx(ui.Button, Object.assign({
@@ -577,7 +567,7 @@ function PublishButton(_a) {
577
567
  const mutation = api.useInvalidateMutation(isDraft ? api$1.publish : api$1.unpublish, api$1.queryKey, queryId, {
578
568
  networkMode: "always"
579
569
  });
580
- const publish = React__default["default"].useCallback(() => {
570
+ const publish = React.useCallback(() => {
581
571
  mutation.reset();
582
572
  mutation.mutateAsync(queryId).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
583
573
  }, [mutation, queryId]);
@@ -590,391 +580,238 @@ function PublishButton(_a) {
590
580
  }));
591
581
  }
592
582
 
593
- function _extends() {
594
- _extends = Object.assign ? Object.assign.bind() : function (target) {
595
- for (var i = 1; i < arguments.length; i++) {
596
- var source = arguments[i];
597
- for (var key in source) {
598
- if (Object.prototype.hasOwnProperty.call(source, key)) {
599
- target[key] = source[key];
600
- }
601
- }
602
- }
603
- return target;
604
- };
605
- return _extends.apply(this, arguments);
606
- }
607
-
608
- var reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];
609
- var mappedKeys = {
610
- esc: 'escape',
611
- "return": 'enter',
612
- '.': 'period',
613
- ',': 'comma',
614
- '-': 'slash',
615
- ' ': 'space',
616
- '`': 'backquote',
617
- '#': 'backslash',
618
- '+': 'bracketright',
619
- ShiftLeft: 'shift',
620
- ShiftRight: 'shift',
621
- AltLeft: 'alt',
622
- AltRight: 'alt',
623
- MetaLeft: 'meta',
624
- MetaRight: 'meta',
625
- OSLeft: 'meta',
626
- OSRight: 'meta',
627
- ControlLeft: 'ctrl',
628
- ControlRight: 'ctrl'
583
+ const j = ["shift", "alt", "meta", "mod", "ctrl", "control"], Q = {
584
+ esc: "escape",
585
+ return: "enter",
586
+ left: "arrowleft",
587
+ right: "arrowright",
588
+ up: "arrowup",
589
+ down: "arrowdown",
590
+ ShiftLeft: "shift",
591
+ ShiftRight: "shift",
592
+ AltLeft: "alt",
593
+ AltRight: "alt",
594
+ MetaLeft: "meta",
595
+ MetaRight: "meta",
596
+ OSLeft: "meta",
597
+ OSRight: "meta",
598
+ ControlLeft: "ctrl",
599
+ ControlRight: "ctrl"
629
600
  };
630
- function mapKey(key) {
631
- return (mappedKeys[key] || key).trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
632
- }
633
- function isHotkeyModifier(key) {
634
- return reservedModifierKeywords.includes(key);
635
- }
636
- function parseKeysHookInput(keys, splitKey) {
637
- if (splitKey === void 0) {
638
- splitKey = ',';
639
- }
640
- return keys.split(splitKey);
641
- }
642
- function parseHotkey(hotkey, combinationKey, description) {
643
- if (combinationKey === void 0) {
644
- combinationKey = '+';
645
- }
646
- var keys = hotkey.toLocaleLowerCase().split(combinationKey).map(function (k) {
647
- return mapKey(k);
648
- });
649
- var modifiers = {
650
- alt: keys.includes('alt'),
651
- ctrl: keys.includes('ctrl') || keys.includes('control'),
652
- shift: keys.includes('shift'),
653
- meta: keys.includes('meta'),
654
- mod: keys.includes('mod')
601
+ function K(e) {
602
+ return (Q[e.trim()] || e.trim()).toLowerCase().replace(/key|digit|numpad/, "");
603
+ }
604
+ function D(e) {
605
+ return j.includes(e);
606
+ }
607
+ function H(e, r = ",") {
608
+ return e.toLowerCase().split(r);
609
+ }
610
+ function P(e, r = "+", o = ">", i = false, u) {
611
+ let n = [], c = false;
612
+ e = e.trim(), e.includes(o) ? (c = true, n = e.toLocaleLowerCase().split(o).map((f) => K(f))) : n = e.toLocaleLowerCase().split(r).map((f) => K(f));
613
+ const y = {
614
+ alt: n.includes("alt"),
615
+ ctrl: n.includes("ctrl") || n.includes("control"),
616
+ shift: n.includes("shift"),
617
+ meta: n.includes("meta"),
618
+ mod: n.includes("mod"),
619
+ useKey: i
620
+ }, d = n.filter((f) => !j.includes(f));
621
+ return {
622
+ ...y,
623
+ keys: d,
624
+ description: u,
625
+ isSequence: c,
626
+ hotkey: e
655
627
  };
656
- var singleCharKeys = keys.filter(function (k) {
657
- return !reservedModifierKeywords.includes(k);
658
- });
659
- return _extends({}, modifiers, {
660
- keys: singleCharKeys,
661
- description: description
662
- });
663
628
  }
664
-
665
- (function () {
666
- if (typeof document !== 'undefined') {
667
- document.addEventListener('keydown', function (e) {
668
- if (e.key === undefined) {
669
- // Synthetic event (e.g., Chrome autofill). Ignore.
670
- return;
671
- }
672
- pushToCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
673
- });
674
- document.addEventListener('keyup', function (e) {
675
- if (e.key === undefined) {
676
- // Synthetic event (e.g., Chrome autofill). Ignore.
677
- return;
678
- }
679
- removeFromCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
680
- });
681
- }
682
- if (typeof window !== 'undefined') {
683
- window.addEventListener('blur', function () {
684
- currentlyPressedKeys.clear();
685
- });
686
- }
687
- })();
688
- var currentlyPressedKeys = /*#__PURE__*/new Set();
689
- // https://github.com/microsoft/TypeScript/issues/17002
690
- function isReadonlyArray(value) {
691
- return Array.isArray(value);
692
- }
693
- function isHotkeyPressed(key, splitKey) {
694
- if (splitKey === void 0) {
695
- splitKey = ',';
696
- }
697
- var hotkeyArray = isReadonlyArray(key) ? key : key.split(splitKey);
698
- return hotkeyArray.every(function (hotkey) {
699
- return currentlyPressedKeys.has(hotkey.trim().toLowerCase());
700
- });
701
- }
702
- function pushToCurrentlyPressedKeys(key) {
703
- var hotkeyArray = Array.isArray(key) ? key : [key];
704
- /*
705
- Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
706
- https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
707
- Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
708
- */
709
- if (currentlyPressedKeys.has('meta')) {
710
- currentlyPressedKeys.forEach(function (key) {
711
- return !isHotkeyModifier(key) && currentlyPressedKeys["delete"](key.toLowerCase());
712
- });
713
- }
714
- hotkeyArray.forEach(function (hotkey) {
715
- return currentlyPressedKeys.add(hotkey.toLowerCase());
716
- });
717
- }
718
- function removeFromCurrentlyPressedKeys(key) {
719
- var hotkeyArray = Array.isArray(key) ? key : [key];
720
- /*
721
- Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
722
- https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
723
- Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
724
- */
725
- if (key === 'meta') {
726
- currentlyPressedKeys.clear();
727
- } else {
728
- hotkeyArray.forEach(function (hotkey) {
729
- return currentlyPressedKeys["delete"](hotkey.toLowerCase());
730
- });
731
- }
732
- }
733
-
734
- function maybePreventDefault(e, hotkey, preventDefault) {
735
- if (typeof preventDefault === 'function' && preventDefault(e, hotkey) || preventDefault === true) {
736
- e.preventDefault();
737
- }
738
- }
739
- function isHotkeyEnabled(e, hotkey, enabled) {
740
- if (typeof enabled === 'function') {
741
- return enabled(e, hotkey);
742
- }
743
- return enabled === true || enabled === undefined;
744
- }
745
- function isKeyboardEventTriggeredByInput(ev) {
746
- return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select']);
747
- }
748
- function isHotkeyEnabledOnTag(_ref, enabledOnTags) {
749
- var target = _ref.target;
750
- if (enabledOnTags === void 0) {
751
- enabledOnTags = false;
752
- }
753
- var targetTagName = target && target.tagName;
754
- if (isReadonlyArray(enabledOnTags)) {
755
- return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(function (tag) {
756
- return tag.toLowerCase() === targetTagName.toLowerCase();
757
- }));
758
- }
759
- return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
760
- }
761
- function isScopeActive(activeScopes, scopes) {
762
- if (activeScopes.length === 0 && scopes) {
763
- console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>');
629
+ typeof document < "u" && (document.addEventListener("keydown", (e) => {
630
+ e.code !== void 0 && I([K(e.code)]);
631
+ }), document.addEventListener("keyup", (e) => {
632
+ e.code !== void 0 && _([K(e.code)]);
633
+ })), typeof window < "u" && (window.addEventListener("blur", () => {
634
+ L.clear();
635
+ }), window.addEventListener("contextmenu", () => {
636
+ setTimeout(() => {
637
+ L.clear();
638
+ }, 0);
639
+ }));
640
+ const L = /* @__PURE__ */ new Set();
641
+ function R(e) {
642
+ return Array.isArray(e);
643
+ }
644
+ function U(e, r = ",") {
645
+ return (R(e) ? e : e.split(r)).every((i) => L.has(i.trim().toLowerCase()));
646
+ }
647
+ function I(e) {
648
+ const r = Array.isArray(e) ? e : [e];
649
+ L.has("meta") && L.forEach((o) => !D(o) && L.delete(o.toLowerCase())), r.forEach((o) => L.add(o.toLowerCase()));
650
+ }
651
+ function _(e) {
652
+ const r = Array.isArray(e) ? e : [e];
653
+ e === "meta" ? L.clear() : r.forEach((o) => L.delete(o.toLowerCase()));
654
+ }
655
+ function V(e, r, o) {
656
+ (typeof o == "function" && o(e, r) || o === true) && e.preventDefault();
657
+ }
658
+ function X(e, r, o) {
659
+ return typeof o == "function" ? o(e, r) : o === true || o === void 0;
660
+ }
661
+ const Y = [
662
+ "input",
663
+ "textarea",
664
+ "select",
665
+ "searchbox",
666
+ "slider",
667
+ "spinbutton",
668
+ "menuitem",
669
+ "menuitemcheckbox",
670
+ "menuitemradio",
671
+ "option",
672
+ "radio",
673
+ "textbox"
674
+ ];
675
+ function Z(e) {
676
+ return F(e, Y);
677
+ }
678
+ function F(e, r = false) {
679
+ const { target: o, composed: i } = e;
680
+ let u, n;
681
+ return ee(o) && i ? (u = e.composedPath()[0] && e.composedPath()[0].tagName, n = e.composedPath()[0] && e.composedPath()[0].role) : (u = o && o.tagName, n = o && o.role), R(r) ? !!(u && r && r.some((c) => c.toLowerCase() === u.toLowerCase() || c === n)) : !!(u && r && r);
682
+ }
683
+ function ee(e) {
684
+ return !!e.tagName && !e.tagName.startsWith("-") && e.tagName.includes("-");
685
+ }
686
+ function te(e, r) {
687
+ return e.length === 0 && r ? (console.warn(
688
+ 'A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'
689
+ ), true) : r ? e.some((o) => r.includes(o)) || e.includes("*") : true;
690
+ }
691
+ const re = (e, r, o = false) => {
692
+ const { alt: i, meta: u, mod: n, shift: c, ctrl: y, keys: d, useKey: f } = r, { code: p, key: t, ctrlKey: a, metaKey: l, shiftKey: g, altKey: k } = e, m = K(p);
693
+ if (f && d?.length === 1 && d.includes(t))
764
694
  return true;
765
- }
766
- if (!scopes) {
767
- return true;
768
- }
769
- return activeScopes.some(function (scope) {
770
- return scopes.includes(scope);
771
- }) || activeScopes.includes('*');
772
- }
773
- var isHotkeyMatchingKeyboardEvent = function isHotkeyMatchingKeyboardEvent(e, hotkey, ignoreModifiers) {
774
- if (ignoreModifiers === void 0) {
775
- ignoreModifiers = false;
776
- }
777
- var alt = hotkey.alt,
778
- meta = hotkey.meta,
779
- mod = hotkey.mod,
780
- shift = hotkey.shift,
781
- ctrl = hotkey.ctrl,
782
- keys = hotkey.keys;
783
- var pressedKeyUppercase = e.key,
784
- code = e.code,
785
- ctrlKey = e.ctrlKey,
786
- metaKey = e.metaKey,
787
- shiftKey = e.shiftKey,
788
- altKey = e.altKey;
789
- var keyCode = mapKey(code);
790
- var pressedKey = pressedKeyUppercase.toLowerCase();
791
- if (!(keys != null && keys.includes(keyCode)) && !(keys != null && keys.includes(pressedKey)) && !['ctrl', 'control', 'unknown', 'meta', 'alt', 'shift', 'os'].includes(keyCode)) {
695
+ if (!d?.includes(m) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(m))
792
696
  return false;
793
- }
794
- if (!ignoreModifiers) {
795
- // We check the pressed keys for compatibility with the keyup event. In keyup events the modifier flags are not set.
796
- if (alt === !altKey && pressedKey !== 'alt') {
797
- return false;
798
- }
799
- if (shift === !shiftKey && pressedKey !== 'shift') {
697
+ if (!o) {
698
+ if (i !== k && m !== "alt" || c !== g && m !== "shift")
800
699
  return false;
801
- }
802
- // Mod is a special key name that is checking for meta on macOS and ctrl on other platforms
803
- if (mod) {
804
- if (!metaKey && !ctrlKey) {
700
+ if (n) {
701
+ if (!l && !a)
805
702
  return false;
806
- }
807
- } else {
808
- if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
809
- return false;
810
- }
811
- if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {
812
- return false;
813
- }
814
- }
815
- }
816
- // All modifiers are correct, now check the key
817
- // If the key is set, we check for the key
818
- if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {
819
- return true;
820
- } else if (keys) {
821
- // Check if all keys are present in pressedDownKeys set
822
- return isHotkeyPressed(keys);
823
- } else if (!keys) {
824
- // If the key is not set, we only listen for modifiers, that check went alright, so we return true
825
- return true;
703
+ } else if (u !== l && m !== "meta" && m !== "os" || y !== a && m !== "ctrl" && m !== "control")
704
+ return false;
826
705
  }
827
- // There is nothing that matches.
828
- return false;
829
- };
830
-
831
- var BoundHotkeysProxyProvider = /*#__PURE__*/React.createContext(undefined);
832
- var useBoundHotkeysProxy = function useBoundHotkeysProxy() {
833
- return React.useContext(BoundHotkeysProxyProvider);
834
- };
835
-
836
- function deepEqual(x, y) {
837
- //@ts-ignore
838
- return x && y && typeof x === 'object' && typeof y === 'object' ? Object.keys(x).length === Object.keys(y).length &&
839
- //@ts-ignore
840
- Object.keys(x).reduce(function (isEqual, key) {
841
- return isEqual && deepEqual(x[key], y[key]);
842
- }, true) : x === y;
706
+ return d && d.length === 1 && d.includes(m) ? true : d ? U(d) : !d;
707
+ }, $ = React.createContext(void 0), oe = () => React.useContext($);
708
+ function x(e, r) {
709
+ return e && r && typeof e == "object" && typeof r == "object" ? Object.keys(e).length === Object.keys(r).length && // @ts-expect-error TS7053
710
+ Object.keys(e).reduce((o, i) => o && x(e[i], r[i]), true) : e === r;
843
711
  }
844
-
845
- var HotkeysContext = /*#__PURE__*/React.createContext({
712
+ const W = React.createContext({
846
713
  hotkeys: [],
847
- enabledScopes: [],
848
- toggleScope: function toggleScope() {},
849
- enableScope: function enableScope() {},
850
- disableScope: function disableScope() {}
851
- });
852
- var useHotkeysContext = function useHotkeysContext() {
853
- return React.useContext(HotkeysContext);
854
- };
855
-
856
- function useDeepEqualMemo(value) {
857
- var ref = React.useRef(undefined);
858
- if (!deepEqual(ref.current, value)) {
859
- ref.current = value;
714
+ activeScopes: [],
715
+ // This array has to be empty instead of containing '*' as default, to check if the provider is set or not
716
+ toggleScope: () => {
717
+ },
718
+ enableScope: () => {
719
+ },
720
+ disableScope: () => {
860
721
  }
861
- return ref.current;
862
- }
863
-
864
- var stopPropagation = function stopPropagation(e) {
865
- e.stopPropagation();
866
- e.preventDefault();
867
- e.stopImmediatePropagation();
868
- };
869
- var useSafeLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
870
- function useHotkeys(keys, callback, options, dependencies) {
871
- var ref = React.useRef(null);
872
- var hasTriggeredRef = React.useRef(false);
873
- var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
874
- var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;
875
- var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined;
876
- var memoisedCB = React.useCallback(callback, _deps != null ? _deps : []);
877
- var cbRef = React.useRef(memoisedCB);
878
- if (_deps) {
879
- cbRef.current = memoisedCB;
880
- } else {
881
- cbRef.current = callback;
882
- }
883
- var memoisedOptions = useDeepEqualMemo(_options);
884
- var _useHotkeysContext = useHotkeysContext(),
885
- enabledScopes = _useHotkeysContext.enabledScopes;
886
- var proxy = useBoundHotkeysProxy();
887
- useSafeLayoutEffect(function () {
888
- if ((memoisedOptions == null ? void 0 : memoisedOptions.enabled) === false || !isScopeActive(enabledScopes, memoisedOptions == null ? void 0 : memoisedOptions.scopes)) {
722
+ }), se = () => React.useContext(W);
723
+ function ie(e) {
724
+ const r = React.useRef(void 0);
725
+ return x(r.current, e) || (r.current = e), r.current;
726
+ }
727
+ const N = (e) => {
728
+ e.stopPropagation(), e.preventDefault(), e.stopImmediatePropagation();
729
+ }, ue = typeof window < "u" ? React.useLayoutEffect : React.useEffect;
730
+ function fe(e, r, o, i) {
731
+ const u = React.useRef(null), n = React.useRef(false), c = Array.isArray(o) ? Array.isArray(i) ? void 0 : i : o, y = R(e) ? e.join(c?.delimiter) : e, d = Array.isArray(o) ? o : Array.isArray(i) ? i : void 0, f = React.useCallback(r, d ?? []), p = React.useRef(f);
732
+ d ? p.current = f : p.current = r;
733
+ const t = ie(c), { activeScopes: a } = se(), l = oe();
734
+ return ue(() => {
735
+ if (t?.enabled === false || !te(a, t?.scopes))
889
736
  return;
890
- }
891
- var listener = function listener(e, isKeyUp) {
892
- var _e$target;
893
- if (isKeyUp === void 0) {
894
- isKeyUp = false;
895
- }
896
- if (isKeyboardEventTriggeredByInput(e) && !isHotkeyEnabledOnTag(e, memoisedOptions == null ? void 0 : memoisedOptions.enableOnFormTags)) {
897
- return;
898
- }
899
- // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
900
- // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.
901
- if (ref.current !== null) {
902
- var rootNode = ref.current.getRootNode();
903
- if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref.current && !ref.current.contains(rootNode.activeElement)) {
904
- stopPropagation(e);
905
- return;
906
- }
907
- }
908
- if ((_e$target = e.target) != null && _e$target.isContentEditable && !(memoisedOptions != null && memoisedOptions.enableOnContentEditable)) {
909
- return;
910
- }
911
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
912
- var _hotkey$keys;
913
- var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey);
914
- if (isHotkeyMatchingKeyboardEvent(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.ignoreModifiers) || (_hotkey$keys = hotkey.keys) != null && _hotkey$keys.includes('*')) {
915
- if (memoisedOptions != null && memoisedOptions.ignoreEventWhen != null && memoisedOptions.ignoreEventWhen(e)) {
737
+ let g = [], k;
738
+ const m = (s, B = false) => {
739
+ if (!(Z(s) && !F(s, t?.enableOnFormTags))) {
740
+ if (u.current !== null) {
741
+ const v = u.current.getRootNode();
742
+ if ((v instanceof Document || v instanceof ShadowRoot) && v.activeElement !== u.current && !u.current.contains(v.activeElement)) {
743
+ N(s);
916
744
  return;
917
745
  }
918
- if (isKeyUp && hasTriggeredRef.current) {
919
- return;
920
- }
921
- maybePreventDefault(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.preventDefault);
922
- if (!isHotkeyEnabled(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.enabled)) {
923
- stopPropagation(e);
746
+ }
747
+ s.target?.isContentEditable && !t?.enableOnContentEditable || H(y, t?.delimiter).forEach((v) => {
748
+ if (v.includes(t?.splitKey ?? "+") && v.includes(t?.sequenceSplitKey ?? ">")) {
749
+ console.warn(
750
+ `Hotkey ${v} contains both ${t?.splitKey ?? "+"} and ${t?.sequenceSplitKey ?? ">"} which is not supported.`
751
+ );
924
752
  return;
925
753
  }
926
- // Execute the user callback for that hotkey
927
- cbRef.current(e, hotkey);
928
- if (!isKeyUp) {
929
- hasTriggeredRef.current = true;
754
+ const h = P(
755
+ v,
756
+ t?.splitKey,
757
+ t?.sequenceSplitKey,
758
+ t?.useKey,
759
+ t?.description
760
+ );
761
+ if (h.isSequence) {
762
+ k = setTimeout(() => {
763
+ g = [];
764
+ }, t?.sequenceTimeoutMs ?? 1e3);
765
+ const C = h.useKey ? s.key : K(s.code);
766
+ if (D(C.toLowerCase()))
767
+ return;
768
+ g.push(C);
769
+ const G = h.keys?.[g.length - 1];
770
+ if (C !== G) {
771
+ g = [], k && clearTimeout(k);
772
+ return;
773
+ }
774
+ g.length === h.keys?.length && (p.current(s, h), k && clearTimeout(k), g = []);
775
+ } else if (re(s, h, t?.ignoreModifiers) || h.keys?.includes("*")) {
776
+ if (t?.ignoreEventWhen?.(s) || B && n.current)
777
+ return;
778
+ if (V(s, h, t?.preventDefault), !X(s, h, t?.enabled)) {
779
+ N(s);
780
+ return;
781
+ }
782
+ p.current(s, h), B || (n.current = true);
930
783
  }
931
- }
932
- });
933
- };
934
- var handleKeyDown = function handleKeyDown(event) {
935
- if (event.key === undefined) {
936
- // Synthetic event (e.g., Chrome autofill). Ignore.
937
- return;
938
- }
939
- pushToCurrentlyPressedKeys(mapKey(event.code));
940
- if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {
941
- listener(event);
942
- }
943
- };
944
- var handleKeyUp = function handleKeyUp(event) {
945
- if (event.key === undefined) {
946
- // Synthetic event (e.g., Chrome autofill). Ignore.
947
- return;
948
- }
949
- removeFromCurrentlyPressedKeys(mapKey(event.code));
950
- hasTriggeredRef.current = false;
951
- if (memoisedOptions != null && memoisedOptions.keyup) {
952
- listener(event, true);
953
- }
954
- };
955
- var domNode = ref.current || (_options == null ? void 0 : _options.document) || document;
956
- // @ts-ignore
957
- domNode.addEventListener('keyup', handleKeyUp);
958
- // @ts-ignore
959
- domNode.addEventListener('keydown', handleKeyDown);
960
- if (proxy) {
961
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
962
- return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
963
- });
964
- }
965
- return function () {
966
- // @ts-ignore
967
- domNode.removeEventListener('keyup', handleKeyUp);
968
- // @ts-ignore
969
- domNode.removeEventListener('keydown', handleKeyDown);
970
- if (proxy) {
971
- parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
972
- return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
973
784
  });
974
785
  }
786
+ }, O = (s) => {
787
+ s.code !== void 0 && (I(K(s.code)), (t?.keydown === void 0 && t?.keyup !== true || t?.keydown) && m(s));
788
+ }, q = (s) => {
789
+ s.code !== void 0 && (_(K(s.code)), n.current = false, t?.keyup && m(s, true));
790
+ }, E = u.current || c?.document || document;
791
+ return E.addEventListener("keyup", q, c?.eventListenerOptions), E.addEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
792
+ (s) => l.addHotkey(
793
+ P(
794
+ s,
795
+ t?.splitKey,
796
+ t?.sequenceSplitKey,
797
+ t?.useKey,
798
+ t?.description
799
+ )
800
+ )
801
+ ), () => {
802
+ E.removeEventListener("keyup", q, c?.eventListenerOptions), E.removeEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
803
+ (s) => l.removeHotkey(
804
+ P(
805
+ s,
806
+ t?.splitKey,
807
+ t?.sequenceSplitKey,
808
+ t?.useKey,
809
+ t?.description
810
+ )
811
+ )
812
+ ), g = [], k && clearTimeout(k);
975
813
  };
976
- }, [_keys, memoisedOptions, enabledScopes]);
977
- return ref;
814
+ }, [y, t, a]), u;
978
815
  }
979
816
 
980
817
  function UpdateButton(_a) {
@@ -985,10 +822,8 @@ function UpdateButton(_a) {
985
822
  handleSubmit
986
823
  } = (_b = formik.useFormikContext()) !== null && _b !== void 0 ? _b : {
987
824
  dirty: false,
988
- handleSubmit: undefined,
989
- values: {}
990
- };
991
- useHotkeys('ctrl+s', () => {
825
+ handleSubmit: undefined};
826
+ fe('ctrl+s', () => {
992
827
  if (dirty && !props.disabled) handleSubmit();
993
828
  }, {
994
829
  preventDefault: true
@@ -1007,7 +842,7 @@ function ViewButton(_a) {
1007
842
  icon
1008
843
  } = _a,
1009
844
  props = tslib.__rest(_a, ["label", "path", "icon"]);
1010
- const openPage = React__default["default"].useCallback(() => {
845
+ const openPage = React.useCallback(() => {
1011
846
  window.open(path, '_blank');
1012
847
  }, [path]);
1013
848
  return jsxRuntime.jsx(admin.ButtonBarButton, Object.assign({
@@ -1031,13 +866,13 @@ function OrderCell({
1031
866
  }) {
1032
867
  const mutationDown = api.useInvalidateMutation(api$1.moveDown, api$1.queryKey);
1033
868
  const mutationUp = api.useInvalidateMutation(api$1.moveUp, api$1.queryKey);
1034
- const moveDown = React__default["default"].useCallback(e => {
869
+ const moveDown = React.useCallback(e => {
1035
870
  e.stopPropagation();
1036
871
  mutationDown.mutateAsync(postId).catch(error => {
1037
872
  reactToastify.toast.error(`Error: ${error}`);
1038
873
  });
1039
874
  }, [mutationDown, postId]);
1040
- const moveUp = React__default["default"].useCallback(e => {
875
+ const moveUp = React.useCallback(e => {
1041
876
  e.stopPropagation();
1042
877
  mutationUp.mutateAsync(postId).catch(error => {
1043
878
  reactToastify.toast.error(`Error: ${error}`);
@@ -1143,7 +978,7 @@ function PageQueryStateContainerInner(_a) {
1143
978
  children: apiFn == "get" ? children(data) : children(data)
1144
979
  }));
1145
980
  }
1146
- const PageQueryStateContainer = /*#__PURE__*/React__default["default"].forwardRef(PageQueryStateContainerInner);
981
+ const PageQueryStateContainer = /*#__PURE__*/React.forwardRef(PageQueryStateContainerInner);
1147
982
 
1148
983
  function PageSidebar(_a) {
1149
984
  var {
@@ -1213,7 +1048,7 @@ const [CP, usePageTabbedTopBarContext] = react.createContext();
1213
1048
  function PageTabbedTopBarProvider({
1214
1049
  children
1215
1050
  }) {
1216
- const [containerEl, setContainerEl] = React__default["default"].useState(null);
1051
+ const [containerEl, setContainerEl] = React.useState(null);
1217
1052
  return jsxRuntime.jsx(CP, {
1218
1053
  value: {
1219
1054
  containerEl,
@@ -1229,12 +1064,12 @@ function PageTabbedTopBar(_a) {
1229
1064
  children
1230
1065
  } = _a,
1231
1066
  props = tslib.__rest(_a, ["title", "breadcrumbs", "children"]);
1232
- const ref = /*#__PURE__*/React__default["default"].createRef();
1067
+ const ref = /*#__PURE__*/React.createRef();
1233
1068
  const {
1234
1069
  setContainerEl
1235
1070
  } = usePageTabbedTopBarContext();
1236
- const [isSet, setIsSet] = React__default["default"].useState(false);
1237
- React__default["default"].useEffect(() => {
1071
+ const [isSet, setIsSet] = React.useState(false);
1072
+ React.useEffect(() => {
1238
1073
  if (!isSet && ref.current) {
1239
1074
  setContainerEl(ref.current);
1240
1075
  setIsSet(true);
@@ -1268,14 +1103,14 @@ function PageTopBarToolbar({
1268
1103
  const {
1269
1104
  containerEl
1270
1105
  } = usePageTabbedTopBarContext();
1271
- const [visible, setVisible] = React__default["default"].useState(false);
1272
- const portal = React__default["default"].useMemo(() => {
1106
+ const [visible, setVisible] = React.useState(false);
1107
+ const portal = React.useMemo(() => {
1273
1108
  const node = containerEl; //?.ownerDocument.createElement("div")
1274
1109
  // if (node) node.className = PORTAL_CLASSNAME
1275
1110
  return node;
1276
1111
  }, [containerEl]);
1277
1112
  const host = containerEl !== null && containerEl !== void 0 ? containerEl : typeof window !== "undefined" ? document.body : undefined;
1278
- React__default["default"].useLayoutEffect(() => {
1113
+ React.useLayoutEffect(() => {
1279
1114
  if (!portal || !host) return;
1280
1115
  try {
1281
1116
  if (visible) host.appendChild(portal);else host.removeChild(portal);
@@ -1286,11 +1121,11 @@ function PageTopBarToolbar({
1286
1121
  } catch (e) {}
1287
1122
  };
1288
1123
  }, [visible, portal, host]);
1289
- const callback = React__default["default"].useCallback(entries => {
1124
+ const callback = React.useCallback(entries => {
1290
1125
  // @ts-ignore
1291
1126
  setVisible(entries[0].isVisible);
1292
1127
  }, [children]);
1293
- React__default["default"].useEffect(() => {
1128
+ React.useEffect(() => {
1294
1129
  const opts = {
1295
1130
  root: null,
1296
1131
  rootMargin: '0px',
@@ -1344,7 +1179,7 @@ function Buttons$1({
1344
1179
  }) {
1345
1180
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1346
1181
  children: [buttonBar && buttonBar.length > 0 && jsxRuntime.jsx(admin.ButtonBar, {
1347
- children: buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
1182
+ children: buttonBar.map((button, index) => jsxRuntime.jsxs(React.Fragment, {
1348
1183
  children: [button.type === "link" && jsxRuntime.jsx(ViewButton, {
1349
1184
  label: button.label,
1350
1185
  path: button.path,
@@ -1387,7 +1222,7 @@ function DetailsView(_a) {
1387
1222
  } = _a,
1388
1223
  props = tslib.__rest(_a, ["queryField", "api", "useNextRouter", "processInput", "screen", "tabbed"]);
1389
1224
  const id = useQueryField(queryField, useNextRouter);
1390
- const ref = React__default["default"].useRef(null);
1225
+ const ref = React.useRef(null);
1391
1226
  return jsxRuntime.jsx(PageQueryStateContainer, Object.assign({
1392
1227
  api: api,
1393
1228
  apiFn: "get",
@@ -1561,7 +1396,7 @@ function QueryWrapper(_a) {
1561
1396
  const {
1562
1397
  data
1563
1398
  } = api.useApiQuery(mApi.queryKey, fn === "get" || fn === "getTransformed" ? mApi.get : mApi.getAll, react.isFunction(api$1) ? undefined : id);
1564
- const transformedData = React__default["default"].useMemo(() => {
1399
+ const transformedData = React.useMemo(() => {
1565
1400
  if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
1566
1401
  if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
1567
1402
  return transformFn === null || transformFn === void 0 ? void 0 : transformFn(data);
@@ -1637,11 +1472,11 @@ function TableContainerContextProvider({
1637
1472
  children
1638
1473
  }) {
1639
1474
  var _a, _b;
1640
- const [showFilters, setShowFilters] = React__default["default"].useState(false);
1641
- const [showMassActions, setShowMassActions] = React__default["default"].useState(false);
1642
- const [visibleColumnIds, setVisibleColumnIds] = React__default["default"].useState((_a = initialVisibleColumns !== null && initialVisibleColumns !== void 0 ? initialVisibleColumns : columns === null || columns === void 0 ? void 0 : columns.map(col => getColId(col))) !== null && _a !== void 0 ? _a : []);
1475
+ const [showFilters, setShowFilters] = React.useState(false);
1476
+ const [showMassActions, setShowMassActions] = React.useState(false);
1477
+ const [visibleColumnIds, setVisibleColumnIds] = React.useState((_a = initialVisibleColumns !== null && initialVisibleColumns !== void 0 ? initialVisibleColumns : columns === null || columns === void 0 ? void 0 : columns.map(col => getColId(col))) !== null && _a !== void 0 ? _a : []);
1643
1478
  const filteredColumns = (_b = columns === null || columns === void 0 ? void 0 : columns.filter(col => visibleColumnIds.includes(getColId(col)))) !== null && _b !== void 0 ? _b : [];
1644
- const toggleColumnVisibility = React__default["default"].useCallback(id => {
1479
+ const toggleColumnVisibility = React.useCallback(id => {
1645
1480
  const index = visibleColumnIds.indexOf(id);
1646
1481
  if (index > -1) {
1647
1482
  const newIds = visibleColumnIds.concat();
@@ -1651,7 +1486,7 @@ function TableContainerContextProvider({
1651
1486
  setVisibleColumnIds(visibleColumnIds.concat(id));
1652
1487
  }
1653
1488
  }, [visibleColumnIds, setVisibleColumnIds]);
1654
- const isColumnVisible = React__default["default"].useCallback(id => {
1489
+ const isColumnVisible = React.useCallback(id => {
1655
1490
  return visibleColumnIds.includes(id);
1656
1491
  }, [visibleColumnIds]);
1657
1492
  const Provider = provider$1;
@@ -1829,18 +1664,18 @@ function TableFilters({
1829
1664
  getFilters,
1830
1665
  setFilters
1831
1666
  } = table.useTableContext();
1832
- const handleSubmit = React__default["default"].useCallback((values, actions) => {
1667
+ const handleSubmit = React.useCallback((values, actions) => {
1833
1668
  var _a;
1834
1669
  const params = (_a = processInput === null || processInput === void 0 ? void 0 : processInput(values)) !== null && _a !== void 0 ? _a : values;
1835
1670
  if (!isEqual(params, getFilters())) setFilters(params);
1836
1671
  // setFilters(processInput?.(values) ?? values)
1837
1672
  actions.setSubmitting(false);
1838
1673
  }, [setFilters, processInput]);
1839
- const handleReset = React__default["default"].useCallback(resetForm => {
1674
+ const handleReset = React.useCallback(resetForm => {
1840
1675
  setFilters(initialValues);
1841
1676
  resetForm();
1842
1677
  }, [setFilters, initialValues]);
1843
- React__default["default"].useEffect(() => setFilters(initialValues), []);
1678
+ React.useEffect(() => setFilters(initialValues), []);
1844
1679
  return jsxRuntime.jsx(ui.Collapse, {
1845
1680
  in: showFilters,
1846
1681
  style: {
@@ -2008,14 +1843,14 @@ function ItemEditDialog(_a) {
2008
1843
  error /*, error*/,
2009
1844
  refetch
2010
1845
  } = api.useApiQuery(api$1.queryKey, api$1.get, queryId, Object.assign({
2011
- enabled: !( /*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
1846
+ enabled: !(/*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
2012
1847
  onError: onFetchError
2013
1848
  }, queryFetchOptions));
2014
1849
  // const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
2015
1850
  // const [showTab, setShowTab] = React.useState(true);
2016
1851
  const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.upsert, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, querySaveOptions) : api.useApiMutation(api$1.upsert, api$1.queryKey, queryId, querySaveOptions);
2017
- const retry = React__default["default"].useCallback(() => refetch(), [refetch]);
2018
- const saveItem = React__default["default"].useCallback((item, actions) => tslib.__awaiter(this, void 0, void 0, function* () {
1852
+ const retry = React.useCallback(() => refetch(), [refetch]);
1853
+ const saveItem = React.useCallback((item, actions) => tslib.__awaiter(this, void 0, void 0, function* () {
2019
1854
  // Clear mutation error if any
2020
1855
  mutation.reset();
2021
1856
  const formItem = formToQueryData ? formToQueryData(item) : Object.assign({}, item);
@@ -2085,7 +1920,7 @@ function ItemEditDialog(_a) {
2085
1920
  children: [jsxRuntime.jsx(ui.Modal.Body, {
2086
1921
  pb: "6",
2087
1922
  children: jsxRuntime.jsxs(formik.Form, {
2088
- children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
1923
+ children: [/*#__PURE__*/React.isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
2089
1924
  form: form$1
2090
1925
  }), react.isFunction(form$1) && jsxRuntime.jsx(form.FormRenderer, {
2091
1926
  form: form$1(data !== null && data !== void 0 ? data : values)
@@ -2131,7 +1966,7 @@ function QueryWrapperDialog({
2131
1966
  refetchOnMount: false,
2132
1967
  refetchOnWindowFocus: false
2133
1968
  });
2134
- const transformedData = React__default["default"].useMemo(() => {
1969
+ const transformedData = React.useMemo(() => {
2135
1970
  if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
2136
1971
  if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
2137
1972
  // @ts-ignore
@@ -2168,7 +2003,7 @@ function MultiQueryWrapperDialog({
2168
2003
  staleTime: q.cache === false ? 0 : undefined
2169
2004
  }
2170
2005
  })));
2171
- const transformedData = React__default["default"].useMemo(() => {
2006
+ const transformedData = React.useMemo(() => {
2172
2007
  return data === null || data === void 0 ? void 0 : data.map((d, index) => {
2173
2008
  var _a, _b;
2174
2009
  return queries[index].transformFn ? (_b = (_a = queries[index]) === null || _a === void 0 ? void 0 : _a.transformFn) === null || _b === void 0 ? void 0 : _b.call(_a, d) : d;
@@ -2195,7 +2030,10 @@ function DialogRenderer({
2195
2030
  invalidateQueryKey,
2196
2031
  queryId
2197
2032
  }) {
2198
- const props = tslib.__rest(config, ["type"]);
2033
+ const {
2034
+ type
2035
+ } = config,
2036
+ props = tslib.__rest(config, ["type"]);
2199
2037
  if (config.type === "dialog") return jsxRuntime.jsx(ItemEditDialog, Object.assign({}, props, {
2200
2038
  queryId: queryId,
2201
2039
  invalidateQueryKey: invalidateQueryKey,
@@ -2219,7 +2057,7 @@ function RefreshButton({
2219
2057
  queryKey
2220
2058
  }) {
2221
2059
  const invalidate = api.useInvalidateQuery(queryKey);
2222
- useHotkeys('ctrl+r', () => invalidate(), {
2060
+ fe('ctrl+r', () => invalidate(), {
2223
2061
  preventDefault: true
2224
2062
  }, [invalidate]);
2225
2063
  return jsxRuntime.jsx(ButtonBarButton, {
@@ -2238,6 +2076,7 @@ function ItemDeleteDialog(_a) {
2238
2076
  var {
2239
2077
  title,
2240
2078
  actionButtonLabel,
2079
+ closeActionButtonLabel = "Cancel",
2241
2080
  itemLabel,
2242
2081
  queryId = "",
2243
2082
  api: api$1,
@@ -2248,15 +2087,19 @@ function ItemDeleteDialog(_a) {
2248
2087
  md_boxSizing,
2249
2088
  msg,
2250
2089
  show,
2251
- onClose
2090
+ onClose,
2091
+ onSuccess
2252
2092
  } = _a,
2253
- props = tslib.__rest(_a, ["title", "actionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2093
+ props = tslib.__rest(_a, ["title", "actionButtonLabel", "closeActionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose", "onSuccess"]);
2254
2094
  const fn = apiFn ? api$1[apiFn] : api$1.delete;
2255
2095
  const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(fn, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(fn, api$1.queryKey);
2256
2096
  const mutate = api.useMutate(mutation, {
2257
- onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2097
+ onSuccess: () => {
2098
+ onClose === null || onClose === void 0 ? void 0 : onClose();
2099
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
2100
+ }
2258
2101
  });
2259
- const handleDelete = React__default["default"].useCallback(() => mutate(queryId), [mutate, queryId]);
2102
+ const handleDelete = React.useCallback(() => mutate(queryId), [mutate, queryId]);
2260
2103
  return jsxRuntime.jsxs(ui.Modal, Object.assign({
2261
2104
  size: size,
2262
2105
  show: show,
@@ -2275,19 +2118,19 @@ function ItemDeleteDialog(_a) {
2275
2118
  placeContent: "end",
2276
2119
  spaceX: "3",
2277
2120
  children: [jsxRuntime.jsx(ui.Button, {
2278
- disabled: mutation.isLoading,
2121
+ disabled: mutation.isPending,
2279
2122
  onClick: onClose,
2280
2123
  variant: "borderless",
2281
- scheme: "secondary",
2124
+ scheme: "dark",
2282
2125
  me: "2",
2283
- children: "Cancel"
2126
+ children: closeActionButtonLabel
2284
2127
  }), jsxRuntime.jsx(ui.Button, {
2285
2128
  scheme: "danger",
2286
- disabled: mutation.isLoading,
2129
+ disabled: mutation.isPending,
2287
2130
  onClick: handleDelete,
2288
2131
  children: actionButtonLabel || "Delete"
2289
2132
  })]
2290
- }), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2133
+ }), mutation.isPending && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2291
2134
  }));
2292
2135
  }
2293
2136
 
@@ -2300,9 +2143,9 @@ function TableViewProvider({
2300
2143
  }) {
2301
2144
  const openLink = hooks.useOpenLink();
2302
2145
  const navigate = reactRouterDom.useNavigate();
2303
- const [dialog, setDialog] = React__default["default"].useState(null);
2304
- const onCloseDialog = React__default["default"].useCallback(() => setDialog(null), [setDialog]);
2305
- const onAction = React__default["default"].useCallback((action, item) => {
2146
+ const [dialog, setDialog] = React.useState(null);
2147
+ const onCloseDialog = React.useCallback(() => setDialog(null), [setDialog]);
2148
+ const onAction = React.useCallback((action, item) => {
2306
2149
  switch (action.type) {
2307
2150
  case "view":
2308
2151
  {
@@ -2443,7 +2286,7 @@ function TableRowPublishPostButton$1(_a) {
2443
2286
  const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
2444
2287
  networkMode: "always"
2445
2288
  });
2446
- const publish = React__default["default"].useCallback(event => {
2289
+ const publish = React.useCallback(event => {
2447
2290
  event === null || event === void 0 ? void 0 : event.preventDefault();
2448
2291
  event === null || event === void 0 ? void 0 : event.stopPropagation();
2449
2292
  mutation.reset();
@@ -2477,7 +2320,7 @@ function TableRowActionsView({
2477
2320
  alignItems: "stretch",
2478
2321
  placeContent: "end",
2479
2322
  h: "full",
2480
- children: (_a = react.runIfFn(rowActions, item)) === null || _a === void 0 ? void 0 : _a.map((action, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
2323
+ children: (_a = react.runIfFn(rowActions, item)) === null || _a === void 0 ? void 0 : _a.map((action, index) => jsxRuntime.jsxs(React.Fragment, {
2481
2324
  children: [action.type === "publish" && jsxRuntime.jsx(TableRowPublishPostButton$1, {
2482
2325
  id: item.id,
2483
2326
  api: api,
@@ -2501,7 +2344,7 @@ function ActionButton(_a) {
2501
2344
  onClick
2502
2345
  } = _a,
2503
2346
  props = tslib.__rest(_a, ["onClick"]);
2504
- const handleClick = React__default["default"].useCallback(event => {
2347
+ const handleClick = React.useCallback(event => {
2505
2348
  event === null || event === void 0 ? void 0 : event.preventDefault();
2506
2349
  event === null || event === void 0 ? void 0 : event.stopPropagation();
2507
2350
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
@@ -2539,7 +2382,7 @@ function useTableProps(api, table, rowActions, queryParams) {
2539
2382
  columns: c
2540
2383
  } = table,
2541
2384
  props = tslib.__rest(table, ["onRowClick", "columns"]);
2542
- const onRowClickHandler = React__default["default"].useCallback(item => {
2385
+ const onRowClickHandler = React.useCallback(item => {
2543
2386
  var _a;
2544
2387
  const config = react.runIfFn(onRowClick, item);
2545
2388
  if (config) {
@@ -2562,7 +2405,7 @@ function useTableProps(api, table, rowActions, queryParams) {
2562
2405
  }
2563
2406
  }
2564
2407
  }, [navigate, onRowClick]);
2565
- const columns = React__default["default"].useMemo(() => {
2408
+ const columns = React.useMemo(() => {
2566
2409
  const columns = table.columns.concat([]);
2567
2410
  if (rowActions) {
2568
2411
  columns.push(createColumnHelper().display({
@@ -2687,7 +2530,7 @@ function TableButtonBar({
2687
2530
  api,
2688
2531
  children
2689
2532
  }) {
2690
- const createDialogFn = React__default["default"].useCallback(data => {
2533
+ const createDialogFn = React.useCallback(data => {
2691
2534
  return onClose => {
2692
2535
  var _a;
2693
2536
  const view = (_a = react.runIfFn(createView, data)) !== null && _a !== void 0 ? _a : react.runIfFn(editView, null);
@@ -2704,7 +2547,7 @@ function TableButtonBar({
2704
2547
  return jsxRuntime.jsxs(ButtonBar, {
2705
2548
  children: [jsxRuntime.jsx(RefreshButton, {
2706
2549
  queryKey: queryKey
2707
- }), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
2550
+ }), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React.Fragment, {
2708
2551
  children: [button.type === "create" && editView && jsxRuntime.jsx(TableCreateButton, {
2709
2552
  buildDialog: createDialogFn(button.data),
2710
2553
  icon: button.icon,
@@ -2723,7 +2566,7 @@ function TableWrapper({
2723
2566
  queryParams
2724
2567
  }) {
2725
2568
  const tableProps = useTableProps(api, table$1, rowActions, queryParams);
2726
- const _subtitle = React__default["default"].useMemo(() => {
2569
+ const _subtitle = React.useMemo(() => {
2727
2570
  if (!subtitle) return undefined;
2728
2571
  return data => {
2729
2572
  return jsxRuntime.jsx("div", {
@@ -2785,7 +2628,7 @@ function useQueries(queries) {
2785
2628
  function useInvalidate(queries) {
2786
2629
  const queryClient = reactQuery.useQueryClient();
2787
2630
  const params = reactRouterDom.useParams();
2788
- const invalidate = React__default["default"].useCallback(() => {
2631
+ const invalidate = React.useCallback(() => {
2789
2632
  const queryKeys = [];
2790
2633
  queries.forEach(q => {
2791
2634
  if (!q.queryField || !react.isFunction(q.api)) {
@@ -2968,7 +2811,7 @@ function NextMenuItem(_a) {
2968
2811
  const selected = path == "/" ? pathname == "/" : pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2969
2812
  const match = path == "/" ? pathname == "/" : pathname == (path.startsWith("/") ? path : `/${path}`);
2970
2813
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2971
- children: [jsxRuntime.jsxs(Link__default["default"], {
2814
+ children: [jsxRuntime.jsxs(Link, {
2972
2815
  href: path,
2973
2816
  style: {
2974
2817
  position: "relative"
@@ -3044,13 +2887,13 @@ function UserBlock({
3044
2887
  menuConfig,
3045
2888
  path
3046
2889
  }) {
3047
- var _a, _b, _c, _d;
2890
+ var _a, _b;
3048
2891
  const {
3049
2892
  isLoading,
3050
2893
  user
3051
2894
  } = auth.useSessionUser();
3052
2895
  const navigate = reactRouterDom.useNavigate();
3053
- const handleClick = React__default["default"].useCallback(() => navigate(path), [navigate, path]);
2896
+ const handleClick = React.useCallback(() => navigate(path), [navigate, path]);
3054
2897
  if (isLoading) return null;
3055
2898
  return jsxRuntime.jsxs("div", {
3056
2899
  dflex: true,
@@ -3072,7 +2915,7 @@ function UserBlock({
3072
2915
  }), jsxRuntime.jsx("span", {
3073
2916
  flexGrow: true,
3074
2917
  ms: "2",
3075
- children: `${capitalize((_d = (_c = user === null || user === void 0 ? void 0 : user.firstname) !== null && _c !== void 0 ? _c : user === null || user === void 0 ? void 0 : user.lastname) !== null && _d !== void 0 ? _d : "Jonathan")}`
2918
+ children: `${capitalize((user === null || user === void 0 ? void 0 : user.firstname) || (user === null || user === void 0 ? void 0 : user.lastname) || "")}`
3076
2919
  }), jsxRuntime.jsx(ui.IconButton, {
3077
2920
  variant: "borderless",
3078
2921
  corners: "pill",
@@ -3094,7 +2937,7 @@ function OverflowMenu({
3094
2937
  darkMode,
3095
2938
  menuConfig
3096
2939
  }) {
3097
- const [showPopup, setShowPopup] = React__default["default"].useState(false);
2940
+ const [showPopup, setShowPopup] = React.useState(false);
3098
2941
  const navigate = reactRouterDom.useNavigate();
3099
2942
  const logout = auth.useSessionLogout(false);
3100
2943
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -3152,7 +2995,7 @@ function MenuItem(_a) {
3152
2995
  children
3153
2996
  } = _a,
3154
2997
  props = tslib.__rest(_a, ["icon", "onClick", "children"]);
3155
- const handleClick = React__default["default"].useCallback(e => {
2998
+ const handleClick = React.useCallback(e => {
3156
2999
  e.preventDefault();
3157
3000
  e.stopPropagation();
3158
3001
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
@@ -3212,7 +3055,7 @@ function Sidebar(_a) {
3212
3055
  darkMode: darkMode
3213
3056
  }), jsxRuntime.jsx("h1", {
3214
3057
  textSize: "md",
3215
- children: title !== null && title !== void 0 ? title : env.AppEnv.appName()
3058
+ children: title || env.AppEnv.appName()
3216
3059
  })]
3217
3060
  }), jsxRuntime.jsx(Menu, {
3218
3061
  overflowY: "auto",
@@ -3239,7 +3082,7 @@ function Logo(_a) {
3239
3082
  } = _a,
3240
3083
  props = tslib.__rest(_a, ["width", "height", "darkMode"]);
3241
3084
  return jsxRuntime.jsx("div", Object.assign({}, props, {
3242
- children: jsxRuntime.jsx(Image__default["default"], {
3085
+ children: jsxRuntime.jsx(Image, {
3243
3086
  src: `/logo_${darkMode ? "light" : "dark"}.png`,
3244
3087
  alt: env.AppEnv.appName(),
3245
3088
  width: width,
@@ -3298,7 +3141,7 @@ function LeftPanel({
3298
3141
  userSettingsPath
3299
3142
  }) {
3300
3143
  const [isOpen, __, toggle] = hooks.useBoolean(true);
3301
- useHotkeys('ctrl+t', () => toggle(), [toggle]);
3144
+ fe('ctrl+t', () => toggle(), [toggle]);
3302
3145
  return jsxRuntime.jsxs("div", {
3303
3146
  ms: isOpen ? "0" : "-14.5rem",
3304
3147
  transition: "all",
@@ -3372,11 +3215,11 @@ function AttachDialog(_a) {
3372
3215
  refetch: refetchAll,
3373
3216
  error: errorAll
3374
3217
  } = api.useApiQuery(queryFetchAllKey, queryFetchAllFn);
3375
- const [selectedResources, setSelectedResources] = React__default["default"].useState([]);
3218
+ const [selectedResources, setSelectedResources] = React.useState([]);
3376
3219
  const isLoading = fetchLoading || fetchAllLoading;
3377
3220
  const isError = fetchError || fetchAllError;
3378
3221
  const mutation = api.useApiMutation(querySaveFn, queryKey, queryId);
3379
- const handleClick = React__default["default"].useCallback(event => {
3222
+ const handleClick = React.useCallback(event => {
3380
3223
  var _a;
3381
3224
  const id = (_a = event === null || event === void 0 ? void 0 : event.currentTarget.dataset.id) !== null && _a !== void 0 ? _a : "";
3382
3225
  const arr = selectedResources.concat([]);
@@ -3384,11 +3227,11 @@ function AttachDialog(_a) {
3384
3227
  if (i != -1) arr.splice(i, 1);else arr.push(id);
3385
3228
  setSelectedResources(arr);
3386
3229
  }, [selectedResources, setSelectedResources]);
3387
- const retry = React__default["default"].useCallback(() => {
3230
+ const retry = React.useCallback(() => {
3388
3231
  if (fetchError) refetch();
3389
3232
  if (fetchAllError) refetchAll();
3390
3233
  }, [refetch, refetchAll, fetchError, fetchAllError]);
3391
- const saveItem = React__default["default"].useCallback(() => {
3234
+ const saveItem = React.useCallback(() => {
3392
3235
  // Clear mutation error if any
3393
3236
  mutation.reset();
3394
3237
  mutation.mutateAsync({
@@ -3405,7 +3248,7 @@ function AttachDialog(_a) {
3405
3248
  if (onSaveError) onSaveError();else reactToastify.toast.error(`Error adding ${itemLabel}`);
3406
3249
  });
3407
3250
  }, [mutation, queryId, onSuccess, queryClient, onSaveError, onClose]);
3408
- const resources = React__default["default"].useMemo(() => {
3251
+ const resources = React.useMemo(() => {
3409
3252
  let r = [];
3410
3253
  if (attached && data) {
3411
3254
  r = [].concat(data);
@@ -3553,7 +3396,7 @@ function FormActionDialog(_a) {
3553
3396
  }, formikProps, {
3554
3397
  children: [jsxRuntime.jsxs(ui.Modal.Body, {
3555
3398
  pb: "6",
3556
- children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
3399
+ children: [/*#__PURE__*/React.isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
3557
3400
  form: form$1
3558
3401
  })]
3559
3402
  }), jsxRuntime.jsxs(ui.Modal.Footer, {
@@ -3588,7 +3431,7 @@ function PageSectionTitle(_a) {
3588
3431
  }));
3589
3432
  }
3590
3433
 
3591
- const PageStateContainer = /*#__PURE__*/React__default["default"].forwardRef((_a, ref) => {
3434
+ const PageStateContainer = /*#__PURE__*/React.forwardRef((_a, ref) => {
3592
3435
  var {
3593
3436
  loading = false,
3594
3437
  children
@@ -3687,7 +3530,7 @@ function TableRowViewButton(_a) {
3687
3530
  path
3688
3531
  } = _a,
3689
3532
  props = tslib.__rest(_a, ["path"]);
3690
- const openPage = React__default["default"].useCallback(event => {
3533
+ const openPage = React.useCallback(event => {
3691
3534
  event === null || event === void 0 ? void 0 : event.preventDefault();
3692
3535
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3693
3536
  window.open(`${env.AppEnv.websiteUrl()}/${path}`, '_blank');
@@ -3704,7 +3547,7 @@ function TableRowNavigateButton(_a) {
3704
3547
  } = _a,
3705
3548
  props = tslib.__rest(_a, ["path"]);
3706
3549
  const navigate = reactRouterDom.useNavigate();
3707
- const handleClick = React__default["default"].useCallback(event => {
3550
+ const handleClick = React.useCallback(event => {
3708
3551
  event === null || event === void 0 ? void 0 : event.preventDefault();
3709
3552
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3710
3553
  navigate(`${path}`);
@@ -3803,7 +3646,7 @@ function TableRowPublishPostButton(_a) {
3803
3646
  const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
3804
3647
  networkMode: "always"
3805
3648
  });
3806
- const publish = React__default["default"].useCallback(event => {
3649
+ const publish = React.useCallback(event => {
3807
3650
  event === null || event === void 0 ? void 0 : event.preventDefault();
3808
3651
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3809
3652
  mutation.reset();