@apia/components 4.0.40 → 4.0.42

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/dist/index.js CHANGED
@@ -4,10 +4,10 @@ import React__default, { createContext, useContext, useEffect, useMemo, useState
4
4
  import parse, { domToReact, Element } from 'html-react-parser';
5
5
  import { Spinner as Spinner$1, Box as Box$1 } from 'theme-ui';
6
6
  import { uniqueId as uniqueId$3, cloneDeep, isFunction } from 'lodash-es';
7
- import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Progress, Label as Label$1, Paragraph, Container, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
7
+ import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Paragraph, Label as Label$1, Container, Progress, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
8
8
  import { BarLoader } from 'react-spinners';
9
9
  import uniqueId$2 from 'lodash-es/uniqueId';
10
- import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, isChild, useUnmount, StatefulEmitter, shallowEqual as shallowEqual$1, getSpecificParent, getDateFormat, customEvents, uniqueId as uniqueId$4, decodeBase64ToUtf8, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, useMatchScrollDirection, arrayOrArray } from '@apia/util';
10
+ import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, getLabel, isChild, EventEmitter, useUnmount, useMount, StatefulEmitter, shallowEqual as shallowEqual$1, getSpecificParent, getDateFormat, customEvents, decodeBase64ToUtf8, uniqueId as uniqueId$4, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, useMatchScrollDirection, arrayOrArray } from '@apia/util';
11
11
  import usePortal from 'react-cool-portal';
12
12
  import { CSSTransition } from 'react-transition-group';
13
13
  import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
@@ -425,7 +425,9 @@ function useModal(configuration) {
425
425
  });
426
426
  const hide = React__default.useCallback(() => {
427
427
  setIsOpen(false);
428
- }, []);
428
+ if (configuration?.onClose)
429
+ configuration.onClose();
430
+ }, [configuration]);
429
431
  const show = React__default.useCallback(() => {
430
432
  if (configuration?.preFetcher) {
431
433
  setIsLoading(true);
@@ -457,8 +459,7 @@ function useModal(configuration) {
457
459
  if (configuration?.onOpen)
458
460
  configuration.onOpen();
459
461
  showPortal();
460
- } else
461
- onClose?.();
462
+ }
462
463
  }, [isOpen]);
463
464
  return {
464
465
  hide,
@@ -1443,7 +1444,7 @@ var __privateWrapper$2 = (obj, member, setter, getter) => ({
1443
1444
  return __privateGet$9(obj, member, getter);
1444
1445
  }
1445
1446
  });
1446
- var _emitter$4, _maxId$1, _maxOverlay, _useModalsList;
1447
+ var _maxId$1, _maxOverlay;
1447
1448
  class ApiaUtilModalHandler {
1448
1449
  constructor(close) {
1449
1450
  this.close = close;
@@ -1452,54 +1453,12 @@ class ApiaUtilModalHandler {
1452
1453
  class ApiaUtilModals {
1453
1454
  constructor() {
1454
1455
  __publicField$q(this, "overlays", []);
1455
- __privateAdd$c(this, _emitter$4, new EventEmitter());
1456
+ __publicField$q(this, "modals", []);
1456
1457
  __privateAdd$c(this, _maxId$1, 0);
1457
1458
  __privateAdd$c(this, _maxOverlay, 0);
1458
- __privateAdd$c(this, _useModalsList, () => {
1459
- const [modals, setModals] = useState(
1460
- []
1461
- );
1462
- useMount(() => {
1463
- const u1 = __privateGet$9(this, _emitter$4).on("open", (ev) => {
1464
- setModals((current) => [
1465
- ...current,
1466
- {
1467
- ...ev,
1468
- isOpen: true,
1469
- onClose: ev.onClose,
1470
- onExited: () => {
1471
- ev.onExited?.();
1472
- setModals(
1473
- (current2) => current2.filter((modal) => modal.id !== ev.id)
1474
- );
1475
- }
1476
- }
1477
- ]);
1478
- });
1479
- const u2 = __privateGet$9(this, _emitter$4).on("closeAll", () => {
1480
- setModals(
1481
- (current) => current.map((modal) => ({ ...modal, isOpen: false }))
1482
- );
1483
- });
1484
- const u3 = __privateGet$9(this, _emitter$4).on("close", (modalId) => {
1485
- setModals(
1486
- (current) => current.map(
1487
- (modal) => modal.id === modalId ? { ...modal, isOpen: false } : modal
1488
- )
1489
- );
1490
- });
1491
- return () => {
1492
- u1();
1493
- u2();
1494
- u3();
1495
- };
1496
- });
1497
- return modals;
1498
- });
1499
1459
  __publicField$q(this, "Component", observer(() => {
1500
- const modals = __privateGet$9(this, _useModalsList).call(this);
1501
1460
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1502
- modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)),
1461
+ this.modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)),
1503
1462
  this.overlays.map((c) => c.render)
1504
1463
  ] });
1505
1464
  }));
@@ -1508,17 +1467,27 @@ class ApiaUtilModals {
1508
1467
  this.open(cevent.detail);
1509
1468
  });
1510
1469
  makeObservable(this, {
1511
- overlays: observable
1470
+ overlays: observable,
1471
+ modals: observable
1512
1472
  });
1513
1473
  }
1514
1474
  close(id) {
1515
- __privateGet$9(this, _emitter$4).emit("close", id);
1475
+ this.modals = this.modals.filter((s) => s.id !== id);
1516
1476
  }
1517
1477
  open(props) {
1518
1478
  const id = props.id ?? `modal_${__privateWrapper$2(this, _maxId$1)._++}`;
1519
- __privateGet$9(this, _emitter$4).emit("open", { ...props, id });
1479
+ this.modals.push({
1480
+ ...props,
1481
+ id,
1482
+ isOpen: true,
1483
+ onClose: props.onClose,
1484
+ onExited: () => {
1485
+ props.onExited?.();
1486
+ this.close(id);
1487
+ }
1488
+ });
1520
1489
  return new ApiaUtilModalHandler(() => {
1521
- __privateGet$9(this, _emitter$4).emit("close", id);
1490
+ this.close(id);
1522
1491
  });
1523
1492
  }
1524
1493
  /**
@@ -1560,10 +1529,8 @@ class ApiaUtilModals {
1560
1529
  };
1561
1530
  }
1562
1531
  }
1563
- _emitter$4 = new WeakMap();
1564
1532
  _maxId$1 = new WeakMap();
1565
1533
  _maxOverlay = new WeakMap();
1566
- _useModalsList = new WeakMap();
1567
1534
 
1568
1535
  var __defProp$p = Object.defineProperty;
1569
1536
  var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -1933,6 +1900,7 @@ const ConfirmModal = ({
1933
1900
  onConfirm,
1934
1901
  onCancel,
1935
1902
  title,
1903
+ size,
1936
1904
  ...props
1937
1905
  }) => {
1938
1906
  const hasConfirmed = useRef(false);
@@ -1961,6 +1929,7 @@ const ConfirmModal = ({
1961
1929
  []
1962
1930
  ),
1963
1931
  title,
1932
+ size,
1964
1933
  children: /* @__PURE__ */ jsx(Confirm, { ...props, onCancel: handleCancel, onConfirm: handleConfirm })
1965
1934
  }
1966
1935
  );
@@ -2003,7 +1972,7 @@ const AlertModal = ({ children, onClose, title }) => {
2003
1972
  var __defProp$o = Object.defineProperty;
2004
1973
  var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2005
1974
  var __publicField$o = (obj, key, value) => {
2006
- __defNormalProp$o(obj, key + "" , value);
1975
+ __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
2007
1976
  return value;
2008
1977
  };
2009
1978
  var __accessCheck$b = (obj, member, msg) => {
@@ -2032,40 +2001,23 @@ var __privateWrapper$1 = (obj, member, setter, getter) => ({
2032
2001
  return __privateGet$8(obj, member, getter);
2033
2002
  }
2034
2003
  });
2035
- var _emitter$3, _maxIdAlert, _maxIdConfirm;
2004
+ var _maxIdAlert, _maxIdConfirm;
2036
2005
  class ApiaUtilDialogs {
2037
2006
  constructor() {
2038
- __privateAdd$b(this, _emitter$3, new EventEmitter());
2039
2007
  __privateAdd$b(this, _maxIdAlert, 0);
2040
2008
  __privateAdd$b(this, _maxIdConfirm, 0);
2041
- __publicField$o(this, "Component", () => {
2042
- const [confirmDialogs, setConfirmDialogs] = useState([]);
2043
- const [alertsDialogs, setAlertsDialogs] = useState(
2044
- []
2045
- );
2046
- useMount(() => {
2047
- const unsuscribe1 = __privateGet$8(this, _emitter$3).on("alert", (ev) => {
2048
- setAlertsDialogs((current) => [...current, ev]);
2049
- });
2050
- const unsuscribe2 = __privateGet$8(this, _emitter$3).on("confirm", (ev) => {
2051
- setConfirmDialogs((current) => [...current, ev]);
2052
- });
2053
- return () => {
2054
- unsuscribe1();
2055
- unsuscribe2();
2056
- };
2057
- });
2009
+ __publicField$o(this, "alerts", []);
2010
+ __publicField$o(this, "dialogs", []);
2011
+ __publicField$o(this, "Component", observer(() => {
2058
2012
  const removeModal = useCallback(
2059
2013
  (which) => {
2060
- setConfirmDialogs(
2061
- (current) => current.filter((search) => search !== which)
2062
- );
2014
+ this.dialogs = this.dialogs.filter((search) => search !== which);
2063
2015
  },
2064
2016
  []
2065
2017
  );
2066
2018
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2067
- alertsDialogs.map((current) => /* @__PURE__ */ createElement(AlertModal, { ...current, key: current.id })),
2068
- confirmDialogs.map((current) => /* @__PURE__ */ createElement(
2019
+ this.alerts.map((current) => /* @__PURE__ */ createElement(AlertModal, { ...current, key: current.id })),
2020
+ this.dialogs.map((current) => /* @__PURE__ */ createElement(
2069
2021
  ConfirmModal,
2070
2022
  {
2071
2023
  ...current,
@@ -2081,11 +2033,12 @@ class ApiaUtilDialogs {
2081
2033
  }
2082
2034
  ))
2083
2035
  ] });
2084
- });
2036
+ }));
2037
+ makeAutoObservable(this);
2085
2038
  }
2086
2039
  alert(props) {
2087
2040
  return new Promise((resolve) => {
2088
- __privateGet$8(this, _emitter$3).emit("alert", {
2041
+ this.alerts.push({
2089
2042
  ...props,
2090
2043
  onClose: () => resolve(),
2091
2044
  id: `confirm${__privateWrapper$1(this, _maxIdAlert)._++}`
@@ -2094,7 +2047,7 @@ class ApiaUtilDialogs {
2094
2047
  }
2095
2048
  confirm(props) {
2096
2049
  return new Promise((resolve) => {
2097
- __privateGet$8(this, _emitter$3).emit("confirm", {
2050
+ this.dialogs.push({
2098
2051
  ...props,
2099
2052
  id: `confirm${__privateWrapper$1(this, _maxIdConfirm)._++}`,
2100
2053
  onCancel: () => resolve(false),
@@ -2103,7 +2056,6 @@ class ApiaUtilDialogs {
2103
2056
  });
2104
2057
  }
2105
2058
  }
2106
- _emitter$3 = new WeakMap();
2107
2059
  _maxIdAlert = new WeakMap();
2108
2060
  _maxIdConfirm = new WeakMap();
2109
2061
 
@@ -5278,740 +5230,308 @@ const LabelBox = ({
5278
5230
  );
5279
5231
  };
5280
5232
 
5281
- var __defProp$f = Object.defineProperty;
5282
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5283
- var __publicField$f = (obj, key, value) => {
5284
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
5285
- return value;
5286
- };
5287
- let maxId = 0;
5288
- class ChatMessage {
5289
- constructor(message = "", messageType = "user", attachments = [], reference = null) {
5290
- this.message = message;
5291
- this.messageType = messageType;
5292
- this.attachments = attachments;
5293
- this.reference = reference;
5294
- __publicField$f(this, "id");
5295
- __publicField$f(this, "clone", () => new ChatMessage(
5296
- this.message,
5297
- this.messageType,
5298
- this.attachments.map((x) => {
5299
- return { ...x };
5300
- }),
5301
- this.reference
5302
- ));
5303
- this.id = maxId++;
5304
- if (messageType === "response")
5305
- this.messageType = "system";
5306
- if (typeof message === "string")
5307
- this.message = message;
5308
- makeObservable(this, {
5309
- attachments: observable,
5310
- message: observable,
5311
- messageType: observable,
5312
- reference: observable
5233
+ function importComponent(path) {
5234
+ return lazy(() => {
5235
+ return new Promise((resolve) => {
5236
+ import(
5237
+ /* webpackInclude: /\.tsx?$/ */
5238
+ `/customComponents/${path}`
5239
+ ).then((result) => {
5240
+ if (result?.default?.default)
5241
+ resolve(result.default);
5242
+ else if (result?.default)
5243
+ resolve(result);
5244
+ else
5245
+ resolve({
5246
+ default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
5247
+ });
5248
+ }).catch((error) => {
5249
+ resolve({
5250
+ default: () => {
5251
+ console.error(error);
5252
+ return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
5253
+ }
5254
+ });
5255
+ });
5313
5256
  });
5314
- }
5315
- removeAttachment(attachment) {
5316
- this.attachments = this.attachments.filter(
5317
- (current) => current !== attachment
5318
- );
5319
- }
5320
- addAttachmentDescription(attachment, description) {
5321
- const a = this.attachments.find((current) => current === attachment);
5322
- if (a) {
5323
- a.description = description;
5324
- }
5325
- }
5257
+ });
5326
5258
  }
5327
5259
 
5328
- const AutoscrollContainer = ({ children, threshold = 150, className }) => {
5329
- const wrapperRef = useRef(null);
5330
- const autoScrollEnabled = useRef(true);
5331
- useEffect(() => {
5332
- const wrapper = wrapperRef.current;
5333
- if (!wrapper)
5334
- return;
5335
- const scrollEl = findScrollContainer(wrapper);
5336
- const isNearBottom = () => scrollEl.scrollHeight - (scrollEl.scrollTop + scrollEl.clientHeight) <= threshold;
5337
- const onWheel = (e) => {
5338
- if (e.deltaY < 0) {
5339
- autoScrollEnabled.current = false;
5340
- } else if (e.deltaY > 0 && isNearBottom()) {
5341
- autoScrollEnabled.current = true;
5342
- }
5343
- };
5344
- const onScroll = () => {
5345
- if (isNearBottom()) {
5346
- autoScrollEnabled.current = true;
5347
- }
5348
- };
5349
- function enable() {
5350
- autoScrollEnabled.current = true;
5351
- }
5352
- scrollEl.addEventListener("wheel", onWheel, { passive: true });
5353
- scrollEl.addEventListener("scroll", onScroll, { passive: true });
5354
- document.addEventListener("enableAutoScroll", enable);
5355
- scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
5356
- const mo = new MutationObserver(() => {
5357
- if (autoScrollEnabled.current) {
5358
- scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
5359
- }
5360
- });
5361
- mo.observe(wrapper, { childList: true, subtree: true });
5362
- return () => {
5363
- scrollEl.removeEventListener("wheel", onWheel);
5364
- scrollEl.removeEventListener("enableAutoScroll", enable);
5365
- scrollEl.removeEventListener("scroll", onScroll);
5366
- mo.disconnect();
5367
- };
5368
- }, [threshold]);
5369
- return /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: `${className || ""} autoscrollContainer`, children });
5260
+ const MessageBlock = ({
5261
+ componentData
5262
+ }) => {
5263
+ if (typeof componentData.args === "string") {
5264
+ componentData.args = JSON.parse(componentData.args);
5265
+ }
5266
+ const Component = importComponent(componentData.path);
5267
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...componentData.args }) });
5370
5268
  };
5269
+ var MessageBlock$1 = memo(MessageBlock);
5371
5270
 
5372
- const FileCard = forwardRef(
5373
- ({
5374
- name,
5375
- iconsSize,
5376
- additionalButtons,
5377
- className,
5378
- sx,
5379
- width = "fit-content",
5380
- handleClose,
5381
- onDoubleClick,
5382
- onClick,
5383
- onDropFiles
5384
- }, ref) => {
5385
- const [isDragOver, setIsDragOver] = useState(false);
5386
- return /* @__PURE__ */ createElement(
5387
- Box,
5388
- {
5389
- ...getVariant("layout.common.components.fileCard"),
5390
- sx: {
5391
- ...sx,
5392
- width,
5393
- ...isDragOver && onDropFiles ? {
5394
- border: "2px dashed #1976d2!important",
5395
- backgroundColor: "#f5faff!important"
5396
- } : {}
5397
- },
5398
- ref,
5399
- key: name,
5400
- className: `fileCard ${className ?? ""}`,
5401
- onDoubleClick,
5402
- onClick,
5403
- title: name,
5404
- tabIndex: 0,
5405
- onDragOver: (e) => {
5406
- e.preventDefault();
5407
- e.stopPropagation();
5408
- setIsDragOver(true);
5409
- },
5410
- onDragLeave: (e) => {
5411
- e.preventDefault();
5412
- e.stopPropagation();
5413
- setIsDragOver(false);
5414
- },
5415
- onDrop: (e) => {
5416
- e.preventDefault();
5417
- e.stopPropagation();
5418
- setIsDragOver(false);
5419
- if (onDropFiles && e.dataTransfer?.files?.length) {
5420
- const files = Array.from(e.dataTransfer.files);
5421
- onDropFiles(files);
5422
- }
5423
- }
5424
- },
5425
- /* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
5426
- /* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
5427
- /* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
5428
- ] }),
5429
- /* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
5430
- return /* @__PURE__ */ jsx(
5431
- IconButton,
5271
+ const AttributeParsers = [
5272
+ /**
5273
+ * Allows to pass javascript event handlers through the format
5274
+ * onEventDispatched, the main difficulty is that the html parser returns the
5275
+ * attributes with lowercase, that's why any attribute of the type
5276
+ * onEventDispatched will be passed to the component as onEventdispatched
5277
+ * (note the lowercase 'd').
5278
+ */
5279
+ {
5280
+ match: /^(?:data-)?on(.*)$/i,
5281
+ parse([, originalAction], value) {
5282
+ if (value.match(/^__contextMethod/))
5283
+ return [
5432
5284
  {
5433
- iconSize: "Md",
5434
- ...c,
5435
- className: `fileCard__additionalButton ${c.className ?? ""}`
5285
+ newName: `on${originalAction[0].toUpperCase()}${originalAction.slice(
5286
+ 1
5287
+ )}`,
5288
+ newValue: value
5436
5289
  }
5437
- );
5438
- }) }),
5439
- handleClose && /* @__PURE__ */ jsx(
5440
- Close,
5290
+ ];
5291
+ let newName = `on${originalAction.charAt(0).toUpperCase()}${originalAction.slice(1)}`;
5292
+ const composedEvent = originalAction.match(/^(mouse|key|double)(.*)$/i);
5293
+ if (composedEvent) {
5294
+ newName = `on${composedEvent[1].charAt(0).toUpperCase()}${composedEvent[1].slice(1)}${composedEvent[2].charAt(0).toUpperCase()}${composedEvent[2].slice(1)}`;
5295
+ }
5296
+ return [
5441
5297
  {
5442
- type: "button",
5443
- className: "fileCard__delete",
5444
- onClick: (e) => {
5445
- e.stopPropagation();
5446
- e.preventDefault();
5447
- handleClose(name);
5298
+ newName,
5299
+ newValue: (ev) => {
5300
+ const evalString = value.replace(/return [^;\n\r]+/, "");
5301
+ const f = eval(evalString);
5302
+ f(ev);
5448
5303
  }
5449
5304
  }
5450
- )
5451
- );
5452
- }
5453
- );
5454
-
5455
- const Dropzone = ({
5456
- sx,
5457
- className,
5458
- messageError,
5459
- progress = 0,
5460
- defaultLabel = getLabel("btnUploadClass").text,
5461
- draggingLabel = getLabel("lblDroping").text,
5462
- onClick,
5463
- onChange,
5464
- handleInfoButton
5465
- }) => {
5466
- const innerSx = messageError ? { borderLeft: "2px solid", borderColor: "danger" } : {};
5467
- const fileInputRef = useRef(null);
5468
- const handleClick = (ev) => {
5469
- onClick?.(ev);
5470
- if (!ev.defaultPrevented) {
5471
- fileInputRef.current?.click();
5305
+ ];
5472
5306
  }
5473
- };
5474
- const handleDragOver = (e) => {
5475
- e.preventDefault();
5476
- };
5477
- const [isDragging, setIsDragging] = useState(false);
5478
- const handleDragStart = (_e) => {
5479
- setIsDragging(true);
5480
- };
5481
- const handleDragLeave = (e) => {
5482
- e.preventDefault();
5483
- setIsDragging(false);
5484
- };
5485
- return /* @__PURE__ */ jsxs(
5486
- Box,
5487
- {
5488
- ...getVariant("layout.execution.components.uploader.dropzone"),
5489
- className: "dropzone__container",
5490
- children: [
5491
- /* @__PURE__ */ jsxs(
5492
- Box,
5307
+ },
5308
+ {
5309
+ /**
5310
+ * Allows to pass style objects as JSON strings
5311
+ */
5312
+ match: /^data-style$/,
5313
+ parse(_match, value2) {
5314
+ try {
5315
+ return [{ newName: "style", newValue: JSON.parse(value2) }];
5316
+ } catch (e) {
5317
+ console.error({ value: value2, e });
5318
+ }
5319
+ return null;
5320
+ }
5321
+ },
5322
+ {
5323
+ /**
5324
+ * Allows conditional rendering of a component
5325
+ */
5326
+ match: /^data-render$/,
5327
+ parse(_match, originalValue) {
5328
+ if (originalValue !== "" && !JSON.parse(originalValue)) {
5329
+ throw new Command("COMMAND: PREVENT_RENDERING");
5330
+ }
5331
+ return [
5332
+ {
5333
+ newName: "data-render",
5334
+ newValue: void 0
5335
+ }
5336
+ ];
5337
+ }
5338
+ },
5339
+ {
5340
+ /**
5341
+ * Allow to pass json data as property to the components
5342
+ */
5343
+ match: /^data-json-([a-zA-Z][\w_]*)$/,
5344
+ parse: ([, name], originalValue) => {
5345
+ try {
5346
+ return [
5493
5347
  {
5494
- tabIndex: 0,
5495
- sx: { ...innerSx, sx },
5496
- className: `dropzone ${className ?? ""}`,
5497
- onClick: handleClick,
5498
- onKeyDown: (ev) => {
5499
- if (ev.code === "Enter" || ev.code === "Space") {
5500
- handleClick(ev);
5501
- }
5502
- },
5503
- onDrop: (e) => {
5504
- e.preventDefault();
5505
- const newFiles = Array.from(e.dataTransfer.files);
5506
- setIsDragging(false);
5507
- onChange?.(newFiles);
5508
- },
5509
- onDragEnter: handleDragStart,
5510
- onDragLeave: handleDragLeave,
5511
- onDragOver: handleDragOver,
5512
- children: [
5513
- progress > 0 && progress < 100 && /* @__PURE__ */ jsx(Progress, { max: 100, value: progress, className: "progressBar" }),
5514
- messageError ? /* @__PURE__ */ jsx(Box, { color: "danger", children: messageError }) : isDragging ? draggingLabel : defaultLabel,
5515
- /* @__PURE__ */ jsx(
5516
- "input",
5517
- {
5518
- multiple: true,
5519
- type: "file",
5520
- ref: fileInputRef,
5521
- style: { display: "none" },
5522
- onChange: (e) => {
5523
- e.preventDefault();
5524
- if (e.target.files) {
5525
- const newFiles = Array.from([...e.target.files]);
5526
- onChange?.(newFiles);
5527
- e.target.value = "";
5528
- }
5529
- }
5530
- }
5531
- )
5532
- ]
5348
+ newName: name,
5349
+ newValue: JSON.parse(originalValue)
5533
5350
  }
5534
- ),
5535
- handleInfoButton && /* @__PURE__ */ jsx(
5536
- IconButton,
5351
+ ];
5352
+ } catch (e) {
5353
+ console.info(`Prop: ${name}, originalValue: ${originalValue}`);
5354
+ console.error(e);
5355
+ return null;
5356
+ }
5357
+ }
5358
+ },
5359
+ {
5360
+ match: /^data(?:-dom)?-variant$/,
5361
+ parse(_, newValue) {
5362
+ return [
5363
+ { newName: "data-variant", newValue },
5364
+ { newName: "variant", newValue }
5365
+ ];
5366
+ }
5367
+ },
5368
+ {
5369
+ match: /^data-dom-([a-zA-Z][\w_]*)/i,
5370
+ parse([, name], newValue) {
5371
+ return [{ newName: `data-${name}`, newValue }];
5372
+ }
5373
+ },
5374
+ {
5375
+ /**
5376
+ * Change all the attributes whose name matches with data-(name) to just
5377
+ * name
5378
+ */
5379
+ match: /^data-([a-zA-Z][\w_]*)$/,
5380
+ parse: ([, newName2], newValue) => [{ newName: newName2, newValue }]
5381
+ },
5382
+ /**
5383
+ * Allows to pass conditional data to a component. It accepts as value a JSON
5384
+ * string with the following structure:
5385
+ *
5386
+ * data-condition-NAME_OF_ATTRIBUTE=`
5387
+ * {
5388
+ * "condition": CONDITION,
5389
+ * "NAME_OF_ATTRIBUTE": VALUE_TO_PASS_TO_THE_COMPONENT
5390
+ * }
5391
+ *
5392
+ * Where:
5393
+ * - NAME_OF_ATTRIBUTE can be anything you want, the only limitations are
5394
+ * the attribute names limitations. - CONDITION will be evaluated with a
5395
+ * ternary conditional, if it parses to true the value will be passed or
5396
+ * hidden elsewhere - VALUE_TO_PASS_TO_THE_COMPONENT Since all the attribute
5397
+ * will be parsed with JSON, the value to pass can be anything that
5398
+ * can be parsed this way.
5399
+ */
5400
+ {
5401
+ match: /^data-condition-([a-zA-Z][\w_]*)$/,
5402
+ parse: ([, newName2], value2) => {
5403
+ try {
5404
+ const parsedValue = JSON.parse(value2);
5405
+ return [
5537
5406
  {
5538
- className: "info",
5539
- iconSize: "Sm",
5540
- icon: "Info",
5541
- onMouseEnter: handleInfoButton,
5542
- onClick: handleClick
5407
+ newName: newName2,
5408
+ newValue: parsedValue.condition ? parsedValue[newName2] : void 0
5543
5409
  }
5544
- )
5545
- ]
5410
+ ];
5411
+ } catch (e) {
5412
+ console.error(e);
5413
+ }
5414
+ return null;
5546
5415
  }
5547
- );
5548
- };
5416
+ },
5417
+ {
5418
+ match: /^tabindex/i,
5419
+ parse(_, newValue) {
5420
+ return [{ newName: "tabIndex", newValue }];
5421
+ }
5422
+ }
5423
+ ];
5549
5424
 
5550
- var __defProp$e = Object.defineProperty;
5551
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5552
- var __publicField$e = (obj, key, value) => {
5553
- __defNormalProp$e(obj, key + "" , value);
5554
- return value;
5425
+ const PathShortcuts = {};
5426
+
5427
+ const AttributeFilters = ["data-template", "data-component", "style"];
5428
+
5429
+ const AttributeReplacers = {
5430
+ // Common html props
5431
+ class: "className",
5432
+ colspan: "colSpan",
5433
+ for: "htmlFor",
5434
+ readonly: "readOnly",
5435
+ autocomplete: "autoComplete",
5436
+ // Chart button
5437
+ chartid: "chartId",
5438
+ // Dynamic button
5439
+ apiaprops: "apiaProps",
5440
+ // Profiles props
5441
+ // Users administration
5442
+ isglobal: "isGlobal",
5443
+ iscreate: "isCreate",
5444
+ ldapfull: "ldapFull",
5445
+ passwordprops: "passwordProps",
5446
+ // Validation fields
5447
+ initialvalue: "initialValue",
5448
+ submitvalueparser: "submitValueParser",
5449
+ validationclass: "validationClass",
5450
+ validationfunction: "validationFunction",
5451
+ validationrules: "validationRules",
5452
+ allowpickbeforetoday: "allowPickBeforeToday",
5453
+ evtmetafilters: "evtMetaFilters",
5454
+ trafreemetafilters: "traFreeMetaFilters",
5455
+ // Documents info modal
5456
+ allowdownload: "allowDownload",
5457
+ // Documents upload modal
5458
+ allowpickfromdirectories: "allowPickFromDirectories",
5459
+ allowpickfrommonitor: "allowPickFromMonitor",
5460
+ // Document Info modal
5461
+ frommonitor: "fromMonitor",
5462
+ showhistory: "showHistory",
5463
+ showdownloadinfo: "showDownloadInfo",
5464
+ showpermissions: "showPermissions",
5465
+ // LangPicker
5466
+ currentlang: "currentLang",
5467
+ // Change Dates Modal
5468
+ dateinputname: "dateInputName",
5469
+ initiallyexpanded: "initiallyExpanded",
5470
+ buttonsactions: "buttonsActions",
5471
+ // Reports
5472
+ reportname: "reportName"
5555
5473
  };
5556
- class UploadHandler {
5557
- constructor(props) {
5558
- this.props = props;
5559
- __publicField$e(this, "state", { inProgressFiles: [], uploadedFiles: [] });
5560
- makeAutoObservable(this);
5561
- this.state.uploadedFiles = this.props.initialFiles;
5562
- }
5563
- delete(file) {
5564
- this.props.onDelete(file).then((res) => {
5565
- if (res === true) {
5566
- this.state.uploadedFiles = this.state.uploadedFiles.filter(
5567
- (c) => c !== file
5568
- );
5569
- } else if (typeof res === "string") {
5570
- ApiaUtil.instance.notifications.notify({
5571
- message: res
5572
- });
5573
- }
5574
- });
5575
- }
5576
- start(files) {
5577
- files.forEach((file) => {
5578
- const newUpload = {
5579
- abortController: new AbortController(),
5580
- id: uniqueId$4("file_upload"),
5581
- file,
5582
- progress: 0
5583
- };
5584
- this.state.inProgressFiles.push(newUpload);
5585
- this.props.onUpload(newUpload).then((res) => {
5586
- this.state.inProgressFiles = this.state.inProgressFiles.filter(
5587
- (c) => c.id !== newUpload.id
5588
- );
5589
- if (typeof res === "string") {
5590
- ApiaUtil.instance.notifications.notify({
5591
- message: res,
5592
- icon: ""
5593
- });
5594
- } else if (res) {
5595
- this.state.uploadedFiles.push(res);
5596
- }
5597
- });
5598
- });
5599
- }
5600
- }
5601
- const Uploader = observer(({ handler }) => {
5602
- return /* @__PURE__ */ jsxs(Box, { className: "file_uploader", children: [
5603
- /* @__PURE__ */ jsx(Box, { className: "file_uploader__dropzone", children: (handler.props.isMultiple || handler.state.uploadedFiles.length === 0 && handler.state.inProgressFiles.length === 0) && /* @__PURE__ */ jsx(
5604
- Dropzone,
5605
- {
5606
- onChange: (ev) => {
5607
- handler.start(ev);
5608
- }
5609
- }
5610
- ) }),
5611
- /* @__PURE__ */ jsx(Box, { className: "file_uploader__in_progress", children: handler.state.inProgressFiles.map((c) => /* @__PURE__ */ jsx(
5612
- Dropzone,
5613
- {
5614
- progress: c.progress,
5615
- messageError: c.error
5616
- },
5617
- c.file.name
5618
- )) }),
5619
- /* @__PURE__ */ jsx(Box, { className: "file_uploader__files_list", children: handler.state.uploadedFiles.map((c) => /* @__PURE__ */ jsx(
5620
- FileCard,
5621
- {
5622
- name: c.name,
5623
- handleClose: () => handler.delete(c)
5624
- },
5625
- c.id
5626
- )) })
5627
- ] });
5628
- });
5629
5474
 
5630
- const FileAttachment = observer(
5631
- ({
5632
- attachment,
5633
- onAddDescription,
5634
- onRemove
5635
- }) => {
5636
- const { ref } = ApiaUtil.instance.tooltips.useHover({
5637
- preferredOrientationX: "left",
5638
- preferredOrientationY: "top",
5639
- minSize: {
5640
- width: 200,
5641
- height: 400
5642
- },
5643
- attachToMousePosition: true,
5644
- closeOnMouseLeaveAttachedElement: true,
5645
- children: /* @__PURE__ */ jsxs(
5646
- Box,
5647
- {
5648
- sx: {
5649
- display: "flex",
5650
- alignItems: "center",
5651
- flexDirection: "column"
5652
- },
5653
- children: [
5654
- /* @__PURE__ */ jsx("h1", { children: attachment.name }),
5655
- /* @__PURE__ */ jsx("img", { src: attachment.base64 }),
5656
- attachment.description && /* @__PURE__ */ jsx(Label$1, { children: attachment.description })
5657
- ]
5658
- }
5659
- )
5660
- });
5661
- return /* @__PURE__ */ jsx(
5662
- FileCard,
5663
- {
5664
- ref,
5665
- name: attachment.name,
5666
- handleClose: onRemove,
5667
- additionalButtons: onAddDescription ? [
5668
- {
5669
- icon: "Pencil",
5670
- onClick: () => {
5671
- const collector = new Collector();
5672
- collector.add(
5673
- new collector.fields.textarea(
5674
- "desc",
5675
- getLabel("lblDesc").text,
5676
- { initialValue: attachment.description }
5677
- )
5678
- );
5679
- collector.show({
5680
- onConfirm: (ev) => {
5681
- if (ev) {
5682
- onAddDescription(attachment, ev.desc);
5683
- }
5684
- return true;
5685
- }
5686
- });
5687
- },
5688
- variant: "icon-only"
5689
- }
5690
- ] : []
5691
- }
5692
- );
5475
+ const ComplexReplacements = [
5476
+ (domNode, _, customOptions, commentsData) => {
5477
+ if (domNode.attribs["data-prevent-parse"] && domNode.attribs["data-prevent-parse"].trim() === "true") {
5478
+ return null;
5479
+ }
5480
+ if (domNode.attributes.find((current) => current.name === "data-fragment")) {
5481
+ const children = domToReact(
5482
+ cloneDeep(domNode.children),
5483
+ parseOptions(customOptions, commentsData)
5484
+ );
5485
+ return /* @__PURE__ */ jsx(Fragment, { children });
5486
+ }
5487
+ return false;
5693
5488
  }
5694
- );
5489
+ ];
5695
5490
 
5696
- const Attachments = observer(
5697
- ({
5698
- attachments,
5699
- onRemove,
5700
- onAddDescription,
5701
- className
5702
- }) => {
5703
- if (!attachments.length)
5704
- return null;
5705
- return /* @__PURE__ */ jsx(
5706
- Box,
5707
- {
5708
- className: `attachments ${className}`,
5709
- ...getVariant("layout.common.chat.attachments"),
5710
- children: attachments.map((x) => /* @__PURE__ */ jsx(
5711
- FileAttachment,
5712
- {
5713
- attachment: x,
5714
- onRemove: onRemove ? () => onRemove(x) : void 0,
5715
- onAddDescription
5716
- },
5717
- x.id
5718
- ))
5719
- }
5720
- );
5491
+ const TagReplacers = {
5492
+ div: Box,
5493
+ button: Button,
5494
+ container: Container,
5495
+ h1: (props) => /* @__PURE__ */ jsx(Heading, { as: "h1", ...props }),
5496
+ h2: (props) => /* @__PURE__ */ jsx(Heading, { as: "h2", ...props }),
5497
+ h3: (props) => /* @__PURE__ */ jsx(Heading, { as: "h3", ...props }),
5498
+ h4: (props) => /* @__PURE__ */ jsx(Heading, { as: "h4", ...props }),
5499
+ h5: (props) => /* @__PURE__ */ jsx(Heading, { as: "h5", ...props }),
5500
+ h6: (props) => /* @__PURE__ */ jsx(Heading, { as: "h6", ...props }),
5501
+ img: Image,
5502
+ label: Label$1,
5503
+ input: Input,
5504
+ p: Paragraph,
5505
+ select: Select
5506
+ };
5507
+
5508
+ const contextMethods = {};
5509
+
5510
+ const AttributeValueParsers = (currentValue) => {
5511
+ if (currentValue === "true")
5512
+ return true;
5513
+ if (currentValue === "false")
5514
+ return false;
5515
+ if (typeof currentValue === "string") {
5516
+ const result = currentValue.match(/^__contextMethod\.(\w+)\.(\w+)$/);
5517
+ if (result) {
5518
+ return contextMethods[result[1]][result[2]];
5519
+ }
5721
5520
  }
5722
- );
5521
+ return currentValue;
5522
+ };
5723
5523
 
5724
- function importComponent(path) {
5725
- return lazy(() => {
5726
- return new Promise((resolve) => {
5727
- import(
5728
- /* webpackInclude: /\.tsx?$/ */
5729
- `/customComponents/${path}`
5730
- ).then((result) => {
5731
- if (result?.default?.default)
5732
- resolve(result.default);
5733
- else if (result?.default)
5734
- resolve(result);
5735
- else
5736
- resolve({
5737
- default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
5738
- });
5739
- }).catch((error) => {
5740
- resolve({
5741
- default: () => {
5742
- console.error(error);
5743
- return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
5744
- }
5745
- });
5746
- });
5747
- });
5748
- });
5524
+ function isMessage(error) {
5525
+ return !!(typeof error === "object" && error && "message" in error);
5526
+ }
5527
+ function processCommand(command) {
5528
+ return Commands[command]();
5749
5529
  }
5530
+ const Commands = {
5531
+ PREVENT_RENDERING: () => null
5532
+ };
5750
5533
 
5751
- const AttributeParsers = [
5752
- /**
5753
- * Allows to pass javascript event handlers through the format
5754
- * onEventDispatched, the main difficulty is that the html parser returns the
5755
- * attributes with lowercase, that's why any attribute of the type
5756
- * onEventDispatched will be passed to the component as onEventdispatched
5757
- * (note the lowercase 'd').
5758
- */
5759
- {
5760
- match: /^(?:data-)?on(.*)$/i,
5761
- parse([, originalAction], value) {
5762
- if (value.match(/^__contextMethod/))
5763
- return [
5764
- {
5765
- newName: `on${originalAction[0].toUpperCase()}${originalAction.slice(
5766
- 1
5767
- )}`,
5768
- newValue: value
5769
- }
5770
- ];
5771
- let newName = `on${originalAction.charAt(0).toUpperCase()}${originalAction.slice(1)}`;
5772
- const composedEvent = originalAction.match(/^(mouse|key|double)(.*)$/i);
5773
- if (composedEvent) {
5774
- newName = `on${composedEvent[1].charAt(0).toUpperCase()}${composedEvent[1].slice(1)}${composedEvent[2].charAt(0).toUpperCase()}${composedEvent[2].slice(1)}`;
5775
- }
5776
- return [
5777
- {
5778
- newName,
5779
- newValue: (ev) => {
5780
- const evalString = value.replace(/return [^;\n\r]+/, "");
5781
- const f = eval(evalString);
5782
- f(ev);
5783
- }
5784
- }
5785
- ];
5786
- }
5787
- },
5788
- {
5789
- /**
5790
- * Allows to pass style objects as JSON strings
5791
- */
5792
- match: /^data-style$/,
5793
- parse(_match, value2) {
5794
- try {
5795
- return [{ newName: "style", newValue: JSON.parse(value2) }];
5796
- } catch (e) {
5797
- console.error({ value: value2, e });
5798
- }
5799
- return null;
5800
- }
5801
- },
5802
- {
5803
- /**
5804
- * Allows conditional rendering of a component
5805
- */
5806
- match: /^data-render$/,
5807
- parse(_match, originalValue) {
5808
- if (originalValue !== "" && !JSON.parse(originalValue)) {
5809
- throw new Command("COMMAND: PREVENT_RENDERING");
5810
- }
5811
- return [
5812
- {
5813
- newName: "data-render",
5814
- newValue: void 0
5815
- }
5816
- ];
5817
- }
5818
- },
5819
- {
5820
- /**
5821
- * Allow to pass json data as property to the components
5822
- */
5823
- match: /^data-json-([a-zA-Z][\w_]*)$/,
5824
- parse: ([, name], originalValue) => {
5825
- try {
5826
- return [
5827
- {
5828
- newName: name,
5829
- newValue: JSON.parse(originalValue)
5830
- }
5831
- ];
5832
- } catch (e) {
5833
- console.info(`Prop: ${name}, originalValue: ${originalValue}`);
5834
- console.error(e);
5835
- return null;
5836
- }
5837
- }
5838
- },
5839
- {
5840
- match: /^data(?:-dom)?-variant$/,
5841
- parse(_, newValue) {
5842
- return [
5843
- { newName: "data-variant", newValue },
5844
- { newName: "variant", newValue }
5845
- ];
5846
- }
5847
- },
5848
- {
5849
- match: /^data-dom-([a-zA-Z][\w_]*)/i,
5850
- parse([, name], newValue) {
5851
- return [{ newName: `data-${name}`, newValue }];
5852
- }
5853
- },
5854
- {
5855
- /**
5856
- * Change all the attributes whose name matches with data-(name) to just
5857
- * name
5858
- */
5859
- match: /^data-([a-zA-Z][\w_]*)$/,
5860
- parse: ([, newName2], newValue) => [{ newName: newName2, newValue }]
5861
- },
5862
- /**
5863
- * Allows to pass conditional data to a component. It accepts as value a JSON
5864
- * string with the following structure:
5865
- *
5866
- * data-condition-NAME_OF_ATTRIBUTE=`
5867
- * {
5868
- * "condition": CONDITION,
5869
- * "NAME_OF_ATTRIBUTE": VALUE_TO_PASS_TO_THE_COMPONENT
5870
- * }
5871
- *
5872
- * Where:
5873
- * - NAME_OF_ATTRIBUTE can be anything you want, the only limitations are
5874
- * the attribute names limitations. - CONDITION will be evaluated with a
5875
- * ternary conditional, if it parses to true the value will be passed or
5876
- * hidden elsewhere - VALUE_TO_PASS_TO_THE_COMPONENT Since all the attribute
5877
- * will be parsed with JSON, the value to pass can be anything that
5878
- * can be parsed this way.
5879
- */
5880
- {
5881
- match: /^data-condition-([a-zA-Z][\w_]*)$/,
5882
- parse: ([, newName2], value2) => {
5883
- try {
5884
- const parsedValue = JSON.parse(value2);
5885
- return [
5886
- {
5887
- newName: newName2,
5888
- newValue: parsedValue.condition ? parsedValue[newName2] : void 0
5889
- }
5890
- ];
5891
- } catch (e) {
5892
- console.error(e);
5893
- }
5894
- return null;
5895
- }
5896
- },
5897
- {
5898
- match: /^tabindex/i,
5899
- parse(_, newValue) {
5900
- return [{ newName: "tabIndex", newValue }];
5901
- }
5902
- }
5903
- ];
5904
-
5905
- const PathShortcuts = {};
5906
-
5907
- const AttributeFilters = ["data-template", "data-component", "style"];
5908
-
5909
- const AttributeReplacers = {
5910
- // Common html props
5911
- class: "className",
5912
- colspan: "colSpan",
5913
- for: "htmlFor",
5914
- readonly: "readOnly",
5915
- autocomplete: "autoComplete",
5916
- // Chart button
5917
- chartid: "chartId",
5918
- // Dynamic button
5919
- apiaprops: "apiaProps",
5920
- // Profiles props
5921
- // Users administration
5922
- isglobal: "isGlobal",
5923
- iscreate: "isCreate",
5924
- ldapfull: "ldapFull",
5925
- passwordprops: "passwordProps",
5926
- // Validation fields
5927
- initialvalue: "initialValue",
5928
- submitvalueparser: "submitValueParser",
5929
- validationclass: "validationClass",
5930
- validationfunction: "validationFunction",
5931
- validationrules: "validationRules",
5932
- allowpickbeforetoday: "allowPickBeforeToday",
5933
- evtmetafilters: "evtMetaFilters",
5934
- trafreemetafilters: "traFreeMetaFilters",
5935
- // Documents info modal
5936
- allowdownload: "allowDownload",
5937
- // Documents upload modal
5938
- allowpickfromdirectories: "allowPickFromDirectories",
5939
- allowpickfrommonitor: "allowPickFromMonitor",
5940
- // Document Info modal
5941
- frommonitor: "fromMonitor",
5942
- showhistory: "showHistory",
5943
- showdownloadinfo: "showDownloadInfo",
5944
- showpermissions: "showPermissions",
5945
- // LangPicker
5946
- currentlang: "currentLang",
5947
- // Change Dates Modal
5948
- dateinputname: "dateInputName",
5949
- initiallyexpanded: "initiallyExpanded",
5950
- buttonsactions: "buttonsActions",
5951
- // Reports
5952
- reportname: "reportName"
5953
- };
5954
-
5955
- const ComplexReplacements = [
5956
- (domNode, _, customOptions, commentsData) => {
5957
- if (domNode.attribs["data-prevent-parse"] && domNode.attribs["data-prevent-parse"].trim() === "true") {
5958
- return null;
5959
- }
5960
- if (domNode.attributes.find((current) => current.name === "data-fragment")) {
5961
- const children = domToReact(
5962
- cloneDeep(domNode.children),
5963
- parseOptions(customOptions, commentsData)
5964
- );
5965
- return /* @__PURE__ */ jsx(Fragment, { children });
5966
- }
5967
- return false;
5968
- }
5969
- ];
5970
-
5971
- const TagReplacers = {
5972
- div: Box,
5973
- button: Button,
5974
- container: Container,
5975
- h1: (props) => /* @__PURE__ */ jsx(Heading, { as: "h1", ...props }),
5976
- h2: (props) => /* @__PURE__ */ jsx(Heading, { as: "h2", ...props }),
5977
- h3: (props) => /* @__PURE__ */ jsx(Heading, { as: "h3", ...props }),
5978
- h4: (props) => /* @__PURE__ */ jsx(Heading, { as: "h4", ...props }),
5979
- h5: (props) => /* @__PURE__ */ jsx(Heading, { as: "h5", ...props }),
5980
- h6: (props) => /* @__PURE__ */ jsx(Heading, { as: "h6", ...props }),
5981
- img: Image,
5982
- label: Label$1,
5983
- input: Input,
5984
- p: Paragraph,
5985
- select: Select
5986
- };
5987
-
5988
- const contextMethods = {};
5989
-
5990
- const AttributeValueParsers = (currentValue) => {
5991
- if (currentValue === "true")
5992
- return true;
5993
- if (currentValue === "false")
5994
- return false;
5995
- if (typeof currentValue === "string") {
5996
- const result = currentValue.match(/^__contextMethod\.(\w+)\.(\w+)$/);
5997
- if (result) {
5998
- return contextMethods[result[1]][result[2]];
5999
- }
6000
- }
6001
- return currentValue;
6002
- };
6003
-
6004
- function isMessage(error) {
6005
- return !!(typeof error === "object" && error && "message" in error);
6006
- }
6007
- function processCommand(command) {
6008
- return Commands[command]();
6009
- }
6010
- const Commands = {
6011
- PREVENT_RENDERING: () => null
6012
- };
6013
-
6014
- const CommentsParsers = [
5534
+ const CommentsParsers = [
6015
5535
  {
6016
5536
  /**
6017
5537
  * This parser allows to put a comment with the structure:
@@ -6051,382 +5571,827 @@ const CommentsParsers = [
6051
5571
  responseData.SuspenseComponent = importTemplaterComponent(result[1]);
6052
5572
  return responseData;
6053
5573
  }
6054
- }
6055
- ];
5574
+ }
5575
+ ];
5576
+
5577
+ var __defProp$f = Object.defineProperty;
5578
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5579
+ var __publicField$f = (obj, key, value) => {
5580
+ __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
5581
+ return value;
5582
+ };
5583
+ var __accessCheck$4 = (obj, member, msg) => {
5584
+ if (!member.has(obj))
5585
+ throw TypeError("Cannot " + msg);
5586
+ };
5587
+ var __privateGet$2 = (obj, member, getter) => {
5588
+ __accessCheck$4(obj, member, "read from private field");
5589
+ return getter ? getter.call(obj) : member.get(obj);
5590
+ };
5591
+ var __privateAdd$4 = (obj, member, value) => {
5592
+ if (member.has(obj))
5593
+ throw TypeError("Cannot add the same private member more than once");
5594
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5595
+ };
5596
+ var _actuallyParse;
5597
+ console.time("Templater parse");
5598
+ console.time("Templater pre screen unlock");
5599
+ function importTemplaterComponent(path) {
5600
+ return lazy(() => {
5601
+ return new Promise((resolve) => {
5602
+ import(
5603
+ /* webpackChunkName: "[request]" */
5604
+ /* webpackInclude: /\.tsx?$/ */
5605
+ /* webpackPreload: true */
5606
+ /* webpackExclude: /projectAnalysisTree/ */
5607
+ `/src/dynamic/${path}`
5608
+ ).then((result2) => {
5609
+ resolve(result2);
5610
+ }).catch((error) => {
5611
+ resolve({
5612
+ default: () => {
5613
+ console.error(error);
5614
+ throw new Error(
5615
+ `The above error ocurred at component ${path}, does it exist?`
5616
+ );
5617
+ }
5618
+ });
5619
+ });
5620
+ });
5621
+ });
5622
+ }
5623
+ function parseShortcut(shortcut) {
5624
+ if ("^($)[.".indexOf(shortcut) !== -1)
5625
+ return `\\${shortcut}`;
5626
+ return shortcut;
5627
+ }
5628
+ const parsedShortcuts = Object.entries(PathShortcuts).map(
5629
+ ([shortcut, path]) => {
5630
+ return [parseShortcut(shortcut), path];
5631
+ }
5632
+ );
5633
+ const Wrapper = ({
5634
+ children,
5635
+ onMount
5636
+ }) => {
5637
+ React.useEffect(() => {
5638
+ if (onMount) {
5639
+ onMount();
5640
+ }
5641
+ return () => {
5642
+ };
5643
+ }, []);
5644
+ return children;
5645
+ };
5646
+ const Command = Error;
5647
+ function makeEmptyCommentsData() {
5648
+ return { customShortcuts: [], SuspenseComponent: () => null };
5649
+ }
5650
+ const parseOptions = (customOptions, commentsData) => {
5651
+ let actualCommentsData = commentsData ?? makeEmptyCommentsData();
5652
+ return {
5653
+ trim: true,
5654
+ replace: (domNode) => {
5655
+ if (customOptions?.debug)
5656
+ console.log(domNode);
5657
+ if (domNode.type.toLowerCase() === "comment") {
5658
+ CommentsParsers.forEach((parser) => {
5659
+ const matchResult = domNode.data.match(
5660
+ parser.match
5661
+ );
5662
+ if (matchResult) {
5663
+ actualCommentsData = parser.parse(matchResult, actualCommentsData);
5664
+ }
5665
+ });
5666
+ }
5667
+ if (domNode instanceof Element && domNode.attribs) {
5668
+ let componentName = domNode.attribs["data-component"];
5669
+ if (componentName) {
5670
+ actualCommentsData.customShortcuts.forEach(
5671
+ ([shortcut, replacement]) => {
5672
+ if (componentName.match(new RegExp(`^${shortcut}.+`))) {
5673
+ componentName = replacement + componentName.slice(shortcut.length);
5674
+ }
5675
+ }
5676
+ );
5677
+ parsedShortcuts.forEach(([shortcut, replacement]) => {
5678
+ if (componentName.match(new RegExp(`^${shortcut}.+`))) {
5679
+ componentName = replacement + componentName.slice(shortcut.length);
5680
+ }
5681
+ });
5682
+ if (componentName.startsWith("@"))
5683
+ componentName = componentName.slice(1);
5684
+ }
5685
+ try {
5686
+ const Component = componentName ? importTemplaterComponent(componentName) : TagReplacers[domNode.name] ?? ((props3) => /* @__PURE__ */ jsx(Box$1, { as: domNode.name, ...props3 }));
5687
+ for (let i = 0; i < ComplexReplacements.length; i++) {
5688
+ const complexReplacement = ComplexReplacements[i];
5689
+ const result2 = complexReplacement(
5690
+ domNode,
5691
+ Component,
5692
+ customOptions,
5693
+ commentsData
5694
+ );
5695
+ if (result2 !== false)
5696
+ return /* @__PURE__ */ jsx(Suspense, { children: result2 });
5697
+ }
5698
+ [
5699
+ ...AttributeFilters,
5700
+ ...customOptions?.filterAttributes ?? []
5701
+ ].forEach((att) => {
5702
+ delete domNode.attribs[att];
5703
+ });
5704
+ const props2 = Object.entries(domNode.attribs).reduce(
5705
+ (dictionary, [initialName, initialValue]) => {
5706
+ const name = initialName;
5707
+ const value = initialValue;
5708
+ let hasParsed = false;
5709
+ const returnDictionary = { ...dictionary };
5710
+ for (let i = 0; i < AttributeParsers.length; i++) {
5711
+ const parser = AttributeParsers[i];
5712
+ const match = name.match(parser.match);
5713
+ if (customOptions?.debug)
5714
+ console.log(parser.match, match);
5715
+ if (match) {
5716
+ const parsed = parser.parse(match, value);
5717
+ if (customOptions?.debug)
5718
+ console.log(parser.match, parsed);
5719
+ if (parsed) {
5720
+ parsed.forEach(({ newName, newValue }) => {
5721
+ const finalName = {
5722
+ ...AttributeReplacers,
5723
+ ...customOptions?.attributesReplacement ?? {}
5724
+ }[newName] ?? newName;
5725
+ returnDictionary[finalName] = AttributeValueParsers(newValue);
5726
+ });
5727
+ hasParsed = true;
5728
+ }
5729
+ break;
5730
+ }
5731
+ }
5732
+ if (!hasParsed) {
5733
+ const newName = {
5734
+ ...AttributeReplacers,
5735
+ ...customOptions?.attributesReplacement ?? {}
5736
+ }[name] ?? name;
5737
+ returnDictionary[newName] = AttributeValueParsers(value);
5738
+ }
5739
+ return returnDictionary;
5740
+ },
5741
+ {}
5742
+ );
5743
+ const children = domToReact(
5744
+ cloneDeep(domNode.children),
5745
+ parseOptions(customOptions, actualCommentsData)
5746
+ );
5747
+ delete props2.children;
5748
+ const { onComponentload } = props2;
5749
+ if (onComponentload) {
5750
+ delete props2.onComponentload;
5751
+ }
5752
+ if (actualCommentsData.SuspenseComponent) {
5753
+ if (onComponentload) {
5754
+ return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) }) });
5755
+ }
5756
+ return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
5757
+ }
5758
+ if (onComponentload)
5759
+ return /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
5760
+ return /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null });
5761
+ } catch (e) {
5762
+ if (isMessage(e)) {
5763
+ const match = e.message.match(/COMMAND: *(\w[\w\d_-]*)/);
5764
+ if (match) {
5765
+ return processCommand(match[1]);
5766
+ }
5767
+ }
5768
+ console.error(e);
5769
+ }
5770
+ }
5771
+ return domNode;
5772
+ },
5773
+ htmlparser2: { lowerCaseAttributeNames: false }
5774
+ };
5775
+ };
5776
+ const _Templater = class _Templater {
5777
+ constructor() {
5778
+ __publicField$f(this, "isDownloadingTemplate", false);
5779
+ __publicField$f(this, "templates", {});
5780
+ __privateAdd$4(this, _actuallyParse, (html, options) => {
5781
+ let actualHTML = html;
5782
+ if (window.onPreParseTemplate) {
5783
+ const parser = new DOMParser();
5784
+ const document2 = parser.parseFromString(html, "text/html");
5785
+ window.onPreParseTemplate?.(document2);
5786
+ actualHTML = document2.body.innerHTML;
5787
+ }
5788
+ return parse(actualHTML, options);
5789
+ });
5790
+ this.initTemplates();
5791
+ }
5792
+ static get instance() {
5793
+ if (!this._instance) {
5794
+ this._instance = new _Templater();
5795
+ }
5796
+ return this._instance;
5797
+ }
5798
+ initTemplates() {
5799
+ const templates = [
5800
+ ...document.querySelectorAll("[data-template]")
5801
+ ];
5802
+ const templatesObject = templates.reduce((dictionary, template) => {
5803
+ const name = template.getAttribute("data-template");
5804
+ if (!name)
5805
+ return dictionary;
5806
+ return {
5807
+ ...dictionary,
5808
+ [name]: this.parseContent(name, template.outerHTML, {})
5809
+ };
5810
+ }, {});
5811
+ templates.forEach((template) => template.remove());
5812
+ this.templates = templatesObject;
5813
+ }
5814
+ /**
5815
+ * This method parses the string looking for <script class="context"> tags
5816
+ * and placeholders, run that code and make the replacements in the template
5817
+ * string.
5818
+ *
5819
+ * @param content The HTML string
5820
+ */
5821
+ parseContent(templateName, content, props) {
5822
+ function shoutError(error) {
5823
+ console.error("%cParse template error", "font-size: 16px; margin: 10px");
5824
+ throw new Error(`${error} at template ${templateName}`);
5825
+ }
5826
+ let context = {};
5827
+ let newContent = content.replaceAll(
5828
+ /data-json-([\w_-]+)="([^"]+)"/g,
5829
+ (_2, propName, propValue) => {
5830
+ return `data-json-${propName}='${propValue.replaceAll(
5831
+ "'",
5832
+ "&apos;"
5833
+ )}'`;
5834
+ }
5835
+ ).replaceAll(
5836
+ /<script [^>]*class="context"[^>]*>([\s\S]*?)<\/script>/g,
5837
+ (_, scriptContent) => {
5838
+ if (scriptContent.match(/window[^=;]*=/))
5839
+ throw new Error("Assignment to window is forbidden");
5840
+ try {
5841
+ context = {
5842
+ ...context,
5843
+ ...eval(`{
5844
+ let context = JSON.parse(\`${JSON.stringify(context).replaceAll(
5845
+ '"',
5846
+ '\\"'
5847
+ )}\`);
5848
+ ${scriptContent};
5849
+ context
5850
+ }`)
5851
+ };
5852
+ } catch (e) {
5853
+ console.info(`Script contents: ${scriptContent}`);
5854
+ console.info(`Props`, props);
5855
+ shoutError(e);
5856
+ }
5857
+ return "";
5858
+ }
5859
+ );
5860
+ const contextId = uniqueId$3();
5861
+ const replacementVars = { context, props };
5862
+ Object.entries(replacementVars).forEach(([varName, varContent]) => {
5863
+ if (varContent)
5864
+ Object.entries(varContent).forEach(([key, value]) => {
5865
+ if (isFunction(value)) {
5866
+ if (!contextMethods[contextId])
5867
+ contextMethods[contextId] = {};
5868
+ const methodId = uniqueId$3();
5869
+ contextMethods[contextId][methodId] = value;
5870
+ newContent = newContent.replaceAll(
5871
+ new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
5872
+ `__contextMethod.${contextId}.${methodId}`
5873
+ );
5874
+ } else
5875
+ newContent = newContent.replaceAll(
5876
+ new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
5877
+ value !== void 0 ? value : ""
5878
+ );
5879
+ });
5880
+ });
5881
+ newContent = newContent.replaceAll(
5882
+ /{{\s*(context|props)\?.([_$a-zA-Z]\w+)\s*}}/g,
5883
+ ""
5884
+ );
5885
+ const result = newContent.match(
5886
+ /\{\{(context|props)\.([_$a-zA-Z]\w+)\\s*}}/
5887
+ );
5888
+ if (result)
5889
+ shoutError(`${result[1]}.${result[2]} is undefined`);
5890
+ return newContent;
5891
+ }
5892
+ /**
5893
+ * This method takes a template from the HTML Document and parses it to React
5894
+ * Components.
5895
+ *
5896
+ * @param name The name of the template you are looking for, it must be specified as
5897
+ * data-template="name" in the HTML element you want to use as template.
5898
+ * @param options This argument allows you to alter the behavior of the parser, for example
5899
+ * to replace some attribute names, parse some attributes with a custom parser function or
5900
+ * discard some attributes. See the type IAlterDefaultOptions to get more information
5901
+ *
5902
+ * @returns A ReactComponent as the result of the parsed HTML template.
5903
+ */
5904
+ getTemplateByName(name, options) {
5905
+ if (!this.templates[name])
5906
+ throw new Error("There is no template with such name, ", name);
5907
+ const component = __privateGet$2(this, _actuallyParse).call(this, this.parseContent(name, this.templates[name], options?.props), parseOptions(options));
5908
+ return component;
5909
+ }
5910
+ /**
5911
+ * This method parses a string in HTML to React Components.
5912
+ *
5913
+ * @param content The HTML string to parse to React Components
5914
+ * @param options This argument allows you to alter the behavior of the parser, for example
5915
+ * to replace some attribute names, parse some attributes with a custom parser function or
5916
+ * discard some attributes. See the type IAlterDefaultOptions to get more information
5917
+ *
5918
+ * @returns A ReactComponent as the result of the parsed HTML template.
5919
+ */
5920
+ parseString(content2, options) {
5921
+ return __privateGet$2(this, _actuallyParse).call(this, this.parseContent("parseStringTemplate", content2, options?.props), parseOptions(options));
5922
+ }
5923
+ };
5924
+ _actuallyParse = new WeakMap();
5925
+ __publicField$f(_Templater, "_instance", null);
5926
+ let Templater = _Templater;
5927
+
5928
+ const MDRenderer = ({ str }) => {
5929
+ return /* @__PURE__ */ jsx(Box, { ...getVariant("layout.common.markdown"), children: Templater.instance.parseString(
5930
+ new Remarkable({ linkTarget: "_blank" }).render(str)
5931
+ ) });
5932
+ };
5933
+ var MDRenderer$1 = memo(MDRenderer);
5934
+
5935
+ const MessageBlocks = ({ str }) => {
5936
+ const parts = str.split(/(!!\[[^]+])/g).map((c, i) => {
5937
+ if (c.match(/^!!\[[^]+]$/)) {
5938
+ const definition = JSON.parse(
5939
+ decodeBase64ToUtf8(
5940
+ (c.match(/^!!\[([^]+)]$/) ?? [void 0, void 0])[1] ?? ""
5941
+ )
5942
+ );
5943
+ return /* @__PURE__ */ jsx(MessageBlock$1, { componentData: definition }, i);
5944
+ } else {
5945
+ return /* @__PURE__ */ jsx(MDRenderer$1, { str: c }, i);
5946
+ }
5947
+ });
5948
+ return parts;
5949
+ };
5950
+ var MessageBlocks$1 = memo(MessageBlocks);
5951
+
5952
+ var __defProp$e = Object.defineProperty;
5953
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5954
+ var __publicField$e = (obj, key, value) => {
5955
+ __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
5956
+ return value;
5957
+ };
5958
+ let maxId = 0;
5959
+ class ChatMessage {
5960
+ constructor(message = "", messageType = "user", attachments = [], reference = null) {
5961
+ this.message = message;
5962
+ this.messageType = messageType;
5963
+ this.attachments = attachments;
5964
+ this.reference = reference;
5965
+ __publicField$e(this, "id");
5966
+ __publicField$e(this, "clone", () => new ChatMessage(
5967
+ this.message,
5968
+ this.messageType,
5969
+ this.attachments.map((x) => {
5970
+ return { ...x };
5971
+ }),
5972
+ this.reference
5973
+ ));
5974
+ this.id = maxId++;
5975
+ if (messageType === "response")
5976
+ this.messageType = "system";
5977
+ if (typeof message === "string")
5978
+ this.message = message;
5979
+ makeObservable(this, {
5980
+ attachments: observable,
5981
+ message: observable,
5982
+ messageType: observable,
5983
+ reference: observable
5984
+ });
5985
+ }
5986
+ removeAttachment(attachment) {
5987
+ this.attachments = this.attachments.filter(
5988
+ (current) => current !== attachment
5989
+ );
5990
+ }
5991
+ addAttachmentDescription(attachment, description) {
5992
+ const a = this.attachments.find((current) => current === attachment);
5993
+ if (a) {
5994
+ a.description = description;
5995
+ }
5996
+ }
5997
+ }
5998
+
5999
+ const AutoscrollContainer = ({ children, threshold = 150, className }) => {
6000
+ const wrapperRef = useRef(null);
6001
+ const autoScrollEnabled = useRef(true);
6002
+ useEffect(() => {
6003
+ const wrapper = wrapperRef.current;
6004
+ if (!wrapper)
6005
+ return;
6006
+ const scrollEl = findScrollContainer(wrapper);
6007
+ const isNearBottom = () => scrollEl.scrollHeight - (scrollEl.scrollTop + scrollEl.clientHeight) <= threshold;
6008
+ const onWheel = (e) => {
6009
+ if (e.deltaY < 0) {
6010
+ autoScrollEnabled.current = false;
6011
+ } else if (e.deltaY > 0 && isNearBottom()) {
6012
+ autoScrollEnabled.current = true;
6013
+ }
6014
+ };
6015
+ const onScroll = () => {
6016
+ if (isNearBottom()) {
6017
+ autoScrollEnabled.current = true;
6018
+ }
6019
+ };
6020
+ function enable() {
6021
+ autoScrollEnabled.current = true;
6022
+ }
6023
+ scrollEl.addEventListener("wheel", onWheel, { passive: true });
6024
+ scrollEl.addEventListener("scroll", onScroll, { passive: true });
6025
+ document.addEventListener("enableAutoScroll", enable);
6026
+ scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
6027
+ const mo = new MutationObserver(() => {
6028
+ if (autoScrollEnabled.current) {
6029
+ scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
6030
+ }
6031
+ });
6032
+ mo.observe(wrapper, { childList: true, subtree: true });
6033
+ return () => {
6034
+ scrollEl.removeEventListener("wheel", onWheel);
6035
+ scrollEl.removeEventListener("enableAutoScroll", enable);
6036
+ scrollEl.removeEventListener("scroll", onScroll);
6037
+ mo.disconnect();
6038
+ };
6039
+ }, [threshold]);
6040
+ return /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: `${className || ""} autoscrollContainer`, children });
6041
+ };
6042
+
6043
+ const FileCard = forwardRef(
6044
+ ({
6045
+ name,
6046
+ iconsSize,
6047
+ additionalButtons,
6048
+ className,
6049
+ sx,
6050
+ width = "fit-content",
6051
+ handleClose,
6052
+ onDoubleClick,
6053
+ onClick,
6054
+ onDropFiles
6055
+ }, ref) => {
6056
+ const [isDragOver, setIsDragOver] = useState(false);
6057
+ return /* @__PURE__ */ createElement(
6058
+ Box,
6059
+ {
6060
+ ...getVariant("layout.common.components.fileCard"),
6061
+ sx: {
6062
+ ...sx,
6063
+ width,
6064
+ ...isDragOver && onDropFiles ? {
6065
+ border: "2px dashed #1976d2!important",
6066
+ backgroundColor: "#f5faff!important"
6067
+ } : {}
6068
+ },
6069
+ ref,
6070
+ key: name,
6071
+ className: `fileCard ${className ?? ""}`,
6072
+ onDoubleClick,
6073
+ onClick,
6074
+ title: name,
6075
+ tabIndex: 0,
6076
+ onDragOver: (e) => {
6077
+ e.preventDefault();
6078
+ e.stopPropagation();
6079
+ setIsDragOver(true);
6080
+ },
6081
+ onDragLeave: (e) => {
6082
+ e.preventDefault();
6083
+ e.stopPropagation();
6084
+ setIsDragOver(false);
6085
+ },
6086
+ onDrop: (e) => {
6087
+ e.preventDefault();
6088
+ e.stopPropagation();
6089
+ setIsDragOver(false);
6090
+ if (onDropFiles && e.dataTransfer?.files?.length) {
6091
+ const files = Array.from(e.dataTransfer.files);
6092
+ onDropFiles(files);
6093
+ }
6094
+ }
6095
+ },
6096
+ /* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
6097
+ /* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
6098
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
6099
+ ] }),
6100
+ /* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
6101
+ return /* @__PURE__ */ jsx(
6102
+ IconButton,
6103
+ {
6104
+ iconSize: "Md",
6105
+ ...c,
6106
+ className: `fileCard__additionalButton ${c.className ?? ""}`
6107
+ }
6108
+ );
6109
+ }) }),
6110
+ handleClose && /* @__PURE__ */ jsx(
6111
+ Close,
6112
+ {
6113
+ type: "button",
6114
+ className: "fileCard__delete",
6115
+ onClick: (e) => {
6116
+ e.stopPropagation();
6117
+ e.preventDefault();
6118
+ handleClose(name);
6119
+ }
6120
+ }
6121
+ )
6122
+ );
6123
+ }
6124
+ );
6125
+
6126
+ const Dropzone = ({
6127
+ sx,
6128
+ className,
6129
+ messageError,
6130
+ progress = 0,
6131
+ defaultLabel = getLabel("btnUploadClass").text,
6132
+ draggingLabel = getLabel("lblDroping").text,
6133
+ onClick,
6134
+ onChange,
6135
+ handleInfoButton
6136
+ }) => {
6137
+ const innerSx = messageError ? { borderLeft: "2px solid", borderColor: "danger" } : {};
6138
+ const fileInputRef = useRef(null);
6139
+ const handleClick = (ev) => {
6140
+ onClick?.(ev);
6141
+ if (!ev.defaultPrevented) {
6142
+ fileInputRef.current?.click();
6143
+ }
6144
+ };
6145
+ const handleDragOver = (e) => {
6146
+ e.preventDefault();
6147
+ };
6148
+ const [isDragging, setIsDragging] = useState(false);
6149
+ const handleDragStart = (_e) => {
6150
+ setIsDragging(true);
6151
+ };
6152
+ const handleDragLeave = (e) => {
6153
+ e.preventDefault();
6154
+ setIsDragging(false);
6155
+ };
6156
+ return /* @__PURE__ */ jsxs(
6157
+ Box,
6158
+ {
6159
+ ...getVariant("layout.execution.components.uploader.dropzone"),
6160
+ className: "dropzone__container",
6161
+ children: [
6162
+ /* @__PURE__ */ jsxs(
6163
+ Box,
6164
+ {
6165
+ tabIndex: 0,
6166
+ sx: { ...innerSx, sx },
6167
+ className: `dropzone ${className ?? ""}`,
6168
+ onClick: handleClick,
6169
+ onKeyDown: (ev) => {
6170
+ if (ev.code === "Enter" || ev.code === "Space") {
6171
+ handleClick(ev);
6172
+ }
6173
+ },
6174
+ onDrop: (e) => {
6175
+ e.preventDefault();
6176
+ const newFiles = Array.from(e.dataTransfer.files);
6177
+ setIsDragging(false);
6178
+ onChange?.(newFiles);
6179
+ },
6180
+ onDragEnter: handleDragStart,
6181
+ onDragLeave: handleDragLeave,
6182
+ onDragOver: handleDragOver,
6183
+ children: [
6184
+ progress > 0 && progress < 100 && /* @__PURE__ */ jsx(Progress, { max: 100, value: progress, className: "progressBar" }),
6185
+ messageError ? /* @__PURE__ */ jsx(Box, { color: "danger", children: messageError }) : isDragging ? draggingLabel : defaultLabel,
6186
+ /* @__PURE__ */ jsx(
6187
+ "input",
6188
+ {
6189
+ multiple: true,
6190
+ type: "file",
6191
+ ref: fileInputRef,
6192
+ style: { display: "none" },
6193
+ onChange: (e) => {
6194
+ e.preventDefault();
6195
+ if (e.target.files) {
6196
+ const newFiles = Array.from([...e.target.files]);
6197
+ onChange?.(newFiles);
6198
+ e.target.value = "";
6199
+ }
6200
+ }
6201
+ }
6202
+ )
6203
+ ]
6204
+ }
6205
+ ),
6206
+ handleInfoButton && /* @__PURE__ */ jsx(
6207
+ IconButton,
6208
+ {
6209
+ className: "info",
6210
+ iconSize: "Sm",
6211
+ icon: "Info",
6212
+ onMouseEnter: handleInfoButton,
6213
+ onClick: handleClick
6214
+ }
6215
+ )
6216
+ ]
6217
+ }
6218
+ );
6219
+ };
6056
6220
 
6057
6221
  var __defProp$d = Object.defineProperty;
6058
6222
  var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6059
6223
  var __publicField$d = (obj, key, value) => {
6060
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
6224
+ __defNormalProp$d(obj, key + "" , value);
6061
6225
  return value;
6062
6226
  };
6063
- var __accessCheck$4 = (obj, member, msg) => {
6064
- if (!member.has(obj))
6065
- throw TypeError("Cannot " + msg);
6066
- };
6067
- var __privateGet$2 = (obj, member, getter) => {
6068
- __accessCheck$4(obj, member, "read from private field");
6069
- return getter ? getter.call(obj) : member.get(obj);
6070
- };
6071
- var __privateAdd$4 = (obj, member, value) => {
6072
- if (member.has(obj))
6073
- throw TypeError("Cannot add the same private member more than once");
6074
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
6075
- };
6076
- var _actuallyParse;
6077
- console.time("Templater parse");
6078
- console.time("Templater pre screen unlock");
6079
- function importTemplaterComponent(path) {
6080
- return lazy(() => {
6081
- return new Promise((resolve) => {
6082
- import(
6083
- /* webpackChunkName: "[request]" */
6084
- /* webpackInclude: /\.tsx?$/ */
6085
- /* webpackPreload: true */
6086
- /* webpackExclude: /projectAnalysisTree/ */
6087
- `/src/dynamic/${path}`
6088
- ).then((result2) => {
6089
- resolve(result2);
6090
- }).catch((error) => {
6091
- resolve({
6092
- default: () => {
6093
- console.error(error);
6094
- throw new Error(
6095
- `The above error ocurred at component ${path}, does it exist?`
6096
- );
6097
- }
6098
- });
6099
- });
6100
- });
6101
- });
6102
- }
6103
- function parseShortcut(shortcut) {
6104
- if ("^($)[.".indexOf(shortcut) !== -1)
6105
- return `\\${shortcut}`;
6106
- return shortcut;
6107
- }
6108
- const parsedShortcuts = Object.entries(PathShortcuts).map(
6109
- ([shortcut, path]) => {
6110
- return [parseShortcut(shortcut), path];
6227
+ class UploadHandler {
6228
+ constructor(props) {
6229
+ this.props = props;
6230
+ __publicField$d(this, "state", { inProgressFiles: [], uploadedFiles: [] });
6231
+ makeAutoObservable(this);
6232
+ this.state.uploadedFiles = this.props.initialFiles;
6111
6233
  }
6112
- );
6113
- const Wrapper = ({
6114
- children,
6115
- onMount
6116
- }) => {
6117
- React.useEffect(() => {
6118
- if (onMount) {
6119
- onMount();
6120
- }
6121
- return () => {
6122
- };
6123
- }, []);
6124
- return children;
6125
- };
6126
- const Command = Error;
6127
- function makeEmptyCommentsData() {
6128
- return { customShortcuts: [], SuspenseComponent: () => null };
6129
- }
6130
- const parseOptions = (customOptions, commentsData) => {
6131
- let actualCommentsData = commentsData ?? makeEmptyCommentsData();
6132
- return {
6133
- trim: true,
6134
- replace: (domNode) => {
6135
- if (customOptions?.debug)
6136
- console.log(domNode);
6137
- if (domNode.type.toLowerCase() === "comment") {
6138
- CommentsParsers.forEach((parser) => {
6139
- const matchResult = domNode.data.match(
6140
- parser.match
6141
- );
6142
- if (matchResult) {
6143
- actualCommentsData = parser.parse(matchResult, actualCommentsData);
6144
- }
6234
+ delete(file) {
6235
+ this.props.onDelete(file).then((res) => {
6236
+ if (res === true) {
6237
+ this.state.uploadedFiles = this.state.uploadedFiles.filter(
6238
+ (c) => c !== file
6239
+ );
6240
+ } else if (typeof res === "string") {
6241
+ ApiaUtil.instance.notifications.notify({
6242
+ message: res
6145
6243
  });
6146
6244
  }
6147
- if (domNode instanceof Element && domNode.attribs) {
6148
- let componentName = domNode.attribs["data-component"];
6149
- if (componentName) {
6150
- actualCommentsData.customShortcuts.forEach(
6151
- ([shortcut, replacement]) => {
6152
- if (componentName.match(new RegExp(`^${shortcut}.+`))) {
6153
- componentName = replacement + componentName.slice(shortcut.length);
6154
- }
6155
- }
6156
- );
6157
- parsedShortcuts.forEach(([shortcut, replacement]) => {
6158
- if (componentName.match(new RegExp(`^${shortcut}.+`))) {
6159
- componentName = replacement + componentName.slice(shortcut.length);
6160
- }
6161
- });
6162
- if (componentName.startsWith("@"))
6163
- componentName = componentName.slice(1);
6164
- }
6165
- try {
6166
- const Component = componentName ? importTemplaterComponent(componentName) : TagReplacers[domNode.name] ?? ((props3) => /* @__PURE__ */ jsx(Box$1, { as: domNode.name, ...props3 }));
6167
- for (let i = 0; i < ComplexReplacements.length; i++) {
6168
- const complexReplacement = ComplexReplacements[i];
6169
- const result2 = complexReplacement(
6170
- domNode,
6171
- Component,
6172
- customOptions,
6173
- commentsData
6174
- );
6175
- if (result2 !== false)
6176
- return /* @__PURE__ */ jsx(Suspense, { children: result2 });
6177
- }
6178
- [
6179
- ...AttributeFilters,
6180
- ...customOptions?.filterAttributes ?? []
6181
- ].forEach((att) => {
6182
- delete domNode.attribs[att];
6183
- });
6184
- const props2 = Object.entries(domNode.attribs).reduce(
6185
- (dictionary, [initialName, initialValue]) => {
6186
- const name = initialName;
6187
- const value = initialValue;
6188
- let hasParsed = false;
6189
- const returnDictionary = { ...dictionary };
6190
- for (let i = 0; i < AttributeParsers.length; i++) {
6191
- const parser = AttributeParsers[i];
6192
- const match = name.match(parser.match);
6193
- if (customOptions?.debug)
6194
- console.log(parser.match, match);
6195
- if (match) {
6196
- const parsed = parser.parse(match, value);
6197
- if (customOptions?.debug)
6198
- console.log(parser.match, parsed);
6199
- if (parsed) {
6200
- parsed.forEach(({ newName, newValue }) => {
6201
- const finalName = {
6202
- ...AttributeReplacers,
6203
- ...customOptions?.attributesReplacement ?? {}
6204
- }[newName] ?? newName;
6205
- returnDictionary[finalName] = AttributeValueParsers(newValue);
6206
- });
6207
- hasParsed = true;
6208
- }
6209
- break;
6210
- }
6211
- }
6212
- if (!hasParsed) {
6213
- const newName = {
6214
- ...AttributeReplacers,
6215
- ...customOptions?.attributesReplacement ?? {}
6216
- }[name] ?? name;
6217
- returnDictionary[newName] = AttributeValueParsers(value);
6218
- }
6219
- return returnDictionary;
6220
- },
6221
- {}
6222
- );
6223
- const children = domToReact(
6224
- cloneDeep(domNode.children),
6225
- parseOptions(customOptions, actualCommentsData)
6226
- );
6227
- delete props2.children;
6228
- const { onComponentload } = props2;
6229
- if (onComponentload) {
6230
- delete props2.onComponentload;
6231
- }
6232
- if (actualCommentsData.SuspenseComponent) {
6233
- if (onComponentload) {
6234
- return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) }) });
6235
- }
6236
- return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
6237
- }
6238
- if (onComponentload)
6239
- return /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
6240
- return /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null });
6241
- } catch (e) {
6242
- if (isMessage(e)) {
6243
- const match = e.message.match(/COMMAND: *(\w[\w\d_-]*)/);
6244
- if (match) {
6245
- return processCommand(match[1]);
6246
- }
6247
- }
6248
- console.error(e);
6249
- }
6250
- }
6251
- return domNode;
6252
- },
6253
- htmlparser2: { lowerCaseAttributeNames: false }
6254
- };
6255
- };
6256
- const _Templater = class _Templater {
6257
- constructor() {
6258
- __publicField$d(this, "isDownloadingTemplate", false);
6259
- __publicField$d(this, "templates", {});
6260
- __privateAdd$4(this, _actuallyParse, (html, options) => {
6261
- let actualHTML = html;
6262
- if (window.onPreParseTemplate) {
6263
- const parser = new DOMParser();
6264
- const document2 = parser.parseFromString(html, "text/html");
6265
- window.onPreParseTemplate?.(document2);
6266
- actualHTML = document2.body.innerHTML;
6267
- }
6268
- return parse(actualHTML, options);
6269
6245
  });
6270
- this.initTemplates();
6271
- }
6272
- static get instance() {
6273
- if (!this._instance) {
6274
- this._instance = new _Templater();
6275
- }
6276
- return this._instance;
6277
6246
  }
6278
- initTemplates() {
6279
- const templates = [
6280
- ...document.querySelectorAll("[data-template]")
6281
- ];
6282
- const templatesObject = templates.reduce((dictionary, template) => {
6283
- const name = template.getAttribute("data-template");
6284
- if (!name)
6285
- return dictionary;
6286
- return {
6287
- ...dictionary,
6288
- [name]: this.parseContent(name, template.outerHTML, {})
6247
+ start(files) {
6248
+ files.forEach((file) => {
6249
+ const newUpload = {
6250
+ abortController: new AbortController(),
6251
+ id: uniqueId$4("file_upload"),
6252
+ file,
6253
+ progress: 0
6289
6254
  };
6290
- }, {});
6291
- templates.forEach((template) => template.remove());
6292
- this.templates = templatesObject;
6255
+ this.state.inProgressFiles.push(newUpload);
6256
+ this.props.onUpload(newUpload).then((res) => {
6257
+ this.state.inProgressFiles = this.state.inProgressFiles.filter(
6258
+ (c) => c.id !== newUpload.id
6259
+ );
6260
+ if (typeof res === "string") {
6261
+ ApiaUtil.instance.notifications.notify({
6262
+ message: res,
6263
+ icon: ""
6264
+ });
6265
+ } else if (res) {
6266
+ this.state.uploadedFiles.push(res);
6267
+ }
6268
+ });
6269
+ });
6293
6270
  }
6294
- /**
6295
- * This method parses the string looking for <script class="context"> tags
6296
- * and placeholders, run that code and make the replacements in the template
6297
- * string.
6298
- *
6299
- * @param content The HTML string
6300
- */
6301
- parseContent(templateName, content, props) {
6302
- function shoutError(error) {
6303
- console.error("%cParse template error", "font-size: 16px; margin: 10px");
6304
- throw new Error(`${error} at template ${templateName}`);
6305
- }
6306
- let context = {};
6307
- let newContent = content.replaceAll(
6308
- /data-json-([\w_-]+)="([^"]+)"/g,
6309
- (_2, propName, propValue) => {
6310
- return `data-json-${propName}='${propValue.replaceAll(
6311
- "'",
6312
- "&apos;"
6313
- )}'`;
6314
- }
6315
- ).replaceAll(
6316
- /<script [^>]*class="context"[^>]*>([\s\S]*?)<\/script>/g,
6317
- (_, scriptContent) => {
6318
- if (scriptContent.match(/window[^=;]*=/))
6319
- throw new Error("Assignment to window is forbidden");
6320
- try {
6321
- context = {
6322
- ...context,
6323
- ...eval(`{
6324
- let context = JSON.parse(\`${JSON.stringify(context).replaceAll(
6325
- '"',
6326
- '\\"'
6327
- )}\`);
6328
- ${scriptContent};
6329
- context
6330
- }`)
6331
- };
6332
- } catch (e) {
6333
- console.info(`Script contents: ${scriptContent}`);
6334
- console.info(`Props`, props);
6335
- shoutError(e);
6271
+ }
6272
+ const Uploader = observer(({ handler }) => {
6273
+ return /* @__PURE__ */ jsxs(Box, { className: "file_uploader", children: [
6274
+ /* @__PURE__ */ jsx(Box, { className: "file_uploader__dropzone", children: (handler.props.isMultiple || handler.state.uploadedFiles.length === 0 && handler.state.inProgressFiles.length === 0) && /* @__PURE__ */ jsx(
6275
+ Dropzone,
6276
+ {
6277
+ onChange: (ev) => {
6278
+ handler.start(ev);
6336
6279
  }
6337
- return "";
6338
6280
  }
6339
- );
6340
- const contextId = uniqueId$3();
6341
- const replacementVars = { context, props };
6342
- Object.entries(replacementVars).forEach(([varName, varContent]) => {
6343
- if (varContent)
6344
- Object.entries(varContent).forEach(([key, value]) => {
6345
- if (isFunction(value)) {
6346
- if (!contextMethods[contextId])
6347
- contextMethods[contextId] = {};
6348
- const methodId = uniqueId$3();
6349
- contextMethods[contextId][methodId] = value;
6350
- newContent = newContent.replaceAll(
6351
- new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
6352
- `__contextMethod.${contextId}.${methodId}`
6353
- );
6354
- } else
6355
- newContent = newContent.replaceAll(
6356
- new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
6357
- value !== void 0 ? value : ""
6358
- );
6359
- });
6281
+ ) }),
6282
+ /* @__PURE__ */ jsx(Box, { className: "file_uploader__in_progress", children: handler.state.inProgressFiles.map((c) => /* @__PURE__ */ jsx(
6283
+ Dropzone,
6284
+ {
6285
+ progress: c.progress,
6286
+ messageError: c.error
6287
+ },
6288
+ c.file.name
6289
+ )) }),
6290
+ /* @__PURE__ */ jsx(Box, { className: "file_uploader__files_list", children: handler.state.uploadedFiles.map((c) => /* @__PURE__ */ jsx(
6291
+ FileCard,
6292
+ {
6293
+ name: c.name,
6294
+ handleClose: () => handler.delete(c)
6295
+ },
6296
+ c.id
6297
+ )) })
6298
+ ] });
6299
+ });
6300
+
6301
+ const FileAttachment = observer(
6302
+ ({
6303
+ attachment,
6304
+ onAddDescription,
6305
+ onRemove
6306
+ }) => {
6307
+ const { ref } = ApiaUtil.instance.tooltips.useHover({
6308
+ preferredOrientationX: "left",
6309
+ preferredOrientationY: "top",
6310
+ minSize: {
6311
+ width: 200,
6312
+ height: 400
6313
+ },
6314
+ attachToMousePosition: true,
6315
+ closeOnMouseLeaveAttachedElement: true,
6316
+ children: /* @__PURE__ */ jsxs(
6317
+ Box,
6318
+ {
6319
+ sx: {
6320
+ display: "flex",
6321
+ alignItems: "center",
6322
+ flexDirection: "column"
6323
+ },
6324
+ children: [
6325
+ /* @__PURE__ */ jsx("h1", { children: attachment.name }),
6326
+ /* @__PURE__ */ jsx("img", { src: attachment.base64 }),
6327
+ attachment.description && /* @__PURE__ */ jsx(Label$1, { children: attachment.description })
6328
+ ]
6329
+ }
6330
+ )
6360
6331
  });
6361
- newContent = newContent.replaceAll(
6362
- /{{\s*(context|props)\?.([_$a-zA-Z]\w+)\s*}}/g,
6363
- ""
6364
- );
6365
- const result = newContent.match(
6366
- /\{\{(context|props)\.([_$a-zA-Z]\w+)\\s*}}/
6332
+ return /* @__PURE__ */ jsx(
6333
+ FileCard,
6334
+ {
6335
+ ref,
6336
+ name: attachment.name,
6337
+ handleClose: onRemove,
6338
+ additionalButtons: onAddDescription ? [
6339
+ {
6340
+ icon: "Pencil",
6341
+ onClick: () => {
6342
+ const collector = new Collector();
6343
+ collector.add(
6344
+ new collector.fields.textarea(
6345
+ "desc",
6346
+ getLabel("lblDesc").text,
6347
+ { initialValue: attachment.description }
6348
+ )
6349
+ );
6350
+ collector.show({
6351
+ onConfirm: (ev) => {
6352
+ if (ev) {
6353
+ onAddDescription(attachment, ev.desc);
6354
+ }
6355
+ return true;
6356
+ },
6357
+ title: getLabel("btnAddComment").text
6358
+ });
6359
+ },
6360
+ variant: "icon-only"
6361
+ }
6362
+ ] : []
6363
+ }
6367
6364
  );
6368
- if (result)
6369
- shoutError(`${result[1]}.${result[2]} is undefined`);
6370
- return newContent;
6371
- }
6372
- /**
6373
- * This method takes a template from the HTML Document and parses it to React
6374
- * Components.
6375
- *
6376
- * @param name The name of the template you are looking for, it must be specified as
6377
- * data-template="name" in the HTML element you want to use as template.
6378
- * @param options This argument allows you to alter the behavior of the parser, for example
6379
- * to replace some attribute names, parse some attributes with a custom parser function or
6380
- * discard some attributes. See the type IAlterDefaultOptions to get more information
6381
- *
6382
- * @returns A ReactComponent as the result of the parsed HTML template.
6383
- */
6384
- getTemplateByName(name, options) {
6385
- if (!this.templates[name])
6386
- throw new Error("There is no template with such name, ", name);
6387
- const component = __privateGet$2(this, _actuallyParse).call(this, this.parseContent(name, this.templates[name], options?.props), parseOptions(options));
6388
- return component;
6389
- }
6390
- /**
6391
- * This method parses a string in HTML to React Components.
6392
- *
6393
- * @param content The HTML string to parse to React Components
6394
- * @param options This argument allows you to alter the behavior of the parser, for example
6395
- * to replace some attribute names, parse some attributes with a custom parser function or
6396
- * discard some attributes. See the type IAlterDefaultOptions to get more information
6397
- *
6398
- * @returns A ReactComponent as the result of the parsed HTML template.
6399
- */
6400
- parseString(content2, options) {
6401
- return __privateGet$2(this, _actuallyParse).call(this, this.parseContent("parseStringTemplate", content2, options?.props), parseOptions(options));
6402
6365
  }
6403
- };
6404
- _actuallyParse = new WeakMap();
6405
- __publicField$d(_Templater, "_instance", null);
6406
- let Templater = _Templater;
6366
+ );
6407
6367
 
6408
- const MDRenderer = ({ str }) => {
6409
- const parts = str.split(/(!!\[[^]+])/g).map((c, i) => {
6410
- if (c.match(/^!!\[[^]+]$/)) {
6411
- const definition = JSON.parse(
6412
- decodeBase64ToUtf8(
6413
- (c.match(/^!!\[([^]+)]$/) ?? [void 0, void 0])[1] ?? ""
6414
- )
6415
- );
6416
- if (typeof definition.args === "string") {
6417
- definition.args = JSON.parse(definition.args);
6368
+ const Attachments = observer(
6369
+ ({
6370
+ attachments,
6371
+ onRemove,
6372
+ onAddDescription,
6373
+ className
6374
+ }) => {
6375
+ if (!attachments.length)
6376
+ return null;
6377
+ return /* @__PURE__ */ jsx(
6378
+ Box,
6379
+ {
6380
+ className: `attachments ${className}`,
6381
+ ...getVariant("layout.common.chat.attachments"),
6382
+ children: attachments.map((x) => /* @__PURE__ */ jsx(
6383
+ FileAttachment,
6384
+ {
6385
+ attachment: x,
6386
+ onRemove: onRemove ? () => onRemove(x) : void 0,
6387
+ onAddDescription
6388
+ },
6389
+ x.id
6390
+ ))
6418
6391
  }
6419
- const Component = importComponent(definition.path);
6420
- return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...definition.args }) }, i);
6421
- } else {
6422
- return /* @__PURE__ */ jsx(Box, { children: Templater.instance.parseString(
6423
- new Remarkable({ linkTarget: "_blank" }).render(c)
6424
- ) }, i);
6425
- }
6426
- });
6427
- return parts;
6428
- };
6429
- var MDRenderer$1 = memo(MDRenderer);
6392
+ );
6393
+ }
6394
+ );
6430
6395
 
6431
6396
  const Message = observer(
6432
6397
  ({
@@ -6448,7 +6413,7 @@ const Message = observer(
6448
6413
  {
6449
6414
  className: "history_message__content",
6450
6415
  ...typeof message === "string" ? {
6451
- children: /* @__PURE__ */ jsx(MDRenderer$1, { str: message })
6416
+ children: /* @__PURE__ */ jsx(MessageBlocks$1, { str: message })
6452
6417
  } : { children: message }
6453
6418
  }
6454
6419
  ),
@@ -8337,13 +8302,16 @@ const LinearSpinnerLock = ({ isLocked }) => isLocked ? /* @__PURE__ */ jsx(
8337
8302
  className: "locker",
8338
8303
  style: {
8339
8304
  backgroundColor: "rgb(128 128 128 / 0%)",
8340
- inset: 0,
8305
+ top: 0,
8306
+ left: 0,
8307
+ right: 0,
8308
+ bottom: 0,
8341
8309
  position: "fixed",
8342
8310
  display: "flex",
8343
8311
  alignItems: "center",
8344
8312
  justifyContent: "center",
8345
- zIndex: "modal",
8346
- transition: "background-color 2s"
8313
+ zIndex: 1200,
8314
+ transition: "background-color 0.25s"
8347
8315
  },
8348
8316
  ref: (el) => {
8349
8317
  if (el instanceof HTMLElement) {
@@ -8907,7 +8875,7 @@ const DefaultIconRendererNoMemo = (props) => {
8907
8875
  return /* @__PURE__ */ jsxs(
8908
8876
  Box,
8909
8877
  {
8910
- title: String(props.additionalProps?.title) || props.label,
8878
+ title: String(props.ariaLabel) || props.label,
8911
8879
  className: "iconsList__icon__wrapper",
8912
8880
  children: [
8913
8881
  /* @__PURE__ */ jsxs(Box, { className: "iconsList__icon__image__wrapper", children: [
@@ -8922,7 +8890,7 @@ const DefaultIconRendererNoMemo = (props) => {
8922
8890
  ),
8923
8891
  props.icon && /* @__PURE__ */ jsx(Icon$1, { icon: props.icon, title: props.ariaLabel })
8924
8892
  ] }),
8925
- /* @__PURE__ */ jsx(Box, { className: "iconsList__icon__label", children: props.label })
8893
+ /* @__PURE__ */ jsx(Box, { className: "iconsList__icon__label", title: props.ariaLabel, children: props.label })
8926
8894
  ]
8927
8895
  }
8928
8896
  );
@@ -12049,5 +12017,5 @@ const _FiltersStore = class _FiltersStore {
12049
12017
  __publicField(_FiltersStore, "instance", new _FiltersStore());
12050
12018
  let FiltersStore = _FiltersStore;
12051
12019
 
12052
- export { Accordion, AccordionAside, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, Aside, AsideLoader, AsidePanel, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, BodyAside, CalendarModal, Captcha, CenteredHeaderButtons, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FavoriteIcon, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingAside, FloatingChatController, FooterButtons, FooterResponsiveButtons, HamburguerMenu, Header, HeaderButtons, IconButton, IconInput, IconsList, Label, LabelBox, LinearLoader, LinearSpinnerLock, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, MDRenderer$1 as MDRenderer, Modal, NumberInput, Overlay, Pagination, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, ShowResponsive, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, menuController, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
12020
+ export { Accordion, AccordionAside, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, Aside, AsideLoader, AsidePanel, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, BodyAside, CalendarModal, Captcha, CenteredHeaderButtons, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FavoriteIcon, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingAside, FloatingChatController, FooterButtons, FooterResponsiveButtons, HamburguerMenu, Header, HeaderButtons, IconButton, IconInput, IconsList, Label, LabelBox, LinearLoader, LinearSpinnerLock, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, MDRenderer$1 as MDRenderer, MessageBlock$1 as MessageBlock, MessageBlocks$1 as MessageBlocks, Modal, NumberInput, Overlay, Pagination, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, ShowResponsive, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, menuController, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
12053
12021
  //# sourceMappingURL=index.js.map