@knowvah/dot-engine 1.2.2 → 1.2.4

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 (42) hide show
  1. package/dist/cdt/bag.d.ts +6 -4
  2. package/dist/cdt/bag.d.ts.map +1 -1
  3. package/dist/common/arrows-shapes-poly.d.ts +1 -1
  4. package/dist/common/arrows-shapes-poly.d.ts.map +1 -1
  5. package/dist/common/arrows-shapes.d.ts +2 -2
  6. package/dist/common/arrows-shapes.d.ts.map +1 -1
  7. package/dist/common/htmltable-lex.d.ts.map +1 -1
  8. package/dist/common/record.d.ts.map +1 -1
  9. package/dist/index.js +2013 -2008
  10. package/dist/index.js.map +4 -4
  11. package/dist/layout/dot/edge-route-arrow.d.ts +8 -0
  12. package/dist/layout/dot/edge-route-arrow.d.ts.map +1 -1
  13. package/dist/model/geom.d.ts +5 -0
  14. package/dist/model/geom.d.ts.map +1 -1
  15. package/dist/render.js +95 -90
  16. package/dist/render.js.map +4 -4
  17. package/dist/xdot/parse.d.ts.map +1 -1
  18. package/package.json +2 -1
  19. package/src/cdt/bag.ts +30 -52
  20. package/src/common/arrows-shapes-poly.ts +20 -1
  21. package/src/common/arrows-shapes.ts +6 -2
  22. package/src/common/htmltable-lex.ts +17 -4
  23. package/src/common/htmltable-parse.ts +1 -1
  24. package/src/common/record.ts +3 -5
  25. package/src/layout/dot/edge-route-arrow.ts +7 -2
  26. package/src/model/geom.ts +14 -0
  27. package/src/xdot/parse.ts +3 -1
  28. package/dist/gvc/textlayout.d.ts +0 -33
  29. package/dist/gvc/textlayout.d.ts.map +0 -1
  30. package/dist/layout/osage/layout.d.ts +0 -49
  31. package/dist/layout/osage/layout.d.ts.map +0 -1
  32. package/dist/layout/pack/test-helpers.d.ts +0 -7
  33. package/dist/layout/pack/test-helpers.d.ts.map +0 -1
  34. package/dist/layout/patchwork/tree-node.d.ts +0 -46
  35. package/dist/layout/patchwork/tree-node.d.ts.map +0 -1
  36. package/dist/xdot/lex.d.ts +0 -22
  37. package/dist/xdot/lex.d.ts.map +0 -1
  38. package/src/gvc/textlayout.ts +0 -44
  39. package/src/layout/osage/layout.ts +0 -254
  40. package/src/layout/pack/test-helpers.ts +0 -46
  41. package/src/layout/patchwork/tree-node.ts +0 -120
  42. package/src/xdot/lex.ts +0 -151
@@ -28,6 +28,14 @@ export declare function arrowheadPolygon(arrowTip: Point, arrowDir: Point, penwi
28
28
  /** Minimal edge shape exposing the arrow-related attributes. */
29
29
  interface ArrowAttrEdge {
30
30
  attrs: Map<string, string>;
31
+ /** Present on real edges; the curve generator needs the rankdir frame. */
32
+ tail?: {
33
+ root?: {
34
+ info?: {
35
+ rankdir?: number;
36
+ };
37
+ };
38
+ };
31
39
  }
32
40
  /** The arrowhead/arrowtail name for an edge end (default "normal"). */
33
41
  export declare function edgeArrowName(e: ArrowAttrEdge, end: 'head' | 'tail'): string;
@@ -1 +1 @@
1
- {"version":3,"file":"edge-route-arrow.d.ts","sourceRoot":"","sources":["../../../src/layout/dot/edge-route-arrow.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,gFAAgF;AAChF,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,SAAM,GAAG,KAAK,EAAE,CAe1F;AAOD,gEAAgE;AAChE,UAAU,aAAa;IAAG,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;AAEtD,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,G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AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAC/E,WAAW,EAAE,CAMf"}
@@ -109,6 +109,11 @@ export type Port = {
109
109
  * @see lib/common/geom.c:ccwrotatepf
110
110
  */
111
111
  export declare function ccwrotatepf(p: Point, ccwrot: number): Point;
112
+ /**
113
+ * Clockwise counterpart — the exact inverse of {@link ccwrotatepf} per case.
114
+ * @see lib/common/geom.c:cwrotatepf
115
+ */
116
+ export declare function cwrotatepf(p: Point, cwrot: number): Point;
112
117
  /**
113
118
  * Returns true if box `b0` completely contains box `b1`.
114
119
  *
@@ -1 +1 @@
1
- {"version":3,"file":"geom.d.ts","sourceRoot":"","sources":["../../src/model/geom.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAMH;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAM7C;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAM3C;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4CAA4C;IAC5C,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,EAAE,EAAE,KAAK,CAAC;IACV,yCAAyC;IACzC,EAAE,EAAE,KAAK,CAAC;CACX,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4CAA4C;IAC5C,IA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;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAQ3D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAQzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,GAAG,OAAO,CAOrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,GAAG,OAAO,CAOpD;AAMD;;;;GAIG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,WAAW,MAAO,CAAC"}
package/dist/render.js CHANGED
@@ -5450,12 +5450,15 @@ function parseAttrs(raw) {
5450
5450
  }
5451
5451
  return out;
5452
5452
  }
5453
+ function normalizeTag(tag) {
5454
+ return tag === "TH" ? "TR" : tag;
5455
+ }
5453
5456
  function parseCloseToken(inner) {
5454
5457
  const body = inner.slice(1).trim();
5455
5458
  const sp = body.search(/\s/);
5456
5459
  const tag = (sp === -1 ? body : body.slice(0, sp)).toUpperCase();
5457
5460
  checkTag(tag);
5458
- return { type: "close", tag };
5461
+ return { type: "close", tag: normalizeTag(tag) };
5459
5462
  }
5460
5463
  function cleanText(raw) {
5461
5464
  const isKeep = (c) => c === " " || c === " " || c === "\n" || c === "\r";
@@ -5489,12 +5492,13 @@ function scanTag(src, start, tokens) {
5489
5492
  function parseOpenToken(inner) {
5490
5493
  const sp = inner.search(/\s/);
5491
5494
  if (sp === -1) {
5492
- checkTag(inner.toUpperCase());
5493
- return { type: "open", tag: inner.toUpperCase(), attrs: parseAttrs("") };
5495
+ const tag2 = inner.toUpperCase();
5496
+ checkTag(tag2);
5497
+ return { type: "open", tag: normalizeTag(tag2), attrs: parseAttrs("") };
5494
5498
  }
5495
5499
  const tag = inner.slice(0, sp).toUpperCase();
5496
5500
  checkTag(tag);
5497
- return { type: "open", tag, attrs: parseAttrs(inner.slice(sp + 1)) };
5501
+ return { type: "open", tag: normalizeTag(tag), attrs: parseAttrs(inner.slice(sp + 1)) };
5498
5502
  }
5499
5503
  function tokenize(src) {
5500
5504
  const tokens = [];
@@ -5719,7 +5723,7 @@ var buildCell = (content, a) => ({
5719
5723
  });
5720
5724
  var parseCell = (s, attrs, fontStack) => buildCell(parseCellContent(s, attrs, fontStack), attrs);
5721
5725
  var processRowToken = (s, t, cells, fontStack) => {
5722
- if (t.type === "open" && (t.tag === "TD" || t.tag === "TH")) {
5726
+ if (t.type === "open" && t.tag === "TD") {
5723
5727
  consume(s);
5724
5728
  cells.push(parseCell(s, t.attrs, fontStack));
5725
5729
  return;
@@ -7597,6 +7601,40 @@ function miterShape(baseLeft, P, baseRight, penwidth) {
7597
7601
  return [{ x: P1.x + l * a.cos, y: P1.y + l * a.sin }, P1, P2];
7598
7602
  }
7599
7603
 
7604
+ // src/model/geom.ts
7605
+ function ccwrotatepf(p, ccwrot) {
7606
+ switch (ccwrot) {
7607
+ case 0:
7608
+ return p;
7609
+ case 90:
7610
+ return { x: -p.y, y: p.x };
7611
+ case 180:
7612
+ return { x: p.x, y: -p.y };
7613
+ case 270:
7614
+ return { x: p.y, y: p.x };
7615
+ default:
7616
+ return p;
7617
+ }
7618
+ }
7619
+ function cwrotatepf(p, cwrot) {
7620
+ switch (cwrot) {
7621
+ case 0:
7622
+ return p;
7623
+ case 90:
7624
+ return { x: p.y, y: -p.x };
7625
+ case 180:
7626
+ return { x: p.x, y: -p.y };
7627
+ case 270:
7628
+ return { x: p.y, y: p.x };
7629
+ default:
7630
+ return p;
7631
+ }
7632
+ }
7633
+ function boxOverlap(b0, b1) {
7634
+ return b0.ur.x >= b1.ll.x && b1.ur.x >= b0.ll.x && b0.ur.y >= b1.ll.y && b1.ur.y >= b0.ll.y;
7635
+ }
7636
+ var POINTS_PER_INCH = 72;
7637
+
7600
7638
  // src/common/arrows-shapes-poly.ts
7601
7639
  var CROW_ARROWWIDTH = 0.45;
7602
7640
  function crowBasePoints(u, v, flag) {
@@ -7758,7 +7796,15 @@ function curveControlPoints(p, v, w, flag) {
7758
7796
  const AF2 = { x: p.x - 0.95 * v.x + w.x + s * w.x * (4 / 3), y: AF3.y + s * w.y * (4 / 3) };
7759
7797
  return [AF0, AF1, AF2, AF3];
7760
7798
  }
7761
- function genCurve(p0, u, _arrowsize, penwidth, flag) {
7799
+ function genCurve(p0, u, _arrowsize, penwidth, flag, rankdir = 0) {
7800
+ if (rankdir !== 0) {
7801
+ const rot = rankdir * 90;
7802
+ const fin = genCurve(ccwrotatepf(p0, rot), ccwrotatepf(u, rot), _arrowsize, penwidth, flag);
7803
+ return {
7804
+ ops: fin.ops.map((op) => "points" in op ? { ...op, points: op.points.map((pt) => cwrotatepf(pt, rot)) } : op),
7805
+ q: cwrotatepf(fin.q, rot)
7806
+ };
7807
+ }
7762
7808
  const arrowwidth = penwidth > 4 ? 0.5 * penwidth / 4 : 0.5;
7763
7809
  const noShift = flag & ARR_MOD_INV || u.x === 0 && u.y === 0;
7764
7810
  const p = noShift ? p0 : vsub(p0, backwardDelta(u, penwidth));
@@ -7973,7 +8019,7 @@ function arrowLength(comps, arrowsize, penwidth) {
7973
8019
  for (let i = 0; i < n; i++) length += arrowLengthOne(comps[i], arrowsize, penwidth);
7974
8020
  return length;
7975
8021
  }
7976
- function dispatchSimple(r, tip2, dir, arrowsize, penwidth) {
8022
+ function dispatchSimple(r, tip2, dir, arrowsize, penwidth, rankdir = 0) {
7977
8023
  const flag = arrowFlag(r);
7978
8024
  const u = componentU(dir, r.lenfact, arrowsize);
7979
8025
  switch (r.type & ARR_TYPE_MASK) {
@@ -7987,8 +8033,10 @@ function dispatchSimple(r, tip2, dir, arrowsize, penwidth) {
7987
8033
  return genDiamond(tip2, u, arrowsize, penwidth, flag);
7988
8034
  case ARR_TYPE_DOT:
7989
8035
  return genDot(tip2, u, arrowsize, penwidth, flag);
8036
+ // curve is the one generator that is not rotation-equivariant; it needs
8037
+ // the rankdir to reproduce C's render-time (final-frame) generation.
7990
8038
  case ARR_TYPE_CURVE:
7991
- return genCurve(tip2, u, arrowsize, penwidth, flag);
8039
+ return genCurve(tip2, u, arrowsize, penwidth, flag, rankdir);
7992
8040
  case ARR_TYPE_GAP:
7993
8041
  return genGap(tip2, u, arrowsize, penwidth, flag);
7994
8042
  case ARR_TYPE_NORM:
@@ -7996,14 +8044,14 @@ function dispatchSimple(r, tip2, dir, arrowsize, penwidth) {
7996
8044
  return genNormal(tip2, u, arrowsize, penwidth, flag);
7997
8045
  }
7998
8046
  }
7999
- function arrowDrawOps(comps, tip2, dir, arrowsize, penwidth) {
8047
+ function arrowDrawOps(comps, tip2, dir, arrowsize, penwidth, rankdir = 0) {
8000
8048
  const ops = [];
8001
8049
  let p = tip2;
8002
8050
  const n = Math.min(comps.length, 4);
8003
8051
  for (let i = 0; i < n; i++) {
8004
8052
  const r = comps[i];
8005
8053
  if ((r.type & ARR_TYPE_MASK) === ARR_TYPE_NONE) break;
8006
- const res = dispatchSimple(r, p, dir, arrowsize, penwidth);
8054
+ const res = dispatchSimple(r, p, dir, arrowsize, penwidth, rankdir);
8007
8055
  ops.push(...res.ops);
8008
8056
  p = res.q;
8009
8057
  }
@@ -8147,7 +8195,8 @@ function edgeArrowsize(e) {
8147
8195
  }
8148
8196
  function arrowDrawOpsForEnd(e, end, tip2, dir, penwidth) {
8149
8197
  const comps = parseArrow(edgeArrowName(e, end)).map(resolveArrowType);
8150
- return arrowDrawOps(comps, tip2, dir, edgeArrowsize(e), penwidth);
8198
+ const rankdir = (e.tail?.root?.info?.rankdir ?? 0) & 3;
8199
+ return arrowDrawOps(comps, tip2, dir, edgeArrowsize(e), penwidth, rankdir);
8151
8200
  }
8152
8201
 
8153
8202
  // src/model/layoutParams.ts
@@ -8501,26 +8550,6 @@ var RenderJob = class {
8501
8550
  }
8502
8551
  };
8503
8552
 
8504
- // src/model/geom.ts
8505
- function ccwrotatepf(p, ccwrot) {
8506
- switch (ccwrot) {
8507
- case 0:
8508
- return p;
8509
- case 90:
8510
- return { x: -p.y, y: p.x };
8511
- case 180:
8512
- return { x: p.x, y: -p.y };
8513
- case 270:
8514
- return { x: p.y, y: p.x };
8515
- default:
8516
- return p;
8517
- }
8518
- }
8519
- function boxOverlap(b0, b1) {
8520
- return b0.ur.x >= b1.ll.x && b1.ur.x >= b0.ll.x && b0.ur.y >= b1.ll.y && b1.ur.y >= b0.ll.y;
8521
- }
8522
- var POINTS_PER_INCH = 72;
8523
-
8524
8553
  // src/model/graphInfo.ts
8525
8554
  function makeGraphInfo() {
8526
8555
  return {
@@ -10724,10 +10753,7 @@ function posReclbl(f, ul, sides) {
10724
10753
  }
10725
10754
  }
10726
10755
  function attrBool(n, g, key) {
10727
- const s = nodeAttr(n, g, key);
10728
- if (!s || s.toLowerCase() === "false" || s.toLowerCase() === "no") return false;
10729
- if (s.toLowerCase() === "true" || s.toLowerCase() === "yes") return true;
10730
- return parseInt(s, 10) !== 0;
10756
+ return mapbool2(nodeAttr(n, g, key));
10731
10757
  }
10732
10758
  function recAttrSize(n, g) {
10733
10759
  const w = nodeAttr(n, g, "width");
@@ -16296,7 +16322,7 @@ function class2(g) {
16296
16322
 
16297
16323
  // src/common/edge-label-init.ts
16298
16324
  var MIN_FONTSIZE = 1;
16299
- function mapbool2(s) {
16325
+ function mapbool3(s) {
16300
16326
  if (!s || s.toLowerCase() === "false" || s.toLowerCase() === "no") return false;
16301
16327
  if (s.toLowerCase() === "true" || s.toLowerCase() === "yes") return true;
16302
16328
  const n = parseInt(s, 10);
@@ -16327,7 +16353,7 @@ function applyLabel(e, g, fi, measurer) {
16327
16353
  const content = isHtml ? htmlValueContent(str) : str;
16328
16354
  e.info.label = makeAnyLabel(content, isHtml, fi, measurer, e);
16329
16355
  g.root.info.has_labels |= EDGE_LABEL;
16330
- e.info.label_ontop = mapbool2(e.attrs.get("labelfloat")) ? 1 : 0;
16356
+ e.info.label_ontop = mapbool3(e.attrs.get("labelfloat")) ? 1 : 0;
16331
16357
  }
16332
16358
  function applyXLabel(e, g, fi, measurer) {
16333
16359
  const str = e.attrs.get("xlabel");
@@ -16523,7 +16549,7 @@ function graphInit(g, useRankdir) {
16523
16549
  if (fn !== -1) g.info.fontnames = fn;
16524
16550
  parseRatioDrawing(g);
16525
16551
  setClType(maptoken(g.attrs.get("clusterrank"), RANK_NAMES, rankCodes()));
16526
- g.info.concentrate = mapbool3(g.attrs.get("concentrate"));
16552
+ g.info.concentrate = mapbool2(g.attrs.get("concentrate"));
16527
16553
  g.info.edgeLabelsDone = false;
16528
16554
  doGraphLabel(g, layoutMeasurer(g));
16529
16555
  }
@@ -16565,7 +16591,7 @@ function sameNonemptyGroup(e) {
16565
16591
  }
16566
16592
  function initEdgeConstraint(e) {
16567
16593
  const s = e.attrs.get("constraint");
16568
- if (s !== void 0 && s !== "") e.info.constraint = mapbool3(s);
16594
+ if (s !== void 0 && s !== "") e.info.constraint = mapbool2(s);
16569
16595
  }
16570
16596
  function applyGroupPenalty(e) {
16571
16597
  if (!sameNonemptyGroup(e)) return;
@@ -16663,7 +16689,7 @@ function gdRankdir(n) {
16663
16689
  function gdFlip(n) {
16664
16690
  return (gdRankdir(n) & 1) !== 0;
16665
16691
  }
16666
- function cwrotatepf(p, cwrot) {
16692
+ function cwrotatepf2(p, cwrot) {
16667
16693
  switch (cwrot) {
16668
16694
  case 90:
16669
16695
  return { x: p.y, y: -p.x };
@@ -16810,7 +16836,7 @@ function setOrder(pp, q) {
16810
16836
  pp.order = MC_SCALE * a / (2 * Math.PI) | 0;
16811
16837
  }
16812
16838
  function applyDir(pp, bp, dir, rd, definedFinal) {
16813
- const q = cwrotatepf(dir.p, 90 * rd);
16839
+ const q = cwrotatepf2(dir.p, 90 * rd);
16814
16840
  pp.p = q;
16815
16841
  pp.bp = bp;
16816
16842
  pp.side = dir.dyna ? dir.side : invflipSide(dir.side, rd);
@@ -16826,7 +16852,7 @@ function nodeInsideFn(n) {
16826
16852
  }
16827
16853
  function compassPoint(n, insideFn, yArg, xArg, rd) {
16828
16854
  let p = { x: xArg, y: yArg };
16829
- if (rd) p = cwrotatepf(p, 90 * rd);
16855
+ if (rd) p = cwrotatepf2(p, 90 * rd);
16830
16856
  const curve = [{ x: 0, y: 0 }, { x: 0, y: 0 }, { x: p.x, y: p.y }, { x: p.x, y: p.y }];
16831
16857
  const ctx = { nodeCoord: n.info.coord, rw: n.info.rw, bp: null, node: n };
16832
16858
  bezierClip(ctx, insideFn, curve, true);
@@ -21956,10 +21982,10 @@ function xgWeak(Xg, t, h, orig, st) {
21956
21982
  function isNonConstraint(e) {
21957
21983
  const v = e.attrs.get("constraint");
21958
21984
  if (!v) return false;
21959
- return !mapbool3(v);
21985
+ return !mapbool2(v);
21960
21986
  }
21961
21987
  function isAStrongCluster(g) {
21962
- return mapbool3(g.attrs.get("compact") ?? "");
21988
+ return mapbool2(g.attrs.get("compact") ?? "");
21963
21989
  }
21964
21990
  function dotLca(c0, c1) {
21965
21991
  let a = c0;
@@ -22234,7 +22260,7 @@ var clType = LOCAL;
22234
22260
  function setClType(t) {
22235
22261
  clType = t;
22236
22262
  }
22237
- function mapbool3(s) {
22263
+ function mapbool2(s) {
22238
22264
  if (!s || s === "") return false;
22239
22265
  const l = s.toLowerCase();
22240
22266
  if (l === "false" || l === "no") return false;
@@ -22250,7 +22276,7 @@ function scaleClamp(nnodes, scale) {
22250
22276
  function isACluster(g) {
22251
22277
  if (g === g.root) return true;
22252
22278
  if (g.name.toLowerCase().startsWith("cluster")) return true;
22253
- return mapbool3(g.attrs.get("cluster"));
22279
+ return mapbool2(g.attrs.get("cluster"));
22254
22280
  }
22255
22281
  function cleanup1ClearNode(n) {
22256
22282
  if (n.info.in) n.info.in.size = 0;
@@ -22598,7 +22624,7 @@ function dot1Rank(g) {
22598
22624
  cleanup1(g);
22599
22625
  }
22600
22626
  function dotRank(g) {
22601
- if (mapbool3(g.attrs.get("newrank"))) {
22627
+ if (mapbool2(g.attrs.get("newrank"))) {
22602
22628
  g.info.flags = (g.info.flags ?? 0) | NEW_RANK;
22603
22629
  dot2Rank(g);
22604
22630
  } else {
@@ -28142,31 +28168,13 @@ function splay(root, key, keyOf, compare) {
28142
28168
  }
28143
28169
 
28144
28170
  // src/cdt/bag.ts
28145
- function findByIdentity(start, target, key, keyOf, compare) {
28146
- let cur = start;
28147
- let parent = null;
28148
- while (cur !== null) {
28149
- if (cur.obj === target) return [cur, parent];
28150
- if (compare(key, keyOf(cur.obj)) !== 0) return [null, null];
28151
- parent = cur;
28152
- cur = cur.left;
28153
- }
28154
- return [null, null];
28155
- }
28156
- function unlinkNode(root, cur, parent) {
28157
- const left = cur.left;
28158
- const right = cur.right;
28159
- let replacement;
28160
- if (left === null) {
28161
- replacement = right;
28162
- } else {
28163
- const maxLeft = splayMax(left);
28164
- maxLeft.right = right;
28165
- replacement = maxLeft;
28166
- }
28167
- if (parent === null) return replacement;
28168
- parent.left = replacement;
28169
- return root;
28171
+ function removeRoot(root) {
28172
+ const left = root.left;
28173
+ const right = root.right;
28174
+ if (left === null) return right;
28175
+ const maxLeft = splayMax(left);
28176
+ maxLeft.right = right;
28177
+ return maxLeft;
28170
28178
  }
28171
28179
  var DtBag = class {
28172
28180
  _root = null;
@@ -28205,16 +28213,13 @@ var DtBag = class {
28205
28213
  const key = this._keyOf(obj);
28206
28214
  this._root = splay(this._root, key, this._keyOf, this._compare);
28207
28215
  if (this._compare(key, this._keyOf(this._root.obj)) !== 0) return false;
28208
- const [cur, parent] = findByIdentity(
28209
- this._root,
28210
- obj,
28211
- key,
28212
- this._keyOf,
28213
- this._compare
28214
- );
28215
- if (cur === null) return false;
28216
- const newRoot = unlinkNode(this._root, cur, parent);
28217
- this._root = newRoot;
28216
+ while (this._root.obj !== obj) {
28217
+ const nxt = this.next(this._root.obj);
28218
+ if (nxt === void 0 || this._compare(key, this._keyOf(nxt)) !== 0) {
28219
+ return false;
28220
+ }
28221
+ }
28222
+ this._root = removeRoot(this._root);
28218
28223
  this._size--;
28219
28224
  return true;
28220
28225
  }
@@ -29065,7 +29070,7 @@ function runPlacement(gp) {
29065
29070
  const nObjs = gp.nodes.size + nSetLbls + nClbls + nElbls;
29066
29071
  const { ctx } = buildArrays(gp, nObjs, nLbls, nClbls, et);
29067
29072
  const forceStr = gp.attrs.get("forcelabels");
29068
- const force = forceStr === void 0 ? true : mapbool3(forceStr);
29073
+ const force = forceStr === void 0 ? true : mapbool2(forceStr);
29069
29074
  const params = { bb: { ll: ctx.bb.ll, ur: ctx.bb.ur }, force };
29070
29075
  placeLabels(ctx.objs, ctx.lbls, params);
29071
29076
  writeBackLabels(gp, ctx.lbls, nLbls);
@@ -34295,7 +34300,7 @@ function dotPhasePostNoFinish(g) {
34295
34300
  removeFill(g);
34296
34301
  dotSameports(g);
34297
34302
  dotSplines(g);
34298
- if (mapbool3(g.attrs.get("compound") ?? g.root.attrs.get("compound"))) dotCompoundEdges(g);
34303
+ if (mapbool2(g.attrs.get("compound") ?? g.root.attrs.get("compound"))) dotCompoundEdges(g);
34299
34304
  }
34300
34305
  function dotPhasePost(g) {
34301
34306
  dotPhasePostNoFinish(g);
@@ -35286,7 +35291,7 @@ function userPos(n) {
35286
35291
  n.info.pos = [Number(m[1]), Number(m[2])];
35287
35292
  n.info.posSet = true;
35288
35293
  const pin = n.attrs.get("pin");
35289
- if (m[3] === "!" || pin !== void 0 && mapbool3(pin)) n.info.pinned = true;
35294
+ if (m[3] === "!" || pin !== void 0 && mapbool2(pin)) n.info.pinned = true;
35290
35295
  return true;
35291
35296
  }
35292
35297
  function assignNodeIds2(g) {
@@ -38537,7 +38542,7 @@ function splineEdgesImpl(g, sep, edgetype) {
38537
38542
  function splineEdges(g) {
38538
38543
  const edgetype = g.info.flags & 15;
38539
38544
  if (edgetype === EDGETYPE_NONE) return;
38540
- g.root.info.concentrate = mapbool3(g.root.attrs.get("concentrate"));
38545
+ g.root.info.concentrate = mapbool2(g.root.attrs.get("concentrate"));
38541
38546
  for (const n of nodesInSeq(g)) {
38542
38547
  for (const e of n.outEdges(g)) {
38543
38548
  if (e.info.tail_port.dyna) e.info.tail_port = resolvePort(e.tail, e.head, e.info.tail_port);
@@ -45433,7 +45438,7 @@ function PARENT(n) {
45433
45438
  function isCluster(g) {
45434
45439
  if (g === g.root) return true;
45435
45440
  if (g.name.toLowerCase().startsWith("cluster")) return true;
45436
- return mapbool3(g.attrs.get("cluster"));
45441
+ return mapbool2(g.attrs.get("cluster"));
45437
45442
  }
45438
45443
  function clusterInitGraph(g) {
45439
45444
  graphInit(g, false);
@@ -45960,7 +45965,7 @@ function walkTree(tree) {
45960
45965
  function isCluster2(g) {
45961
45966
  if (g === g.root) return true;
45962
45967
  if (g.name.toLowerCase().startsWith("cluster")) return true;
45963
- return mapbool3(g.attrs.get("cluster"));
45968
+ return mapbool2(g.attrs.get("cluster"));
45964
45969
  }
45965
45970
  function collectClusters2(g, clusters) {
45966
45971
  for (const subg of g.subgraphs.values()) {
@@ -46040,7 +46045,7 @@ var PATCHWORK_LAYOUT_ENGINE = {
46040
46045
  // src/gvc/edge-labels.ts
46041
46046
  function renderEdgeLabels(e, renderer, job) {
46042
46047
  const obj = job.obj;
46043
- const spl = mapbool3(e.attrs.get("decorate") ?? "false") ? e.info.spl : void 0;
46048
+ const spl = mapbool2(e.attrs.get("decorate") ?? "false") ? e.info.spl : void 0;
46044
46049
  if (obj === null) {
46045
46050
  renderOneLabel(e.info.label, renderer, job);
46046
46051
  if (spl) emitAttachment(e.info.label, spl, renderer, job);
@@ -52452,7 +52457,7 @@ var XdotParser = class _XdotParser {
52452
52457
  let accounted = 0;
52453
52458
  let j = 0;
52454
52459
  while (accounted < len) {
52455
- if (cur + j >= s.length) break;
52460
+ if (cur + j >= s.length) return null;
52456
52461
  const ch = s[cur + j];
52457
52462
  const prev = j > 0 ? s[cur + j - 1] : "";
52458
52463
  out += ch;