likec4 1.17.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,11 @@ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { createContext as createContext$1, useContext as useContext$1, useId as useId$1, useEffect as useEffect$1, useCallback as useCallback$1, Component, useLayoutEffect as useLayoutEffect$1, useRef as useRef$1, useInsertionEffect, useMemo as useMemo$1, forwardRef as forwardRef$1, Fragment, createElement as createElement$1, Children, isValidElement, useState as useState$1, memo as memo$1, Suspense, lazy, useSyncExternalStore, StrictMode } from "react";
4
4
  import { createRoot } from "react-dom/client";
5
- import { L as Link, c as createRootRouteWithContext, S as ScrollRestoration, O as Outlet, a as createFileRoute, u as useRouter, b as useParams, d as useRouterState, i as isNotFound, n as notFound, R as RouterProvider, e as createRouter$1, f as createHashHistory, g as createBrowserHistory } from "./tanstack-router-DJI32bwX.js";
6
- import { e as Container, f as Title, a as Text$6, G as Group, g as Button, h as useReducedMotion, i as useMergedRef, B as Box, t as themeToVars, j as useMantineStyleNonce, k as useComputedColorScheme, l as Popover, m as PopoverTarget, T as ThemeIcon, n as PopoverDropdown, S as ScrollAreaAutosize, c as clsx, A as ActionIcon$1, o as Stack$1, p as useTree, q as Tree, r as Tooltip$5, s as useId$2, v as SegmentedControl, P as Paper, w as Alert, x as Anchor, y as Pill, D as Divider$1, z as useViewportSize, R as RemoveScroll, C as Card, F as FocusTrap, E as FocusTrapInitialFocus, H as CloseButton, J as Badge, K as Flex, L as ActionIconGroup, M as Tabs, N as TabsList, O as TabsTab, Q as TabsPanel, U as ScrollArea, V as UnstyledButton, W as CopyButton$1, X as Code, Y as useLocalStorage, Z as useStateHistory, _ as Space, $ as useHotkeys, a0 as MantineContext, a1 as Menu, a2 as MenuTarget, a3 as MenuDropdown, a4 as MenuLabel, a5 as MenuDivider, a6 as TooltipGroup, a7 as MenuItem, a8 as keys$1, a9 as ColorSwatch, aa as CheckIcon, ab as rem, ac as Slider, ad as useDebouncedValue, b as CardSection, ae as Spoiler, af as ButtonGroup, ag as useHover, ah as FloatingIndicator, ai as useUncontrolled, aj as clampUseMovePosition, ak as useMove, al as HoverCard, am as HoverCardTarget, an as Overlay, ao as HoverCardDropdown, ap as Notification, aq as createTheme, ar as MantineProvider, as as useInViewport, at as SimpleGrid, u as useMantineColorScheme, au as Drawer, av as Select, aw as ModalRoot, ax as ModalOverlay, ay as ModalContent, az as ModalBody, aA as useMantineTheme, aB as useMediaQuery, aC as useDisclosure, aD as LoadingOverlay, aE as useCallbackRef, aF as Burger, aG as Loader } from "./mantine-CdYQpHSU.js";
5
+ import { L as Link, c as createRootRouteWithContext, S as ScrollRestoration, O as Outlet, a as createFileRoute, u as useRouter, b as useParams, d as useRouterState, i as isNotFound, n as notFound, R as RouterProvider, e as createRouter$1, f as createHashHistory, g as createBrowserHistory } from "./tanstack-router-CF1kJvtP.js";
6
+ import { e as Container, f as Title, a as Text$6, G as Group, g as Button, h as useReducedMotion, i as useMergedRef, B as Box, t as themeToVars, j as useMantineStyleNonce, S as Spotlight, k as SpotlightActionsGroup, d as Center, H as Highlight, l as useComputedColorScheme, m as Popover, n as PopoverTarget, T as ThemeIcon, o as PopoverDropdown, p as ScrollAreaAutosize, c as clsx, A as ActionIcon$1, q as Stack$1, r as useTree, s as Tree, v as Tooltip$5, w as useId$2, x as SegmentedControl, P as Paper, y as Alert, z as Anchor, D as Pill, E as Divider$1, F as useViewportSize, R as RemoveScroll, C as Card, J as FocusTrap, K as FocusTrapInitialFocus, L as CloseButton, M as Badge, N as Flex, O as ActionIconGroup, Q as Tabs, U as TabsList, V as TabsTab, W as TabsPanel, X as ScrollArea, Y as UnstyledButton, Z as CopyButton$1, _ as Code, $ as useLocalStorage, a0 as useStateHistory, a1 as Space, a2 as useHotkeys, a3 as MantineContext, a4 as Menu, a5 as MenuTarget, a6 as MenuDropdown, a7 as MenuLabel, a8 as MenuDivider, a9 as TooltipGroup, aa as MenuItem, ab as keys$1, ac as ColorSwatch, ad as CheckIcon, ae as rem, af as Slider, ag as useDebouncedValue, b as CardSection, ah as Spoiler, ai as ButtonGroup, aj as useHover, ak as FloatingIndicator, al as useUncontrolled, am as clampUseMovePosition, an as useMove, ao as openSpotlight, ap as HoverCard, aq as HoverCardTarget, ar as Overlay, as as HoverCardDropdown, at as Notification, au as createTheme, av as MantineProvider, aw as useInViewport, ax as SimpleGrid, u as useMantineColorScheme, ay as Drawer, az as Select, aA as ModalRoot, aB as ModalOverlay, aC as ModalContent, aD as ModalBody, aE as useMantineTheme, aF as useMediaQuery, aG as useDisclosure, aH as LoadingOverlay, aI as useCallbackRef, aJ as Burger, aK as Loader } from "./mantine-BzD51ZKm.js";
7
7
  import { withOverviewGraph, ComponentName, isDevelopment, krokiD2SvgUrl, basepath, useHashHistory } from "../const.js";
8
8
  import { useLikeC4ModelAtom } from "virtual:likec4/model";
9
- import { g as getDefaultExportFromCjs, d as useReactFlow, e as useStoreApi, f as useStore$1, h as useNodesData, j as getNodeDimensions, k as createWithEqualityFn, l as applyNodeChanges, m as applyEdgeChanges, n as getViewportForBounds, o as getBoundsOfRects, s as shallow$1, p as boxToRect, q as useStoreWithEqualityFn, M as MarkerType, H as Handle, P as Position, r as getBezierPath, B as BaseEdge, E as EdgeLabelRenderer, i as index, t as Panel$1, V as ViewportPortal, R as ReactFlowProvider, v as useOnViewportChange, x as useInternalNode, N as NodeToolbar, b as Background, c as BackgroundVariant } from "./likec4-CLNXvKhh.js";
9
+ import { g as getDefaultExportFromCjs, d as useReactFlow, e as useStoreApi, f as useStore$1, h as useNodesData, j as getNodeDimensions, k as createWithEqualityFn, l as applyNodeChanges, m as applyEdgeChanges, n as getViewportForBounds, o as getBoundsOfRects, s as shallow$1, p as boxToRect, q as useStoreWithEqualityFn, M as MarkerType, H as Handle, P as Position, r as getBezierPath, B as BaseEdge, E as EdgeLabelRenderer, i as index, t as Panel$1, V as ViewportPortal, R as ReactFlowProvider, v as useOnViewportChange, x as useInternalNode, N as NodeToolbar, b as Background, c as BackgroundVariant } from "./likec4-DF_Jsv_p.js";
10
10
  import { RenderIcon } from "../icons.js";
11
11
  import { usePreviewUrl } from "virtual:likec4/previews";
12
12
  var content = "_1u4wf800", image = "_1u4wf801", inner = "_1u4wf802", root = "_1u4wf803", description$2 = "_1u4wf804", title$5 = "_1u4wf805";
@@ -257,9 +257,12 @@ function u$9(r2, n2, a2) {
257
257
  if (o2 === 1) return u$a(r2, n2, a2);
258
258
  throw new Error("Wrong number of arguments");
259
259
  }
260
+ function r$6(...t2) {
261
+ return u$9(Object.values, t2);
262
+ }
260
263
  var s$3 = { done: !1, hasNext: !1 };
261
264
  function x$1(t2, ...o2) {
262
- let n2 = t2, u2 = o2.map((e2) => "lazy" in e2 ? f$4(e2) : void 0), p2 = 0;
265
+ let n2 = t2, u2 = o2.map((e2) => "lazy" in e2 ? f$3(e2) : void 0), p2 = 0;
263
266
  for (; p2 < o2.length; ) {
264
267
  if (u2[p2] === void 0 || !B(n2)) {
265
268
  let i2 = o2[p2];
@@ -295,14 +298,14 @@ function A(t2, o2, n2) {
295
298
  }
296
299
  return p2.hasNext && o2.push(u2), e2;
297
300
  }
298
- function f$4(t2) {
301
+ function f$3(t2) {
299
302
  let { lazy: o2, lazyArgs: n2 } = t2, u2 = o2(...n2);
300
303
  return Object.assign(u2, { isSingle: o2.single ?? !1, index: 0, items: [] });
301
304
  }
302
305
  function B(t2) {
303
306
  return typeof t2 == "string" || typeof t2 == "object" && t2 !== null && Symbol.iterator in t2;
304
307
  }
305
- function f$3(t2, i2) {
308
+ function f$2(t2, i2) {
306
309
  let o2 = i2.length - t2.length;
307
310
  if (o2 === 1) {
308
311
  let [n2, ...r2] = i2;
@@ -314,23 +317,20 @@ function f$3(t2, i2) {
314
317
  }
315
318
  throw new Error("Wrong number of arguments");
316
319
  }
317
- function i$8(...e2) {
318
- return f$3(o$9, e2);
320
+ function i$9(...e2) {
321
+ return f$2(o$a, e2);
319
322
  }
320
- function o$9() {
323
+ function o$a() {
321
324
  let e2 = /* @__PURE__ */ new Set();
322
325
  return (t2) => e2.has(t2) ? s$3 : (e2.add(t2), { done: !1, hasNext: !0, next: t2 });
323
326
  }
324
- function r$6(...n2) {
325
- return u$9(Object.values, n2);
326
- }
327
- function i$7(...e2) {
327
+ function i$8(...e2) {
328
328
  return u$9(r$5, e2);
329
329
  }
330
330
  var r$5 = (e2, t2) => e2.length >= t2, T$1 = { asc: (r2, n2) => r2 > n2, desc: (r2, n2) => r2 < n2 };
331
- function m$3(r2, n2) {
331
+ function s$2(r2, n2) {
332
332
  let [e2, ...o2] = n2;
333
- if (!s$2(e2)) {
333
+ if (!m$3(e2)) {
334
334
  let t2 = u$8(...o2);
335
335
  return r2(e2, t2);
336
336
  }
@@ -340,11 +340,11 @@ function m$3(r2, n2) {
340
340
  function u$8(r2, n2, ...e2) {
341
341
  let o2 = typeof r2 == "function" ? r2 : r2[0], a2 = typeof r2 == "function" ? "asc" : r2[1], { [a2]: t2 } = T$1, i2 = n2 === void 0 ? void 0 : u$8(n2, ...e2);
342
342
  return (y2, c) => {
343
- let l2 = o2(y2), p2 = o2(c);
344
- return t2(l2, p2) ? 1 : t2(p2, l2) ? -1 : i2?.(y2, c) ?? 0;
343
+ let p2 = o2(y2), l2 = o2(c);
344
+ return t2(p2, l2) ? 1 : t2(l2, p2) ? -1 : i2?.(y2, c) ?? 0;
345
345
  };
346
346
  }
347
- function s$2(r2) {
347
+ function m$3(r2) {
348
348
  if (d$3(r2)) return !0;
349
349
  if (typeof r2 != "object" || !Array.isArray(r2)) return !1;
350
350
  let [n2, e2, ...o2] = r2;
@@ -352,9 +352,9 @@ function s$2(r2) {
352
352
  }
353
353
  var d$3 = (r2) => typeof r2 == "function" && r2.length === 1;
354
354
  function u$7(...e2) {
355
- return u$9(i$6, e2);
355
+ return u$9(i$7, e2);
356
356
  }
357
- function i$6(e2, a2) {
357
+ function i$7(e2, a2) {
358
358
  let n2 = [];
359
359
  for (let [o2, r2] of e2.entries()) {
360
360
  if (!a2(r2, o2, e2)) break;
@@ -363,9 +363,9 @@ function i$6(e2, a2) {
363
363
  return n2;
364
364
  }
365
365
  function r$4(...n2) {
366
- return u$9(e$4, n2);
366
+ return u$9(e$3, n2);
367
367
  }
368
- function e$4(n2, o2) {
368
+ function e$3(n2, o2) {
369
369
  return o2(n2), n2;
370
370
  }
371
371
  function b(t2) {
@@ -392,17 +392,17 @@ function r$3(e2, u2, t2) {
392
392
  return { ...y2, [n2]: r$3(T2, a2, t2) };
393
393
  }
394
394
  function m$2(...r2) {
395
- return u$9(o$8, r2);
395
+ return u$9(o$9, r2);
396
396
  }
397
- function o$8(r2, t2) {
397
+ function o$9(r2, t2) {
398
398
  let e2 = [...r2];
399
399
  return e2.sort(t2), e2;
400
400
  }
401
401
  function a$3(...r2) {
402
- return m$3(o$7, r2);
402
+ return s$2(n$6, r2);
403
403
  }
404
- var o$7 = (r2, n2) => [...r2].sort(n2);
405
- function o$6(r2, n2) {
404
+ var n$6 = (r2, t2) => [...r2].sort(t2);
405
+ function o$8(r2, n2) {
406
406
  let e2 = Math.ceil(r2), t2 = Math.floor(n2);
407
407
  if (t2 < e2) throw new RangeError(`randomInteger: The range [${r2.toString()},${n2.toString()}] contains no integer`);
408
408
  return Math.floor(Math.random() * (t2 - e2 + 1) + e2);
@@ -417,24 +417,24 @@ function t$7(...e2) {
417
417
  function r$2(e2) {
418
418
  return [...e2].reverse();
419
419
  }
420
- function i$5(...e2) {
421
- return u$9(y$5, e2);
420
+ function i$6(...e2) {
421
+ return u$9(o$7, e2);
422
422
  }
423
- function y$5(e2, r2) {
424
- let o2 = {};
425
- for (let n2 of r2) n2 in e2 && (o2[n2] = e2[n2]);
426
- return o2;
423
+ function o$7(e2, n2) {
424
+ let t2 = {};
425
+ for (let r2 of n2) r2 in e2 && (t2[r2] = e2[r2]);
426
+ return t2;
427
427
  }
428
428
  function p$3(...n2) {
429
429
  return u$9(t$6, n2);
430
430
  }
431
431
  var t$6 = (n2, e2) => n2[e2];
432
432
  function y$4(...t2) {
433
- return u$9(f$2, t2);
433
+ return u$9(f$1, t2);
434
434
  }
435
- function f$2(t2, e2) {
436
- if (!i$7(e2, 1)) return { ...t2 };
437
- if (!i$7(e2, 2)) {
435
+ function f$1(t2, e2) {
436
+ if (!i$8(e2, 1)) return { ...t2 };
437
+ if (!i$8(e2, 2)) {
438
438
  let { [e2[0]]: r2, ...m2 } = t2;
439
439
  return m2;
440
440
  }
@@ -443,13 +443,13 @@ function f$2(t2, e2) {
443
443
  return o2;
444
444
  }
445
445
  function t$5(...n2) {
446
- return u$9(o$5, n2);
446
+ return u$9(o$6, n2);
447
447
  }
448
- var o$5 = (n2) => n2.length === 1 ? n2[0] : void 0;
448
+ var o$6 = (n2) => n2.length === 1 ? n2[0] : void 0;
449
449
  function d$2(...r2) {
450
- return u$9(i$4, r2);
450
+ return u$9(i$5, r2);
451
451
  }
452
- var i$4 = (r2, t2) => {
452
+ var i$5 = (r2, t2) => {
453
453
  let a2 = [[], []];
454
454
  for (let [o2, e2] of r2.entries()) t2(e2, o2, r2) ? a2[0].push(e2) : a2[1].push(e2);
455
455
  return a2;
@@ -462,9 +462,9 @@ function a$2(...e2) {
462
462
  }
463
463
  var n$5 = (e2) => e2.at(-1);
464
464
  function m$1(...a2) {
465
- return u$9(o$4, a2, p$2);
465
+ return u$9(o$5, a2, p$2);
466
466
  }
467
- var o$4 = (a2, e2) => a2.map(e2), p$2 = (a2) => (e2, r2, t2) => ({ done: !1, hasNext: !0, next: a2(e2, r2, t2) });
467
+ var o$5 = (a2, e2) => a2.map(e2), p$2 = (a2) => (e2, t2, r2) => ({ done: !1, hasNext: !0, next: a2(e2, t2, r2) });
468
468
  function l$3(...n2) {
469
469
  return u$9(d$1, n2);
470
470
  }
@@ -488,16 +488,16 @@ function n$3(l2) {
488
488
  function l$2(n2) {
489
489
  return n2 != null;
490
490
  }
491
- function o$3(a2) {
491
+ function o$4(a2) {
492
492
  return (t2) => !a2(t2);
493
493
  }
494
- function e$3(n2) {
495
- return n2 == null;
494
+ function n$2(e2) {
495
+ return e2 == null;
496
496
  }
497
497
  function e$2(r2) {
498
498
  return typeof r2 == "number" && !Number.isNaN(r2);
499
499
  }
500
- function n$2(r2) {
500
+ function o$3(r2) {
501
501
  return Array.isArray(r2);
502
502
  }
503
503
  function n$1(e2) {
@@ -514,17 +514,17 @@ var o$2 = (a2, r2) => a2.flatMap(r2), l$1 = (a2) => (r2, t2, y2) => {
514
514
  return Array.isArray(n2) ? { done: !1, hasNext: !0, hasMany: !0, next: n2 } : { done: !1, hasNext: !0, next: n2 };
515
515
  };
516
516
  function u$4(...e2) {
517
- return u$9(o$1, e2, i$3);
517
+ return u$9(o$1, e2, i$4);
518
518
  }
519
519
  function o$1(e2, r2) {
520
520
  return e2.forEach(r2), e2;
521
521
  }
522
- var i$3 = (e2) => (r2, n2, t2) => (e2(r2, n2, t2), { done: !1, hasNext: !0, next: r2 });
523
- function f$1(...e2) {
522
+ var i$4 = (e2) => (r2, n2, t2) => (e2(r2, n2, t2), { done: !1, hasNext: !0, next: r2 });
523
+ function i$3(...e2) {
524
524
  return u$9(a$1, e2);
525
525
  }
526
526
  function a$1(e2, r2) {
527
- for (let [o2, t2] of Object.entries(e2)) r2(t2, o2, e2);
527
+ for (let [t2, o2] of Object.entries(e2)) r2(o2, t2, e2);
528
528
  return e2;
529
529
  }
530
530
  function i$2(...e2) {
@@ -563,7 +563,7 @@ function u$2(n2, t2 = [], r2 = []) {
563
563
  if (typeof n2 == "function") return n2;
564
564
  if (typeof n2 != "object" || n2 === null || n2 instanceof Date || n2 instanceof RegExp) return structuredClone(n2);
565
565
  let o2 = t2.indexOf(n2);
566
- return o2 >= 0 ? r2[o2] : (t2.push(n2), Array.isArray(n2) ? y$2(n2, t2, r2) : s(n2, t2, r2));
566
+ return o2 !== -1 ? r2[o2] : (t2.push(n2), Array.isArray(n2) ? y$2(n2, t2, r2) : s(n2, t2, r2));
567
567
  }
568
568
  function s(n2, t2, r2) {
569
569
  let o2 = {};
@@ -633,11 +633,11 @@ function whereOperatorAsPredicate(operator) {
633
633
  return (value) => value.kind === kind2;
634
634
  }
635
635
  const kind = operator.kind.neq;
636
- return (value) => e$3(value.kind) || value.kind !== kind;
636
+ return (value) => n$2(value.kind) || value.kind !== kind;
637
637
  }
638
638
  case isNotOperator(operator): {
639
639
  const predicate = whereOperatorAsPredicate(operator.not);
640
- return o$3(predicate);
640
+ return o$4(predicate);
641
641
  }
642
642
  case isAndOperator(operator): {
643
643
  const predicates = operator.and.map(whereOperatorAsPredicate);
@@ -904,7 +904,7 @@ const blue$1 = {
904
904
  }, DELAY = "LIKEC4_DELAY";
905
905
  function delay$1(...args) {
906
906
  let ms = 100;
907
- return args.length === 2 ? ms = o$6(args[0], args[1]) : args.length === 1 && (ms = args[0]), new Promise((resolve) => {
907
+ return args.length === 2 ? ms = o$8(args[0], args[1]) : args.length === 1 && (ms = args[0]), new Promise((resolve) => {
908
908
  setTimeout(() => {
909
909
  resolve(DELAY);
910
910
  }, ms ?? 100);
@@ -1637,6 +1637,9 @@ class BaseAnimation {
1637
1637
  then(resolve, reject) {
1638
1638
  return this.currentFinishedPromise.then(resolve, reject);
1639
1639
  }
1640
+ flatten() {
1641
+ this.options.type = "keyframes", this.options.ease = "linear";
1642
+ }
1640
1643
  updateFinishedPromise() {
1641
1644
  this.currentFinishedPromise = new Promise((resolve) => {
1642
1645
  this.resolveFinishedPromise = resolve;
@@ -1995,6 +1998,9 @@ class MainThreadAnimation extends BaseAnimation {
1995
1998
  const { name, motionValue: motionValue2, element, keyframes: keyframes2 } = this.options, KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver, onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
1996
1999
  this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name, motionValue2, element), this.resolver.scheduleResolve();
1997
2000
  }
2001
+ flatten() {
2002
+ super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
2003
+ }
1998
2004
  initPlayback(keyframes$1) {
1999
2005
  const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options, generatorFactory = isGenerator(type) ? type : generators[type] || keyframes;
2000
2006
  let mapPercentToKeyframes, mirroredGenerator;
@@ -2158,7 +2164,7 @@ function mapEasingToNativeEasing(easing, duration) {
2158
2164
  if (easing)
2159
2165
  return typeof easing == "function" && supportsLinearEasing() ? generateLinearEasing(easing, duration) : isBezierDefinition(easing) ? cubicBezierAsString(easing) : Array.isArray(easing) ? easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[easing];
2160
2166
  }
2161
- function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2, times } = {}) {
2167
+ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}) {
2162
2168
  const keyframeOptions = { [valueName]: keyframes2 };
2163
2169
  times && (keyframeOptions.offset = times);
2164
2170
  const easing = mapEasingToNativeEasing(ease2, duration);
@@ -2407,6 +2413,9 @@ class GroupPlaybackControls {
2407
2413
  runAll(methodName) {
2408
2414
  this.animations.forEach((controls) => controls[methodName]());
2409
2415
  }
2416
+ flatten() {
2417
+ this.runAll("flatten");
2418
+ }
2410
2419
  play() {
2411
2420
  this.runAll("play");
2412
2421
  }
@@ -2500,7 +2509,7 @@ class MotionValue {
2500
2509
  * @internal
2501
2510
  */
2502
2511
  constructor(init, options = {}) {
2503
- this.version = "11.11.11", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v, render = !0) => {
2512
+ this.version = "11.11.17", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v, render = !0) => {
2504
2513
  const currentTime = time$1.now();
2505
2514
  this.updatedAt !== currentTime && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(v), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), render && this.events.renderRequest && this.events.renderRequest.notify(this.current);
2506
2515
  }, this.hasAnimated = !1, this.setCurrent(init), this.owner = options.owner;
@@ -6432,7 +6441,7 @@ function createLayoutConstraints(xyflowApi, editingNodeIds) {
6432
6441
  editingNodeIds.flatMap(ancestorsOf)
6433
6442
  ), traverse = new Array();
6434
6443
  for (const [, xynode] of nodeLookup)
6435
- e$3(xynode.parentId) && traverse.push({
6444
+ n$2(xynode.parentId) && traverse.push({
6436
6445
  xynode,
6437
6446
  parent: null
6438
6447
  });
@@ -6512,7 +6521,7 @@ function useLayoutConstraints() {
6512
6521
  T((n2) => n2.draggable !== !1),
6513
6522
  m$1((x2) => x2.id)
6514
6523
  );
6515
- i$7(draggingNodes, 1) && (solverRef.current = createLayoutConstraints(xystore, draggingNodes));
6524
+ i$8(draggingNodes, 1) && (solverRef.current = createLayoutConstraints(xystore, draggingNodes));
6516
6525
  },
6517
6526
  onNodeDrag: () => {
6518
6527
  solverRef.current?.onMove((nodes) => {
@@ -7474,7 +7483,7 @@ function bezierControlPoints(diagramEdge) {
7474
7483
  const handles = [
7475
7484
  // start
7476
7485
  ];
7477
- for (; i$7(bezierPoints, 3); ) {
7486
+ for (; i$8(bezierPoints, 3); ) {
7478
7487
  const [cp1, cp2, end, ...rest] = bezierPoints, bezier = new Bezier(start[0], start[1], cp1[0], cp1[1], cp2[0], cp2[1], end[0], end[1]), inflections = bezier.inflections();
7479
7488
  inflections.length === 0 && inflections.push(0.5), inflections.forEach((t2) => {
7480
7489
  const { x: x2, y: y2 } = bezier.get(t2);
@@ -7488,7 +7497,7 @@ function bezierControlPoints(diagramEdge) {
7488
7497
  }
7489
7498
  const isClose = (a2, b2) => Math.abs(a2 - b2) < 3.1;
7490
7499
  function isSamePoint$1(a2, b2) {
7491
- const [ax, ay] = n$2(a2) ? a2 : [a2.x, a2.y], [bx, by] = n$2(b2) ? b2 : [b2.x, b2.y];
7500
+ const [ax, ay] = o$3(a2) ? a2 : [a2.x, a2.y], [bx, by] = o$3(b2) ? b2 : [b2.x, b2.y];
7492
7501
  return isClose(ax, bx) && isClose(ay, by);
7493
7502
  }
7494
7503
  function stopPropagation$1(e2) {
@@ -7517,7 +7526,7 @@ function diagramViewToXYFlowData(view, opts) {
7517
7526
  const ns = "", nodeById = (id2) => nonNullable(nodeLookup.get(id2), `Node not found: ${id2}`);
7518
7527
  let next;
7519
7528
  for (; next = traverse.shift(); ) {
7520
- const { node: node2, parent } = next, isCompound = i$7(node2.children, 1) || node2.kind == ElementKind.Group;
7529
+ const { node: node2, parent } = next, isCompound = i$8(node2.children, 1) || node2.kind == ElementKind.Group;
7521
7530
  isCompound && traverse.push(...node2.children.map((child) => ({ node: nodeById(child), parent: node2 })));
7522
7531
  const position2 = {
7523
7532
  x: node2.position[0],
@@ -7561,7 +7570,7 @@ function diagramViewToXYFlowData(view, opts) {
7561
7570
  }
7562
7571
  for (const edge of view.edges) {
7563
7572
  const source = edge.source, target = edge.target, id2 = ns + edge.id;
7564
- if (!i$7(edge.points, 2)) {
7573
+ if (!i$8(edge.points, 2)) {
7565
7574
  console.error("edge should have at least 2 points", edge);
7566
7575
  continue;
7567
7576
  }
@@ -7590,6 +7599,329 @@ function diagramViewToXYFlowData(view, opts) {
7590
7599
  xyedges
7591
7600
  };
7592
7601
  }
7602
+ class Aligner {
7603
+ }
7604
+ class LinearAligner extends Aligner {
7605
+ constructor(getEdgePosition, computePosition, propertyToEdit) {
7606
+ super(), this.getEdgePosition = getEdgePosition, this.computePosition = computePosition, this.propertyToEdit = propertyToEdit;
7607
+ }
7608
+ alignTo;
7609
+ computeLayout(nodes) {
7610
+ this.alignTo = this.getEdgePosition(nodes);
7611
+ }
7612
+ applyPosition(node2) {
7613
+ return {
7614
+ [this.propertyToEdit]: this.computePosition(this.alignTo, node2)
7615
+ };
7616
+ }
7617
+ }
7618
+ class GridAligner extends Aligner {
7619
+ layout = /* @__PURE__ */ new Map();
7620
+ axisPreset;
7621
+ get primaryAxisCoord() {
7622
+ return this.axisPreset.primaryAxisCoord;
7623
+ }
7624
+ get secondaryAxisCoord() {
7625
+ return this.axisPreset.secondaryAxisCoord;
7626
+ }
7627
+ get primaryAxisDimension() {
7628
+ return this.axisPreset.primaryAxisDimension;
7629
+ }
7630
+ get secondaryAxisDimension() {
7631
+ return this.axisPreset.secondaryAxisDimension;
7632
+ }
7633
+ constructor(alignmentMode) {
7634
+ super(), this.axisPreset = alignmentMode === "Column" ? {
7635
+ primaryAxisDimension: "width",
7636
+ secondaryAxisDimension: "height",
7637
+ primaryAxisCoord: "x",
7638
+ secondaryAxisCoord: "y"
7639
+ } : {
7640
+ primaryAxisDimension: "height",
7641
+ secondaryAxisDimension: "width",
7642
+ primaryAxisCoord: "y",
7643
+ secondaryAxisCoord: "x"
7644
+ };
7645
+ }
7646
+ applyPosition(node2) {
7647
+ return this.layout?.get(node2.id) ?? {};
7648
+ }
7649
+ computeLayout(nodes) {
7650
+ const sortedNodeRects = x$1(
7651
+ nodes,
7652
+ a$3((r2) => r2[this.primaryAxisCoord])
7653
+ ), layoutRect = this.getLayoutRect(sortedNodeRects), layers = this.getLayers(sortedNodeRects);
7654
+ this.layout = this.buildLayout(layers, layoutRect, sortedNodeRects);
7655
+ }
7656
+ getLayoutRect(nodeRects) {
7657
+ const x2 = Math.min(...nodeRects.map((n2) => n2.x)), y2 = Math.min(...nodeRects.map((n2) => n2.y)), right = Math.max(...nodeRects.map((n2) => n2.x + n2.width)), bottom = Math.max(...nodeRects.map((n2) => n2.y + n2.height));
7658
+ return {
7659
+ x: x2,
7660
+ y: y2,
7661
+ width: right - x2,
7662
+ height: bottom - y2
7663
+ };
7664
+ }
7665
+ getLayers(sortedNodeRects) {
7666
+ const layers = [];
7667
+ let layerEnd = 0, layer = null;
7668
+ for (let node2 of sortedNodeRects)
7669
+ if (layer && node2[this.primaryAxisCoord] < layerEnd)
7670
+ layer.nodes.push(node2), layer.primaryAxisSize = Math.max(layer.primaryAxisSize, node2[this.primaryAxisDimension]), layer.occupiedSpace += node2[this.secondaryAxisDimension], layerEnd = Math.max(
7671
+ node2[this.primaryAxisCoord] + node2[this.primaryAxisDimension],
7672
+ layerEnd
7673
+ );
7674
+ else {
7675
+ layer = {
7676
+ primaryAxisSize: node2[this.primaryAxisDimension],
7677
+ nodes: [node2],
7678
+ occupiedSpace: node2[this.secondaryAxisDimension],
7679
+ layout: null
7680
+ }, layers.push(layer), layerEnd = node2[this.primaryAxisCoord] + node2[this.primaryAxisDimension];
7681
+ continue;
7682
+ }
7683
+ return layers.forEach(
7684
+ (l2) => l2.nodes.sort((a2, b2) => a2[this.secondaryAxisCoord] - b2[this.secondaryAxisCoord])
7685
+ ), layers;
7686
+ }
7687
+ buildLayout(layers, layoutRect, nodeRects) {
7688
+ const nodeMap = new Map(nodeRects.map((n2) => [n2.id, n2])), layout2 = [], occupiedSpace = layers.reduce((a2, b2) => a2 + b2.primaryAxisSize, 0), rowMargin = layers.length > 1 ? (layoutRect[this.primaryAxisDimension] - occupiedSpace) / (layers.length - 1) : 0, baseLayerIndex = layers.reduce(
7689
+ (widestLayerIndex, layer, i2) => layers[widestLayerIndex].occupiedSpace < layer.occupiedSpace ? i2 : widestLayerIndex,
7690
+ 0
7691
+ ), baseLayer = layers[baseLayerIndex], baseLayerPosition = layers.slice(0, baseLayerIndex).reduce(
7692
+ (a2, layer) => a2 + layer.primaryAxisSize + rowMargin,
7693
+ layoutRect[this.primaryAxisCoord]
7694
+ ), baseLayerLayout = this.buildLayerLayout(
7695
+ baseLayer,
7696
+ layoutRect,
7697
+ baseLayerPosition,
7698
+ nodeMap,
7699
+ null
7700
+ );
7701
+ baseLayer.layout = baseLayerLayout, layout2.push(...baseLayerLayout.nodePositions);
7702
+ let placeNextLayerAt = baseLayerPosition + baseLayer.primaryAxisSize + rowMargin, refLayer = baseLayer;
7703
+ for (let i2 = baseLayerIndex + 1; i2 < layers.length; i2++) {
7704
+ const layer = layers[i2];
7705
+ layer.layout = this.buildLayerLayout(layer, layoutRect, placeNextLayerAt, nodeMap, refLayer), layout2.push(...layer.layout.nodePositions), refLayer = layer.layout.refLayer ?? layer, placeNextLayerAt += layer.primaryAxisSize + rowMargin;
7706
+ }
7707
+ placeNextLayerAt = baseLayerPosition, refLayer = baseLayer;
7708
+ for (let i2 = baseLayerIndex - 1; i2 >= 0; i2--) {
7709
+ const layer = layers[i2];
7710
+ placeNextLayerAt -= layer.primaryAxisSize + rowMargin, layer.layout = this.buildLayerLayout(layer, layoutRect, placeNextLayerAt, nodeMap, refLayer), layout2.push(...layer.layout.nodePositions), refLayer = layer.layout.refLayer ?? layer;
7711
+ }
7712
+ return new Map(layout2);
7713
+ }
7714
+ buildLayerLayout(layer, layoutRect, placeNextLayerAt, nodeMap, refLayer) {
7715
+ let bestLayerLayout = this.scoreLayout(
7716
+ this.spaceAround(layer, layoutRect, placeNextLayerAt),
7717
+ nodeMap
7718
+ );
7719
+ if (layer.nodes.length != 1) {
7720
+ const currentlayerLayout = this.scoreLayout(
7721
+ this.spaceBetween(layer, layoutRect, placeNextLayerAt),
7722
+ nodeMap
7723
+ );
7724
+ bestLayerLayout = currentlayerLayout[0] < bestLayerLayout[0] ? currentlayerLayout : bestLayerLayout;
7725
+ }
7726
+ if (refLayer && refLayer.nodes.length - 1 >= layer.nodes.length) {
7727
+ const currentlayerLayout = this.scoreLayout(
7728
+ this.placeInGaps(layer, placeNextLayerAt, refLayer),
7729
+ nodeMap
7730
+ );
7731
+ bestLayerLayout = currentlayerLayout[0] < bestLayerLayout[0] ? currentlayerLayout : bestLayerLayout;
7732
+ }
7733
+ if (refLayer && refLayer.nodes.length >= layer.nodes.length) {
7734
+ const currentlayerLayout = this.scoreLayout(
7735
+ this.placeInCells(layer, placeNextLayerAt, refLayer),
7736
+ nodeMap
7737
+ );
7738
+ bestLayerLayout = currentlayerLayout[0] < bestLayerLayout[0] ? currentlayerLayout : bestLayerLayout;
7739
+ }
7740
+ return bestLayerLayout[1];
7741
+ }
7742
+ spaceBetween(layer, layoutRect, placeNextLayerAt) {
7743
+ const margin = (layoutRect[this.secondaryAxisDimension] - layer.occupiedSpace) / (layer.nodes.length - 1);
7744
+ let placeNextNodeAt = layoutRect[this.secondaryAxisCoord];
7745
+ const result = /* @__PURE__ */ new Map();
7746
+ for (let node2 of layer.nodes)
7747
+ result.set(node2.id, {
7748
+ [this.secondaryAxisCoord]: placeNextNodeAt,
7749
+ [this.primaryAxisCoord]: placeNextLayerAt
7750
+ }), placeNextNodeAt += node2[this.secondaryAxisDimension] + margin;
7751
+ return { nodePositions: result, refLayer: null };
7752
+ }
7753
+ spaceAround(layer, layoutRect, placeNextLayerAt) {
7754
+ const margin = (layoutRect[this.secondaryAxisDimension] - layer.occupiedSpace) / (layer.nodes.length + 1);
7755
+ let placeNextNodeAt = layoutRect[this.secondaryAxisCoord] + margin;
7756
+ const result = /* @__PURE__ */ new Map();
7757
+ for (let node2 of a$3(layer.nodes, (n2) => n2[this.secondaryAxisCoord]))
7758
+ result.set(node2.id, {
7759
+ [this.secondaryAxisCoord]: placeNextNodeAt,
7760
+ [this.primaryAxisCoord]: placeNextLayerAt
7761
+ }), placeNextNodeAt += node2[this.secondaryAxisDimension] + margin;
7762
+ return { nodePositions: result, refLayer: null };
7763
+ }
7764
+ placeInGaps(layer, placeNextLayerAt, refLayer) {
7765
+ const result = /* @__PURE__ */ new Map(), nodes = layer.nodes, placementOptions = this.getGapsPositions(refLayer);
7766
+ let optionIndex = 0;
7767
+ for (let i2 = 0, node2 = nodes[i2]; i2 < nodes.length; i2++, node2 = nodes[i2]) {
7768
+ const nodeCenter = node2[this.secondaryAxisCoord] + node2[this.secondaryAxisDimension] / 2;
7769
+ let bestOffset = 1 / 0;
7770
+ for (; optionIndex - i2 <= placementOptions.length - nodes.length; ) {
7771
+ const offset = placementOptions[optionIndex] - nodeCenter;
7772
+ if (Math.abs(offset) < Math.abs(bestOffset))
7773
+ bestOffset = offset, optionIndex++;
7774
+ else
7775
+ break;
7776
+ }
7777
+ result.set(node2.id, {
7778
+ [this.secondaryAxisCoord]: node2[this.secondaryAxisCoord] + bestOffset,
7779
+ [this.primaryAxisCoord]: placeNextLayerAt
7780
+ });
7781
+ }
7782
+ return { nodePositions: result, refLayer };
7783
+ }
7784
+ placeInCells(layer, placeNextLayerAt, refLayer) {
7785
+ const result = /* @__PURE__ */ new Map(), nodes = layer.nodes, placementOptions = this.getNodePositions(refLayer);
7786
+ let optionIndex = 0;
7787
+ for (let i2 = 0, node2 = nodes[i2]; i2 < nodes.length; i2++, node2 = nodes[i2]) {
7788
+ const nodeCenter = node2[this.secondaryAxisCoord] + node2[this.secondaryAxisDimension] / 2;
7789
+ let bestOffset = 1 / 0;
7790
+ for (; optionIndex - i2 <= placementOptions.length - nodes.length; ) {
7791
+ const offset = placementOptions[optionIndex] - nodeCenter;
7792
+ if (Math.abs(offset) < Math.abs(bestOffset))
7793
+ bestOffset = offset, optionIndex++;
7794
+ else
7795
+ break;
7796
+ }
7797
+ result.set(node2.id, {
7798
+ [this.secondaryAxisCoord]: node2[this.secondaryAxisCoord] + bestOffset,
7799
+ [this.primaryAxisCoord]: placeNextLayerAt
7800
+ });
7801
+ }
7802
+ return { nodePositions: result, refLayer };
7803
+ }
7804
+ scoreLayout(layout2, originalRects) {
7805
+ return [
7806
+ x$1(
7807
+ Array.from(layout2.nodePositions),
7808
+ m$1(([id2, position2]) => {
7809
+ const originalRect = originalRects.get(id2);
7810
+ return invariant$1(originalRect, `Could not find original rect for node ${id2}`), [i$6(originalRect, ["x", "y"]), position2];
7811
+ }),
7812
+ m$1(
7813
+ ([original, suggested]) => Math.abs(original[this.secondaryAxisCoord] - suggested[this.secondaryAxisCoord])
7814
+ ),
7815
+ l$4((a2, b2) => a2 + b2, 0)
7816
+ ),
7817
+ layout2
7818
+ ];
7819
+ }
7820
+ getGapsPositions(layer) {
7821
+ const result = [], { layout: layout2, nodes } = layer;
7822
+ invariant$1(layout2, "Layout of the layer must be computed before calling getGapsPositions");
7823
+ for (let i2 = 1; i2 < nodes.length; i2++) {
7824
+ const previousNode = nodes[i2 - 1], currentNode = nodes[i2], previousNodePosition = layout2.nodePositions.get(previousNode.id), currentNodePosition = layout2.nodePositions.get(currentNode.id);
7825
+ result.push(
7826
+ (currentNodePosition[this.secondaryAxisCoord] + previousNodePosition[this.secondaryAxisCoord] + previousNode[this.secondaryAxisDimension]) / 2
7827
+ );
7828
+ }
7829
+ return result;
7830
+ }
7831
+ getNodePositions(layer) {
7832
+ const result = [], { layout: layout2, nodes } = layer;
7833
+ invariant$1(layout2, "Layout of the layer must be computed before calling getGapsPositions");
7834
+ for (let i2 = 0; i2 < nodes.length; i2++) {
7835
+ const node2 = nodes[i2], nodePosition = layout2.nodePositions.get(node2.id);
7836
+ result.push(
7837
+ nodePosition[this.secondaryAxisCoord] + node2[this.secondaryAxisDimension] / 2
7838
+ );
7839
+ }
7840
+ return result;
7841
+ }
7842
+ }
7843
+ function getLinearAligner(mode) {
7844
+ switch (mode) {
7845
+ case "Left":
7846
+ return new LinearAligner(
7847
+ (nodes) => Math.min(...nodes.map((n2) => n2.x)),
7848
+ (alignTo, _) => Math.floor(alignTo),
7849
+ "x"
7850
+ );
7851
+ case "Top":
7852
+ return new LinearAligner(
7853
+ (nodes) => Math.min(...nodes.map((n2) => n2.y)),
7854
+ (alignTo, _) => Math.floor(alignTo),
7855
+ "y"
7856
+ );
7857
+ case "Right":
7858
+ return new LinearAligner(
7859
+ (nodes) => Math.max(...nodes.map((n2) => n2.x + n2.width)),
7860
+ (alignTo, node2) => Math.floor(alignTo - node2.width),
7861
+ "x"
7862
+ );
7863
+ case "Bottom":
7864
+ return new LinearAligner(
7865
+ (nodes) => Math.max(...nodes.map((n2) => n2.y + n2.height)),
7866
+ (alignTo, node2) => Math.floor(alignTo - node2.height),
7867
+ "y"
7868
+ );
7869
+ case "Center":
7870
+ return new LinearAligner(
7871
+ (nodes) => Math.min(...nodes.map((n2) => n2.x + n2.width / 2)),
7872
+ (alignTo, node2) => Math.floor(alignTo - node2.width / 2),
7873
+ "x"
7874
+ );
7875
+ case "Middle":
7876
+ return new LinearAligner(
7877
+ (nodes) => Math.min(...nodes.map((n2) => n2.y + n2.height / 2)),
7878
+ (alignTo, node2) => Math.floor(alignTo - node2.height / 2),
7879
+ "y"
7880
+ );
7881
+ }
7882
+ }
7883
+ function align(get) {
7884
+ return (mode) => {
7885
+ const { scheduleSaveManualLayout, xystore } = get(), { nodeLookup, parentLookup } = xystore.getState(), nodesToAlign = [...new Set(nodeLookup.values().filter((n2) => n2.selected).map((n2) => n2.id)).difference(new Set(parentLookup.keys()))];
7886
+ if (!i$8(nodesToAlign, 2)) {
7887
+ console.warn("At least 2 nodes must be selected to align");
7888
+ return;
7889
+ }
7890
+ const constraints = createLayoutConstraints(xystore, nodesToAlign), aligner = getAligner(mode);
7891
+ constraints.onMove((nodes) => {
7892
+ aligner.computeLayout(nodes.map(({ node: node2 }) => toNodeRect(node2))), nodes.forEach(({ rect, node: node2 }) => {
7893
+ rect.positionAbsolute = {
7894
+ ...rect.positionAbsolute,
7895
+ ...aligner.applyPosition(toNodeRect(node2))
7896
+ };
7897
+ });
7898
+ }), scheduleSaveManualLayout();
7899
+ };
7900
+ }
7901
+ function toNodeRect(node2) {
7902
+ return {
7903
+ ...node2.internals.positionAbsolute,
7904
+ id: node2.id,
7905
+ width: getNodeDimensions(node2).width,
7906
+ height: getNodeDimensions(node2).height
7907
+ };
7908
+ }
7909
+ function getAligner(mode) {
7910
+ switch (mode) {
7911
+ case "Left":
7912
+ case "Right":
7913
+ case "Top":
7914
+ case "Bottom":
7915
+ case "Center":
7916
+ case "Middle":
7917
+ return getLinearAligner(mode);
7918
+ case "Column":
7919
+ case "Row":
7920
+ return new GridAligner(mode);
7921
+ default:
7922
+ nonexhaustive(mode);
7923
+ }
7924
+ }
7593
7925
  const StringSet = Set, DEFAULT_PROPS = {
7594
7926
  xyedges: [],
7595
7927
  xynodes: [],
@@ -7689,7 +8021,7 @@ function createDiagramStore(props2) {
7689
8021
  fromNode: stepCurrent.nodeId
7690
8022
  }), lastOnNavigate && lastOnNavigate.toView !== nextView.id && (lastOnNavigate = null);
7691
8023
  const elTo = lastOnNavigate && nextView.nodes.find((n2) => n2.id === lastOnNavigate?.fromNode), xynodeFrom = elTo && xyflow2.getInternalNode(elTo.id);
7692
- if (!lastOnNavigate || e$3(elTo) || e$3(xynodeFrom)) {
8024
+ if (!lastOnNavigate || n$2(elTo) || n$2(xynodeFrom)) {
7693
8025
  const zoom = xyflow2.getZoom(), { x: x2, y: y2 } = getBBoxCenter(nextView.bounds);
7694
8026
  xyflow2.setCenter(x2, y2, { zoom }), lastOnNavigate = null;
7695
8027
  }
@@ -7905,7 +8237,7 @@ function createDiagramStore(props2) {
7905
8237
  const _updated = acc[data.edge.id] = {
7906
8238
  points: data.edge.points
7907
8239
  };
7908
- data.label?.bbox && (_updated.labelBBox = data.label.bbox), data.edge.labelBBox && (_updated.labelBBox ??= data.edge.labelBBox), i$7(controlPoints, 1) && (_updated.controlPoints = controlPoints), !sourceOrTargetMoved && data.edge.dotpos && (_updated.dotpos = data.edge.dotpos);
8240
+ data.label?.bbox && (_updated.labelBBox = data.label.bbox), data.edge.labelBBox && (_updated.labelBBox ??= data.edge.labelBBox), i$8(controlPoints, 1) && (_updated.controlPoints = controlPoints), !sourceOrTargetMoved && data.edge.dotpos && (_updated.dotpos = data.edge.dotpos);
7909
8241
  const allX = [
7910
8242
  ...data.edge.points.map((p2) => p2[0]),
7911
8243
  ...controlPoints.map((p2) => p2.x),
@@ -8162,41 +8494,7 @@ function createDiagramStore(props2) {
8162
8494
  return vector(v).mul(scale2).add(nodeCenter);
8163
8495
  }
8164
8496
  },
8165
- align: (mode) => {
8166
- const { scheduleSaveManualLayout, xystore } = get(), { nodeLookup, parentLookup } = xystore.getState(), nodesToAlign = [...new Set(nodeLookup.values().filter((n2) => n2.selected).map((n2) => n2.id)).difference(new Set(parentLookup.keys()))];
8167
- if (!i$7(nodesToAlign, 2)) {
8168
- console.warn("At least 2 nodes must be selected to align");
8169
- return;
8170
- }
8171
- const constraints = createLayoutConstraints(xystore, nodesToAlign);
8172
- let getEdgePosition, getPosition, propertyToEdit;
8173
- switch (mode) {
8174
- case "Left":
8175
- getEdgePosition = (nodes) => Math.min(...nodes.map((n2) => n2.internals.positionAbsolute.x)), propertyToEdit = "x", getPosition = (alignTo, _) => Math.floor(alignTo);
8176
- break;
8177
- case "Top":
8178
- getEdgePosition = (nodes) => Math.min(...nodes.map((n2) => n2.internals.positionAbsolute.y)), propertyToEdit = "y", getPosition = (alignTo, _) => Math.floor(alignTo);
8179
- break;
8180
- case "Right":
8181
- getEdgePosition = (nodes) => Math.max(...nodes.map((n2) => n2.internals.positionAbsolute.x + getNodeDimensions(n2).width)), propertyToEdit = "x", getPosition = (alignTo, node2) => Math.floor(alignTo - node2.width);
8182
- break;
8183
- case "Bottom":
8184
- getEdgePosition = (nodes) => Math.max(...nodes.map((n2) => n2.internals.positionAbsolute.y + getNodeDimensions(n2).height)), propertyToEdit = "y", getPosition = (alignTo, node2) => Math.floor(alignTo - node2.height);
8185
- break;
8186
- case "Center":
8187
- getEdgePosition = (nodes) => Math.max(...nodes.map((n2) => n2.internals.positionAbsolute.x + getNodeDimensions(n2).width / 2)), propertyToEdit = "x", getPosition = (alignTo, node2) => Math.floor(alignTo - getNodeDimensions(node2).width / 2);
8188
- break;
8189
- case "Middle":
8190
- getEdgePosition = (nodes) => Math.max(...nodes.map((n2) => n2.internals.positionAbsolute.y + getNodeDimensions(n2).height / 2)), propertyToEdit = "y", getPosition = (alignTo, node2) => Math.floor(alignTo - getNodeDimensions(node2).height / 2);
8191
- break;
8192
- }
8193
- constraints.onMove((nodes) => {
8194
- const alignTo = getEdgePosition(nodes.map(({ node: node2 }) => node2));
8195
- nodes.forEach(({ rect, node: node2 }) => {
8196
- rect.positionAbsolute = { ...rect.positionAbsolute, [propertyToEdit]: getPosition(alignTo, node2) };
8197
- });
8198
- }), scheduleSaveManualLayout();
8199
- }
8497
+ align: align(get)
8200
8498
  }),
8201
8499
  {
8202
8500
  name: `${storeDevId} - ${props2.view.id}`,
@@ -10143,8 +10441,8 @@ class Stylesheet {
10143
10441
  if (this.localClassNamesMap.has(transformedSelector))
10144
10442
  return this.transformClassname(transformedSelector);
10145
10443
  for (var results = this.localClassNamesSearch.search(transformedSelector), lastReplaceIndex = transformedSelector.length, i2 = results.length - 1; i2 >= 0; i2--) {
10146
- var [endIndex, [firstMatch]] = results[i2], startIndex = endIndex - firstMatch.length + 1;
10147
- startIndex >= lastReplaceIndex || (lastReplaceIndex = startIndex, transformedSelector[startIndex - 1] !== "." && (transformedSelector = replaceBetweenIndexes(transformedSelector, startIndex, endIndex + 1, this.transformClassname(firstMatch))));
10444
+ var [endIndex, [firstMatch]] = results[i2], startIndex = endIndex - firstMatch.length + 1, skipReplacement = lastReplaceIndex <= endIndex;
10445
+ skipReplacement || (lastReplaceIndex = startIndex, transformedSelector[startIndex - 1] !== "." && (transformedSelector = replaceBetweenIndexes(transformedSelector, startIndex, endIndex + 1, this.transformClassname(firstMatch))));
10148
10446
  }
10149
10447
  return transformedSelector;
10150
10448
  }
@@ -11693,6 +11991,13 @@ var IconLayoutAlignRight = createReactComponent("outline", "layout-align-right",
11693
11991
  * See the LICENSE file in the root directory of this source tree.
11694
11992
  */
11695
11993
  var IconLayoutAlignTop = createReactComponent("outline", "layout-align-top", "IconLayoutAlignTop", [["path", { d: "M4 4l16 0", key: "svg-0" }], ["path", { d: "M9 8m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z", key: "svg-1" }]]);
11994
+ /**
11995
+ * @license @tabler/icons-react v3.17.0 - MIT
11996
+ *
11997
+ * This source code is licensed under the MIT license.
11998
+ * See the LICENSE file in the root directory of this source tree.
11999
+ */
12000
+ var IconLayoutBoardSplit = createReactComponent("outline", "layout-board-split", "IconLayoutBoardSplit", [["path", { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z", key: "svg-0" }], ["path", { d: "M4 12h8", key: "svg-1" }], ["path", { d: "M12 15h8", key: "svg-2" }], ["path", { d: "M12 9h8", key: "svg-3" }], ["path", { d: "M12 4v16", key: "svg-4" }]]);
11696
12001
  /**
11697
12002
  * @license @tabler/icons-react v3.17.0 - MIT
11698
12003
  *
@@ -11728,6 +12033,13 @@ var IconMenu = createReactComponent("outline", "menu", "IconMenu", [["path", { d
11728
12033
  * See the LICENSE file in the root directory of this source tree.
11729
12034
  */
11730
12035
  var IconMoonStars = createReactComponent("outline", "moon-stars", "IconMoonStars", [["path", { d: "M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z", key: "svg-0" }], ["path", { d: "M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2", key: "svg-1" }], ["path", { d: "M19 11h2m-1 -1v2", key: "svg-2" }]]);
12036
+ /**
12037
+ * @license @tabler/icons-react v3.17.0 - MIT
12038
+ *
12039
+ * This source code is licensed under the MIT license.
12040
+ * See the LICENSE file in the root directory of this source tree.
12041
+ */
12042
+ var IconRectangularPrism = createReactComponent("outline", "rectangular-prism", "IconRectangularPrism", [["path", { d: "M21 14.008v-5.018a1.98 1.98 0 0 0 -1 -1.717l-4 -2.008a2.016 2.016 0 0 0 -2 0l-10 5.008c-.619 .355 -1 1.01 -1 1.718v5.018c0 .709 .381 1.363 1 1.717l4 2.008a2.016 2.016 0 0 0 2 0l10 -5.008c.619 -.355 1 -1.01 1 -1.718z", key: "svg-0" }], ["path", { d: "M9 21v-7.5", key: "svg-1" }], ["path", { d: "M9 13.5l11.5 -5.5", key: "svg-2" }], ["path", { d: "M3.5 11l5.5 2.5", key: "svg-3" }]]);
11731
12043
  /**
11732
12044
  * @license @tabler/icons-react v3.17.0 - MIT
11733
12045
  *
@@ -11735,6 +12047,13 @@ var IconMoonStars = createReactComponent("outline", "moon-stars", "IconMoonStars
11735
12047
  * See the LICENSE file in the root directory of this source tree.
11736
12048
  */
11737
12049
  var IconRouteOff = createReactComponent("outline", "route-off", "IconRouteOff", [["path", { d: "M6 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-0" }], ["path", { d: "M18 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-1" }], ["path", { d: "M12 19h4.5c.71 0 1.372 -.212 1.924 -.576m1.545 -2.459a3.5 3.5 0 0 0 -3.469 -3.965h-.499m-4 0h-3.501a3.5 3.5 0 0 1 -2.477 -5.972m2.477 -1.028h3.5", key: "svg-2" }], ["path", { d: "M3 3l18 18", key: "svg-3" }]]);
12050
+ /**
12051
+ * @license @tabler/icons-react v3.17.0 - MIT
12052
+ *
12053
+ * This source code is licensed under the MIT license.
12054
+ * See the LICENSE file in the root directory of this source tree.
12055
+ */
12056
+ var IconSearch = createReactComponent("outline", "search", "IconSearch", [["path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", key: "svg-0" }], ["path", { d: "M21 21l-6 -6", key: "svg-1" }]]);
11738
12057
  /**
11739
12058
  * @license @tabler/icons-react v3.17.0 - MIT
11740
12059
  *
@@ -11749,6 +12068,13 @@ var IconSelector = createReactComponent("outline", "selector", "IconSelector", [
11749
12068
  * See the LICENSE file in the root directory of this source tree.
11750
12069
  */
11751
12070
  var IconShare = createReactComponent("outline", "share", "IconShare", [["path", { d: "M6 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0", key: "svg-0" }], ["path", { d: "M18 6m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0", key: "svg-1" }], ["path", { d: "M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0", key: "svg-2" }], ["path", { d: "M8.7 10.7l6.6 -3.4", key: "svg-3" }], ["path", { d: "M8.7 13.3l6.6 3.4", key: "svg-4" }]]);
12071
+ /**
12072
+ * @license @tabler/icons-react v3.17.0 - MIT
12073
+ *
12074
+ * This source code is licensed under the MIT license.
12075
+ * See the LICENSE file in the root directory of this source tree.
12076
+ */
12077
+ var IconSitemap = createReactComponent("outline", "sitemap", "IconSitemap", [["path", { d: "M3 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z", key: "svg-0" }], ["path", { d: "M15 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z", key: "svg-1" }], ["path", { d: "M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z", key: "svg-2" }], ["path", { d: "M6 15v-1a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v1", key: "svg-3" }], ["path", { d: "M12 9l0 3", key: "svg-4" }]]);
11752
12078
  /**
11753
12079
  * @license @tabler/icons-react v3.17.0 - MIT
11754
12080
  *
@@ -11826,7 +12152,114 @@ var IconPlayerStopFilled = createReactComponent("filled", "player-stop-filled",
11826
12152
  * See the LICENSE file in the root directory of this source tree.
11827
12153
  */
11828
12154
  var IconStarFilled = createReactComponent("filled", "star-filled", "IconStarFilled", [["path", { d: "M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z", key: "svg-0" }]]);
11829
- const OverlayContext = createContext$1({});
12155
+ function filterAction(actionData, query) {
12156
+ const queryLower = query.toLowerCase(), keywordMatch = (Array.isArray(actionData.keywords) ? actionData.keywords : []).map((keyword) => {
12157
+ const index2 = keyword.toLowerCase().indexOf(queryLower);
12158
+ return index2 !== -1 ? {
12159
+ keyword,
12160
+ match: keyword.substring(index2, index2 + query.length)
12161
+ } : null;
12162
+ }).find((match) => !!match);
12163
+ return keywordMatch ? {
12164
+ data: actionData,
12165
+ keyword: keywordMatch.keyword,
12166
+ match: keywordMatch.match
12167
+ } : void 0;
12168
+ }
12169
+ function buildFilteredActions(actionsData, query) {
12170
+ return x$1(
12171
+ actionsData,
12172
+ m$1((a2) => filterAction(a2, query)),
12173
+ T((qm) => !!qm),
12174
+ m$1((qm) => buildSpotlightAction(qm))
12175
+ );
12176
+ }
12177
+ function highlightMatch(match) {
12178
+ return /* @__PURE__ */ jsx(Highlight, { highlight: match.match, children: match.keyword });
12179
+ }
12180
+ function buildSpotlightAction(matchedAction) {
12181
+ const isMatchInLabel = matchedAction.keyword == matchedAction.data.label;
12182
+ return /* @__PURE__ */ jsxs(Spotlight.Action, { onClick: matchedAction.data.onClick, children: [
12183
+ /* @__PURE__ */ jsx(Center, { style: { marginRight: "8px " }, children: matchedAction.data.leftSection }),
12184
+ /* @__PURE__ */ jsx(Group, { wrap: "nowrap", w: "100%", children: /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
12185
+ /* @__PURE__ */ jsx(Text$6, { children: isMatchInLabel ? highlightMatch(matchedAction) : matchedAction.data.label }),
12186
+ !isMatchInLabel && /* @__PURE__ */ jsx(Text$6, { opacity: 0.6, size: "xs", children: highlightMatch(matchedAction) })
12187
+ ] }) })
12188
+ ] });
12189
+ }
12190
+ const LikeC4Search = memo$1(() => {
12191
+ const view = useDiagramState((s2) => s2.view), model = useLikeC4Model(!0), store = useDiagramStoreApi(), [query, setQuery] = useState$1(""), getNodeActionsData = () => {
12192
+ const { focusOnNode } = store.getState();
12193
+ return x$1(
12194
+ view.nodes,
12195
+ T((n2) => !!n2.title),
12196
+ m$1((n2) => ({
12197
+ id: n2.id,
12198
+ label: n2.title,
12199
+ keywords: [
12200
+ n2.title,
12201
+ ...(n2.tags ?? []).map((t2) => `#${t2}`),
12202
+ ...n2.description ? [n2.description] : []
12203
+ ].filter((k) => k.toLowerCase()),
12204
+ onClick: () => focusOnNode(n2.id),
12205
+ leftSection: /* @__PURE__ */ jsx(IconRectangularPrism, {})
12206
+ }))
12207
+ );
12208
+ }, getViewActionsData = () => {
12209
+ const { onNavigateTo } = store.getState(), views = model.views();
12210
+ return m$1(views, (v) => ({
12211
+ id: v.id,
12212
+ label: v.title ?? v.id,
12213
+ keywords: [
12214
+ v.title ?? v.id,
12215
+ ...v.tags ?? [],
12216
+ ...v.view.description ? [v.view.description] : []
12217
+ ],
12218
+ onClick: () => {
12219
+ store.setState({
12220
+ hoveredNodeId: null,
12221
+ lastOnNavigate: {
12222
+ fromView: view.id,
12223
+ toView: v.id,
12224
+ fromNode: null
12225
+ }
12226
+ }), onNavigateTo?.(v.id);
12227
+ },
12228
+ leftSection: /* @__PURE__ */ jsx(IconSitemap, {})
12229
+ }));
12230
+ }, { nodeActions, viewActions } = useMemo$1(
12231
+ () => ({
12232
+ nodeActions: buildFilteredActions(getNodeActionsData(), query),
12233
+ viewActions: buildFilteredActions(getViewActionsData(), query)
12234
+ }),
12235
+ [model, store, view, query]
12236
+ ), portalProps = useMantinePortalProps();
12237
+ return /* @__PURE__ */ jsxs(
12238
+ Spotlight.Root,
12239
+ {
12240
+ ...portalProps,
12241
+ shortcut: ["mod + f", "mod + k"],
12242
+ query,
12243
+ onQueryChange: setQuery,
12244
+ scrollable: !0,
12245
+ maxHeight: "calc(100vh - 100px)",
12246
+ children: [
12247
+ /* @__PURE__ */ jsx(
12248
+ Spotlight.Search,
12249
+ {
12250
+ placeholder: "Search elements in current view and other views...",
12251
+ leftSection: /* @__PURE__ */ jsx(IconSearch, { stroke: 1.5 })
12252
+ }
12253
+ ),
12254
+ /* @__PURE__ */ jsxs(Spotlight.ActionsList, { children: [
12255
+ nodeActions.length > 0 && /* @__PURE__ */ jsx(SpotlightActionsGroup, { label: "Elements", children: nodeActions }),
12256
+ viewActions.length > 0 && /* @__PURE__ */ jsx(SpotlightActionsGroup, { label: "Views", children: viewActions }),
12257
+ nodeActions.length == 0 && viewActions.length == 0 && /* @__PURE__ */ jsx(Spotlight.Empty, { children: "Nothing found..." })
12258
+ ] })
12259
+ ]
12260
+ }
12261
+ );
12262
+ }), OverlayContext = createContext$1({});
11830
12263
  function useOverlayDialog() {
11831
12264
  return useContext$1(OverlayContext);
11832
12265
  }
@@ -13595,10 +14028,10 @@ function hasConflict(conflicts, v, w) {
13595
14028
  return !!conflicts[v] && Object.hasOwn(conflicts[v], w);
13596
14029
  }
13597
14030
  function verticalAlignment(g, layering, conflicts, neighborFn) {
13598
- let root2 = {}, align = {}, pos = {};
14031
+ let root2 = {}, align2 = {}, pos = {};
13599
14032
  return layering.forEach((layer) => {
13600
14033
  layer.forEach((v, order2) => {
13601
- root2[v] = v, align[v] = v, pos[v] = order2;
14034
+ root2[v] = v, align2[v] = v, pos[v] = order2;
13602
14035
  });
13603
14036
  }), layering.forEach((layer) => {
13604
14037
  let prevIdx = -1;
@@ -13609,13 +14042,13 @@ function verticalAlignment(g, layering, conflicts, neighborFn) {
13609
14042
  let mp = (ws.length - 1) / 2;
13610
14043
  for (let i2 = Math.floor(mp), il = Math.ceil(mp); i2 <= il; ++i2) {
13611
14044
  let w = ws[i2];
13612
- align[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w) && (align[w] = v, align[v] = root2[v] = root2[w], prevIdx = pos[w]);
14045
+ align2[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w) && (align2[w] = v, align2[v] = root2[v] = root2[w], prevIdx = pos[w]);
13613
14046
  }
13614
14047
  }
13615
14048
  });
13616
- }), { root: root2, align };
14049
+ }), { root: root2, align: align2 };
13617
14050
  }
13618
- function horizontalCompaction(g, layering, root2, align, reverseSep) {
14051
+ function horizontalCompaction(g, layering, root2, align2, reverseSep) {
13619
14052
  let xs = {}, blockG = buildBlockGraph(g, layering, root2, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight";
13620
14053
  function iterate(setXsFunc, nextNodesFunc) {
13621
14054
  let stack = blockG.nodes(), elem = stack.pop(), visited = {};
@@ -13629,7 +14062,7 @@ function horizontalCompaction(g, layering, root2, align, reverseSep) {
13629
14062
  let min2 = blockG.outEdges(elem).reduce((acc, e2) => Math.min(acc, xs[e2.w] - blockG.edge(e2)), Number.POSITIVE_INFINITY), node2 = g.node(elem);
13630
14063
  min2 !== Number.POSITIVE_INFINITY && node2.borderType !== borderType && (xs[elem] = Math.max(xs[elem], min2));
13631
14064
  }
13632
- return iterate(pass1, blockG.predecessors.bind(blockG)), iterate(pass2, blockG.successors.bind(blockG)), Object.keys(align).forEach((v) => xs[v] = xs[root2[v]]), xs;
14065
+ return iterate(pass1, blockG.predecessors.bind(blockG)), iterate(pass2, blockG.successors.bind(blockG)), Object.keys(align2).forEach((v) => xs[v] = xs[root2[v]]), xs;
13633
14066
  }
13634
14067
  function buildBlockGraph(g, layering, root2, reverseSep) {
13635
14068
  let blockGraph = new Graph$2(), graphLabel = g.graph(), sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
@@ -13667,10 +14100,10 @@ function alignCoordinates(xss, alignTo) {
13667
14100
  });
13668
14101
  });
13669
14102
  }
13670
- function balance(xss, align) {
14103
+ function balance(xss, align2) {
13671
14104
  return util$3.mapValues(xss.ul, (num, v) => {
13672
- if (align)
13673
- return xss[align.toLowerCase()][v];
14105
+ if (align2)
14106
+ return xss[align2.toLowerCase()][v];
13674
14107
  {
13675
14108
  let xs = Object.values(xss).map((xs2) => xs2[v]).sort((a2, b2) => a2 - b2);
13676
14109
  return (xs[1] + xs[2]) / 2;
@@ -13685,11 +14118,11 @@ function positionX$1(g) {
13685
14118
  ["u", "d"].forEach((vert) => {
13686
14119
  adjustedLayering = vert === "u" ? layering : Object.values(layering).reverse(), ["l", "r"].forEach((horiz) => {
13687
14120
  horiz === "r" && (adjustedLayering = adjustedLayering.map((inner2) => Object.values(inner2).reverse()));
13688
- let neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g), align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn), xs = horizontalCompaction(
14121
+ let neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g), align2 = verticalAlignment(g, adjustedLayering, conflicts, neighborFn), xs = horizontalCompaction(
13689
14122
  g,
13690
14123
  adjustedLayering,
13691
- align.root,
13692
- align.align,
14124
+ align2.root,
14125
+ align2.align,
13693
14126
  horiz === "r"
13694
14127
  );
13695
14128
  horiz === "r" && (xs = util$3.mapValues(xs, (x2) => -x2)), xss[vert + horiz] = xs;
@@ -14155,7 +14588,7 @@ function useLayoutedEdgeDetails(edgeId) {
14155
14588
  layout$1
14156
14589
  ]);
14157
14590
  }
14158
- var elementNode$1 = "xsefl30", elementNodeContent$1 = "xsefl31", elementNodeTitle$1 = "xsefl32", elementNodeDescription$1 = "xsefl33", compoundNodeBody$1 = "xsefl34", compoundNodeTitle$1 = "xsefl35", cssShapeSvg$1 = "xsefl36", edgeContainer$1 = "xsefl37", edgeLabel$2 = "xsefl38 xsefl37", edgeLabelText$2 = "xsefl39", edgeLabelTechnology$1 = "xsefl3a", navigateBtnBox$1 = "xsefl3b", navigateBtn$3 = "xsefl3c";
14591
+ var elementNode$1 = "xsefl30", elementNodeContent$1 = "xsefl31", elementNodeTitle$1 = "xsefl32", elementNodeDescription$1 = "xsefl33", compoundNodeBody$1 = "xsefl34", compoundNodeTitle$1 = "xsefl35", cssShapeSvg$1 = "xsefl36", edgeContainer$1 = "xsefl37", edgeLabel$2 = "xsefl38 xsefl37", edgeLabelText$2 = "xsefl39", edgeLabelTechnology$1 = "xsefl3a", navigateBtnBox$2 = "xsefl3b", navigateBtn$3 = "xsefl3c";
14159
14592
  const Text$5 = Text$6.withProps({
14160
14593
  component: "div"
14161
14594
  });
@@ -14226,7 +14659,7 @@ function CompoundNode$1({
14226
14659
  ))
14227
14660
  ] });
14228
14661
  }
14229
- var container$6 = "_14ylloj1", handleCenter = "_14ylloj2", containerAnimated = "_14ylloj3", dimmed$2 = "_14ylloj4", indicator$1 = "_14ylloj7", fillElementFill = "_14ylloj8", fillMixStroke = "_14ylloja", hasIcon = "_14yllojb", title$4 = "_14ylloje", description$1 = "_14yllojf", technology = "_14yllojg", elementDataContainer = "_14yllojh", elementTextData = "_14ylloji", elementIcon$2 = "_14yllojj", shapeSvg$1 = "_14yllojm", navigateBtn$2 = "_14yllojo _14yllojn", detailsBtn$1 = "_14yllojp _14yllojn";
14662
+ var container$6 = "_14ylloj1", handleCenter = "_14ylloj2", containerAnimated = "_14ylloj3", dimmed$2 = "_14ylloj4", indicator$1 = "_14ylloj7", fillElementFill = "_14ylloj8", fillMixStroke = "_14ylloja", hasIcon = "_14yllojb", title$4 = "_14ylloje", description$1 = "_14yllojf", technology = "_14yllojg", elementDataContainer = "_14yllojh", elementTextData = "_14ylloji", elementIcon$2 = "_14yllojj", shapeSvg$1 = "_14yllojm", navigateBtnBox$1 = "_14yllojo", navigateBtn$2 = "_14yllojp _14yllojn", detailsBtn$1 = "_14yllojq _14yllojn";
14230
14663
  function cylinderSVGPath(diameter, height, tilt = 0.065) {
14231
14664
  const radius = Math.round(diameter / 2), rx = radius, ry = toDomPrecision(tilt * radius), tiltAdjustedHeight = height - 2 * ry;
14232
14665
  return {
@@ -14455,7 +14888,7 @@ function ElementNode$1({
14455
14888
  /* @__PURE__ */ jsx(Text$4, { className: elementNodeTitle$1, lineClamp: 2, children: element.title }),
14456
14889
  element.description && /* @__PURE__ */ jsx(Text$4, { className: elementNodeDescription$1, lineClamp: 4, children: element.description })
14457
14890
  ] }),
14458
- /* @__PURE__ */ jsxs(Group, { className: navigateBtnBox$1, children: [
14891
+ /* @__PURE__ */ jsxs(Group, { className: navigateBtnBox$2, children: [
14459
14892
  navigateTo && onNavigateTo && navigateTo !== currentViewId && /* @__PURE__ */ jsx(
14460
14893
  Action$2,
14461
14894
  {
@@ -15116,7 +15549,7 @@ function layout(subjectId, view, likec4model, scope) {
15116
15549
  T(l$2),
15117
15550
  // Group relations with saame source and target - make them one edge
15118
15551
  i$2(p$3("id")),
15119
- f$1((grouped) => {
15552
+ i$3((grouped) => {
15120
15553
  const { source, target } = grouped[0], relations = m$1(grouped, (g2) => g2.relation);
15121
15554
  source.data.ports.right.push({
15122
15555
  id: target.id,
@@ -15632,7 +16065,7 @@ const nodeTypes$1 = {
15632
16065
  empty: EmptyNode
15633
16066
  }, edgeTypes$1 = {
15634
16067
  relation: RelationshipEdge$1
15635
- }, findRootSubject = (nodes) => nodes.find((n2) => n2.data.column === "subjects" && e$3(n2.parentId)), resetDimmedAndHovered = (xyflow2) => {
16068
+ }, findRootSubject = (nodes) => nodes.find((n2) => n2.data.column === "subjects" && n$2(n2.parentId)), resetDimmedAndHovered = (xyflow2) => {
15636
16069
  xyflow2.setEdges(
15637
16070
  (edges) => edges.map((edge) => ({
15638
16071
  ...edge,
@@ -15845,7 +16278,7 @@ function TabPanelRelationships({
15845
16278
  currentView,
15846
16279
  element
15847
16280
  }) {
15848
- const layoutId = useId$2(), enableRelationshipBrowser = useDiagramState((s2) => s2.enableRelationshipBrowser), overlay = useOverlayDialog(), [scope, setScope] = useState$1("view"), node2 = nonNullable(currentView.nodes.find((n2) => n2.id === element.id)), incoming = element.incoming().map((r2) => r2.id), outgoing = element.outgoing().map((r2) => r2.id), findRelationIds = (edgeId) => currentView.edges.find((edge) => edge.id === edgeId)?.relations ?? [], incomingInView = i$8(node2.inEdges.flatMap(findRelationIds)), outgoingInView = i$8(node2.outEdges.flatMap(findRelationIds)), notIncludedRelations = [
16281
+ const layoutId = useId$2(), enableRelationshipBrowser = useDiagramState((s2) => s2.enableRelationshipBrowser), overlay = useOverlayDialog(), [scope, setScope] = useState$1("view"), node2 = nonNullable(currentView.nodes.find((n2) => n2.id === element.id)), incoming = element.incoming().map((r2) => r2.id), outgoing = element.outgoing().map((r2) => r2.id), findRelationIds = (edgeId) => currentView.edges.find((edge) => edge.id === edgeId)?.relations ?? [], incomingInView = i$9(node2.inEdges.flatMap(findRelationIds)), outgoingInView = i$9(node2.outEdges.flatMap(findRelationIds)), notIncludedRelations = [
15849
16282
  ...incoming,
15850
16283
  ...outgoing
15851
16284
  ].filter((r2) => !incomingInView.includes(r2) && !outgoingInView.includes(r2)).length, {
@@ -16078,13 +16511,13 @@ function ElementDetailsCard({ fqn: fqn2 }) {
16078
16511
  renderIcon,
16079
16512
  onNavigateTo,
16080
16513
  onOpenSourceElement: onOpenSource
16081
- } = useDiagramState(i$5(["view", "renderIcon", "onNavigateTo", "onOpenSourceElement"])), element = currentView.nodes.find((n2) => n2.id === fqn2);
16514
+ } = useDiagramState(i$6(["view", "renderIcon", "onNavigateTo", "onOpenSourceElement"])), element = currentView.nodes.find((n2) => n2.id === fqn2);
16082
16515
  invariant$1(element, `DiagramNode with fqn ${fqn2} not found`);
16083
16516
  const likec4Model = useLikeC4Model(!0), elementModel = likec4Model.element(fqn2), viewId = currentView.id, elementIcon2 = ElementIcon$1({
16084
16517
  element,
16085
16518
  viewId,
16086
16519
  renderIcon
16087
- }), incoming = elementModel.incoming().map((r2) => r2.id), outgoing = elementModel.outgoing().map((r2) => r2.id), findRelationIds = (edgeId) => currentView.edges.find((edge) => edge.id === edgeId)?.relations ?? [], incomingInView = i$8(element.inEdges.flatMap(findRelationIds)), outgoingInView = i$8(element.outEdges.flatMap(findRelationIds));
16520
+ }), incoming = elementModel.incoming().map((r2) => r2.id), outgoing = elementModel.outgoing().map((r2) => r2.id), findRelationIds = (edgeId) => currentView.edges.find((edge) => edge.id === edgeId)?.relations ?? [], incomingInView = i$9(element.inEdges.flatMap(findRelationIds)), outgoingInView = i$9(element.outEdges.flatMap(findRelationIds));
16088
16521
  [
16089
16522
  ...incoming,
16090
16523
  ...outgoing
@@ -16189,8 +16622,8 @@ function ElementDetailsCard({ fqn: fqn2 }) {
16189
16622
  className: cardHeader,
16190
16623
  onPointerDown: (e2) => controls.start(e2),
16191
16624
  children: [
16192
- /* @__PURE__ */ jsxs(Group, { align: "start", justify: "space-between", gap: "sm", mb: "sm", children: [
16193
- /* @__PURE__ */ jsxs(Group, { align: "start", gap: "sm", style: { cursor: "default" }, children: [
16625
+ /* @__PURE__ */ jsxs(Group, { align: "start", justify: "space-between", gap: "sm", mb: "sm", wrap: "nowrap", children: [
16626
+ /* @__PURE__ */ jsxs(Group, { align: "start", gap: "sm", style: { cursor: "default" }, wrap: "nowrap", children: [
16194
16627
  elementIcon2,
16195
16628
  /* @__PURE__ */ jsxs(Box, { children: [
16196
16629
  /* @__PURE__ */ jsx(
@@ -16216,7 +16649,7 @@ function ElementDetailsCard({ fqn: fqn2 }) {
16216
16649
  }
16217
16650
  )
16218
16651
  ] }),
16219
- /* @__PURE__ */ jsxs(Group, { align: "baseline", gap: "sm", children: [
16652
+ /* @__PURE__ */ jsxs(Group, { align: "baseline", gap: "sm", wrap: "nowrap", children: [
16220
16653
  /* @__PURE__ */ jsxs(Box, { children: [
16221
16654
  /* @__PURE__ */ jsx(SmallLabel, { children: "kind" }),
16222
16655
  /* @__PURE__ */ jsx(Badge, { radius: "sm", size: "sm", fw: 600, color: "gray", children: element.kind })
@@ -16400,7 +16833,7 @@ function ElementProperty({
16400
16833
  Text$6,
16401
16834
  {
16402
16835
  component: "div",
16403
- ...e$3(children) && { c: "dimmed" },
16836
+ ...n$2(children) && { c: "dimmed" },
16404
16837
  fz: "md",
16405
16838
  style: {
16406
16839
  whiteSpace: "preserve-breaks",
@@ -16628,7 +17061,7 @@ const RelationshipsOverlay = memo$1(function({ subjectId }) {
16628
17061
  ] : []
16629
17062
  ), /* @__PURE__ */ jsxs(OverlayContext.Provider, { value: ctxValue, children: [
16630
17063
  /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, onExitComplete, children: activeOverlay?.elementDetails && /* @__PURE__ */ jsx(ElementDetailsCard, { fqn: activeOverlay.elementDetails }, "details card") }, viewId),
16631
- /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, onExitComplete, children: activeOverlay && e$3(activeOverlay.elementDetails) && /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, children: /* @__PURE__ */ jsx(
17064
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, onExitComplete, children: activeOverlay && n$2(activeOverlay.elementDetails) && /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, children: /* @__PURE__ */ jsx(
16632
17065
  Box,
16633
17066
  {
16634
17067
  component: m.div,
@@ -17375,7 +17808,7 @@ function RelationshipsDropdownMenu({
17375
17808
  const {
17376
17809
  openOverlay,
17377
17810
  enableRelationshipBrowser
17378
- } = useDiagramState(i$5(["openOverlay", "enableRelationshipBrowser"])), portalProps = useMantinePortalProps(), [sourceXYNode, targetXYNode] = useXYNodesData([edge.source, edge.target]);
17811
+ } = useDiagramState(i$6(["openOverlay", "enableRelationshipBrowser"])), portalProps = useMantinePortalProps(), [sourceXYNode, targetXYNode] = useXYNodesData([edge.source, edge.target]);
17379
17812
  invariant$1(sourceXYNode, `Source XYNode ${edge.source} not found for edge ${edge.id}`), invariant$1(targetXYNode, `Target XYNode ${edge.target} not found for edge ${edge.id}`);
17380
17813
  const [direct, nested] = x$1(
17381
17814
  edge.relations,
@@ -17664,13 +18097,13 @@ function bezierPath(bezierSpline) {
17664
18097
  let [start, ...points] = bezierSpline;
17665
18098
  invariant$1(start, "start should be defined");
17666
18099
  let path = `M ${start[0]},${start[1]}`;
17667
- for (; i$7(points, 3); ) {
18100
+ for (; i$8(points, 3); ) {
17668
18101
  const [cp1, cp2, end, ...rest] = points;
17669
18102
  path = path + ` C ${cp1[0]},${cp1[1]} ${cp2[0]},${cp2[1]} ${end[0]},${end[1]}`, points = rest;
17670
18103
  }
17671
18104
  return invariant$1(points.length === 0, "all points should be consumed"), path;
17672
18105
  }
17673
- const isSame = (a2, b2) => Math.abs(a2 - b2) < 2.5, isSamePoint = (a2, b2) => isSame(n$2(a2) ? a2[0] : a2.x, n$2(b2) ? b2[0] : b2.x) && isSame(n$2(a2) ? a2[1] : a2.y, n$2(b2) ? b2[1] : b2.y), sameControlPoints = (a2, b2) => a2 === b2 ? !0 : !a2 || !b2 || a2.length !== b2.length ? !1 : a2.every((ap, i2) => isSamePoint(ap, b2[i2])), isEqualProps$2 = (prev, next) => prev.id === next.id && deepEqual(prev.source, next.source) && deepEqual(prev.target, next.target) && deepEqual(prev.selected ?? !1, next.selected ?? !1) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.data.label, next.data.label) && sameControlPoints(prev.data.controlPoints, next.data.controlPoints) && deepEqual(prev.data.edge, next.data.edge), curve = d3line().curve(curveCatmullRomOpen).x((d2) => d2.x).y((d2) => d2.y), RelationshipEdge = memo$1(function({
18106
+ const isSame = (a2, b2) => Math.abs(a2 - b2) < 2.5, isSamePoint = (a2, b2) => isSame(o$3(a2) ? a2[0] : a2.x, o$3(b2) ? b2[0] : b2.x) && isSame(o$3(a2) ? a2[1] : a2.y, o$3(b2) ? b2[1] : b2.y), sameControlPoints = (a2, b2) => a2 === b2 ? !0 : !a2 || !b2 || a2.length !== b2.length ? !1 : a2.every((ap, i2) => isSamePoint(ap, b2[i2])), isEqualProps$2 = (prev, next) => prev.id === next.id && deepEqual(prev.source, next.source) && deepEqual(prev.target, next.target) && deepEqual(prev.selected ?? !1, next.selected ?? !1) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.data.label, next.data.label) && sameControlPoints(prev.data.controlPoints, next.data.controlPoints) && deepEqual(prev.data.edge, next.data.edge), curve = d3line().curve(curveCatmullRomOpen).x((d2) => d2.x).y((d2) => d2.y), RelationshipEdge = memo$1(function({
17674
18107
  id: id2,
17675
18108
  data,
17676
18109
  sourceX,
@@ -18695,30 +19128,38 @@ const CompoundNodeMemo = /* @__PURE__ */ memo$1(({
18695
19128
  tap: {
18696
19129
  scale: 0.975
18697
19130
  }
18698
- }, VariantsNavigate = {
19131
+ }, VariantsNavigateBtn = {
18699
19132
  idle: {
18700
19133
  "--ai-bg": "var(--ai-bg-idle)",
18701
19134
  scale: 1,
18702
19135
  opacity: 0.5,
18703
- translateX: "-50%",
18704
- originY: 0.2
19136
+ originY: 0.5
18705
19137
  },
18706
19138
  selected: {},
18707
19139
  hovered: {
18708
19140
  "--ai-bg": "var(--ai-bg-hover)",
18709
- translateX: "-50%",
18710
19141
  scale: 1.35,
18711
19142
  opacity: 1
18712
- },
19143
+ }
19144
+ };
19145
+ VariantsNavigateBtn.selected = VariantsNavigateBtn.hovered;
19146
+ const VariantsNavigate = {
19147
+ ...VariantsNavigateBtn,
18713
19148
  "hovered:navigate": {
18714
19149
  scale: 1.42
18715
19150
  },
18716
19151
  "tap:navigate": {
18717
19152
  scale: 1.15
18718
19153
  }
18719
- };
18720
- VariantsNavigate.selected = VariantsNavigate.hovered;
18721
- const VariantsDetailsBtn = {
19154
+ }, VariantRealationships = {
19155
+ ...VariantsNavigateBtn,
19156
+ "hovered:relationships": {
19157
+ scale: 1.42
19158
+ },
19159
+ "tap:relationships": {
19160
+ scale: 1.15
19161
+ }
19162
+ }, VariantsDetailsBtn = {
18722
19163
  idle: {
18723
19164
  "--ai-bg": "var(--ai-bg-idle)",
18724
19165
  scale: 1,
@@ -18756,6 +19197,7 @@ const isEqualProps = (prev, next) => prev.id === next.id && deepEqual(prev.selec
18756
19197
  isNavigable,
18757
19198
  isInteractive,
18758
19199
  enableElementDetails,
19200
+ enableRelationshipBrowser,
18759
19201
  triggerOnNavigateTo,
18760
19202
  openOverlay,
18761
19203
  isInActiveOverlay,
@@ -18765,9 +19207,10 @@ const isEqualProps = (prev, next) => prev.id === next.id && deepEqual(prev.selec
18765
19207
  isEditable: s2.readonly !== !0,
18766
19208
  isHovered: s2.hoveredNodeId === id2,
18767
19209
  isDimmed: s2.dimmed.has(id2),
18768
- isInteractive: s2.nodesDraggable || s2.nodesSelectable || s2.enableElementDetails || !!s2.onNavigateTo && !!element.navigateTo,
19210
+ isInteractive: s2.nodesDraggable || s2.nodesSelectable || s2.enableElementDetails || s2.enableRelationshipBrowser || !!s2.onNavigateTo && !!element.navigateTo,
18769
19211
  isNavigable: !!s2.onNavigateTo && !!element.navigateTo,
18770
19212
  enableElementDetails: s2.enableElementDetails,
19213
+ enableRelationshipBrowser: s2.enableRelationshipBrowser,
18771
19214
  triggerOnNavigateTo: s2.triggerOnNavigateTo,
18772
19215
  openOverlay: s2.openOverlay,
18773
19216
  isInActiveOverlay: (s2.activeOverlay?.elementDetails ?? s2.activeOverlay?.relationshipsOf) === id2,
@@ -18802,6 +19245,8 @@ const isEqualProps = (prev, next) => prev.id === next.id && deepEqual(prev.selec
18802
19245
  e2.stopPropagation(), triggerOnNavigateTo(id2, e2);
18803
19246
  }, [triggerOnNavigateTo, id2]), onOpenDetails = useCallback$1((e2) => {
18804
19247
  e2.stopPropagation(), openOverlay({ elementDetails: element.id });
19248
+ }, [openOverlay, element.id]), onOpenRelationships = useCallback$1((e2) => {
19249
+ e2.stopPropagation(), openOverlay({ relationshipsOf: element.id });
18805
19250
  }, [openOverlay, element.id]);
18806
19251
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
18807
19252
  isToolbarVisible && /* @__PURE__ */ jsx(
@@ -18875,22 +19320,38 @@ const isEqualProps = (prev, next) => prev.id === next.id && deepEqual(prev.selec
18875
19320
  ]
18876
19321
  }
18877
19322
  ),
18878
- isNavigable && /* @__PURE__ */ jsx(
18879
- ActionIcon$1,
18880
- {
18881
- component: m.div,
18882
- variants: VariantsNavigate,
18883
- "data-animate-target": "navigate",
18884
- className: clsx("nodrag nopan", navigateBtn$2),
18885
- radius: "md",
18886
- style: { zIndex: 100 },
18887
- role: "button",
18888
- onClick: onNavigateTo,
18889
- onDoubleClick: stopPropagation$1,
18890
- ...isInteractive && animateHandlers,
18891
- children: /* @__PURE__ */ jsx(IconZoomScan, { style: { width: "75%" } })
18892
- }
18893
- ),
19323
+ (enableRelationshipBrowser || isNavigable) && /* @__PURE__ */ jsxs(Group, { className: navigateBtnBox$1, align: "center", children: [
19324
+ enableRelationshipBrowser && /* @__PURE__ */ jsx(
19325
+ ActionIcon$1,
19326
+ {
19327
+ component: m.div,
19328
+ variants: VariantRealationships,
19329
+ "data-animate-target": "relationships",
19330
+ className: clsx("nodrag nopan", navigateBtn$2),
19331
+ radius: "md",
19332
+ role: "button",
19333
+ onClick: onOpenRelationships,
19334
+ onDoubleClick: stopPropagation$1,
19335
+ ...isInteractive && animateHandlers,
19336
+ children: /* @__PURE__ */ jsx(IconTransform, { style: { width: "75%" } })
19337
+ }
19338
+ ),
19339
+ isNavigable && /* @__PURE__ */ jsx(
19340
+ ActionIcon$1,
19341
+ {
19342
+ component: m.div,
19343
+ variants: VariantsNavigate,
19344
+ "data-animate-target": "navigate",
19345
+ className: clsx("nodrag nopan", navigateBtn$2),
19346
+ radius: "md",
19347
+ role: "button",
19348
+ onClick: onNavigateTo,
19349
+ onDoubleClick: stopPropagation$1,
19350
+ ...isInteractive && animateHandlers,
19351
+ children: /* @__PURE__ */ jsx(IconZoomScan, { style: { width: "75%" } })
19352
+ }
19353
+ )
19354
+ ] }),
18894
19355
  enableElementDetails && /* @__PURE__ */ jsx(
18895
19356
  Tooltip$5,
18896
19357
  {
@@ -19636,7 +20097,7 @@ const ElementNotation = ({ value }) => {
19636
20097
  }, selector$1 = (s2) => ({
19637
20098
  id: s2.view.id,
19638
20099
  notations: s2.view.notation?.elements ?? [],
19639
- isVisible: e$3(s2.focusedNodeId ?? s2.activeWalkthrough)
20100
+ isVisible: n$2(s2.focusedNodeId ?? s2.activeWalkthrough)
19640
20101
  });
19641
20102
  function NotationPanel() {
19642
20103
  const height = useXYStore((s2) => s2.height), {
@@ -19918,6 +20379,16 @@ const selector = (state) => ({
19918
20379
  /* @__PURE__ */ jsx(PopoverTarget, { children: /* @__PURE__ */ jsx(Tooltip, { label: "Manual layouting tools", withinPortal: !1, position: "top-end", children: /* @__PURE__ */ jsx(ActionIcon, { children: /* @__PURE__ */ jsx(IconLayoutCollage, {}) }) }) }),
19919
20380
  /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
19920
20381
  /* @__PURE__ */ jsxs(ActionIconGroup, { pos: "relative", children: [
20382
+ /* @__PURE__ */ jsx(
20383
+ Action,
20384
+ {
20385
+ label: "Align in columns",
20386
+ icon: /* @__PURE__ */ jsx(IconLayoutBoardSplit, {}),
20387
+ onClick: (e2) => {
20388
+ e2.stopPropagation(), store.getState().align("Column");
20389
+ }
20390
+ }
20391
+ ),
19921
20392
  /* @__PURE__ */ jsx(
19922
20393
  Action,
19923
20394
  {
@@ -19948,6 +20419,16 @@ const selector = (state) => ({
19948
20419
  }
19949
20420
  }
19950
20421
  ),
20422
+ /* @__PURE__ */ jsx(
20423
+ Action,
20424
+ {
20425
+ label: "Align in rows",
20426
+ icon: /* @__PURE__ */ jsx(IconLayoutBoardSplit, { style: { transform: "rotate(90deg)" } }),
20427
+ onClick: (e2) => {
20428
+ e2.stopPropagation(), store.getState().align("Row");
20429
+ }
20430
+ }
20431
+ ),
19951
20432
  /* @__PURE__ */ jsx(
19952
20433
  Action,
19953
20434
  {
@@ -20104,6 +20585,7 @@ const selector = (state) => ({
20104
20585
  }
20105
20586
  ), TopLeftPanel = () => {
20106
20587
  const store = useDiagramStoreApi(), {
20588
+ enableSearch,
20107
20589
  showNavigationButtons,
20108
20590
  showFitDiagram,
20109
20591
  showLayoutDriftWarning,
@@ -20112,8 +20594,9 @@ const selector = (state) => ({
20112
20594
  viewportChanged,
20113
20595
  showManualLayoutTools
20114
20596
  } = useDiagramState((s2) => {
20115
- const isNotWalkthrough = e$3(s2.activeWalkthrough), isNotFocused = e$3(s2.focusedNodeId), isNotActive = isNotWalkthrough && isNotFocused;
20597
+ const isNotWalkthrough = n$2(s2.activeWalkthrough), isNotFocused = n$2(s2.focusedNodeId), isNotActive = isNotWalkthrough && isNotFocused;
20116
20598
  return {
20599
+ enableSearch: s2.enableSearch,
20117
20600
  showNavigationButtons: !!s2.onBurgerMenuClick || s2.showNavigationButtons && !!s2.onNavigateTo,
20118
20601
  showFitDiagram: s2.controls && s2.fitViewEnabled && s2.zoomable && isNotWalkthrough,
20119
20602
  showLayoutDriftWarning: s2.controls && !s2.readonly && s2.view.hasLayoutDrift === !0 && isNotActive,
@@ -20137,6 +20620,13 @@ const selector = (state) => ({
20137
20620
  children: [
20138
20621
  showNavigationButtons && /* @__PURE__ */ jsx(BackwardForwardButtons, {}),
20139
20622
  /* @__PURE__ */ jsxs(ActionIconGroup, { className: actionIconGroup, orientation: "vertical", children: [
20623
+ enableSearch && /* @__PURE__ */ jsx(Tooltip, { label: "Search", children: /* @__PURE__ */ jsx(
20624
+ ActionIcon,
20625
+ {
20626
+ onClick: () => openSpotlight(),
20627
+ children: /* @__PURE__ */ jsx(IconSearch, {})
20628
+ }
20629
+ ) }),
20140
20630
  showGoToSource && /* @__PURE__ */ jsx(Tooltip, { label: "Open source", ...portalProps, children: /* @__PURE__ */ jsx(
20141
20631
  ActionIcon,
20142
20632
  {
@@ -20227,6 +20717,7 @@ function LikeC4Diagram({
20227
20717
  enableElementDetails = !1,
20228
20718
  enableRelationshipDetails = enableElementDetails,
20229
20719
  enableRelationshipBrowser = enableRelationshipDetails,
20720
+ enableSearch = !0,
20230
20721
  initialWidth,
20231
20722
  initialHeight,
20232
20723
  keepAspectRatio = !1,
@@ -20284,6 +20775,7 @@ function LikeC4Diagram({
20284
20775
  showNotations,
20285
20776
  enableFocusMode,
20286
20777
  enableRelationshipDetails: enableRelationshipDetails && hasLikec4model,
20778
+ enableSearch: hasLikec4model && enableSearch,
20287
20779
  enableElementDetails: enableElementDetails && hasLikec4model,
20288
20780
  enableDynamicViewWalkthrough,
20289
20781
  enableRelationshipBrowser: enableRelationshipBrowser && hasLikec4model,
@@ -20306,7 +20798,8 @@ function LikeC4Diagram({
20306
20798
  LikeC4DiagramInnerMemo,
20307
20799
  {
20308
20800
  background,
20309
- showDiagramTitle
20801
+ showDiagramTitle,
20802
+ enableSearch: hasLikec4model && enableSearch
20310
20803
  }
20311
20804
  )
20312
20805
  }
@@ -20318,7 +20811,8 @@ function LikeC4Diagram({
20318
20811
  LikeC4Diagram.displayName = "LikeC4Diagram";
20319
20812
  const LikeC4DiagramInnerMemo = /* @__PURE__ */ memo$1(function({
20320
20813
  background,
20321
- showDiagramTitle
20814
+ showDiagramTitle,
20815
+ enableSearch
20322
20816
  }) {
20323
20817
  const {
20324
20818
  isInitialized,
@@ -20355,6 +20849,7 @@ const LikeC4DiagramInnerMemo = /* @__PURE__ */ memo$1(function({
20355
20849
  }
20356
20850
  ),
20357
20851
  enableOverlays && /* @__PURE__ */ jsx(Overlays, {}),
20852
+ enableSearch && /* @__PURE__ */ jsx(LikeC4Search, {}),
20358
20853
  isInitialized && /* @__PURE__ */ jsxs(Fragment$1, { children: [
20359
20854
  fitView && /* @__PURE__ */ jsx(FitViewOnDiagramChange, {}),
20360
20855
  enableFocusMode && /* @__PURE__ */ jsx(SelectEdgesOnNodeFocus, {})
@@ -20399,6 +20894,7 @@ function StaticLikeC4Diagram({
20399
20894
  enableFocusMode: !1,
20400
20895
  nodesSelectable: !1,
20401
20896
  nodesDraggable: !1,
20897
+ enableSearch: !1,
20402
20898
  ...rest
20403
20899
  }
20404
20900
  );
@@ -20510,7 +21006,7 @@ function DiagramPreview$1({ diagram }) {
20510
21006
  }
20511
21007
  ) });
20512
21008
  }
20513
- const OverviewGraph = /* @__PURE__ */ lazy(() => import("./-index-overview-DNT3FQkn.js"));
21009
+ const OverviewGraph = /* @__PURE__ */ lazy(() => import("./-index-overview-DrCqsLHx.js"));
20514
21010
  function WithOverviewGraph() {
20515
21011
  return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(OverviewGraph, {}) });
20516
21012
  }
@@ -21426,6 +21922,7 @@ function ExportPage() {
21426
21922
  nodesSelectable: !1,
21427
21923
  nodesDraggable: !1,
21428
21924
  enableFocusMode: !1,
21925
+ enableSearch: !1,
21429
21926
  renderIcon: RenderIcon,
21430
21927
  initialWidth: diagram.bounds.width,
21431
21928
  initialHeight: diagram.bounds.height
@@ -21862,7 +22359,7 @@ function recalculateIntersectingHandles({
21862
22359
  }) {
21863
22360
  intersectingHandles.splice(0);
21864
22361
  let targetElement = null;
21865
- target instanceof HTMLElement && (targetElement = target), registeredResizeHandlers.forEach((data) => {
22362
+ (target instanceof HTMLElement || target instanceof SVGElement) && (targetElement = target), registeredResizeHandlers.forEach((data) => {
21866
22363
  const {
21867
22364
  element: dragHandleElement,
21868
22365
  hitAreaMargins
@@ -23342,9 +23839,9 @@ createRoot(document.getElementById("like4-root")).render(
23342
23839
  );
23343
23840
  export {
23344
23841
  IconFolderFilled as I,
23842
+ nonexhaustive as a,
23345
23843
  createReactComponent as c,
23346
- e$3 as e,
23347
- i$5 as i,
23348
- nonexhaustive as n,
23844
+ i$6 as i,
23845
+ n$2 as n,
23349
23846
  useUpdateEffect as u
23350
23847
  };