likec4 1.32.2 → 1.34.0

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.
@@ -4,12 +4,11 @@ import React__default, { useState, Fragment, createContext, useContext, useRef,
4
4
  import { createRoot } from "react-dom/client";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { createPortal, flushSync } from "react-dom";
7
- import { ComponentName, useHashHistory, withOverviewGraph, krokiPumlSvgUrl, isDevelopment, krokiD2SvgUrl, basepath } from "./const.js";
7
+ import { pageTitle, ComponentName, useHashHistory, withOverviewGraph, krokiPumlSvgUrl, isDevelopment, krokiD2SvgUrl, basepath } from "./const.js";
8
8
  import { projects, isSingleProject } from "likec4:projects";
9
9
  import { $likec4model, $likec4data, IconRenderer as IconRenderer$1, projectId } from "likec4:single-project";
10
- import { nano } from "likec4/react";
11
- import { isTagColorSpecified, invariant as invariant$2, hasAtLeast, nonexhaustive, isStepEdgeId, extractStep, nameFromFqn, nonNullable, defaultTheme, ElementShapes, toArray, ifind, DefaultMap, ancestorsFqn, isAncestor, sortParentsFirst, ifilter, Queue, whereOperatorAsPredicate, GroupElementKind, delay as delay$1, BBox, getParallelStepsPrefix, isDeploymentView, compareNatural as compareNatural$1, isDescendantOf } from "@likec4/core";
12
- import { DefaultShapeSize, DefaultTextSize, DefaultPaddingSize } from "@likec4/core/types";
10
+ import { isTagColorSpecified, invariant as invariant$2, hasAtLeast, nonexhaustive, isStepEdgeId, extractStep, nameFromFqn, nonNullable, defaultTheme, ElementShapes, toArray, RichText, ifind, DefaultMap, ancestorsFqn, isAncestor, sortParentsFirst, ifilter, Queue, whereOperatorAsPredicate, GroupElementKind, delay as delay$1, BBox, getParallelStepsPrefix, isDeploymentView, compareNatural as compareNatural$1, isDescendantOf } from "@likec4/core";
11
+ import { DefaultShapeSize, DefaultTextSize, DefaultPaddingSize, RichText as RichText$1 } from "@likec4/core/types";
13
12
  import { computeRelationshipsView, treeFromElements as treeFromElements$1 } from "@likec4/core/compute-view/relationships";
14
13
  import { compareNatural, ifind as ifind$1, DefaultMap as DefaultMap$1 } from "@likec4/core/utils";
15
14
  import { modelConnection } from "@likec4/core/model";
@@ -743,26 +742,34 @@ function useCallbackRef(callback) {
743
742
  }), useMemo(() => (...args) => callbackRef.current?.(...args), []);
744
743
  }
745
744
  function useDebouncedCallback$1(callback, options) {
746
- const delay2 = typeof options == "number" ? options : options.delay, flushOnUnmount = typeof options == "number" ? !1 : options.flushOnUnmount, leading = typeof options == "number" ? !1 : options.leading, handleCallback = useCallbackRef(callback), debounceTimerRef = useRef(0), flushRef = useRef(() => {
747
- }), leadingRef = useRef(leading), lastCallback = Object.assign(
748
- useCallback(
745
+ const { delay: delay2, flushOnUnmount, leading } = typeof options == "number" ? { delay: options, flushOnUnmount: !1, leading: !1 } : options, handleCallback = useCallbackRef(callback), debounceTimerRef = useRef(0), lastCallback = useMemo(() => {
746
+ const currentCallback = Object.assign(
749
747
  (...args) => {
750
- if (window.clearTimeout(debounceTimerRef.current), leading && leadingRef.current) {
751
- leadingRef.current = !1, handleCallback(...args);
748
+ window.clearTimeout(debounceTimerRef.current);
749
+ const isFirstCall = currentCallback._isFirstCall;
750
+ if (currentCallback._isFirstCall = !1, leading && isFirstCall) {
751
+ handleCallback(...args);
752
752
  return;
753
753
  }
754
+ function clearTimeoutAndLeadingRef() {
755
+ window.clearTimeout(debounceTimerRef.current), debounceTimerRef.current = 0, currentCallback._isFirstCall = !0;
756
+ }
754
757
  const flush = () => {
755
- debounceTimerRef.current !== 0 && (debounceTimerRef.current = 0, leadingRef.current = !0, handleCallback(...args));
758
+ debounceTimerRef.current !== 0 && (clearTimeoutAndLeadingRef(), handleCallback(...args));
759
+ }, cancel = () => {
760
+ clearTimeoutAndLeadingRef();
756
761
  };
757
- flushRef.current = flush, lastCallback.flush = flush, debounceTimerRef.current = window.setTimeout(flush, delay2), leadingRef.current = !1;
762
+ currentCallback.flush = flush, currentCallback.cancel = cancel, debounceTimerRef.current = window.setTimeout(flush, delay2);
758
763
  },
759
- [handleCallback, delay2, leading]
760
- ),
761
- { flush: flushRef.current }
762
- );
764
+ { flush: () => {
765
+ }, cancel: () => {
766
+ }, _isFirstCall: !0 }
767
+ );
768
+ return currentCallback;
769
+ }, [handleCallback, delay2, leading]);
763
770
  return useEffect(
764
771
  () => () => {
765
- window.clearTimeout(debounceTimerRef.current), flushOnUnmount && lastCallback.flush();
772
+ flushOnUnmount ? lastCallback.flush() : lastCallback.cancel();
766
773
  },
767
774
  [lastCallback, flushOnUnmount]
768
775
  ), lastCallback;
@@ -817,6 +824,19 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
817
824
  function useColorScheme(initialValue, options) {
818
825
  return useMediaQuery("(prefers-color-scheme: dark)", initialValue === "dark", options) ? "dark" : "light";
819
826
  }
827
+ function useDebouncedState(defaultValue, wait, options = { leading: !1 }) {
828
+ const [value, setValue] = useState(defaultValue), timeoutRef = useRef(null), leadingRef = useRef(!0), clearTimeout2 = () => window.clearTimeout(timeoutRef.current);
829
+ useEffect(() => clearTimeout2, []);
830
+ const debouncedSetValue = useCallback(
831
+ (newValue) => {
832
+ clearTimeout2(), leadingRef.current && options.leading ? setValue(newValue) : timeoutRef.current = window.setTimeout(() => {
833
+ leadingRef.current = !0, setValue(newValue);
834
+ }, wait), leadingRef.current = !1;
835
+ },
836
+ [options.leading]
837
+ );
838
+ return [value, debouncedSetValue];
839
+ }
820
840
  function useDebouncedValue(value, wait, options = { leading: !1 }) {
821
841
  const [_value, setValue] = useState(value), mountedRef = useRef(!1), timeoutRef = useRef(null), cooldownRef = useRef(!1), cancel = () => window.clearTimeout(timeoutRef.current);
822
842
  return useEffect(() => {
@@ -1214,8 +1234,9 @@ const keyNameMap = {
1214
1234
  ArrowRight: "arrowright",
1215
1235
  ArrowUp: "arrowup",
1216
1236
  ArrowDown: "arrowdown",
1217
- Escape: "esc",
1218
- Esc: "esc",
1237
+ Escape: "escape",
1238
+ Esc: "escape",
1239
+ esc: "escape",
1219
1240
  Enter: "enter",
1220
1241
  Tab: "tab",
1221
1242
  Backspace: "backspace",
@@ -1361,14 +1382,6 @@ function usePrevious$1(value) {
1361
1382
  ref.current = value;
1362
1383
  }, [value]), ref.current;
1363
1384
  }
1364
- function useInViewport() {
1365
- const observer = useRef(null), [inViewport, setInViewport] = useState(!1);
1366
- return { ref: useCallback((node2) => {
1367
- typeof IntersectionObserver < "u" && (node2 && !observer.current ? observer.current = new IntersectionObserver(
1368
- (entries) => setInViewport(entries.some((entry) => entry.isIntersecting))
1369
- ) : observer.current?.disconnect(), node2 ? observer.current?.observe(node2) : setInViewport(!1));
1370
- }, []), inViewport };
1371
- }
1372
1385
  function useMutationObserver(callback, options, target) {
1373
1386
  const observer = useRef(null), ref = useRef(null);
1374
1387
  return useEffect(() => {
@@ -2860,6 +2873,7 @@ function extractStyleProps(others) {
2860
2873
  pe,
2861
2874
  ps,
2862
2875
  bd,
2876
+ bdrs,
2863
2877
  bg,
2864
2878
  c: c2,
2865
2879
  opacity,
@@ -2947,6 +2961,7 @@ function extractStyleProps(others) {
2947
2961
  inset: inset2,
2948
2962
  display,
2949
2963
  flex,
2964
+ bdrs,
2950
2965
  hiddenFrom,
2951
2966
  visibleFrom,
2952
2967
  lightHidden,
@@ -6838,7 +6853,7 @@ function getDefaultMiddlewares$1(middlewares) {
6838
6853
  }
6839
6854
  function getPopoverMiddlewares(options, getFloating, env) {
6840
6855
  const middlewaresOptions = getDefaultMiddlewares$1(options.middlewares), middlewares = [offset$1(options.offset), hide()];
6841
- return options.dropdownVisible && env !== "test" && (middlewaresOptions.flip = !1, middlewaresOptions.shift = !1), middlewaresOptions.shift && middlewares.push(
6856
+ return options.dropdownVisible && env !== "test" && options.preventPositionChangeWhenVisible && (middlewaresOptions.flip = !1, middlewaresOptions.shift = !1), middlewaresOptions.shift && middlewares.push(
6842
6857
  shift(
6843
6858
  typeof middlewaresOptions.shift == "boolean" ? { limiter: limitShift(), padding: 5 } : { limiter: limitShift(), padding: 5, ...middlewaresOptions.shift }
6844
6859
  )
@@ -6869,13 +6884,30 @@ function usePopover(options) {
6869
6884
  onChange: options.onChange
6870
6885
  }), previouslyOpened = useRef(_opened), onClose = () => {
6871
6886
  _opened && !options.disabled && setOpened(!1);
6872
- }, onToggle = () => !options.disabled && setOpened(!_opened), floating = useFloating({
6887
+ }, onToggle = () => {
6888
+ options.disabled || setOpened(!_opened);
6889
+ }, floating = useFloating({
6873
6890
  strategy: options.strategy,
6874
- placement: options.positionRef.current,
6891
+ placement: options.preventPositionChangeWhenVisible ? options.positionRef.current : options.position,
6875
6892
  middleware: getPopoverMiddlewares(options, () => floating, env),
6876
- whileElementsMounted: autoUpdate
6893
+ // Only use whileElementsMounted when elements are conditionally rendered (not keepMounted)
6894
+ // When keepMounted=true, elements are hidden with CSS and we need manual autoUpdate control
6895
+ whileElementsMounted: options.keepMounted ? void 0 : autoUpdate
6877
6896
  });
6878
- return useDidUpdate(() => {
6897
+ return useEffect(() => {
6898
+ if (!(!options.keepMounted || !floating.refs.reference.current || !floating.refs.floating.current) && _opened)
6899
+ return autoUpdate(
6900
+ floating.refs.reference.current,
6901
+ floating.refs.floating.current,
6902
+ floating.update
6903
+ );
6904
+ }, [
6905
+ options.keepMounted,
6906
+ _opened,
6907
+ floating.refs.reference,
6908
+ floating.refs.floating,
6909
+ floating.update
6910
+ ]), useDidUpdate(() => {
6879
6911
  options.onPositionChange?.(floating.placement), options.positionRef.current = floating.placement;
6880
6912
  }, [floating.placement]), useDidUpdate(() => {
6881
6913
  _opened !== previouslyOpened.current && (_opened ? options.onOpen?.() : options.onClose?.()), previouslyOpened.current = _opened;
@@ -6969,6 +7001,7 @@ function Popover(_props) {
6969
7001
  withOverlay,
6970
7002
  overlayProps,
6971
7003
  hideDetached,
7004
+ preventPositionChangeWhenVisible,
6972
7005
  ...others
6973
7006
  } = props2, getStyles2 = useStyles({
6974
7007
  name: __staticSelector,
@@ -6999,7 +7032,9 @@ function Popover(_props) {
6999
7032
  dropdownVisible,
7000
7033
  setDropdownVisible,
7001
7034
  positionRef,
7002
- disabled
7035
+ disabled,
7036
+ preventPositionChangeWhenVisible,
7037
+ keepMounted
7003
7038
  });
7004
7039
  useClickOutside(
7005
7040
  () => {
@@ -9323,6 +9358,7 @@ function Combobox(_props) {
9323
9358
  Popover,
9324
9359
  {
9325
9360
  opened: store.dropdownOpened,
9361
+ preventPositionChangeWhenVisible: !0,
9326
9362
  ...others,
9327
9363
  onChange: (_opened) => !_opened && onDropdownClose(),
9328
9364
  withRoles: !1,
@@ -13192,7 +13228,7 @@ function TreeNode({
13192
13228
  hasChildren: Array.isArray(node2.children) && node2.children.length > 0,
13193
13229
  elementProps
13194
13230
  }) : /* @__PURE__ */ jsx("div", { ...elementProps, children: node2.label }),
13195
- controller.expandedState[node2.value] && nested.length > 0 && /* @__PURE__ */ jsx("ul", { role: "group", ...getStyles2("subtree"), "data-level": level2, children: nested })
13231
+ controller.expandedState[node2.value] && nested.length > 0 && /* @__PURE__ */ jsx(Box$1, { component: "ul", role: "group", ...getStyles2("subtree"), "data-level": level2, children: nested })
13196
13232
  ]
13197
13233
  }
13198
13234
  );
@@ -15647,6 +15683,20 @@ class BaseRootRoute extends BaseRoute {
15647
15683
  super(options);
15648
15684
  }
15649
15685
  }
15686
+ function stripSearchParams(input2) {
15687
+ return ({ search, next }) => {
15688
+ if (input2 === !0)
15689
+ return {};
15690
+ const result = next(search);
15691
+ return Array.isArray(input2) ? input2.forEach((key2) => {
15692
+ delete result[key2];
15693
+ }) : Object.entries(input2).forEach(
15694
+ ([key2, value]) => {
15695
+ deepEqual$1(result[key2], value) && delete result[key2];
15696
+ }
15697
+ ), result;
15698
+ };
15699
+ }
15650
15700
  function CatchBoundary(props2) {
15651
15701
  const errorComponent = props2.errorComponent ?? ErrorComponent;
15652
15702
  return /* @__PURE__ */ jsx(
@@ -16779,8 +16829,7 @@ function Fallback$1({ error, resetErrorBoundary }) {
16779
16829
  {
16780
16830
  onClick: () => {
16781
16831
  resetErrorBoundary(), router.navigate({
16782
- to: "/",
16783
- search: !0
16832
+ to: "/"
16784
16833
  });
16785
16834
  },
16786
16835
  variant: "light",
@@ -17159,10 +17208,9 @@ function NotFound() {
17159
17208
  }
17160
17209
  const asTheme = (v) => {
17161
17210
  if (typeof v != "string")
17162
- return;
17211
+ return "auto";
17163
17212
  const vlower = v.toLowerCase();
17164
- if (vlower === "light" || vlower === "dark")
17165
- return vlower;
17213
+ return vlower === "light" || vlower === "dark" ? vlower : "auto";
17166
17214
  }, asPadding = (v) => {
17167
17215
  switch (!0) {
17168
17216
  case typeof v == "number":
@@ -17170,17 +17218,38 @@ const asTheme = (v) => {
17170
17218
  case typeof v == "string":
17171
17219
  return Math.round(parseFloat(v));
17172
17220
  }
17221
+ return 20;
17173
17222
  }, Route$m = createRootRouteWithContext()({
17174
- // component: RootComponent,
17223
+ component: RootComponent,
17175
17224
  validateSearch: (search) => ({
17176
17225
  padding: asPadding(search.padding),
17177
17226
  theme: asTheme(search.theme)
17178
- })
17179
- }), Route$l = createFileRoute("/projects")({
17227
+ }),
17228
+ search: {
17229
+ middlewares: [
17230
+ stripSearchParams({
17231
+ padding: 20,
17232
+ theme: "auto"
17233
+ })
17234
+ ]
17235
+ }
17236
+ });
17237
+ function RootComponent() {
17238
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
17239
+ /* @__PURE__ */ jsx(Outlet, {}),
17240
+ /* @__PURE__ */ jsx(ThemeSync, {})
17241
+ ] });
17242
+ }
17243
+ const ThemeSync = () => {
17244
+ const { theme: theme2 } = Route$m.useSearch(), mantineColorScheme = useMantineColorScheme();
17245
+ return useEffect(() => {
17246
+ theme2 && theme2 !== mantineColorScheme.colorScheme && mantineColorScheme.setColorScheme(theme2);
17247
+ }, [theme2]), null;
17248
+ }, Route$l = createFileRoute("/projects")({
17180
17249
  component: RouteComponent$3
17181
17250
  });
17182
17251
  function RouteComponent$3() {
17183
- return useDocumentTitle("LikeC4 Projects"), /* @__PURE__ */ jsx(Container, { size: "xs", py: "lg", children: /* @__PURE__ */ jsxs(Stack, { children: [
17252
+ return useDocumentTitle(`Projects - ${pageTitle}`), /* @__PURE__ */ jsx(Container, { size: "xs", py: "lg", children: /* @__PURE__ */ jsxs(Stack, { children: [
17184
17253
  /* @__PURE__ */ jsx(Text, { fz: "lg", children: "Select a project" }),
17185
17254
  projects.map((v) => /* @__PURE__ */ jsx(
17186
17255
  Button,
@@ -22920,13 +22989,13 @@ function creator(name) {
22920
22989
  }
22921
22990
  function none() {
22922
22991
  }
22923
- function selector$p(selector3) {
22992
+ function selector$q(selector3) {
22924
22993
  return selector3 == null ? none : function() {
22925
22994
  return this.querySelector(selector3);
22926
22995
  };
22927
22996
  }
22928
22997
  function selection_select(select2) {
22929
- typeof select2 != "function" && (select2 = selector$p(select2));
22998
+ typeof select2 != "function" && (select2 = selector$q(select2));
22930
22999
  for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2)
22931
23000
  for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2)
22932
23001
  (node2 = group[i2]) && (subnode = select2.call(node2, node2.__data__, i2, group)) && ("__data__" in node2 && (subnode.__data__ = node2.__data__), subgroup[i2] = subnode);
@@ -23317,7 +23386,7 @@ function constantNull() {
23317
23386
  return null;
23318
23387
  }
23319
23388
  function selection_insert(name, before) {
23320
- var create2 = typeof name == "function" ? name : creator(name), select2 = before == null ? constantNull : typeof before == "function" ? before : selector$p(before);
23389
+ var create2 = typeof name == "function" ? name : creator(name), select2 = before == null ? constantNull : typeof before == "function" ? before : selector$q(before);
23321
23390
  return this.select(function() {
23322
23391
  return this.insertBefore(create2.apply(this, arguments), select2.apply(this, arguments) || null);
23323
23392
  });
@@ -24471,7 +24540,7 @@ function transition_remove() {
24471
24540
  }
24472
24541
  function transition_select(select2) {
24473
24542
  var name = this._name, id2 = this._id;
24474
- typeof select2 != "function" && (select2 = selector$p(select2));
24543
+ typeof select2 != "function" && (select2 = selector$q(select2));
24475
24544
  for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2)
24476
24545
  for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2)
24477
24546
  (node2 = group[i2]) && (subnode = select2.call(node2, node2.__data__, i2, group)) && ("__data__" in node2 && (subnode.__data__ = node2.__data__), subgroup[i2] = subnode, schedule(subgroup[i2], name, id2, i2, subgroup, get(node2, id2)));
@@ -28830,9 +28899,9 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
28830
28899
  return jsx("div", { className: cc(["react-flow__resize-control", "nodrag", ...positionClassNames, variant, className]), ref: resizeControlRef, style: controlStyle, children: children2 });
28831
28900
  }
28832
28901
  memo$2(ResizeControl);
28833
- const selector$5 = (state) => state.domNode?.querySelector(".react-flow__renderer");
28902
+ const selector$p = (state) => state.domNode?.querySelector(".react-flow__renderer");
28834
28903
  function NodeToolbarPortal({ children: children2 }) {
28835
- const wrapperRef = useStore$1(selector$5);
28904
+ const wrapperRef = useStore$1(selector$p);
28836
28905
  return wrapperRef ? createPortal(children2, wrapperRef) : null;
28837
28906
  }
28838
28907
  const nodeEqualityFn = (a2, b2) => a2?.internals.positionAbsolute.x !== b2?.internals.positionAbsolute.x || a2?.internals.positionAbsolute.y !== b2?.internals.positionAbsolute.y || a2?.measured.width !== b2?.measured.width || a2?.measured.height !== b2?.measured.height || a2?.selected !== b2?.selected || a2?.internals.z !== b2?.internals.z, nodesEqualityFn = (a2, b2) => {
@@ -28920,7 +28989,7 @@ function useCustomCompareEffect(callback, deps, comparator = basicDepsComparator
28920
28989
  function useDebouncedEffect(callback, deps, delay2, maxWait = 0) {
28921
28990
  useEffect(useDebouncedCallback(callback, deps, delay2, maxWait), deps);
28922
28991
  }
28923
- const { valueOf, toString: toString$1 } = Object.prototype, isEqual = (a2, b2) => {
28992
+ const { valueOf, toString } = Object.prototype, isEqual = (a2, b2) => {
28924
28993
  const visited = /* @__PURE__ */ new WeakMap(), inner2 = (a3, b3) => {
28925
28994
  if (a3 === b3)
28926
28995
  return !0;
@@ -28969,7 +29038,7 @@ const { valueOf, toString: toString$1 } = Object.prototype, isEqual = (a2, b2) =
28969
29038
  }
28970
29039
  if (a3.valueOf !== valueOf && typeof a3.valueOf == "function" && typeof b3.valueOf == "function")
28971
29040
  return a3.valueOf() === b3.valueOf();
28972
- if (a3.toString !== toString$1 && typeof a3.toString == "function" && typeof b3.toString == "function")
29041
+ if (a3.toString !== toString && typeof a3.toString == "function" && typeof b3.toString == "function")
28973
29042
  return a3.toString() === b3.toString();
28974
29043
  const aKeys = Object.keys(a3);
28975
29044
  let key2;
@@ -31354,7 +31423,7 @@ const cssTransparentBg = css({
31354
31423
  const square = useStore$1(selectDimensions);
31355
31424
  return useUpdateEffect(onViewportResize, [square]), null;
31356
31425
  };
31357
- var xstateReact_cjs = {}, xstate_cjs = {}, xstateActors_cjs = {}, raiseCbaedcda_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
31426
+ var xstateReact_cjs = {}, xstate_cjs = {}, xstateActors_cjs = {}, raise5872b9e8_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
31358
31427
  function requireXstateDev_cjs() {
31359
31428
  if (hasRequiredXstateDev_cjs) return xstateDev_cjs;
31360
31429
  hasRequiredXstateDev_cjs = 1, Object.defineProperty(xstateDev_cjs, "__esModule", { value: !0 });
@@ -31387,10 +31456,10 @@ function requireXstateDev_cjs() {
31387
31456
  };
31388
31457
  return xstateDev_cjs.devToolsAdapter = devToolsAdapter, xstateDev_cjs.getGlobal = getGlobal, xstateDev_cjs.registerService = registerService, xstateDev_cjs;
31389
31458
  }
31390
- var hasRequiredRaiseCbaedcda_cjs;
31391
- function requireRaiseCbaedcda_cjs() {
31392
- if (hasRequiredRaiseCbaedcda_cjs) return raiseCbaedcda_cjs;
31393
- hasRequiredRaiseCbaedcda_cjs = 1;
31459
+ var hasRequiredRaise5872b9e8_cjs;
31460
+ function requireRaise5872b9e8_cjs() {
31461
+ if (hasRequiredRaise5872b9e8_cjs) return raise5872b9e8_cjs;
31462
+ hasRequiredRaise5872b9e8_cjs = 1;
31394
31463
  var dev_dist_xstateDev = requireXstateDev_cjs();
31395
31464
  class Mailbox {
31396
31465
  constructor(_process) {
@@ -33063,13 +33132,13 @@ ${err.message}`);
33063
33132
  }
33064
33133
  return raise3.type = "xstate.raise", raise3.event = eventOrExpr, raise3.id = options?.id, raise3.delay = options?.delay, raise3.resolve = resolveRaise, raise3.execute = executeRaise, raise3;
33065
33134
  }
33066
- return raiseCbaedcda_cjs.$$ACTOR_TYPE = $$ACTOR_TYPE, raiseCbaedcda_cjs.Actor = Actor, raiseCbaedcda_cjs.NULL_EVENT = NULL_EVENT, raiseCbaedcda_cjs.ProcessingStatus = ProcessingStatus, raiseCbaedcda_cjs.STATE_DELIMITER = STATE_DELIMITER, raiseCbaedcda_cjs.XSTATE_ERROR = XSTATE_ERROR, raiseCbaedcda_cjs.XSTATE_STOP = XSTATE_STOP, raiseCbaedcda_cjs.and = and, raiseCbaedcda_cjs.cancel = cancel, raiseCbaedcda_cjs.cloneMachineSnapshot = cloneMachineSnapshot, raiseCbaedcda_cjs.createActor = createActor, raiseCbaedcda_cjs.createErrorActorEvent = createErrorActorEvent, raiseCbaedcda_cjs.createInitEvent = createInitEvent, raiseCbaedcda_cjs.createInvokeId = createInvokeId, raiseCbaedcda_cjs.createMachineSnapshot = createMachineSnapshot, raiseCbaedcda_cjs.evaluateGuard = evaluateGuard, raiseCbaedcda_cjs.formatInitialTransition = formatInitialTransition, raiseCbaedcda_cjs.formatTransition = formatTransition, raiseCbaedcda_cjs.formatTransitions = formatTransitions, raiseCbaedcda_cjs.getAllOwnEventDescriptors = getAllOwnEventDescriptors, raiseCbaedcda_cjs.getAllStateNodes = getAllStateNodes, raiseCbaedcda_cjs.getCandidates = getCandidates, raiseCbaedcda_cjs.getDelayedTransitions = getDelayedTransitions, raiseCbaedcda_cjs.getInitialStateNodes = getInitialStateNodes, raiseCbaedcda_cjs.getPersistedSnapshot = getPersistedSnapshot, raiseCbaedcda_cjs.getStateNodeByPath = getStateNodeByPath, raiseCbaedcda_cjs.getStateNodes = getStateNodes, raiseCbaedcda_cjs.interpret = interpret, raiseCbaedcda_cjs.isInFinalState = isInFinalState, raiseCbaedcda_cjs.isMachineSnapshot = isMachineSnapshot, raiseCbaedcda_cjs.isStateId = isStateId, raiseCbaedcda_cjs.macrostep = macrostep, raiseCbaedcda_cjs.mapValues = mapValues, raiseCbaedcda_cjs.matchesState = matchesState, raiseCbaedcda_cjs.microstep = microstep, raiseCbaedcda_cjs.not = not, raiseCbaedcda_cjs.or = or, raiseCbaedcda_cjs.pathToStateValue = pathToStateValue, raiseCbaedcda_cjs.raise = raise2, raiseCbaedcda_cjs.resolveActionsAndContext = resolveActionsAndContext, raiseCbaedcda_cjs.resolveReferencedActor = resolveReferencedActor, raiseCbaedcda_cjs.resolveStateValue = resolveStateValue, raiseCbaedcda_cjs.spawnChild = spawnChild, raiseCbaedcda_cjs.stateIn = stateIn, raiseCbaedcda_cjs.stop = stop, raiseCbaedcda_cjs.stopChild = stopChild, raiseCbaedcda_cjs.toArray = toArray2, raiseCbaedcda_cjs.toObserver = toObserver, raiseCbaedcda_cjs.toStatePath = toStatePath, raiseCbaedcda_cjs.toTransitionConfigArray = toTransitionConfigArray, raiseCbaedcda_cjs.transitionNode = transitionNode, raiseCbaedcda_cjs;
33135
+ return raise5872b9e8_cjs.$$ACTOR_TYPE = $$ACTOR_TYPE, raise5872b9e8_cjs.Actor = Actor, raise5872b9e8_cjs.NULL_EVENT = NULL_EVENT, raise5872b9e8_cjs.ProcessingStatus = ProcessingStatus, raise5872b9e8_cjs.STATE_DELIMITER = STATE_DELIMITER, raise5872b9e8_cjs.XSTATE_ERROR = XSTATE_ERROR, raise5872b9e8_cjs.XSTATE_STOP = XSTATE_STOP, raise5872b9e8_cjs.and = and, raise5872b9e8_cjs.cancel = cancel, raise5872b9e8_cjs.cloneMachineSnapshot = cloneMachineSnapshot, raise5872b9e8_cjs.createActor = createActor, raise5872b9e8_cjs.createErrorActorEvent = createErrorActorEvent, raise5872b9e8_cjs.createInitEvent = createInitEvent, raise5872b9e8_cjs.createInvokeId = createInvokeId, raise5872b9e8_cjs.createMachineSnapshot = createMachineSnapshot, raise5872b9e8_cjs.evaluateGuard = evaluateGuard, raise5872b9e8_cjs.formatInitialTransition = formatInitialTransition, raise5872b9e8_cjs.formatTransition = formatTransition, raise5872b9e8_cjs.formatTransitions = formatTransitions, raise5872b9e8_cjs.getAllOwnEventDescriptors = getAllOwnEventDescriptors, raise5872b9e8_cjs.getAllStateNodes = getAllStateNodes, raise5872b9e8_cjs.getCandidates = getCandidates, raise5872b9e8_cjs.getDelayedTransitions = getDelayedTransitions, raise5872b9e8_cjs.getInitialStateNodes = getInitialStateNodes, raise5872b9e8_cjs.getPersistedSnapshot = getPersistedSnapshot, raise5872b9e8_cjs.getStateNodeByPath = getStateNodeByPath, raise5872b9e8_cjs.getStateNodes = getStateNodes, raise5872b9e8_cjs.interpret = interpret, raise5872b9e8_cjs.isInFinalState = isInFinalState, raise5872b9e8_cjs.isMachineSnapshot = isMachineSnapshot, raise5872b9e8_cjs.isStateId = isStateId, raise5872b9e8_cjs.macrostep = macrostep, raise5872b9e8_cjs.mapValues = mapValues, raise5872b9e8_cjs.matchesState = matchesState, raise5872b9e8_cjs.microstep = microstep, raise5872b9e8_cjs.not = not, raise5872b9e8_cjs.or = or, raise5872b9e8_cjs.pathToStateValue = pathToStateValue, raise5872b9e8_cjs.raise = raise2, raise5872b9e8_cjs.resolveActionsAndContext = resolveActionsAndContext, raise5872b9e8_cjs.resolveReferencedActor = resolveReferencedActor, raise5872b9e8_cjs.resolveStateValue = resolveStateValue, raise5872b9e8_cjs.spawnChild = spawnChild, raise5872b9e8_cjs.stateIn = stateIn, raise5872b9e8_cjs.stop = stop, raise5872b9e8_cjs.stopChild = stopChild, raise5872b9e8_cjs.toArray = toArray2, raise5872b9e8_cjs.toObserver = toObserver, raise5872b9e8_cjs.toStatePath = toStatePath, raise5872b9e8_cjs.toTransitionConfigArray = toTransitionConfigArray, raise5872b9e8_cjs.transitionNode = transitionNode, raise5872b9e8_cjs;
33067
33136
  }
33068
33137
  var hasRequiredXstateActors_cjs;
33069
33138
  function requireXstateActors_cjs() {
33070
33139
  if (hasRequiredXstateActors_cjs) return xstateActors_cjs;
33071
33140
  hasRequiredXstateActors_cjs = 1, Object.defineProperty(xstateActors_cjs, "__esModule", { value: !0 });
33072
- var guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs();
33141
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs();
33073
33142
  requireXstateDev_cjs();
33074
33143
  function fromTransition(transition, initialContext) {
33075
33144
  return {
@@ -33376,11 +33445,11 @@ function requireXstateActors_cjs() {
33376
33445
  }
33377
33446
  return xstateActors_cjs.createEmptyActor = createEmptyActor, xstateActors_cjs.fromCallback = fromCallback, xstateActors_cjs.fromEventObservable = fromEventObservable, xstateActors_cjs.fromObservable = fromObservable, xstateActors_cjs.fromPromise = fromPromise, xstateActors_cjs.fromTransition = fromTransition, xstateActors_cjs;
33378
33447
  }
33379
- var log179b5431_cjs = {}, hasRequiredLog179b5431_cjs;
33380
- function requireLog179b5431_cjs() {
33381
- if (hasRequiredLog179b5431_cjs) return log179b5431_cjs;
33382
- hasRequiredLog179b5431_cjs = 1;
33383
- var guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs();
33448
+ var StateMachine1cda96d3_cjs = {}, assignE9c344ea_cjs = {}, hasRequiredAssignE9c344ea_cjs;
33449
+ function requireAssignE9c344ea_cjs() {
33450
+ if (hasRequiredAssignE9c344ea_cjs) return assignE9c344ea_cjs;
33451
+ hasRequiredAssignE9c344ea_cjs = 1;
33452
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs();
33384
33453
  function createSpawner(actorScope, {
33385
33454
  machine,
33386
33455
  context: context2
@@ -33454,177 +33523,13 @@ function requireLog179b5431_cjs() {
33454
33523
  }
33455
33524
  return assign3.type = "xstate.assign", assign3.assignment = assignment, assign3.resolve = resolveAssign, assign3;
33456
33525
  }
33457
- function resolveEmit(_, snapshot, args, actionParams, {
33458
- event: eventOrExpr
33459
- }) {
33460
- const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33461
- return [snapshot, {
33462
- event: resolvedEvent
33463
- }, void 0];
33464
- }
33465
- function executeEmit(actorScope, {
33466
- event
33467
- }) {
33468
- actorScope.defer(() => actorScope.emit(event));
33469
- }
33470
- function emit2(eventOrExpr) {
33471
- function emit3(_args, _params) {
33472
- }
33473
- return emit3.type = "xstate.emit", emit3.event = eventOrExpr, emit3.resolve = resolveEmit, emit3.execute = executeEmit, emit3;
33474
- }
33475
- let SpecialTargets = /* @__PURE__ */ function(SpecialTargets2) {
33476
- return SpecialTargets2.Parent = "#_parent", SpecialTargets2.Internal = "#_internal", SpecialTargets2;
33477
- }({});
33478
- function resolveSendTo(actorScope, snapshot, args, actionParams, {
33479
- to,
33480
- event: eventOrExpr,
33481
- id: id2,
33482
- delay: delay2
33483
- }, extra) {
33484
- const delaysMap = snapshot.machine.implementations.delays;
33485
- if (typeof eventOrExpr == "string")
33486
- throw new Error(
33487
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
33488
- `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`
33489
- );
33490
- const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33491
- let resolvedDelay;
33492
- if (typeof delay2 == "string") {
33493
- const configDelay = delaysMap && delaysMap[delay2];
33494
- resolvedDelay = typeof configDelay == "function" ? configDelay(args, actionParams) : configDelay;
33495
- } else
33496
- resolvedDelay = typeof delay2 == "function" ? delay2(args, actionParams) : delay2;
33497
- const resolvedTarget = typeof to == "function" ? to(args, actionParams) : to;
33498
- let targetActorRef;
33499
- if (typeof resolvedTarget == "string") {
33500
- if (resolvedTarget === SpecialTargets.Parent ? targetActorRef = actorScope.self._parent : resolvedTarget === SpecialTargets.Internal ? targetActorRef = actorScope.self : resolvedTarget.startsWith("#_") ? targetActorRef = snapshot.children[resolvedTarget.slice(2)] : targetActorRef = extra.deferredActorIds?.includes(resolvedTarget) ? resolvedTarget : snapshot.children[resolvedTarget], !targetActorRef)
33501
- throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${snapshot.machine.id}'.`);
33502
- } else
33503
- targetActorRef = resolvedTarget || actorScope.self;
33504
- return [snapshot, {
33505
- to: targetActorRef,
33506
- targetId: typeof resolvedTarget == "string" ? resolvedTarget : void 0,
33507
- event: resolvedEvent,
33508
- id: id2,
33509
- delay: resolvedDelay
33510
- }, void 0];
33511
- }
33512
- function retryResolveSendTo(_, snapshot, params) {
33513
- typeof params.to == "string" && (params.to = snapshot.children[params.to]);
33514
- }
33515
- function executeSendTo(actorScope, params) {
33516
- actorScope.defer(() => {
33517
- const {
33518
- to,
33519
- event,
33520
- delay: delay2,
33521
- id: id2
33522
- } = params;
33523
- if (typeof delay2 == "number") {
33524
- actorScope.system.scheduler.schedule(actorScope.self, to, event, delay2, id2);
33525
- return;
33526
- }
33527
- actorScope.system._relay(
33528
- actorScope.self,
33529
- // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
33530
- // if it initially started as a string
33531
- to,
33532
- event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event
33533
- );
33534
- });
33535
- }
33536
- function sendTo(to, eventOrExpr, options) {
33537
- function sendTo2(_args, _params) {
33538
- }
33539
- return sendTo2.type = "xstate.sendTo", sendTo2.to = to, sendTo2.event = eventOrExpr, sendTo2.id = options?.id, sendTo2.delay = options?.delay, sendTo2.resolve = resolveSendTo, sendTo2.retryResolve = retryResolveSendTo, sendTo2.execute = executeSendTo, sendTo2;
33540
- }
33541
- function sendParent(event, options) {
33542
- return sendTo(SpecialTargets.Parent, event, options);
33543
- }
33544
- function forwardTo(target, options) {
33545
- return sendTo(target, ({
33546
- event
33547
- }) => event, options);
33548
- }
33549
- function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
33550
- collect
33551
- }) {
33552
- const actions = [], enqueue = function(action) {
33553
- actions.push(action);
33554
- };
33555
- return enqueue.assign = (...args2) => {
33556
- actions.push(assign2(...args2));
33557
- }, enqueue.cancel = (...args2) => {
33558
- actions.push(guards_dist_xstateGuards.cancel(...args2));
33559
- }, enqueue.raise = (...args2) => {
33560
- actions.push(guards_dist_xstateGuards.raise(...args2));
33561
- }, enqueue.sendTo = (...args2) => {
33562
- actions.push(sendTo(...args2));
33563
- }, enqueue.sendParent = (...args2) => {
33564
- actions.push(sendParent(...args2));
33565
- }, enqueue.spawnChild = (...args2) => {
33566
- actions.push(guards_dist_xstateGuards.spawnChild(...args2));
33567
- }, enqueue.stopChild = (...args2) => {
33568
- actions.push(guards_dist_xstateGuards.stopChild(...args2));
33569
- }, enqueue.emit = (...args2) => {
33570
- actions.push(emit2(...args2));
33571
- }, collect({
33572
- context: args.context,
33573
- event: args.event,
33574
- enqueue,
33575
- check: (guard) => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
33576
- self: actorScope.self,
33577
- system: actorScope.system
33578
- }, actionParams), [snapshot, void 0, actions];
33579
- }
33580
- function enqueueActions(collect) {
33581
- function enqueueActions2(_args, _params) {
33582
- }
33583
- return enqueueActions2.type = "xstate.enqueueActions", enqueueActions2.collect = collect, enqueueActions2.resolve = resolveEnqueueActions, enqueueActions2;
33584
- }
33585
- function resolveLog(_, snapshot, actionArgs, actionParams, {
33586
- value,
33587
- label: label2
33588
- }) {
33589
- return [snapshot, {
33590
- value: typeof value == "function" ? value(actionArgs, actionParams) : value,
33591
- label: label2
33592
- }, void 0];
33593
- }
33594
- function executeLog({
33595
- logger
33596
- }, {
33597
- value,
33598
- label: label2
33599
- }) {
33600
- label2 ? logger(label2, value) : logger(value);
33601
- }
33602
- function log(value = ({
33603
- context: context2,
33604
- event
33605
- }) => ({
33606
- context: context2,
33607
- event
33608
- }), label2) {
33609
- function log2(_args, _params) {
33610
- }
33611
- return log2.type = "xstate.log", log2.value = value, log2.label = label2, log2.resolve = resolveLog, log2.execute = executeLog, log2;
33612
- }
33613
- return log179b5431_cjs.SpecialTargets = SpecialTargets, log179b5431_cjs.assign = assign2, log179b5431_cjs.emit = emit2, log179b5431_cjs.enqueueActions = enqueueActions, log179b5431_cjs.forwardTo = forwardTo, log179b5431_cjs.log = log, log179b5431_cjs.sendParent = sendParent, log179b5431_cjs.sendTo = sendTo, log179b5431_cjs;
33526
+ return assignE9c344ea_cjs.assign = assign2, assignE9c344ea_cjs;
33614
33527
  }
33615
- var hasRequiredXstate_cjs;
33616
- function requireXstate_cjs() {
33617
- if (hasRequiredXstate_cjs) return xstate_cjs;
33618
- hasRequiredXstate_cjs = 1, Object.defineProperty(xstate_cjs, "__esModule", { value: !0 });
33619
- var actors_dist_xstateActors = requireXstateActors_cjs(), guards_dist_xstateGuards = /* @__PURE__ */ requireRaiseCbaedcda_cjs(), log = /* @__PURE__ */ requireLog179b5431_cjs();
33620
- requireXstateDev_cjs();
33621
- function assertEvent(event, type) {
33622
- const types = guards_dist_xstateGuards.toArray(type);
33623
- if (!types.includes(event.type)) {
33624
- const typesText = types.length === 1 ? `type "${types[0]}"` : `one of types "${types.join('", "')}"`;
33625
- throw new Error(`Expected event ${JSON.stringify(event)} to have ${typesText}`);
33626
- }
33627
- }
33528
+ var hasRequiredStateMachine1cda96d3_cjs;
33529
+ function requireStateMachine1cda96d3_cjs() {
33530
+ if (hasRequiredStateMachine1cda96d3_cjs) return StateMachine1cda96d3_cjs;
33531
+ hasRequiredStateMachine1cda96d3_cjs = 1;
33532
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
33628
33533
  const cache = /* @__PURE__ */ new WeakMap();
33629
33534
  function memo2(object, key2, fn) {
33630
33535
  let memoizedData = cache.get(object);
@@ -33726,7 +33631,7 @@ function requireXstate_cjs() {
33726
33631
  }
33727
33632
  /** The mapping of events to transitions. */
33728
33633
  get on() {
33729
- return memo2(this, "on", () => [...this.transitions].flatMap(([descriptor, t2]) => t2.map((t3) => [descriptor, t3])).reduce((map, [descriptor, transition2]) => (map[descriptor] = map[descriptor] || [], map[descriptor].push(transition2), map), {}));
33634
+ return memo2(this, "on", () => [...this.transitions].flatMap(([descriptor, t2]) => t2.map((t3) => [descriptor, t3])).reduce((map, [descriptor, transition]) => (map[descriptor] = map[descriptor] || [], map[descriptor].push(transition), map), {}));
33730
33635
  }
33731
33636
  get after() {
33732
33637
  return memo2(this, "delayedTransitions", () => guards_dist_xstateGuards.getDelayedTransitions(this));
@@ -33780,7 +33685,7 @@ ${err.message}`);
33780
33685
  * Excludes any inert events.
33781
33686
  */
33782
33687
  get ownEvents() {
33783
- const events = new Set([...this.transitions.keys()].filter((descriptor) => this.transitions.get(descriptor).some((transition2) => !(!transition2.target && !transition2.actions.length && !transition2.reenter))));
33688
+ const events = new Set([...this.transitions.keys()].filter((descriptor) => this.transitions.get(descriptor).some((transition) => !(!transition.target && !transition.actions.length && !transition.reenter))));
33784
33689
  return Array.from(events);
33785
33690
  }
33786
33691
  }
@@ -33798,11 +33703,10 @@ ${err.message}`);
33798
33703
  }), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
33799
33704
  }
33800
33705
  /**
33801
- * Clones this state machine with the provided implementations and merges the
33802
- * `context` (if provided).
33706
+ * Clones this state machine with the provided implementations.
33803
33707
  *
33804
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`,
33805
- * `context`) to recursively merge with the existing options.
33708
+ * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
33709
+ * recursively merge with the existing options.
33806
33710
  * @returns A new `StateMachine` instance with the provided implementations.
33807
33711
  */
33808
33712
  provide(implementations) {
@@ -33889,7 +33793,7 @@ ${err.message}`);
33889
33793
  input: event.input,
33890
33794
  self: self2
33891
33795
  });
33892
- return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [log.assign(assignment)], internalQueue, void 0);
33796
+ return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [assign2.assign(assignment)], internalQueue, void 0);
33893
33797
  }
33894
33798
  return preInitial;
33895
33799
  }
@@ -33947,33 +33851,28 @@ ${err.message}`);
33947
33851
  });
33948
33852
  children2[actorId] = actorRef;
33949
33853
  });
33950
- function resolveStateNodeFromIdOrPath(idOrPath, root2) {
33854
+ function resolveHistoryReferencedState(root2, referenced) {
33855
+ if (referenced instanceof StateNode)
33856
+ return referenced;
33951
33857
  try {
33952
- return root2.machine.getStateNodeById(idOrPath);
33858
+ return root2.machine.getStateNodeById(referenced.id);
33953
33859
  } catch {
33954
- try {
33955
- return guards_dist_xstateGuards.getStateNodeByPath(root2, idOrPath.split("."));
33956
- } catch {
33957
- return idOrPath;
33958
- }
33959
33860
  }
33960
33861
  }
33961
- function reviveHistoryValue(historyValue, root2) {
33962
- if (!historyValue || typeof historyValue != "object") return {};
33862
+ function reviveHistoryValue(root2, historyValue) {
33863
+ if (!historyValue || typeof historyValue != "object")
33864
+ return {};
33963
33865
  const revived = {};
33964
33866
  for (const key2 in historyValue) {
33965
33867
  const arr = historyValue[key2];
33966
- revived[key2] = arr.map((item) => {
33967
- if (item instanceof StateNode) return item;
33968
- if (typeof item == "object" && "id" in item && typeof item.id == "string") {
33969
- const resolved = resolveStateNodeFromIdOrPath(item.id, root2);
33970
- if (resolved instanceof StateNode) return resolved;
33971
- }
33972
- }).filter((item) => item !== void 0), revived[key2].length === 0 && delete revived[key2];
33868
+ for (const item of arr) {
33869
+ const resolved = resolveHistoryReferencedState(root2, item);
33870
+ resolved && (revived[key2] ??= [], revived[key2].push(resolved));
33871
+ }
33973
33872
  }
33974
33873
  return revived;
33975
33874
  }
33976
- const revivedHistoryValue = reviveHistoryValue(snapshot.historyValue, this.root), restoredSnapshot = guards_dist_xstateGuards.createMachineSnapshot({
33875
+ const revivedHistoryValue = reviveHistoryValue(this.root, snapshot.historyValue), restoredSnapshot = guards_dist_xstateGuards.createMachineSnapshot({
33977
33876
  ...snapshot,
33978
33877
  children: children2,
33979
33878
  _nodes: Array.from(guards_dist_xstateGuards.getAllStateNodes(guards_dist_xstateGuards.getStateNodes(this.root, snapshot.value))),
@@ -33997,8 +33896,186 @@ ${err.message}`);
33997
33896
  return reviveContext(restoredSnapshot.context, children2), restoredSnapshot;
33998
33897
  }
33999
33898
  }
33899
+ return StateMachine1cda96d3_cjs.StateMachine = StateMachine, StateMachine1cda96d3_cjs.StateNode = StateNode, StateMachine1cda96d3_cjs;
33900
+ }
33901
+ var log215998b6_cjs = {}, hasRequiredLog215998b6_cjs;
33902
+ function requireLog215998b6_cjs() {
33903
+ if (hasRequiredLog215998b6_cjs) return log215998b6_cjs;
33904
+ hasRequiredLog215998b6_cjs = 1;
33905
+ var guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
33906
+ function resolveEmit(_, snapshot, args, actionParams, {
33907
+ event: eventOrExpr
33908
+ }) {
33909
+ const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33910
+ return [snapshot, {
33911
+ event: resolvedEvent
33912
+ }, void 0];
33913
+ }
33914
+ function executeEmit(actorScope, {
33915
+ event
33916
+ }) {
33917
+ actorScope.defer(() => actorScope.emit(event));
33918
+ }
33919
+ function emit2(eventOrExpr) {
33920
+ function emit3(_args, _params) {
33921
+ }
33922
+ return emit3.type = "xstate.emit", emit3.event = eventOrExpr, emit3.resolve = resolveEmit, emit3.execute = executeEmit, emit3;
33923
+ }
33924
+ let SpecialTargets = /* @__PURE__ */ function(SpecialTargets2) {
33925
+ return SpecialTargets2.Parent = "#_parent", SpecialTargets2.Internal = "#_internal", SpecialTargets2;
33926
+ }({});
33927
+ function resolveSendTo(actorScope, snapshot, args, actionParams, {
33928
+ to,
33929
+ event: eventOrExpr,
33930
+ id: id2,
33931
+ delay: delay2
33932
+ }, extra) {
33933
+ const delaysMap = snapshot.machine.implementations.delays;
33934
+ if (typeof eventOrExpr == "string")
33935
+ throw new Error(
33936
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
33937
+ `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`
33938
+ );
33939
+ const resolvedEvent = typeof eventOrExpr == "function" ? eventOrExpr(args, actionParams) : eventOrExpr;
33940
+ let resolvedDelay;
33941
+ if (typeof delay2 == "string") {
33942
+ const configDelay = delaysMap && delaysMap[delay2];
33943
+ resolvedDelay = typeof configDelay == "function" ? configDelay(args, actionParams) : configDelay;
33944
+ } else
33945
+ resolvedDelay = typeof delay2 == "function" ? delay2(args, actionParams) : delay2;
33946
+ const resolvedTarget = typeof to == "function" ? to(args, actionParams) : to;
33947
+ let targetActorRef;
33948
+ if (typeof resolvedTarget == "string") {
33949
+ if (resolvedTarget === SpecialTargets.Parent ? targetActorRef = actorScope.self._parent : resolvedTarget === SpecialTargets.Internal ? targetActorRef = actorScope.self : resolvedTarget.startsWith("#_") ? targetActorRef = snapshot.children[resolvedTarget.slice(2)] : targetActorRef = extra.deferredActorIds?.includes(resolvedTarget) ? resolvedTarget : snapshot.children[resolvedTarget], !targetActorRef)
33950
+ throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${snapshot.machine.id}'.`);
33951
+ } else
33952
+ targetActorRef = resolvedTarget || actorScope.self;
33953
+ return [snapshot, {
33954
+ to: targetActorRef,
33955
+ targetId: typeof resolvedTarget == "string" ? resolvedTarget : void 0,
33956
+ event: resolvedEvent,
33957
+ id: id2,
33958
+ delay: resolvedDelay
33959
+ }, void 0];
33960
+ }
33961
+ function retryResolveSendTo(_, snapshot, params) {
33962
+ typeof params.to == "string" && (params.to = snapshot.children[params.to]);
33963
+ }
33964
+ function executeSendTo(actorScope, params) {
33965
+ actorScope.defer(() => {
33966
+ const {
33967
+ to,
33968
+ event,
33969
+ delay: delay2,
33970
+ id: id2
33971
+ } = params;
33972
+ if (typeof delay2 == "number") {
33973
+ actorScope.system.scheduler.schedule(actorScope.self, to, event, delay2, id2);
33974
+ return;
33975
+ }
33976
+ actorScope.system._relay(
33977
+ actorScope.self,
33978
+ // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
33979
+ // if it initially started as a string
33980
+ to,
33981
+ event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event
33982
+ );
33983
+ });
33984
+ }
33985
+ function sendTo(to, eventOrExpr, options) {
33986
+ function sendTo2(_args, _params) {
33987
+ }
33988
+ return sendTo2.type = "xstate.sendTo", sendTo2.to = to, sendTo2.event = eventOrExpr, sendTo2.id = options?.id, sendTo2.delay = options?.delay, sendTo2.resolve = resolveSendTo, sendTo2.retryResolve = retryResolveSendTo, sendTo2.execute = executeSendTo, sendTo2;
33989
+ }
33990
+ function sendParent(event, options) {
33991
+ return sendTo(SpecialTargets.Parent, event, options);
33992
+ }
33993
+ function forwardTo(target, options) {
33994
+ return sendTo(target, ({
33995
+ event
33996
+ }) => event, options);
33997
+ }
33998
+ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
33999
+ collect
34000
+ }) {
34001
+ const actions = [], enqueue = function(action) {
34002
+ actions.push(action);
34003
+ };
34004
+ return enqueue.assign = (...args2) => {
34005
+ actions.push(assign2.assign(...args2));
34006
+ }, enqueue.cancel = (...args2) => {
34007
+ actions.push(guards_dist_xstateGuards.cancel(...args2));
34008
+ }, enqueue.raise = (...args2) => {
34009
+ actions.push(guards_dist_xstateGuards.raise(...args2));
34010
+ }, enqueue.sendTo = (...args2) => {
34011
+ actions.push(sendTo(...args2));
34012
+ }, enqueue.sendParent = (...args2) => {
34013
+ actions.push(sendParent(...args2));
34014
+ }, enqueue.spawnChild = (...args2) => {
34015
+ actions.push(guards_dist_xstateGuards.spawnChild(...args2));
34016
+ }, enqueue.stopChild = (...args2) => {
34017
+ actions.push(guards_dist_xstateGuards.stopChild(...args2));
34018
+ }, enqueue.emit = (...args2) => {
34019
+ actions.push(emit2(...args2));
34020
+ }, collect({
34021
+ context: args.context,
34022
+ event: args.event,
34023
+ enqueue,
34024
+ check: (guard) => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
34025
+ self: actorScope.self,
34026
+ system: actorScope.system
34027
+ }, actionParams), [snapshot, void 0, actions];
34028
+ }
34029
+ function enqueueActions(collect) {
34030
+ function enqueueActions2(_args, _params) {
34031
+ }
34032
+ return enqueueActions2.type = "xstate.enqueueActions", enqueueActions2.collect = collect, enqueueActions2.resolve = resolveEnqueueActions, enqueueActions2;
34033
+ }
34034
+ function resolveLog(_, snapshot, actionArgs, actionParams, {
34035
+ value,
34036
+ label: label2
34037
+ }) {
34038
+ return [snapshot, {
34039
+ value: typeof value == "function" ? value(actionArgs, actionParams) : value,
34040
+ label: label2
34041
+ }, void 0];
34042
+ }
34043
+ function executeLog({
34044
+ logger
34045
+ }, {
34046
+ value,
34047
+ label: label2
34048
+ }) {
34049
+ label2 ? logger(label2, value) : logger(value);
34050
+ }
34051
+ function log(value = ({
34052
+ context: context2,
34053
+ event
34054
+ }) => ({
34055
+ context: context2,
34056
+ event
34057
+ }), label2) {
34058
+ function log2(_args, _params) {
34059
+ }
34060
+ return log2.type = "xstate.log", log2.value = value, log2.label = label2, log2.resolve = resolveLog, log2.execute = executeLog, log2;
34061
+ }
34062
+ return log215998b6_cjs.SpecialTargets = SpecialTargets, log215998b6_cjs.emit = emit2, log215998b6_cjs.enqueueActions = enqueueActions, log215998b6_cjs.forwardTo = forwardTo, log215998b6_cjs.log = log, log215998b6_cjs.sendParent = sendParent, log215998b6_cjs.sendTo = sendTo, log215998b6_cjs;
34063
+ }
34064
+ var hasRequiredXstate_cjs;
34065
+ function requireXstate_cjs() {
34066
+ if (hasRequiredXstate_cjs) return xstate_cjs;
34067
+ hasRequiredXstate_cjs = 1, Object.defineProperty(xstate_cjs, "__esModule", { value: !0 });
34068
+ var actors_dist_xstateActors = requireXstateActors_cjs(), guards_dist_xstateGuards = /* @__PURE__ */ requireRaise5872b9e8_cjs(), StateMachine = /* @__PURE__ */ requireStateMachine1cda96d3_cjs(), log = /* @__PURE__ */ requireLog215998b6_cjs(), assign2 = /* @__PURE__ */ requireAssignE9c344ea_cjs();
34069
+ requireXstateDev_cjs();
34070
+ function assertEvent(event, type) {
34071
+ const types = guards_dist_xstateGuards.toArray(type);
34072
+ if (!types.includes(event.type)) {
34073
+ const typesText = types.length === 1 ? `type "${types[0]}"` : `one of types "${types.join('", "')}"`;
34074
+ throw new Error(`Expected event ${JSON.stringify(event)} to have ${typesText}`);
34075
+ }
34076
+ }
34000
34077
  function createMachine(config, implementations) {
34001
- return new StateMachine(config, implementations);
34078
+ return new StateMachine.StateMachine(config, implementations);
34002
34079
  }
34003
34080
  function createInertActorScope(actorLogic) {
34004
34081
  const self2 = guards_dist_xstateGuards.createActor(actorLogic);
@@ -34158,7 +34235,7 @@ ${err.message}`);
34158
34235
  }), done && sub.unsubscribe());
34159
34236
  });
34160
34237
  }
34161
- return xstate_cjs.createEmptyActor = actors_dist_xstateActors.createEmptyActor, xstate_cjs.fromCallback = actors_dist_xstateActors.fromCallback, xstate_cjs.fromEventObservable = actors_dist_xstateActors.fromEventObservable, xstate_cjs.fromObservable = actors_dist_xstateActors.fromObservable, xstate_cjs.fromPromise = actors_dist_xstateActors.fromPromise, xstate_cjs.fromTransition = actors_dist_xstateActors.fromTransition, xstate_cjs.Actor = guards_dist_xstateGuards.Actor, xstate_cjs.__unsafe_getAllOwnEventDescriptors = guards_dist_xstateGuards.getAllOwnEventDescriptors, xstate_cjs.and = guards_dist_xstateGuards.and, xstate_cjs.cancel = guards_dist_xstateGuards.cancel, xstate_cjs.createActor = guards_dist_xstateGuards.createActor, xstate_cjs.getStateNodes = guards_dist_xstateGuards.getStateNodes, xstate_cjs.interpret = guards_dist_xstateGuards.interpret, xstate_cjs.isMachineSnapshot = guards_dist_xstateGuards.isMachineSnapshot, xstate_cjs.matchesState = guards_dist_xstateGuards.matchesState, xstate_cjs.not = guards_dist_xstateGuards.not, xstate_cjs.or = guards_dist_xstateGuards.or, xstate_cjs.pathToStateValue = guards_dist_xstateGuards.pathToStateValue, xstate_cjs.raise = guards_dist_xstateGuards.raise, xstate_cjs.spawnChild = guards_dist_xstateGuards.spawnChild, xstate_cjs.stateIn = guards_dist_xstateGuards.stateIn, xstate_cjs.stop = guards_dist_xstateGuards.stop, xstate_cjs.stopChild = guards_dist_xstateGuards.stopChild, xstate_cjs.toObserver = guards_dist_xstateGuards.toObserver, xstate_cjs.SpecialTargets = log.SpecialTargets, xstate_cjs.assign = log.assign, xstate_cjs.emit = log.emit, xstate_cjs.enqueueActions = log.enqueueActions, xstate_cjs.forwardTo = log.forwardTo, xstate_cjs.log = log.log, xstate_cjs.sendParent = log.sendParent, xstate_cjs.sendTo = log.sendTo, xstate_cjs.SimulatedClock = SimulatedClock, xstate_cjs.StateMachine = StateMachine, xstate_cjs.StateNode = StateNode, xstate_cjs.assertEvent = assertEvent, xstate_cjs.createMachine = createMachine, xstate_cjs.getInitialSnapshot = getInitialSnapshot, xstate_cjs.getNextSnapshot = getNextSnapshot, xstate_cjs.initialTransition = initialTransition, xstate_cjs.setup = setup, xstate_cjs.toPromise = toPromise, xstate_cjs.transition = transition, xstate_cjs.waitFor = waitFor, xstate_cjs;
34238
+ return xstate_cjs.createEmptyActor = actors_dist_xstateActors.createEmptyActor, xstate_cjs.fromCallback = actors_dist_xstateActors.fromCallback, xstate_cjs.fromEventObservable = actors_dist_xstateActors.fromEventObservable, xstate_cjs.fromObservable = actors_dist_xstateActors.fromObservable, xstate_cjs.fromPromise = actors_dist_xstateActors.fromPromise, xstate_cjs.fromTransition = actors_dist_xstateActors.fromTransition, xstate_cjs.Actor = guards_dist_xstateGuards.Actor, xstate_cjs.__unsafe_getAllOwnEventDescriptors = guards_dist_xstateGuards.getAllOwnEventDescriptors, xstate_cjs.and = guards_dist_xstateGuards.and, xstate_cjs.cancel = guards_dist_xstateGuards.cancel, xstate_cjs.createActor = guards_dist_xstateGuards.createActor, xstate_cjs.getStateNodes = guards_dist_xstateGuards.getStateNodes, xstate_cjs.interpret = guards_dist_xstateGuards.interpret, xstate_cjs.isMachineSnapshot = guards_dist_xstateGuards.isMachineSnapshot, xstate_cjs.matchesState = guards_dist_xstateGuards.matchesState, xstate_cjs.not = guards_dist_xstateGuards.not, xstate_cjs.or = guards_dist_xstateGuards.or, xstate_cjs.pathToStateValue = guards_dist_xstateGuards.pathToStateValue, xstate_cjs.raise = guards_dist_xstateGuards.raise, xstate_cjs.spawnChild = guards_dist_xstateGuards.spawnChild, xstate_cjs.stateIn = guards_dist_xstateGuards.stateIn, xstate_cjs.stop = guards_dist_xstateGuards.stop, xstate_cjs.stopChild = guards_dist_xstateGuards.stopChild, xstate_cjs.toObserver = guards_dist_xstateGuards.toObserver, xstate_cjs.StateMachine = StateMachine.StateMachine, xstate_cjs.StateNode = StateMachine.StateNode, xstate_cjs.SpecialTargets = log.SpecialTargets, xstate_cjs.emit = log.emit, xstate_cjs.enqueueActions = log.enqueueActions, xstate_cjs.forwardTo = log.forwardTo, xstate_cjs.log = log.log, xstate_cjs.sendParent = log.sendParent, xstate_cjs.sendTo = log.sendTo, xstate_cjs.assign = assign2.assign, xstate_cjs.SimulatedClock = SimulatedClock, xstate_cjs.assertEvent = assertEvent, xstate_cjs.createMachine = createMachine, xstate_cjs.getInitialSnapshot = getInitialSnapshot, xstate_cjs.getNextSnapshot = getNextSnapshot, xstate_cjs.initialTransition = initialTransition, xstate_cjs.setup = setup, xstate_cjs.toPromise = toPromise, xstate_cjs.transition = transition, xstate_cjs.waitFor = waitFor, xstate_cjs;
34162
34239
  }
34163
34240
  var hasRequiredXstateReact_cjs;
34164
34241
  function requireXstateReact_cjs() {
@@ -34950,6 +35027,27 @@ const curveCatmullRomOpen = function custom4(alpha2) {
34950
35027
  return splitProps(props2, likec4tagVariantKeys);
34951
35028
  },
34952
35029
  getVariantProps: likec4tagFn.getVariantProps
35030
+ }), markdownBlockFn = /* @__PURE__ */ createRecipe("likec4-markdown-block", {
35031
+ uselikec4palette: !1
35032
+ }, []), markdownBlockVariantMap = {
35033
+ uselikec4palette: [
35034
+ "true",
35035
+ "false"
35036
+ ]
35037
+ }, markdownBlockVariantKeys = Object.keys(markdownBlockVariantMap), markdownBlock = /* @__PURE__ */ Object.assign(memo$1(markdownBlockFn.recipeFn), {
35038
+ __recipe__: !0,
35039
+ __name__: "markdownBlock",
35040
+ __getCompoundVariantCss__: markdownBlockFn.__getCompoundVariantCss__,
35041
+ raw: (props2) => props2,
35042
+ variantKeys: markdownBlockVariantKeys,
35043
+ variantMap: markdownBlockVariantMap,
35044
+ merge(recipe) {
35045
+ return mergeRecipes(this, recipe);
35046
+ },
35047
+ splitVariantProps(props2) {
35048
+ return splitProps(props2, markdownBlockVariantKeys);
35049
+ },
35050
+ getVariantProps: markdownBlockFn.getVariantProps
34953
35051
  }), MotionButton = /* @__PURE__ */ createMinimalMotionComponent("button"), MotionDiv = /* @__PURE__ */ createMinimalMotionComponent("div"), compoundActionBtn = cva({
34954
35052
  base: {
34955
35053
  transitionDuration: "normal",
@@ -36603,140 +36701,157 @@ const ElementTag = forwardRef(
36603
36701
  }
36604
36702
  );
36605
36703
  }
36606
- ), propsAreEqual = (prev, next) => prev.data.width === next.data.width && deepEqual(prev.data.tags, next.data.tags), ElementTags = memo$2(({ id: id2, data: { tags, width } }) => {
36607
- const zoom2 = useCurrentZoom(), zoomIsLargeEnough = zoom2 > 1.2, portalProps = useMantinePortalProps();
36704
+ ), propsAreEqual = (prev, next) => prev.data.width === next.data.width && deepEqual(prev.data.tags, next.data.tags) && (prev.data.hovered ?? !1) === (next.data.hovered ?? !1), ElementTags = memo$2(({ id: id2, data: { tags, width, hovered = !1 } }) => {
36705
+ const {
36706
+ hovered: isTagsBarHovered,
36707
+ ref: tagsBarRef
36708
+ } = useHover$1(), {
36709
+ hovered: isTagsToolbarHovered,
36710
+ ref: tagsToolbarRef
36711
+ } = useHover$1(), [isVisible, setVisible] = useDebouncedState(!1, hovered ? 120 : 300);
36712
+ useEffect(() => {
36713
+ setVisible((visibleNow) => visibleNow ? hovered || isTagsBarHovered || isTagsToolbarHovered : hovered && (isTagsBarHovered || isTagsToolbarHovered));
36714
+ }, [isTagsBarHovered, isTagsToolbarHovered, hovered]);
36715
+ const zoom2 = useCurrentZoom(), zoomIsLargeEnough = zoom2 > 1.2, diagram = useDiagram(), onHover = (tag) => {
36716
+ diagram.send({ type: "tag.highlight", tag });
36717
+ }, onLeave = useCallback(() => {
36718
+ diagram.send({ type: "tag.unhighlight" });
36719
+ }, []);
36608
36720
  if (!tags || tags.length === 0)
36609
36721
  return null;
36610
36722
  const maxWidth = Math.max(Math.round(width * zoom2) - 10, 200);
36611
- return /* @__PURE__ */ jsxs(
36612
- HoverCard,
36613
- {
36614
- ...portalProps,
36615
- floatingStrategy: "fixed",
36616
- position: "bottom-start",
36617
- offset: {
36618
- alignmentAxis: Math.round(4 * zoom2),
36619
- mainAxis: 8
36620
- },
36621
- keepMounted: !1,
36622
- openDelay: 300,
36623
- closeDelay: 500,
36624
- children: [
36625
- /* @__PURE__ */ jsx(HoverCard.Target, { children: /* @__PURE__ */ jsx(
36626
- "div",
36723
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
36724
+ /* @__PURE__ */ jsx(
36725
+ "div",
36726
+ {
36727
+ ref: tagsBarRef,
36728
+ className: cx(
36729
+ "likec4-element-tags",
36730
+ hstack({
36731
+ pointerEvents: "all",
36732
+ gap: 4,
36733
+ alignItems: "flex-end",
36734
+ justifyItems: "stretch",
36735
+ position: "absolute",
36736
+ width: "100%",
36737
+ bottom: 0,
36738
+ left: 0,
36739
+ padding: 4,
36740
+ _shapeCylinder: {
36741
+ bottom: 5
36742
+ },
36743
+ _shapeStorage: {
36744
+ bottom: 5
36745
+ },
36746
+ _shapeQueue: {
36747
+ bottom: 0,
36748
+ paddingLeft: 14
36749
+ }
36750
+ })
36751
+ ),
36752
+ onClick: stopPropagation$1,
36753
+ children: tags.map((tag) => /* @__PURE__ */ jsx(
36754
+ Box,
36627
36755
  {
36628
- className: cx(
36629
- "likec4-element-tags",
36630
- hstack({
36631
- pointerEvents: "all",
36632
- gap: 4,
36633
- alignItems: "flex-end",
36634
- justifyItems: "stretch",
36635
- position: "absolute",
36636
- width: "100%",
36637
- bottom: 0,
36638
- left: 0,
36639
- padding: 4,
36640
- _shapeCylinder: {
36641
- bottom: 5
36642
- },
36643
- _shapeStorage: {
36644
- bottom: 5
36645
- },
36646
- _shapeQueue: {
36647
- bottom: 0,
36648
- paddingLeft: 14
36649
- }
36650
- })
36651
- ),
36652
- onClick: stopPropagation$1,
36653
- children: tags.map((tag) => /* @__PURE__ */ jsx(
36654
- Box,
36655
- {
36656
- "data-likec4-tag": tag,
36657
- className: css({
36658
- layerStyle: "likec4.tag",
36659
- flex: 1,
36660
- display: "flex",
36661
- alignItems: "center",
36662
- justifyContent: "center",
36663
- maxWidth: 50,
36664
- height: 5,
36665
- _whenHovered: {
36666
- height: 12,
36667
- borderRadius: 4,
36668
- transitionDelay: ".08s"
36669
- },
36670
- transition: "fast"
36671
- })
36756
+ "data-likec4-tag": tag,
36757
+ className: css({
36758
+ layerStyle: "likec4.tag",
36759
+ flex: 1,
36760
+ display: "flex",
36761
+ alignItems: "center",
36762
+ justifyContent: "center",
36763
+ maxWidth: 50,
36764
+ height: 5,
36765
+ _whenHovered: {
36766
+ height: 12,
36767
+ borderRadius: 4,
36768
+ transitionDelay: ".08s"
36672
36769
  },
36673
- id2 + "#" + tag
36674
- ))
36675
- }
36676
- ) }),
36677
- /* @__PURE__ */ jsx(
36678
- HoverCard.Dropdown,
36770
+ transition: "fast"
36771
+ })
36772
+ },
36773
+ id2 + "#" + tag
36774
+ ))
36775
+ }
36776
+ ),
36777
+ /* @__PURE__ */ jsx(NodeToolbar, { isVisible, align: "start", position: Position.Bottom, children: /* @__PURE__ */ jsx(
36778
+ HStack,
36779
+ {
36780
+ ref: tagsToolbarRef,
36781
+ css: {
36782
+ gap: 4,
36783
+ flexWrap: "wrap",
36784
+ pb: "sm",
36785
+ translate: "auto",
36786
+ x: -8,
36787
+ maxWidth
36788
+ },
36789
+ children: tags.map((tag) => /* @__PURE__ */ jsx(
36790
+ ElementTag,
36679
36791
  {
36680
- p: 0,
36681
- w: "auto",
36682
- maw: maxWidth,
36792
+ tag,
36683
36793
  className: css({
36684
- background: "transparent",
36685
- border: "none"
36794
+ userSelect: "none",
36795
+ cursor: "pointer",
36796
+ ...zoomIsLargeEnough && {
36797
+ fontSize: "lg",
36798
+ borderRadius: 4,
36799
+ px: 6
36800
+ }
36686
36801
  }),
36687
- children: /* @__PURE__ */ jsx(ElementTagsDropdown, { tags, zoomIsLargeEnough })
36688
- }
36689
- )
36690
- ]
36691
- }
36692
- );
36802
+ onClick: (e2) => {
36803
+ e2.stopPropagation(), diagram.openSearch(`#${tag}`);
36804
+ },
36805
+ onMouseEnter: () => onHover(tag),
36806
+ onMouseLeave: onLeave
36807
+ },
36808
+ tag
36809
+ ))
36810
+ }
36811
+ ) })
36812
+ ] });
36693
36813
  }, propsAreEqual);
36694
36814
  ElementTags.displayName = "ElementTags";
36695
- function ElementTagsDropdown({ tags, zoomIsLargeEnough }) {
36696
- const diagram = useDiagram(), onHover = (tag) => {
36697
- diagram.send({ type: "tag.highlight", tag });
36698
- }, onLeave = useCallback(() => {
36699
- diagram.send({ type: "tag.unhighlight" });
36700
- }, []);
36815
+ const MarkdownBlock = forwardRef(({
36816
+ value,
36817
+ textScale = 1,
36818
+ uselikec4palette = !1,
36819
+ hideIfEmpty = !1,
36820
+ emptyText = "no content",
36821
+ className,
36822
+ ...props2
36823
+ }, ref) => {
36824
+ if (value.isEmpty && hideIfEmpty)
36825
+ return null;
36826
+ const content2 = value.nonEmpty ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", children: emptyText }) };
36701
36827
  return /* @__PURE__ */ jsx(
36702
- HStack,
36828
+ Box,
36703
36829
  {
36704
- css: {
36705
- gap: 4,
36706
- flexWrap: "wrap",
36707
- pb: "sm"
36830
+ ref,
36831
+ ...props2,
36832
+ className: cx(
36833
+ markdownBlock({
36834
+ uselikec4palette
36835
+ }),
36836
+ className
36837
+ ),
36838
+ style: {
36839
+ // @ts-expect-error
36840
+ "--mantine-scale": textScale
36708
36841
  },
36709
- children: tags.map((tag) => /* @__PURE__ */ jsx(
36710
- ElementTag,
36711
- {
36712
- tag,
36713
- className: css({
36714
- userSelect: "none",
36715
- cursor: "pointer",
36716
- ...zoomIsLargeEnough && {
36717
- fontSize: "lg",
36718
- borderRadius: 4,
36719
- px: 6
36720
- }
36721
- }),
36722
- onClick: (e2) => {
36723
- e2.stopPropagation(), diagram.openSearch(`#${tag}`);
36724
- },
36725
- onMouseEnter: () => onHover(tag),
36726
- onMouseLeave: onLeave
36727
- },
36728
- tag
36729
- ))
36842
+ ...content2
36730
36843
  }
36731
36844
  );
36732
- }
36845
+ });
36846
+ MarkdownBlock.displayName = "MarkdownBlock";
36733
36847
  const iconSize$2 = "--icon-size", title$4 = css.raw({
36734
36848
  textStyle: "likec4.node.primary",
36735
36849
  flex: "0 0 auto",
36736
36850
  textAlign: "center",
36737
36851
  color: "likec4.palette.hiContrast"
36738
36852
  }), description$2 = css.raw({
36739
- flex: "0 1 auto",
36853
+ flexGrow: "0",
36854
+ flexShrink: "1",
36740
36855
  textStyle: "likec4.node.secondary",
36741
36856
  color: "likec4.palette.loContrast",
36742
36857
  textAlign: "center",
@@ -36806,6 +36921,8 @@ const iconSize$2 = "--icon-size", title$4 = css.raw({
36806
36921
  flex: "1",
36807
36922
  height: "fit-content",
36808
36923
  width: "fit-content",
36924
+ maxHeight: "100%",
36925
+ maxWidth: "100%",
36809
36926
  margin: "0 auto",
36810
36927
  display: "flex",
36811
36928
  alignItems: "center",
@@ -36857,6 +36974,8 @@ const iconSize$2 = "--icon-size", title$4 = css.raw({
36857
36974
  textContainer: {
36858
36975
  height: "fit-content",
36859
36976
  width: "fit-content",
36977
+ maxHeight: "100%",
36978
+ maxWidth: "100%",
36860
36979
  flex: "0 1 auto",
36861
36980
  display: "flex",
36862
36981
  flexDirection: "column",
@@ -36926,7 +37045,7 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
36926
37045
  className: elementIcon$2
36927
37046
  }), classes2 = elementTitle({
36928
37047
  hasIcon: n$5(elementIcon2),
36929
- hasDescription: !n$1(data.description ?? ""),
37048
+ hasDescription: !!data.description?.nonEmpty,
36930
37049
  hasTechnology: !n$1(data.technology ?? "")
36931
37050
  }), size2 = nodeSizes(data.style).size, isSmOrXs = size2 === "sm" || size2 === "xs";
36932
37051
  return /* @__PURE__ */ jsxs(
@@ -36946,7 +37065,7 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
36946
37065
  /* @__PURE__ */ jsx(
36947
37066
  Text,
36948
37067
  {
36949
- component: "h3",
37068
+ component: "div",
36950
37069
  className: cx(classes2.title, "likec4-element-title"),
36951
37070
  lineClamp: isSmOrXs ? 2 : 3,
36952
37071
  children: data.title
@@ -36961,12 +37080,14 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
36961
37080
  }
36962
37081
  ),
36963
37082
  data.description && /* @__PURE__ */ jsx(
36964
- Text,
37083
+ MarkdownBlock,
36965
37084
  {
36966
- component: "div",
36967
37085
  className: cx(classes2.description, "likec4-element-description"),
36968
- lineClamp: isSmOrXs ? 3 : 5,
36969
- children: data.description
37086
+ value: data.description,
37087
+ uselikec4palette: !0,
37088
+ hideIfEmpty: !0,
37089
+ maxHeight: data.description.isMarkdown ? "8rem" : void 0,
37090
+ lineClamp: isSmOrXs ? 3 : 5
36970
37091
  }
36971
37092
  )
36972
37093
  ] })
@@ -37442,7 +37563,7 @@ const stopPropagation = (e2) => e2.stopPropagation(), Tooltip$4 = Tooltip$5.with
37442
37563
  ] })
37443
37564
  ] }),
37444
37565
  /* @__PURE__ */ jsx(Box$1, { className: title$3, children: r2.title || "untitled" }),
37445
- r2.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: r2.description }),
37566
+ r2.description.nonEmpty && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: r2.description.text }),
37446
37567
  links.length > 0 && /* @__PURE__ */ jsx(
37447
37568
  Stack,
37448
37569
  {
@@ -38688,11 +38809,13 @@ const useElementDetailsActorRef = () => {
38688
38809
  display: "grid",
38689
38810
  gridTemplateColumns: "min-content 1fr",
38690
38811
  gridAutoRows: "min-content max-content",
38691
- gap: "[20px 16px]",
38812
+ gap: "[24px 20px]",
38692
38813
  alignItems: "baseline",
38693
38814
  justifyItems: "stretch"
38694
38815
  }), propertyLabel = css({
38695
- justifySelf: "end"
38816
+ justifySelf: "end",
38817
+ textAlign: "right",
38818
+ userSelect: "none"
38696
38819
  }), resizeHandle = css({
38697
38820
  position: "absolute",
38698
38821
  width: "14px",
@@ -40155,10 +40278,8 @@ function requireUtil$1() {
40155
40278
  zipObject
40156
40279
  };
40157
40280
  function addDummyNode(g, type, attrs, name) {
40158
- let v;
40159
- do
40281
+ for (var v = name; g.hasNode(v); )
40160
40282
  v = uniqueId(name);
40161
- while (g.hasNode(v));
40162
40283
  return attrs.dummy = type, g.setNode(v, attrs), v;
40163
40284
  }
40164
40285
  function simplify(g) {
@@ -40282,7 +40403,7 @@ function requireUtil$1() {
40282
40403
  let idCounter2 = 0;
40283
40404
  function uniqueId(prefix2) {
40284
40405
  var id2 = ++idCounter2;
40285
- return toString(prefix2) + id2;
40406
+ return prefix2 + ("" + id2);
40286
40407
  }
40287
40408
  function range(start2, limit, step = 1) {
40288
40409
  limit == null && (limit = start2, start2 = 0);
@@ -40523,6 +40644,9 @@ function requireRank() {
40523
40644
  var rankUtil = requireUtil(), longestPath = rankUtil.longestPath, feasibleTree = requireFeasibleTree(), networkSimplex = requireNetworkSimplex();
40524
40645
  rank_1 = rank;
40525
40646
  function rank(g) {
40647
+ var ranker = g.graph().ranker;
40648
+ if (ranker instanceof Function)
40649
+ return ranker(g);
40526
40650
  switch (g.graph().ranker) {
40527
40651
  case "network-simplex":
40528
40652
  networkSimplexRanker(g);
@@ -40533,6 +40657,8 @@ function requireRank() {
40533
40657
  case "longest-path":
40534
40658
  longestPathRanker(g);
40535
40659
  break;
40660
+ case "none":
40661
+ break;
40536
40662
  default:
40537
40663
  networkSimplexRanker(g);
40538
40664
  }
@@ -41229,7 +41355,7 @@ function requireLayout() {
41229
41355
  inputLabel.points = layoutLabel.points, Object.hasOwn(layoutLabel, "x") && (inputLabel.x = layoutLabel.x, inputLabel.y = layoutLabel.y);
41230
41356
  }), inputGraph.graph().width = layoutGraph.graph().width, inputGraph.graph().height = layoutGraph.graph().height;
41231
41357
  }
41232
- let graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, graphAttrs = ["acyclicer", "ranker", "rankdir", "align"], nodeNumAttrs = ["width", "height"], nodeDefaults = { width: 0, height: 0 }, edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"], edgeDefaults = {
41358
+ let graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, graphAttrs = ["acyclicer", "ranker", "rankdir", "align"], nodeNumAttrs = ["width", "height", "rank"], nodeDefaults = { width: 0, height: 0 }, edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"], edgeDefaults = {
41233
41359
  minlen: 1,
41234
41360
  weight: 1,
41235
41361
  width: 0,
@@ -41418,7 +41544,7 @@ function requireDebug() {
41418
41544
  }
41419
41545
  var version, hasRequiredVersion;
41420
41546
  function requireVersion() {
41421
- return hasRequiredVersion || (hasRequiredVersion = 1, version = "1.1.4"), version;
41547
+ return hasRequiredVersion || (hasRequiredVersion = 1, version = "1.1.5"), version;
41422
41548
  }
41423
41549
  var dagre$1, hasRequiredDagre;
41424
41550
  function requireDagre() {
@@ -41707,7 +41833,7 @@ function layoutRelationshipsView$1(data, scope) {
41707
41833
  y: position.y,
41708
41834
  position: [position.x, position.y],
41709
41835
  title: "empty node",
41710
- description: null,
41836
+ description: RichText.EMPTY,
41711
41837
  technology: null,
41712
41838
  tags: [],
41713
41839
  links: [],
@@ -41746,7 +41872,7 @@ function layoutRelationshipsView$1(data, scope) {
41746
41872
  y: position.y,
41747
41873
  position: [position.x, position.y],
41748
41874
  title: element.title,
41749
- description: element.description,
41875
+ description: RichText.from(element.description),
41750
41876
  technology: element.technology,
41751
41877
  tags: [...element.tags],
41752
41878
  links: null,
@@ -42055,7 +42181,7 @@ function RelationshipsBrowser({ actorRef }) {
42055
42181
  initialEdges: []
42056
42182
  }), /* @__PURE__ */ jsx(RelationshipsBrowserActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: !1, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(RelationshipsBrowserXYFlow, {}) }) }) }) });
42057
42183
  }
42058
- const selector$4 = (state) => ({
42184
+ const selector$5 = (state) => ({
42059
42185
  isActive: state.hasTag("active"),
42060
42186
  nodes: state.context.xynodes,
42061
42187
  edges: state.context.xyedges
@@ -42065,7 +42191,7 @@ const selector$4 = (state) => ({
42065
42191
  nodes,
42066
42192
  edges
42067
42193
  } = useRelationshipsBrowserState(
42068
- selector$4,
42194
+ selector$5,
42069
42195
  selectorEq
42070
42196
  );
42071
42197
  return /* @__PURE__ */ jsx(
@@ -42729,7 +42855,22 @@ function ElementDetailsCard({
42729
42855
  /* @__PURE__ */ jsxs(Group, { align: "baseline", gap: "sm", wrap: "nowrap", children: [
42730
42856
  /* @__PURE__ */ jsxs("div", { children: [
42731
42857
  /* @__PURE__ */ jsx(SmallLabel, { children: "kind" }),
42732
- /* @__PURE__ */ jsx(Badge, { radius: "sm", size: "sm", fw: 600, color: "gray", children: elementModel.kind })
42858
+ /* @__PURE__ */ jsx(
42859
+ Badge,
42860
+ {
42861
+ radius: "sm",
42862
+ size: "sm",
42863
+ fw: 600,
42864
+ color: "gray",
42865
+ style: {
42866
+ cursor: "pointer"
42867
+ },
42868
+ onClick: (e2) => {
42869
+ e2.stopPropagation(), diagram.openSearch(`kind:${elementModel.kind}`);
42870
+ },
42871
+ children: elementModel.kind
42872
+ }
42873
+ )
42733
42874
  ] }),
42734
42875
  /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
42735
42876
  /* @__PURE__ */ jsx(SmallLabel, { children: "tags" }),
@@ -42776,7 +42917,9 @@ function ElementDetailsCard({
42776
42917
  variant: "default",
42777
42918
  radius: "sm",
42778
42919
  onClick: (e2) => {
42779
- e2.stopPropagation();
42920
+ e2.stopPropagation(), diagram.openSource({
42921
+ element: elementModel.id
42922
+ });
42780
42923
  },
42781
42924
  children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.8, style: { width: "62%" } })
42782
42925
  }
@@ -42812,8 +42955,17 @@ function ElementDetailsCard({
42812
42955
  },
42813
42956
  children: [
42814
42957
  /* @__PURE__ */ jsx(TabsList, { children: TABS.map((tab) => /* @__PURE__ */ jsx(TabsTab, { value: tab, children: tab }, tab)) }),
42815
- /* @__PURE__ */ jsx(TabsPanel, { value: "Properties", children: /* @__PURE__ */ jsx(ScrollArea, { scrollbars: "y", type: "auto", children: /* @__PURE__ */ jsxs(Box$1, { className: propertiesGrid, pt: "xs", children: [
42816
- /* @__PURE__ */ jsx(ElementProperty, { title: "description", emptyValue: "no description", children: elementModel.description }),
42958
+ /* @__PURE__ */ jsx(TabsPanel, { value: "Properties", children: /* @__PURE__ */ jsx(ScrollArea, { scrollbars: "y", type: "scroll", offsetScrollbars: !0, children: /* @__PURE__ */ jsxs(Box$1, { className: propertiesGrid, pt: "xs", children: [
42959
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
42960
+ /* @__PURE__ */ jsx(PropertyLabel, { children: "description" }),
42961
+ /* @__PURE__ */ jsx(
42962
+ MarkdownBlock,
42963
+ {
42964
+ value: elementModel.description,
42965
+ emptyText: "no description"
42966
+ }
42967
+ )
42968
+ ] }),
42817
42969
  elementModel.technology && /* @__PURE__ */ jsx(ElementProperty, { title: "technology", children: elementModel.technology }),
42818
42970
  elementModel.links.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
42819
42971
  /* @__PURE__ */ jsx(PropertyLabel, { children: "links" }),
@@ -42888,10 +43040,7 @@ const ViewButton$1 = ({
42888
43040
  onNavigateTo
42889
43041
  }) => /* @__PURE__ */ jsx(UnstyledButton, { className: viewButton$1, onClick: (e2) => onNavigateTo(view.id, e2), children: /* @__PURE__ */ jsxs(Group, { gap: 6, align: "start", wrap: "nowrap", children: [
42890
43042
  /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", children: view._type === "deployment" ? /* @__PURE__ */ jsx(IconStack2, { stroke: 1.8 }) : /* @__PURE__ */ jsx(IconZoomScan, { stroke: 1.8 }) }),
42891
- /* @__PURE__ */ jsxs(Box$1, { children: [
42892
- /* @__PURE__ */ jsx(Text, { component: "div", className: viewButtonTitle, lineClamp: 1, children: view.title || "untitled" }),
42893
- view.description && /* @__PURE__ */ jsx(Text, { component: "div", mt: 2, fz: "xs", c: "dimmed", lh: 1.4, lineClamp: 1, children: view.description })
42894
- ] })
43043
+ /* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Text, { component: "div", className: viewButtonTitle, lineClamp: 1, children: view.title || "untitled" }) })
42895
43044
  ] }) });
42896
43045
  function ElementProperty({
42897
43046
  title: title2,
@@ -42910,6 +43059,7 @@ function ElementProperty({
42910
43059
  fz: "md",
42911
43060
  style: {
42912
43061
  whiteSpace: "preserve-breaks",
43062
+ userSelect: "all",
42913
43063
  ...style2
42914
43064
  },
42915
43065
  ...props2,
@@ -42919,11 +43069,96 @@ function ElementProperty({
42919
43069
  ] });
42920
43070
  }
42921
43071
  function ElementMetata({
42922
- value
43072
+ value: metadata
42923
43073
  }) {
42924
43074
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
42925
43075
  /* @__PURE__ */ jsx(PropertyLabel, { children: "metadata" }),
42926
- /* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(Code, { block: !0, children: JSON.stringify(value, null, 2) }) })
43076
+ /* @__PURE__ */ jsx(
43077
+ Box$1,
43078
+ {
43079
+ className: css({
43080
+ flex: 1,
43081
+ display: "grid",
43082
+ gridTemplateColumns: "min-content 1fr",
43083
+ gridAutoRows: "min-content max-content",
43084
+ gap: "[4px 4px]",
43085
+ alignItems: "baseline",
43086
+ justifyItems: "stretch",
43087
+ paddingRight: "2xs"
43088
+ }),
43089
+ children: t$1(metadata).map(([key2, value]) => /* @__PURE__ */ jsxs(
43090
+ "div",
43091
+ {
43092
+ className: cx(
43093
+ "group",
43094
+ css({
43095
+ display: "contents"
43096
+ })
43097
+ ),
43098
+ children: [
43099
+ /* @__PURE__ */ jsxs(
43100
+ "div",
43101
+ {
43102
+ className: css({
43103
+ fontSize: "sm",
43104
+ fontWeight: 500,
43105
+ justifySelf: "end",
43106
+ whiteSpace: "nowrap"
43107
+ }),
43108
+ children: [
43109
+ key2,
43110
+ ":"
43111
+ ]
43112
+ }
43113
+ ),
43114
+ /* @__PURE__ */ jsx(
43115
+ "div",
43116
+ {
43117
+ className: css({}),
43118
+ children: /* @__PURE__ */ jsx(
43119
+ ScrollAreaAutosize,
43120
+ {
43121
+ type: "auto",
43122
+ mah: 200,
43123
+ overscrollBehavior: "none",
43124
+ className: css({
43125
+ transitionProperty: "all",
43126
+ transitionDuration: "fast",
43127
+ transitionTimingFunction: "inOut",
43128
+ rounded: "sm",
43129
+ color: "mantine.colors.gray[8]",
43130
+ _dark: {
43131
+ color: "mantine.colors.dark[1]"
43132
+ },
43133
+ _groupHover: {
43134
+ transitionTimingFunction: "out",
43135
+ color: "mantine.colors.defaultColor",
43136
+ background: "mantine.colors.defaultHover"
43137
+ }
43138
+ }),
43139
+ children: /* @__PURE__ */ jsx(
43140
+ "div",
43141
+ {
43142
+ className: css({
43143
+ fontSize: "sm",
43144
+ padding: "2xs",
43145
+ whiteSpace: "pre",
43146
+ fontFamily: "[var(--mantine-font-family-monospace)]",
43147
+ userSelect: "all"
43148
+ }),
43149
+ children: value
43150
+ }
43151
+ )
43152
+ }
43153
+ )
43154
+ }
43155
+ )
43156
+ ]
43157
+ },
43158
+ key2
43159
+ ))
43160
+ }
43161
+ )
42927
43162
  ] });
42928
43163
  }
42929
43164
  function ElementDetails({
@@ -43608,7 +43843,7 @@ function layoutRelationshipDetails(data, scope) {
43608
43843
  y: position.y,
43609
43844
  position: [position.x, position.y],
43610
43845
  title: element.title,
43611
- description: element.description,
43846
+ description: RichText.from(element.description),
43612
43847
  technology: element.technology,
43613
43848
  tags: [...element.tags],
43614
43849
  links: null,
@@ -43890,7 +44125,7 @@ const selectSubject = (state) => ({
43890
44125
  }, [store, instance.viewportInitialized, actor]), useEffect(() => {
43891
44126
  data !== null && actor.send({ type: "update.layoutData", data });
43892
44127
  }, [data, actor]), null;
43893
- }), selector$3 = ({ context: context2 }) => ({
44128
+ }), selector$4 = ({ context: context2 }) => ({
43894
44129
  // subject: context.subject,
43895
44130
  // view: state.context.view,
43896
44131
  initialized: context2.initialized.xydata && context2.initialized.xyflow,
@@ -43901,7 +44136,7 @@ const selectSubject = (state) => ({
43901
44136
  initialized,
43902
44137
  nodes,
43903
44138
  edges
43904
- } = useRelationshipDetailsState(selector$3, deepEqual);
44139
+ } = useRelationshipDetailsState(selector$4, deepEqual);
43905
44140
  return /* @__PURE__ */ jsxs(
43906
44141
  BaseXYFlow,
43907
44142
  {
@@ -44475,11 +44710,11 @@ function ViewButton({ className, view, loop = !1, search, ...props2 }) {
44475
44710
  /* @__PURE__ */ jsx(
44476
44711
  Highlight,
44477
44712
  {
44478
- highlight: view.$view.description ? search : "",
44713
+ highlight: view.description.nonEmpty ? search : "",
44479
44714
  component: "div",
44480
44715
  className: btn$2.description,
44481
44716
  lineClamp: 1,
44482
- children: view.$view.description || "No description"
44717
+ children: view.description.text || "No description"
44483
44718
  }
44484
44719
  )
44485
44720
  ] })
@@ -44640,7 +44875,7 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
44640
44875
  }
44641
44876
  ) })
44642
44877
  ] }),
44643
- /* @__PURE__ */ jsx(Highlight, { component: "div", highlight: searchTerms, className: btn$1.description, lineClamp: 1, children: element.description || "No description" })
44878
+ /* @__PURE__ */ jsx(Highlight, { component: "div", highlight: searchTerms, className: btn$1.description, lineClamp: 1, children: element.description.text || "No description" })
44644
44879
  ] }),
44645
44880
  /* @__PURE__ */ jsx(Text, { component: "div", className: cx(elementViewsCount, btn$1.descriptionColor), fz: "xs", children: views.length === 0 ? "No views" : /* @__PURE__ */ jsxs(Fragment$1, { children: [
44646
44881
  views.length,
@@ -45371,7 +45606,7 @@ const autolayoutButton = css({
45371
45606
  borderColor: "mantine.colors.gray[5]",
45372
45607
  borderRadius: 3,
45373
45608
  transform: "translate(-50%, -50%)"
45374
- }), selector$2 = (state) => ({
45609
+ }), selector$3 = (state) => ({
45375
45610
  viewId: state.view.id,
45376
45611
  autoLayout: state.view.autoLayout
45377
45612
  }), ChangeAutoLayoutButton = (props2) => {
@@ -45380,7 +45615,7 @@ const autolayoutButton = css({
45380
45615
  } = useDiagramEventHandlers(), diagram = useDiagram(), [rootRef, setRootRef] = useState(null), [controlsRefs, setControlsRefs] = useState({}), {
45381
45616
  autoLayout,
45382
45617
  viewId
45383
- } = useDiagramContext(selector$2), { ref, hovered: isSpacingHovered } = useHover$1(), setControlRef = (name) => (node2) => {
45618
+ } = useDiagramContext(selector$3), { ref, hovered: isSpacingHovered } = useHover$1(), setControlRef = (name) => (node2) => {
45384
45619
  controlsRefs[name] = node2, setControlsRefs(controlsRefs);
45385
45620
  }, setAutoLayout = (direction) => (event) => {
45386
45621
  event.stopPropagation(), onChange?.({
@@ -45697,11 +45932,11 @@ const autolayoutButton = css({
45697
45932
  "forward"
45698
45933
  )
45699
45934
  ] });
45700
- }, selector$1 = (state) => ({
45935
+ }, selector$2 = (state) => ({
45701
45936
  visible: state.features.enableReadOnly !== !0,
45702
45937
  isReadOnly: state.toggledFeatures.enableReadOnly ?? state.features.enableReadOnly
45703
45938
  }), ToggleReadonly = () => {
45704
- const { visible: visible2, isReadOnly } = useDiagramContext(selector$1), diagram = useDiagram();
45939
+ const { visible: visible2, isReadOnly } = useDiagramContext(selector$2), diagram = useDiagram();
45705
45940
  return visible2 ? /* @__PURE__ */ jsx(Tooltip, { label: isReadOnly ? "Enable editing" : "Disable editing", children: /* @__PURE__ */ jsx(
45706
45941
  ActionIcon,
45707
45942
  {
@@ -45871,14 +46106,17 @@ const autolayoutButton = css({
45871
46106
  color: "mantine.colors.gray[5]"
45872
46107
  }
45873
46108
  });
46109
+ function selector$1(context2) {
46110
+ return {
46111
+ id: context2.view.id,
46112
+ title: context2.view.title ?? "untitled",
46113
+ description: RichText$1.from(context2.view.description),
46114
+ links: context2.view.links,
46115
+ isNotActiveWalkthrough: context2.activeWalkthrough === null
46116
+ };
46117
+ }
45874
46118
  function DiagramTitlePanel() {
45875
- const { id: id2, title: title$12, description: description$12, links, isNotActiveWalkthrough } = useDiagramContext((s2) => ({
45876
- id: s2.view.id,
45877
- title: s2.view.title ?? "untitled",
45878
- description: s2.view.description,
45879
- links: s2.view.links,
45880
- isNotActiveWalkthrough: s2.activeWalkthrough === null
45881
- })), [isCollapsed, setCollapsed] = useLocalStorage({
46119
+ const { id: id2, title: title$12, description: description$12, links, isNotActiveWalkthrough } = useDiagramContext(selector$1), [isCollapsed, setCollapsed] = useLocalStorage({
45882
46120
  key: "diagram-title-webview-collapsed",
45883
46121
  defaultValue: !1
45884
46122
  }), toggle = () => setCollapsed((v) => !v);
@@ -45972,24 +46210,23 @@ function DiagramTitlePanel() {
45972
46210
  }
45973
46211
  )
45974
46212
  ] }),
45975
- description$12 && /* @__PURE__ */ jsx(
46213
+ description$12.nonEmpty && /* @__PURE__ */ jsx(
45976
46214
  Spoiler,
45977
46215
  {
45978
- maxHeight: 42,
46216
+ maxHeight: 60,
45979
46217
  showLabel: /* @__PURE__ */ jsx(Button, { component: "div", color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "show more" }),
45980
46218
  hideLabel: /* @__PURE__ */ jsx(Button, { component: "div", color: "gray", variant: "light", fz: "10", size: "compact-xs", tabIndex: -1, children: "hide" }),
45981
46219
  children: /* @__PURE__ */ jsx(
45982
- Text,
46220
+ MarkdownBlock,
45983
46221
  {
45984
- component: "div",
45985
- size: "sm",
45986
46222
  className: description,
45987
- children: description$12 || "no description"
46223
+ textScale: 0.9,
46224
+ value: description$12
45988
46225
  }
45989
46226
  )
45990
46227
  }
45991
46228
  ),
45992
- !description$12 && /* @__PURE__ */ jsx(
46229
+ description$12.isEmpty && /* @__PURE__ */ jsx(
45993
46230
  Text,
45994
46231
  {
45995
46232
  component: "div",
@@ -46852,7 +47089,7 @@ function viewToNodesEdge$1(opts) {
46852
47089
  id: node2.id,
46853
47090
  title: node2.title,
46854
47091
  technology: node2.technology,
46855
- description: node2.description,
47092
+ description: RichText.from(node2.description),
46856
47093
  height: node2.height,
46857
47094
  width: node2.width,
46858
47095
  level: node2.level,
@@ -47636,7 +47873,7 @@ function layoutResultToXYFlow(layout2) {
47636
47873
  fqn: fqn2,
47637
47874
  title: node2.title,
47638
47875
  technology: node2.technology,
47639
- description: node2.description,
47876
+ description: RichText.from(node2.description),
47640
47877
  height: node2.height,
47641
47878
  width: node2.width,
47642
47879
  color: node2.color,
@@ -47681,8 +47918,8 @@ function layoutResultToXYFlow(layout2) {
47681
47918
  color: color2,
47682
47919
  navigateTo,
47683
47920
  line,
47684
- ...technology2 && { technology: technology2 },
47685
- ...description2 && { description: description2 }
47921
+ description: RichText.from(description2),
47922
+ ...technology2 && { technology: technology2 }
47686
47923
  }
47687
47924
  });
47688
47925
  }
@@ -49131,7 +49368,7 @@ const _diagramMachine = xstate_cjsExports.setup({
49131
49368
  };
49132
49369
  }),
49133
49370
  "tag.highlight": xstate_cjsExports.assign(({ context: context2, event }) => (xstate_cjsExports.assertEvent(event, "tag.highlight"), {
49134
- xynodes: context2.xynodes.map((n2) => n2.data.tags?.includes(event.tag) ? setDimmed(n2, !1) : setDimmed(n2, "immediate"))
49371
+ xynodes: context2.xynodes.map((n2) => n2.data.tags?.includes(event.tag) ? setDimmed(n2, !1) : setDimmed(n2, !0))
49135
49372
  })),
49136
49373
  "undim everything": xstate_cjsExports.assign(({ context: context2 }) => ({
49137
49374
  xynodes: context2.xynodes.map(setDimmed(!1)),
@@ -49748,7 +49985,10 @@ function findCorrespondingNode(context2, event) {
49748
49985
  const fromNodeId = context2.lastOnNavigate?.fromNode, fromNode = fromNodeId && context2.view.nodes.find((n2) => n2.id === fromNodeId), fromRef = fromNode && nodeRef(fromNode), toNode = fromRef && event.view.nodes.find((n2) => nodeRef(n2) === fromRef);
49749
49986
  return { fromNode, toNode };
49750
49987
  }
49751
- const diagramMachine = _diagramMachine, selectToggledFeatures = (state) => state.context.toggledFeatures;
49988
+ const diagramMachine = _diagramMachine, selectToggledFeatures = (state) => state.context.features.enableReadOnly ? {
49989
+ ...state.context.toggledFeatures,
49990
+ enableReadOnly: !0
49991
+ } : state.context.toggledFeatures;
49752
49992
  function DiagramActorProvider({
49753
49993
  view,
49754
49994
  zoomable,
@@ -49995,7 +50235,7 @@ function useLikeC4ModelDataAtom() {
49995
50235
  return useContext(LikeC4ModelDataContext);
49996
50236
  }
49997
50237
  function LikeC4ModelContext({ likec4data, likec4model, children: children2 }) {
49998
- const model = nano.useStore(likec4model);
50238
+ const model = useStore(likec4model);
49999
50239
  return /* @__PURE__ */ jsx(LikeC4ModelDataContext.Provider, { value: likec4data, children: /* @__PURE__ */ jsx(LikeC4ModelProvider, { likec4model: model, children: children2 }) });
50000
50240
  }
50001
50241
  css({
@@ -50120,54 +50360,64 @@ const previewBg = css({
50120
50360
  component: RouteComponent$1
50121
50361
  });
50122
50362
  function RouteComponent$1() {
50123
- useDocumentTitle("LikeC4");
50124
- const views = t$4(useLikeC4Model$1().$model.views);
50125
- return /* @__PURE__ */ jsx(
50363
+ useDocumentTitle(pageTitle);
50364
+ const views = [...useLikeC4Model$1("layouted").views()];
50365
+ return /* @__PURE__ */ jsx(Container, { size: "xl", children: /* @__PURE__ */ jsx(
50126
50366
  SimpleGrid,
50127
50367
  {
50128
50368
  p: { base: "md", sm: "xl" },
50129
- cols: { base: 1, sm: 2, md: 3, lg: 5 },
50369
+ cols: { base: 1, sm: 2, md: 3, xl: 4 },
50130
50370
  spacing: { base: 10, sm: "xl" },
50131
50371
  verticalSpacing: { base: "md", sm: "xl" },
50132
- children: views.map((v) => /* @__PURE__ */ jsx(ViewCard, { viewId: v }, v))
50372
+ children: views.map((v) => /* @__PURE__ */ jsx(ViewCard, { view: v }, v.id))
50133
50373
  }
50134
- );
50374
+ ) });
50135
50375
  }
50136
- const ViewCard = memo$2(({ viewId }) => {
50137
- const diagram = useLikeC4Model$1("layouted").findView(viewId);
50138
- if (!diagram || !diagram.isDiagram())
50139
- return null;
50140
- const { id: id2, title: title2, description: description2 } = diagram.$view;
50141
- return /* @__PURE__ */ jsxs(
50376
+ function ViewCard({ view }) {
50377
+ const [visible2, setVisible] = useState(!1);
50378
+ return useTimeoutEffect(() => {
50379
+ setVisible(!0);
50380
+ }, 100), /* @__PURE__ */ jsxs(
50142
50381
  Card,
50143
50382
  {
50144
50383
  shadow: "xs",
50145
50384
  padding: "lg",
50146
50385
  radius: "sm",
50386
+ className: "group",
50147
50387
  withBorder: !0,
50148
50388
  children: [
50149
- /* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(DiagramPreview$1, { diagram: diagram.$view }) }),
50150
- /* @__PURE__ */ jsx(Group, { justify: "space-between", mt: "md", mb: "xs", children: /* @__PURE__ */ jsx(Text, { fw: 500, children: title2 }) }),
50151
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: description2 }),
50152
- /* @__PURE__ */ jsx(Link$1, { to: "/view/$viewId/", params: { viewId: id2 }, search: !0, className: cardLink })
50389
+ /* @__PURE__ */ jsx(Card.Section, { children: /* @__PURE__ */ jsx(Box$1, { className: previewBg, style: { height: 200 }, children: visible2 && /* @__PURE__ */ jsx(
50390
+ StaticLikeC4Diagram,
50391
+ {
50392
+ background: "transparent",
50393
+ view: view.$view,
50394
+ fitView: !0,
50395
+ fitViewPadding: "4px",
50396
+ reduceGraphics: !0
50397
+ }
50398
+ ) }) }),
50399
+ /* @__PURE__ */ jsx(Group, { justify: "space-between", mt: "md", children: /* @__PURE__ */ jsx(Text, { fw: 500, children: view.title ?? view.id }) }),
50400
+ /* @__PURE__ */ jsx(
50401
+ MarkdownBlock,
50402
+ {
50403
+ value: view.description,
50404
+ textScale: 0.75,
50405
+ emptyText: "No description",
50406
+ lineClamp: 3,
50407
+ mt: "2",
50408
+ css: {
50409
+ transition: "fast",
50410
+ opacity: {
50411
+ base: 0.8,
50412
+ _groupHover: 1
50413
+ }
50414
+ }
50415
+ }
50416
+ ),
50417
+ /* @__PURE__ */ jsx(Link$1, { to: "/view/$viewId/", params: { viewId: view.id }, search: !0, className: cardLink })
50153
50418
  ]
50154
50419
  }
50155
50420
  );
50156
- });
50157
- function DiagramPreview$1({ diagram }) {
50158
- const { ref, inViewport } = useInViewport(), [visible2, setVisible] = useState(inViewport);
50159
- return useLayoutEffect$1(() => {
50160
- inViewport && !visible2 && setVisible(!0);
50161
- }, [inViewport]), /* @__PURE__ */ jsx(Box$1, { ref, className: previewBg, style: { height: 175 }, children: visible2 && /* @__PURE__ */ jsx(
50162
- StaticLikeC4Diagram,
50163
- {
50164
- background: "transparent",
50165
- view: diagram,
50166
- fitView: !0,
50167
- fitViewPadding: "4px",
50168
- reduceGraphics: !0
50169
- }
50170
- ) });
50171
50421
  }
50172
50422
  const Route$h = createFileRoute("/project/$projectId")({
50173
50423
  staleTime: 1 / 0,
@@ -51179,7 +51429,7 @@ function layoutRelationshipsView(data) {
51179
51429
  x: position.x,
51180
51430
  y: position.y,
51181
51431
  title: element.title,
51182
- description: element.description,
51432
+ description: element.description.$source,
51183
51433
  technology: element.technology,
51184
51434
  tags: element.tags,
51185
51435
  links: null,
@@ -51293,7 +51543,8 @@ const cssExportView = css({
51293
51543
  margin: 0,
51294
51544
  marginRight: "auto",
51295
51545
  marginBottom: "auto",
51296
- background: "transparent"
51546
+ background: "transparent",
51547
+ overflow: "hidden"
51297
51548
  });
51298
51549
  css({
51299
51550
  position: "fixed",
@@ -51345,7 +51596,7 @@ function ExportPage() {
51345
51596
  if (!viewportRef.current)
51346
51597
  return;
51347
51598
  [...viewportRef.current.querySelectorAll(".react-flow__viewport")].forEach((el) => {
51348
- el.style.transform = "";
51599
+ el.style.transform = "translate(" + padding + "px, " + padding + "px)";
51349
51600
  });
51350
51601
  }
51351
51602
  ), useDebouncedEffect(
@@ -51371,7 +51622,6 @@ function ExportPage() {
51371
51622
  "data-testid": "export-page",
51372
51623
  className: cx(cssExportView),
51373
51624
  style: {
51374
- padding,
51375
51625
  minWidth: width,
51376
51626
  width,
51377
51627
  minHeight: height,
@@ -51382,7 +51632,14 @@ function ExportPage() {
51382
51632
  /* @__PURE__ */ jsx(
51383
51633
  StaticLikeC4Diagram,
51384
51634
  {
51385
- view: diagram,
51635
+ view: {
51636
+ ...diagram,
51637
+ bounds: {
51638
+ ...diagram.bounds,
51639
+ x: padding,
51640
+ y: padding
51641
+ }
51642
+ },
51386
51643
  fitView: !1,
51387
51644
  fitViewPadding: 0,
51388
51645
  background: "transparent",
@@ -51455,7 +51712,7 @@ function ViewReact() {
51455
51712
  search: !0
51456
51713
  });
51457
51714
  }), title2 = view ? view.title ?? view.id : "View not found";
51458
- if (useDocumentTitle(title2 + " - LikeC4"), !view)
51715
+ if (console.log(pageTitle), useDocumentTitle(`${title2} - ${pageTitle}`), !view)
51459
51716
  return /* @__PURE__ */ jsx(NotFound, {});
51460
51717
  const hasNotations = (view.notation?.nodes ?? []).length > 0;
51461
51718
  return /* @__PURE__ */ jsx(
@@ -51899,9 +52156,10 @@ function updateCursor() {
51899
52156
  constraintFlags |= flag;
51900
52157
  }), intersectsHorizontal && intersectsVertical ? setGlobalCursorStyle("intersection", constraintFlags) : intersectsHorizontal ? setGlobalCursorStyle("horizontal", constraintFlags) : intersectsVertical ? setGlobalCursorStyle("vertical", constraintFlags) : resetGlobalCursorStyle();
51901
52158
  }
51902
- let listenersAbortController = new AbortController();
52159
+ let listenersAbortController;
51903
52160
  function updateListeners() {
51904
- listenersAbortController.abort(), listenersAbortController = new AbortController();
52161
+ var _listenersAbortContro;
52162
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 || _listenersAbortContro.abort(), listenersAbortController = new AbortController();
51905
52163
  const options = {
51906
52164
  capture: !0,
51907
52165
  signal: listenersAbortController.signal