@standarx/graph 0.0.0-stage → 1.1.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.fr.md +438 -0
  3. package/README.md +437 -2
  4. package/THIRD_PARTY_NOTICES.md +22 -0
  5. package/assets/fonts/Inter-Regular.ttf +0 -0
  6. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  7. package/assets/fonts/OFL.txt +92 -0
  8. package/dist/adapter-0bggwh8x.js +393 -0
  9. package/dist/cli-4m00785g.js +20 -0
  10. package/dist/cli-5v9761s9.js +330 -0
  11. package/dist/cli-9f1pdw5q.js +462 -0
  12. package/dist/cli-a4ax1vkc.js +172 -0
  13. package/dist/cli-abzdy8pn.js +1144 -0
  14. package/dist/cli-gh5166k6.js +1565 -0
  15. package/dist/cli-m29a3wgx.js +579 -0
  16. package/dist/cli-mzmjkk5v.js +11 -0
  17. package/dist/cli-nhmh6yxk.js +2485 -0
  18. package/dist/cli-nyckgf1t.js +4 -0
  19. package/dist/cli-sfdqkbd1.js +433 -0
  20. package/dist/cli-txrzzr2q.js +0 -0
  21. package/dist/cli-vecew2na.js +709 -0
  22. package/dist/cli-wt9dmbhm.js +560 -0
  23. package/dist/cli-ywgtv1cg.js +39 -0
  24. package/dist/cli-z3ccx2y4.js +141 -0
  25. package/dist/cli.d.ts +2 -0
  26. package/dist/cli.js +413 -0
  27. package/dist/core/index.d.ts +6 -0
  28. package/dist/core/index.js +91 -0
  29. package/dist/core/spatial.d.ts +16 -0
  30. package/dist/core/threshold.d.ts +1 -0
  31. package/dist/core/view.d.ts +80 -0
  32. package/dist/export/index.d.ts +18 -0
  33. package/dist/export/index.js +170 -0
  34. package/dist/export/pdf.d.ts +5 -0
  35. package/dist/export/png.d.ts +4 -0
  36. package/dist/format/index.d.ts +4 -0
  37. package/dist/format/index.js +69 -0
  38. package/dist/format/json-schema.d.ts +2 -0
  39. package/dist/format/schema.d.ts +787 -0
  40. package/dist/format/semantic/er.d.ts +3 -0
  41. package/dist/format/semantic/graph.d.ts +3 -0
  42. package/dist/format/semantic/sequence.d.ts +3 -0
  43. package/dist/format/semantic/shared.d.ts +14 -0
  44. package/dist/format/semantic/state.d.ts +3 -0
  45. package/dist/format/semantic/tree.d.ts +3 -0
  46. package/dist/format/transition-label.d.ts +2 -0
  47. package/dist/format/validate.d.ts +11 -0
  48. package/dist/html/index.d.ts +3 -0
  49. package/dist/html/index.js +125 -0
  50. package/dist/html/layout-worker.d.ts +1 -0
  51. package/dist/html/layout-worker.generated.d.ts +1 -0
  52. package/dist/html/mount.d.ts +12 -0
  53. package/dist/html/page.d.ts +14 -0
  54. package/dist/html/render.d.ts +7 -0
  55. package/dist/html/runtime.d.ts +1 -0
  56. package/dist/html/runtime.generated.d.ts +1 -0
  57. package/dist/html/shell.d.ts +10 -0
  58. package/dist/html/svg-adapter.d.ts +8 -0
  59. package/dist/html/ui.d.ts +34 -0
  60. package/dist/language/actions.d.ts +3 -0
  61. package/dist/language/analysis.d.ts +38 -0
  62. package/dist/language/complete.d.ts +3 -0
  63. package/dist/language/diagnostics.d.ts +14 -0
  64. package/dist/language/docs.d.ts +11 -0
  65. package/dist/language/format.d.ts +17 -0
  66. package/dist/language/hover.d.ts +3 -0
  67. package/dist/language/index.d.ts +8 -0
  68. package/dist/language/index.js +1560 -0
  69. package/dist/language/navigation.d.ts +9 -0
  70. package/dist/language/positions.d.ts +7 -0
  71. package/dist/language/symbols.d.ts +3 -0
  72. package/dist/language/types.d.ts +46 -0
  73. package/dist/layout/elk.d.ts +35 -0
  74. package/dist/layout/er.d.ts +3 -0
  75. package/dist/layout/font-metrics.d.ts +9 -0
  76. package/dist/layout/graph.d.ts +3 -0
  77. package/dist/layout/index.d.ts +5 -0
  78. package/dist/layout/index.js +16 -0
  79. package/dist/layout/measure.d.ts +10 -0
  80. package/dist/layout/sequence.d.ts +3 -0
  81. package/dist/layout/shapes.d.ts +16 -0
  82. package/dist/layout/shared.d.ts +31 -0
  83. package/dist/layout/state.d.ts +3 -0
  84. package/dist/layout/tree.d.ts +3 -0
  85. package/dist/layout/types.d.ts +198 -0
  86. package/dist/layout-worker.generated-xsmtzrfj.js +34 -0
  87. package/dist/mermaid/common.d.ts +36 -0
  88. package/dist/mermaid/er.d.ts +3 -0
  89. package/dist/mermaid/graph.d.ts +4 -0
  90. package/dist/mermaid/index.d.ts +6 -0
  91. package/dist/mermaid/index.js +6 -0
  92. package/dist/mermaid/mindmap.d.ts +3 -0
  93. package/dist/mermaid/sequence.d.ts +3 -0
  94. package/dist/mermaid/state.d.ts +3 -0
  95. package/dist/remark/index.d.ts +9 -0
  96. package/dist/remark/index.js +102 -0
  97. package/dist/shared/errors.d.ts +6 -0
  98. package/dist/shared/package-root.d.ts +5 -0
  99. package/dist/svg/escape.d.ts +1 -0
  100. package/dist/svg/index.d.ts +3 -0
  101. package/dist/svg/index.js +25 -0
  102. package/dist/svg/render.d.ts +9 -0
  103. package/dist/svg/theme.d.ts +62 -0
  104. package/dist/svg-adapter-gq5vmp6q.js +227 -0
  105. package/dist/text/build.d.ts +10 -0
  106. package/dist/text/canonical.d.ts +10 -0
  107. package/dist/text/errors.d.ts +33 -0
  108. package/dist/text/highlight.d.ts +13 -0
  109. package/dist/text/index.d.ts +33 -0
  110. package/dist/text/index.js +25 -0
  111. package/dist/text/lexer.d.ts +29 -0
  112. package/dist/text/parser.d.ts +160 -0
  113. package/dist/text/print.d.ts +6 -0
  114. package/dist/text/slug.d.ts +1 -0
  115. package/dist/text/syntax.d.ts +8 -0
  116. package/dist/version.d.ts +1 -0
  117. package/dist/webgl/adapter.d.ts +4 -0
  118. package/dist/webgl/index.d.ts +7 -0
  119. package/dist/webgl/index.js +15 -0
  120. package/dist/webgl/runtime.d.ts +1 -0
  121. package/dist/webgl/runtime.generated.d.ts +1 -0
  122. package/grammars/standargraph.tmLanguage.json +599 -0
  123. package/language-configuration.json +35 -0
  124. package/licenses/EPL-2.0.txt +277 -0
  125. package/licenses/MPL-2.0.txt +373 -0
  126. package/package.json +133 -4
  127. package/schema/graph-document.v1.json +1737 -0
@@ -0,0 +1,1565 @@
1
+ // src/layout/font-metrics.ts
2
+ var FONT_METRICS = {
3
+ regular: {
4
+ unitsPerEm: 2048,
5
+ ascender: 1984,
6
+ descender: -494,
7
+ fallback: 1098,
8
+ advances: {
9
+ 32: 576,
10
+ 33: 589,
11
+ 34: 954,
12
+ 35: 1297,
13
+ 36: 1314,
14
+ 37: 2011,
15
+ 38: 1319,
16
+ 39: 614,
17
+ 40: 747,
18
+ 41: 747,
19
+ 42: 1026,
20
+ 43: 1355,
21
+ 44: 590,
22
+ 45: 942,
23
+ 46: 590,
24
+ 47: 738,
25
+ 48: 1292,
26
+ 49: 833,
27
+ 50: 1249,
28
+ 51: 1265,
29
+ 52: 1323,
30
+ 53: 1215,
31
+ 54: 1270,
32
+ 55: 1159,
33
+ 56: 1267,
34
+ 57: 1270,
35
+ 58: 590,
36
+ 59: 618,
37
+ 60: 1355,
38
+ 61: 1355,
39
+ 62: 1355,
40
+ 63: 1047,
41
+ 64: 1978,
42
+ 65: 1413,
43
+ 66: 1340,
44
+ 67: 1496,
45
+ 68: 1478,
46
+ 69: 1231,
47
+ 70: 1209,
48
+ 71: 1528,
49
+ 72: 1522,
50
+ 73: 550,
51
+ 74: 1169,
52
+ 75: 1376,
53
+ 76: 1158,
54
+ 77: 1850,
55
+ 78: 1543,
56
+ 79: 1566,
57
+ 80: 1308,
58
+ 81: 1566,
59
+ 82: 1318,
60
+ 83: 1314,
61
+ 84: 1322,
62
+ 85: 1524,
63
+ 86: 1413,
64
+ 87: 2018,
65
+ 88: 1397,
66
+ 89: 1390,
67
+ 90: 1288,
68
+ 91: 747,
69
+ 92: 738,
70
+ 93: 747,
71
+ 94: 965,
72
+ 95: 934,
73
+ 96: 661,
74
+ 97: 1150,
75
+ 98: 1254,
76
+ 99: 1170,
77
+ 100: 1254,
78
+ 101: 1194,
79
+ 102: 758,
80
+ 103: 1256,
81
+ 104: 1211,
82
+ 105: 496,
83
+ 106: 496,
84
+ 107: 1124,
85
+ 108: 496,
86
+ 109: 1794,
87
+ 110: 1210,
88
+ 111: 1228,
89
+ 112: 1254,
90
+ 113: 1254,
91
+ 114: 771,
92
+ 115: 1081,
93
+ 116: 670,
94
+ 117: 1211,
95
+ 118: 1151,
96
+ 119: 1676,
97
+ 120: 1118,
98
+ 121: 1151,
99
+ 122: 1131,
100
+ 123: 873,
101
+ 124: 681,
102
+ 125: 873,
103
+ 126: 1355,
104
+ 160: 576,
105
+ 161: 589,
106
+ 162: 1170,
107
+ 163: 1251,
108
+ 164: 1484,
109
+ 165: 1126,
110
+ 166: 553,
111
+ 167: 1164,
112
+ 168: 1210,
113
+ 169: 1872,
114
+ 170: 929,
115
+ 171: 1193,
116
+ 172: 1355,
117
+ 174: 1364,
118
+ 175: 978,
119
+ 176: 933,
120
+ 177: 1355,
121
+ 178: 905,
122
+ 179: 913,
123
+ 180: 661,
124
+ 181: 1200,
125
+ 182: 1234,
126
+ 183: 590,
127
+ 184: 549,
128
+ 185: 623,
129
+ 186: 988,
130
+ 187: 1193,
131
+ 188: 1643,
132
+ 189: 1735,
133
+ 190: 1806,
134
+ 191: 1047,
135
+ 192: 1413,
136
+ 193: 1413,
137
+ 194: 1413,
138
+ 195: 1413,
139
+ 196: 1413,
140
+ 197: 1413,
141
+ 198: 2035,
142
+ 199: 1496,
143
+ 200: 1231,
144
+ 201: 1231,
145
+ 202: 1231,
146
+ 203: 1231,
147
+ 204: 550,
148
+ 205: 550,
149
+ 206: 550,
150
+ 207: 550,
151
+ 208: 1505,
152
+ 209: 1543,
153
+ 210: 1566,
154
+ 211: 1566,
155
+ 212: 1566,
156
+ 213: 1566,
157
+ 214: 1566,
158
+ 215: 1355,
159
+ 216: 1566,
160
+ 217: 1524,
161
+ 218: 1524,
162
+ 219: 1524,
163
+ 220: 1524,
164
+ 221: 1390,
165
+ 222: 1302,
166
+ 223: 1262,
167
+ 224: 1150,
168
+ 225: 1150,
169
+ 226: 1150,
170
+ 227: 1150,
171
+ 228: 1150,
172
+ 229: 1150,
173
+ 230: 1879,
174
+ 231: 1170,
175
+ 232: 1194,
176
+ 233: 1194,
177
+ 234: 1194,
178
+ 235: 1194,
179
+ 236: 496,
180
+ 237: 496,
181
+ 238: 496,
182
+ 239: 496,
183
+ 240: 1193,
184
+ 241: 1210,
185
+ 242: 1228,
186
+ 243: 1228,
187
+ 244: 1228,
188
+ 245: 1228,
189
+ 246: 1228,
190
+ 247: 1355,
191
+ 248: 1228,
192
+ 249: 1211,
193
+ 250: 1211,
194
+ 251: 1211,
195
+ 252: 1211,
196
+ 253: 1151,
197
+ 254: 1254,
198
+ 255: 1151,
199
+ 256: 1413,
200
+ 257: 1150,
201
+ 258: 1413,
202
+ 259: 1150,
203
+ 260: 1413,
204
+ 261: 1150,
205
+ 262: 1496,
206
+ 263: 1170,
207
+ 264: 1496,
208
+ 265: 1170,
209
+ 266: 1496,
210
+ 267: 1170,
211
+ 268: 1496,
212
+ 269: 1170,
213
+ 270: 1478,
214
+ 271: 1454,
215
+ 272: 1505,
216
+ 273: 1254,
217
+ 274: 1231,
218
+ 275: 1194,
219
+ 276: 1231,
220
+ 277: 1194,
221
+ 278: 1231,
222
+ 279: 1194,
223
+ 280: 1231,
224
+ 281: 1194,
225
+ 282: 1231,
226
+ 283: 1194,
227
+ 284: 1528,
228
+ 285: 1256,
229
+ 286: 1528,
230
+ 287: 1256,
231
+ 288: 1528,
232
+ 289: 1256,
233
+ 290: 1528,
234
+ 291: 1256,
235
+ 292: 1522,
236
+ 293: 1211,
237
+ 294: 1590,
238
+ 295: 1211,
239
+ 296: 550,
240
+ 297: 496,
241
+ 298: 550,
242
+ 299: 496,
243
+ 300: 550,
244
+ 301: 496,
245
+ 302: 550,
246
+ 303: 496,
247
+ 304: 550,
248
+ 305: 496,
249
+ 306: 1719,
250
+ 307: 992,
251
+ 308: 1169,
252
+ 309: 496,
253
+ 310: 1376,
254
+ 311: 1124,
255
+ 312: 1076,
256
+ 313: 1158,
257
+ 314: 496,
258
+ 315: 1158,
259
+ 316: 496,
260
+ 317: 1158,
261
+ 318: 696,
262
+ 319: 1152,
263
+ 320: 736,
264
+ 321: 1218,
265
+ 322: 496,
266
+ 323: 1543,
267
+ 324: 1210,
268
+ 325: 1543,
269
+ 326: 1210,
270
+ 327: 1543,
271
+ 328: 1210,
272
+ 330: 1543,
273
+ 331: 1210,
274
+ 332: 1566,
275
+ 333: 1228,
276
+ 334: 1566,
277
+ 335: 1228,
278
+ 336: 1566,
279
+ 337: 1228,
280
+ 338: 2058,
281
+ 339: 2047,
282
+ 340: 1318,
283
+ 341: 771,
284
+ 342: 1318,
285
+ 343: 771,
286
+ 344: 1318,
287
+ 345: 771,
288
+ 346: 1314,
289
+ 347: 1081,
290
+ 348: 1314,
291
+ 349: 1081,
292
+ 350: 1314,
293
+ 351: 1081,
294
+ 352: 1314,
295
+ 353: 1081,
296
+ 354: 1322,
297
+ 355: 670,
298
+ 356: 1322,
299
+ 357: 770,
300
+ 358: 1322,
301
+ 359: 670,
302
+ 360: 1524,
303
+ 361: 1211,
304
+ 362: 1524,
305
+ 363: 1211,
306
+ 364: 1524,
307
+ 365: 1211,
308
+ 366: 1524,
309
+ 367: 1211,
310
+ 368: 1524,
311
+ 369: 1211,
312
+ 370: 1524,
313
+ 371: 1211,
314
+ 372: 2018,
315
+ 373: 1676,
316
+ 374: 1390,
317
+ 375: 1151,
318
+ 376: 1390,
319
+ 377: 1288,
320
+ 378: 1131,
321
+ 379: 1288,
322
+ 380: 1131,
323
+ 381: 1288,
324
+ 382: 1131,
325
+ 383: 644,
326
+ 384: 1254,
327
+ 385: 1620,
328
+ 386: 1344,
329
+ 387: 1254,
330
+ 388: 1611,
331
+ 389: 1420,
332
+ 390: 1496,
333
+ 391: 1496,
334
+ 392: 1185,
335
+ 393: 1505,
336
+ 394: 1758,
337
+ 395: 1298,
338
+ 396: 1254,
339
+ 397: 1112,
340
+ 398: 1231,
341
+ 399: 1528,
342
+ 400: 1265,
343
+ 401: 1209,
344
+ 402: 798,
345
+ 403: 1528,
346
+ 404: 1302,
347
+ 405: 1949,
348
+ 406: 564,
349
+ 407: 690,
350
+ 408: 1389,
351
+ 409: 1124,
352
+ 410: 496,
353
+ 411: 1314,
354
+ 412: 1859,
355
+ 413: 1543,
356
+ 414: 1211,
357
+ 415: 1566,
358
+ 416: 1560,
359
+ 417: 1222,
360
+ 418: 1784,
361
+ 419: 1307,
362
+ 420: 1588,
363
+ 421: 1254,
364
+ 422: 1486,
365
+ 423: 1314,
366
+ 424: 1081,
367
+ 425: 1292,
368
+ 426: 1120,
369
+ 427: 670,
370
+ 428: 1327,
371
+ 429: 661,
372
+ 430: 1322,
373
+ 431: 1518,
374
+ 432: 1269,
375
+ 433: 1567,
376
+ 434: 1299,
377
+ 435: 1460,
378
+ 436: 1390,
379
+ 437: 1288,
380
+ 438: 1131,
381
+ 439: 1402,
382
+ 440: 1402,
383
+ 441: 1270,
384
+ 442: 1109,
385
+ 443: 1249,
386
+ 444: 1247,
387
+ 445: 1115,
388
+ 446: 1112,
389
+ 447: 1298,
390
+ 448: 546,
391
+ 449: 734,
392
+ 450: 496,
393
+ 451: 589,
394
+ 453: 2609,
395
+ 454: 2385,
396
+ 455: 2327,
397
+ 456: 1654,
398
+ 457: 992,
399
+ 458: 2712,
400
+ 459: 2039,
401
+ 460: 1706,
402
+ 461: 1413,
403
+ 462: 1150,
404
+ 463: 550,
405
+ 464: 496,
406
+ 465: 1566,
407
+ 466: 1228,
408
+ 467: 1524,
409
+ 468: 1211,
410
+ 469: 1524,
411
+ 470: 1211,
412
+ 471: 1524,
413
+ 472: 1211,
414
+ 473: 1524,
415
+ 474: 1211,
416
+ 475: 1524,
417
+ 476: 1211,
418
+ 477: 1194,
419
+ 478: 1413,
420
+ 479: 1150,
421
+ 480: 1413,
422
+ 481: 1150,
423
+ 482: 2035,
424
+ 483: 1879,
425
+ 484: 1528,
426
+ 485: 1376,
427
+ 486: 1528,
428
+ 487: 1256,
429
+ 488: 1376,
430
+ 489: 1124,
431
+ 490: 1566,
432
+ 491: 1228,
433
+ 492: 1566,
434
+ 493: 1228,
435
+ 494: 1402,
436
+ 495: 1270,
437
+ 496: 496,
438
+ 497: 2766,
439
+ 498: 2609,
440
+ 499: 2385,
441
+ 500: 1528,
442
+ 501: 1256,
443
+ 502: 2290,
444
+ 503: 1302,
445
+ 504: 1543,
446
+ 505: 1210,
447
+ 506: 1413,
448
+ 507: 1150,
449
+ 508: 2035,
450
+ 509: 1879,
451
+ 510: 1566,
452
+ 511: 1228,
453
+ 512: 1413,
454
+ 513: 1150,
455
+ 514: 1413,
456
+ 515: 1150,
457
+ 516: 1231,
458
+ 517: 1194,
459
+ 518: 1231,
460
+ 519: 1194,
461
+ 520: 550,
462
+ 521: 496,
463
+ 522: 550,
464
+ 523: 496,
465
+ 524: 1566,
466
+ 525: 1228,
467
+ 526: 1566,
468
+ 527: 1228,
469
+ 528: 1318,
470
+ 529: 771,
471
+ 530: 1318,
472
+ 531: 771,
473
+ 532: 1524,
474
+ 533: 1211,
475
+ 534: 1524,
476
+ 535: 1211,
477
+ 536: 1314,
478
+ 537: 1081,
479
+ 538: 1322,
480
+ 539: 670,
481
+ 540: 1298,
482
+ 541: 1113,
483
+ 542: 1522,
484
+ 543: 1211,
485
+ 544: 1295,
486
+ 545: 1574,
487
+ 546: 1295,
488
+ 547: 1294,
489
+ 548: 1288,
490
+ 549: 1131,
491
+ 550: 1413,
492
+ 551: 1150,
493
+ 552: 1231,
494
+ 553: 1194,
495
+ 554: 1566,
496
+ 555: 1228,
497
+ 556: 1566,
498
+ 557: 1228,
499
+ 558: 1566,
500
+ 559: 1228,
501
+ 560: 1566,
502
+ 561: 1228,
503
+ 562: 1390,
504
+ 563: 1151,
505
+ 564: 816,
506
+ 565: 1530,
507
+ 566: 836,
508
+ 567: 496,
509
+ 568: 1853,
510
+ 569: 1853,
511
+ 570: 1413,
512
+ 571: 1496,
513
+ 572: 1170,
514
+ 573: 1185,
515
+ 574: 1322,
516
+ 575: 1081,
517
+ 576: 1131,
518
+ 577: 1112,
519
+ 578: 1113,
520
+ 579: 1340,
521
+ 580: 1518,
522
+ 581: 1486,
523
+ 582: 1231,
524
+ 583: 1194,
525
+ 584: 1239,
526
+ 585: 496,
527
+ 586: 1566,
528
+ 587: 1254,
529
+ 588: 1326,
530
+ 589: 771,
531
+ 590: 1368,
532
+ 591: 1151,
533
+ 8192: 1118,
534
+ 8193: 2234,
535
+ 8194: 1024,
536
+ 8195: 2048,
537
+ 8196: 684,
538
+ 8197: 512,
539
+ 8198: 340,
540
+ 8199: 1328,
541
+ 8200: 590,
542
+ 8201: 372,
543
+ 8202: 186,
544
+ 8203: 0,
545
+ 8208: 734,
546
+ 8209: 734,
547
+ 8210: 1328,
548
+ 8211: 1024,
549
+ 8212: 2048,
550
+ 8213: 2048,
551
+ 8214: 981,
552
+ 8215: 927,
553
+ 8216: 534,
554
+ 8217: 534,
555
+ 8218: 494,
556
+ 8219: 534,
557
+ 8220: 902,
558
+ 8221: 902,
559
+ 8222: 862,
560
+ 8223: 902,
561
+ 8224: 1006,
562
+ 8225: 1006,
563
+ 8226: 1152,
564
+ 8227: 1152,
565
+ 8228: 590,
566
+ 8229: 1180,
567
+ 8230: 1770,
568
+ 8231: 590,
569
+ 8239: 372,
570
+ 8240: 2735,
571
+ 8241: 3459,
572
+ 8242: 456,
573
+ 8243: 906,
574
+ 8244: 1356,
575
+ 8245: 456,
576
+ 8246: 906,
577
+ 8247: 1356,
578
+ 8248: 932,
579
+ 8249: 787,
580
+ 8250: 787,
581
+ 8251: 1310,
582
+ 8252: 1178,
583
+ 8253: 1038,
584
+ 8254: 1106,
585
+ 8255: 1673,
586
+ 8256: 1673,
587
+ 8257: 926,
588
+ 8258: 1481,
589
+ 8259: 1152,
590
+ 8260: 393,
591
+ 8261: 747,
592
+ 8262: 747,
593
+ 8263: 2094,
594
+ 8264: 1636,
595
+ 8265: 1636,
596
+ 8266: 910,
597
+ 8267: 1234,
598
+ 8268: 1212,
599
+ 8269: 1212,
600
+ 8270: 1026,
601
+ 8271: 618,
602
+ 8272: 1664,
603
+ 8273: 1106,
604
+ 8274: 1513,
605
+ 8275: 1486,
606
+ 8276: 1673,
607
+ 8277: 1125,
608
+ 8279: 1806,
609
+ 8287: 576,
610
+ 8592: 1954,
611
+ 8593: 1708,
612
+ 8594: 1954,
613
+ 8595: 1708,
614
+ 8596: 2746,
615
+ 8597: 1708,
616
+ 8598: 1588,
617
+ 8599: 1588,
618
+ 8600: 1588,
619
+ 8601: 1588,
620
+ 8617: 2343,
621
+ 8618: 2343,
622
+ 8624: 2022,
623
+ 8625: 2022,
624
+ 8627: 2022,
625
+ 8628: 1709,
626
+ 8629: 2022,
627
+ 8634: 1954,
628
+ 8635: 1954,
629
+ 8656: 1954,
630
+ 8658: 1954,
631
+ 8660: 2746,
632
+ 8670: 1245,
633
+ 8671: 1245,
634
+ 8676: 2078,
635
+ 8677: 2078,
636
+ 8679: 2111,
637
+ 8682: 2111
638
+ }
639
+ },
640
+ semibold: {
641
+ unitsPerEm: 2048,
642
+ ascender: 1984,
643
+ descender: -494,
644
+ fallback: 1135,
645
+ advances: {
646
+ 32: 516,
647
+ 33: 658,
648
+ 34: 1071,
649
+ 35: 1318,
650
+ 36: 1332,
651
+ 37: 2057,
652
+ 38: 1357,
653
+ 39: 667,
654
+ 40: 764,
655
+ 41: 764,
656
+ 42: 1105,
657
+ 43: 1378,
658
+ 44: 653,
659
+ 45: 953,
660
+ 46: 653,
661
+ 47: 776,
662
+ 48: 1351,
663
+ 49: 866,
664
+ 50: 1276,
665
+ 51: 1303,
666
+ 52: 1364,
667
+ 53: 1254,
668
+ 54: 1310,
669
+ 55: 1180,
670
+ 56: 1311,
671
+ 57: 1310,
672
+ 58: 653,
673
+ 59: 674,
674
+ 60: 1378,
675
+ 61: 1378,
676
+ 62: 1378,
677
+ 63: 1113,
678
+ 64: 2046,
679
+ 65: 1490,
680
+ 66: 1350,
681
+ 67: 1509,
682
+ 68: 1479,
683
+ 69: 1240,
684
+ 70: 1204,
685
+ 71: 1534,
686
+ 72: 1527,
687
+ 73: 567,
688
+ 74: 1187,
689
+ 75: 1440,
690
+ 76: 1158,
691
+ 77: 1889,
692
+ 78: 1555,
693
+ 79: 1574,
694
+ 80: 1321,
695
+ 81: 1583,
696
+ 82: 1336,
697
+ 83: 1332,
698
+ 84: 1352,
699
+ 85: 1507,
700
+ 86: 1490,
701
+ 87: 2089,
702
+ 88: 1474,
703
+ 89: 1461,
704
+ 90: 1336,
705
+ 91: 764,
706
+ 92: 776,
707
+ 93: 764,
708
+ 94: 986,
709
+ 95: 961,
710
+ 96: 719,
711
+ 97: 1176,
712
+ 98: 1278,
713
+ 99: 1193,
714
+ 100: 1278,
715
+ 101: 1211,
716
+ 102: 796,
717
+ 103: 1281,
718
+ 104: 1254,
719
+ 105: 536,
720
+ 106: 536,
721
+ 107: 1166,
722
+ 108: 536,
723
+ 109: 1844,
724
+ 110: 1253,
725
+ 111: 1247,
726
+ 112: 1278,
727
+ 113: 1278,
728
+ 114: 813,
729
+ 115: 1125,
730
+ 116: 723,
731
+ 117: 1254,
732
+ 118: 1202,
733
+ 119: 1719,
734
+ 120: 1165,
735
+ 121: 1205,
736
+ 122: 1159,
737
+ 123: 931,
738
+ 124: 735,
739
+ 125: 931,
740
+ 126: 1378,
741
+ 160: 516,
742
+ 161: 658,
743
+ 162: 1193,
744
+ 163: 1289,
745
+ 164: 1534,
746
+ 165: 1154,
747
+ 166: 647,
748
+ 167: 1164,
749
+ 168: 1253,
750
+ 169: 1872,
751
+ 170: 943,
752
+ 171: 1299,
753
+ 172: 1378,
754
+ 174: 1359,
755
+ 175: 925,
756
+ 176: 938,
757
+ 177: 1378,
758
+ 178: 929,
759
+ 179: 949,
760
+ 180: 719,
761
+ 181: 1258,
762
+ 182: 1229,
763
+ 183: 653,
764
+ 184: 680,
765
+ 185: 663,
766
+ 186: 998,
767
+ 187: 1299,
768
+ 188: 1702,
769
+ 189: 1781,
770
+ 190: 1858,
771
+ 191: 1113,
772
+ 192: 1490,
773
+ 193: 1490,
774
+ 194: 1490,
775
+ 195: 1490,
776
+ 196: 1490,
777
+ 197: 1490,
778
+ 198: 2075,
779
+ 199: 1509,
780
+ 200: 1240,
781
+ 201: 1240,
782
+ 202: 1240,
783
+ 203: 1240,
784
+ 204: 567,
785
+ 205: 567,
786
+ 206: 567,
787
+ 207: 567,
788
+ 208: 1539,
789
+ 209: 1555,
790
+ 210: 1574,
791
+ 211: 1574,
792
+ 212: 1574,
793
+ 213: 1574,
794
+ 214: 1574,
795
+ 215: 1378,
796
+ 216: 1574,
797
+ 217: 1507,
798
+ 218: 1507,
799
+ 219: 1507,
800
+ 220: 1507,
801
+ 221: 1461,
802
+ 222: 1347,
803
+ 223: 1318,
804
+ 224: 1176,
805
+ 225: 1176,
806
+ 226: 1176,
807
+ 227: 1176,
808
+ 228: 1176,
809
+ 229: 1176,
810
+ 230: 1869,
811
+ 231: 1193,
812
+ 232: 1211,
813
+ 233: 1211,
814
+ 234: 1211,
815
+ 235: 1211,
816
+ 236: 536,
817
+ 237: 536,
818
+ 238: 536,
819
+ 239: 536,
820
+ 240: 1216,
821
+ 241: 1253,
822
+ 242: 1247,
823
+ 243: 1247,
824
+ 244: 1247,
825
+ 245: 1247,
826
+ 246: 1247,
827
+ 247: 1378,
828
+ 248: 1247,
829
+ 249: 1254,
830
+ 250: 1254,
831
+ 251: 1254,
832
+ 252: 1254,
833
+ 253: 1205,
834
+ 254: 1278,
835
+ 255: 1205,
836
+ 256: 1490,
837
+ 257: 1176,
838
+ 258: 1490,
839
+ 259: 1176,
840
+ 260: 1490,
841
+ 261: 1176,
842
+ 262: 1509,
843
+ 263: 1193,
844
+ 264: 1509,
845
+ 265: 1193,
846
+ 266: 1509,
847
+ 267: 1193,
848
+ 268: 1509,
849
+ 269: 1193,
850
+ 270: 1479,
851
+ 271: 1514,
852
+ 272: 1539,
853
+ 273: 1278,
854
+ 274: 1240,
855
+ 275: 1211,
856
+ 276: 1240,
857
+ 277: 1211,
858
+ 278: 1240,
859
+ 279: 1211,
860
+ 280: 1240,
861
+ 281: 1211,
862
+ 282: 1240,
863
+ 283: 1211,
864
+ 284: 1534,
865
+ 285: 1281,
866
+ 286: 1534,
867
+ 287: 1281,
868
+ 288: 1534,
869
+ 289: 1281,
870
+ 290: 1534,
871
+ 291: 1281,
872
+ 292: 1527,
873
+ 293: 1254,
874
+ 294: 1632,
875
+ 295: 1254,
876
+ 296: 567,
877
+ 297: 536,
878
+ 298: 567,
879
+ 299: 536,
880
+ 300: 567,
881
+ 301: 536,
882
+ 302: 567,
883
+ 303: 536,
884
+ 304: 567,
885
+ 305: 536,
886
+ 306: 1754,
887
+ 307: 1071,
888
+ 308: 1187,
889
+ 309: 536,
890
+ 310: 1440,
891
+ 311: 1166,
892
+ 312: 1160,
893
+ 313: 1158,
894
+ 314: 536,
895
+ 315: 1158,
896
+ 316: 536,
897
+ 317: 1158,
898
+ 318: 772,
899
+ 319: 1173,
900
+ 320: 858,
901
+ 321: 1232,
902
+ 322: 536,
903
+ 323: 1555,
904
+ 324: 1253,
905
+ 325: 1555,
906
+ 326: 1253,
907
+ 327: 1555,
908
+ 328: 1253,
909
+ 330: 1555,
910
+ 331: 1253,
911
+ 332: 1574,
912
+ 333: 1247,
913
+ 334: 1574,
914
+ 335: 1247,
915
+ 336: 1574,
916
+ 337: 1247,
917
+ 338: 2076,
918
+ 339: 2031,
919
+ 340: 1336,
920
+ 341: 813,
921
+ 342: 1336,
922
+ 343: 813,
923
+ 344: 1336,
924
+ 345: 813,
925
+ 346: 1332,
926
+ 347: 1125,
927
+ 348: 1332,
928
+ 349: 1125,
929
+ 350: 1332,
930
+ 351: 1125,
931
+ 352: 1332,
932
+ 353: 1125,
933
+ 354: 1352,
934
+ 355: 723,
935
+ 356: 1352,
936
+ 357: 859,
937
+ 358: 1352,
938
+ 359: 723,
939
+ 360: 1507,
940
+ 361: 1254,
941
+ 362: 1507,
942
+ 363: 1254,
943
+ 364: 1507,
944
+ 365: 1254,
945
+ 366: 1507,
946
+ 367: 1254,
947
+ 368: 1507,
948
+ 369: 1254,
949
+ 370: 1507,
950
+ 371: 1254,
951
+ 372: 2089,
952
+ 373: 1719,
953
+ 374: 1461,
954
+ 375: 1205,
955
+ 376: 1461,
956
+ 377: 1336,
957
+ 378: 1159,
958
+ 379: 1336,
959
+ 380: 1159,
960
+ 381: 1336,
961
+ 382: 1159,
962
+ 383: 685,
963
+ 384: 1278,
964
+ 385: 1702,
965
+ 386: 1343,
966
+ 387: 1278,
967
+ 388: 1694,
968
+ 389: 1500,
969
+ 390: 1509,
970
+ 391: 1509,
971
+ 392: 1241,
972
+ 393: 1539,
973
+ 394: 1831,
974
+ 395: 1345,
975
+ 396: 1278,
976
+ 397: 1251,
977
+ 398: 1240,
978
+ 399: 1534,
979
+ 400: 1303,
980
+ 401: 1204,
981
+ 402: 897,
982
+ 403: 1534,
983
+ 404: 1439,
984
+ 405: 1990,
985
+ 406: 610,
986
+ 407: 728,
987
+ 408: 1454,
988
+ 409: 1166,
989
+ 410: 536,
990
+ 411: 1370,
991
+ 412: 1918,
992
+ 413: 1555,
993
+ 414: 1254,
994
+ 415: 1574,
995
+ 416: 1584,
996
+ 417: 1243,
997
+ 418: 1865,
998
+ 419: 1440,
999
+ 420: 1673,
1000
+ 421: 1278,
1001
+ 422: 1534,
1002
+ 423: 1332,
1003
+ 424: 1125,
1004
+ 425: 1341,
1005
+ 426: 1253,
1006
+ 427: 723,
1007
+ 428: 1429,
1008
+ 429: 718,
1009
+ 430: 1352,
1010
+ 431: 1504,
1011
+ 432: 1323,
1012
+ 433: 1585,
1013
+ 434: 1343,
1014
+ 435: 1557,
1015
+ 436: 1440,
1016
+ 437: 1336,
1017
+ 438: 1159,
1018
+ 439: 1406,
1019
+ 440: 1406,
1020
+ 441: 1306,
1021
+ 442: 1152,
1022
+ 443: 1276,
1023
+ 444: 1283,
1024
+ 445: 1253,
1025
+ 446: 1154,
1026
+ 447: 1349,
1027
+ 448: 587,
1028
+ 449: 778,
1029
+ 450: 536,
1030
+ 451: 658,
1031
+ 453: 2637,
1032
+ 454: 2437,
1033
+ 455: 2345,
1034
+ 456: 1694,
1035
+ 457: 1071,
1036
+ 458: 2742,
1037
+ 459: 2090,
1038
+ 460: 1789,
1039
+ 461: 1490,
1040
+ 462: 1176,
1041
+ 463: 567,
1042
+ 464: 536,
1043
+ 465: 1574,
1044
+ 466: 1247,
1045
+ 467: 1507,
1046
+ 468: 1254,
1047
+ 469: 1507,
1048
+ 470: 1254,
1049
+ 471: 1507,
1050
+ 472: 1254,
1051
+ 473: 1507,
1052
+ 474: 1254,
1053
+ 475: 1507,
1054
+ 476: 1254,
1055
+ 477: 1211,
1056
+ 478: 1490,
1057
+ 479: 1176,
1058
+ 480: 1490,
1059
+ 481: 1176,
1060
+ 482: 2075,
1061
+ 483: 1869,
1062
+ 484: 1534,
1063
+ 485: 1400,
1064
+ 486: 1534,
1065
+ 487: 1281,
1066
+ 488: 1440,
1067
+ 489: 1166,
1068
+ 490: 1574,
1069
+ 491: 1247,
1070
+ 492: 1574,
1071
+ 493: 1247,
1072
+ 494: 1406,
1073
+ 495: 1306,
1074
+ 496: 536,
1075
+ 497: 2815,
1076
+ 498: 2637,
1077
+ 499: 2437,
1078
+ 500: 1534,
1079
+ 501: 1281,
1080
+ 502: 2298,
1081
+ 503: 1443,
1082
+ 504: 1555,
1083
+ 505: 1253,
1084
+ 506: 1490,
1085
+ 507: 1176,
1086
+ 508: 2075,
1087
+ 509: 1869,
1088
+ 510: 1574,
1089
+ 511: 1247,
1090
+ 512: 1490,
1091
+ 513: 1176,
1092
+ 514: 1490,
1093
+ 515: 1176,
1094
+ 516: 1240,
1095
+ 517: 1211,
1096
+ 518: 1240,
1097
+ 519: 1211,
1098
+ 520: 567,
1099
+ 521: 536,
1100
+ 522: 567,
1101
+ 523: 536,
1102
+ 524: 1574,
1103
+ 525: 1247,
1104
+ 526: 1574,
1105
+ 527: 1247,
1106
+ 528: 1336,
1107
+ 529: 813,
1108
+ 530: 1336,
1109
+ 531: 813,
1110
+ 532: 1507,
1111
+ 533: 1254,
1112
+ 534: 1507,
1113
+ 535: 1254,
1114
+ 536: 1332,
1115
+ 537: 1125,
1116
+ 538: 1352,
1117
+ 539: 723,
1118
+ 540: 1344,
1119
+ 541: 1155,
1120
+ 542: 1527,
1121
+ 543: 1254,
1122
+ 544: 1344,
1123
+ 545: 1598,
1124
+ 546: 1343,
1125
+ 547: 1342,
1126
+ 548: 1336,
1127
+ 549: 1159,
1128
+ 550: 1490,
1129
+ 551: 1176,
1130
+ 552: 1240,
1131
+ 553: 1211,
1132
+ 554: 1574,
1133
+ 555: 1247,
1134
+ 556: 1574,
1135
+ 557: 1247,
1136
+ 558: 1574,
1137
+ 559: 1247,
1138
+ 560: 1574,
1139
+ 561: 1247,
1140
+ 562: 1461,
1141
+ 563: 1205,
1142
+ 564: 856,
1143
+ 565: 1573,
1144
+ 566: 912,
1145
+ 567: 536,
1146
+ 568: 1912,
1147
+ 569: 1912,
1148
+ 570: 1490,
1149
+ 571: 1509,
1150
+ 572: 1193,
1151
+ 573: 1218,
1152
+ 574: 1352,
1153
+ 575: 1125,
1154
+ 576: 1159,
1155
+ 577: 1154,
1156
+ 578: 1155,
1157
+ 579: 1379,
1158
+ 580: 1541,
1159
+ 581: 1534,
1160
+ 582: 1240,
1161
+ 583: 1211,
1162
+ 584: 1268,
1163
+ 585: 536,
1164
+ 586: 1578,
1165
+ 587: 1278,
1166
+ 588: 1361,
1167
+ 589: 813,
1168
+ 590: 1439,
1169
+ 591: 1205,
1170
+ 8192: 1149,
1171
+ 8193: 2285,
1172
+ 8194: 1024,
1173
+ 8195: 2048,
1174
+ 8196: 684,
1175
+ 8197: 512,
1176
+ 8198: 340,
1177
+ 8199: 1325,
1178
+ 8200: 653,
1179
+ 8201: 339,
1180
+ 8202: 169,
1181
+ 8203: 0,
1182
+ 8208: 864,
1183
+ 8209: 864,
1184
+ 8210: 1325,
1185
+ 8211: 1024,
1186
+ 8212: 2048,
1187
+ 8213: 2048,
1188
+ 8214: 1099,
1189
+ 8215: 959,
1190
+ 8216: 602,
1191
+ 8217: 602,
1192
+ 8218: 558,
1193
+ 8219: 602,
1194
+ 8220: 1038,
1195
+ 8221: 1027,
1196
+ 8222: 983,
1197
+ 8223: 1027,
1198
+ 8224: 1131,
1199
+ 8225: 1131,
1200
+ 8226: 1031,
1201
+ 8227: 1031,
1202
+ 8228: 653,
1203
+ 8229: 1305,
1204
+ 8230: 1958,
1205
+ 8231: 653,
1206
+ 8239: 339,
1207
+ 8240: 2809,
1208
+ 8241: 3561,
1209
+ 8242: 527,
1210
+ 8243: 1049,
1211
+ 8244: 1572,
1212
+ 8245: 527,
1213
+ 8246: 1049,
1214
+ 8247: 1572,
1215
+ 8248: 1059,
1216
+ 8249: 851,
1217
+ 8250: 851,
1218
+ 8251: 1541,
1219
+ 8252: 1316,
1220
+ 8253: 1107,
1221
+ 8254: 1049,
1222
+ 8255: 1718,
1223
+ 8256: 1718,
1224
+ 8257: 961,
1225
+ 8258: 1536,
1226
+ 8259: 1031,
1227
+ 8260: 419,
1228
+ 8261: 764,
1229
+ 8262: 764,
1230
+ 8263: 2226,
1231
+ 8264: 1771,
1232
+ 8265: 1771,
1233
+ 8266: 941,
1234
+ 8267: 1229,
1235
+ 8268: 1235,
1236
+ 8269: 1235,
1237
+ 8270: 1105,
1238
+ 8271: 674,
1239
+ 8272: 1713,
1240
+ 8273: 1155,
1241
+ 8274: 1625,
1242
+ 8275: 1534,
1243
+ 8276: 1718,
1244
+ 8277: 1354,
1245
+ 8279: 2095,
1246
+ 8287: 595,
1247
+ 8592: 1954,
1248
+ 8593: 1805,
1249
+ 8594: 1954,
1250
+ 8595: 1805,
1251
+ 8596: 2746,
1252
+ 8597: 1740,
1253
+ 8598: 1598,
1254
+ 8599: 1598,
1255
+ 8600: 1598,
1256
+ 8601: 1598,
1257
+ 8617: 2363,
1258
+ 8618: 2363,
1259
+ 8624: 2055,
1260
+ 8625: 2055,
1261
+ 8627: 2055,
1262
+ 8628: 1793,
1263
+ 8629: 2055,
1264
+ 8634: 1954,
1265
+ 8635: 1954,
1266
+ 8656: 1954,
1267
+ 8658: 1954,
1268
+ 8660: 2746,
1269
+ 8670: 1282,
1270
+ 8671: 1282,
1271
+ 8676: 2126,
1272
+ 8677: 2126,
1273
+ 8679: 2206,
1274
+ 8682: 2206
1275
+ }
1276
+ }
1277
+ };
1278
+
1279
+ // src/layout/measure.ts
1280
+ var LINE_HEIGHT = 1.25;
1281
+ function measureText2(text, options) {
1282
+ const metrics = FONT_METRICS[options.weight];
1283
+ const lines = text.split(`
1284
+ `);
1285
+ let widest = 0;
1286
+ for (const line of lines) {
1287
+ let units = 0;
1288
+ for (const char of line) {
1289
+ units += metrics.advances[char.codePointAt(0) ?? 0] ?? metrics.fallback;
1290
+ }
1291
+ widest = Math.max(widest, units / metrics.unitsPerEm * options.size);
1292
+ }
1293
+ return {
1294
+ width: widest,
1295
+ height: lines.length * LINE_HEIGHT * options.size
1296
+ };
1297
+ }
1298
+
1299
+ // src/layout/shared.ts
1300
+ var MARGIN = 20;
1301
+ var LABEL_FONT = { size: 14, weight: "semibold" };
1302
+ var CAPTION_FONT = { size: 11, weight: "regular" };
1303
+ var EDGE_LABEL_FONT = { size: 12, weight: "regular" };
1304
+ var GROUP_FONT = { size: 12, weight: "semibold" };
1305
+ var PAD_X = 12;
1306
+ var PAD_Y = 8;
1307
+ var SELF_LOOP_WIDTH = 30;
1308
+ var SELF_LOOP_HEIGHT = 20;
1309
+ function round(value) {
1310
+ return Math.round(value * 100) / 100 + 0;
1311
+ }
1312
+ function compact(value) {
1313
+ const result = {};
1314
+ for (const [key, entry] of Object.entries(value)) {
1315
+ if (entry !== undefined)
1316
+ result[key] = entry;
1317
+ }
1318
+ return result;
1319
+ }
1320
+ function boxSize(label, type, minWidth) {
1321
+ const text = measureText2(label, LABEL_FONT);
1322
+ const caption = type === undefined ? undefined : measureText2(type, CAPTION_FONT);
1323
+ const width = Math.ceil(Math.max(minWidth, text.width + 2 * PAD_X, caption === undefined ? 0 : caption.width + 2 * PAD_X));
1324
+ const base = caption === undefined ? 40 : 54;
1325
+ const height = Math.ceil(Math.max(base, 2 * PAD_Y + text.height + (caption?.height ?? 0)));
1326
+ return { width, height };
1327
+ }
1328
+ function labelBoxSize(label) {
1329
+ const text = measureText2(label, EDGE_LABEL_FONT);
1330
+ return {
1331
+ width: Math.ceil(text.width + 8),
1332
+ height: Math.ceil(text.height + 4)
1333
+ };
1334
+ }
1335
+ function groupTopPadding(label) {
1336
+ if (label === undefined || label === "")
1337
+ return PAD_X;
1338
+ return Math.ceil(measureText2(label, GROUP_FONT).height) + 16;
1339
+ }
1340
+ var ACTIONS_GAP = 6;
1341
+ function actionsHeight(count) {
1342
+ if (count === 0)
1343
+ return 0;
1344
+ return Math.ceil(ACTIONS_GAP + count * LINE_HEIGHT * CAPTION_FONT.size);
1345
+ }
1346
+ function actionsWidth(actions) {
1347
+ return Math.max(0, ...actions.map((action) => measureText2(action, CAPTION_FONT).width));
1348
+ }
1349
+ var ER_ROW_HEIGHT = Math.ceil(LINE_HEIGHT * EDGE_LABEL_FONT.size + 6);
1350
+ var ER_ROWS_PAD = 3;
1351
+ function keysText(keys) {
1352
+ return keys === undefined ? "" : keys.map((key) => key.toUpperCase()).join(", ");
1353
+ }
1354
+ function attributeTypeText(attribute) {
1355
+ return `${attribute.type ?? ""}${attribute.nullable === true ? "?" : ""}`;
1356
+ }
1357
+
1358
+ // src/layout/shapes.ts
1359
+ var CYLINDER_RY = 7;
1360
+ var DOCUMENT_WAVE = 6;
1361
+ var SUBROUTINE_PAD = 16;
1362
+ var PILL_SEGMENTS = 12;
1363
+ var ROUND_SEGMENTS = 48;
1364
+ var CYLINDER_SEGMENTS = 24;
1365
+ var SUBROUTINE_BAR = 8;
1366
+ function shapeSize(shape, label, type, minWidth) {
1367
+ const base = boxSize(label, type, minWidth);
1368
+ const kind = shape ?? "box";
1369
+ const text = measureText2(label, LABEL_FONT);
1370
+ const caption = type === undefined ? undefined : measureText2(type, CAPTION_FONT);
1371
+ const tw = Math.max(text.width, caption?.width ?? 0);
1372
+ const th = text.height + (caption?.height ?? 0);
1373
+ switch (kind) {
1374
+ case "box":
1375
+ case "rect":
1376
+ return base;
1377
+ case "pill":
1378
+ return {
1379
+ width: Math.ceil(base.width + base.height / 2),
1380
+ height: base.height
1381
+ };
1382
+ case "diamond": {
1383
+ const height = Math.ceil(Math.max(48, 2 * th + 8));
1384
+ return {
1385
+ width: Math.ceil(Math.max(80, tw / (1 - th / height) + 16)),
1386
+ height
1387
+ };
1388
+ }
1389
+ case "circle": {
1390
+ const diameter = Math.ceil(Math.max(48, Math.hypot(tw, th) + 16));
1391
+ return { width: diameter, height: diameter };
1392
+ }
1393
+ case "ellipse":
1394
+ return {
1395
+ width: Math.ceil(Math.max(80, tw * Math.SQRT2 + 12)),
1396
+ height: Math.ceil(Math.max(40, th * Math.SQRT2 + 8))
1397
+ };
1398
+ case "hexagon":
1399
+ return {
1400
+ width: Math.ceil(base.width + base.height / 2),
1401
+ height: base.height
1402
+ };
1403
+ case "parallelogram":
1404
+ return {
1405
+ width: Math.ceil(base.width + base.height / 3),
1406
+ height: base.height
1407
+ };
1408
+ case "cylinder":
1409
+ return { width: base.width, height: base.height + 2 * CYLINDER_RY };
1410
+ case "document":
1411
+ return { width: base.width, height: base.height + DOCUMENT_WAVE };
1412
+ case "subroutine":
1413
+ return { width: base.width + SUBROUTINE_PAD, height: base.height };
1414
+ }
1415
+ }
1416
+ function textOffsetY(shape) {
1417
+ if (shape === "cylinder")
1418
+ return CYLINDER_RY / 2;
1419
+ if (shape === "document")
1420
+ return -DOCUMENT_WAVE / 2;
1421
+ return 0;
1422
+ }
1423
+ function ellipsePoints(cx, cy, rx, ry, from, to, segments) {
1424
+ const points = [];
1425
+ for (let i = 0;i <= segments; i++) {
1426
+ const angle = from + (to - from) * i / segments;
1427
+ points.push({ x: cx + rx * Math.cos(angle), y: cy + ry * Math.sin(angle) });
1428
+ }
1429
+ return points;
1430
+ }
1431
+ function outline(shape, box) {
1432
+ const { x, y, width: w, height: h } = box;
1433
+ switch (shape) {
1434
+ case undefined:
1435
+ case "box":
1436
+ case "rect":
1437
+ case "document":
1438
+ case "subroutine":
1439
+ return;
1440
+ case "pill": {
1441
+ const r = h / 2;
1442
+ return [
1443
+ ...ellipsePoints(x + w - r, y + r, r, r, -Math.PI / 2, Math.PI / 2, PILL_SEGMENTS),
1444
+ ...ellipsePoints(x + r, y + r, r, r, Math.PI / 2, 3 * Math.PI / 2, PILL_SEGMENTS)
1445
+ ];
1446
+ }
1447
+ case "diamond":
1448
+ return [
1449
+ { x: x + w / 2, y },
1450
+ { x: x + w, y: y + h / 2 },
1451
+ { x: x + w / 2, y: y + h },
1452
+ { x, y: y + h / 2 }
1453
+ ];
1454
+ case "circle":
1455
+ case "ellipse":
1456
+ return ellipsePoints(x + w / 2, y + h / 2, w / 2, h / 2, 0, 2 * Math.PI, ROUND_SEGMENTS).slice(0, ROUND_SEGMENTS);
1457
+ case "hexagon": {
1458
+ const i = h / 4;
1459
+ return [
1460
+ { x: x + i, y },
1461
+ { x: x + w - i, y },
1462
+ { x: x + w, y: y + h / 2 },
1463
+ { x: x + w - i, y: y + h },
1464
+ { x: x + i, y: y + h },
1465
+ { x, y: y + h / 2 }
1466
+ ];
1467
+ }
1468
+ case "parallelogram": {
1469
+ const s = h / 3;
1470
+ return [
1471
+ { x: x + s, y },
1472
+ { x: x + w, y },
1473
+ { x: x + w - s, y: y + h },
1474
+ { x, y: y + h }
1475
+ ];
1476
+ }
1477
+ case "cylinder":
1478
+ return [
1479
+ ...ellipsePoints(x + w / 2, y + CYLINDER_RY, w / 2, CYLINDER_RY, Math.PI, 2 * Math.PI, CYLINDER_SEGMENTS),
1480
+ ...ellipsePoints(x + w / 2, y + h - CYLINDER_RY, w / 2, CYLINDER_RY, 0, Math.PI, CYLINDER_SEGMENTS)
1481
+ ];
1482
+ }
1483
+ }
1484
+ function intersect(a, c, p, q) {
1485
+ const rx = c.x - a.x;
1486
+ const ry = c.y - a.y;
1487
+ const sx = q.x - p.x;
1488
+ const sy = q.y - p.y;
1489
+ const denominator = rx * sy - ry * sx;
1490
+ if (denominator === 0)
1491
+ return;
1492
+ const t = ((p.x - a.x) * sy - (p.y - a.y) * sx) / denominator;
1493
+ const u = ((p.x - a.x) * ry - (p.y - a.y) * rx) / denominator;
1494
+ if (t < 0 || t > 1 || u < 0 || u > 1)
1495
+ return;
1496
+ return t;
1497
+ }
1498
+ function firstHit(a, c, contour) {
1499
+ let best;
1500
+ for (let i = 0;i < contour.length; i++) {
1501
+ const t = intersect(a, c, contour[i], contour[(i + 1) % contour.length]);
1502
+ if (t !== undefined && (best === undefined || t < best))
1503
+ best = t;
1504
+ }
1505
+ if (best === undefined)
1506
+ return;
1507
+ return { x: a.x + (c.x - a.x) * best, y: a.y + (c.y - a.y) * best };
1508
+ }
1509
+ function clipEnd(inner, end, contour, box) {
1510
+ const dx = end.x - inner.x;
1511
+ const dy = end.y - inner.y;
1512
+ const length = Math.hypot(dx, dy);
1513
+ if (length === 0)
1514
+ return end;
1515
+ const reach = box.width + box.height;
1516
+ const far = {
1517
+ x: end.x + dx / length * reach,
1518
+ y: end.y + dy / length * reach
1519
+ };
1520
+ return firstHit(inner, far, contour) ?? end;
1521
+ }
1522
+ function clipEnds(points, fromShape, fromBox, toShape, toBox) {
1523
+ const result = points.map((point) => ({ ...point }));
1524
+ if (result.length < 2)
1525
+ return result;
1526
+ const fromContour = outline(fromShape, fromBox);
1527
+ const toContour = outline(toShape, toBox);
1528
+ const last = result.length - 1;
1529
+ if (toContour !== undefined) {
1530
+ result[last] = clipEnd(points[last - 1], points[last], toContour, toBox);
1531
+ }
1532
+ if (fromContour !== undefined) {
1533
+ result[0] = clipEnd(points[1], points[0], fromContour, fromBox);
1534
+ }
1535
+ return result;
1536
+ }
1537
+ function clipToRect(rect, toward) {
1538
+ const cx = rect.x + rect.width / 2;
1539
+ const cy = rect.y + rect.height / 2;
1540
+ const dx = toward.x - cx;
1541
+ const dy = toward.y - cy;
1542
+ if (dx === 0 && dy === 0)
1543
+ return { x: cx, y: cy };
1544
+ const scale = Math.min(dx === 0 ? Infinity : rect.width / 2 / Math.abs(dx), dy === 0 ? Infinity : rect.height / 2 / Math.abs(dy));
1545
+ return { x: cx + dx * scale, y: cy + dy * scale };
1546
+ }
1547
+ function clipToShape(shape, rect, toward) {
1548
+ const contour = outline(shape, rect);
1549
+ if (contour === undefined)
1550
+ return clipToRect(rect, toward);
1551
+ const center = { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 };
1552
+ const dx = toward.x - center.x;
1553
+ const dy = toward.y - center.y;
1554
+ const length = Math.hypot(dx, dy);
1555
+ if (length === 0)
1556
+ return center;
1557
+ const reach = rect.width + rect.height;
1558
+ const far = {
1559
+ x: center.x + dx / length * reach,
1560
+ y: center.y + dy / length * reach
1561
+ };
1562
+ return firstHit(center, far, contour) ?? clipToRect(rect, toward);
1563
+ }
1564
+
1565
+ export { FONT_METRICS, LINE_HEIGHT, measureText2, MARGIN, LABEL_FONT, CAPTION_FONT, EDGE_LABEL_FONT, GROUP_FONT, PAD_X, PAD_Y, SELF_LOOP_WIDTH, SELF_LOOP_HEIGHT, round, compact, boxSize, labelBoxSize, groupTopPadding, ACTIONS_GAP, actionsHeight, actionsWidth, ER_ROW_HEIGHT, ER_ROWS_PAD, keysText, attributeTypeText, CYLINDER_RY, DOCUMENT_WAVE, SUBROUTINE_BAR, shapeSize, textOffsetY, outline, clipEnds, clipToShape };