likec4 1.59.3 → 1.60.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.
Files changed (99) hide show
  1. package/__app__/codegen/react.mjs +6 -6
  2. package/__app__/codegen/webcomponent.mjs +147 -69
  3. package/__app__/src/aichat/index.mjs +10 -5
  4. package/__app__/src/chunks/AIChat.mjs +1134 -693
  5. package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
  6. package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
  7. package/__app__/src/chunks/es.mjs +515 -335
  8. package/__app__/src/chunks/hooks.mjs +578 -366
  9. package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
  10. package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
  11. package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
  12. package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
  13. package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
  14. package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
  15. package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
  16. package/__app__/src/chunks/libs/d3.mjs +3218 -1509
  17. package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
  18. package/__app__/src/chunks/libs/framer.mjs +9251 -3846
  19. package/__app__/src/chunks/libs/nanostores.mjs +174 -0
  20. package/__app__/src/chunks/libs/zod.mjs +4591 -2363
  21. package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
  22. package/__app__/src/chunks/styled-system.mjs +3538 -756
  23. package/__app__/src/fonts.css +112 -1
  24. package/__app__/src/main.mjs +44398 -24039
  25. package/__app__/src/style.css +18488 -1
  26. package/config/schema.json +136 -97
  27. package/dist/app/render-view-client.css +1 -1
  28. package/dist/app/render-view-client.js +506 -338
  29. package/dist/chunks/enableServer.mjs +1 -1
  30. package/dist/chunks/filenames.mjs +16 -14
  31. package/dist/chunks/generate-likec4.mjs +5 -0
  32. package/dist/chunks/index.d.mts +246 -180
  33. package/dist/chunks/index2.d.mts +2882 -1977
  34. package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
  35. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
  36. package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
  37. package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
  38. package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
  39. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
  40. package/dist/chunks/libs/birpc.mjs +1 -1
  41. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  42. package/dist/chunks/libs/chevrotain.mjs +87 -35
  43. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  44. package/dist/chunks/libs/json5.mjs +4 -4
  45. package/dist/chunks/libs/langium.d.mts +9903 -5297
  46. package/dist/chunks/libs/langium.mjs +16 -24
  47. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  48. package/dist/chunks/libs/p-limit.mjs +1 -0
  49. package/dist/chunks/libs/p-queue.mjs +1 -1
  50. package/dist/chunks/libs/package-manager-detector.mjs +1 -1
  51. package/dist/chunks/libs/pako.mjs +2 -2
  52. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  53. package/dist/chunks/libs/remeda.mjs +1 -1
  54. package/dist/chunks/libs/ufo.mjs +1 -1
  55. package/dist/chunks/libs/unstorage.mjs +1 -1
  56. package/dist/chunks/libs/which.mjs +1 -1
  57. package/dist/chunks/node.mjs +60 -60
  58. package/dist/chunks/rolldown-runtime.mjs +1 -1
  59. package/dist/chunks/sequence-view.mjs +1 -1
  60. package/dist/chunks/vite-plugin.mjs +55 -52
  61. package/dist/cli/index.d.mts +1 -1
  62. package/dist/cli/index.mjs +208 -1300
  63. package/dist/config/index.d.mts +2 -2
  64. package/dist/generators/likec4.d.mts +6578 -0
  65. package/dist/generators/likec4.mjs +1 -0
  66. package/dist/index.d.mts +3 -3
  67. package/dist/model/index.d.mts +8 -5
  68. package/dist/vite-plugin/index.d.mts +6 -3
  69. package/dist/vite-plugin/index.mjs +1 -1
  70. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
  71. package/dist/vite-plugin/internal/index.d.mts +16 -15
  72. package/dist/vite-plugin/internal/index.mjs +144 -46
  73. package/generators/likec4/package.json +4 -0
  74. package/package.json +117 -110
  75. package/react/index.d.mts +8500 -5399
  76. package/react/index.mjs +534 -58617
  77. package/react/rolldown-runtime-DnkiqaRY.js +1 -0
  78. package/skills/likec4-dsl/SKILL.md +428 -0
  79. package/skills/likec4-dsl/evals/evals-public.json +202 -0
  80. package/skills/likec4-dsl/evals/grading-spec.json +589 -0
  81. package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
  82. package/skills/likec4-dsl/references/cli.md +139 -0
  83. package/skills/likec4-dsl/references/configuration.md +266 -0
  84. package/skills/likec4-dsl/references/deployment.md +160 -0
  85. package/skills/likec4-dsl/references/dynamic-views.md +455 -0
  86. package/skills/likec4-dsl/references/examples.md +370 -0
  87. package/skills/likec4-dsl/references/identifier-validity.md +90 -0
  88. package/skills/likec4-dsl/references/include-predicates-wildcards.md +179 -0
  89. package/skills/likec4-dsl/references/model.md +151 -0
  90. package/skills/likec4-dsl/references/predicates.md +123 -0
  91. package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
  92. package/skills/likec4-dsl/references/specification.md +75 -0
  93. package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
  94. package/skills/likec4-dsl/references/troubleshooting.md +96 -0
  95. package/skills/likec4-dsl/references/views.md +329 -0
  96. package/vite-plugin-modules.d.ts +4 -2
  97. package/dist/chunks/libs/picomatch.mjs +0 -1
  98. package/dist/chunks/libs/zod.d.mts +0 -2140
  99. package/dist/chunks/libs/zod.mjs +0 -65
@@ -1,119 +1,139 @@
1
- import { i as o } from "./rolldown-runtime.mjs";
2
- import { d as s, i as c } from "./libs/@tanstack.mjs";
3
- import { st as l } from "./libs/@mantine.mjs";
4
- import { E as u, M as d, o as f } from "./styled-system.mjs";
5
- import { n as p, t as m } from "./libs/fast-equals.mjs";
6
- import { b as h } from "./libs/framer.mjs";
7
- import { n as g } from "./libs/@xstate/react.mjs";
8
- import { createContext as _, createElement as v, forwardRef as y, useCallback as b, useContext as x, useEffect as S, useLayoutEffect as C, useMemo as w, useRef as T, useState as E, useSyncExternalStore as D } from "react";
9
- import { c as O } from "react/compiler-runtime";
10
- import { jsx as k } from "react/jsx-runtime";
11
- import { useLikeC4Projects as A } from "likec4:projects";
12
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/lazyDataLastImpl--3B10z3s.js
13
- function e$2(o, s, c) {
14
- let r = (c) => o(c, ...s);
15
- return c === void 0 ? r : Object.assign(r, {
16
- lazy: c,
17
- lazyArgs: s
1
+ import { i as __name } from "./rolldown-runtime.mjs";
2
+ import { i as useMatches, u as useParams } from "./libs/@tanstack.mjs";
3
+ import { ut as Text } from "./libs/@mantine.mjs";
4
+ import { I as cx, k as Box, o as markdownBlock } from "./styled-system.mjs";
5
+ import { n as shallowEqual, t as deepEqual } from "./libs/fast-equals.mjs";
6
+ import { t as listenKeys } from "./libs/nanostores.mjs";
7
+ import { b as invariant } from "./libs/framer.mjs";
8
+ import { n as useSelector } from "./libs/@xstate/react.mjs";
9
+ import { createContext, createElement, forwardRef, use, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
10
+ import { c } from "react/compiler-runtime";
11
+ import { jsx } from "react/jsx-runtime";
12
+ import { useLikeC4Projects } from "likec4:projects";
13
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/lazyDataLastImpl--3B10z3s.js
14
+ function e$2(e, t, n) {
15
+ let r = (n) => e(n, ...t);
16
+ return n === void 0 ? r : Object.assign(r, {
17
+ lazy: n,
18
+ lazyArgs: t
18
19
  });
19
20
  }
20
- o(e$2, "e");
21
+ __name(e$2, "e");
21
22
  //#endregion
22
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/purry.js
23
- function t$3(o, s, c) {
24
- let l = o.length - s.length;
25
- if (l === 0) return o(...s);
26
- if (l === 1) return e$2(o, s, c);
27
- throw Error("Wrong number of arguments");
23
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/purry.js
24
+ function t$3(t, n, r) {
25
+ let i = t.length - n.length;
26
+ if (i === 0) return t(...n);
27
+ if (i === 1) return e$2(t, n, r);
28
+ throw Error(`Wrong number of arguments`);
28
29
  }
29
- o(t$3, "t");
30
+ __name(t$3, "t");
30
31
  //#endregion
31
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/utilityEvaluators-IxVD3t2o.js
32
- var j = {
32
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/utilityEvaluators-IxVD3t2o.js
33
+ var t$2 = {
33
34
  done: !1,
34
35
  hasNext: !1
35
- }, M = /* @__PURE__ */ o((o) => ({
36
+ };
37
+ var r$3 = /* @__PURE__ */ __name((e) => ({
36
38
  hasNext: !0,
37
- next: o,
39
+ next: e,
38
40
  done: !1
39
41
  }), "r");
40
42
  //#endregion
41
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/pipe.js
42
- function t$1(o, ...s) {
43
- let c = o, l = s.map((o) => "lazy" in o ? {
44
- lazyEvaluator: o.lazy(...o.lazyArgs),
45
- isSingle: o.lazy.single ?? !1,
43
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/pipe.js
44
+ function t$1(e, ...t) {
45
+ let i = e;
46
+ let o = t.map((e) => `lazy` in e ? {
47
+ lazyEvaluator: e.lazy(...e.lazyArgs),
48
+ isSingle: e.lazy.single ?? !1,
46
49
  index: 0,
47
50
  items: []
48
- } : void 0), u = 0;
49
- for (; u < s.length;) {
50
- if (l[u] === void 0 || !a$1(c)) {
51
- let o = s[u];
52
- c = o(c), u += 1;
51
+ } : void 0);
52
+ let s = 0;
53
+ for (; s < t.length;) {
54
+ if (o[s] === void 0 || !a$1(i)) {
55
+ let e = t[s];
56
+ i = e(i), s += 1;
53
57
  continue;
54
58
  }
55
- let o = n$1(l, u), d = r$2(c, o), { isSingle: f } = o.at(-1);
56
- c = f ? d[0] : d, u += o.length;
59
+ let e = n$1(o, s), c = r$2(i, e), { isSingle: l } = e.at(-1);
60
+ i = l ? c[0] : c, s += e.length;
57
61
  }
58
- return c;
62
+ return i;
59
63
  }
60
- o(t$1, "t");
61
- function n$1(o, s) {
62
- let c = [];
63
- for (let l = s; l < o.length; l++) {
64
- let s = o[l];
65
- if (s === void 0 || (c.push(s), s.isSingle)) break;
64
+ __name(t$1, "t");
65
+ function n$1(e, t) {
66
+ let n = [];
67
+ for (let r = t; r < e.length; r++) {
68
+ let t = e[r];
69
+ if (t === void 0 || (n.push(t), t.isSingle)) break;
66
70
  }
67
- return c;
71
+ return n;
68
72
  }
69
- o(n$1, "n");
70
- function r$2(o, s) {
71
- let c = [];
72
- for (let l of o) if (i$1(l, c, s)) break;
73
- return c;
73
+ __name(n$1, "n");
74
+ function r$2(e, t) {
75
+ let n = [];
76
+ for (let r of e) if (i$1(r, n, t)) break;
77
+ return n;
74
78
  }
75
- o(r$2, "r");
76
- function i$1(o, s, c) {
77
- if (c.length === 0) return s.push(o), !1;
78
- let l = o, u = j, d = !1;
79
- for (let [o, { items: f, lazyEvaluator: p }] of c.entries()) if (f.push(l), u = p(l, f.length - 1, f), u.done && (d = !0), u.hasNext) {
80
- if (u.hasMany ?? !1) {
81
- for (let l of u.next) if (i$1(l, s, c.slice(o + 1))) return !0;
82
- return d;
79
+ __name(r$2, "r");
80
+ function i$1(t, n, r) {
81
+ if (r.length === 0) return n.push(t), !1;
82
+ let a = t;
83
+ let o = t$2;
84
+ let s = !1;
85
+ for (let [e, { items: t, lazyEvaluator: c }] of r.entries()) if (t.push(a), o = c(a, t.length - 1, t), o.done && (s = !0), o.hasNext) {
86
+ if (o.hasMany ?? !1) {
87
+ for (let t of o.next) if (i$1(t, n, r.slice(e + 1))) return !0;
88
+ return s;
83
89
  }
84
- l = u.next;
90
+ a = o.next;
85
91
  } else break;
86
- return u.hasNext && s.push(l), d;
92
+ return o.hasNext && n.push(a), s;
87
93
  }
88
- o(i$1, "i");
89
- function a$1(o) {
90
- return typeof o == "string" || typeof o == "object" && !!o && Symbol.iterator in o;
94
+ __name(i$1, "i");
95
+ function a$1(e) {
96
+ return typeof e == `string` || typeof e == `object` && !!e && Symbol.iterator in e;
91
97
  }
92
- o(a$1, "a");
98
+ __name(a$1, "a");
93
99
  //#endregion
94
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/toSingle-DiQSixar.js
95
- var N = /* @__PURE__ */ o((o) => Object.assign(o, { single: !0 }), "e");
100
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/toSingle-DiQSixar.js
101
+ var e$1 = /* @__PURE__ */ __name((e) => Object.assign(e, { single: !0 }), "e");
96
102
  //#endregion
97
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/find.js
98
- function r$1(...o) {
99
- return t$3(i, o, N(a));
103
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/find.js
104
+ function r$1(...t) {
105
+ return t$3(i, t, e$1(a));
100
106
  }
101
- o(r$1, "r");
102
- var i = (o, s) => o.find(s), a = (o) => (s, c, l) => o(s, c, l) ? {
107
+ __name(r$1, "r");
108
+ var i = (e, t) => e.find(t);
109
+ var a = (e) => (n, r, i) => e(n, r, i) ? {
103
110
  done: !0,
104
111
  hasNext: !0,
105
- next: s
106
- } : j, e = (o) => typeof o == "function";
112
+ next: n
113
+ } : t$2;
114
+ //#endregion
115
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/isFunction.js
116
+ var e = (e) => typeof e == `function`;
107
117
  //#endregion
108
- //#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/map.js
109
- function t(...o) {
110
- return t$3(n, o, r);
118
+ //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/map.js
119
+ function t(...t) {
120
+ return t$3(n, t, r);
111
121
  }
112
- var n = (o, s) => o.map(s), r = (o) => (s, c, l) => ({
122
+ var n = (e, t) => e.map(t);
123
+ var r = (e) => (t, n, r) => ({
113
124
  done: !1,
114
125
  hasNext: !0,
115
- next: o(s, c, l)
116
- }), P = {
126
+ next: e(t, n, r)
127
+ });
128
+ //#endregion
129
+ //#region ../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.0/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs
130
+ /**
131
+ * @license @tabler/icons-react v3.49.0 - MIT
132
+ *
133
+ * This source code is licensed under the MIT license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */
136
+ var defaultAttributes = {
117
137
  outline: {
118
138
  xmlns: "http://www.w3.org/2000/svg",
119
139
  width: 24,
@@ -133,352 +153,544 @@ var n = (o, s) => o.map(s), r = (o) => (s, c, l) => ({
133
153
  fill: "currentColor",
134
154
  stroke: "none"
135
155
  }
136
- }, createReactComponent = (o, s, c, l) => {
137
- let u = y(({ color: c = "currentColor", size: u = 24, stroke: d = 2, title: f, className: p, children: m, ...h }, g) => v("svg", {
138
- ref: g,
139
- ...P[o],
140
- width: u,
141
- height: u,
156
+ };
157
+ //#endregion
158
+ //#region ../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.0/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
159
+ /**
160
+ * @license @tabler/icons-react v3.49.0 - MIT
161
+ *
162
+ * This source code is licensed under the MIT license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */
165
+ var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
166
+ const Component = forwardRef(({ color = "currentColor", size = 24, stroke = 2, title, className, children, ...rest }, ref) => createElement("svg", {
167
+ ref,
168
+ ...defaultAttributes[type],
169
+ width: size,
170
+ height: size,
142
171
  className: [
143
- "tabler-icon",
144
- `tabler-icon-${s}`,
145
- p
146
- ].join(" "),
147
- ...o === "filled" ? { fill: c } : {
148
- strokeWidth: d,
149
- stroke: c
172
+ `tabler-icon`,
173
+ `tabler-icon-${iconName}`,
174
+ className
175
+ ].filter(Boolean).join(" "),
176
+ ...type === "filled" ? { fill: color } : {
177
+ strokeWidth: stroke,
178
+ stroke: color
150
179
  },
151
- ...h
180
+ ...rest
152
181
  }, [
153
- f && v("title", { key: "svg-title" }, f),
154
- ...l.map(([o, s]) => v(o, s)),
155
- ...Array.isArray(m) ? m : [m]
182
+ title && createElement("title", { key: "svg-title" }, title),
183
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
184
+ ...Array.isArray(children) ? children : [children]
156
185
  ]));
157
- return u.displayName = `${c}`, u;
158
- }, F = createReactComponent("outline", "sparkles", "Sparkles", [["path", {
159
- d: "M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",
160
- key: "svg-0"
161
- }]]), I = createReactComponent("filled", "player-stop-filled", "PlayerStopFilled", [["path", {
162
- d: "M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",
163
- key: "svg-0"
186
+ Component.displayName = `${iconNamePascal}`;
187
+ return Component;
188
+ };
189
+ /**
190
+ * @license @tabler/icons-react v3.49.0 - MIT
191
+ *
192
+ * This source code is licensed under the MIT license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */
195
+ var IconSparkles = createReactComponent("outline", "sparkles", "Sparkles", [["path", {
196
+ "d": "M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",
197
+ "key": "svg-0"
198
+ }]]);
199
+ /**
200
+ * @license @tabler/icons-react v3.49.0 - MIT
201
+ *
202
+ * This source code is licensed under the MIT license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */
205
+ var IconPlayerStopFilled = createReactComponent("filled", "player-stop-filled", "PlayerStopFilled", [["path", {
206
+ "d": "M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",
207
+ "key": "svg-0"
164
208
  }]]);
165
209
  //#endregion
166
- //#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@react-hookz/web/dist/useSyncedRef/index.js
167
- function useSyncedRef(o) {
168
- let s = T(o);
169
- return s.current = o, w(() => Object.freeze({ get current() {
170
- return s.current;
210
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/useSyncedRef/index.js
211
+ /**
212
+ * Like `useRef`, but it returns immutable ref that contains actual value.
213
+ *
214
+ * @param value
215
+ */
216
+ function useSyncedRef(value) {
217
+ const ref = useRef(value);
218
+ ref.current = value;
219
+ return useMemo(() => Object.freeze({ get current() {
220
+ return ref.current;
171
221
  } }), []);
172
222
  }
173
223
  //#endregion
174
- //#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@react-hookz/web/dist/util/const.js
175
- var L = /* @__PURE__ */ o(() => {}, "noop"), R = typeof globalThis < "u" && typeof navigator < "u" && typeof document < "u", basicDepsComparator = (o, s) => {
176
- if (o === s) return !0;
177
- if (o.length !== s.length) return !1;
178
- for (let [c, l] of o.entries()) if (l !== s[c]) return !1;
179
- return !0;
224
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/util/const.js
225
+ var noop$1 = /* @__PURE__ */ __name(() => {}, "noop");
226
+ var isBrowser = typeof globalThis !== "undefined" && typeof navigator !== "undefined" && typeof document !== "undefined";
227
+ //#endregion
228
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/util/misc.js
229
+ var basicDepsComparator = (d1, d2) => {
230
+ if (d1 === d2) return true;
231
+ if (d1.length !== d2.length) return false;
232
+ for (const [i, element] of d1.entries()) if (element !== d2[i]) return false;
233
+ return true;
180
234
  };
181
235
  //#endregion
182
- //#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@react-hookz/web/dist/useCustomCompareEffect/index.js
183
- function useCustomCompareEffect(o, s, c = basicDepsComparator, l = S, ...u) {
184
- let d = T(void 0);
185
- (d.current === void 0 || R && !c(d.current, s)) && (d.current = s), l(o, d.current, ...u);
236
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/useCustomCompareEffect/index.js
237
+ /**
238
+ * Like `useEffect` but uses provided comparator function to validate dependency changes.
239
+ *
240
+ * @param callback Function that will be passed to the underlying effect hook.
241
+ * @param deps Dependency list like the one passed to `useEffect`.
242
+ * @param comparator Function that compares two dependency arrays,
243
+ * and returns `true` if they're equal.
244
+ * @param effectHook Effect hook that will be used to run
245
+ * `callback`. Must match the type signature of `useEffect`, meaning that the `callback` should be
246
+ * placed as the first argument and the dependency list as second.
247
+ * @param effectHookRestArgs Extra arguments that are passed to the `effectHook`
248
+ * after the `callback` and the dependency list.
249
+ */
250
+ function useCustomCompareEffect(callback, deps, comparator = basicDepsComparator, effectHook = useEffect, ...effectHookRestArgs) {
251
+ const dependencies = useRef(void 0);
252
+ if (dependencies.current === void 0 || isBrowser && !comparator(dependencies.current, deps)) dependencies.current = deps;
253
+ effectHook(callback, dependencies.current, ...effectHookRestArgs);
186
254
  }
187
255
  //#endregion
188
- //#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@react-hookz/web/dist/useFirstMountState/index.js
256
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/useFirstMountState/index.js
257
+ /**
258
+ * Returns a boolean that is `true` only on first render.
259
+ */
189
260
  function useFirstMountState() {
190
- let o = T(!0);
191
- return S(() => {
192
- o.current = !1;
193
- }, []), o.current;
261
+ const isFirstMount = useRef(true);
262
+ useEffect(() => {
263
+ isFirstMount.current = false;
264
+ }, []);
265
+ return isFirstMount.current;
194
266
  }
195
267
  //#endregion
196
- //#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@react-hookz/web/dist/useIsomorphicLayoutEffect/index.js
197
- var z = R ? C : S, cancelTimeout = (o) => {
198
- o && clearTimeout(o);
268
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/useIsomorphicLayoutEffect/index.js
269
+ /**
270
+ * Alias for `useLayoutEffect` in browser, but for `useEffect` at server side. Helps to avoid
271
+ * warning shown during SSR.
272
+ */
273
+ var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
274
+ //#endregion
275
+ //#region ../../node_modules/.pnpm/@react-hookz+web@25.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@react-hookz/web/dist/useTimeoutEffect/index.js
276
+ var cancelTimeout = (id) => {
277
+ if (id) clearTimeout(id);
199
278
  };
200
- function useTimeoutEffect(o, s) {
201
- let c = useSyncedRef(o), l = useSyncedRef(s), u = T(null), d = b(() => {
202
- cancelTimeout(u.current);
203
- }, []), f = b(() => {
204
- l.current !== void 0 && (d(), u.current = setTimeout(() => {
205
- c.current();
206
- }, l.current));
279
+ /**
280
+ * Like `setTimeout` but in the form of a react hook.
281
+ *
282
+ * @param callback Callback to be called after the timeout. Changing this
283
+ * will not reset the timeout.
284
+ * @param ms Timeout delay in milliseconds. `undefined` disables the timeout.
285
+ * Keep in mind, that changing this parameter will re-set timeout, meaning
286
+ * that it will be set as new after the change.
287
+ */
288
+ function useTimeoutEffect(callback, ms) {
289
+ const cbRef = useSyncedRef(callback);
290
+ const msRef = useSyncedRef(ms);
291
+ const timeoutIdRef = useRef(null);
292
+ const cancel = useCallback(() => {
293
+ cancelTimeout(timeoutIdRef.current);
294
+ }, []);
295
+ const reset = useCallback(() => {
296
+ if (msRef.current === void 0) return;
297
+ cancel();
298
+ timeoutIdRef.current = setTimeout(() => {
299
+ cbRef.current();
300
+ }, msRef.current);
207
301
  }, []);
208
- return S(() => (f(), d), [s]), [d, f];
302
+ useEffect(() => {
303
+ reset();
304
+ return cancel;
305
+ }, [ms]);
306
+ return [cancel, reset];
209
307
  }
210
308
  //#endregion
211
309
  //#region ../diagram/src/hooks/useUpdateEffect.ts
212
- var noop = () => {}, depsShallowEqual = (o, s) => {
213
- if (o === s) return !0;
214
- if (o.length !== s.length) return !1;
215
- for (let [c, l] of o.entries()) if (!(l === s[c] || p(l, s[c]))) return !1;
216
- return !0;
217
- };
218
- function useUpdateEffect(o, s, c, l) {
219
- useCustomCompareEffect(useFirstMountState() ? noop : o, s, c ?? depsShallowEqual, l);
220
- }
221
- //#endregion
222
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/atom/index.js
223
- var B = [], V = 0, H = null, U = 4, W = globalThis.nanostoresGlobal ||= { epoch: 0 }, drainQueue = () => {
224
- let o;
225
- for (V = 0; V < B.length; V += U) try {
226
- B[V](B[V + 1].value, B[V + 2], B[V + 3]);
227
- } catch (s) {
228
- o = s;
310
+ var noop = () => {};
311
+ var depsShallowEqual = (d1, d2) => {
312
+ if (d1 === d2) return true;
313
+ if (d1.length !== d2.length) return false;
314
+ for (const [i, element] of d1.entries()) {
315
+ if (element === d2[i] || shallowEqual(element, d2[i])) continue;
316
+ return false;
229
317
  }
230
- if (B.length = 0, o) throw o;
231
- }, atom = /* @__NO_SIDE_EFFECTS__ */ (o) => {
232
- let s = [], c = {
233
- eq: Object.is,
234
- get() {
235
- return c.lc || c.listen(() => {})(), c.value;
236
- },
237
- init: o,
238
- lc: 0,
239
- listen(o) {
240
- return c.lc = s.push(o), () => {
241
- for (let s = V + U; s < B.length;) B[s] === o ? B.splice(s, U) : s += U;
242
- let l = s.indexOf(o);
243
- ~l && (s.splice(l, 1), --c.lc || c.off());
244
- };
245
- },
246
- notify(o, l) {
247
- W.epoch++;
248
- let u = !B.length && !0;
249
- for (let u of s) H?.has(u) || (H?.add(u), B.push(u, c, o, l));
250
- u && drainQueue();
251
- },
252
- off() {},
253
- set(o) {
254
- let s = c.value;
255
- c.eq(s, o) || (c.value = o, c.notify(s));
256
- },
257
- subscribe(o) {
258
- let s = c.listen(o);
259
- return o(c.value), s;
260
- },
261
- value: o
262
- };
263
- return c;
264
- }, G = 5, K = 6, q = 10, on = (o, s, c, l) => (o.events = o.events || {}, o.events[c + q] || (o.events[c + q] = l((s) => {
265
- o.events[c].reduceRight((o, s) => (s(o), o), {
266
- shared: {},
267
- ...s
268
- });
269
- })), o.events[c] = o.events[c] || [], o.events[c].push(s), () => {
270
- let l = o.events[c], u = l.indexOf(s);
271
- l.splice(u, 1), l.length || (delete o.events[c], o.events[c + q](), delete o.events[c + q]);
272
- }), J = 1e3, onMount = (o, s) => {
273
- let listener = (c) => {
274
- let l = s(c);
275
- l && o.events[K].push(l);
276
- };
277
- return on(o, listener, G, (s) => {
278
- let c = o.listen;
279
- o.listen = (...l) => (!o.lc && !o.active && (o.active = !0, s()), c(...l));
280
- let l = o.off;
281
- return o.events[K] = [], o.off = () => {
282
- l(), setTimeout(() => {
283
- if (o.active && !o.lc) {
284
- o.active = !1;
285
- for (let s of o.events[K]) s();
286
- o.events[K] = [];
287
- }
288
- }, J);
289
- }, () => {
290
- o.listen = c, o.off = l;
291
- };
292
- });
318
+ return true;
293
319
  };
294
- //#endregion
295
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/deep-map/path.js
296
- function getPath(o, s) {
297
- let c = getAllKeysFromPath(s), l = o;
298
- for (let o of c) {
299
- if (l == null) return;
300
- l = l[o];
301
- }
302
- return l;
303
- }
304
- var Y = /(.*)\[(\d+)\]/;
305
- function getAllKeysFromPath(o) {
306
- return o.split(".").flatMap((o) => getKeyAndIndicesFromKey(o));
307
- }
308
- function getKeyAndIndicesFromKey(o) {
309
- if (Y.test(o)) {
310
- let [, s, c] = o.match(Y);
311
- return [...getKeyAndIndicesFromKey(s), c];
312
- }
313
- return [o];
320
+ function useUpdateEffect(callback, deps, equalityFn, effectHook) {
321
+ useCustomCompareEffect(useFirstMountState() ? noop : callback, deps, equalityFn ?? depsShallowEqual, effectHook);
314
322
  }
315
323
  //#endregion
316
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/listen-keys/index.js
317
- function listenKeys(o, s, c) {
318
- let l = new Set(s);
319
- return o.listen((o, u, d) => {
320
- (d === void 0 ? s.some((s) => u === void 0 || o[s] !== u[s] || getPath(o, s) !== getPath(u, s)) : l.has(d) || l.has(d.split(/\.|\[/)[0])) && c(o, u, d);
321
- });
322
- }
323
- //#endregion
324
- //#region ../../node_modules/.pnpm/@nanostores+react@1.1.0_nanostores@1.5.2_react@19.2.8/node_modules/@nanostores/react/index.js
325
- var emit = (o, s) => (c) => {
326
- o.current !== c && (o.current = c, s());
324
+ //#region ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.0/node_modules/@nanostores/react/index.js
325
+ var emit = (snapshotRef, onChange) => (value) => {
326
+ if (snapshotRef.current === value) return;
327
+ snapshotRef.current = value;
328
+ onChange();
327
329
  };
328
- function useStore(o, { keys: s, deps: c = [o, s], ssr: l } = {}) {
329
- let u = T();
330
- u.current = o.get();
331
- let d = b((c) => (emit(u, c)(o.value), s?.length > 0 ? listenKeys(o, s, emit(u, c)) : o.listen(emit(u, c))), c), get = () => u.current, f = get;
332
- return l && "init" in o && (f = l === "initial" ? () => o.init : l), D(d, get, f);
330
+ function useStore(store, { keys, deps = [store, keys], ssr } = {}) {
331
+ let snapshotRef = useRef();
332
+ snapshotRef.current = store.get();
333
+ let subscribe = useCallback((onChange) => {
334
+ emit(snapshotRef, onChange)(store.value);
335
+ return keys?.length > 0 ? listenKeys(store, keys, emit(snapshotRef, onChange)) : store.listen(emit(snapshotRef, onChange));
336
+ }, deps);
337
+ let get = () => snapshotRef.current;
338
+ let server = get;
339
+ if (ssr && "init" in store) server = ssr === "initial" ? () => store.init : ssr;
340
+ return useSyncExternalStore(subscribe, get, server);
333
341
  }
334
342
  //#endregion
335
343
  //#region ../diagram/src/hooks/safeContext.tsx
336
- var X = _(null);
337
- X.displayName = "DiagramApiSafeContext";
338
- var Z = X.Provider;
344
+ var DiagramApiSafeContext = createContext(null);
345
+ DiagramApiSafeContext.displayName = "DiagramApiSafeContext";
346
+ var DiagramApiContextProvider = DiagramApiSafeContext.Provider;
339
347
  function useDiagram() {
340
- let o = x(X);
341
- if (o === null) throw Error("DiagramApi is not provided");
342
- return o;
348
+ const ctx = use(DiagramApiSafeContext);
349
+ if (ctx === null) throw new Error("DiagramApi is not provided");
350
+ return ctx;
343
351
  }
344
- function createSafeContextForActor(o) {
345
- let s = _(null);
346
- function selectSnapshot(o, s) {
347
- return [o, s ?? p];
352
+ /**
353
+ * Helper to create a safe context for an actor
354
+ * @example
355
+ * ```tsx
356
+ * const {
357
+ * ContextProvider: MyActorContext,
358
+ * useActorRef,
359
+ * selectSnapshot,
360
+ * useActorSelector
361
+ * } = createSafeContextForActor<MyActorRef>()
362
+ *
363
+ * const select = selectSnapshot(
364
+ * s => ....,
365
+ * (a, b) => a === b
366
+ * )
367
+ *
368
+ * // Later in component:
369
+ * const value = useActorSelector(select)
370
+ * ```
371
+ */
372
+ function createSafeContextForActor(name) {
373
+ const Ctx = createContext(null);
374
+ function selectSnapshot(selector, compare) {
375
+ return [selector, compare ?? shallowEqual];
348
376
  }
349
- function selectContext(o, s) {
350
- return [(s) => o(s.context), s ?? p];
377
+ function selectContext(selector, compare) {
378
+ return [(snapshot) => selector(snapshot.context), compare ?? shallowEqual];
351
379
  }
352
380
  function useActorRef() {
353
- let c = x(s);
354
- if (c === null) throw Error(`${o}SafeContext is not provided `);
355
- return c;
381
+ const actorRef = useContext(Ctx);
382
+ if (actorRef === null) throw new Error(`${name}SafeContext is not provided `);
383
+ return actorRef;
356
384
  }
357
- function useActorSelector(o, s) {
358
- let c, l;
359
- return s === void 0 ? Array.isArray(o) ? [c, l] = o : (c = o, l = p) : [c, l] = [o, s], l ??= p, h(e(c), "selector must be a function"), g(useActorRef(), c, l);
385
+ function useActorSelector(arg1, arg2) {
386
+ let selector;
387
+ let compare;
388
+ if (arg2 !== void 0) [selector, compare] = [arg1, arg2];
389
+ else if (Array.isArray(arg1)) [selector, compare] = arg1;
390
+ else {
391
+ selector = arg1;
392
+ compare = shallowEqual;
393
+ }
394
+ compare ??= shallowEqual;
395
+ invariant(e(selector), "selector must be a function");
396
+ return useSelector(useActorRef(), selector, compare);
360
397
  }
361
398
  return {
362
- ContextProvider: s.Provider,
399
+ ContextProvider: Ctx.Provider,
363
400
  selectSnapshot,
364
401
  selectContext,
365
402
  useActorSelector,
366
403
  useActorRef
367
404
  };
368
405
  }
369
- var { ContextProvider: ee, selectSnapshot: te, selectContext: ne, useActorSelector: re, useActorRef: ie } = createSafeContextForActor("DiagramActor"), Q = y((o, s) => {
370
- let c = O(34), p, m, h, g, _, v, y, b, x;
371
- c[0] === o ? (p = c[1], m = c[2], h = c[3], g = c[4], _ = c[5], v = c[6], y = c[7], b = c[8], x = c[9]) : ({value: x, textScale: _, uselikec4palette: v, hideIfEmpty: y, emptyText: b, className: p, style: g, fontSize: m, ...h} = o, c[0] = o, c[1] = p, c[2] = m, c[3] = h, c[4] = g, c[5] = _, c[6] = v, c[7] = y, c[8] = b, c[9] = x);
372
- let S = _ === void 0 ? 1 : _, C = v !== void 0 && v, w = y !== void 0 && y, T = b === void 0 ? "no content" : b;
373
- if (x.isEmpty && w) return null;
374
- let E;
375
- c[10] !== T || c[11] !== x.html || c[12] !== x.isMarkdown || c[13] !== x.nonEmpty || c[14] !== x.text ? (E = x.nonEmpty ? x.isMarkdown ? { dangerouslySetInnerHTML: { __html: x.html } } : { children: /* @__PURE__ */ k("p", { children: x.text }) } : { children: /* @__PURE__ */ k(l, {
376
- component: "span",
377
- fz: "xs",
378
- c: "dimmed",
379
- style: { userSelect: "none" },
380
- children: T
381
- }) }, c[10] = T, c[11] = x.html, c[12] = x.isMarkdown, c[13] = x.nonEmpty, c[14] = x.text, c[15] = E) : E = c[15];
382
- let D = E, A;
383
- c[16] !== p || c[17] !== C || c[18] !== x.isMarkdown ? (A = d(f({
384
- uselikec4palette: C,
385
- value: x.isMarkdown ? "markdown" : "plaintext"
386
- }), p), c[16] = p, c[17] = C, c[18] = x.isMarkdown, c[19] = A) : A = c[19];
387
- let j;
388
- c[20] === m ? j = c[21] : (j = m && { "--text-fz": `var(--font-sizes-${m}, var(--font-sizes-md))` }, c[20] = m, c[21] = j);
389
- let M;
390
- c[22] === S ? M = c[23] : (M = S !== 1 && { "--mantine-scale": S }, c[22] = S, c[23] = M);
391
- let N;
392
- c[24] !== g || c[25] !== j || c[26] !== M ? (N = {
393
- ...g,
394
- ...j,
395
- ...M
396
- }, c[24] = g, c[25] = j, c[26] = M, c[27] = N) : N = c[27];
397
- let P;
398
- return c[28] !== D || c[29] !== h || c[30] !== s || c[31] !== A || c[32] !== N ? (P = /* @__PURE__ */ k(u, {
399
- ...h,
400
- ref: s,
401
- className: A,
402
- style: N,
403
- ...D
404
- }), c[28] = D, c[29] = h, c[30] = s, c[31] = A, c[32] = N, c[33] = P) : P = c[33], P;
406
+ var { ContextProvider: DiagramActorContextProvider, selectSnapshot: selectDiagramSnapshot, selectContext: selectDiagramContext, useActorSelector: useDiagramSelector, useActorRef: useDiagramActorRef } = createSafeContextForActor("DiagramActor");
407
+ //#endregion
408
+ //#region ../diagram/src/base-primitives/Markdown.tsx
409
+ var Markdown = forwardRef((t0, ref) => {
410
+ const $ = c(34);
411
+ let className;
412
+ let fontSize;
413
+ let props;
414
+ let style;
415
+ let t1;
416
+ let t2;
417
+ let t3;
418
+ let t4;
419
+ let value;
420
+ if ($[0] !== t0) {
421
+ ({value, textScale: t1, uselikec4palette: t2, hideIfEmpty: t3, emptyText: t4, className, style, fontSize, ...props} = t0);
422
+ $[0] = t0;
423
+ $[1] = className;
424
+ $[2] = fontSize;
425
+ $[3] = props;
426
+ $[4] = style;
427
+ $[5] = t1;
428
+ $[6] = t2;
429
+ $[7] = t3;
430
+ $[8] = t4;
431
+ $[9] = value;
432
+ } else {
433
+ className = $[1];
434
+ fontSize = $[2];
435
+ props = $[3];
436
+ style = $[4];
437
+ t1 = $[5];
438
+ t2 = $[6];
439
+ t3 = $[7];
440
+ t4 = $[8];
441
+ value = $[9];
442
+ }
443
+ const textScale = t1 === void 0 ? 1 : t1;
444
+ const uselikec4palette = t2 === void 0 ? false : t2;
445
+ const hideIfEmpty = t3 === void 0 ? false : t3;
446
+ const emptyText = t4 === void 0 ? "no content" : t4;
447
+ if (value.isEmpty && hideIfEmpty) return null;
448
+ let t5;
449
+ if ($[10] !== emptyText || $[11] !== value.html || $[12] !== value.isMarkdown || $[13] !== value.nonEmpty || $[14] !== value.text) {
450
+ t5 = value.nonEmpty ? value.isMarkdown ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx("p", { children: value.text }) } : { children: /* @__PURE__ */ jsx(Text, {
451
+ component: "span",
452
+ fz: "xs",
453
+ c: "dimmed",
454
+ style: { userSelect: "none" },
455
+ children: emptyText
456
+ }) };
457
+ $[10] = emptyText;
458
+ $[11] = value.html;
459
+ $[12] = value.isMarkdown;
460
+ $[13] = value.nonEmpty;
461
+ $[14] = value.text;
462
+ $[15] = t5;
463
+ } else t5 = $[15];
464
+ const content = t5;
465
+ let t6;
466
+ if ($[16] !== className || $[17] !== uselikec4palette || $[18] !== value.isMarkdown) {
467
+ t6 = cx(markdownBlock({
468
+ uselikec4palette,
469
+ value: value.isMarkdown ? "markdown" : "plaintext"
470
+ }), className);
471
+ $[16] = className;
472
+ $[17] = uselikec4palette;
473
+ $[18] = value.isMarkdown;
474
+ $[19] = t6;
475
+ } else t6 = $[19];
476
+ let t7;
477
+ if ($[20] !== fontSize) {
478
+ t7 = fontSize && { "--text-fz": `var(--font-sizes-${fontSize}, var(--font-sizes-md))` };
479
+ $[20] = fontSize;
480
+ $[21] = t7;
481
+ } else t7 = $[21];
482
+ let t8;
483
+ if ($[22] !== textScale) {
484
+ t8 = textScale !== 1 && { "--mantine-scale": textScale };
485
+ $[22] = textScale;
486
+ $[23] = t8;
487
+ } else t8 = $[23];
488
+ let t9;
489
+ if ($[24] !== style || $[25] !== t7 || $[26] !== t8) {
490
+ t9 = {
491
+ ...style,
492
+ ...t7,
493
+ ...t8
494
+ };
495
+ $[24] = style;
496
+ $[25] = t7;
497
+ $[26] = t8;
498
+ $[27] = t9;
499
+ } else t9 = $[27];
500
+ let t10;
501
+ if ($[28] !== content || $[29] !== props || $[30] !== ref || $[31] !== t6 || $[32] !== t9) {
502
+ t10 = /* @__PURE__ */ jsx(Box, {
503
+ ...props,
504
+ ref,
505
+ className: t6,
506
+ style: t9,
507
+ ...content
508
+ });
509
+ $[28] = content;
510
+ $[29] = props;
511
+ $[30] = ref;
512
+ $[31] = t6;
513
+ $[32] = t9;
514
+ $[33] = t10;
515
+ } else t10 = $[33];
516
+ return t10;
405
517
  });
406
- Q.displayName = "Markdown";
518
+ Markdown.displayName = "Markdown";
407
519
  //#endregion
408
520
  //#region src/context/safeCtx.ts
409
- var $ = _(null), ae = $.Provider, useLikeC4ModelAtom = () => {
410
- let o = x($);
411
- if (o === null) throw Error("LikeC4ModelAtom is not provided");
412
- return o;
521
+ /**
522
+ * To improve experience with HMR, we move context to separate files and use as a boundary for hooks
523
+ */
524
+ var LikeC4ModelDataContext = createContext(null);
525
+ var LikeC4ModelDataContextProvider = LikeC4ModelDataContext.Provider;
526
+ var useLikeC4ModelAtom = () => {
527
+ const ctx = useContext(LikeC4ModelDataContext);
528
+ if (ctx === null) throw new Error("LikeC4ModelAtom is not provided");
529
+ return ctx;
413
530
  };
414
531
  //#endregion
415
532
  //#region src/hooks.ts
416
- function useTransparentBackground(o) {
417
- let s = O(3), c = o === void 0 || o, t1, l;
418
- s[0] === c ? (t1 = s[1], l = s[2]) : (t1 = () => {
419
- let o = document.body.parentElement;
420
- if (!(!o || c !== !0)) return o.classList.add("transparent-bg"), () => {
421
- o.classList.remove("transparent-bg");
533
+ function useTransparentBackground(t0) {
534
+ const $ = c(3);
535
+ const enabled = t0 === void 0 ? true : t0;
536
+ let t1;
537
+ let t2;
538
+ if ($[0] !== enabled) {
539
+ t1 = () => {
540
+ const htmlEl = document.body.parentElement;
541
+ if (!htmlEl || enabled !== true) return;
542
+ htmlEl.classList.add("transparent-bg");
543
+ return () => {
544
+ htmlEl.classList.remove("transparent-bg");
545
+ };
422
546
  };
423
- }, l = [c], s[0] = c, s[1] = t1, s[2] = l), z(t1, l);
547
+ t2 = [enabled];
548
+ $[0] = enabled;
549
+ $[1] = t1;
550
+ $[2] = t2;
551
+ } else {
552
+ t1 = $[1];
553
+ t2 = $[2];
554
+ }
555
+ useIsomorphicLayoutEffect(t1, t2);
424
556
  }
425
557
  function useLikeC4Views() {
426
- let o = O(4), s = useLikeC4ModelAtom(), c;
427
- o[0] === Symbol.for("react.memo_cache_sentinel") ? (c = [], o[0] = c) : c = o[0];
428
- let [l, u] = E(c), t1, d;
429
- return o[1] === s ? (t1 = o[2], d = o[3]) : (t1 = () => s.subscribe((o) => {
430
- u((s) => {
431
- let c = [...o.views()].map((o) => {
432
- let c = o.$layouted, l = s.find((s) => s.id === o.id);
433
- return l && m(c, l) ? l : c;
558
+ const $ = c(4);
559
+ const $likec4model = useLikeC4ModelAtom();
560
+ let t0;
561
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
562
+ t0 = [];
563
+ $[0] = t0;
564
+ } else t0 = $[0];
565
+ const [views, setViews] = useState(t0);
566
+ let t1;
567
+ let t2;
568
+ if ($[1] !== $likec4model) {
569
+ t1 = () => $likec4model.subscribe((next) => {
570
+ setViews((prev) => {
571
+ const nextViews = [...next.views()].map((v) => {
572
+ const n = v.$layouted;
573
+ const p = prev.find((_) => _.id === v.id);
574
+ return !!p && deepEqual(n, p) ? p : n;
575
+ });
576
+ if (shallowEqual(prev, nextViews)) return prev;
577
+ return nextViews;
434
578
  });
435
- return p(s, c) ? s : c;
436
579
  });
437
- }), d = [s], o[1] = s, o[2] = t1, o[3] = d), S(t1, d), l;
580
+ t2 = [$likec4model];
581
+ $[1] = $likec4model;
582
+ $[2] = t1;
583
+ $[3] = t2;
584
+ } else {
585
+ t1 = $[2];
586
+ t2 = $[3];
587
+ }
588
+ useEffect(t1, t2);
589
+ return views;
438
590
  }
439
591
  function useCurrentViewId() {
440
- let o = O(1), c;
441
- return o[0] === Symbol.for("react.memo_cache_sentinel") ? (c = {
442
- select: _temp,
443
- strict: !1
444
- }, o[0] = c) : c = o[0], s(c) ?? "index";
592
+ const $ = c(1);
593
+ let t0;
594
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
595
+ t0 = {
596
+ select: _temp,
597
+ strict: false
598
+ };
599
+ $[0] = t0;
600
+ } else t0 = $[0];
601
+ return useParams(t0) ?? "index";
445
602
  }
446
- function _temp(o) {
447
- return o.viewId;
603
+ function _temp(params) {
604
+ return params.viewId;
448
605
  }
606
+ /**
607
+ * Returns the current view and a function to set the layout type.
608
+ */
449
609
  function useCurrentView() {
450
- let o = O(13), s = useCurrentViewId(), c = useLikeC4ModelAtom(), [l, u] = E("manual"), t0;
451
- o[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => {
452
- u("manual");
453
- }, o[0] = t0) : t0 = o[0];
454
- let d;
455
- o[1] === s ? d = o[2] : (d = [s], o[1] = s, o[2] = d), useUpdateEffect(t0, d);
610
+ const $ = c(13);
611
+ const viewId = useCurrentViewId();
612
+ const $likec4model = useLikeC4ModelAtom();
613
+ const [layoutType, setLayoutType] = useState("manual");
614
+ let t0;
615
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
616
+ t0 = () => {
617
+ setLayoutType("manual");
618
+ };
619
+ $[0] = t0;
620
+ } else t0 = $[0];
621
+ let t1;
622
+ if ($[1] !== viewId) {
623
+ t1 = [viewId];
624
+ $[1] = viewId;
625
+ $[2] = t1;
626
+ } else t1 = $[2];
627
+ useUpdateEffect(t0, t1);
456
628
  let t2;
457
- o[3] !== c || o[4] !== s ? (t2 = () => c.get().findView(s)?.$layouted ?? null, o[3] = c, o[4] = s, o[5] = t2) : t2 = o[5];
458
- let [f, p] = E(t2), t3, h;
459
- o[6] !== c || o[7] !== l || o[8] !== s ? (t3 = () => c.subscribe((o, c) => {
460
- p((c) => {
461
- let u = o.findView(s);
462
- if (!u) return c?.id === s ? c : null;
463
- let d = l === "auto" ? u.$view : u.$layouted;
464
- return m(c, d) ? c : d;
629
+ if ($[3] !== $likec4model || $[4] !== viewId) {
630
+ t2 = () => $likec4model.get().findView(viewId)?.$layouted ?? null;
631
+ $[3] = $likec4model;
632
+ $[4] = viewId;
633
+ $[5] = t2;
634
+ } else t2 = $[5];
635
+ const [view, setView] = useState(t2);
636
+ let t3;
637
+ let t4;
638
+ if ($[6] !== $likec4model || $[7] !== layoutType || $[8] !== viewId) {
639
+ t3 = () => $likec4model.subscribe((next, old) => {
640
+ setView((current) => {
641
+ const vm = next.findView(viewId);
642
+ if (!vm) return current?.id === viewId ? current : null;
643
+ const nextView = layoutType === "auto" ? vm.$view : vm.$layouted;
644
+ if (deepEqual(current, nextView)) return current;
645
+ return nextView;
646
+ });
465
647
  });
466
- }), h = [
467
- c,
468
- s,
469
- l
470
- ], o[6] = c, o[7] = l, o[8] = s, o[9] = t3, o[10] = h) : (t3 = o[9], h = o[10]), S(t3, h);
471
- let g;
472
- return o[11] === f ? g = o[12] : (g = [f, u], o[11] = f, o[12] = g), g;
648
+ t4 = [
649
+ $likec4model,
650
+ viewId,
651
+ layoutType
652
+ ];
653
+ $[6] = $likec4model;
654
+ $[7] = layoutType;
655
+ $[8] = viewId;
656
+ $[9] = t3;
657
+ $[10] = t4;
658
+ } else {
659
+ t3 = $[9];
660
+ t4 = $[10];
661
+ }
662
+ useEffect(t3, t4);
663
+ let t5;
664
+ if ($[11] !== view) {
665
+ t5 = [view, setLayoutType];
666
+ $[11] = view;
667
+ $[12] = t5;
668
+ } else t5 = $[12];
669
+ return t5;
473
670
  }
474
671
  function useCurrentProject() {
475
- let o = O(4), s = A(), l;
476
- o[0] === Symbol.for("react.memo_cache_sentinel") ? (l = { select: selectProjectIdFromContext }, o[0] = l) : l = o[0];
477
- let u = c(l), d;
478
- return o[1] !== u || o[2] !== s ? (d = u && s.find((o) => o.id === u) || s[0], o[1] = u, o[2] = s, o[3] = d) : d = o[3], d;
672
+ const $ = c(4);
673
+ const projects = useLikeC4Projects();
674
+ let t0;
675
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
676
+ t0 = {
677
+ select: selectProjectIdFromContext,
678
+ structuralSharing: false
679
+ };
680
+ $[0] = t0;
681
+ } else t0 = $[0];
682
+ const projectId = useMatches(t0);
683
+ let t1;
684
+ if ($[1] !== projectId || $[2] !== projects) {
685
+ t1 = projectId && projects.find((p) => p.id === projectId) || projects[0];
686
+ $[1] = projectId;
687
+ $[2] = projects;
688
+ $[3] = t1;
689
+ } else t1 = $[3];
690
+ return t1;
479
691
  }
480
- function selectProjectIdFromContext(o) {
481
- return o.find((o) => o.routeId === "/project/$projectId")?.params?.projectId ?? o.at(-1)?.context.projectId ?? void 0;
692
+ function selectProjectIdFromContext(matches) {
693
+ return matches.find((m) => m.routeId === "/project/$projectId")?.params?.projectId ?? matches.at(-1)?.context.projectId ?? void 0;
482
694
  }
483
695
  //#endregion
484
- export { createReactComponent as A, useTimeoutEffect as C, useSyncedRef as D, L as E, t$1 as F, M as I, j as L, e as M, r$1 as N, I as O, N as P, t$3 as R, useUpdateEffect as S, R as T, useStore as _, useTransparentBackground as a, W as b, Q as c, createSafeContextForActor as d, ne as f, re as g, ie as h, useLikeC4Views as i, t as j, F as k, ee as l, useDiagram as m, useCurrentView as n, ae as o, te as p, useCurrentViewId as r, useLikeC4ModelAtom as s, useCurrentProject as t, Z as u, onMount as v, useFirstMountState as w, depsShallowEqual as x, atom as y, e$2 as z };
696
+ export { r$1 as A, noop$1 as C, createReactComponent as D, IconSparkles as E, t$3 as F, e$2 as I, t$1 as M, r$3 as N, t as O, t$2 as P, isBrowser as S, IconPlayerStopFilled as T, useStore as _, useTransparentBackground as a, useTimeoutEffect as b, Markdown as c, createSafeContextForActor as d, selectDiagramContext as f, useDiagramSelector as g, useDiagramActorRef as h, useLikeC4Views as i, e$1 as j, e as k, DiagramActorContextProvider as l, useDiagram as m, useCurrentView as n, LikeC4ModelDataContextProvider as o, selectDiagramSnapshot as p, useCurrentViewId as r, useLikeC4ModelAtom as s, useCurrentProject as t, DiagramApiContextProvider as u, depsShallowEqual as v, useSyncedRef as w, useFirstMountState as x, useUpdateEffect as y };