mulmoclaude 2.4.0 → 2.5.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 (144) hide show
  1. package/README.md +1 -0
  2. package/client/assets/{AllPackages-Dw2RXFr1.js → AllPackages-BEk5YJDm.js} +1 -1
  3. package/client/assets/{BaseConfiguration-D3cG9hNe.js → BaseConfiguration-BNAavVmS.js} +1 -1
  4. package/client/assets/{Element-Cv7I_0yC.js → Element-9N081W6i.js} +1 -1
  5. package/client/assets/{Entities-C8-4eSNA.js → Entities-CStqDzQa.js} +1 -1
  6. package/client/assets/{FunctionList-vF4juMGB.js → FunctionList-BiRbmGuH.js} +1 -1
  7. package/client/assets/{InputJax-DgXeQ-Ah.js → InputJax-BIXwEG13.js} +1 -1
  8. package/client/assets/{JsonEditor-ZvNJuqs_.js → JsonEditor-FKfzzMkt.js} +1 -1
  9. package/client/assets/{MathItem-Detxmt2G.js → MathItem-BGdp9nCn.js} +1 -1
  10. package/client/assets/{MmlFactory-CIQ3138s.js → MmlFactory-BtWqthmC.js} +1 -1
  11. package/client/assets/{Options-DmQY5iBM.js → Options-D4NRwRVE.js} +1 -1
  12. package/client/assets/{OutputJax-CAQGaq8b.js → OutputJax-ClIqqRdT.js} +1 -1
  13. package/client/assets/{PrioritizedList-kZ7_WZX-.js → PrioritizedList-CnJ310Kt.js} +1 -1
  14. package/client/assets/{Styles-B53-i2nc.js → Styles-D3y1lCFc.js} +1 -1
  15. package/client/assets/{TeXAtom-Dwnbvu2N.js → TeXAtom-ZEaqimtW.js} +1 -1
  16. package/client/assets/__vite-browser-external-B2LgiLf-.js +1 -0
  17. package/client/assets/{abnfDiagram-YUKMZFIV-D2izv3tI.js → abnfDiagram-WEYOIA3C-BscsEU67.js} +1 -1
  18. package/client/assets/{arc-Dy-vWwtK.js → arc-Dl4OzSiI.js} +1 -1
  19. package/client/assets/{architectureDiagram-47P4ROYG-BMqz_hfK.js → architectureDiagram-ZHVYKT53-DVrv2QNl.js} +1 -1
  20. package/client/assets/{assistive-mml-BBZjDstH.js → assistive-mml-x7F99dtt.js} +1 -1
  21. package/client/assets/{blockDiagram-E7TT5TSB-BC_6nVzg.js → blockDiagram-RJAE7QA3-CL9VjhIy.js} +1 -1
  22. package/client/assets/{c4Diagram-CRA5TL53-CMlgEq-D.js → c4Diagram-XDPPPE54-ClAuW1Su.js} +1 -1
  23. package/client/assets/channel-C7tbw03E.js +1 -0
  24. package/client/assets/{chunk-AW2ZBBNX-CRAjzqLf.js → chunk-2E7WHVMD-BpfatsVl.js} +1 -1
  25. package/client/assets/{chunk-HTAEGDNF-BpIQa4ai.js → chunk-4EMNKR2T-CNryqYUD.js} +1 -1
  26. package/client/assets/{chunk-7TKQ45FW-BY_vhyym.js → chunk-55XCU76K-CQJx4wsK.js} +1 -1
  27. package/client/assets/{chunk-3YJQHVM4-B_LDijS0.js → chunk-7S6XSTFO-B8TJqaKm.js} +1 -1
  28. package/client/assets/{chunk-E2ZNV5FY-CRk3Pfq3.js → chunk-AQDTSKZB-dUGlA8XM.js} +1 -1
  29. package/client/assets/{chunk-VPRB5NB3-CYQe0pjV.js → chunk-DSNLSHJZ-Bc29O7Kj.js} +2 -2
  30. package/client/assets/chunk-HAGFOTED-SRXWMJmA.js +62 -0
  31. package/client/assets/chunk-HNE4Q36P-XIsiGulF.js +1 -0
  32. package/client/assets/{chunk-EU5HNXII-C7SKkz7x.js → chunk-NQOKRVIF-CNDyB28A.js} +1 -1
  33. package/client/assets/{chunk-4EA7E6EY-DB8ZoOxD.js → chunk-UHW7PFBP-D7z_YIHC.js} +1 -1
  34. package/client/assets/{chunk-KQW6MTUR-CzqgqmsR.js → chunk-VQ5W62QI-CfTNhJXC.js} +1 -1
  35. package/client/assets/chunk-WQQL4CDK--oD9-mIV.js +10 -0
  36. package/client/assets/{chunk-XXDRQBXY-DCiQN07N.js → chunk-XXDRQBXY-BuQ7FvNe.js} +1 -1
  37. package/client/assets/{chunk-HJ2JQQFS-CdiwUyEn.js → chunk-YZO67HFG-CVfUxFvr.js} +1 -1
  38. package/client/assets/{chunk-DBDB3WZW-CfsLqRL8.js → chunk-ZAUX2LTX-DPy60Elv.js} +1 -1
  39. package/client/assets/{chunk-FVRAUYC3-9lHES_Ib.js → chunk-ZCHMQSOR-4NYZgH42.js} +1 -1
  40. package/client/assets/{classDiagram-v2-K4WV4PDN-BNPHLuup.js → classDiagram-v2-4MYWR3UA-lJp1Kd7m.js} +1 -1
  41. package/client/assets/{cose-bilkent-JH36ORCC-dF6741Or.js → cose-bilkent-JH36ORCC-DcDTRz3u.js} +1 -1
  42. package/client/assets/{cynefinDiagram-3GCD6N5R-4XXRJFyl.js → cynefinDiagram-WF24UDRP-QSqrt6_X.js} +1 -1
  43. package/client/assets/{dagre-W4DXFKR2-PkNbgDcl.js → dagre-NK4GIZVX-8E7OP13B.js} +1 -1
  44. package/client/assets/{diagram-OVF4WLC6-Cy-3YXv9.js → diagram-CBK3MWTC-C2JHQxLJ.js} +1 -1
  45. package/client/assets/{diagram-UMYRVEAY-BWotPjlO.js → diagram-I5XIIV2D-xBXWQfqG.js} +1 -1
  46. package/client/assets/{diagram-PFPMY2P6-ckbdhYhd.js → diagram-ODIL2UCW-sA3o0YaV.js} +1 -1
  47. package/client/assets/{diagram-ZIFT7M5P-DIZ_YPN4.js → diagram-PFBEJUXE-Bzk9qOX0.js} +1 -1
  48. package/client/assets/{diagram-YEKJPTXX-Drfsm5Ei.js → diagram-RJA3I4VV-BwqRpVus.js} +1 -1
  49. package/client/assets/{diagram-2UJZ2QOL-D5UsCT69.js → diagram-TYUNFSNR-DOTRQeA3.js} +1 -1
  50. package/client/assets/{dist-DovUe4bX.js → dist-COSwdJCZ.js} +1 -1
  51. package/client/assets/{ebnfDiagram-VR2GEFS7-BZqd1z6D.js → ebnfDiagram-V4P3TTPT-C39RhWYu.js} +1 -1
  52. package/client/assets/elk-QONTBCTQ-dPy-h9Po.js +27 -0
  53. package/client/assets/{erDiagram-O2IAPWRE-B62N9MOe.js → erDiagram-KYQIGQAA-B5Fn1BL_.js} +1 -1
  54. package/client/assets/flowDiagram-IUGLLWBU-sQjDH9CV.js +1 -0
  55. package/client/assets/{ganttDiagram-R7TSEDQI-yzG4IDV2.js → ganttDiagram-R7GPNTJY-DSvw-AAx.js} +1 -1
  56. package/client/assets/{gitGraphDiagram-XJZIOB7I-DKNU3c7Q.js → gitGraphDiagram-PDYL7XHY-DwXIb1T8.js} +1 -1
  57. package/client/assets/{heic2any-B4wtRmxS.js → heic2any-7DJPuAa-.js} +1 -1
  58. package/client/assets/{html-CR7kQNkU.js → html-Ct7pOTau.js} +1 -1
  59. package/client/assets/index-BII5bTJI.css +2 -0
  60. package/client/assets/{index-ijQN8Kty.js → index-CoMmb_Su.js} +2178 -419
  61. package/client/assets/{infoDiagram-5W2HQ5XZ-1fGGWi6i.js → infoDiagram-MVDRKAX5-BP0sp6PG.js} +1 -1
  62. package/client/assets/{ishikawaDiagram-K3B6WC7H-D8UbvNjQ.js → ishikawaDiagram-HPEHV2GE-DkZCnfkB.js} +1 -1
  63. package/client/assets/{journeyDiagram-COXZFDF6-DODfPsn6.js → journeyDiagram-BOSHW7O7-C5lBrmWk.js} +1 -1
  64. package/client/assets/{kanban-definition-P3RFRI5V-C_4kym-D.js → kanban-definition-FNSA4HC5-k1P4cerJ.js} +1 -1
  65. package/client/assets/katex-B940_AAO.js +257 -0
  66. package/client/assets/{lengths-BWBolkW1.js → lengths-DaFrXNkv.js} +1 -1
  67. package/client/assets/{line-CHud_SQT.js → line-DG8MUuK4.js} +1 -1
  68. package/client/assets/{linear-N0xOv4AO.js → linear-QypFZXrA.js} +1 -1
  69. package/client/assets/{liteAdaptor-BcJ0akeI.js → liteAdaptor-Bcghdd_u.js} +1 -1
  70. package/client/assets/{manifold-DUBpAdN8.js → manifold-CyOGI3vv.js} +2 -2
  71. package/client/assets/{marp-DbrRRh1n.js → marp-uBg3qXiP.js} +1 -1
  72. package/client/assets/{mathjax-B2LxS74s.js → mathjax-D7JHkqwo.js} +1 -1
  73. package/client/assets/{mermaid.core-Ck4FoAPC.js → mermaid.core-DGklhdAB.js} +5 -5
  74. package/client/assets/{mindmap-definition-LZFPQGKD-2U3eDZgj.js → mindmap-definition-6OY57UG3-gzS6FyZY.js} +11 -9
  75. package/client/assets/{mo-C-TLAbzI.js → mo-BjiDe2hG.js} +1 -1
  76. package/client/assets/{pegDiagram-BGZESJAR-CPSrx-ye.js → pegDiagram-ECIUJNBX-Cq66EodD.js} +1 -1
  77. package/client/assets/{pieDiagram-CAPJLFHJ-5f_PIyeW.js → pieDiagram-GNMPY74T-xAtnNnqX.js} +1 -1
  78. package/client/assets/purify.es-BXhPiKO5.js +3 -0
  79. package/client/assets/{quadrantDiagram-GDMTTRAM-DtTnwXGk.js → quadrantDiagram-D57K4MC3-Du892PsV.js} +1 -1
  80. package/client/assets/{railroadDiagram-SM67HX2B-D_vgpY1Q.js → railroadDiagram-Y72NRBL7-CKdD2y_X.js} +1 -1
  81. package/client/assets/{requirementDiagram-X7JNWC4A-D73sEQMU.js → requirementDiagram-EQYSW5RA-Bq_GbYUM.js} +1 -1
  82. package/client/assets/{runtime-protocol-vue-CSgbWzhp.js → runtime-protocol-vue-DDgG0sdu.js} +1 -1
  83. package/client/assets/{runtime-vue-vwmCYkQi.js → runtime-vue-D3lOcL9y.js} +1 -1
  84. package/client/assets/{sankeyDiagram-UM26HJRW-D937W4Di.js → sankeyDiagram-SY24JHO5-CfVDH0Xd.js} +1 -1
  85. package/client/assets/{sequenceDiagram-ZO4K6R2Y-CQxSGPhF.js → sequenceDiagram-BLEHNHQU-BfLzBJr6.js} +1 -1
  86. package/client/assets/{src-tZFcq4Tp.js → src-BgGykKNK.js} +1 -1
  87. package/client/assets/{stateDiagram-v2-TBUQTH76-Dh3_ywoS.js → stateDiagram-v2-A6IESKWZ-Drw4P5gp.js} +1 -1
  88. package/client/assets/{svg-DmHVKe1q.js → svg-Cqon0dX1.js} +1 -1
  89. package/client/assets/swimlanes-B3ENRKFQ-BQFHcOaN.js +1 -0
  90. package/client/assets/swimlanesDiagram-AYQRV4AK-BCeSnUvS.js +8 -0
  91. package/client/assets/{tex-ClbW-kMH.js → tex-CPHJ5d-t.js} +1 -1
  92. package/client/assets/{timeline-definition-YOQAKGHF-CLrIBvH8.js → timeline-definition-JXYKGLGB-DKG-sSoZ.js} +1 -1
  93. package/client/assets/{usecaseDiagram-VIAY4XPW-E2sLzIvc.js → usecaseDiagram-WPOLBNNX-6b-VgS7o.js} +1 -1
  94. package/client/assets/{vennDiagram-BLWOH2XV-DRtM4O4i.js → vennDiagram-Q3Y3IDCW-DWz364sx.js} +1 -1
  95. package/client/assets/{vue-i18n-BbRMUmOW.js → vue-i18n-2bgWpywp.js} +1 -1
  96. package/client/assets/{vue-C_VSdwOG.js → vue-imO0VoyF.js} +1 -1
  97. package/client/assets/vue.runtime.esm-bundler-Cwm3cFXF.js +5 -0
  98. package/client/assets/{wardleyDiagram-YMQ3BMBF-CK584zEb.js → wardleyDiagram-IVAIDKWA-C43sB-35.js} +1 -1
  99. package/client/assets/{xychartDiagram-TAQBALBS-D47LTZYZ.js → xychartDiagram-4URNHDU4-D-n9TuYW.js} +1 -1
  100. package/client/index.html +9 -9
  101. package/package.json +8 -7
  102. package/server/agent/index.ts +5 -3
  103. package/server/agent/prompt.ts +6 -3
  104. package/server/agent/promptWorkspacePaths.ts +12 -0
  105. package/server/build/mcp-server.mjs +622 -620
  106. package/server/index.ts +7 -22
  107. package/server/prompts/system/system.md +1 -2
  108. package/server/workspace/journal/index.ts +3 -0
  109. package/server/workspace/journal/memoryExtractor.ts +6 -0
  110. package/server/workspace/memory/legacy-fold.ts +34 -0
  111. package/server/workspace/memory/legacy-migration-gate.ts +27 -0
  112. package/server/workspace/memory/llm-classifier.ts +4 -22
  113. package/server/workspace/memory/migrate.ts +52 -21
  114. package/server/workspace/memory/run.ts +32 -28
  115. package/server/workspace/memory/seed-topic-layout-run.ts +50 -0
  116. package/server/workspace/memory/seed-topic-layout.ts +34 -0
  117. package/server/workspace/memory/startup.ts +29 -0
  118. package/server/workspace/memory/topic-migrate.ts +78 -9
  119. package/server/workspace/memory/topic-run.ts +14 -9
  120. package/server/workspace/memory/topic-swap.ts +4 -6
  121. package/server/workspace/workspace.ts +4 -7
  122. package/src/config/systemFileDescriptors.ts +1 -1
  123. package/src/lang/de.ts +5 -4
  124. package/src/lang/en.ts +5 -4
  125. package/src/lang/es.ts +5 -4
  126. package/src/lang/fr.ts +5 -4
  127. package/src/lang/ja.ts +6 -4
  128. package/src/lang/ko.ts +6 -4
  129. package/src/lang/pt-BR.ts +5 -4
  130. package/src/lang/zh.ts +6 -4
  131. package/client/assets/__vite-browser-external-0OnNcCAs.js +0 -1
  132. package/client/assets/channel-D5MgCXLU.js +0 -1
  133. package/client/assets/chunk-2BW5OAIV-BmsIcsho.js +0 -10
  134. package/client/assets/chunk-NTY3LDVX-DJFUMgKq.js +0 -1
  135. package/client/assets/chunk-XC4XBNZT-Crw0ZTTY.js +0 -62
  136. package/client/assets/elk-IJKZMXRS-CU7dBhBG.js +0 -27
  137. package/client/assets/flowDiagram-OXPTDLAJ-BWPfh4Ws.js +0 -1
  138. package/client/assets/index-Da2v4SOh.css +0 -2
  139. package/client/assets/katex-DJhrJSbw.js +0 -257
  140. package/client/assets/purify.es-B0LuI4JX.js +0 -3
  141. package/client/assets/swimlanes-N4OXWK64-CzBA2aUH.js +0 -1
  142. package/client/assets/swimlanesDiagram-K3J5GTZL-DpGZyRA0.js +0 -8
  143. package/client/assets/vue.runtime.esm-bundler-C6akXk9q.js +0 -5
  144. package/server/workspace/billing-migration.ts +0 -69
@@ -3,8 +3,8 @@
3
3
  // Reads the existing #1029-style atomic entries from
4
4
  // `conversations/memory/`, runs a clusterer, and writes the
5
5
  // proposed topic layout to a STAGING dir
6
- // `conversations/memory.next/`. Does NOT swap. The user runs
7
- // `topic-swap.ts` after reviewing.
6
+ // `conversations/memory.next/`. Does NOT swap — `runTopicMigrationOnce`
7
+ // does that right after. A cluster that dropped bullets is never staged.
8
8
  //
9
9
  // Library only — `runTopicMigrationOnce` (in PR-B) decides when
10
10
  // to call this from server startup.
@@ -13,13 +13,16 @@
13
13
  // the one-shot atomic → topic migration chain and goes when the
14
14
  // chain goes.
15
15
 
16
- import { mkdir, rm } from "node:fs/promises";
16
+ import { mkdir, readdir, rm } from "node:fs/promises";
17
17
  import path from "node:path";
18
18
 
19
19
  import { writeFileAtomic } from "../../utils/files/atomic.js";
20
+ import { readTextSafe } from "../../utils/files/safe.js";
20
21
  import { log } from "../../system/logger/index.js";
21
22
  import { errorMessage } from "../../utils/errors.js";
22
- import { WORKSPACE_DIRS } from "../paths.js";
23
+ import { WORKSPACE_DIRS, WORKSPACE_FILES } from "../paths.js";
24
+ import { parseCandidates } from "./migrate.js";
25
+ import { legacyFoldEntries } from "./legacy-fold.js";
23
26
  import { loadAllMemoryEntries } from "./io.js";
24
27
  import { MEMORY_TYPES, type MemoryEntry, type MemoryType } from "./types.js";
25
28
  import type { ClusterMap, ClusterTopic, MemoryClusterer } from "./topic-cluster.js";
@@ -42,6 +45,38 @@ export function topicStagingPath(workspaceRoot: string): string {
42
45
  return path.join(workspaceRoot, WORKSPACE_DIRS.memoryStaging);
43
46
  }
44
47
 
48
+ // Written last, so its presence means every topic file was staged.
49
+ const STAGING_INDEX_FILE = "MEMORY.md";
50
+
51
+ export function stagingIndexPath(stagingPath: string): string {
52
+ return path.join(stagingPath, STAGING_INDEX_FILE);
53
+ }
54
+
55
+ async function countBulletLines(file: string): Promise<number> {
56
+ const text = await readTextSafe(file);
57
+ return text === null ? 0 : text.split("\n").filter((line) => line.startsWith("- ")).length;
58
+ }
59
+
60
+ async function countStagedBullets(stagingPath: string): Promise<number> {
61
+ const perType = await Promise.all(
62
+ MEMORY_TYPES.map(async (type) => {
63
+ const dir = path.join(stagingPath, type);
64
+ const names = await readdir(dir).catch(() => []);
65
+ const counts = await Promise.all(names.filter((name) => name.endsWith(".md")).map((name) => countBulletLines(path.join(dir, name))));
66
+ return counts.reduce((total, count) => total + count, 0);
67
+ }),
68
+ );
69
+ return perType.reduce((total, count) => total + count, 0);
70
+ }
71
+
72
+ /** A leftover staging may be swapped only if it was fully written (index present) and holds a bullet for every
73
+ * input the cluster would take (`countClusterInput`) — the index alone is not enough, because builds before #3458
74
+ * indexed lossy stagings too, and builds before #3460 did not stage leftover `memory.md` bullets. */
75
+ export async function isStagingSwappable(stagingPath: string, requiredBulletCount: number): Promise<boolean> {
76
+ if ((await readTextSafe(stagingIndexPath(stagingPath))) === null) return false;
77
+ return (await countStagedBullets(stagingPath)) >= requiredBulletCount;
78
+ }
79
+
45
80
  interface WrittenTopic {
46
81
  type: MemoryType;
47
82
  topic: ClusterTopic;
@@ -51,29 +86,63 @@ interface WrittenTopic {
51
86
  }
52
87
 
53
88
  export async function clusterAtomicIntoStaging(workspaceRoot: string, clusterer: MemoryClusterer): Promise<TopicMigrationResult> {
54
- const entries = await loadAllMemoryEntries(workspaceRoot);
89
+ const { atomicEntries, foldedEntries } = await loadClusterInput(workspaceRoot);
55
90
  const stagingPath = topicStagingPath(workspaceRoot);
56
- if (entries.length === 0) return emptyResult(stagingPath);
57
- log.info("memory", "topic-migrate: clustering", { entryCount: entries.length });
91
+ if (atomicEntries.length === 0) return emptyResult(stagingPath);
92
+ const entries = [...atomicEntries, ...foldedEntries];
93
+ log.info("memory", "topic-migrate: clustering", { entryCount: entries.length, foldedFromMemoryMd: foldedEntries.length });
58
94
 
59
95
  const map = await runClustererOrCleanup(entries, stagingPath, clusterer);
60
96
  if (!map) return { ...emptyResult(stagingPath), inputCount: entries.length };
97
+ // Checked before anything is written: a lossy staging left by a crash would be promoted by the retry-swap path.
98
+ const bulletsLost = countBulletsLost(entries, map);
99
+ if (bulletsLost > 0) {
100
+ log.warn("memory", "topic-migrate: cluster dropped bullets, not staging it; the atomic layout stays", { bulletsLost });
101
+ await rm(stagingPath, { recursive: true, force: true });
102
+ return { ...emptyResult(stagingPath), inputCount: entries.length, bulletsLost };
103
+ }
61
104
 
62
105
  const topicCounts: Record<MemoryType, number> = { preference: 0, interest: 0, fact: 0, reference: 0 };
63
106
  const written = await writeTopicsToStaging(stagingPath, map, topicCounts);
107
+ const topicsInCluster = MEMORY_TYPES.reduce((total, type) => total + map[type].length, 0);
108
+ if (written.length < topicsInCluster) {
109
+ // The index marks a staging complete for the retry-swap path, so a partial tree must not get one.
110
+ log.warn("memory", "topic-migrate: some topic files failed to stage, discarding the staging", { written: written.length, topicsInCluster });
111
+ await rm(stagingPath, { recursive: true, force: true });
112
+ return { ...emptyResult(stagingPath), inputCount: entries.length };
113
+ }
64
114
  await writeStagingIndex(stagingPath, written);
65
115
 
66
116
  const result: TopicMigrationResult = {
67
117
  noop: false,
68
118
  inputCount: entries.length,
69
119
  topicCounts,
70
- bulletsLost: countBulletsLost(entries, map),
120
+ bulletsLost,
71
121
  stagingPath,
72
122
  };
73
123
  log.info("memory", "topic-migrate: staging ready", { stagingPath, topicCounts, bulletsLost: result.bulletsLost });
74
124
  return result;
75
125
  }
76
126
 
127
+ interface ClusterInput {
128
+ atomicEntries: MemoryEntry[];
129
+ /** Bullets from a leftover `memory.md` that the cluster must also place (#3460). */
130
+ foldedEntries: MemoryEntry[];
131
+ }
132
+
133
+ async function loadClusterInput(workspaceRoot: string): Promise<ClusterInput> {
134
+ const atomicEntries = await loadAllMemoryEntries(workspaceRoot);
135
+ const legacyText = await readTextSafe(path.join(workspaceRoot, WORKSPACE_FILES.memory));
136
+ const foldedEntries = legacyText === null ? [] : legacyFoldEntries(parseCandidates(legacyText), atomicEntries);
137
+ return { atomicEntries, foldedEntries };
138
+ }
139
+
140
+ /** How many bullets a staging must hold to cover this workspace's memory — the same input the cluster takes. */
141
+ export async function countClusterInput(workspaceRoot: string): Promise<number> {
142
+ const { atomicEntries, foldedEntries } = await loadClusterInput(workspaceRoot);
143
+ return atomicEntries.length + foldedEntries.length;
144
+ }
145
+
77
146
  // Wipe stale staging BEFORE the cluster call. If the clusterer
78
147
  // returns null or throws, we leave the workspace with no staging
79
148
  // dir at all — that's the correct "migration didn't complete"
@@ -233,7 +302,7 @@ async function writeStagingIndex(stagingPath: string, written: WrittenTopic[]):
233
302
  if (written.length === 0) {
234
303
  lines.push("_(no entries yet)_", "");
235
304
  }
236
- await writeFileAtomic(path.join(stagingPath, "MEMORY.md"), lines.join("\n"), { uniqueTmp: true });
305
+ await writeFileAtomic(stagingIndexPath(stagingPath), lines.join("\n"), { uniqueTmp: true });
237
306
  }
238
307
 
239
308
  function formatStagingIndexLine(entry: WrittenTopic): string {
@@ -27,13 +27,15 @@
27
27
  // `topic-detect.ts` — minus the atomic-format branch) stays.
28
28
 
29
29
  import { existsSync, statSync } from "node:fs";
30
+ import { rm } from "node:fs/promises";
30
31
  import path from "node:path";
31
32
 
32
33
  import { runClaudeCli, ClaudeCliNotFoundError, type Summarize } from "../journal/archivist-cli.js";
33
34
  import { WORKSPACE_DIRS, WORKSPACE_FILES } from "../paths.js";
35
+ import { LEGACY_MEMORY_PLACEHOLDER_MAX_BYTES } from "./legacy-migration-gate.js";
34
36
  import { loadAllMemoryEntries } from "./io.js";
35
37
  import { makeLlmMemoryClusterer, type MemoryClusterer } from "./topic-cluster.js";
36
- import { clusterAtomicIntoStaging, topicStagingPath } from "./topic-migrate.js";
38
+ import { clusterAtomicIntoStaging, countClusterInput, isStagingSwappable, topicStagingPath } from "./topic-migrate.js";
37
39
  import { swapStagingIntoMemory } from "./topic-swap.js";
38
40
  import { MEMORY_TYPES } from "./types.js";
39
41
  import { errorMessage } from "../../utils/errors.js";
@@ -71,14 +73,17 @@ export async function runTopicMigrationOnce(workspaceRoot: string, deps: RunTopi
71
73
  return;
72
74
  }
73
75
  const stagingPath = topicStagingPath(workspaceRoot);
74
- // If staging is left over from a prior run that crashed between
75
- // cluster and swap, just retry the swap. Re-clustering would burn
76
- // another LLM call and (because clusterAtomicIntoStaging wipes
77
- // staging up front) discard the prior cluster result.
76
+ // A complete staging left by a crash between cluster and swap is swapped without another LLM call. An
77
+ // incomplete one (crash during the cluster call or mid-write) would replace memory/ with a partial tree, so it
78
+ // is discarded and the cluster runs again below.
78
79
  if (existsSync(stagingPath)) {
79
- log.info("memory", "topic-run: existing staging detected, retrying swap", { stagingPath });
80
- await runSwap(workspaceRoot);
81
- return;
80
+ if (await isStagingSwappable(stagingPath, await countClusterInput(workspaceRoot))) {
81
+ log.info("memory", "topic-run: existing staging detected, retrying swap", { stagingPath });
82
+ await runSwap(workspaceRoot);
83
+ return;
84
+ }
85
+ log.warn("memory", "topic-run: discarding an incomplete or lossy staging from an interrupted run", { stagingPath });
86
+ await rm(stagingPath, { recursive: true, force: true });
82
87
  }
83
88
  if (shouldDeferForLegacyMigration(workspaceRoot)) return;
84
89
 
@@ -119,7 +124,7 @@ function shouldDeferForLegacyMigration(workspaceRoot: string): boolean {
119
124
  } catch {
120
125
  legacyStat = null;
121
126
  }
122
- if (legacyStat && legacyStat.size >= 64 && !existsSync(`${legacyPath}.backup`)) {
127
+ if (legacyStat && legacyStat.size >= LEGACY_MEMORY_PLACEHOLDER_MAX_BYTES && !existsSync(`${legacyPath}.backup`)) {
123
128
  log.debug("memory", "topic-run: legacy memory.md still in flight, deferring", { legacyPath });
124
129
  return true;
125
130
  }
@@ -1,10 +1,8 @@
1
- // Swap `conversations/memory/` ↔ `conversations/memory.next/`
2
- // after the user has approved the staging diff (#1070 PR-A).
1
+ // Swap `conversations/memory/` ↔ `conversations/memory.next/` (#1070 PR-A).
3
2
  //
4
- // Library only — invoked from a CLI helper or the agent (a tool
5
- // surface for the agent will land later). The swap is intentionally
6
- // NOT auto-run: the whole point of staging is to give the user a
7
- // chance to inspect.
3
+ // Run automatically by `runTopicMigrationOnce` right after staging,
4
+ // (a cluster that dropped bullets is never staged, so the workspace stays
5
+ // atomic). `yarn memory:swap` runs it by hand.
8
6
  //
9
7
  // CLEANUP 2026-07-01: see `topic-run.ts` — this file is part of
10
8
  // the one-shot atomic → topic migration chain and goes when the
@@ -5,6 +5,7 @@ import { log } from "../system/logger/index.js";
5
5
  import { EAGER_WORKSPACE_DIRS, WORKSPACE_PATHS, workspacePath } from "./paths.js";
6
6
  import { readWorkspaceTextSync, writeWorkspaceTextSync } from "../utils/files/workspace-io.js";
7
7
  import { loadCustomDirs, ensureCustomDirs } from "./custom-dirs.js";
8
+ import { seedTopicLayoutIfFresh } from "./memory/seed-topic-layout-run.js";
8
9
  // Helps + preset skills + their sync logic now live in @mulmoclaude/core/workspace-setup
9
10
  // (shared with MulmoTerminal); the bundled source dirs come from the package.
10
11
  import { seedHelps, presetSkillsAssetDir, syncActivePresetSkills, syncPresetSkills } from "@mulmoclaude/core/workspace-setup";
@@ -23,14 +24,10 @@ export function initWorkspace(): string {
23
24
  mkdirSync(WORKSPACE_PATHS[key], { recursive: true });
24
25
  }
25
26
 
26
- // Ensure the typed-memory directory exists (#1029). Individual
27
- // entry files are written by the agent or by the legacy-memory
28
- // migration; init just guarantees the directory is there so the
29
- // reader and migration both have a place to write to. The legacy
30
- // `conversations/memory.md` is no longer auto-created — migration
31
- // converts it on first start and the new layout becomes the source
32
- // of truth thereafter.
27
+ // Ensure the memory directory exists. A workspace with no memory to lose starts directly in the
28
+ // topic layout (#1070); one that has any goes through the boot-time migration chain instead.
33
29
  mkdirSync(WORKSPACE_PATHS.memoryDir, { recursive: true });
30
+ if (seedTopicLayoutIfFresh(workspacePath)) log.info("memory", "new workspace: starting in the topic memory layout");
34
31
 
35
32
  // Always sync the bundled help docs into workspace/helps/.
36
33
  seedHelps({ destDir: WORKSPACE_PATHS.helps });
@@ -55,7 +55,7 @@ export const SYSTEM_FILE_DESCRIPTORS: readonly Entry[] = [
55
55
  {
56
56
  kind: "exact",
57
57
  path: "config/scheduler/overrides.json",
58
- descriptor: { id: "schedulerOverrides", schemaRef: "server/utils/files/scheduler-io.ts", editPolicy: "agent-managed" },
58
+ descriptor: { id: "schedulerOverrides", schemaRef: "server/utils/files/scheduler-overrides-io.ts", editPolicy: "agent-managed" },
59
59
  },
60
60
  // ── data/ ──
61
61
  {
package/src/lang/de.ts CHANGED
@@ -612,8 +612,9 @@ const deMessages = {
612
612
  "Pro-Aufgabe Zeit-/Intervall-Überschreibungen über dem Systemzeitplan. Der Agent bearbeitet dies, wenn du den Zeitpunkt einer wiederkehrenden Aufgabe änderst.",
613
613
  },
614
614
  schedulerItems: {
615
- title: "Scheduler-Item-Warteschlange",
616
- summary: "Geplante Aufrufe, die zur Auslösung bereitstehen. Agent-verwaltet; nicht von Hand bearbeiten, ohne jedes Feld zu verstehen.",
615
+ title: "Alte Kalendereinträge",
616
+ summary:
617
+ "Einträge aus der entfernten Kalenderansicht. Die App zeigt sie nicht mehr an, und nichts führt sie nach Zeitplan aus; nur die alten /api/scheduler-Aktionen lesen und schreiben diese Datei noch. Geplante Aufgaben liegen in config/scheduler/tasks.json.",
617
618
  },
618
619
  wikiIndex: {
619
620
  title: "Wiki-Index",
@@ -635,9 +636,9 @@ const deMessages = {
635
636
  "Formatspezifikation, die der Agent liest, um Wiki-Seiten konsistent zu halten. Empfindlich — eine bestimmte Struktur wird erwartet; bevorzuge Agent-getriebene Bearbeitung.",
636
637
  },
637
638
  memory: {
638
- title: "Memory",
639
+ title: "Memory (alte Datei)",
639
640
  summary:
640
- "Destillierte Fakten über dich, immer als Kontext für neue Gespräche geladen. Der Journal-Extraktor hängt automatisch an; manuelle Bearbeitung ebenfalls möglich.",
641
+ "Das ältere Ein-Datei-Gedächtnis. Nur Arbeitsbereiche im älteren Format lesen es; aktuelle Arbeitsbereiche speichern Fakten als Themendateien unter conversations/memory/<type>/<topic>.md und ignorieren diese Datei, Änderungen hier wirken dort also nicht.",
641
642
  },
642
643
  summariesIndex: {
643
644
  title: "Zusammenfassungs-Index",
package/src/lang/en.ts CHANGED
@@ -629,8 +629,9 @@ const enMessages = {
629
629
  "Per-task time / interval overrides applied on top of the system schedule. The agent edits this when you ask to change a recurring task's timing.",
630
630
  },
631
631
  schedulerItems: {
632
- title: "Scheduler items queue",
633
- summary: "Active scheduled invocations ready to fire. Agent-managed; do not hand-edit unless you know exactly what each field means.",
632
+ title: "Legacy calendar items",
633
+ summary:
634
+ "Calendar items from the removed Calendar view. The app no longer shows them and nothing runs them on a schedule; only the legacy /api/scheduler actions still read and write this file. Scheduled tasks live in config/scheduler/tasks.json.",
634
635
  },
635
636
  wikiIndex: {
636
637
  title: "Wiki index",
@@ -649,9 +650,9 @@ const enMessages = {
649
650
  summary: "The format spec the agent reads to keep wiki pages consistent. Fragile — the agent expects a specific structure, so prefer agent-driven edits.",
650
651
  },
651
652
  memory: {
652
- title: "Memory",
653
+ title: "Memory (legacy file)",
653
654
  summary:
654
- "Distilled facts about you, always loaded as context for new conversations. The journal extractor appends here automatically; you can also hand-edit.",
655
+ "The older single-file memory. Only workspaces still on the older memory format read it; current workspaces keep facts as topic files under conversations/memory/<type>/<topic>.md and ignore this file, so editing it has no effect there.",
655
656
  },
656
657
  summariesIndex: {
657
658
  title: "Summaries index",
package/src/lang/es.ts CHANGED
@@ -612,8 +612,9 @@ const esMessages = {
612
612
  "Sobrescrituras de hora / intervalo por tarea aplicadas sobre el horario del sistema. El agente las edita cuando pides cambiar la franja de una tarea recurrente.",
613
613
  },
614
614
  schedulerItems: {
615
- title: "Cola de elementos del programador",
616
- summary: "Invocaciones programadas listas para dispararse. Gestionado por el agente; no edites a mano salvo que entiendas cada campo.",
615
+ title: "Elementos de calendario antiguos",
616
+ summary:
617
+ "Elementos de la vista de Calendario eliminada. La app ya no los muestra y nada los ejecuta según una programación; solo las acciones antiguas de /api/scheduler siguen leyendo y escribiendo este archivo. Las tareas programadas están en config/scheduler/tasks.json.",
617
618
  },
618
619
  wikiIndex: {
619
620
  title: "Índice de la wiki",
@@ -633,9 +634,9 @@ const esMessages = {
633
634
  "Especificación de formato que el agente lee para mantener las páginas consistentes. Frágil — espera una estructura concreta; prefiere ediciones del agente.",
634
635
  },
635
636
  memory: {
636
- title: "Memoria",
637
+ title: "Memoria (archivo antiguo)",
637
638
  summary:
638
- "Hechos destilados sobre ti, cargados siempre como contexto en conversaciones nuevas. El extractor del journal añade automáticamente; también puedes editar a mano.",
639
+ "La memoria antigua de un solo archivo. Solo la leen los espacios de trabajo con el formato antiguo; los actuales guardan los hechos como archivos de tema en conversations/memory/<type>/<topic>.md e ignoran este archivo, así que editarlo no tiene efecto en ellos.",
639
640
  },
640
641
  summariesIndex: {
641
642
  title: "Índice de resúmenes",
package/src/lang/fr.ts CHANGED
@@ -607,8 +607,9 @@ const frMessages = {
607
607
  "Surcharges horaires / d'intervalle par tâche appliquées au-dessus du planning système. L'agent édite ce fichier quand vous demandez à changer l'horaire d'une tâche récurrente.",
608
608
  },
609
609
  schedulerItems: {
610
- title: "File d'éléments du planificateur",
611
- summary: "Invocations planifiées prêtes à se déclencher. Géré par l'agent ; n'éditez pas à la main sans comprendre chaque champ.",
610
+ title: "Anciens éléments de calendrier",
611
+ summary:
612
+ "Éléments de la vue Calendrier supprimée. L'application ne les affiche plus et rien ne les exécute selon un planning ; seules les anciennes actions /api/scheduler lisent et écrivent encore ce fichier. Les tâches planifiées se trouvent dans config/scheduler/tasks.json.",
612
613
  },
613
614
  wikiIndex: {
614
615
  title: "Index du wiki",
@@ -628,9 +629,9 @@ const frMessages = {
628
629
  "Spécification de format que l'agent lit pour garder les pages du wiki cohérentes. Fragile — il attend une structure précise ; préférez les éditions via l'agent.",
629
630
  },
630
631
  memory: {
631
- title: "Mémoire",
632
+ title: "Mémoire (ancien fichier)",
632
633
  summary:
633
- "Faits distillés à votre sujet, toujours chargés comme contexte pour les nouvelles conversations. L'extracteur du journal y ajoute automatiquement ; vous pouvez aussi éditer à la main.",
634
+ "L'ancienne mémoire en un seul fichier. Seuls les espaces de travail encore à l'ancien format la lisent ; les espaces actuels stockent les faits dans des fichiers de sujet sous conversations/memory/<type>/<topic>.md et ignorent ce fichier, donc le modifier n'a pas d'effet pour eux.",
634
635
  },
635
636
  summariesIndex: {
636
637
  title: "Index des résumés",
package/src/lang/ja.ts CHANGED
@@ -603,8 +603,9 @@ const jaMessages = {
603
603
  summary: "システム既定スケジュールに上書きするタスクごとの時刻 / 間隔の上書き。会話で「このタスクの時刻を変えて」と頼むとエージェントが書き換えます。",
604
604
  },
605
605
  schedulerItems: {
606
- title: "スケジューラアイテムキュー",
607
- summary: "発火待ちの予約済み実行キュー。エージェント管理 — 各フィールドの意味を理解していなければ手動編集しないでください。",
606
+ title: "旧カレンダー項目",
607
+ summary:
608
+ "削除済みのカレンダー画面の項目。アプリには表示されず、予定どおりに実行されることもありません。このファイルを読み書きするのは旧来の /api/scheduler の操作だけです。予定タスクは config/scheduler/tasks.json にあります。",
608
609
  },
609
610
  wikiIndex: {
610
611
  title: "Wiki インデックス",
@@ -623,8 +624,9 @@ const jaMessages = {
623
624
  summary: "Wiki ページの一貫性を保つためにエージェントが参照する書式仕様。壊れやすい — 特定の構造を期待するため、エージェント主導の編集を推奨します。",
624
625
  },
625
626
  memory: {
626
- title: "メモリ",
627
- summary: "新しい会話のコンテキストとして常に読み込まれる、あなたに関する蒸留された事実。journal の抽出器が自動追記し、手動編集も可能です。",
627
+ title: "メモリ(旧ファイル)",
628
+ summary:
629
+ "以前の 1 ファイル形式のメモリ。旧形式のワークスペースだけが読み込みます。現在のワークスペースは事実を conversations/memory/<type>/<topic>.md の topic ファイルに保存し、このファイルは読まないため、編集しても反映されません。",
628
630
  },
629
631
  summariesIndex: {
630
632
  title: "サマリインデックス",
package/src/lang/ko.ts CHANGED
@@ -601,8 +601,9 @@ const koMessages = {
601
601
  summary: "시스템 기본 일정 위에 덮어쓰는 작업별 시간 / 간격 오버라이드. 반복 작업 시간을 변경해 달라고 요청하면 에이전트가 여기에 기록합니다.",
602
602
  },
603
603
  schedulerItems: {
604
- title: "스케줄러 아이템 큐",
605
- summary: "발화 대기 중인 예약 호출 큐. 에이전트 관리 — 각 필드의 의미를 정확히 알지 않으면 수동 편집하지 마세요.",
604
+ title: "이전 캘린더 항목",
605
+ summary:
606
+ "삭제된 캘린더 화면의 항목입니다. 앱에 표시되지 않으며 일정에 따라 실행되지도 않습니다. 이 파일을 읽고 쓰는 것은 이전 /api/scheduler 작업뿐입니다. 예약 작업은 config/scheduler/tasks.json에 있습니다.",
606
607
  },
607
608
  wikiIndex: {
608
609
  title: "위키 인덱스",
@@ -621,8 +622,9 @@ const koMessages = {
621
622
  summary: "에이전트가 위키 페이지 일관성을 유지하기 위해 참조하는 형식 명세. 취약 — 특정 구조를 기대하므로 에이전트 주도 편집을 권장합니다.",
622
623
  },
623
624
  memory: {
624
- title: "메모리",
625
- summary: "당신에 관한 정제된 사실로, 새 대화의 컨텍스트로 항상 로드됩니다. journal 추출기가 자동으로 추가하며 수동 편집도 가능합니다.",
625
+ title: "메모리(이전 파일)",
626
+ summary:
627
+ "예전의 단일 파일 메모리입니다. 이전 형식의 워크스페이스만 읽습니다. 현재 워크스페이스는 사실을 conversations/memory/<type>/<topic>.md 토픽 파일에 저장하고 이 파일은 읽지 않으므로, 편집해도 반영되지 않습니다.",
626
628
  },
627
629
  summariesIndex: {
628
630
  title: "요약 인덱스",
package/src/lang/pt-BR.ts CHANGED
@@ -602,8 +602,9 @@ const ptBRMessages = {
602
602
  "Sobrescritas por tarefa de horário / intervalo aplicadas sobre o agendamento do sistema. O agente edita quando você pede para mudar o horário de uma tarefa.",
603
603
  },
604
604
  schedulerItems: {
605
- title: "Fila de itens do agendador",
606
- summary: "Invocações agendadas prontas para disparar. Gerenciado pelo agente; não edite manualmente sem entender cada campo.",
605
+ title: "Itens de calendário antigos",
606
+ summary:
607
+ "Itens da visualização de Calendário removida. O app não os mostra mais e nada os executa por agendamento; só as ações antigas de /api/scheduler ainda leem e gravam este arquivo. As tarefas agendadas ficam em config/scheduler/tasks.json.",
607
608
  },
608
609
  wikiIndex: {
609
610
  title: "Índice da wiki",
@@ -623,9 +624,9 @@ const ptBRMessages = {
623
624
  "Especificação de formato que o agente lê para manter as páginas da wiki consistentes. Frágil — espera uma estrutura específica; prefira edições via agente.",
624
625
  },
625
626
  memory: {
626
- title: "Memória",
627
+ title: "Memória (arquivo antigo)",
627
628
  summary:
628
- "Fatos destilados sobre você, sempre carregados como contexto em novas conversas. O extrator do journal adiciona automaticamente; você também pode editar manualmente.",
629
+ "A memória antiga em um único arquivo. Só os espaços de trabalho no formato antigo a leem; os atuais guardam os fatos como arquivos de tópico em conversations/memory/<type>/<topic>.md e ignoram este arquivo, então editá-lo não tem efeito neles.",
629
630
  },
630
631
  summariesIndex: {
631
632
  title: "Índice de resumos",
package/src/lang/zh.ts CHANGED
@@ -589,8 +589,9 @@ const zhMessages = {
589
589
  summary: "在系统调度之上叠加的每任务时间 / 间隔覆盖。当你要求修改某个定期任务的时间时,代理会写入此文件。",
590
590
  },
591
591
  schedulerItems: {
592
- title: "调度器条目队列",
593
- summary: "等待触发的预定调用队列。代理管理;除非你清楚每个字段的含义,否则不要手动编辑。",
592
+ title: "旧日历条目",
593
+ summary:
594
+ "已删除的日历视图中的条目。应用不再显示它们,也不会按计划执行它们;只有旧的 /api/scheduler 操作仍会读写此文件。计划任务位于 config/scheduler/tasks.json。",
594
595
  },
595
596
  wikiIndex: {
596
597
  title: "Wiki 索引",
@@ -609,8 +610,9 @@ const zhMessages = {
609
610
  summary: "代理用于保持 Wiki 页面一致性的格式规范。脆弱 — 代理期望特定结构,建议交由代理编辑。",
610
611
  },
611
612
  memory: {
612
- title: "记忆",
613
- summary: "关于你的精炼事实,作为新对话的上下文始终加载。journal 提取器会自动追加,也可手动编辑。",
613
+ title: "记忆(旧文件)",
614
+ summary:
615
+ "旧的单文件记忆。只有仍使用旧格式的工作区会读取它;当前工作区把事实保存为 conversations/memory/<type>/<topic>.md 下的主题文件,并忽略此文件,因此编辑它不会生效。",
614
616
  },
615
617
  summariesIndex: {
616
618
  title: "总结索引",
@@ -1 +0,0 @@
1
- import{Pr as e}from"./vue.runtime.esm-bundler-C6akXk9q.js";var t=e(((e,t)=>{t.exports={}}));export{t};
@@ -1 +0,0 @@
1
- import{at as e,ot as t}from"./chunk-VPRB5NB3-CYQe0pjV.js";var n=(n,r)=>t.lang.round(e.parse(n)[r]);export{n as t};
@@ -1,10 +0,0 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-tZFcq4Tp.js";import{b as r,w as i,y as a}from"./chunk-VPRB5NB3-CYQe0pjV.js";import{$ as o,J as s,Q as c,X as l,Y as u,Z as d,_ as f,d as p,et as m,it as h,nt as g,q as _,rt as v,tt as y}from"./chunk-3YJQHVM4-B_LDijS0.js";import{t as b}from"./line-CHud_SQT.js";import{n as x,r as S}from"./chunk-E2ZNV5FY-CRk3Pfq3.js";import{i as C,n as ee}from"./chunk-4EA7E6EY-DB8ZoOxD.js";import{t as te}from"./rough.esm-Dy-Kn_BL.js";import{t as w}from"./chunk-XC4XBNZT-Crw0ZTTY.js";import{n as T}from"./chunk-DBDB3WZW-CfsLqRL8.js";var E=e((e,t)=>{if(t)return`translate(`+-e.width/2+`, `+-e.height/2+`)`;let n=e.x??0,r=e.y??0;return`translate(`+-(n+e.width/2)+`, `+-(r+e.height/2)+`)`},`computeLabelTransform`),D={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},O={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function k(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=A(e),t=A(t);let[n,r]=[e.x,e.y],[i,a]=[t.x,t.y],o=i-n,s=a-r;return{angle:Math.atan(s/o),deltaX:o,deltaY:s}}e(k,`calculateDeltaAndAngle`);var A=e(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,`pointTransformer`),ne=e(t=>({x:e(function(e,n,r){let i=0,a=A(r[0]).x<A(r[r.length-1]).x?`left`:`right`;if(n===0&&Object.hasOwn(D,t.arrowTypeStart)){let{angle:e,deltaX:n}=k(r[0],r[1]);i=D[t.arrowTypeStart]*Math.cos(e)*(n>=0?1:-1)}else if(n===r.length-1&&Object.hasOwn(D,t.arrowTypeEnd)){let{angle:e,deltaX:n}=k(r[r.length-1],r[r.length-2]);i=D[t.arrowTypeEnd]*Math.cos(e)*(n>=0?1:-1)}let o=Math.abs(A(e).x-A(r[r.length-1]).x),s=Math.abs(A(e).y-A(r[r.length-1]).y),c=Math.abs(A(e).x-A(r[0]).x),l=Math.abs(A(e).y-A(r[0]).y),u=D[t.arrowTypeStart],d=D[t.arrowTypeEnd];if(o<d&&o>0&&s<d){let e=d+1-o;e*=a===`right`?-1:1,i-=e}if(c<u&&c>0&&l<u){let e=u+1-c;e*=a===`right`?-1:1,i+=e}return A(e).x+i},`x`),y:e(function(e,n,r){let i=0,a=A(r[0]).y<A(r[r.length-1]).y?`down`:`up`;if(n===0&&Object.hasOwn(D,t.arrowTypeStart)){let{angle:e,deltaY:n}=k(r[0],r[1]);i=D[t.arrowTypeStart]*Math.abs(Math.sin(e))*(n>=0?1:-1)}else if(n===r.length-1&&Object.hasOwn(D,t.arrowTypeEnd)){let{angle:e,deltaY:n}=k(r[r.length-1],r[r.length-2]);i=D[t.arrowTypeEnd]*Math.abs(Math.sin(e))*(n>=0?1:-1)}let o=Math.abs(A(e).y-A(r[r.length-1]).y),s=Math.abs(A(e).x-A(r[r.length-1]).x),c=Math.abs(A(e).y-A(r[0]).y),l=Math.abs(A(e).x-A(r[0]).x),u=D[t.arrowTypeStart],d=D[t.arrowTypeEnd];if(o<d&&o>0&&s<d){let e=d+1-o;e*=a===`up`?-1:1,i-=e}if(c<u&&c>0&&l<u){let e=u+1-c;e*=a===`up`?-1:1,i+=e}return A(e).y+i},`y`)}),`getLineFunctionsWithOffset`),re=e((e,t,n,r,i,a=!1,o)=>{t.arrowTypeStart&&N(e,`start`,t.arrowTypeStart,n,r,i,a,o),t.arrowTypeEnd&&N(e,`end`,t.arrowTypeEnd,n,r,i,a,o)},`addEdgeMarkers`),j={arrow_cross:{type:`cross`,fill:!1},arrow_point:{type:`point`,fill:!0},arrow_barb:{type:`barb`,fill:!0},arrow_barb_neo:{type:`barb`,fill:!0},arrow_circle:{type:`circle`,fill:!1},arrow_hierarchy:{type:`hierarchy`,fill:!1},aggregation:{type:`aggregation`,fill:!1},extension:{type:`extension`,fill:!1},composition:{type:`composition`,fill:!0},dependency:{type:`dependency`,fill:!0},lollipop:{type:`lollipop`,fill:!1},only_one:{type:`onlyOne`,fill:!1},zero_or_one:{type:`zeroOrOne`,fill:!1},one_or_more:{type:`oneOrMore`,fill:!1},zero_or_more:{type:`zeroOrMore`,fill:!1},requirement_arrow:{type:`requirement_arrow`,fill:!1},requirement_contains:{type:`requirement_contains`,fill:!1}},M=[`cross`,`point`,`circle`,`lollipop`,`aggregation`,`extension`,`composition`,`dependency`,`barb`],N=e((e,n,r,i,a,o,s=!1,c)=>{if(!r||r===`none`)return;let l=j[r],u=l&&M.includes(l.type);if(!l){t.warn(`Unknown arrow type: ${r}`);return}let d=`${a}_${o}-${l.type}${n===`start`?`Start`:`End`}${s&&u?`-margin`:``}`;if(c&&c.trim()!==``){let t=`${d}_${c.replace(/[^\dA-Za-z]/g,`_`)}`;if(!document.getElementById(t)){let e=document.getElementById(d);if(e){let n=e.cloneNode(!0);n.id=t,n.querySelectorAll(`path, circle, line`).forEach(e=>{e.setAttribute(`stroke`,c),l.fill&&e.setAttribute(`fill`,c)}),e.parentNode?.appendChild(n)}}e.attr(`marker-${n}`,`url(${i}#${t})`)}else e.attr(`marker-${n}`,`url(${i}#${d})`)},`addEdgeMarker`),ie=e(e=>typeof e==`string`?e:r()?.flowchart?.curve,`resolveEdgeCurveType`),P=new Map,F=new Map,I=e(()=>{P.clear(),F.clear()},`clear`),L=e(e=>!!(e.label||e.startLabelLeft||e.startLabelRight||e.endLabelLeft||e.endLabelRight),`hasEdgeLabel`),R=e(e=>e?typeof e==`string`?e:e.reduce((e,t)=>e+`;`+t,``):``,`getLabelStyles`),z=e(async(e,a)=>{let o=r(),s=i(o),{labelStyles:c}=C(a);a.labelStyle=c;let l=e.insert(`g`).attr(`class`,`edgeLabel`),u=l.insert(`g`).attr(`class`,`label`).attr(`data-id`,a.id),d=a.labelType===`markdown`,f=await x(e,a.label,{style:R(a.labelStyle),useHtmlLabels:s,addSvgBackground:!0,isNode:!1,markdown:d,width:void 0},o);u.node().appendChild(f),t.info(`abc82`,a,a.labelType);let p,m;if(s){let e=f.children[0],t=n(f);p=await S.measure(()=>e.getBoundingClientRect()),m=p,t.attr(`width`,p.width),t.attr(`height`,p.height)}else{let e=n(f).select(`text`).node();await S.measure(()=>{p=f.getBBox(),m=e&&typeof e.getBBox==`function`?e.getBBox():p})}u.attr(`transform`,E(m,s)),P.set(a.id,l),a.width=p.width,a.height=p.height;let h;if(a.startLabelLeft){let t=e.insert(`g`).attr(`class`,`edgeTerminals`),r=t.insert(`g`).attr(`class`,`inner`),i=await w(r,a.startLabelLeft,R(a.labelStyle)||``,!1,!1);h=i;let o=i.getBBox();if(s){let e=i.children[0],t=n(i);o=e.getBoundingClientRect(),t.attr(`width`,o.width),t.attr(`height`,o.height)}r.attr(`transform`,E(o,s)),F.get(a.id)||F.set(a.id,{}),F.get(a.id).startLeft=t,V(h,a.startLabelLeft,o),B(a,`startLeft`,o)}if(a.startLabelRight){let t=e.insert(`g`).attr(`class`,`edgeTerminals`),r=t.insert(`g`).attr(`class`,`inner`),i=await w(r,a.startLabelRight,R(a.labelStyle)||``,!1,!1);h=i;let o=i.getBBox();if(s){let e=i.children[0],t=n(i);o=e.getBoundingClientRect(),t.attr(`width`,o.width),t.attr(`height`,o.height)}r.attr(`transform`,E(o,s)),F.get(a.id)||F.set(a.id,{}),F.get(a.id).startRight=t,V(h,a.startLabelRight,o),B(a,`startRight`,o)}if(a.endLabelLeft){let t=e.insert(`g`).attr(`class`,`edgeTerminals`),r=t.insert(`g`).attr(`class`,`inner`),i=await w(r,a.endLabelLeft,R(a.labelStyle)||``,!1,!1);h=i;let o=i.getBBox();if(s){let e=i.children[0],t=n(i);o=e.getBoundingClientRect(),t.attr(`width`,o.width),t.attr(`height`,o.height)}r.attr(`transform`,E(o,s)),F.get(a.id)||F.set(a.id,{}),F.get(a.id).endLeft=t,V(h,a.endLabelLeft,o),B(a,`endLeft`,o)}if(a.endLabelRight){let t=e.insert(`g`).attr(`class`,`edgeTerminals`),r=t.insert(`g`).attr(`class`,`inner`),i=await w(r,a.endLabelRight,R(a.labelStyle)||``,!1,!1);h=i;let o=i.getBBox();if(s){let e=i.children[0],t=n(i);o=e.getBoundingClientRect(),t.attr(`width`,o.width),t.attr(`height`,o.height)}r.attr(`transform`,E(o,s)),F.get(a.id)||F.set(a.id,{}),F.get(a.id).endRight=t,V(h,a.endLabelRight,o),B(a,`endRight`,o)}return f},`insertEdgeLabel`);function B(e,t,n){e.terminalLabelSizes??={},e.terminalLabelSizes[t]={width:n.width,height:n.height}}e(B,`recordTerminalLabelSize`);function V(e,t,n){i(r())&&e&&(e.style.width=Math.max(t.length*9,n.width)+`px`,e.style.height=n.height+`px`)}e(V,`setTerminalWidth`);var H=e((e,t)=>{let n=e.x,r=e.y;if(t?.updatedPath){let i=f.calcLabelPosition(t.updatedPath);if(t.originalPath){let a=f.calcLabelPosition(t.originalPath);n=e.x+(i.x-a.x),r=e.y+(i.y-a.y)}else n=i.x,r=i.y}return{x:n,y:r}},`resolveEdgeLabelPosition`),U=e((e,n)=>{t.debug(`Moving label abc88 `,e.id,e.label,P.get(e.id),n);let i=r(),{subGraphTitleTotalMargin:a}=T(i);if(e.label){let r=P.get(e.id),{x:i,y:o}=H(e,n);t.debug(`Moving label `+e.label+` from (`,e.x,`,`,e.y,`) to (`,i,`,`,o,`) abc88`),r.attr(`transform`,`translate(${i}, ${o+a/2})`)}let o=n.updatedPath?n.updatedPath:n.originalPath;if(e.startLabelLeft){let t=F.get(e.id).startLeft,n=e.x,r=e.y;if(o){let t=f.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_left`,o);n=t.x,r=t.y}t.attr(`transform`,`translate(${n}, ${r})`)}if(e.startLabelRight){let t=F.get(e.id).startRight,n=e.x,r=e.y;if(o){let t=f.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_right`,o);n=t.x,r=t.y}t.attr(`transform`,`translate(${n}, ${r})`)}if(e.endLabelLeft){let t=F.get(e.id).endLeft,n=e.x,r=e.y;if(o){let t=f.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_left`,o);n=t.x,r=t.y}t.attr(`transform`,`translate(${n}, ${r})`)}if(e.endLabelRight){let t=F.get(e.id).endRight,n=e.x,r=e.y;if(o){let t=f.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_right`,o);n=t.x,r=t.y}t.attr(`transform`,`translate(${n}, ${r})`)}},`positionEdgeLabel`),ae=e((e,t)=>{if(!e?.isLabelEdge||!e?.id?.endsWith(`-to-label`)||!Array.isArray(t)||t.length!==2)return t;let[n,r]=t,i=Math.abs(r.x-n.x),a=Math.abs(r.y-n.y);return i<.001||a<.001?t:a>=i?[n,{x:n.x,y:r.y},r]:[n,{x:r.x,y:n.y},r]},`orthogonalizeToLabelClippedPoints`),W=e((e,t)=>{let n=e.x,r=e.y,i=Math.abs(t.x-n),a=Math.abs(t.y-r),o=e.width/2,s=e.height/2;return i>=o||a>=s},`outsideNode`),G=e((e,n,r)=>{t.debug(`intersection calc abc89:
2
- outsidePoint: ${JSON.stringify(n)}
3
- insidePoint : ${JSON.stringify(r)}
4
- node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let i=e.x,a=e.y,o=Math.abs(i-r.x),s=e.width/2,c=r.x<n.x?s-o:s+o,l=e.height/2,u=Math.abs(n.y-r.y),d=Math.abs(n.x-r.x);if(Math.abs(a-n.y)*s>Math.abs(i-n.x)*l){let e=r.y<n.y?n.y-l-a:a-l-n.y;c=d*e/u;let i={x:r.x<n.x?r.x+c:r.x-d+c,y:r.y<n.y?r.y+u-e:r.y-u+e};return c===0&&(i.x=n.x,i.y=n.y),d===0&&(i.x=n.x),u===0&&(i.y=n.y),t.debug(`abc89 top/bottom calc, Q ${u}, q ${e}, R ${d}, r ${c}`,i),i}{c=r.x<n.x?n.x-s-i:i-s-n.x;let e=u*c/d,a=r.x<n.x?r.x+d-c:r.x-d+c,o=r.y<n.y?r.y+e:r.y-e;return t.debug(`sides calc abc89, Q ${u}, q ${e}, R ${d}, r ${c}`,{_x:a,_y:o}),c===0&&(a=n.x,o=n.y),d===0&&(a=n.x),u===0&&(o=n.y),{x:a,y:o}}},`intersection`),K=e((e,n)=>{t.warn(`abc88 cutPathAtIntersect`,e,n);let r=[],i=e[0],a=!1;return e.forEach(e=>{if(t.info(`abc88 checking point`,e,n),!W(n,e)&&!a){let o=G(n,i,e);t.debug(`abc88 inside`,e,i,o),t.debug(`abc88 intersection`,o,n);let s=!1;r.forEach(e=>{s||=e.x===o.x&&e.y===o.y}),r.some(e=>e.x===o.x&&e.y===o.y)?t.warn(`abc88 no intersect`,o,r):r.push(o),a=!0}else t.warn(`abc88 outside`,e,i),i=e,a||r.push(e)}),t.debug(`returning points`,r),r},`cutPathAtIntersect`);function q(e){let t=[],n=[];for(let r=1;r<e.length-1;r++){let i=e[r-1],a=e[r],o=e[r+1];(i.x===a.x&&a.y===o.y&&Math.abs(a.x-o.x)>5&&Math.abs(a.y-i.y)>5||i.y===a.y&&a.x===o.x&&Math.abs(a.x-i.x)>5&&Math.abs(a.y-o.y)>5)&&(t.push(a),n.push(r))}return{cornerPoints:t,cornerPointPositions:n}}e(q,`extractCornerPoints`);var J=e(function(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=n/Math.sqrt(r*r+i*i);return{x:t.x-a*r,y:t.y-a*i}},`findAdjacentPoint`),oe=e(function(e){let{cornerPointPositions:n}=q(e),r=[];for(let i=0;i<e.length;i++)if(n.includes(i)){let n=e[i-1],a=e[i+1],o=e[i],s=J(n,o,5),c=J(a,o,5),l=c.x-s.x,u=c.y-s.y;r.push(s);let d=Math.sqrt(2)*2,f={x:o.x,y:o.y};Math.abs(a.x-n.x)>10&&Math.abs(a.y-n.y)>=10?(t.debug(`Corner point fixing`,Math.abs(a.x-n.x),Math.abs(a.y-n.y)),f=o.x===s.x?{x:l<0?s.x-5+d:s.x+5-d,y:u<0?s.y-d:s.y+d}:{x:l<0?s.x-d:s.x+d,y:u<0?s.y-5+d:s.y+5-d}):t.debug(`Corner point skipping fixing`,Math.abs(a.x-n.x),Math.abs(a.y-n.y)),r.push(f,c)}else r.push(e[i]);return r},`fixCorners`),se=e((e,t,n)=>{let r=e-t-n,i=Math.floor(r/4);return`0 ${t} ${Array(Number.isFinite(i)?Math.max(0,i):0).fill(`2 2`).join(` `)} ${n}`},`generateDashArray`),Y=e(function(e,i,a,x,S,C,w,T=!1){if(!w)throw Error(`insertEdge: missing diagramId for edge "${i.id}" \u2014 edge IDs require a diagram prefix for uniqueness`);let{handDrawnSeed:E,layout:D}=r(),k=i.points,A=!1,j=S;var M=C;let N=[];for(let e in i.cssCompiledStyles)ee(e)||N.push(i.cssCompiledStyles[e]);if(D===`swimlane`){if(M.intersect&&j.intersect&&Array.isArray(k)&&k.length>=2){if(k.length===2)k=[j.intersect(k[0]),M.intersect(k[1])];else{let e=k.slice(1,-1),t=e[0],n=e[e.length-1],r=.5,i=Math.abs(k[k.length-1].x-n.x)<r&&Math.abs(k[k.length-1].y-n.y)<r,a=j.intersect(t),o=i?n:M.intersect(n),s=Math.abs(o.x-n.x)<r&&Math.abs(o.y-n.y)<r,c=Math.abs(a.x-t.x)<r&&Math.abs(a.y-t.y)<r?[]:[a],l=s?[]:[o];k=[...c,...e,...l]}}k=ae(i,k)}else M.intersect&&j.intersect&&!T&&(k=k.slice(1,i.points.length-1),k.unshift(j.intersect(k[0])),k.push(M.intersect(k[k.length-1])));let P=btoa(JSON.stringify(k));i.toCluster&&(t.info(`to cluster abc88`,a.get(i.toCluster)),k=K(i.points,a.get(i.toCluster).node),A=!0),i.fromCluster&&(t.debug(`from cluster abc88`,a.get(i.fromCluster),JSON.stringify(k,null,2)),k=K(k.reverse(),a.get(i.fromCluster).node).reverse(),A=!0);let F=k.filter(e=>!Number.isNaN(e.y)),I=ie(i.curve);I!==`rounded`&&(F=oe(F));let L=h;switch(I){case`linear`:L=h;break;case`basis`:L=y;break;case`cardinal`:L=m;break;case`bumpX`:L=g;break;case`bumpY`:L=v;break;case`catmullRom`:L=o;break;case`monotoneX`:L=d;break;case`monotoneY`:L=c;break;case`natural`:L=l;break;case`step`:L=u;break;case`stepAfter`:L=_;break;case`stepBefore`:L=s;break;case`rounded`:L=h;break;default:L=y}let{x:R,y:z}=ne(i),B=b().x(R).y(z).curve(L),V;switch(i.thickness){case`normal`:V=`edge-thickness-normal`;break;case`thick`:V=`edge-thickness-thick`;break;case`invisible`:V=`edge-thickness-invisible`;break;default:V=`edge-thickness-normal`}switch(i.pattern){case`solid`:V+=` edge-pattern-solid`;break;case`dotted`:V+=` edge-pattern-dotted`;break;case`dashed`:V+=` edge-pattern-dashed`;break;default:V+=` edge-pattern-solid`}let H,U=I===`rounded`?X(Q(F,i),5):B(F),W=Array.isArray(i.style)?i.style:[i.style],G=W.find(e=>e?.startsWith(`stroke:`)),q=``;i.animate&&(q=`edge-animation-fast`),i.animation&&(q=`edge-animation-`+i.animation);let J=!1;if(i.look===`handDrawn`){let t=te.svg(e);Object.assign([],F);let r=t.path(U,{roughness:.3,seed:E});V+=` transition`,H=n(r).select(`path`).attr(`id`,`${w}-${i.id}`).attr(`class`,` `+V+(i.classes?` `+i.classes:``)+(q?` `+q:``)).attr(`style`,W?W.reduce((e,t)=>e+`;`+t,``):``);let a=H.attr(`d`);H.attr(`d`,a),e.node().appendChild(H.node())}else{let t=N.join(`;`),n=W?W.reduce((e,t)=>e+t+`;`,``):``,r=(t?t+`;`+n+`;`:n)+`;`+(W?W.reduce((e,t)=>e+`;`+t,``):``);H=e.append(`path`).attr(`d`,U).attr(`id`,`${w}-${i.id}`).attr(`class`,` `+V+(i.classes?` `+i.classes:``)+(q?` `+q:``)).attr(`style`,r),G=r.match(/stroke:([^;]+)/)?.[1],J=i.animate===!0||!!i.animation||t.includes(`animation`);let a=H.node(),o=typeof a.getTotalLength==`function`?a.getTotalLength():0,s=O[i.arrowTypeStart]||0,c=O[i.arrowTypeEnd]||0;if(i.look===`neo`&&!J){let e=`stroke-dasharray: ${i.pattern===`dotted`||i.pattern===`dashed`?se(o,s,c):`0 ${s} ${o-s-c} ${c}`}; stroke-dashoffset: 0;`;H.attr(`style`,e+H.attr(`style`))}}H.attr(`data-edge`,!0),H.attr(`data-et`,`edge`),H.attr(`data-id`,i.id),H.attr(`data-points`,P),H.attr(`data-look`,p(i.look)),i.showPoints&&F.forEach(t=>{e.append(`circle`).style(`stroke`,`red`).style(`fill`,`red`).attr(`r`,1).attr(`cx`,t.x).attr(`cy`,t.y)});let Y=``;(r().flowchart.arrowMarkerAbsolute||r().state.arrowMarkerAbsolute)&&(Y=window.location.protocol+`//`+window.location.host+window.location.pathname+window.location.search,Y=Y.replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)),t.info(`arrowTypeStart`,i.arrowTypeStart),t.info(`arrowTypeEnd`,i.arrowTypeEnd);let Z=!J&&i?.look===`neo`;re(H,i,Y,w,x,Z,G);let ce=Math.floor(k.length/2),le=k[ce];f.isLabelCoordinateInPath(le,H.attr(`d`))||(A=!0);let $={};return A&&($.updatedPath=k),$.originalPath=i.points,$},`insertEdge`);function X(e,t){if(e.length<2)return``;let n=``,r=e.length,i=1e-5;for(let a=0;a<r;a++){let o=e[a],s=e[a-1],c=e[a+1];if(a===0)n+=`M${o.x},${o.y}`;else if(a===r-1)n+=`L${o.x},${o.y}`;else{let e=o.x-s.x,r=o.y-s.y,a=c.x-o.x,l=c.y-o.y,u=Math.hypot(e,r),d=Math.hypot(a,l);if(u<i||d<i){n+=`L${o.x},${o.y}`;continue}let f=e/u,p=r/u,m=a/d,h=l/d,g=f*m+p*h,_=Math.acos(Math.max(-1,Math.min(1,g)));if(_<i||Math.abs(Math.PI-_)<i){n+=`L${o.x},${o.y}`;continue}let v=Math.min(t/Math.sin(_/2),u/2,d/2),y=o.x-f*v,b=o.y-p*v,x=o.x+m*v,S=o.y+h*v;n+=`L${y},${b}`,n+=`Q${o.x},${o.y} ${x},${S}`}}return n}e(X,`generateRoundedPath`);function Z(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};let n=t.x-e.x,r=t.y-e.y;return{angle:Math.atan2(r,n),deltaX:n,deltaY:r}}e(Z,`calculateDeltaAndAngle`);function Q(e,t){let n=e.map(e=>({...e}));if(e.length>=2&&D[t.arrowTypeStart]){let r=D[t.arrowTypeStart],i=e[0],a=e[1],{angle:o}=Z(i,a),s=r*Math.cos(o),c=r*Math.sin(o);n[0].x=i.x+s,n[0].y=i.y+c}let r=e.length;if(r>=2&&D[t.arrowTypeEnd]){let i=D[t.arrowTypeEnd],a=e[r-1],o=e[r-2],{angle:s}=Z(o,a),c=i*Math.cos(s),l=i*Math.sin(s);n[r-1].x=a.x-c,n[r-1].y=a.y-l}return n}e(Q,`applyMarkerOffsetsToPoints`);var ce=e((e,t,n,r)=>{t.forEach(t=>{le[t](e,n,r)})},`insertMarkers`),le={extension:e((e,n,r)=>{t.trace(`Making markers for `,r),e.append(`defs`).append(`marker`).attr(`id`,r+`_`+n+`-extensionStart`).attr(`class`,`marker extension `+n).attr(`refX`,18).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 1,7 L18,13 V 1 Z`),e.append(`defs`).append(`marker`).attr(`id`,r+`_`+n+`-extensionEnd`).attr(`class`,`marker extension `+n).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 1,1 V 13 L18,7 Z`),e.append(`marker`).attr(`id`,r+`_`+n+`-extensionStart-margin`).attr(`class`,`marker extension `+n).attr(`refX`,18).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).attr(`viewBox`,`0 0 20 14`).append(`polygon`).attr(`points`,`10,7 18,13 18,1`).style(`stroke-width`,2).style(`stroke-dasharray`,`0`),e.append(`defs`).append(`marker`).attr(`id`,r+`_`+n+`-extensionEnd-margin`).attr(`class`,`marker extension `+n).attr(`refX`,9).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).attr(`viewBox`,`0 0 20 14`).append(`polygon`).attr(`points`,`10,1 10,13 18,7`).style(`stroke-width`,2).style(`stroke-dasharray`,`0`)},`extension`),composition:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-compositionStart`).attr(`class`,`marker composition `+t).attr(`refX`,18).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-compositionEnd`).attr(`class`,`marker composition `+t).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-compositionStart-margin`).attr(`class`,`marker composition `+t).attr(`refX`,15).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,0).attr(`viewBox`,`0 0 15 15`).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-compositionEnd-margin`).attr(`class`,`marker composition `+t).attr(`refX`,3.5).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,0).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`)},`composition`),aggregation:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-aggregationStart`).attr(`class`,`marker aggregation `+t).attr(`refX`,18).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-aggregationEnd`).attr(`class`,`marker aggregation `+t).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-aggregationStart-margin`).attr(`class`,`marker aggregation `+t).attr(`refX`,15).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,2).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-aggregationEnd-margin`).attr(`class`,`marker aggregation `+t).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,2).attr(`d`,`M 18,7 L9,13 L1,7 L9,1 Z`)},`aggregation`),dependency:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-dependencyStart`).attr(`class`,`marker dependency `+t).attr(`refX`,6).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 5,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-dependencyEnd`).attr(`class`,`marker dependency `+t).attr(`refX`,13).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M 18,7 L9,13 L14,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-dependencyStart-margin`).attr(`class`,`marker dependency `+t).attr(`refX`,4).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,0).attr(`d`,`M 5,7 L9,13 L1,7 L9,1 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-dependencyEnd-margin`).attr(`class`,`marker dependency `+t).attr(`refX`,16).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).style(`stroke-width`,0).attr(`d`,`M 18,7 L9,13 L14,7 L9,1 Z`)},`dependency`),lollipop:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-lollipopStart`).attr(`class`,`marker lollipop `+t).attr(`refX`,13).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`circle`).attr(`fill`,`transparent`).attr(`cx`,7).attr(`cy`,7).attr(`r`,6),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-lollipopEnd`).attr(`class`,`marker lollipop `+t).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`circle`).attr(`fill`,`transparent`).attr(`cx`,7).attr(`cy`,7).attr(`r`,6),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-lollipopStart-margin`).attr(`class`,`marker lollipop `+t).attr(`refX`,13).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`circle`).attr(`fill`,`transparent`).attr(`cx`,7).attr(`cy`,7).attr(`r`,6).attr(`stroke-width`,2),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-lollipopEnd-margin`).attr(`class`,`marker lollipop `+t).attr(`refX`,1).attr(`refY`,7).attr(`markerWidth`,190).attr(`markerHeight`,240).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`circle`).attr(`fill`,`transparent`).attr(`cx`,7).attr(`cy`,7).attr(`r`,6).attr(`stroke-width`,2)},`lollipop`),point:e((e,t,n)=>{e.append(`marker`).attr(`id`,n+`_`+t+`-pointEnd`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refX`,5).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,8).attr(`markerHeight`,8).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 0 L 10 5 L 0 10 z`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-pointStart`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refX`,4.5).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,8).attr(`markerHeight`,8).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 5 L 10 10 L 10 0 z`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-pointEnd-margin`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 11.5 14`).attr(`refX`,11.5).attr(`refY`,7).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,10.5).attr(`markerHeight`,14).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 0 L 11.5 7 L 0 14 z`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,0).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-pointStart-margin`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 11.5 14`).attr(`refX`,1).attr(`refY`,7).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,11.5).attr(`markerHeight`,14).attr(`orient`,`auto`).append(`polygon`).attr(`points`,`0,7 11.5,14 11.5,0`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,0).style(`stroke-dasharray`,`1,0`)},`point`),circle:e((e,t,n)=>{e.append(`marker`).attr(`id`,n+`_`+t+`-circleEnd`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refX`,11).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,11).attr(`markerHeight`,11).attr(`orient`,`auto`).append(`circle`).attr(`cx`,`5`).attr(`cy`,`5`).attr(`r`,`5`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-circleStart`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refX`,-1).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,11).attr(`markerHeight`,11).attr(`orient`,`auto`).append(`circle`).attr(`cx`,`5`).attr(`cy`,`5`).attr(`r`,`5`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-circleEnd-margin`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refY`,5).attr(`refX`,12.25).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,14).attr(`markerHeight`,14).attr(`orient`,`auto`).append(`circle`).attr(`cx`,`5`).attr(`cy`,`5`).attr(`r`,`5`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,0).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-circleStart-margin`).attr(`class`,`marker `+t).attr(`viewBox`,`0 0 10 10`).attr(`refX`,-2).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,14).attr(`markerHeight`,14).attr(`orient`,`auto`).append(`circle`).attr(`cx`,`5`).attr(`cy`,`5`).attr(`r`,`5`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,0).style(`stroke-dasharray`,`1,0`)},`circle`),cross:e((e,t,n)=>{e.append(`marker`).attr(`id`,n+`_`+t+`-crossEnd`).attr(`class`,`marker cross `+t).attr(`viewBox`,`0 0 11 11`).attr(`refX`,12).attr(`refY`,5.2).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,11).attr(`markerHeight`,11).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 1,1 l 9,9 M 10,1 l -9,9`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,2).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-crossStart`).attr(`class`,`marker cross `+t).attr(`viewBox`,`0 0 11 11`).attr(`refX`,-1).attr(`refY`,5.2).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,11).attr(`markerHeight`,11).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 1,1 l 9,9 M 10,1 l -9,9`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,2).style(`stroke-dasharray`,`1,0`),e.append(`marker`).attr(`id`,n+`_`+t+`-crossEnd-margin`).attr(`class`,`marker cross `+t).attr(`viewBox`,`0 0 15 15`).attr(`refX`,17.7).attr(`refY`,7.5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,12).attr(`markerHeight`,12).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 1,1 L 14,14 M 1,14 L 14,1`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,2.5),e.append(`marker`).attr(`id`,n+`_`+t+`-crossStart-margin`).attr(`class`,`marker cross `+t).attr(`viewBox`,`0 0 15 15`).attr(`refX`,-3.5).attr(`refY`,7.5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,12).attr(`markerHeight`,12).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 1,1 L 14,14 M 1,14 L 14,1`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,2.5).style(`stroke-dasharray`,`1,0`)},`cross`),barb:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-barbEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,14).attr(`markerUnits`,`userSpaceOnUse`).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`barb`),barbNeo:e((e,t,n)=>{let{themeVariables:r}=a(),{transitionColor:i}=r;e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-barbEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,14).attr(`markerUnits`,`strokeWidth`).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L11,14 L13,7 L11,0 Z`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-barbEnd-margin`).attr(`refX`,17).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,14).attr(`markerUnits`,`userSpaceOnUse`).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L11,14 L13,7 L11,0 Z`).attr(`fill`,`${i}`)},`barbNeo`),hierarchy:e((e,t,n)=>{e.append(`marker`).attr(`id`,n+`_`+t+`-hierarchyEnd`).attr(`class`,`marker hierarchy `+t).attr(`viewBox`,`0 0 12 10`).attr(`refX`,10).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,12).attr(`markerHeight`,10).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 0 L 6 5 L 0 10 M 4 0 L 10 5 L 4 10`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`).style(`fill`,`none`),e.append(`marker`).attr(`id`,n+`_`+t+`-hierarchyStart`).attr(`class`,`marker hierarchy `+t).attr(`viewBox`,`0 0 12 10`).attr(`refX`,2).attr(`refY`,5).attr(`markerUnits`,`userSpaceOnUse`).attr(`markerWidth`,12).attr(`markerHeight`,10).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 12 0 L 6 5 L 12 10 M 8 0 L 2 5 L 8 10`).attr(`class`,`arrowMarkerPath`).style(`stroke-width`,1).style(`stroke-dasharray`,`1,0`).style(`fill`,`none`)},`hierarchy`),only_one:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-onlyOneStart`).attr(`class`,`marker onlyOne `+t).attr(`refX`,0).attr(`refY`,9).attr(`markerWidth`,18).attr(`markerHeight`,18).attr(`orient`,`auto`).append(`path`).attr(`d`,`M9,0 L9,18 M15,0 L15,18`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-onlyOneEnd`).attr(`class`,`marker onlyOne `+t).attr(`refX`,18).attr(`refY`,9).attr(`markerWidth`,18).attr(`markerHeight`,18).attr(`orient`,`auto`).append(`path`).attr(`d`,`M3,0 L3,18 M9,0 L9,18`)},`only_one`),zero_or_one:e((e,t,n)=>{let r=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrOneStart`).attr(`class`,`marker zeroOrOne `+t).attr(`refX`,0).attr(`refY`,9).attr(`markerWidth`,30).attr(`markerHeight`,18).attr(`orient`,`auto`);r.append(`circle`).attr(`fill`,`white`).attr(`cx`,21).attr(`cy`,9).attr(`r`,6),r.append(`path`).attr(`d`,`M9,0 L9,18`);let i=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrOneEnd`).attr(`class`,`marker zeroOrOne `+t).attr(`refX`,30).attr(`refY`,9).attr(`markerWidth`,30).attr(`markerHeight`,18).attr(`orient`,`auto`);i.append(`circle`).attr(`fill`,`white`).attr(`cx`,9).attr(`cy`,9).attr(`r`,6),i.append(`path`).attr(`d`,`M21,0 L21,18`)},`zero_or_one`),one_or_more:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-oneOrMoreStart`).attr(`class`,`marker oneOrMore `+t).attr(`refX`,18).attr(`refY`,18).attr(`markerWidth`,45).attr(`markerHeight`,36).attr(`orient`,`auto`).append(`path`).attr(`d`,`M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-oneOrMoreEnd`).attr(`class`,`marker oneOrMore `+t).attr(`refX`,27).attr(`refY`,18).attr(`markerWidth`,45).attr(`markerHeight`,36).attr(`orient`,`auto`).append(`path`).attr(`d`,`M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18`)},`one_or_more`),zero_or_more:e((e,t,n)=>{let r=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrMoreStart`).attr(`class`,`marker zeroOrMore `+t).attr(`refX`,18).attr(`refY`,18).attr(`markerWidth`,57).attr(`markerHeight`,36).attr(`orient`,`auto`);r.append(`circle`).attr(`fill`,`white`).attr(`cx`,48).attr(`cy`,18).attr(`r`,6),r.append(`path`).attr(`d`,`M0,18 Q18,0 36,18 Q18,36 0,18`);let i=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrMoreEnd`).attr(`class`,`marker zeroOrMore `+t).attr(`refX`,39).attr(`refY`,18).attr(`markerWidth`,57).attr(`markerHeight`,36).attr(`orient`,`auto`);i.append(`circle`).attr(`fill`,`white`).attr(`cx`,9).attr(`cy`,18).attr(`r`,6),i.append(`path`).attr(`d`,`M21,18 Q39,0 57,18 Q39,36 21,18`)},`zero_or_more`),only_one_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i}=r;e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-onlyOneStart`).attr(`class`,`marker onlyOne `+t).attr(`refX`,0).attr(`refY`,9).attr(`markerWidth`,18).attr(`markerHeight`,18).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M9,0 L9,18 M15,0 L15,18`).attr(`stroke-width`,`${i}`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-onlyOneEnd`).attr(`class`,`marker onlyOne `+t).attr(`refX`,18).attr(`refY`,9).attr(`markerWidth`,18).attr(`markerHeight`,18).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M3,0 L3,18 M9,0 L9,18`).attr(`stroke-width`,`${i}`)},`only_one_neo`),zero_or_one_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i,mainBkg:o}=r,s=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrOneStart`).attr(`class`,`marker zeroOrOne `+t).attr(`refX`,0).attr(`refY`,9).attr(`markerWidth`,30).attr(`markerHeight`,18).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`);s.append(`circle`).attr(`fill`,o??`white`).attr(`cx`,21).attr(`cy`,9).attr(`stroke-width`,`${i}`).attr(`r`,6),s.append(`path`).attr(`d`,`M9,0 L9,18`).attr(`stroke-width`,`${i}`);let c=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrOneEnd`).attr(`class`,`marker zeroOrOne `+t).attr(`refX`,30).attr(`refY`,9).attr(`markerWidth`,30).attr(`markerHeight`,18).attr(`markerUnits`,`userSpaceOnUse`).attr(`orient`,`auto`);c.append(`circle`).attr(`fill`,o??`white`).attr(`cx`,9).attr(`cy`,9).attr(`stroke-width`,`${i}`).attr(`r`,6),c.append(`path`).attr(`d`,`M21,0 L21,18`).attr(`stroke-width`,`${i}`)},`zero_or_one_neo`),one_or_more_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i}=r;e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-oneOrMoreStart`).attr(`class`,`marker oneOrMore `+t).attr(`refX`,18).attr(`refY`,18).attr(`markerWidth`,45).attr(`markerHeight`,36).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`path`).attr(`d`,`M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27`).attr(`stroke-width`,`${i}`),e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-oneOrMoreEnd`).attr(`class`,`marker oneOrMore `+t).attr(`refX`,27).attr(`refY`,18).attr(`markerWidth`,45).attr(`markerHeight`,36).attr(`markerUnits`,`userSpaceOnUse`).attr(`orient`,`auto`).append(`path`).attr(`d`,`M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18`).attr(`stroke-width`,`${i}`)},`one_or_more_neo`),zero_or_more_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i,mainBkg:o}=r,s=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrMoreStart`).attr(`class`,`marker zeroOrMore `+t).attr(`refX`,18).attr(`refY`,18).attr(`markerWidth`,57).attr(`markerHeight`,36).attr(`markerUnits`,`userSpaceOnUse`).attr(`orient`,`auto`);s.append(`circle`).attr(`fill`,o??`white`).attr(`cx`,45.5).attr(`cy`,18).attr(`r`,6).attr(`stroke-width`,`${i}`),s.append(`path`).attr(`d`,`M0,18 Q18,0 36,18 Q18,36 0,18`).attr(`stroke-width`,`${i}`);let c=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-zeroOrMoreEnd`).attr(`class`,`marker zeroOrMore `+t).attr(`refX`,39).attr(`refY`,18).attr(`markerWidth`,57).attr(`markerHeight`,36).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`);c.append(`circle`).attr(`fill`,o??`white`).attr(`cx`,11).attr(`cy`,18).attr(`r`,6).attr(`stroke-width`,`${i}`),c.append(`path`).attr(`d`,`M21,18 Q39,0 57,18 Q39,36 21,18`).attr(`stroke-width`,`${i}`)},`zero_or_more_neo`),requirement_arrow:e((e,t,n)=>{e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_arrowEnd`).attr(`refX`,20).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).append(`path`).attr(`d`,`M0,0
5
- L20,10
6
- M20,10
7
- L0,20`)},`requirement_arrow`),requirement_contains:e((e,t,n)=>{let r=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_containsStart`).attr(`refX`,0).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).append(`g`);r.append(`circle`).attr(`cx`,10).attr(`cy`,10).attr(`r`,9).attr(`fill`,`none`),r.append(`line`).attr(`x1`,1).attr(`x2`,19).attr(`y1`,10).attr(`y2`,10),r.append(`line`).attr(`y1`,1).attr(`y2`,19).attr(`x1`,10).attr(`x2`,10)},`requirement_contains`),requirement_arrow_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i}=r;e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_arrowEnd`).attr(`refX`,20).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).attr(`stroke-width`,`${i}`).attr(`viewBox`,`0 0 25 20`).append(`path`).attr(`d`,`M0,0
8
- L20,10
9
- M20,10
10
- L0,20`).attr(`stroke-linejoin`,`miter`)},`requirement_arrow_neo`),requirement_contains_neo:e((e,t,n)=>{let{themeVariables:r}=a(),{strokeWidth:i}=r,o=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_containsStart`).attr(`refX`,0).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`g`);o.append(`circle`).attr(`cx`,10).attr(`cy`,10).attr(`r`,9).attr(`fill`,`none`),o.append(`line`).attr(`x1`,1).attr(`x2`,19).attr(`y1`,10).attr(`y2`,10),o.append(`line`).attr(`y1`,1).attr(`y2`,19).attr(`x1`,10).attr(`x2`,10),o.selectAll(`*`).attr(`stroke-width`,`${i}`)},`requirement_contains_neo`)},$=ce;export{z as a,$ as c,F as d,Y as i,U as l,P as n,D as o,L as r,O as s,I as t,H as u};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-tZFcq4Tp.js";import{b as r,g as i,w as a}from"./chunk-VPRB5NB3-CYQe0pjV.js";import{n as o}from"./chunk-E2ZNV5FY-CRk3Pfq3.js";import{a as s,i as c,t as l}from"./chunk-4EA7E6EY-DB8ZoOxD.js";import{s as u}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{t as d}from"./rough.esm-Dy-Kn_BL.js";import{i as f,n as p,t as m}from"./chunk-XC4XBNZT-Crw0ZTTY.js";import{n as h}from"./chunk-DBDB3WZW-CfsLqRL8.js";var g=e(async(e,a)=>{let l=r(),{theme:p,themeVariables:m,handDrawnSeed:h}=l,{clusterBkg:g,clusterBorder:_,borderColorArray:v}=m,y=_,{labelStyles:b,nodeStyles:x,borderStyles:S,backgroundStyles:C}=c(a),w=e.insert(`g`).attr(`class`,`cluster swimlane `+(a.cssClasses||``)).attr(`id`,a.id).attr(`data-id`,a.id).attr(`data-et`,`cluster`).attr(`data-look`,a.look);u(w,a.colorIndex,p,v);let T=i(l.flowchart.htmlLabels),E=a.direction===`LR`,D=w.insert(`g`).attr(`class`,`cluster-label swimlane-label`),O=await o(D,a.label,{style:a.labelStyle,useHtmlLabels:T,isNode:!0,width:a.width}),k=O.getBBox();if(T){let e=O.children[0],t=n(O);k=e.getBoundingClientRect(),t.attr(`width`,k.width),t.attr(`height`,k.height)}let A=a.padding??0,j=a.width<=k.width+A?k.width+A:a.width;a.diff=a.width<=k.width+A?(j-a.width)/2-A:-A;let M=a.height,N=a.y-M/2,P=a.y+M/2,F=a.x-j/2,I=a.swimlaneContentTop===void 0?N+M/3:a.swimlaneContentTop,L=E?4:0,R=k.height+2*L,z,B;if(E){let e=Math.max(R,k.height+2*L),t=F+e,n=Math.max(0,j-e);if(a.look===`handDrawn`){let r=d.svg(w),i=s(a,{roughness:.7,fill:g,stroke:y,seed:h}),o=s(a,{roughness:.7,fill:`none`,stroke:y,seed:h}),c=r.rectangle(F,N,e,M,i);z=w.insert(()=>c,`:first-child`).attr(`class`,`swimlane-title`);let l=r.rectangle(t,N,n,M,o);B=w.insert(()=>l,`:first-child`).attr(`class`,`swimlane-body`),z.select(`path:nth-child(2)`).attr(`style`,S.join(`;`)),z.select(`path`).attr(`style`,C.join(`;`).replace(`fill`,`stroke`))}else z=w.insert(`rect`,`:first-child`),B=w.insert(`rect`,`:first-child`),z.attr(`class`,`swimlane-title`).attr(`style`,x).attr(`x`,F).attr(`y`,N).attr(`width`,e).attr(`height`,M).attr(`fill`,g).attr(`stroke`,y),B.attr(`class`,`swimlane-body`).attr(`style`,x).attr(`x`,t).attr(`y`,N).attr(`width`,n).attr(`height`,M).attr(`fill`,`none`).attr(`stroke`,y);let r=F+e/2,i=a.y;D.attr(`transform`,`translate(${r}, ${i}) rotate(-90) translate(${-k.width/2}, ${-k.height/2})`)}else{let e=Math.max(0,I-N),t=Math.min(R,e),n=N+t,r=Math.max(0,P-n),i=a.x-j/2;if(a.look===`handDrawn`){let e=d.svg(w),o=s(a,{roughness:.7,fill:g,stroke:y,fillWeight:3,seed:h}),c=s(a,{roughness:.7,fill:`none`,stroke:y,seed:h}),l=e.rectangle(i,N,j,t,o);z=w.insert(()=>l,`:first-child`).attr(`class`,`swimlane-title`);let u=e.rectangle(i,n,j,r,c);B=w.insert(()=>u,`:first-child`).attr(`class`,`swimlane-body`),z.select(`path:nth-child(2)`).attr(`style`,S.join(`;`)),z.select(`path`).attr(`style`,C.join(`;`).replace(`fill`,`stroke`))}else z=w.insert(`rect`,`:first-child`),B=w.insert(`rect`,`:first-child`),z.attr(`class`,`swimlane-title`).attr(`style`,x).attr(`x`,i).attr(`y`,N).attr(`width`,j).attr(`height`,t).attr(`fill`,g).attr(`stroke`,y),B.attr(`class`,`swimlane-body`).attr(`style`,x).attr(`x`,i).attr(`y`,n).attr(`width`,j).attr(`height`,r).attr(`fill`,`none`).attr(`stroke`,y);let o=a.x-k.width/2,c=N+(t-k.height)/2;D.attr(`transform`,`translate(${o}, ${c})`)}if(t.trace(`Swimlane data `,a,JSON.stringify(a)),b){let e=D.select(`span`);e&&e.attr(`style`,b)}return a.offsetX=0,a.width=j,a.height=M,a.offsetY=k.height-A/2,a.intersect=function(e){return f(a,e)},{cluster:w,labelBBox:k}},`swimlane`),_=e(async(e,i)=>{t.info(`Creating subgraph rect for `,i.id,i);let l=r(),{theme:g,themeVariables:_,handDrawnSeed:v}=l,{clusterBkg:y,clusterBorder:b,borderColorArray:x}=_,{labelStyles:S,nodeStyles:C,borderStyles:w,backgroundStyles:T}=c(i),E=e.insert(`g`).attr(`class`,`cluster `+i.cssClasses).attr(`id`,i.domId).attr(`data-look`,i.look);u(E,i.colorIndex,g,x);let D=a(l),O=E.insert(`g`).attr(`class`,`cluster-label `),k;k=i.labelType===`markdown`?await o(O,i.label,{style:i.labelStyle,useHtmlLabels:D,isNode:!0,width:i.width}):await m(O,i.label,i.labelStyle||``,!1,!0);let A=k.getBBox();if(a(l)){let e=k.children[0],t=n(k);A=e.getBoundingClientRect(),t.attr(`width`,A.width),t.attr(`height`,A.height)}let j=i.width<=A.width+i.padding?A.width+i.padding:i.width;i.diff=i.width<=A.width+i.padding?(j-i.width)/2-i.padding:-i.padding;let M=i.height,N=i.x-j/2,P=i.y-M/2;t.trace(`Data `,i,JSON.stringify(i));let F;if(i.look===`handDrawn`){let e=d.svg(E),n=s(i,{roughness:.7,fill:y,stroke:b,fillWeight:3,seed:v}),r=e.path(p(N,P,j,M,0),n);F=E.insert(()=>(t.debug(`Rough node insert CXC`,r),r),`:first-child`),F.select(`path:nth-child(2)`).attr(`style`,w.join(`;`)),F.select(`path`).attr(`style`,T.join(`;`).replace(`fill`,`stroke`))}else F=E.insert(`rect`,`:first-child`),F.attr(`style`,C).attr(`rx`,i.rx).attr(`ry`,i.ry).attr(`x`,N).attr(`y`,P).attr(`width`,j).attr(`height`,M);let{subGraphTitleTopMargin:I}=h(l);if(O.attr(`transform`,`translate(${i.x-A.width/2}, ${i.y-i.height/2+I})`),S){let e=O.select(`span`);e&&e.attr(`style`,S)}let L=F.node().getBBox();return i.offsetX=0,i.width=L.width,i.height=L.height,i.offsetY=A.height-i.padding/2,i.intersect=function(e){return f(i,e)},{cluster:E,labelBBox:A}},`rect`),v=e((e,t)=>{let n=e.insert(`g`).attr(`class`,`note-cluster`).attr(`id`,t.domId),r=n.insert(`rect`,`:first-child`),i=0*t.padding,a=i/2;r.attr(`rx`,t.rx).attr(`ry`,t.ry).attr(`x`,t.x-t.width/2-a).attr(`y`,t.y-t.height/2-a).attr(`width`,t.width+i).attr(`height`,t.height+i).attr(`fill`,`none`);let o=r.node().getBBox();return t.width=o.width,t.height=o.height,t.intersect=function(e){return f(t,e)},{cluster:n,labelBBox:{width:0,height:0}}},`noteGroup`),y=e(async(e,t)=>{let i=r(),{theme:o,themeVariables:s,handDrawnSeed:c}=i,{altBackground:l,borderColorArray:h,compositeBackground:g,compositeTitleBackground:_,nodeBorder:v}=s,y=e.insert(`g`).attr(`class`,t.cssClasses).attr(`id`,t.domId).attr(`data-id`,t.id).attr(`data-look`,t.look);u(y,t.colorIndex,o,h);let b=y.insert(`g`,`:first-child`),x=y.insert(`g`).attr(`class`,`cluster-label`),S=y.append(`rect`),C=await m(x,t.label,t.labelStyle,void 0,!0),w=C.getBBox();if(a(i)){let e=C.children[0],t=n(C);w=e.getBoundingClientRect(),t.attr(`width`,w.width),t.attr(`height`,w.height)}let T=0*t.padding,E=T/2,D=(t.width<=w.width+t.padding?w.width+t.padding:t.width)+T;t.diff=t.width<=w.width+t.padding?(D-t.width)/2-t.padding:-t.padding;let O=t.height+T,k=t.height+T-w.height-6,A=t.x-D/2,j=t.y-O/2;t.width=D;let M=t.y-t.height/2-E+w.height+2,N;if(t.look===`handDrawn`){let e=t.cssClasses.includes(`statediagram-cluster-alt`),n=d.svg(y),r=t.rx||t.ry?n.path(p(A,j,D,O,10),{roughness:.7,fill:_,fillStyle:`solid`,stroke:v,seed:c}):n.rectangle(A,j,D,O,{seed:c});N=y.insert(()=>r,`:first-child`);let i=n.rectangle(A,M,D,k,{fill:e?l:g,fillStyle:e?`hachure`:`solid`,stroke:v,seed:c});N=y.insert(()=>r,`:first-child`),S=y.insert(()=>i),N.attr(`class`,`outer`),S.attr(`class`,`inner`)}else N=b.insert(`rect`,`:first-child`),N.attr(`class`,`outer`).attr(`x`,A).attr(`y`,j).attr(`width`,D).attr(`height`,O).attr(`data-look`,t.look),S.attr(`class`,`inner`).attr(`x`,A).attr(`y`,M).attr(`width`,D).attr(`height`,k);return x.attr(`transform`,`translate(${t.x-w.width/2}, ${j+1-(a(i)?0:3)})`),t.height=N.node().getBBox().height,t.offsetX=0,t.offsetY=w.height-t.padding/2,t.labelBBox=w,t.intersect=function(e){return f(t,e)},{cluster:y,labelBBox:w}},`roundedWithTitle`),b=e(async(e,i)=>{t.info(`Creating subgraph rect for `,i.id,i);let l=r(),{themeVariables:u,handDrawnSeed:m}=l,{clusterBkg:g,clusterBorder:_}=u,{labelStyles:v,nodeStyles:y,borderStyles:b,backgroundStyles:x}=c(i),S=e.insert(`g`).attr(`class`,`cluster `+i.cssClasses).attr(`id`,i.domId).attr(`data-look`,i.look),C=a(l),w=S.insert(`g`).attr(`class`,`cluster-label `),T=await o(w,i.label,{style:i.labelStyle,useHtmlLabels:C,isNode:!0,width:i.width}),E=T.getBBox();if(a(l)){let e=T.children[0],t=n(T);E=e.getBoundingClientRect(),t.attr(`width`,E.width),t.attr(`height`,E.height)}let D=i.width<=E.width+i.padding?E.width+i.padding:i.width;i.diff=i.width<=E.width+i.padding?(D-i.width)/2-i.padding:-i.padding;let O=i.height,k=i.x-D/2,A=i.y-O/2;t.trace(`Data `,i,JSON.stringify(i));let j;if(i.look===`handDrawn`){let e=d.svg(S),n=s(i,{roughness:.7,fill:g,stroke:_,fillWeight:4,seed:m}),r=e.path(p(k,A,D,O,i.rx),n);j=S.insert(()=>(t.debug(`Rough node insert CXC`,r),r),`:first-child`),j.select(`path:nth-child(2)`).attr(`style`,b.join(`;`)),j.select(`path`).attr(`style`,x.join(`;`).replace(`fill`,`stroke`))}else j=S.insert(`rect`,`:first-child`),j.attr(`style`,y).attr(`rx`,i.rx).attr(`ry`,i.ry).attr(`x`,k).attr(`y`,A).attr(`width`,D).attr(`height`,O);let{subGraphTitleTopMargin:M}=h(l);if(w.attr(`transform`,`translate(${i.x-E.width/2}, ${i.y-i.height/2+M})`),v){let e=w.select(`span`);e&&e.attr(`style`,v)}let N=j.node().getBBox();return i.offsetX=0,i.width=N.width,i.height=N.height,i.offsetY=E.height-i.padding/2,i.intersect=function(e){return f(i,e)},{cluster:S,labelBBox:E}},`kanbanSection`),x=e((e,t)=>{let{theme:n,themeVariables:i,handDrawnSeed:a}=r(),{altBackground:o,nodeBorder:s,borderColorArray:c}=i,l=e.insert(`g`).attr(`class`,t.cssClasses).attr(`id`,t.domId).attr(`data-look`,t.look);u(l,t.colorIndex,n,c);let p=l.insert(`g`,`:first-child`),m=0*t.padding,h=t.width+m;t.diff=-t.padding;let g=t.height+m,_=t.x-h/2,v=t.y-g/2;t.width=h;let y;if(t.look===`handDrawn`){let e=d.svg(l).rectangle(_,v,h,g,{fill:o??`#efefef`,fillStyle:`solid`,roughness:.5,strokeLineDash:[5],stroke:s,seed:a});y=l.insert(()=>e,`:first-child`).attr(`class`,`divider`)}else{y=p.insert(`rect`,`:first-child`);let e=`outer`;e=(t.look,`divider`),y.attr(`class`,e).attr(`x`,_).attr(`y`,v).attr(`width`,h).attr(`height`,g).attr(`data-look`,t.look)}return t.height=y.node().getBBox().height,t.offsetX=0,t.offsetY=0,t.intersect=function(e){return f(t,e)},{cluster:l,labelBBox:{}}},`divider`),S=e(async(e,i,l)=>{t.info(`Creating ${l.cssClass} for `,i.id,i);let g=r(),{theme:_,themeVariables:v,handDrawnSeed:y}=g,{borderColorArray:b}=v,{labelStyles:x,borderStyles:S}=c(i),C=e.insert(`g`).attr(`class`,`cluster `+l.cssClass+` `+i.cssClasses).attr(`id`,i.domId??i.id).attr(`data-look`,i.look);u(C,i.colorIndex,_,b);let w=a(g),T=C.insert(`g`).attr(`class`,`cluster-label`),E={width:0,height:0},D=i.label?.trim();if(D){let e;if(e=i.labelType===`markdown`?await o(T,i.label,{style:i.labelStyle,useHtmlLabels:w,isNode:!0,width:i.width}):await m(T,i.label,i.labelStyle||``,!1,!0),E=e.getBBox(),w){let t=e.children[0],r=n(e);E=t.getBoundingClientRect(),r.attr(`width`,E.width),r.attr(`height`,E.height)}}let O=i.width<=E.width+i.padding?E.width+i.padding:i.width;i.diff=i.width<=E.width+i.padding?(O-i.width)/2-i.padding:-i.padding;let k=i.height,A=i.x-O/2,j=i.y-k/2,M;if(i.look===`handDrawn`){let e=d.svg(C),t=s(i,{roughness:l.roughness,fill:l.fill,stroke:l.stroke,strokeWidth:l.strokeWidth,seed:y,...l.fill===`none`?{fillWeight:0}:{fillStyle:`solid`},...l.strokeDash?{strokeLineDash:l.strokeDash}:{}}),n=e.path(p(A,j,O,k,l.rx),t);M=C.insert(()=>n,`:first-child`),M.select(`path:nth-child(2)`).attr(`style`,S.join(`;`))}else M=C.insert(`rect`,`:first-child`),M.attr(`rx`,l.rx).attr(`ry`,l.rx).attr(`x`,A).attr(`y`,j).attr(`width`,O).attr(`height`,k).attr(`fill`,l.fill).attr(`stroke`,l.stroke).attr(`stroke-width`,l.strokeWidth+`px`),l.strokeDash&&M.attr(`stroke-dasharray`,l.strokeDash.join(`, `));if(D){let{subGraphTitleTopMargin:e}=h(g);if(T.attr(`transform`,`translate(${i.x-E.width/2}, ${i.y-i.height/2+e})`),x){let e=T.select(`span`);e&&e.attr(`style`,x)}}let N=M.node().getBBox();return i.offsetX=0,i.width=N.width,i.height=N.height,i.offsetY=E.height-i.padding/2,i.intersect=function(e){return f(i,e)},{cluster:C,labelBBox:E}},`createContainerGroup`),C=e(async(e,t)=>{let{themeVariables:n}=r();return S(e,t,{cssClass:`flow-cluster`,rx:10,fill:`none`,stroke:n.flowContainerStroke||n.secondaryBorderColor,strokeWidth:.75,roughness:.7})},`flowGroup`),w=e((e,t)=>{let n=e.boundaryType||`rect`,r=n===`package`?20:e.padding,i=n===`package`?t.height+10:0,a=Math.max(e.width,t.width+r),o=n===`package`?Math.max(e.height,i+e.padding*2):e.height,s=e.x-a/2,c=e.y-o/2;return{boundaryType:n,width:a,height:o,x:s,y:c,bodyY:c+i,bodyHeight:o-i,tabHeight:i,tabWidth:n===`package`?Math.min(a,Math.max(80,t.width+20)):0}},`getUsecaseSystemBoundaryGeometry`),T={rect:_,squareRect:_,roundedWithTitle:y,noteGroup:v,divider:x,kanbanSection:b,flowGroup:C,usecaseSystemBoundary:e(async(e,i)=>{t.info(`Creating usecase system boundary for `,i.id,i);let p=r(),{theme:m,themeVariables:g,handDrawnSeed:_}=p,{clusterBkg:v,clusterBorder:y,borderColorArray:b}=g,{labelStyles:x,nodeStyles:S}=c(i),{stylesMap:C}=l(i),T=i.boundaryType||`rect`,E=e.insert(`g`).attr(`class`,`cluster usecase-system-boundary usecase-system-boundary-${T} ${i.cssClasses}`).attr(`id`,typeof i.domId==`string`?i.domId:i.id).attr(`data-boundary-type`,T).attr(`data-look`,i.look);u(E,i.colorIndex,m,b);let D=a(p),O=E.insert(`g`).attr(`class`,`cluster-label system-boundary-title`),k=await o(O,i.label,{style:x,useHtmlLabels:D,isNode:!0}),A=k.getBBox();if(D){let e=k.children[0],t=n(k);A=e.getBoundingClientRect(),t.attr(`width`,A.width),t.attr(`height`,A.height)}let{width:j,height:M,x:N,y:P,bodyY:F,bodyHeight:I,tabHeight:L,tabWidth:R}=w(i,A);i.diff=i.width<=A.width+i.padding?(j-i.width)/2-i.padding:-i.padding;let z=s(i,{fill:C.get(`fill`)||v,stroke:C.get(`stroke`)||y,strokeWidth:C.get(`stroke-width`)?.replace(`px`,``)||1,seed:_});if(i.look===`handDrawn`){let e=d.svg(E),t=e.rectangle(N,F,j,I,z);if(E.insert(()=>t,`:first-child`).attr(`class`,`boundary-body label-container`),T===`package`){let t=e.rectangle(N,P,R,L,z);E.insert(()=>t,`:first-child`).attr(`class`,`boundary-tab system-boundary-package-tab label-container`)}}else E.insert(`rect`,`:first-child`).attr(`class`,`boundary-body label-container`).attr(`style`,S).attr(`x`,N).attr(`y`,F).attr(`width`,j).attr(`height`,I),T===`package`&&E.insert(`rect`,`:first-child`).attr(`class`,`boundary-tab system-boundary-package-tab label-container`).attr(`style`,S).attr(`x`,N).attr(`y`,P).attr(`width`,R).attr(`height`,L);let{subGraphTitleTopMargin:B}=h(p);return T===`package`?O.attr(`transform`,`translate(${N+(R-A.width)/2}, ${P+(L-A.height)/2})`):O.attr(`transform`,`translate(${i.x-A.width/2}, ${P+B})`),x&&(O.attr(`style`,x),O.select(`span`).attr(`style`,x)),i.offsetX=0,i.width=j,i.height=M,i.offsetY=A.height-i.padding/2,i.labelBBox=A,i.intersect=function(e){return f(i,e)},{cluster:E,labelBBox:A}},`usecaseSystemBoundary`),swimlane:g},E=new Set([`noteGroup`,`divider`]),D=e(e=>!E.has(e??`rect`),`clusterPaintsTitle`),O=new Map,k=e(async(e,t)=>{let n=await T[t.shape||`rect`](e,t);return O.set(t.id,n),n},`insertCluster`),A=e(()=>{O=new Map},`clear`);export{D as n,k as r,A as t};