@belonguniverseai/react-sdk 0.6.1 → 0.6.3

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 (93) hide show
  1. package/dist/api/agent-grants.d.ts +6 -0
  2. package/dist/api/client.d.ts +88 -27
  3. package/dist/api/task-schedules.d.ts +138 -255
  4. package/dist/app/call-summary.d.ts +30 -0
  5. package/dist/component/abnfDiagram-N423BO3Z-C1O9dfJJ.js +90 -0
  6. package/dist/component/arc-Cpnt_LFj.js +86 -0
  7. package/dist/component/{architectureDiagram-3BPJPVTR-BVwa4QrX.js → architectureDiagram-T3A2C74G-iakL6yUj.js} +1872 -1785
  8. package/dist/component/{blockDiagram-GPEHLZMM-CKNImKL2.js → blockDiagram-VBNYF7ZC-D7t0jIvW.js} +895 -894
  9. package/dist/component/{c4Diagram-AAUBKEIU-BcbjcMPA.js → c4Diagram-5PPSVZJV-CRX1o0CJ.js} +3 -3
  10. package/dist/component/{channel-vtwXLQ1f.js → channel-DnM50Ep0.js} +2 -2
  11. package/dist/component/{chunk-ND2GUHAM-DfbE4oOG.js → chunk-2GRJ4B5K-ChTMjM-v.js} +5 -5
  12. package/dist/component/{chunk-QZHKN3VN-Y8mfHGtB.js → chunk-2Q5K7J3B-F2Rpvtwm.js} +2 -2
  13. package/dist/component/{chunk-AQP2D5EJ-DiS4043D.js → chunk-5RXB4S5H-B1WLx-ex.js} +399 -378
  14. package/dist/component/{chunk-FMBD7UC4-Bu05DXe4.js → chunk-5VM5RSS4-D35VMAuN.js} +2 -2
  15. package/dist/component/chunk-6Q2QTUOP-DGVp_gyk.js +673 -0
  16. package/dist/component/{chunk-727SXJPM-BTqmmKKN.js → chunk-GF5L2VYU-CZOQEv_q.js} +244 -239
  17. package/dist/component/{chunk-4BX2VUAB-DySNI9mv.js → chunk-JWPE2WC7-BbwyDj9g.js} +2 -2
  18. package/dist/component/{chunk-2J33WTMH-C6wmoOIl.js → chunk-KBJHAD2P-B9qL0VLM.js} +2 -2
  19. package/dist/component/chunk-RYQCIY6F-5eaMbXXL.js +316 -0
  20. package/dist/component/{chunk-55IACEB6-C4M2cG_c.js → chunk-XXDRQBXY-XJadTIK5.js} +2 -2
  21. package/dist/component/{classDiagram-4FO5ZUOK-ChO_m1Vd.js → classDiagram-JCYQIIEL-DVaEk7uT.js} +3 -3
  22. package/dist/component/{classDiagram-v2-Q7XG4LA2-ChO_m1Vd.js → classDiagram-v2-OCEON4UE-DVaEk7uT.js} +3 -3
  23. package/dist/component/{cose-bilkent-S5V4N54A-B1DDE26M.js → cose-bilkent-JH36ORCC-DZA30AqI.js} +2 -2
  24. package/dist/component/{wardley-L42UT6IY-HA1eSIS_.js → cynefin-VYW2F7L2-DAyxamLw.js} +9199 -7918
  25. package/dist/component/cynefinDiagram-MW4NZA55-CutZScTQ.js +302 -0
  26. package/dist/component/dagre-VZM6K2ZE-CelPLP8N.js +343 -0
  27. package/dist/component/diagram-7IWD3JNH-Cr5piwKc.js +353 -0
  28. package/dist/component/{diagram-KO2AKTUF-DD3KqnFb.js → diagram-B4RE2ZJO-DgLNdZkh.js} +24 -24
  29. package/dist/component/{diagram-LMA3HP47-D6-oakzD.js → diagram-LBJQPF4R-DxeIMTjN.js} +23 -23
  30. package/dist/component/{diagram-OG6HWLK6-DfxY1IE7.js → diagram-Q27KOJAE-WACyk_gr.js} +197 -197
  31. package/dist/component/diagram-UB23O5K3-DbhVYU5T.js +222 -0
  32. package/dist/component/ebnfDiagram-BXEA7PRR-DoGrYW10.js +112 -0
  33. package/dist/component/{erDiagram-TEJ5UH35-BDV1C23R.js → erDiagram-JOGREHBK-BgewA6fH.js} +142 -131
  34. package/dist/component/{flowDiagram-I6XJVG4X-mEwMtE2U.js → flowDiagram-UKHOOZJN-1YmYJYcE.js} +268 -258
  35. package/dist/component/ganttDiagram-PKOTCBZU-BFAEPYkH.js +2714 -0
  36. package/dist/component/{gitGraphDiagram-PVQCEYII-CIKPPQiC.js → gitGraphDiagram-DS77QQ5N-CSiPuE-l.js} +33 -33
  37. package/dist/component/{graph-BZLHvygk.js → graph-CWpEkm4G.js} +35 -35
  38. package/dist/component/{highlighted-body-OFNGDK62-DpP1DD9S.js → highlighted-body-OFNGDK62-CSJNGt18.js} +2 -2
  39. package/dist/component/index.js +2 -2
  40. package/dist/component/{infoDiagram-5YYISTIA-DKTrvjCm.js → infoDiagram-6WML65LV-CoMVfONe.js} +4 -4
  41. package/dist/component/{ishikawaDiagram-YF4QCWOH-BcuncMnU.js → ishikawaDiagram-WSZJBQD7-B2YEkQ4b.js} +27 -27
  42. package/dist/component/{journeyDiagram-JHISSGLW-BTTgY3Of.js → journeyDiagram-NVQOT4AX-B7b5ZwlF.js} +5 -5
  43. package/dist/component/{kanban-definition-UN3LZRKU-D9K5810E.js → kanban-definition-27J2QSJJ-C9GPAsBR.js} +35 -35
  44. package/dist/component/layout-Br2UjHRU.js +1522 -0
  45. package/dist/component/{linear-DondfmT2.js → linear-Bi0C-9d1.js} +13 -13
  46. package/dist/component/map-CdwokNh2.js +227 -0
  47. package/dist/component/{mermaid-GHXKKRXX-j_0KsvYs.js → mermaid-GHXKKRXX-BaBCeViM.js} +34453 -35613
  48. package/dist/component/{mindmap-definition-RKZ34NQL-DMC3vCUq.js → mindmap-definition-FAOFIHXS-tHIAo7Ms.js} +26 -26
  49. package/dist/component/pegDiagram-VL7TDLO6-Db_7lLRV.js +98 -0
  50. package/dist/component/pieDiagram-7S7Q4E2Y-C4fs4XCK.js +210 -0
  51. package/dist/component/{quadrantDiagram-W4KKPZXB-DMos-d69.js → quadrantDiagram-CIZ2JOQS-Bw7vXO0q.js} +14 -15
  52. package/dist/component/railroadDiagram-AXF67PYL-kY0VoZEg.js +80 -0
  53. package/dist/component/{requirementDiagram-4Y6WPE33-BpgIfnhZ.js → requirementDiagram-LRYGKXZP-BkNtSZm5.js} +15 -15
  54. package/dist/component/{sankeyDiagram-5OEKKPKP-xbJGp8Ms.js → sankeyDiagram-W5VNT64P-BK_C1BYE.js} +2 -2
  55. package/dist/component/{sequenceDiagram-3UESZ5HK-Bnlm4mVO.js → sequenceDiagram-SI44F4Z6-CEmgVZaE.js} +960 -963
  56. package/dist/component/sizeCapture-X5ZJPWSS-J5ZNXT4c.js +49 -0
  57. package/dist/component/{stateDiagram-AJRCARHV-BIooqMYf.js → stateDiagram-OKZ733FA-DrwrNuNs.js} +5 -5
  58. package/dist/component/{stateDiagram-v2-BHNVJYJU-C6WAOCCe.js → stateDiagram-v2-UEYNNEHI-DHD85VTD.js} +3 -3
  59. package/dist/component/swimlanes-SLNWSIFB-FOK5tys1.js +5335 -0
  60. package/dist/component/swimlanesDiagram-ULZ7WXOC-edTvZTge.js +16 -0
  61. package/dist/component/{timeline-definition-PNZ67QCA-lTe5jbcD.js → timeline-definition-Z64GVDOM-Cc4fTsjY.js} +15 -15
  62. package/dist/component/vennDiagram-T6HMQDX7-DYZl8srI.js +1581 -0
  63. package/dist/component/{wardleyDiagram-YWT4CUSO-BSz_UDND.js → wardleyDiagram-T6FBY63Y-BEvv3PjS.js} +15 -15
  64. package/dist/component/{xychartDiagram-2RQKCTM6-BmzhiB0a.js → xychartDiagram-ELKLHX3M-79AgTtk-.js} +464 -418
  65. package/dist/components/embed/BetaBadge.d.ts +12 -0
  66. package/dist/components/embed/DisclaimerGate.d.ts +16 -0
  67. package/dist/components/embed/LegalShortDisclaimer.d.ts +11 -0
  68. package/dist/components/embed/LocalePills.d.ts +18 -0
  69. package/dist/components/embed/WelcomeIntro.d.ts +3 -1
  70. package/dist/embed/brand-marks.d.ts +5 -5
  71. package/dist/embed/copy.d.ts +13 -0
  72. package/dist/embed/legal-disclaimer.d.ts +23 -0
  73. package/dist/embed/presets.d.ts +5 -1
  74. package/dist/embed/task-schedule-store.d.ts +3 -13
  75. package/dist/embed/voice/call-active-marker.d.ts +1 -20
  76. package/dist/embed/voice/line-slots.d.ts +37 -2
  77. package/dist/embed/voice/voice-token.d.ts +2 -12
  78. package/dist/embed/voice-call.d.ts +12 -0
  79. package/dist/i18n/messages/en.d.ts +1 -2
  80. package/dist/lib/web-storage.d.ts +8 -0
  81. package/dist/stream/belong-chat-transport.d.ts +101 -587
  82. package/dist/stream/message-metadata.d.ts +6 -36
  83. package/dist/stream/stream-state-store.d.ts +14 -25
  84. package/dist/types/public.d.ts +3 -0
  85. package/package.json +1 -1
  86. package/dist/component/arc-BziuP1aB.js +0 -86
  87. package/dist/component/dagre-BM42HDAG-BmujNepD.js +0 -448
  88. package/dist/component/diagram-2AECGRRQ-Cbck9DRQ.js +0 -220
  89. package/dist/component/diagram-5GNKFQAL-csRK5clZ.js +0 -126
  90. package/dist/component/ganttDiagram-6RSMTGT7-C_dcTMQX.js +0 -2709
  91. package/dist/component/layout-Bu6nRdWm.js +0 -1731
  92. package/dist/component/pieDiagram-4H26LBE5-DmYi_D3l.js +0 -166
  93. package/dist/component/vennDiagram-CIIHVFJN-5RYbksB1.js +0 -1560
@@ -1,45 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  export declare const belongMessageMetadataSchema: z.ZodObject<{
3
- /** Producing task of an assistant turn — the reload-stable feedback key. */
4
3
  taskId: z.ZodOptional<z.ZodString>;
5
- /** The user's current 👍/👎 on that turn; `.nullish()` because the live
6
- * `start` chunk stamps no vote yet while history returns `null` for
7
- * "no vote" (requiring it would hide the thumbs on a fresh turn). */
8
4
  feedback: z.ZodOptional<z.ZodNullable<z.ZodObject<{
9
- sentiment: z.ZodEnum<["up", "down"]>;
5
+ sentiment: z.ZodEnum<{
6
+ up: "up";
7
+ down: "down";
8
+ }>;
10
9
  reason: z.ZodNullable<z.ZodString>;
11
- }, "strip", z.ZodTypeAny, {
12
- reason: string | null;
13
- sentiment: "up" | "down";
14
- }, {
15
- reason: string | null;
16
- sentiment: "up" | "down";
17
- }>>>;
18
- /** Server row creation time (ISO) — per-bubble clock, history only (§41). */
10
+ }, z.core.$strip>>>;
19
11
  createdAt: z.ZodOptional<z.ZodString>;
20
- /** Skill picked for this user message — renders the bubble's skill chip. */
21
12
  skill: z.ZodOptional<z.ZodString>;
22
- /** Set by `loadSessionHistory` on every restored message. Gates the
23
- * dispatch renderers' auto-fire: absent (live/replayed turn) → fire once;
24
- * true (restored history) → render settled, never re-dispatch. */
25
13
  fromHistory: z.ZodOptional<z.ZodBoolean>;
26
- }, "strip", z.ZodTypeAny, {
27
- createdAt?: string | undefined;
28
- taskId?: string | undefined;
29
- skill?: string | undefined;
30
- feedback?: {
31
- reason: string | null;
32
- sentiment: "up" | "down";
33
- } | null | undefined;
34
- fromHistory?: boolean | undefined;
35
- }, {
36
- createdAt?: string | undefined;
37
- taskId?: string | undefined;
38
- skill?: string | undefined;
39
- feedback?: {
40
- reason: string | null;
41
- sentiment: "up" | "down";
42
- } | null | undefined;
43
- fromHistory?: boolean | undefined;
44
- }>;
14
+ }, z.core.$strip>;
45
15
  export type BelongMessageMetadata = z.infer<typeof belongMessageMetadataSchema>;
@@ -1,34 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  declare const streamStateSchema: z.ZodObject<{
3
3
  sessionId: z.ZodString;
4
- /**
5
- * Active run id, or null once the run reached a terminal state. The session
6
- * pointer outlives the run: it survives on terminal so a reload can still
7
- * restore this conversation's history — only the run cursor is dropped so we
8
- * never reconnect to a finished run.
9
- */
10
4
  runId: z.ZodNullable<z.ZodString>;
11
- /** `<seq>-0` SSE cursor, or null when no event has been seen yet. */
12
5
  lastEventId: z.ZodNullable<z.ZodString>;
13
- /**
14
- * Epoch ms of the last cursor write. Resume is only attempted for
15
- * recently-touched runs (see {@link readResumableStreamState}). State
16
- * written by an older SDK build has no `updatedAt`, fails this schema, and
17
- * is treated as absent — which is exactly the "start fresh" behavior we
18
- * want for stale leftovers from a previous visit.
19
- */
20
6
  updatedAt: z.ZodNumber;
21
- }, "strip", z.ZodTypeAny, {
22
- updatedAt: number;
23
- sessionId: string;
24
- runId: string | null;
25
- lastEventId: string | null;
26
- }, {
27
- updatedAt: number;
28
- sessionId: string;
29
- runId: string | null;
30
- lastEventId: string | null;
31
- }>;
7
+ }, z.core.$strip>;
32
8
  export type PersistedStreamState = z.infer<typeof streamStateSchema>;
33
9
  /** Bump the foreground-mount generation. Call exactly once per ChatRoute
34
10
  * remount (BelongDock's `chatMount.key` writers), synchronously alongside
@@ -47,6 +23,19 @@ export declare const peekGenerationLostSession: () => string | null;
47
23
  * consumed, or superseded by a newer loss) — a stale reconciler can never
48
24
  * clear a loss it did not actually adopt. */
49
25
  export declare const consumeGenerationLostSession: (sessionId: string) => void;
26
+ /**
27
+ * May per-tab state found at the FIRST read of this page realm keep a live run
28
+ * id? True only for a navigation that PROVES the writing realm is gone (a
29
+ * genuine reload, bfcache/back-forward, or an environment with no Performance
30
+ * API to ask). A `navigate` load is what "Duplicate Tab" performs, and the
31
+ * original tab is still there consuming its own runs.
32
+ *
33
+ * Exported because `sessionStorage` now carries TWO per-tab tiers that both
34
+ * name live runs — the session pointer + parked cursors here, and the rail's
35
+ * agent-line slots (`embed/voice/line-slots.ts`). One duplicate-tab rule for
36
+ * both, so a clone can never double-attach to a run from either direction.
37
+ */
38
+ export declare const mayKeepClonedRunIds: () => boolean;
50
39
  /**
51
40
  * The tab's active stream state.
52
41
  *
@@ -246,6 +246,9 @@ export type BelongGlobal = {
246
246
  userCaption?: string;
247
247
  assistantCaption?: string;
248
248
  agentBusy?: boolean;
249
+ /** What the agent was ASKED to do — the call summary card's headline when
250
+ * no plan step is in flight. State, not a timeline row. */
251
+ currentRequest?: string | null;
249
252
  workPhase?: "coding" | "files" | "actions" | null;
250
253
  speaking?: boolean;
251
254
  thinking?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Belong — embeddable React AI assistant dock. Mount <BelongWidget> in your app tree with getToken dependency-injection auth.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,86 +0,0 @@
1
- import { O as ln, P as an, Q as g, S as on, T as Z, V as w, W as _, X as sn, Y as rn, Z as z, $ as t, a0 as V, a1 as un, a2 as tn, a3 as fn } from "./mermaid-GHXKKRXX-j_0KsvYs.js";
2
- globalThis.process = globalThis.process || { env: {} };
3
- globalThis.global = globalThis.global || globalThis;
4
- function cn(l) {
5
- return l.innerRadius;
6
- }
7
- function gn(l) {
8
- return l.outerRadius;
9
- }
10
- function yn(l) {
11
- return l.startAngle;
12
- }
13
- function pn(l) {
14
- return l.endAngle;
15
- }
16
- function dn(l) {
17
- return l && l.padAngle;
18
- }
19
- function hn(l, x, q, O, v, T, W, a) {
20
- var D = q - l, u = O - x, n = W - v, p = a - T, s = p * D - n * u;
21
- if (!(s * s < g))
22
- return s = (n * (x - T) - p * (l - v)) / s, [l + s * D, x + s * u];
23
- }
24
- function J(l, x, q, O, v, T, W) {
25
- var a = l - q, D = x - O, u = (W ? T : -T) / z(a * a + D * D), n = u * D, p = -u * a, s = l + n, i = x + p, f = q + n, c = O + p, X = (s + f) / 2, o = (i + c) / 2, d = f - s, y = c - i, A = d * d + y * y, R = v - T, b = s * c - f * i, E = (y < 0 ? -1 : 1) * z(fn(0, R * R * A - b * b)), I = (b * y - d * E) / A, Q = (-b * d - y * E) / A, P = (b * y + d * E) / A, h = (-b * d + y * E) / A, m = I - X, e = Q - o, r = P - X, Y = h - o;
26
- return m * m + e * e > r * r + Y * Y && (I = P, Q = h), {
27
- cx: I,
28
- cy: Q,
29
- x01: -n,
30
- y01: -p,
31
- x11: I * (v / R - 1),
32
- y11: Q * (v / R - 1)
33
- };
34
- }
35
- function xn() {
36
- var l = cn, x = gn, q = V(0), O = null, v = yn, T = pn, W = dn, a = null, D = ln(u);
37
- function u() {
38
- var n, p, s = +l.apply(this, arguments), i = +x.apply(this, arguments), f = v.apply(this, arguments) - an, c = T.apply(this, arguments) - an, X = sn(c - f), o = c > f;
39
- if (a || (a = n = D()), i < s && (p = i, i = s, s = p), !(i > g)) a.moveTo(0, 0);
40
- else if (X > on - g)
41
- a.moveTo(i * Z(f), i * w(f)), a.arc(0, 0, i, f, c, !o), s > g && (a.moveTo(s * Z(c), s * w(c)), a.arc(0, 0, s, c, f, o));
42
- else {
43
- var d = f, y = c, A = f, R = c, b = X, E = X, I = W.apply(this, arguments) / 2, Q = I > g && (O ? +O.apply(this, arguments) : z(s * s + i * i)), P = _(sn(i - s) / 2, +q.apply(this, arguments)), h = P, m = P, e, r;
44
- if (Q > g) {
45
- var Y = un(Q / s * w(I)), B = un(Q / i * w(I));
46
- (b -= Y * 2) > g ? (Y *= o ? 1 : -1, A += Y, R -= Y) : (b = 0, A = R = (f + c) / 2), (E -= B * 2) > g ? (B *= o ? 1 : -1, d += B, y -= B) : (E = 0, d = y = (f + c) / 2);
47
- }
48
- var $ = i * Z(d), j = i * w(d), C = s * Z(R), F = s * w(R);
49
- if (P > g) {
50
- var G = i * Z(y), H = i * w(y), K = s * Z(A), L = s * w(A), S;
51
- if (X < rn)
52
- if (S = hn($, j, K, L, G, H, C, F)) {
53
- var M = $ - S[0], N = j - S[1], U = G - S[0], k = H - S[1], nn = 1 / w(tn((M * U + N * k) / (z(M * M + N * N) * z(U * U + k * k))) / 2), en = z(S[0] * S[0] + S[1] * S[1]);
54
- h = _(P, (s - en) / (nn - 1)), m = _(P, (i - en) / (nn + 1));
55
- } else
56
- h = m = 0;
57
- }
58
- E > g ? m > g ? (e = J(K, L, $, j, i, m, o), r = J(G, H, C, F, i, m, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), m < P ? a.arc(e.cx, e.cy, m, t(e.y01, e.x01), t(r.y01, r.x01), !o) : (a.arc(e.cx, e.cy, m, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(r.cy + r.y11, r.cx + r.x11), !o), a.arc(r.cx, r.cy, m, t(r.y11, r.x11), t(r.y01, r.x01), !o))) : (a.moveTo($, j), a.arc(0, 0, i, d, y, !o)) : a.moveTo($, j), !(s > g) || !(b > g) ? a.lineTo(C, F) : h > g ? (e = J(C, F, G, H, s, -h, o), r = J($, j, K, L, s, -h, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), h < P ? a.arc(e.cx, e.cy, h, t(e.y01, e.x01), t(r.y01, r.x01), !o) : (a.arc(e.cx, e.cy, h, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(r.cy + r.y11, r.cx + r.x11), o), a.arc(r.cx, r.cy, h, t(r.y11, r.x11), t(r.y01, r.x01), !o))) : a.arc(0, 0, s, R, A, o);
59
- }
60
- if (a.closePath(), n) return a = null, n + "" || null;
61
- }
62
- return u.centroid = function() {
63
- var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, p = (+v.apply(this, arguments) + +T.apply(this, arguments)) / 2 - rn / 2;
64
- return [Z(p) * n, w(p) * n];
65
- }, u.innerRadius = function(n) {
66
- return arguments.length ? (l = typeof n == "function" ? n : V(+n), u) : l;
67
- }, u.outerRadius = function(n) {
68
- return arguments.length ? (x = typeof n == "function" ? n : V(+n), u) : x;
69
- }, u.cornerRadius = function(n) {
70
- return arguments.length ? (q = typeof n == "function" ? n : V(+n), u) : q;
71
- }, u.padRadius = function(n) {
72
- return arguments.length ? (O = n == null ? null : typeof n == "function" ? n : V(+n), u) : O;
73
- }, u.startAngle = function(n) {
74
- return arguments.length ? (v = typeof n == "function" ? n : V(+n), u) : v;
75
- }, u.endAngle = function(n) {
76
- return arguments.length ? (T = typeof n == "function" ? n : V(+n), u) : T;
77
- }, u.padAngle = function(n) {
78
- return arguments.length ? (W = typeof n == "function" ? n : V(+n), u) : W;
79
- }, u.context = function(n) {
80
- return arguments.length ? (a = n ?? null, u) : a;
81
- }, u;
82
- }
83
- export {
84
- xn as d
85
- };
86
- //# sourceMappingURL=arc-BziuP1aB.js.map
@@ -1,448 +0,0 @@
1
- import { _ as w, aY as _, aZ as Y, a_ as F, a$ as j, l as i, c as H, b0 as V, b1 as $, al as U, aT as Z, am as P, ak as q, b2 as z, b3 as K, b4 as Q } from "./mermaid-GHXKKRXX-j_0KsvYs.js";
2
- import { i as N, G as k } from "./graph-BZLHvygk.js";
3
- import { b as W, m as B, l as I } from "./layout-Bu6nRdWm.js";
4
- globalThis.process = globalThis.process || { env: {} };
5
- globalThis.global = globalThis.global || globalThis;
6
- var ee = 4;
7
- function ne(e) {
8
- return W(e, ee);
9
- }
10
- function v(e) {
11
- var t = {
12
- options: {
13
- directed: e.isDirected(),
14
- multigraph: e.isMultigraph(),
15
- compound: e.isCompound()
16
- },
17
- nodes: te(e),
18
- edges: se(e)
19
- };
20
- return N(e.graph()) || (t.value = ne(e.graph())), t;
21
- }
22
- function te(e) {
23
- return B(e.nodes(), function(t) {
24
- var n = e.node(t), a = e.parent(t), r = { v: t };
25
- return N(n) || (r.value = n), N(a) || (r.parent = a), r;
26
- });
27
- }
28
- function se(e) {
29
- return B(e.edges(), function(t) {
30
- var n = e.edge(t), a = { v: t.v, w: t.w };
31
- return N(t.name) || (a.name = t.name), N(n) || (a.value = n), a;
32
- });
33
- }
34
- var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ w(() => {
35
- y.clear(), R.clear(), d.clear();
36
- }, "clear"), D = /* @__PURE__ */ w((e, t) => {
37
- const n = y.get(t) || [];
38
- return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
39
- }, "isDescendant"), re = /* @__PURE__ */ w((e, t) => {
40
- const n = y.get(t) || [];
41
- return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
42
- }, "edgeInCluster"), A = /* @__PURE__ */ w((e, t, n, a) => {
43
- i.warn(
44
- "Copying children of ",
45
- e,
46
- "root",
47
- a,
48
- "data",
49
- t.node(e),
50
- a
51
- );
52
- const r = t.children(e) || [];
53
- e !== a && r.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", r), r.forEach((o) => {
54
- if (t.children(o).length > 0)
55
- A(o, t, n, a);
56
- else {
57
- const l = t.node(o);
58
- i.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (i.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (i.debug("Setting parent", o, e), n.setParent(o, e)) : (i.info("In copy ", e, "root", a, "data", t.node(e), a), i.debug(
59
- "Not Setting parent for node=",
60
- o,
61
- "cluster!==rootId",
62
- e !== a,
63
- "node!==clusterId",
64
- o !== e
65
- ));
66
- const u = t.edges(o);
67
- i.debug("Copying Edges", u), u.forEach((c) => {
68
- i.info("Edge", c);
69
- const h = t.edge(c.v, c.w, c.name);
70
- i.info("Edge data", h, a);
71
- try {
72
- re(c, a) ? (i.info("Copying as ", c.v, c.w, h, c.name), n.setEdge(c.v, c.w, h, c.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
73
- "Skipping copy of edge ",
74
- c.v,
75
- "-->",
76
- c.w,
77
- " rootId: ",
78
- a,
79
- " clusterId:",
80
- e
81
- );
82
- } catch (m) {
83
- i.error(m);
84
- }
85
- });
86
- }
87
- i.debug("Removing node", o), t.removeNode(o);
88
- });
89
- }, "copy"), G = /* @__PURE__ */ w((e, t) => {
90
- const n = t.children(e);
91
- let a = [...n];
92
- for (const r of n)
93
- R.set(r, e), a = [...a, ...G(r, t)];
94
- return a;
95
- }, "extractDescendants"), oe = /* @__PURE__ */ w((e, t, n) => {
96
- const a = e.edges().filter((c) => c.v === t || c.w === t), r = e.edges().filter((c) => c.v === n || c.w === n), o = a.map((c) => ({ v: c.v === t ? n : c.v, w: c.w === t ? t : c.w })), l = r.map((c) => ({ v: c.v, w: c.w }));
97
- return o.filter((c) => l.some((h) => c.v === h.v && c.w === h.w));
98
- }, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
99
- const a = t.children(e);
100
- if (i.trace("Searching children of id ", e, a), a.length < 1)
101
- return e;
102
- let r;
103
- for (const o of a) {
104
- const l = C(o, t, n), u = oe(t, n, l);
105
- if (l)
106
- if (u.length > 0)
107
- r = l;
108
- else
109
- return l;
110
- }
111
- return r;
112
- }, "findNonClusterChild"), T = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), ae = /* @__PURE__ */ w((e, t) => {
113
- if (!e || t > 10) {
114
- i.debug("Opting out, no graph ");
115
- return;
116
- } else
117
- i.debug("Opting in, graph ");
118
- e.nodes().forEach(function(n) {
119
- e.children(n).length > 0 && (i.warn(
120
- "Cluster identified",
121
- n,
122
- " Replacement id in edges: ",
123
- C(n, e, n)
124
- ), y.set(n, G(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
125
- }), e.nodes().forEach(function(n) {
126
- const a = e.children(n), r = e.edges();
127
- a.length > 0 ? (i.debug("Cluster identified", n, y), r.forEach((o) => {
128
- const l = D(o.v, n), u = D(o.w, n);
129
- l ^ u && (i.warn("Edge: ", o, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
130
- })) : i.debug("Not a cluster ", n, y);
131
- });
132
- for (let n of d.keys()) {
133
- const a = d.get(n).id, r = e.parent(a);
134
- r !== n && d.has(r) && !d.get(r).externalConnections && (d.get(n).id = r);
135
- }
136
- e.edges().forEach(function(n) {
137
- const a = e.edge(n);
138
- i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
139
- let r = n.v, o = n.w;
140
- if (i.warn(
141
- "Fix XXX",
142
- d,
143
- "ids:",
144
- n.v,
145
- n.w,
146
- "Translating: ",
147
- d.get(n.v),
148
- " --- ",
149
- d.get(n.w)
150
- ), d.get(n.v) || d.get(n.w)) {
151
- if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), r = T(n.v), o = T(n.w), e.removeEdge(n.v, n.w, n.name), r !== n.v) {
152
- const l = e.parent(r);
153
- d.get(l).externalConnections = !0, a.fromCluster = n.v;
154
- }
155
- if (o !== n.w) {
156
- const l = e.parent(o);
157
- d.get(l).externalConnections = !0, a.toCluster = n.w;
158
- }
159
- i.warn("Fix Replacing with XXX", r, o, n.name), e.setEdge(r, o, a, n.name);
160
- }
161
- }), i.warn("Adjusted Graph", v(e)), J(e, 0), i.trace(d);
162
- }, "adjustClustersAndEdges"), J = /* @__PURE__ */ w((e, t) => {
163
- if (i.warn("extractor - ", t, v(e), e.children("D")), t > 10) {
164
- i.error("Bailing out");
165
- return;
166
- }
167
- let n = e.nodes(), a = !1;
168
- for (const r of n) {
169
- const o = e.children(r);
170
- a = a || o.length > 0;
171
- }
172
- if (!a) {
173
- i.debug("Done, no node has children", e.nodes());
174
- return;
175
- }
176
- i.debug("Nodes = ", n, t);
177
- for (const r of n)
178
- if (i.debug(
179
- "Extracting node",
180
- r,
181
- d,
182
- d.has(r) && !d.get(r).externalConnections,
183
- !e.parent(r),
184
- e.node(r),
185
- e.children("D"),
186
- " Depth ",
187
- t
188
- ), !d.has(r))
189
- i.debug("Not a cluster", r, t);
190
- else if (!d.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
191
- i.warn(
192
- "Cluster without external connections, without a parent and with children",
193
- r,
194
- t
195
- );
196
- let l = e.graph().rankdir === "TB" ? "LR" : "TB";
197
- d.get(r)?.clusterData?.dir && (l = d.get(r).clusterData.dir, i.warn("Fixing dir", d.get(r).clusterData.dir, l));
198
- const u = new k({
199
- multigraph: !0,
200
- compound: !0
201
- }).setGraph({
202
- rankdir: l,
203
- nodesep: 50,
204
- ranksep: 50,
205
- marginx: 8,
206
- marginy: 8
207
- }).setDefaultEdgeLabel(function() {
208
- return {};
209
- });
210
- i.warn("Old graph before copy", v(e)), A(r, e, u, r), e.setNode(r, {
211
- clusterNode: !0,
212
- id: r,
213
- clusterData: d.get(r).clusterData,
214
- label: d.get(r).label,
215
- graph: u
216
- }), i.warn("New graph after copy node: (", r, ")", v(u)), i.debug("Old graph after copy", v(e));
217
- } else
218
- i.warn(
219
- "Cluster ** ",
220
- r,
221
- " **not meeting the criteria !externalConnections:",
222
- !d.get(r).externalConnections,
223
- " no parent: ",
224
- !e.parent(r),
225
- " children ",
226
- e.children(r) && e.children(r).length > 0,
227
- e.children("D"),
228
- t
229
- ), i.debug(d);
230
- n = e.nodes(), i.warn("New list of nodes", n);
231
- for (const r of n) {
232
- const o = e.node(r);
233
- i.warn(" Now next level", r, o), o?.clusterNode && J(o.graph, t + 1);
234
- }
235
- }, "extractor"), L = /* @__PURE__ */ w((e, t) => {
236
- if (t.length === 0)
237
- return [];
238
- let n = Object.assign([], t);
239
- return t.forEach((a) => {
240
- const r = e.children(a), o = L(e, r);
241
- n = [...n, ...o];
242
- }), n;
243
- }, "sorter"), ce = /* @__PURE__ */ w((e) => L(e, e.children()), "sortNodesByHierarchy"), M = /* @__PURE__ */ w(async (e, t, n, a, r, o) => {
244
- i.warn("Graph in recursive render:XAX", v(t), r);
245
- const l = t.graph().rankdir;
246
- i.trace("Dir in recursive render - dir:", l);
247
- const u = e.insert("g").attr("class", "root");
248
- t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0]));
249
- const c = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), m = u.insert("g").attr("class", "edgeLabels"), b = u.insert("g").attr("class", "nodes");
250
- await Promise.all(
251
- t.nodes().map(async function(f) {
252
- const s = t.node(f);
253
- if (r !== void 0) {
254
- const g = JSON.parse(JSON.stringify(r.clusterData));
255
- i.trace(
256
- `Setting data for parent cluster XXX
257
- Node.id = `,
258
- f,
259
- `
260
- data=`,
261
- g.height,
262
- `
263
- Parent cluster`,
264
- r.height
265
- ), t.setNode(r.id, g), t.parent(f) || (i.trace("Setting parent", f, r.id), t.setParent(f, r.id, g));
266
- }
267
- if (i.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
268
- i.info("Cluster identified XBX", f, s.width, t.node(f));
269
- const { ranksep: g, nodesep: p } = t.graph();
270
- s.graph.setGraph({
271
- ...s.graph.graph(),
272
- ranksep: g + 25,
273
- nodesep: p
274
- });
275
- const E = await M(
276
- b,
277
- s.graph,
278
- n,
279
- a,
280
- t.node(f),
281
- o
282
- ), x = E.elem;
283
- V(s, x), s.diff = E.diff || 0, i.info(
284
- "New compound node after recursive render XAX",
285
- f,
286
- "width",
287
- // node,
288
- s.width,
289
- "height",
290
- s.height
291
- // node.x,
292
- // node.y
293
- ), $(x, s);
294
- } else
295
- t.children(f).length > 0 ? (i.trace(
296
- "Cluster - the non recursive path XBX",
297
- f,
298
- s.id,
299
- s,
300
- s.width,
301
- "Graph:",
302
- t
303
- ), i.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", f, b, t.node(f), l), await U(b, t.node(f), { config: o, dir: l }));
304
- })
305
- ), await (/* @__PURE__ */ w(async () => {
306
- const f = t.edges().map(async function(s) {
307
- const g = t.edge(s.v, s.w, s.name);
308
- i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info(
309
- "Fix",
310
- d,
311
- "ids:",
312
- s.v,
313
- s.w,
314
- "Translating: ",
315
- d.get(s.v),
316
- d.get(s.w)
317
- ), await Q(m, g);
318
- });
319
- await Promise.all(f);
320
- }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(v(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(v(t)));
321
- let O = 0, { subGraphTitleTotalMargin: S } = Z(o);
322
- return await Promise.all(
323
- ce(t).map(async function(f) {
324
- const s = t.node(f);
325
- if (i.info(
326
- "Position XBX => " + f + ": (" + s.x,
327
- "," + s.y,
328
- ") width: ",
329
- s.width,
330
- " height: ",
331
- s.height
332
- ), s?.clusterNode)
333
- s.y += S, i.info(
334
- "A tainted cluster node XBX1",
335
- f,
336
- s.id,
337
- s.width,
338
- s.height,
339
- s.x,
340
- s.y,
341
- t.parent(f)
342
- ), d.get(s.id).node = s, P(s);
343
- else if (t.children(f).length > 0) {
344
- i.info(
345
- "A pure cluster node XBX1",
346
- f,
347
- s.id,
348
- s.x,
349
- s.y,
350
- s.width,
351
- s.height,
352
- t.parent(f)
353
- ), s.height += S, t.node(s.parentId);
354
- const g = s?.padding / 2 || 0, p = s?.labelBBox?.height || 0, E = p - g || 0;
355
- i.debug("OffsetY", E, "labelHeight", p, "halfPadding", g), await q(c, s), d.get(s.id).node = s;
356
- } else {
357
- const g = t.node(s.parentId);
358
- s.y += S / 2, i.info(
359
- "A regular node XBX1 - using the padding",
360
- s.id,
361
- "parent",
362
- s.parentId,
363
- s.width,
364
- s.height,
365
- s.x,
366
- s.y,
367
- "offsetY",
368
- s.offsetY,
369
- "parent",
370
- g,
371
- g?.offsetY,
372
- s
373
- ), P(s);
374
- }
375
- })
376
- ), t.edges().forEach(function(f) {
377
- const s = t.edge(f);
378
- i.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
379
- const g = t.node(f.v);
380
- var p = t.node(f.w);
381
- const E = z(h, s, d, n, g, p, a);
382
- K(s, E);
383
- }), t.nodes().forEach(function(f) {
384
- const s = t.node(f);
385
- i.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
386
- }), i.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
387
- }, "recursiveRender"), ue = /* @__PURE__ */ w(async (e, t) => {
388
- const n = new k({
389
- multigraph: !0,
390
- compound: !0
391
- }).setGraph({
392
- rankdir: e.direction,
393
- nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
394
- ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
395
- marginx: 8,
396
- marginy: 8
397
- }).setDefaultEdgeLabel(function() {
398
- return {};
399
- }), a = t.select("g");
400
- _(a, e.markers, e.type, e.diagramId), Y(), F(), j(), ie(), e.nodes.forEach((o) => {
401
- n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
402
- }), i.debug("Edges:", e.edges), e.edges.forEach((o) => {
403
- if (o.start === o.end) {
404
- const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", h = n.node(l);
405
- n.setNode(u, {
406
- domId: u,
407
- id: u,
408
- parentId: h.parentId,
409
- labelStyle: "",
410
- label: "",
411
- padding: 0,
412
- shape: "labelRect",
413
- // shape: 'rect',
414
- style: "",
415
- width: 10,
416
- height: 10
417
- }), n.setParent(u, h.parentId), n.setNode(c, {
418
- domId: c,
419
- id: c,
420
- parentId: h.parentId,
421
- labelStyle: "",
422
- padding: 0,
423
- // shape: 'rect',
424
- shape: "labelRect",
425
- label: "",
426
- style: "",
427
- width: 10,
428
- height: 10
429
- }), n.setParent(c, h.parentId);
430
- const m = structuredClone(o), b = structuredClone(o), X = structuredClone(o);
431
- m.label = "", m.arrowTypeEnd = "none", m.endLabelLeft = "", m.endLabelRight = "", m.startLabelLeft = "", m.id = l + "-cyclic-special-1", b.startLabelRight = "", b.startLabelLeft = "", b.endLabelLeft = "", b.endLabelRight = "", b.arrowTypeStart = "none", b.arrowTypeEnd = "none", b.id = l + "-cyclic-special-mid", X.label = "", X.startLabelRight = "", X.startLabelLeft = "", X.arrowTypeStart = "none", h.isGroup && (m.fromCluster = l, X.toCluster = l), X.id = l + "-cyclic-special-2", X.arrowTypeStart = "none", n.setEdge(l, u, m, l + "-cyclic-special-0"), n.setEdge(u, c, b, l + "-cyclic-special-1"), n.setEdge(c, l, X, l + "-cyc<lic-special-2");
432
- } else
433
- n.setEdge(o.start, o.end, { ...o }, o.id);
434
- }), i.warn("Graph at first:", JSON.stringify(v(n))), ae(n), i.warn("Graph after XAX:", JSON.stringify(v(n)));
435
- const r = H();
436
- await M(
437
- a,
438
- n,
439
- e.type,
440
- e.diagramId,
441
- void 0,
442
- r
443
- );
444
- }, "render");
445
- export {
446
- ue as render
447
- };
448
- //# sourceMappingURL=dagre-BM42HDAG-BmujNepD.js.map