@linkurious/ogma-annotations 1.1.5 → 1.1.7

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.
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var In = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
5
5
  function ce(u) {
6
6
  return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
7
7
  }
8
- var Pe = { exports: {} };
8
+ var $e = { exports: {} };
9
9
  (function(u) {
10
10
  (function(l, t) {
11
11
  u.exports = t();
@@ -15,29 +15,29 @@ var Pe = { exports: {} };
15
15
  function c(s) {
16
16
  return Math.round(s * 1e8) / 1e8;
17
17
  }
18
- function f(s, d) {
19
- var m = d.x - s.x, A = d.y - s.y;
18
+ function d(s, f) {
19
+ var m = f.x - s.x, A = f.y - s.y;
20
20
  return Math.sqrt(m * m + A * A);
21
21
  }
22
- function g(s, d, m) {
23
- var A = d.y - s.y, T = d.x - s.x, S = Math.atan2(A, T);
22
+ function g(s, f, m) {
23
+ var A = f.y - s.y, T = f.x - s.x, S = Math.atan2(A, T);
24
24
  if (m)
25
25
  for (; S < 0; )
26
26
  S += t;
27
27
  return S;
28
28
  }
29
- function p(s, d) {
30
- this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
29
+ function p(s, f) {
30
+ this.x = s !== void 0 ? s : 0, this.y = f !== void 0 ? f : 0;
31
31
  }
32
32
  return p.fromRadians = function(s) {
33
- var d = Math.cos(s), m = Math.sin(s);
34
- return new p(d, m);
33
+ var f = Math.cos(s), m = Math.sin(s);
34
+ return new p(f, m);
35
35
  }, p.fromDegrees = function(s) {
36
- var d = s * (Math.PI / 180);
37
- return p.fromRadians(d);
36
+ var f = s * (Math.PI / 180);
37
+ return p.fromRadians(f);
38
38
  }, p.fromString = function(s) {
39
- var d = s.split(",");
40
- return new p(parseFloat(d[0]), parseFloat(d[1]));
39
+ var f = s.split(",");
40
+ return new p(parseFloat(f[0]), parseFloat(f[1]));
41
41
  }, p.fromArray = function(s) {
42
42
  return new p(s[0], s[1]);
43
43
  }, p.prototype = {
@@ -100,8 +100,8 @@ var Pe = { exports: {} };
100
100
  // @param x - optional x component to set.
101
101
  // @param y - optional y component to set.
102
102
  // @return self.
103
- set: function(s, d) {
104
- return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
103
+ set: function(s, f) {
104
+ return s !== void 0 && (this.x = s), f !== void 0 && (this.y = f), this;
105
105
  },
106
106
  // [API]
107
107
  // [chainable, clone]
@@ -137,7 +137,7 @@ var Pe = { exports: {} };
137
137
  // @param other - vector to get distance from.
138
138
  // @return distance between vectors.
139
139
  distanceFrom: function(s) {
140
- return f(this, s);
140
+ return d(this, s);
141
141
  },
142
142
  // [API]
143
143
  // []
@@ -191,7 +191,7 @@ var Pe = { exports: {} };
191
191
  // @param radians - radians to rotate this vector by (can be positive or negative).
192
192
  // @return self.
193
193
  rotateRadiansSelf: function(s) {
194
- var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, T = this.x * m + this.y * d;
194
+ var f = Math.cos(s), m = Math.sin(s), A = this.x * f - this.y * m, T = this.x * m + this.y * f;
195
195
  return this.x = c(A), this.y = c(T), this;
196
196
  },
197
197
  // [API]
@@ -368,8 +368,8 @@ var Pe = { exports: {} };
368
368
  // @param min - min value for x, y components.
369
369
  // @param max - max value for x, y components.
370
370
  // @return self.
371
- clampSelf: function(s, d) {
372
- return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > d.x && (this.x = d.x), this.y > d.y && (this.y = d.y), this;
371
+ clampSelf: function(s, f) {
372
+ return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > f.x && (this.x = f.x), this.y > f.y && (this.y = f.y), this;
373
373
  },
374
374
  // [API]
375
375
  // [chainable, clone]
@@ -378,8 +378,8 @@ var Pe = { exports: {} };
378
378
  // @param min - min value for x, y components.
379
379
  // @param max - max value for x, y components.
380
380
  // @return cloned vector in range.
381
- clamp: function(s, d) {
382
- return this.clone().clampSelf(s, d);
381
+ clamp: function(s, f) {
382
+ return this.clone().clampSelf(s, f);
383
383
  },
384
384
  // [API]
385
385
  // [chainable, changeSelf]
@@ -450,8 +450,8 @@ var Pe = { exports: {} };
450
450
  // @param x - default value for x if undefined (0 if not defined).
451
451
  // @param y - default value for y if undefined (0 if not defined).
452
452
  // @return self.
453
- repairSelf: function(s, d) {
454
- return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = d || 0), this;
453
+ repairSelf: function(s, f) {
454
+ return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = f || 0), this;
455
455
  },
456
456
  // [API]
457
457
  // [chainable, clone]
@@ -460,8 +460,8 @@ var Pe = { exports: {} };
460
460
  // @param x - default value for x if undefined (0 if not defined).
461
461
  // @param y - default value for y if undefined (0 if not defined).
462
462
  // @return repaired clone.
463
- repair: function(s, d) {
464
- return this.clone().repairSelf(s, d);
463
+ repair: function(s, f) {
464
+ return this.clone().repairSelf(s, f);
465
465
  },
466
466
  // [API]
467
467
  // []
@@ -482,11 +482,11 @@ var Pe = { exports: {} };
482
482
  }();
483
483
  return l.zero = new l(0, 0), l.one = new l(1, 1), l.up = new l(0, -1), l.down = new l(0, 1), l.left = new l(-1, 0), l.right = new l(1, 0), l.upLeft = new l(-1, -1), l.downLeft = new l(-1, 1), l.upRight = new l(1, -1), l.downRight = new l(1, 1), l.prototype.magnitude = l.prototype.length, Object.freeze && (Object.freeze(l.zero), Object.freeze(l.one), Object.freeze(l.up), Object.freeze(l.down), Object.freeze(l.left), Object.freeze(l.right), Object.freeze(l.upLeft), Object.freeze(l.downLeft), Object.freeze(l.upRight), Object.freeze(l.downRight)), l;
484
484
  });
485
- })(Pe);
486
- var _n = Pe.exports;
487
- const G = /* @__PURE__ */ ce(_n);
488
- let Ut = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
489
- const Mt = {
485
+ })($e);
486
+ var _n = $e.exports;
487
+ const U = /* @__PURE__ */ ce(_n);
488
+ let Xt = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
489
+ const Lt = {
490
490
  strokeType: "plain",
491
491
  strokeColor: "black",
492
492
  strokeWidth: 1,
@@ -498,7 +498,7 @@ const Mt = {
498
498
  properties: {
499
499
  type: "arrow",
500
500
  style: {
501
- ...Mt
501
+ ...Lt
502
502
  }
503
503
  },
504
504
  geometry: {
@@ -518,13 +518,13 @@ const Mt = {
518
518
  // tail: 'arrow-plain',
519
519
  // start: { x: 0, y: 0 },
520
520
  // end: { x: 100, y: 100 }
521
- }, Dn = (u = 0, l = 0, t = 0, r = 0, a = { ...Mt }) => ({
522
- id: Ut(),
521
+ }, Dn = (u = 0, l = 0, t = 0, r = 0, a = { ...Lt }) => ({
522
+ id: Xt(),
523
523
  type: "Feature",
524
524
  properties: {
525
525
  type: "arrow",
526
526
  style: {
527
- ...Mt,
527
+ ...Lt,
528
528
  ...a
529
529
  }
530
530
  },
@@ -536,21 +536,21 @@ const Mt = {
536
536
  ]
537
537
  }
538
538
  }), On = "http://www.w3.org/2000/svg";
539
- function Dt(u) {
539
+ function Mt(u) {
540
540
  return document.createElementNS(On, u);
541
541
  }
542
- function $e(u) {
542
+ function Pe(u) {
543
543
  return u.geometry.bbox || Mn(u), u.geometry.bbox;
544
544
  }
545
- function ct(u) {
546
- const l = $e(u);
545
+ function ut(u) {
546
+ const l = Pe(u);
547
547
  return {
548
548
  width: l[2] - l[0],
549
549
  height: l[3] - l[1]
550
550
  };
551
551
  }
552
- function ft(u) {
553
- const l = $e(u);
552
+ function ct(u) {
553
+ const l = Pe(u);
554
554
  return { x: l[0], y: l[1] };
555
555
  }
556
556
  function Mn(u) {
@@ -568,15 +568,15 @@ function zn(u, l, t, r, a) {
568
568
  ]
569
569
  ];
570
570
  }
571
- function Ot(u) {
571
+ function zt(u) {
572
572
  const [l, t] = u.geometry.coordinates[0];
573
573
  return { x: l, y: t };
574
574
  }
575
- function Rt(u, l) {
575
+ function jt(u, l) {
576
576
  const [t, r] = u.geometry.coordinates[l === "start" ? 0 : 1];
577
577
  return { x: t, y: r };
578
578
  }
579
- function Ft(u) {
579
+ function qt(u) {
580
580
  const [l, t] = u.geometry.coordinates[1];
581
581
  return { x: l, y: t };
582
582
  }
@@ -586,15 +586,15 @@ function Ne(u, l, t) {
586
586
  function Re(u, l, t) {
587
587
  u.geometry.coordinates[1] = [l, t];
588
588
  }
589
- function qt(u) {
590
- return { start: Ot(u), end: Ft(u) };
589
+ function Vt(u) {
590
+ return { start: zt(u), end: qt(u) };
591
591
  }
592
592
  function bt(u, l, t, r) {
593
593
  l === "start" ? Ne(u, t, r) : Re(u, t, r);
594
594
  }
595
595
  const He = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
596
  function Xn(u) {
597
- return jt(u).reduce(
597
+ return Bt(u).reduce(
598
598
  (l, t) => (l[0] = Math.min(t[0], l[0]), l[1] = Math.min(t[1], l[1]), l[2] = Math.max(t[0], l[2]), l[3] = Math.max(t[1], l[3]), l),
599
599
  [
600
600
  Number.POSITIVE_INFINITY,
@@ -604,22 +604,22 @@ function Xn(u) {
604
604
  ]
605
605
  );
606
606
  }
607
- function jt(u) {
607
+ function Bt(u) {
608
608
  let l = [];
609
609
  return u.type == "Point" ? l = [u.coordinates] : u.type == "LineString" || u.type == "MultiPoint" ? l = u.coordinates : u.type == "Polygon" || u.type == "MultiLineString" ? l = u.coordinates.reduce(function(t, r) {
610
610
  return t.concat(r);
611
611
  }, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
612
612
  (t, r) => t.concat(r.reduce((a, c) => a.concat(c), [])),
613
613
  []
614
- ) : u.type == "Feature" ? l = jt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
- (t, r) => t.concat(jt(r)),
614
+ ) : u.type == "Feature" ? l = Bt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
+ (t, r) => t.concat(Bt(r)),
616
616
  []
617
617
  ) : u.type == "FeatureCollection" && (l = u.features.reduce(
618
- (t, r) => t.concat(jt(r)),
618
+ (t, r) => t.concat(Bt(r)),
619
619
  []
620
620
  )), l;
621
621
  }
622
- function Ht(u, l, t) {
622
+ function Ft(u, l, t) {
623
623
  const r = Math.atan2(u.y - l.y, u.x - l.x);
624
624
  return {
625
625
  x: l.x + t * Math.cos(r),
@@ -628,55 +628,55 @@ function Ht(u, l, t) {
628
628
  }
629
629
  function je(u, l = 5, t = 30) {
630
630
  var s;
631
- const { start: r, end: a } = qt(u), c = new G(r.x, r.y), g = new G(a.x, a.y).sub(c), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
631
+ const { start: r, end: a } = Vt(u), c = new U(r.x, r.y), g = new U(a.x, a.y).sub(c), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
632
632
  return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
633
633
  }
634
634
  function ke(u, l, t, r) {
635
635
  const a = l.clone().normalize().invert().mul(r);
636
636
  if (!t || t === "none")
637
637
  return "";
638
- const c = u.clone().add(a.rotateRadians(Math.PI / 8)), f = u.clone().add(a.rotateRadians(-Math.PI / 8)), g = `${u.x} ${u.y}`;
639
- return `M ${c.x} ${c.y} L ${g} ${f.x} ${f.y} ${t === "arrow" ? "" : `${c.x} ${c.y}`}`;
638
+ const c = u.clone().add(a.rotateRadians(Math.PI / 8)), d = u.clone().add(a.rotateRadians(-Math.PI / 8)), g = `${u.x} ${u.y}`;
639
+ return `M ${c.x} ${c.y} L ${g} ${d.x} ${d.y} ${t === "arrow" ? "" : `${c.x} ${c.y}`}`;
640
640
  }
641
641
  function Ln(u, l, t, r, a) {
642
- const { start: c, end: f } = qt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new G(c.x, c.y), A = new G(f.x, f.y), T = A.clone().sub(m), S = je(u, r, a), C = Dt("path");
642
+ const { start: c, end: d } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: f } = u.properties.style || t, m = new U(c.x, c.y), A = new U(d.x, d.y), T = A.clone().sub(m), S = je(u, r, a), C = Mt("path");
643
643
  C.setAttribute("data-annotation", `${u.id}`), C.setAttribute("data-annotation-type", "arrow");
644
644
  const k = p === "arrow-plain" || g === "arrow";
645
- C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${d}`), C.setAttribute("fill", k ? s || "" : "none"), C.setAttribute("stroke-linecap", "round"), C.setAttribute("stroke-linejoin", "round");
646
- const F = ke(m, T.clone().invert(), g, S), Y = ke(A, T, p, S), D = F + `M ${m.x} ${m.y} ${A.x} ${A.y}` + Y;
645
+ C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${f}`), C.setAttribute("fill", k ? s || "" : "none"), C.setAttribute("stroke-linecap", "round"), C.setAttribute("stroke-linejoin", "round");
646
+ const F = ke(m, T.clone().invert(), g, S), X = ke(A, T, p, S), D = F + `M ${m.x} ${m.y} ${A.x} ${A.y}` + X;
647
647
  C.setAttribute("d", D), l.appendChild(C);
648
648
  }
649
- const B = -1, Bt = "dragging", Vt = "dragstart", St = "dragend", se = "select", oe = "unselect", Cn = "hover", Pn = "unhover", ae = "remove", le = "add", $n = "cancelDrawing", he = "update", Nn = "link";
649
+ const q = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", se = "select", oe = "unselect", Cn = "hover", $n = "unhover", ae = "remove", le = "add", Pn = "cancelDrawing", he = "update", Nn = "link";
650
650
  var Fe = { exports: {} };
651
651
  (function(u) {
652
652
  var l = Object.prototype.hasOwnProperty, t = "~";
653
653
  function r() {
654
654
  }
655
655
  Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
656
- function a(p, s, d) {
657
- this.fn = p, this.context = s, this.once = d || !1;
656
+ function a(p, s, f) {
657
+ this.fn = p, this.context = s, this.once = f || !1;
658
658
  }
659
- function c(p, s, d, m, A) {
660
- if (typeof d != "function")
659
+ function c(p, s, f, m, A) {
660
+ if (typeof f != "function")
661
661
  throw new TypeError("The listener must be a function");
662
- var T = new a(d, m || p, A), S = t ? t + s : s;
662
+ var T = new a(f, m || p, A), S = t ? t + s : s;
663
663
  return p._events[S] ? p._events[S].fn ? p._events[S] = [p._events[S], T] : p._events[S].push(T) : (p._events[S] = T, p._eventsCount++), p;
664
664
  }
665
- function f(p, s) {
665
+ function d(p, s) {
666
666
  --p._eventsCount === 0 ? p._events = new r() : delete p._events[s];
667
667
  }
668
668
  function g() {
669
669
  this._events = new r(), this._eventsCount = 0;
670
670
  }
671
671
  g.prototype.eventNames = function() {
672
- var s = [], d, m;
672
+ var s = [], f, m;
673
673
  if (this._eventsCount === 0)
674
674
  return s;
675
- for (m in d = this._events)
676
- l.call(d, m) && s.push(t ? m.slice(1) : m);
677
- return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
675
+ for (m in f = this._events)
676
+ l.call(f, m) && s.push(t ? m.slice(1) : m);
677
+ return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(f)) : s;
678
678
  }, g.prototype.listeners = function(s) {
679
- var d = t ? t + s : s, m = this._events[d];
679
+ var f = t ? t + s : s, m = this._events[f];
680
680
  if (!m)
681
681
  return [];
682
682
  if (m.fn)
@@ -685,82 +685,82 @@ var Fe = { exports: {} };
685
685
  S[A] = m[A].fn;
686
686
  return S;
687
687
  }, g.prototype.listenerCount = function(s) {
688
- var d = t ? t + s : s, m = this._events[d];
688
+ var f = t ? t + s : s, m = this._events[f];
689
689
  return m ? m.fn ? 1 : m.length : 0;
690
- }, g.prototype.emit = function(s, d, m, A, T, S) {
690
+ }, g.prototype.emit = function(s, f, m, A, T, S) {
691
691
  var C = t ? t + s : s;
692
692
  if (!this._events[C])
693
693
  return !1;
694
- var k = this._events[C], F = arguments.length, Y, D;
694
+ var k = this._events[C], F = arguments.length, X, D;
695
695
  if (k.fn) {
696
696
  switch (k.once && this.removeListener(s, k.fn, void 0, !0), F) {
697
697
  case 1:
698
698
  return k.fn.call(k.context), !0;
699
699
  case 2:
700
- return k.fn.call(k.context, d), !0;
700
+ return k.fn.call(k.context, f), !0;
701
701
  case 3:
702
- return k.fn.call(k.context, d, m), !0;
702
+ return k.fn.call(k.context, f, m), !0;
703
703
  case 4:
704
- return k.fn.call(k.context, d, m, A), !0;
704
+ return k.fn.call(k.context, f, m, A), !0;
705
705
  case 5:
706
- return k.fn.call(k.context, d, m, A, T), !0;
706
+ return k.fn.call(k.context, f, m, A, T), !0;
707
707
  case 6:
708
- return k.fn.call(k.context, d, m, A, T, S), !0;
708
+ return k.fn.call(k.context, f, m, A, T, S), !0;
709
709
  }
710
- for (D = 1, Y = new Array(F - 1); D < F; D++)
711
- Y[D - 1] = arguments[D];
712
- k.fn.apply(k.context, Y);
710
+ for (D = 1, X = new Array(F - 1); D < F; D++)
711
+ X[D - 1] = arguments[D];
712
+ k.fn.apply(k.context, X);
713
713
  } else {
714
- var U = k.length, X;
715
- for (D = 0; D < U; D++)
714
+ var Y = k.length, G;
715
+ for (D = 0; D < Y; D++)
716
716
  switch (k[D].once && this.removeListener(s, k[D].fn, void 0, !0), F) {
717
717
  case 1:
718
718
  k[D].fn.call(k[D].context);
719
719
  break;
720
720
  case 2:
721
- k[D].fn.call(k[D].context, d);
721
+ k[D].fn.call(k[D].context, f);
722
722
  break;
723
723
  case 3:
724
- k[D].fn.call(k[D].context, d, m);
724
+ k[D].fn.call(k[D].context, f, m);
725
725
  break;
726
726
  case 4:
727
- k[D].fn.call(k[D].context, d, m, A);
727
+ k[D].fn.call(k[D].context, f, m, A);
728
728
  break;
729
729
  default:
730
- if (!Y)
731
- for (X = 1, Y = new Array(F - 1); X < F; X++)
732
- Y[X - 1] = arguments[X];
733
- k[D].fn.apply(k[D].context, Y);
730
+ if (!X)
731
+ for (G = 1, X = new Array(F - 1); G < F; G++)
732
+ X[G - 1] = arguments[G];
733
+ k[D].fn.apply(k[D].context, X);
734
734
  }
735
735
  }
736
736
  return !0;
737
- }, g.prototype.on = function(s, d, m) {
738
- return c(this, s, d, m, !1);
739
- }, g.prototype.once = function(s, d, m) {
740
- return c(this, s, d, m, !0);
741
- }, g.prototype.removeListener = function(s, d, m, A) {
737
+ }, g.prototype.on = function(s, f, m) {
738
+ return c(this, s, f, m, !1);
739
+ }, g.prototype.once = function(s, f, m) {
740
+ return c(this, s, f, m, !0);
741
+ }, g.prototype.removeListener = function(s, f, m, A) {
742
742
  var T = t ? t + s : s;
743
743
  if (!this._events[T])
744
744
  return this;
745
- if (!d)
746
- return f(this, T), this;
745
+ if (!f)
746
+ return d(this, T), this;
747
747
  var S = this._events[T];
748
748
  if (S.fn)
749
- S.fn === d && (!A || S.once) && (!m || S.context === m) && f(this, T);
749
+ S.fn === f && (!A || S.once) && (!m || S.context === m) && d(this, T);
750
750
  else {
751
751
  for (var C = 0, k = [], F = S.length; C < F; C++)
752
- (S[C].fn !== d || A && !S[C].once || m && S[C].context !== m) && k.push(S[C]);
753
- k.length ? this._events[T] = k.length === 1 ? k[0] : k : f(this, T);
752
+ (S[C].fn !== f || A && !S[C].once || m && S[C].context !== m) && k.push(S[C]);
753
+ k.length ? this._events[T] = k.length === 1 ? k[0] : k : d(this, T);
754
754
  }
755
755
  return this;
756
756
  }, g.prototype.removeAllListeners = function(s) {
757
- var d;
758
- return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
757
+ var f;
758
+ return s ? (f = t ? t + s : s, this._events[f] && d(this, f)) : (this._events = new r(), this._eventsCount = 0), this;
759
759
  }, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
760
760
  })(Fe);
761
761
  var Rn = Fe.exports;
762
- const qe = /* @__PURE__ */ ce(Rn);
763
- class Be extends qe {
762
+ const Be = /* @__PURE__ */ ce(Rn);
763
+ class qe extends Be {
764
764
  constructor(t, r) {
765
765
  super();
766
766
  v(this, "ogma");
@@ -768,8 +768,8 @@ class Be extends qe {
768
768
  // layer to draw elements
769
769
  v(this, "layer");
770
770
  v(this, "editor");
771
- v(this, "selectedId", B);
772
- v(this, "hoveredId", B);
771
+ v(this, "selectedId", q);
772
+ v(this, "hoveredId", q);
773
773
  // used to remember ogma options before we change them
774
774
  v(this, "ogmaOptions");
775
775
  v(this, "shouldDetect");
@@ -777,15 +777,15 @@ class Be extends qe {
777
777
  v(this, "showeditorOnHover");
778
778
  v(this, "maxHandleScale", 1.5);
779
779
  v(this, "_onKeyUp", (t) => {
780
- t.code === 27 && this.selectedId !== B ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== B && this._canRemove() && this.remove(this.selectedId);
780
+ t.code === 27 && this.selectedId !== q ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== q && this._canRemove() && this.remove(this.selectedId);
781
781
  });
782
782
  v(this, "_onClickMouseMove", (t) => {
783
783
  if (!t.domEvent || this.isDragging || !this.shouldDetect)
784
784
  return;
785
785
  const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
786
- t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== B && this.unhover() : a ? this.select(a.id) : this.selectedId !== B && this.unselect();
786
+ t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== q && this.unhover() : a ? this.select(a.id) : this.selectedId !== q && this.unselect();
787
787
  });
788
- this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("newFrame", () => {
788
+ this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
789
789
  this.refreshEditor(), this.refreshDrawing();
790
790
  }), this.layer = t.layers.addSVGLayer({
791
791
  draw: (a) => this.draw(a)
@@ -801,7 +801,7 @@ class Be extends qe {
801
801
  */
802
802
  add(t) {
803
803
  const r = this.getDefaultOptions(), a = Object.assign(t, {
804
- id: t.id === void 0 ? Ut() : t.id,
804
+ id: t.id === void 0 ? Xt() : t.id,
805
805
  type: t.type,
806
806
  properties: {
807
807
  ...r.properties,
@@ -845,13 +845,13 @@ class Be extends qe {
845
845
  Object.keys(r).forEach((c) => {
846
846
  if (c !== "id")
847
847
  if (c === "properties") {
848
- const f = r.properties || { style: {} };
848
+ const d = r.properties || { style: {} };
849
849
  t.properties = {
850
850
  ...t.properties || {},
851
- ...f || {},
851
+ ...d || {},
852
852
  style: {
853
853
  ...t.properties.style || {},
854
- ...f.style || {}
854
+ ...d.style || {}
855
855
  }
856
856
  };
857
857
  } else
@@ -882,15 +882,15 @@ class Be extends qe {
882
882
  r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Cn, r));
883
883
  }
884
884
  getSelectedFeature() {
885
- return this.selectedId === B ? null : this.getById(this.selectedId);
885
+ return this.selectedId === q ? null : this.getById(this.selectedId);
886
886
  }
887
887
  unselect() {
888
888
  const t = this.getById(this.selectedId);
889
- return t && this.emit(oe, t), this.selectedId = B, this.hoveredId === B && this.editor.hide(), this.layer.refresh(), this;
889
+ return t && this.emit(oe, t), this.selectedId = q, this.hoveredId === q && this.editor.hide(), this.layer.refresh(), this;
890
890
  }
891
891
  unhover() {
892
892
  const t = this.getById(this.hoveredId);
893
- return this.emit(Pn, t), this.hoveredId = B, this.selectedId === B && this.editor.hide(), this.layer.refresh(), this;
893
+ return this.emit($n, t), this.hoveredId = q, this.selectedId === q && this.editor.hide(), this.layer.refresh(), this;
894
894
  }
895
895
  /**
896
896
  * @method remove
@@ -950,7 +950,7 @@ class Be extends qe {
950
950
  }
951
951
  }
952
952
  const Te = "handle-line", Ie = "handle-start", _e = "handle-end";
953
- class Hn extends Be {
953
+ class Hn extends qe {
954
954
  constructor(t, r = {}) {
955
955
  super(
956
956
  t,
@@ -963,7 +963,7 @@ class Hn extends Be {
963
963
  `
964
964
  );
965
965
  // active handle id
966
- v(this, "draggedHandle", B);
966
+ v(this, "draggedHandle", q);
967
967
  v(this, "start", { x: 0, y: 0 });
968
968
  v(this, "end", { x: 0, y: 0 });
969
969
  v(this, "arrow", { ...Ee });
@@ -977,14 +977,14 @@ class Hn extends Be {
977
977
  r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = He(t.target));
978
978
  });
979
979
  v(this, "onMouseUp", () => {
980
- this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(St, this.arrow));
980
+ this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = q, this.emit(St, this.arrow));
981
981
  });
982
982
  v(this, "onMouseMove", (t) => {
983
- if (!this.isDragging || this.draggedHandle === B)
983
+ if (!this.isDragging || this.draggedHandle === q)
984
984
  return;
985
- const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: c, y: f } = new G(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Te, p = r.id === Ie, s = r.id === _e;
986
- (g || p) && Ne(this.arrow, this.start.x + c, this.start.y + f), (g || s) && Re(this.arrow, this.end.x + c, this.end.y + f), this.emit(
987
- Bt,
985
+ const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: c, y: d } = new U(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Te, p = r.id === Ie, s = r.id === _e;
986
+ (g || p) && Ne(this.arrow, this.start.x + c, this.start.y + d), (g || s) && Re(this.arrow, this.end.x + c, this.end.y + d), this.emit(
987
+ Ut,
988
988
  this.arrow,
989
989
  g ? "line" : p ? "start" : "end"
990
990
  ), this.refreshEditor(), this.layer.refresh();
@@ -1001,49 +1001,53 @@ class Hn extends Be {
1001
1001
  * @param y
1002
1002
  * @param arrow
1003
1003
  */
1004
- startDrawing(t, r, a = Dn(t, r, t, r, Mt)) {
1004
+ startDrawing(t, r, a = Dn(t, r, t, r, Lt)) {
1005
1005
  var g;
1006
1006
  this.add(a), this.hoveredId = a.id;
1007
- const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
1008
- this.startDragging(this.getById(a.id), c.x + (f == null ? void 0 : f.left), c.y + f.top), this.draggedHandle = 2;
1007
+ const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), d = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
1008
+ this.startDragging(this.getById(a.id), c.x + (d == null ? void 0 : d.left), c.y + d.top), this.draggedHandle = 2;
1009
1009
  }
1010
1010
  cancelDrawing() {
1011
- this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B);
1011
+ this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = q);
1012
1012
  }
1013
1013
  startDragging(t, r, a) {
1014
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = Ot(this.arrow), this.end = Ft(this.arrow), this.disableDragging(), this.emit(Vt, this.arrow), this.isDragging = !0;
1014
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = zt(this.arrow), this.end = qt(this.arrow), this.disableDragging(), this.emit(Yt, this.arrow), this.isDragging = !0;
1015
1015
  }
1016
1016
  detect(t, r = 0) {
1017
1017
  return this.elements.find((a) => {
1018
- const { start: c, end: f } = qt(a), g = new G(t.x, t.y).sub(
1019
- new G((c.x + f.x) / 2, (c.y + f.y) / 2)
1020
- ), p = new G(f.x, f.y).sub(new G(c.x, c.y)), s = p.length(), d = p.normalize(), m = je(a);
1021
- return Math.abs(d.dot(g)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
1018
+ const { start: c, end: d } = Vt(a), g = new U(t.x, t.y).sub(
1019
+ new U((c.x + d.x) / 2, (c.y + d.y) / 2)
1020
+ ), p = new U(d.x, d.y).sub(new U(c.x, c.y)), s = p.length(), f = p.normalize(), m = je(a);
1021
+ return Math.abs(f.dot(g)) < s / 2 + r && Math.abs(f.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
1022
1022
  });
1023
1023
  }
1024
1024
  refreshEditor() {
1025
1025
  if (+this.selectedId < 0 && +this.hoveredId < 0)
1026
1026
  return;
1027
- const t = this.selectedId !== B ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = qt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), c = this.ogma.view.graphToScreenCoordinates(r.end), f = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
1027
+ const t = this.selectedId !== q ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Vt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), c = this.ogma.view.graphToScreenCoordinates(r.end), d = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
1028
1028
  this.editor.element.querySelectorAll(".handle")
1029
1029
  );
1030
- p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${f})`, s.style.transform = `translate(${c.x}px, ${c.y}px) translate(-50%, -50%) scale(${f}`;
1031
- const d = {
1030
+ p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${d})`, s.style.transform = `translate(${c.x}px, ${c.y}px) translate(-50%, -50%) scale(${d}`;
1031
+ const f = {
1032
1032
  x: (c.x + a.x) / 2,
1033
1033
  y: (c.y + a.y) / 2
1034
- }, m = new G(c.x - a.x, c.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1035
- g.style.width = `${m.length()}px`, g.style.left = `${d.x}px`, g.style.top = `${d.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
1034
+ }, m = new U(c.x - a.x, c.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1035
+ g.style.width = `${m.length()}px`, g.style.left = `${f.x}px`, g.style.top = `${f.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
1036
1036
  }
1037
1037
  getDefaultOptions() {
1038
1038
  return Ee;
1039
1039
  }
1040
1040
  draw(t) {
1041
1041
  t.innerHTML = "";
1042
- const r = Dt("g");
1043
- this.elements.forEach(
1044
- (a) => Ln(a, r, Mt, this.minArrowHeight, this.maxArrowHeight)
1042
+ const r = Mt("g"), a = this.ogma.view.getAngle();
1043
+ r.setAttribute("transform", `rotate(${-a * (180 / Math.PI)})`), this.elements.forEach(
1044
+ (c) => Ln(c, r, Lt, this.minArrowHeight, this.maxArrowHeight)
1045
1045
  ), t.appendChild(r);
1046
1046
  }
1047
+ refreshDrawing() {
1048
+ const t = this.ogma.view.getAngle();
1049
+ this.layer.element.children[0].setAttribute("transform", `rotate(${-t * (180 / Math.PI)})`);
1050
+ }
1047
1051
  destroy() {
1048
1052
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
1049
1053
  }
@@ -1082,7 +1086,7 @@ const At = {
1082
1086
  handleSize: 3.5,
1083
1087
  placeholder: "Your text..."
1084
1088
  }, jn = (u = 0, l = 0, t = 100, r = 50, a = "", c = { ...At }) => ({
1085
- id: Ut(),
1089
+ id: Xt(),
1086
1090
  type: "Feature",
1087
1091
  properties: {
1088
1092
  type: "text",
@@ -1119,7 +1123,7 @@ var Ve = { exports: {} };
1119
1123
  }, a(e);
1120
1124
  }
1121
1125
  t.d(r, { default: () => Sn });
1122
- var c = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, f = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, d = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1126
+ var c = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, d = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, f = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1123
1127
  function m(e) {
1124
1128
  var n = "", o = this;
1125
1129
  return o.style && o.style !== "normal" && (n += o.style), o.variant && o.variant !== "normal" && (n += (n ? " " : "") + o.variant), o.weight && o.weight !== "normal" && (n += (n ? " " : "") + o.weight), o.size && (n += (n ? " " : "") + o.size + "px", o.height !== o.size && (n += "/" + o.height + "px")), o.family && (n += (n ? " " : "") + o.family), e && (n += "::" + o.baseline), e && (n += "::" + o.color), n;
@@ -1128,10 +1132,10 @@ var Ve = { exports: {} };
1128
1132
  function T(e) {
1129
1133
  var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = c.exec(e);
1130
1134
  n.family = (o[6] || "").trim();
1131
- var i = d[o[2]] || parseFloat(o[2]);
1135
+ var i = f[o[2]] || parseFloat(o[2]);
1132
1136
  o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
1133
1137
  var h = parseFloat(o[4]);
1134
- if (h !== "normal" && h !== "inherit" && h ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = h * s : o[5] === "%" ? n.height = 0.01 * i : n.height = h : n.height = h * i : n.height = Math.round(i * (7 / 6)), f.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
1138
+ if (h !== "normal" && h !== "inherit" && h ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = h * s : o[5] === "%" ? n.height = 0.01 * i : n.height = h : n.height = h * i : n.height = Math.round(i * (7 / 6)), d.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
1135
1139
  n.weight = "bold";
1136
1140
  else {
1137
1141
  var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
@@ -1169,33 +1173,33 @@ var Ve = { exports: {} };
1169
1173
  k[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1170
1174
  }
1171
1175
  return e.length * k[n].size;
1172
- }), Y = {}, D = { trim: !0, collapse: !0 };
1173
- function U(e, n, o) {
1176
+ }), X = {}, D = { trim: !0, collapse: !0 };
1177
+ function Y(e, n, o) {
1174
1178
  var i = Object.assign({}, D, o), h = String(e);
1175
1179
  if (!h)
1176
1180
  return 0;
1177
1181
  if (h in C) {
1178
1182
  var y = n.id + "/" + h;
1179
- return y in Y || (Y[y] = F("_".concat(h, "_"), n) - F("__", n)), Y[y];
1183
+ return y in X || (X[y] = F("_".concat(h, "_"), n) - F("__", n)), X[y];
1180
1184
  }
1181
1185
  return i.trim && i.collapse ? i.trim ? h = h.trim() : i.collapse && (h = h.replace(/\s+/g, " ")) : h = h.replace(/\n/g, " "), F(h, n) + n.size * (e.tracking || 0);
1182
1186
  }
1183
- function X(e) {
1184
- return X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1187
+ function G(e) {
1188
+ return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1185
1189
  return typeof n;
1186
1190
  } : function(n) {
1187
1191
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1188
- }, X(e);
1192
+ }, G(e);
1189
1193
  }
1190
- function Yt(e, n) {
1194
+ function Et(e, n) {
1191
1195
  if (typeof n != "function" && n !== null)
1192
1196
  throw new TypeError("Super expression must either be null or a function");
1193
- e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Xt(e, n);
1197
+ e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && kt(e, n);
1194
1198
  }
1195
- function Xt(e, n) {
1196
- return Xt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1199
+ function kt(e, n) {
1200
+ return kt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1197
1201
  return o.__proto__ = i, o;
1198
- }, Xt(e, n);
1202
+ }, kt(e, n);
1199
1203
  }
1200
1204
  function Gt(e) {
1201
1205
  var n = function() {
@@ -1211,9 +1215,9 @@ var Ve = { exports: {} };
1211
1215
  }
1212
1216
  }();
1213
1217
  return function() {
1214
- var o, i = zt(e);
1218
+ var o, i = Ct(e);
1215
1219
  if (n) {
1216
- var h = zt(this).constructor;
1220
+ var h = Ct(this).constructor;
1217
1221
  o = Reflect.construct(i, arguments, h);
1218
1222
  } else
1219
1223
  o = i.apply(this, arguments);
@@ -1221,7 +1225,7 @@ var Ve = { exports: {} };
1221
1225
  };
1222
1226
  }
1223
1227
  function Ue(e, n) {
1224
- if (n && (X(n) === "object" || typeof n == "function"))
1228
+ if (n && (G(n) === "object" || typeof n == "function"))
1225
1229
  return n;
1226
1230
  if (n !== void 0)
1227
1231
  throw new TypeError("Derived constructors may only return object or undefined");
@@ -1231,12 +1235,12 @@ var Ve = { exports: {} };
1231
1235
  return o;
1232
1236
  }(e);
1233
1237
  }
1234
- function zt(e) {
1235
- return zt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1238
+ function Ct(e) {
1239
+ return Ct = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1236
1240
  return n.__proto__ || Object.getPrototypeOf(n);
1237
- }, zt(e);
1241
+ }, Ct(e);
1238
1242
  }
1239
- function Lt(e, n) {
1243
+ function $t(e, n) {
1240
1244
  if (!(e instanceof n))
1241
1245
  throw new TypeError("Cannot call a class as a function");
1242
1246
  }
@@ -1244,29 +1248,29 @@ var Ve = { exports: {} };
1244
1248
  for (var o = 0; o < n.length; o++) {
1245
1249
  var i = n[o];
1246
1250
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1247
- if (X(y) !== "object" || y === null)
1251
+ if (G(y) !== "object" || y === null)
1248
1252
  return y;
1249
1253
  var x = y[Symbol.toPrimitive];
1250
1254
  if (x !== void 0) {
1251
1255
  var b = x.call(y, w);
1252
- if (X(b) !== "object")
1256
+ if (G(b) !== "object")
1253
1257
  return b;
1254
1258
  throw new TypeError("@@toPrimitive must return a primitive value.");
1255
1259
  }
1256
1260
  return String(y);
1257
- }(i.key, "string"), X(h) === "symbol" ? h : String(h)), i);
1261
+ }(i.key, "string"), G(h) === "symbol" ? h : String(h)), i);
1258
1262
  }
1259
1263
  var h;
1260
1264
  }
1261
- function Ct(e, n, o) {
1265
+ function Pt(e, n, o) {
1262
1266
  return n && ue(e.prototype, n), o && ue(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1263
1267
  }
1264
1268
  var N = function() {
1265
1269
  function e() {
1266
1270
  var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
1267
- Lt(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1271
+ $t(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1268
1272
  }
1269
- return Ct(e, [{ key: "clone", value: function() {
1273
+ return Pt(e, [{ key: "clone", value: function() {
1270
1274
  var n = new e(this.value);
1271
1275
  return n.value = this.value, n.weight = this.weight, n.style = this.style, n.font = this.font, n.href = this.href, n.sub = this.sub, n.sup = this.sup, n;
1272
1276
  } }, { key: "valueOf", value: function() {
@@ -1274,36 +1278,36 @@ var Ve = { exports: {} };
1274
1278
  } }, { key: "toString", value: function() {
1275
1279
  return this.value;
1276
1280
  } }]), e;
1277
- }(), Et = function(e) {
1278
- Yt(o, e);
1281
+ }(), Tt = function(e) {
1282
+ Et(o, e);
1279
1283
  var n = Gt(o);
1280
1284
  function o() {
1281
- return Lt(this, o), n.apply(this, arguments);
1285
+ return $t(this, o), n.apply(this, arguments);
1282
1286
  }
1283
- return Ct(o);
1287
+ return Pt(o);
1284
1288
  }(N), nt = function(e) {
1285
- Yt(o, e);
1289
+ Et(o, e);
1286
1290
  var n = Gt(o);
1287
1291
  function o() {
1288
- return Lt(this, o), n.apply(this, arguments);
1292
+ return $t(this, o), n.apply(this, arguments);
1289
1293
  }
1290
- return Ct(o);
1294
+ return Pt(o);
1291
1295
  }(N), pt = function(e) {
1292
- Yt(o, e);
1296
+ Et(o, e);
1293
1297
  var n = Gt(o);
1294
1298
  function o() {
1295
- return Lt(this, o), n.apply(this, arguments);
1299
+ return $t(this, o), n.apply(this, arguments);
1296
1300
  }
1297
- return Ct(o);
1301
+ return Pt(o);
1298
1302
  }(N), Zt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ye = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, de = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Xe = /^(?:[;\xAD%?…]|,(?!\d))/, Ge = /^[´±°¢£¤$¥\u2212]/;
1299
- function Pt(e, n) {
1303
+ function Nt(e, n) {
1300
1304
  n !== !1 && (e = e.trim());
1301
1305
  for (var o, i, h = [], y = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
1302
1306
  o = e.charAt(x), i = e.charAt(x + 1);
1303
1307
  var E = Zt.test(y), O = Zt.test(o), M = O || E, I = void 0;
1304
1308
  if ((Ge.test(o) && !de.test(y) || Xe.test(y + i) && !de.test(o)) && (M = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((I = Zt.test(e.charAt(x - 2))) && !O && (M = !1), !I && Ye.test(o + i) && (M = !0)), M) {
1305
1309
  var z = e.slice(w, x);
1306
- /\u00AD$/.test(z) ? (h.push(new N(z.slice(0, -1))), h.push(new pt())) : (h.push(new N(z)), h.push(new Et())), w = x;
1310
+ /\u00AD$/.test(z) ? (h.push(new N(z.slice(0, -1))), h.push(new pt())) : (h.push(new N(z)), h.push(new Tt())), w = x;
1307
1311
  }
1308
1312
  y = o;
1309
1313
  }
@@ -1396,7 +1400,7 @@ var Ve = { exports: {} };
1396
1400
  }
1397
1401
  function me(e, n, o) {
1398
1402
  for (var i, h, y = e.width; y + o.width > n && e.length; )
1399
- h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = U(i, i.font), y += i.width) : e.pop(), y -= h;
1403
+ h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = Y(i, i.font), y += i.width) : e.pop(), y -= h;
1400
1404
  e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font = S(o.font, i.bold, i.italic, ""), o.href = e.length ? i.href : null, o.rel = e.length ? i.rel : null, o.target = e.length ? i.target : null, e.push(o);
1401
1405
  }
1402
1406
  function vt(e) {
@@ -1435,30 +1439,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1435
1439
  if (e.length) {
1436
1440
  var b = i.height, E = n.valign(), O = n.height()(), M = n.width()(0), I = !isFinite(M) && e.length === 1, z = I ? null : n.x(), R = vt(b / h), Q = I ? null : vt(b / (1.15 * h + (b - h) / 2));
1437
1441
  if (pn[E] && isFinite(O)) {
1438
- var P = E === "bottom" ? 1 : 0.5;
1439
- Q += (O * P - b * e.length * P) / h;
1442
+ var $ = E === "bottom" ? 1 : 0.5;
1443
+ Q += (O * $ - b * e.length * $) / h;
1440
1444
  }
1441
1445
  var L = w === "justify", H = 0;
1442
1446
  w === "right" ? H = M : w === "center" && (H = M / 2);
1443
- for (var $ = [], tt = "tspan", Z = null, j = "", _ = function() {
1447
+ for (var P = [], tt = "tspan", Z = null, j = "", _ = function() {
1444
1448
  if (j) {
1445
1449
  var gt = x(tt, Z, j);
1446
- $.push(gt);
1450
+ P.push(gt);
1447
1451
  }
1448
1452
  tt = "tspan", Z = null, j = "";
1449
1453
  }, it = 0, et = e.length; it < et; it++) {
1450
- var at = "", ut = "", st = 0, lt = e[it];
1454
+ var at = "", dt = "", st = 0, lt = e[it];
1451
1455
  if (lt.length) {
1452
- $ = [];
1453
- for (var xt = 0, It = 0, ht = void 0, W = 0, $t = lt.length; W < $t; W++) {
1454
- var q = lt[W], K = q.font;
1455
- q.whitespace && xt++, It += q.width, W && !q.tracking && !st && Kt(K.id, at) && Kt(q.class, ut) && Kt(ht, q.href) ? j += q.value : (_(), j = q.value, Z = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== h ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: q.class || null }, st && (Z.dx = vt(st), st = 0), q.tracking && (st = K.size * q.tracking), q.href && !ht ? (ht = q.href, tt = "a", Z.href = ht, Z.rel = q.rel, Z.target = q.target) : ht = null, at = K.id, ut = q.class);
1456
+ P = [];
1457
+ for (var xt = 0, Dt = 0, ht = void 0, W = 0, Rt = lt.length; W < Rt; W++) {
1458
+ var B = lt[W], K = B.font;
1459
+ B.whitespace && xt++, Dt += B.width, W && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? j += B.value : (_(), j = B.value, Z = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== h ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: B.class || null }, st && (Z.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", Z.href = ht, Z.rel = B.rel, Z.target = B.target) : ht = null, at = K.id, dt = B.class);
1456
1460
  }
1457
1461
  if (_(), I)
1458
- o.push.apply(o, ve($));
1462
+ o.push.apply(o, ve(P));
1459
1463
  else {
1460
- var Nt = null, _t = it === et - 1 || lt[lt.length - 1] instanceof nt;
1461
- L && lt.length > 1 && !_t && (Nt = vt((M - It) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Nt, x: z(it) + H, dy: vt(it ? R : Q) + "em" }].concat(ve($))));
1464
+ var Ht = null, Ot = it === et - 1 || lt[lt.length - 1] instanceof nt;
1465
+ L && lt.length > 1 && !Ot && (Ht = vt((M - Dt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Ht, x: z(it) + H, dy: vt(it ? R : Q) + "em" }].concat(ve(P))));
1462
1466
  }
1463
1467
  } else
1464
1468
  o.push(x("tspan", { x: z(it), dy: vt(it ? R : Q) + "em" }, " "));
@@ -1476,24 +1480,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1476
1480
  M += x * I - z * I;
1477
1481
  }
1478
1482
  e.forEach(function(R, Q) {
1479
- var P = n.x()(Q), L = Q * h + M, H = 0, $ = 0;
1483
+ var $ = n.x()(Q), L = Q * h + M, H = 0, P = 0;
1480
1484
  R.forEach(function(j) {
1481
- j.whitespace && H++, $ += j.width;
1485
+ j.whitespace && H++, P += j.width;
1482
1486
  });
1483
1487
  var tt = 0, Z = Q === e.length - 1 || R[R.length - 1] instanceof nt;
1484
- O && R.length > 1 && !Z && (tt = (b - $) / H), R.forEach(function(j) {
1488
+ O && R.length > 1 && !Z && (tt = (b - P) / H), R.forEach(function(j) {
1485
1489
  o.font = j.font;
1486
1490
  var _ = j.font, it = _.baseline ? y * -_.baseline + 0.15 * y : 0;
1487
- o.fillStyle = function(ut, st) {
1488
- return ut.color ? ut.color : st.href ? "#00C" : "#000";
1491
+ o.fillStyle = function(dt, st) {
1492
+ return dt.color ? dt.color : st.href ? "#00C" : "#000";
1489
1493
  }(_, j);
1490
1494
  var et = 0;
1491
- if (E === "right" ? et += b - $ : E === "center" ? et += b / 2 - $ / 2 : E === "justify" && (j.whitespace || j instanceof nt) && (P += tt), o.fillText(j.value, P + et, L + it), j.href) {
1495
+ if (E === "right" ? et += b - P : E === "center" ? et += b / 2 - P / 2 : E === "justify" && (j.whitespace || j instanceof nt) && ($ += tt), o.fillText(j.value, $ + et, L + it), j.href) {
1492
1496
  o.beginPath(), o.strokeStyle = o.fillStyle;
1493
1497
  var at = Math.floor(L + 0.45 * y) + 0.5;
1494
- o.moveTo(P + et, at), o.lineTo(P + et + j.width, at), o.stroke();
1498
+ o.moveTo($ + et, at), o.lineTo($ + et + j.width, at), o.stroke();
1495
1499
  }
1496
- P += j.width;
1500
+ $ += j.width;
1497
1501
  });
1498
1502
  });
1499
1503
  }
@@ -1512,28 +1516,28 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1512
1516
  }
1513
1517
  return n;
1514
1518
  }
1515
- function kt(e) {
1516
- return kt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1519
+ function It(e) {
1520
+ return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1517
1521
  return typeof n;
1518
1522
  } : function(n) {
1519
1523
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1520
- }, kt(e);
1524
+ }, It(e);
1521
1525
  }
1522
1526
  function vn(e, n) {
1523
1527
  for (var o = 0; o < n.length; o++) {
1524
1528
  var i = n[o];
1525
1529
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1526
- if (kt(y) !== "object" || y === null)
1530
+ if (It(y) !== "object" || y === null)
1527
1531
  return y;
1528
1532
  var x = y[Symbol.toPrimitive];
1529
1533
  if (x !== void 0) {
1530
1534
  var b = x.call(y, w);
1531
- if (kt(b) !== "object")
1535
+ if (It(b) !== "object")
1532
1536
  return b;
1533
1537
  throw new TypeError("@@toPrimitive must return a primitive value.");
1534
1538
  }
1535
1539
  return String(y);
1536
- }(i.key, "string"), kt(h) === "symbol" ? h : String(h)), i);
1540
+ }(i.key, "string"), It(h) === "symbol" ? h : String(h)), i);
1537
1541
  }
1538
1542
  var h;
1539
1543
  }
@@ -1561,48 +1565,48 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1561
1565
  var h = this, y = this.props.parser(String(i)), w = this.font(), x = function(b, E, O) {
1562
1566
  if (!b.length)
1563
1567
  return [];
1564
- var M = E.height(), I = E.width(), z = E.overflowLine(), R = E.overflowWrap(), Q = S(O, !0, !1), P = isFinite(M()) ? Math.floor(M() / O.height) : 1 / 0;
1565
- if (!M() && !I(0) || !P)
1568
+ var M = E.height(), I = E.width(), z = E.overflowLine(), R = E.overflowWrap(), Q = S(O, !0, !1), $ = isFinite(M()) ? Math.floor(M() / O.height) : 1 / 0;
1569
+ if (!M() && !I(0) || !$)
1566
1570
  return [];
1567
- for (var L = 0, H = 0, $ = 0, tt = [], Z = [], j = !1; L < b.length && H < P; ) {
1571
+ for (var L = 0, H = 0, P = 0, tt = [], Z = [], j = !1; L < b.length && H < $; ) {
1568
1572
  var _ = b[L], it = dn(_, O);
1569
- if (_.width = U(_, it), _.font = it, _.line = H, _.whitespace = _.value in C, _.value && (_.value = _.value.replace(un, " ")), !(!$ && _.whitespace || j && _.whitespace))
1573
+ if (_.width = Y(_, it), _.font = it, _.line = H, _.whitespace = _.value in C, _.value && (_.value = _.value.replace(un, " ")), !(!P && _.whitespace || j && _.whitespace))
1570
1574
  if (_ instanceof nt)
1571
- $ = 0, Z = [], tt.push(L + 1), H++;
1572
- else if (_ instanceof Et || _ instanceof pt)
1573
- Z.push({ index: L, width: $ });
1574
- else if (_.whitespace || $ + _.width < I(H))
1575
- $ += _.width;
1575
+ P = 0, Z = [], tt.push(L + 1), H++;
1576
+ else if (_ instanceof Tt || _ instanceof pt)
1577
+ Z.push({ index: L, width: P });
1578
+ else if (_.whitespace || P + _.width < I(H))
1579
+ P += _.width;
1576
1580
  else if (Z.length) {
1577
1581
  var et = void 0, at = void 0;
1578
1582
  do {
1579
1583
  at = !0, et = Z.pop();
1580
- var ut = b[et.index], st = void 0;
1581
- ut instanceof pt && (st = U("-", ut.font), et.width + st > I(H) && (at = !Z.length));
1584
+ var dt = b[et.index], st = void 0;
1585
+ dt instanceof pt && (st = Y("-", dt.font), et.width + st > I(H) && (at = !Z.length));
1582
1586
  } while (!at);
1583
- tt.push(et.index + 1), $ = 0, H++, L = et.index, Z = [];
1587
+ tt.push(et.index + 1), P = 0, H++, L = et.index, Z = [];
1584
1588
  } else if (R === "break-word") {
1585
1589
  var lt = I(H);
1586
- if ($ + _.width > lt) {
1590
+ if (P + _.width > lt) {
1587
1591
  var xt = _.clone();
1588
1592
  do
1589
- _.value = _.value.slice(0, -1), _.width = U(_, _.font), $ += _.width;
1593
+ _.value = _.value.slice(0, -1), _.width = Y(_, _.font), P += _.width;
1590
1594
  while (_.value && _.width > lt);
1591
- xt.value = xt.value.slice(_.value.length), b.splice(L + 1, 0, new Et(), xt);
1595
+ xt.value = xt.value.slice(_.value.length), b.splice(L + 1, 0, new Tt(), xt);
1592
1596
  }
1593
- tt.push(L + 1), $ = 0, H++;
1597
+ tt.push(L + 1), P = 0, H++;
1594
1598
  } else
1595
- $ += _.width;
1599
+ P += _.width;
1596
1600
  L++, j = _.whitespace;
1597
1601
  }
1598
1602
  L !== tt[tt.length - 1] && tt.push(L);
1599
- var It = 0, ht = 0, W = tt.map(function(gt) {
1600
- for (var J, yt = It; (J = b[yt]) && (J.whitespace || !J.value); )
1603
+ var Dt = 0, ht = 0, W = tt.map(function(gt) {
1604
+ for (var J, yt = Dt; (J = b[yt]) && (J.whitespace || !J.value); )
1601
1605
  yt++;
1602
- for (var dt = gt, ne = null; dt > yt && (J = b[dt - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
1603
- J instanceof nt && (ne = J), dt--;
1604
- J instanceof pt && (J.value = "-", J.width = U("-", J.font)), It = gt;
1605
- var wt = b.slice(yt, dt).filter(function(ie) {
1606
+ for (var ft = gt, ne = null; ft > yt && (J = b[ft - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
1607
+ J instanceof nt && (ne = J), ft--;
1608
+ J instanceof pt && (J.value = "-", J.width = Y("-", J.font)), Dt = gt;
1609
+ var wt = b.slice(yt, ft).filter(function(ie) {
1606
1610
  return ie.value;
1607
1611
  });
1608
1612
  return ne && wt.push(ne), wt.width = wt.reduce(function(ie, En) {
@@ -1610,19 +1614,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1610
1614
  }, 0), wt.width > ht && (ht = wt.width), wt;
1611
1615
  });
1612
1616
  if (W.hasLineOverflow = !1, z) {
1613
- var $t = z === "ellipsis" ? "…" : z;
1617
+ var Rt = z === "ellipsis" ? "…" : z;
1614
1618
  W.forEach(function(gt, J) {
1615
1619
  var yt = I(J);
1616
1620
  if (gt.width > yt) {
1617
- var dt = new N($t);
1618
- dt.font = O, dt.width = U($t, Q), me(gt, yt, dt), W.hasLineOverflow = !0;
1621
+ var ft = new N(Rt);
1622
+ ft.font = O, ft.width = Y(Rt, Q), me(gt, yt, ft), W.hasLineOverflow = !0;
1619
1623
  }
1620
1624
  });
1621
1625
  }
1622
- var q = E.overflow() === "ellipsis" ? "…" : E.overflow();
1623
- if (q && L !== b.length) {
1624
- var K = I(W.length - 1), Nt = W[W.length - 1], _t = new N(q);
1625
- _t.font = O, _t.width = U(q, Q), me(Nt, K, _t), W.hasOverflow = !0;
1626
+ var B = E.overflow() === "ellipsis" ? "…" : E.overflow();
1627
+ if (B && L !== b.length) {
1628
+ var K = I(W.length - 1), Ht = W[W.length - 1], Ot = new N(B);
1629
+ Ot.font = O, Ot.width = Y(B, Q), me(Ht, K, Ot), W.hasOverflow = !0;
1626
1630
  } else
1627
1631
  W.hasOverflow = !1;
1628
1632
  return W.font = O, W.width = ht, W;
@@ -1671,12 +1675,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1671
1675
  return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? mn(i.text, this, i.ctx) : gn(i.text, this);
1672
1676
  } }], o && vn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1673
1677
  }();
1674
- function Tt(e) {
1675
- return Tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1678
+ function _t(e) {
1679
+ return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1676
1680
  return typeof n;
1677
1681
  } : function(n) {
1678
1682
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1679
- }, Tt(e);
1683
+ }, _t(e);
1680
1684
  }
1681
1685
  function te(e, n) {
1682
1686
  (n == null || n > e.length) && (n = e.length);
@@ -1688,17 +1692,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1688
1692
  for (var o = 0; o < n.length; o++) {
1689
1693
  var i = n[o];
1690
1694
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1691
- if (Tt(y) !== "object" || y === null)
1695
+ if (_t(y) !== "object" || y === null)
1692
1696
  return y;
1693
1697
  var x = y[Symbol.toPrimitive];
1694
1698
  if (x !== void 0) {
1695
1699
  var b = x.call(y, w);
1696
- if (Tt(b) !== "object")
1700
+ if (_t(b) !== "object")
1697
1701
  return b;
1698
1702
  throw new TypeError("@@toPrimitive must return a primitive value.");
1699
1703
  }
1700
1704
  return String(y);
1701
- }(i.key, "string"), Tt(h) === "symbol" ? h : String(h)), i);
1705
+ }(i.key, "string"), _t(h) === "symbol" ? h : String(h)), i);
1702
1706
  }
1703
1707
  var h;
1704
1708
  }
@@ -1796,7 +1800,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1796
1800
  }), o;
1797
1801
  }
1798
1802
  }
1799
- rt.createElement = Se, rt.textparser = Pt, rt.defaultparser = Pt, rt.htmlparser = function(e) {
1803
+ rt.createElement = Se, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
1800
1804
  e = String(e || "").trim();
1801
1805
  for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, h = [], y = [], w = function(M) {
1802
1806
  for (var I in i)
@@ -1805,7 +1809,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1805
1809
  }, x = function(M) {
1806
1810
  var I = h.length, z = tn[M];
1807
1811
  if (I && z) {
1808
- for (var R = I - 1; h[R] && (h[R] instanceof Et || Ze.test(h[R].value)); )
1812
+ for (var R = I - 1; h[R] && (h[R] instanceof Tt || Ze.test(h[R].value)); )
1809
1813
  R--;
1810
1814
  for (; z && h[R] && h[R] instanceof nt; )
1811
1815
  R--, z--;
@@ -1814,7 +1818,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1814
1818
  }
1815
1819
  }; e.length; ) {
1816
1820
  if (n = /^[^<]+/.exec(e))
1817
- Pt(ge(n[0]), !1).forEach(w);
1821
+ Nt(ge(n[0]), !1).forEach(w);
1818
1822
  else if (!(n = Je.exec(e)))
1819
1823
  if (n = We.exec(e))
1820
1824
  y.length && (i = y.pop()), x(n[1]);
@@ -1833,25 +1837,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1833
1837
  }, rt.latexparser = function(e) {
1834
1838
  e = String(e || "").trim();
1835
1839
  var n = [0];
1836
- e = e.replace(/\\verb,(.*?),/, function(P, L) {
1840
+ e = e.replace(/\\verb,(.*?),/, function($, L) {
1837
1841
  return n.push(L), "\\verb," + (n.length - 1) + ",";
1838
1842
  }).replace(/\\\\\n/g, function() {
1839
1843
  return "\\\\";
1840
- }).replace(hn, function(P, L, H) {
1841
- return H.charAt(L - 1) === "\\" ? P : cn[P];
1842
- }).replace(/\n\s+/g, function(P) {
1843
- return /\n/.test(P.slice(1)) ? "\\par " : P;
1844
- }).replace(/\\symbol\{(\d+)\}/, function(P, L, H, $) {
1845
- return $.charAt(H - 1) === "\\" ? P : String.fromCharCode(1 * L);
1846
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(P, L, H, $) {
1847
- return L + H + "{" + $ + "}";
1848
- }).replace(/\\verb,(.*?),/, function(P, L) {
1844
+ }).replace(hn, function($, L, H) {
1845
+ return H.charAt(L - 1) === "\\" ? $ : cn[$];
1846
+ }).replace(/\n\s+/g, function($) {
1847
+ return /\n/.test($.slice(1)) ? "\\par " : $;
1848
+ }).replace(/\\symbol\{(\d+)\}/, function($, L, H, P) {
1849
+ return P.charAt(H - 1) === "\\" ? $ : String.fromCharCode(1 * L);
1850
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function($, L, H, P) {
1851
+ return L + H + "{" + P + "}";
1852
+ }).replace(/\\verb,(.*?),/, function($, L) {
1849
1853
  return "\\verb,".concat(n[+L], ",");
1850
1854
  });
1851
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], y = [], w = function(P) {
1855
+ for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], y = [], w = function($) {
1852
1856
  for (var L in i)
1853
- i[L] && (P[L] = i[L]);
1854
- return h.push(P), P;
1857
+ i[L] && ($[L] = i[L]);
1858
+ return h.push($), $;
1855
1859
  }, x = function() {
1856
1860
  y.push(i), i = Object.create(i);
1857
1861
  }, b = function() {
@@ -1860,7 +1864,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1860
1864
  i = y.pop();
1861
1865
  }, E = { tokens: h, open_context: x, close_context: b, add_token: w }; e.length; ) {
1862
1866
  if (o = an.exec(e))
1863
- Pt(o[0], !1).forEach(w);
1867
+ Nt(o[0], !1).forEach(w);
1864
1868
  else if (o = ln.exec(e))
1865
1869
  w(new N(o[1]));
1866
1870
  else if (!(o = on.exec(e))) {
@@ -1899,16 +1903,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1899
1903
  }
1900
1904
  return h;
1901
1905
  }, rt.measureText = function(e, n, o) {
1902
- return U(e, S(n), o);
1903
- }, rt.Token = N, rt.Break = Et, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = be, be.createElement = Se;
1906
+ return Y(e, S(n), o);
1907
+ }, rt.Token = N, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = be, be.createElement = Se;
1904
1908
  const Sn = rt;
1905
1909
  return r.default;
1906
1910
  })());
1907
1911
  })(Ve);
1908
1912
  var Fn = Ve.exports;
1909
1913
  const Oe = /* @__PURE__ */ ce(Fn);
1910
- function qn(u, l) {
1911
- const t = ct(u), { fontSize: r, font: a, padding: c = 0 } = u.properties.style || {};
1914
+ function Bn(u, l) {
1915
+ const t = ut(u), { fontSize: r, font: a, padding: c = 0 } = u.properties.style || {};
1912
1916
  if (t.width === t.height && t.width === 0)
1913
1917
  return;
1914
1918
  const p = new Oe({
@@ -1928,7 +1932,7 @@ function qn(u, l) {
1928
1932
  p.setAttribute("transform", `translate(${c}, ${c})`), l.appendChild(p);
1929
1933
  }
1930
1934
  const Me = 20;
1931
- class Bn extends Be {
1935
+ class qn extends qe {
1932
1936
  constructor(t, r = {}) {
1933
1937
  super(
1934
1938
  t,
@@ -1953,7 +1957,7 @@ class Bn extends Be {
1953
1957
  v(this, "startX", 0);
1954
1958
  v(this, "startY", 0);
1955
1959
  v(this, "handles", []);
1956
- v(this, "draggedHandle", B);
1960
+ v(this, "draggedHandle", q);
1957
1961
  v(this, "isFocused", !1);
1958
1962
  v(this, "placeholder", "Type your text here...");
1959
1963
  v(this, "_onFocus", () => {
@@ -1968,12 +1972,12 @@ class Bn extends Be {
1968
1972
  this.select(a.id), this.startDragging(this.getById(a.id), c.x, c.y), this.draggedHandle = 6;
1969
1973
  });
1970
1974
  v(this, "cancelDrawing", () => {
1971
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = B, this.isDragging = !1, this.emit(St, this.annotation));
1975
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = q, this.isDragging = !1, this.emit(St, this.annotation));
1972
1976
  });
1973
1977
  v(this, "startDragging", (t, r, a) => {
1974
1978
  this.annotation = t;
1975
- const c = ft(this.annotation), f = ct(this.annotation);
1976
- this.rect.x = c.x, this.rect.y = c.y, this.rect.width = f.width, this.rect.height = f.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Vt, this.annotation), this.isDragging = !0;
1979
+ const c = ct(this.annotation), d = ut(this.annotation);
1980
+ this.rect.x = c.x, this.rect.y = c.y, this.rect.width = d.width, this.rect.height = d.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Yt, this.annotation), this.isDragging = !0;
1977
1981
  });
1978
1982
  v(this, "onHandleMouseDown", (t) => {
1979
1983
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
@@ -1986,19 +1990,19 @@ class Bn extends Be {
1986
1990
  if (!this.isDragging)
1987
1991
  return;
1988
1992
  t.stopPropagation(), t.preventDefault();
1989
- const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), c = r.classList.contains("left"), f = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), d = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, A = this.ogma.view.getAngle(), T = new G(d, m).rotateRadians(A);
1990
- (g && c || a && f) && (T.y = 0, T.x = 0);
1993
+ const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), c = r.classList.contains("left"), d = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), f = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, A = this.ogma.view.getAngle(), T = new U(f, m).rotateRadians(A);
1994
+ (g && c || a && d) && (T.y = 0, T.x = 0);
1991
1995
  const S = c || p ? this.rect.x + T.x : this.rect.x, C = a || p ? this.rect.y + T.y : this.rect.y, k = Math.max(
1992
- this.rect.width + d * (p || c ? 0 : 1),
1996
+ this.rect.width + f * (p || c ? 0 : 1),
1993
1997
  Me
1994
1998
  ), F = Math.max(
1995
1999
  this.rect.height + m * (p || a ? 0 : 1),
1996
2000
  Me
1997
2001
  );
1998
- zn(this.annotation, S, C, k, F), this.emit(Bt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2002
+ zn(this.annotation, S, C, k, F), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1999
2003
  });
2000
2004
  v(this, "onMouseUp", () => {
2001
- !this.isDragging || this.draggedHandle === B || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = B);
2005
+ !this.isDragging || this.draggedHandle === q || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = q);
2002
2006
  });
2003
2007
  v(this, "onViewChanged", () => {
2004
2008
  const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
@@ -2020,41 +2024,43 @@ class Bn extends Be {
2020
2024
  return !this.isFocused;
2021
2025
  }
2022
2026
  detect({ x: t, y: r }, a = 0) {
2023
- const c = new G(t, r), f = this.ogma.view.getAngle();
2027
+ const c = new U(t, r), d = this.ogma.view.getAngle();
2024
2028
  return this.elements.find((g) => {
2025
- const { x: p, y: s } = ft(g), { width: d, height: m } = ct(g), A = new G(p, s), { x: T, y: S } = c.sub(A).rotateRadians(-f);
2026
- return T > -a && T < d + a && S > -a && S < m + a;
2029
+ const { x: p, y: s } = ct(g), { width: f, height: m } = ut(g), A = new U(p, s), { x: T, y: S } = c.sub(A).rotateRadians(-d);
2030
+ return T > -a && T < f + a && S > -a && S < m + a;
2027
2031
  });
2028
2032
  }
2029
2033
  draw(t) {
2030
2034
  t.innerHTML = "";
2031
- const r = "", a = this.ogma.view.getAngle() * 180 / Math.PI;
2032
- this.elements.forEach((f, g) => {
2033
- const p = `class${g}`, s = ct(f), d = ft(f), m = f.id, {
2035
+ const r = "", a = this.ogma.view.getAngle();
2036
+ this.elements.forEach((d, g) => {
2037
+ const p = `class${g}`, s = ut(d), f = ct(d), m = d.id, {
2034
2038
  color: A,
2035
2039
  fontSize: T,
2036
2040
  font: S,
2037
2041
  strokeColor: C,
2038
2042
  strokeWidth: k,
2039
2043
  strokeType: F,
2040
- background: Y
2041
- } = f.properties.style || At;
2044
+ background: X
2045
+ } = d.properties.style || At;
2042
2046
  if (m === this.selectedId)
2043
2047
  return;
2044
- const D = Dt("g");
2048
+ const D = Mt("g");
2045
2049
  D.classList.add("annotation-text"), D.setAttribute("fill", `${A}`), D.setAttribute("font-size", `${T}px`), D.setAttribute("font-family", `${S}`);
2046
- const U = Dt("rect");
2047
- let X = !1;
2048
- F && F !== "none" && (X = !0, U.setAttribute("stroke", C || "black"), U.setAttribute("stroke-width", `${k}`), F === "dashed" && U.setAttribute("stroke-dasharray", "5,5")), (Y && Y.length || X) && (X = !0, U.setAttribute("fill", Y || "transparent")), X && (U.setAttribute("width", `${s.width}`), U.setAttribute("height", `${s.height}`)), D.appendChild(U), qn(f, D), D.setAttribute("transform", `translate(${d.x},${d.y}) rotate(${a})`), D.classList.add(p), D.setAttribute("data-annotation", `${f.id}`), D.setAttribute("data-annotation-type", "text"), t.appendChild(D);
2050
+ const Y = Mt("rect");
2051
+ let G = !1;
2052
+ F && F !== "none" && (G = !0, Y.setAttribute("stroke", C || "black"), Y.setAttribute("stroke-width", `${k}`), F === "dashed" && Y.setAttribute("stroke-dasharray", "5,5")), (X && X.length || G) && (G = !0, Y.setAttribute("fill", X || "transparent")), G && (Y.setAttribute("width", `${s.width}`), Y.setAttribute("height", `${s.height}`)), D.appendChild(Y), Bn(d, D);
2053
+ const { x: Et, y: kt } = new U(f.x, f.y).rotateRadians(-a);
2054
+ D.setAttribute("transform", `translate(${Et},${kt})`), D.classList.add(p), D.setAttribute("data-annotation", `${d.id}`), D.setAttribute("data-annotation-type", "text"), t.appendChild(D);
2049
2055
  });
2050
- const c = Dt("style");
2056
+ const c = Mt("style");
2051
2057
  c.innerHTML = r, t.firstChild && t.insertBefore(c, t.firstChild);
2052
2058
  }
2053
2059
  refreshDrawing() {
2054
- const t = this.ogma.view.getAngle() * 180 / Math.PI;
2060
+ const t = this.ogma.view.getAngle();
2055
2061
  [...this.layer.element.children].forEach((r) => {
2056
- const a = r.getAttribute("transform"), c = a == null ? void 0 : a.match(/translate\(([^)]+)\)/);
2057
- c && r.setAttribute("transform", `translate(${c[1]}) rotate(${t})`);
2062
+ const a = ct(this.getById(+r.getAttribute("data-annotation"))), { x: c, y: d } = new U(a.x, a.y).rotateRadians(-t);
2063
+ r.setAttribute("transform", `translate(${c},${d})`);
2058
2064
  });
2059
2065
  }
2060
2066
  getDefaultOptions() {
@@ -2063,14 +2069,14 @@ class Bn extends Be {
2063
2069
  refreshEditor() {
2064
2070
  if (+this.selectedId < 0 && +this.hoveredId < 0)
2065
2071
  return;
2066
- const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ct(t), a = this.ogma.view.graphToScreenCoordinates(ft(t)), c = this.ogma.view.getZoom(), {
2067
- font: f,
2072
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), a = this.ogma.view.graphToScreenCoordinates(ct(t)), c = this.ogma.view.getZoom(), {
2073
+ font: d,
2068
2074
  fontSize: g,
2069
2075
  color: p,
2070
2076
  background: s,
2071
- padding: d = 0
2077
+ padding: f = 0
2072
2078
  } = t.properties.style || At, m = (g || 1) * c;
2073
- this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * c}px, ${r.height / 2 * c}px)`, this.editor.element.style.width = `${r.width * c}px`, this.editor.element.style.height = `${r.height * c}px`, this.textArea.style.font = `${m} ${f}`, this.textArea.style.fontFamily = f || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${c * d}px`, this.textArea.style.lineHeight = `${m}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = p || "black", this.textArea.style.background = s || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2079
+ this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * c}px, ${r.height / 2 * c}px)`, this.editor.element.style.width = `${r.width * c}px`, this.editor.element.style.height = `${r.height * c}px`, this.textArea.style.font = `${m} ${d}`, this.textArea.style.fontFamily = d || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${c * f}px`, this.textArea.style.lineHeight = `${m}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = p || "black", this.textArea.style.background = s || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2074
2080
  }
2075
2081
  select(t) {
2076
2082
  super.select(t), this.textArea.focus();
@@ -2086,15 +2092,15 @@ class Vn {
2086
2092
  v(this, "linksByArrowId", {});
2087
2093
  }
2088
2094
  add(l, t, r, a, c) {
2089
- const f = Ut(), g = l.id, p = {
2090
- id: f,
2095
+ const d = Xt(), g = l.id, p = {
2096
+ id: d,
2091
2097
  arrow: g,
2092
2098
  target: r,
2093
2099
  targetType: a,
2094
2100
  connectionPoint: c,
2095
2101
  side: t
2096
2102
  };
2097
- return this.links[f] = p, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(f), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][t] = f, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2103
+ return this.links[d] = p, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(d), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][t] = d, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2098
2104
  id: r,
2099
2105
  side: t,
2100
2106
  type: a,
@@ -2113,10 +2119,10 @@ class Vn {
2113
2119
  return this;
2114
2120
  const c = this.links[a];
2115
2121
  delete this.links[a];
2116
- const f = this.linksByTargetId[c.target];
2117
- for (let s = 0; s < f.length; s++)
2118
- if (f[s] === a) {
2119
- f.splice(s, 1);
2122
+ const d = this.linksByTargetId[c.target];
2123
+ for (let s = 0; s < d.length; s++)
2124
+ if (d[s] === a) {
2125
+ d.splice(s, 1);
2120
2126
  break;
2121
2127
  }
2122
2128
  return delete this.linksByArrowId[r][t], this;
@@ -2154,7 +2160,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2154
2160
  { x: 0.5, y: 1 },
2155
2161
  { x: 1, y: 1 }
2156
2162
  ];
2157
- class Gn extends qe {
2163
+ class Gn extends Be {
2158
2164
  constructor(t, r = {}) {
2159
2165
  super();
2160
2166
  v(this, "arrows");
@@ -2178,7 +2184,7 @@ class Gn extends qe {
2178
2184
  Ce.forEach((a) => {
2179
2185
  if (!this.textToMagnet)
2180
2186
  return;
2181
- const c = ct(this.textToMagnet), f = ft(this.textToMagnet), { x: g, y: p } = new G(a.x, a.y).mul({ x: c.width, y: c.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
2187
+ const c = ut(this.textToMagnet), d = ct(this.textToMagnet), { x: g, y: p } = new U(a.x, a.y).mul({ x: c.width, y: c.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
2182
2188
  t.moveTo(g, p), t.arc(g, p, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
2183
2189
  }), t.fill(), t.closePath();
2184
2190
  });
@@ -2186,21 +2192,21 @@ class Gn extends qe {
2186
2192
  const a = r;
2187
2193
  if (ot(t) && a === "line")
2188
2194
  ["start", "end"].find((c) => {
2189
- const f = c === "start" ? Ot(t) : Ft(t);
2190
- return this._snapToText(t, a, f) || this._findAndSnapToNode(t, c, f);
2195
+ const d = c === "start" ? zt(t) : qt(t);
2196
+ return this._snapToText(t, a, d) || this._findAndSnapToNode(t, c, d);
2191
2197
  });
2192
2198
  else if (ot(t) && a !== "line") {
2193
- const c = a === "start" ? Ot(t) : Ft(t);
2199
+ const c = a === "start" ? zt(t) : qt(t);
2194
2200
  this._snapToText(t, a, c) || this._findAndSnapToNode(t, a, c);
2195
2201
  } else
2196
- mt(t) && (this.activeLinks.forEach(({ arrow: c, side: f, connectionPoint: g }) => {
2197
- const p = this.getAnnotation(c), s = ct(t), d = ft(t), m = new G(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
2198
- p.geometry.coordinates[f === "start" ? 0 : 1] = [m.x, m.y];
2202
+ mt(t) && (this.activeLinks.forEach(({ arrow: c, side: d, connectionPoint: g }) => {
2203
+ const p = this.getAnnotation(c), s = ut(t), f = ct(t), m = new U(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
2204
+ p.geometry.coordinates[d === "start" ? 0 : 1] = [m.x, m.y];
2199
2205
  }), this.activeLinks.length && this.arrows.refreshLayer());
2200
- this.layer.refresh(), this.emit(Bt, t, r);
2206
+ this.layer.refresh(), this.emit(Ut, t, r);
2201
2207
  });
2202
2208
  v(this, "_onFeatureDragEnd", (t) => {
2203
- this.dragged !== null && ot(t) && Ot(this.dragged) && Le.forEach((r) => {
2209
+ this.dragged !== null && ot(t) && zt(this.dragged) && Le.forEach((r) => {
2204
2210
  this.links.getArrowLink(t.id, r) && this.emit(Nn, {
2205
2211
  arrow: t,
2206
2212
  link: this.links.getArrowLink(t.id, r)
@@ -2211,7 +2217,7 @@ class Gn extends qe {
2211
2217
  this.textToMagnet = void 0, ot(t) ? this.dragged = t : mt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
2212
2218
  const a = r.getSelectedFeature();
2213
2219
  a && a !== t && r.unhover().unselect(), r.disableDetection();
2214
- }), this.emit(Vt, t);
2220
+ }), this.emit(Yt, t);
2215
2221
  });
2216
2222
  v(this, "_onNodesDragStart", () => {
2217
2223
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
@@ -2222,11 +2228,11 @@ class Gn extends qe {
2222
2228
  });
2223
2229
  v(this, "_onLayoutEnd", (t) => {
2224
2230
  t.ids.forEach((r, a) => {
2225
- this.links.getTargetLinks(r, "node").forEach((f) => {
2226
- const g = this.getAnnotation(f.arrow), p = f.side, s = Rt(
2231
+ this.links.getTargetLinks(r, "node").forEach((d) => {
2232
+ const g = this.getAnnotation(d.arrow), p = d.side, s = jt(
2227
2233
  g,
2228
2234
  p === "start" ? "end" : "start"
2229
- ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ht(s, d, +m);
2235
+ ), f = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ft(s, f, +m);
2230
2236
  bt(g, p, A.x, A.y);
2231
2237
  });
2232
2238
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
@@ -2255,23 +2261,23 @@ class Gn extends qe {
2255
2261
  v(this, "_onUpdate", (t) => {
2256
2262
  this.emit(he, t);
2257
2263
  });
2258
- this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new Hn(t, this.options), this.texts = new Bn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2259
- a.on(Vt, this._onFeatureDragStart).on(Bt, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(he, this.onUpdate).on(oe, this._onUnselect).on(se, this._onSelect).on(le, this._onAdded).on(ae, this._onRemoved);
2264
+ this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new Hn(t, this.options), this.texts = new qn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2265
+ a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(he, this.onUpdate).on(oe, this._onUnselect).on(se, this._onSelect).on(le, this._onAdded).on(ae, this._onRemoved);
2260
2266
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
2261
2267
  this.refreshTextLinks();
2262
2268
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2263
2269
  }
2264
2270
  _moveNodes(t, r, a) {
2265
2271
  t.forEach((c) => {
2266
- const f = this.links.getTargetLinks(c.getId(), "node"), g = c.getPosition();
2267
- f.forEach((p) => {
2268
- const s = this.getAnnotation(p.arrow), d = p.side, m = Rt(
2272
+ const d = this.links.getTargetLinks(c.getId(), "node"), g = c.getPosition();
2273
+ d.forEach((p) => {
2274
+ const s = this.getAnnotation(p.arrow), f = p.side, m = jt(
2269
2275
  s,
2270
- d === "start" ? "end" : "start"
2276
+ f === "start" ? "end" : "start"
2271
2277
  );
2272
2278
  let A = g;
2273
2279
  const T = +c.getAttribute("radius"), S = 1e-6;
2274
- (p.connectionPoint.x - (g.x - r) > S || p.connectionPoint.y - (g.y - a) > S) && (A = Ht(m, g, T)), bt(s, d, A.x, A.y);
2280
+ (p.connectionPoint.x - (g.x - r) > S || p.connectionPoint.y - (g.y - a) > S) && (A = Ft(m, g, T)), bt(s, f, A.x, A.y);
2275
2281
  });
2276
2282
  }), this.arrows.refreshLayer();
2277
2283
  }
@@ -2280,31 +2286,31 @@ class Gn extends qe {
2280
2286
  if (this.links.remove(t, r), !c)
2281
2287
  return !1;
2282
2288
  this.textToMagnet = c;
2283
- const f = this.findMagnetPoint(Ce, c, a);
2284
- return f ? (bt(t, r, f.point.x, f.point.y), this.links.add(t, r, c.id, "text", f.magnet), !0) : !1;
2289
+ const d = this.findMagnetPoint(Ce, c, a);
2290
+ return d ? (bt(t, r, d.point.x, d.point.y), this.links.add(t, r, c.id, "text", d.magnet), !0) : !1;
2285
2291
  }
2286
2292
  _findAndSnapToNode(t, r, a) {
2287
- const c = this.ogma.view.graphToScreenCoordinates(a), f = this.ogma.view.getElementAt(c);
2288
- this.links.remove(t, r), f && f.isNode ? (this.hoveredNode = f, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, f, c)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2293
+ const c = this.ogma.view.graphToScreenCoordinates(a), d = this.ogma.view.getElementAt(c);
2294
+ this.links.remove(t, r), d && d.isNode ? (this.hoveredNode = d, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, d, c)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2289
2295
  }
2290
2296
  _snapToNode(t, r, a, c) {
2291
- const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = c.x - f.x, d = c.y - f.y, m = Math.sqrt(s * s + d * d), A = a.getPosition();
2297
+ const d = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = c.x - d.x, f = c.y - d.y, m = Math.sqrt(s * s + f * f), A = a.getPosition();
2292
2298
  if (m < p + this.options.detectMargin) {
2293
2299
  let T = A;
2294
2300
  if (m > p / 2) {
2295
- const S = Rt(t, r === "end" ? "start" : "end");
2296
- T = Ht(S, T, g);
2301
+ const S = jt(t, r === "end" ? "start" : "end");
2302
+ T = Ft(S, T, g);
2297
2303
  }
2298
2304
  bt(t, r, T.x, T.y), this.links.add(t, r, a.getId(), "node", T);
2299
2305
  }
2300
2306
  }
2301
2307
  refreshTextLinks() {
2302
2308
  let t = !1;
2303
- this.links.forEach(({ connectionPoint: r, targetType: a, target: c, arrow: f, side: g }) => {
2309
+ this.links.forEach(({ connectionPoint: r, targetType: a, target: c, arrow: d, side: g }) => {
2304
2310
  if (a !== "text")
2305
2311
  return;
2306
2312
  t = !0;
2307
- const p = this.getAnnotation(c), s = this.getAnnotation(f), d = ct(p), m = ft(p), A = new G(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2313
+ const p = this.getAnnotation(c), s = this.getAnnotation(d), f = ut(p), m = ct(p), A = new U(r.x, r.y).mul({ x: f.width, y: f.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2308
2314
  bt(s, g, A.x, A.y);
2309
2315
  }), t && this.arrows.refreshLayer();
2310
2316
  }
@@ -2316,17 +2322,17 @@ class Gn extends qe {
2316
2322
  }
2317
2323
  findMagnetPoint(t, r, a) {
2318
2324
  let c;
2319
- for (const f of t) {
2320
- const g = ct(r), p = ft(r), s = new G(f.x, f.y).mul({ x: g.width, y: g.height }).rotateRadians(this.ogma.view.getAngle()).add(p), d = s.sub(a).length(), m = Math.min(
2325
+ for (const d of t) {
2326
+ const g = ut(r), p = ct(r), s = new U(d.x, d.y).mul({ x: g.width, y: g.height }).rotateRadians(this.ogma.view.getAngle()).add(p), f = s.sub(a).length(), m = Math.min(
2321
2327
  this.options.magnetRadius * this.ogma.view.getZoom(),
2322
2328
  // when really zoomed in: avoid to snap on too far away magnets
2323
2329
  g.width / 2,
2324
2330
  g.height / 2
2325
2331
  );
2326
- if (d < Math.max(m, this.options.magnetHandleRadius)) {
2332
+ if (f < Math.max(m, this.options.magnetHandleRadius)) {
2327
2333
  c = {
2328
2334
  point: s,
2329
- magnet: f
2335
+ magnet: d
2330
2336
  };
2331
2337
  break;
2332
2338
  }
@@ -2364,7 +2370,7 @@ class Gn extends qe {
2364
2370
  */
2365
2371
  add(t) {
2366
2372
  if (ze(t)) {
2367
- const [r, a] = t.features.reduce((c, f) => (ot(f) ? c[1].push(f) : mt(f) && c[0].push(f), c), [[], []]);
2373
+ const [r, a] = t.features.reduce((c, d) => (ot(d) ? c[1].push(d) : mt(d) && c[0].push(d), c), [[], []]);
2368
2374
  return r.forEach(
2369
2375
  (c) => this.add(c)
2370
2376
  ), a.forEach(
@@ -2400,12 +2406,12 @@ class Gn extends qe {
2400
2406
  if (a.type === "text" && c)
2401
2407
  this.links.add(t, r, a.id, a.type, a.magnet);
2402
2408
  else if (a.type === "node") {
2403
- const f = this.ogma.getNode(a.id);
2404
- if (!f)
2409
+ const d = this.ogma.getNode(a.id);
2410
+ if (!d)
2405
2411
  continue;
2406
2412
  this.links.add(t, r, a.id, a.type, a.magnet);
2407
- const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = Rt(t, r === "start" ? "end" : "start"), d = Ht(s, g, +p);
2408
- bt(t, r, d.x, d.y);
2413
+ const g = d.getPosition(), p = d.getAttribute("radius") || 0, s = jt(t, r === "start" ? "end" : "start"), f = Ft(s, g, +p);
2414
+ bt(t, r, f.x, f.y);
2409
2415
  }
2410
2416
  }
2411
2417
  }
@@ -2431,7 +2437,7 @@ class Gn extends qe {
2431
2437
  * Cancel drawing on the current frame
2432
2438
  */
2433
2439
  cancelDrawing() {
2434
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit($n);
2440
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Pn);
2435
2441
  }
2436
2442
  /**
2437
2443
  * Update the style of the annotation with the given id
@@ -2473,25 +2479,25 @@ class Gn extends qe {
2473
2479
  export {
2474
2480
  Hn as Arrows,
2475
2481
  Gn as Control,
2476
- Bn as Texts,
2482
+ qn as Texts,
2477
2483
  Dn as createArrow,
2478
- Dt as createSVGElement,
2484
+ Mt as createSVGElement,
2479
2485
  jn as createText,
2480
2486
  Ee as defaultArrowOptions,
2481
- Mt as defaultArrowStyle,
2487
+ Lt as defaultArrowStyle,
2482
2488
  De as defaultControllerOptions,
2483
2489
  re as defaultTextOptions,
2484
2490
  At as defaultTextStyle,
2485
2491
  Xn as getAnnotationsBounds,
2486
- Ft as getArrowEnd,
2487
- qt as getArrowEndPoints,
2488
- Rt as getArrowSide,
2489
- Ot as getArrowStart,
2490
- Ht as getAttachmentPointOnNode,
2492
+ qt as getArrowEnd,
2493
+ Vt as getArrowEndPoints,
2494
+ jt as getArrowSide,
2495
+ zt as getArrowStart,
2496
+ Ft as getAttachmentPointOnNode,
2491
2497
  He as getHandleId,
2492
- $e as getTextBbox,
2493
- ft as getTextPosition,
2494
- ct as getTextSize,
2498
+ Pe as getTextBbox,
2499
+ ct as getTextPosition,
2500
+ ut as getTextSize,
2495
2501
  ze as isAnnotationCollection,
2496
2502
  ot as isArrow,
2497
2503
  mt as isText,
@@ -2501,4 +2507,3 @@ export {
2501
2507
  zn as setTextBbox,
2502
2508
  Mn as updateTextBbox
2503
2509
  };
2504
- //# sourceMappingURL=index.mjs.map