@linkurious/ogma-annotations 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +718 -682
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/Control.d.ts +1 -0
- package/dist/types/Editor/Texts/index.d.ts +1 -0
- package/dist/types/Editor/base.d.ts +2 -0
- package/dist/types/links.d.ts +2 -1
- package/dist/types/types.d.ts +14 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
var kn = Object.defineProperty;
|
|
2
|
-
var Tn = (
|
|
3
|
-
var v = (
|
|
2
|
+
var Tn = (u, l, t) => l in u ? kn(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
|
|
3
|
+
var v = (u, l, t) => (Tn(u, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
4
|
var In = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function ce(u) {
|
|
6
|
+
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
9
|
-
(function(
|
|
8
|
+
var Pe = { exports: {} };
|
|
9
|
+
(function(u) {
|
|
10
10
|
(function(l, t) {
|
|
11
|
-
|
|
11
|
+
u.exports = t();
|
|
12
12
|
})("Vector", function() {
|
|
13
13
|
var l = function() {
|
|
14
14
|
var t = Math.PI * 2, r = 180 / Math.PI, a = Math.PI / 180;
|
|
15
|
-
function
|
|
15
|
+
function c(s) {
|
|
16
16
|
return Math.round(s * 1e8) / 1e8;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function f(s, d) {
|
|
19
19
|
var m = d.x - s.x, A = d.y - s.y;
|
|
20
20
|
return Math.sqrt(m * m + A * A);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
var A = d.y - s.y,
|
|
22
|
+
function g(s, d, m) {
|
|
23
|
+
var A = d.y - s.y, T = d.x - s.x, S = Math.atan2(A, T);
|
|
24
24
|
if (m)
|
|
25
|
-
for (;
|
|
26
|
-
|
|
27
|
-
return
|
|
25
|
+
for (; S < 0; )
|
|
26
|
+
S += t;
|
|
27
|
+
return S;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function p(s, d) {
|
|
30
30
|
this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return p.fromRadians = function(s) {
|
|
33
33
|
var d = Math.cos(s), m = Math.sin(s);
|
|
34
|
-
return new
|
|
35
|
-
},
|
|
34
|
+
return new p(d, m);
|
|
35
|
+
}, p.fromDegrees = function(s) {
|
|
36
36
|
var d = s * (Math.PI / 180);
|
|
37
|
-
return
|
|
38
|
-
},
|
|
37
|
+
return p.fromRadians(d);
|
|
38
|
+
}, p.fromString = function(s) {
|
|
39
39
|
var d = s.split(",");
|
|
40
|
-
return new
|
|
41
|
-
},
|
|
42
|
-
return new
|
|
43
|
-
},
|
|
40
|
+
return new p(parseFloat(d[0]), parseFloat(d[1]));
|
|
41
|
+
}, p.fromArray = function(s) {
|
|
42
|
+
return new p(s[0], s[1]);
|
|
43
|
+
}, p.prototype = {
|
|
44
44
|
// version
|
|
45
45
|
version: "2.0.1",
|
|
46
46
|
// [API]
|
|
@@ -48,7 +48,7 @@ var $e = { exports: {} };
|
|
|
48
48
|
// clone the vector and return the cloned instance.
|
|
49
49
|
// @return cloned vector.
|
|
50
50
|
clone: function() {
|
|
51
|
-
return new
|
|
51
|
+
return new p(this.x, this.y);
|
|
52
52
|
},
|
|
53
53
|
// [API]
|
|
54
54
|
// []
|
|
@@ -108,7 +108,7 @@ var $e = { exports: {} };
|
|
|
108
108
|
// clone and flip between x and y values.
|
|
109
109
|
// @return cloned vector with flipped x and y components.
|
|
110
110
|
flipXY: function() {
|
|
111
|
-
return new
|
|
111
|
+
return new p(this.y, this.x);
|
|
112
112
|
},
|
|
113
113
|
// [API]
|
|
114
114
|
// [chainable, changeSelf]
|
|
@@ -137,21 +137,21 @@ var $e = { exports: {} };
|
|
|
137
137
|
// @param other - vector to get distance from.
|
|
138
138
|
// @return distance between vectors.
|
|
139
139
|
distanceFrom: function(s) {
|
|
140
|
-
return
|
|
140
|
+
return f(this, s);
|
|
141
141
|
},
|
|
142
142
|
// [API]
|
|
143
143
|
// []
|
|
144
144
|
// get angle from another vector in radians.
|
|
145
145
|
// @return angle in radians from this to other.
|
|
146
146
|
radiansTo: function(s) {
|
|
147
|
-
return
|
|
147
|
+
return g(this, s, !0);
|
|
148
148
|
},
|
|
149
149
|
// [API]
|
|
150
150
|
// []
|
|
151
151
|
// get degrees from another vector in degrees.
|
|
152
152
|
// @return angle in degrees from this to other.
|
|
153
153
|
degreesTo: function(s) {
|
|
154
|
-
return
|
|
154
|
+
return g(this, s, !0) * r;
|
|
155
155
|
},
|
|
156
156
|
// [API]
|
|
157
157
|
// []
|
|
@@ -159,7 +159,7 @@ var $e = { exports: {} };
|
|
|
159
159
|
// this is equivalent to doing Vector.zero.radiansTo(this).
|
|
160
160
|
// @return angle in radians.
|
|
161
161
|
toRadians: function(s) {
|
|
162
|
-
return
|
|
162
|
+
return g(p.zero, this, !0);
|
|
163
163
|
},
|
|
164
164
|
// [API]
|
|
165
165
|
// []
|
|
@@ -191,8 +191,8 @@ var $e = { 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,
|
|
195
|
-
return this.x =
|
|
194
|
+
var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, T = this.x * m + this.y * d;
|
|
195
|
+
return this.x = c(A), this.y = c(T), this;
|
|
196
196
|
},
|
|
197
197
|
// [API]
|
|
198
198
|
// [chainable]
|
|
@@ -478,15 +478,15 @@ var $e = { exports: {} };
|
|
|
478
478
|
format: function(s) {
|
|
479
479
|
return s = s || "%x,%y", s = s.replace(new RegExp("%x", "g"), this.x), s = s.replace(new RegExp("%y", "g"), this.y), s;
|
|
480
480
|
}
|
|
481
|
-
},
|
|
481
|
+
}, p;
|
|
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
|
-
})(
|
|
486
|
-
var _n =
|
|
487
|
-
const
|
|
488
|
-
let
|
|
489
|
-
const
|
|
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 = {
|
|
490
490
|
strokeType: "plain",
|
|
491
491
|
strokeColor: "black",
|
|
492
492
|
strokeWidth: 1,
|
|
@@ -498,7 +498,7 @@ const Dt = {
|
|
|
498
498
|
properties: {
|
|
499
499
|
type: "arrow",
|
|
500
500
|
style: {
|
|
501
|
-
...
|
|
501
|
+
...Mt
|
|
502
502
|
}
|
|
503
503
|
},
|
|
504
504
|
geometry: {
|
|
@@ -518,47 +518,47 @@ const Dt = {
|
|
|
518
518
|
// tail: 'arrow-plain',
|
|
519
519
|
// start: { x: 0, y: 0 },
|
|
520
520
|
// end: { x: 100, y: 100 }
|
|
521
|
-
}, Dn = (
|
|
522
|
-
id:
|
|
521
|
+
}, Dn = (u = 0, l = 0, t = 0, r = 0, a = { ...Mt }) => ({
|
|
522
|
+
id: Ut(),
|
|
523
523
|
type: "Feature",
|
|
524
524
|
properties: {
|
|
525
525
|
type: "arrow",
|
|
526
526
|
style: {
|
|
527
|
-
...
|
|
527
|
+
...Mt,
|
|
528
528
|
...a
|
|
529
529
|
}
|
|
530
530
|
},
|
|
531
531
|
geometry: {
|
|
532
532
|
type: "LineString",
|
|
533
533
|
coordinates: [
|
|
534
|
-
[
|
|
534
|
+
[u, l],
|
|
535
535
|
[t, r]
|
|
536
536
|
]
|
|
537
537
|
}
|
|
538
|
-
}),
|
|
539
|
-
function
|
|
540
|
-
return document.createElementNS(
|
|
538
|
+
}), On = "http://www.w3.org/2000/svg";
|
|
539
|
+
function Dt(u) {
|
|
540
|
+
return document.createElementNS(On, u);
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
542
|
+
function $e(u) {
|
|
543
|
+
return u.geometry.bbox || Mn(u), u.geometry.bbox;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
const l =
|
|
545
|
+
function ct(u) {
|
|
546
|
+
const l = $e(u);
|
|
547
547
|
return {
|
|
548
548
|
width: l[2] - l[0],
|
|
549
549
|
height: l[3] - l[1]
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
const l =
|
|
552
|
+
function ft(u) {
|
|
553
|
+
const l = $e(u);
|
|
554
554
|
return { x: l[0], y: l[1] };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
const [l, t] =
|
|
558
|
-
|
|
556
|
+
function Mn(u) {
|
|
557
|
+
const [l, t] = u.geometry.coordinates[0][0], [r, a] = u.geometry.coordinates[0][2];
|
|
558
|
+
u.geometry.bbox = [l, t, r, a];
|
|
559
559
|
}
|
|
560
|
-
function zn(
|
|
561
|
-
|
|
560
|
+
function zn(u, l, t, r, a) {
|
|
561
|
+
u.geometry.bbox = [l, t, l + r, t + a], u.geometry.coordinates = [
|
|
562
562
|
[
|
|
563
563
|
[l, t],
|
|
564
564
|
[l + r, t],
|
|
@@ -568,33 +568,33 @@ function zn(c, l, t, r, a) {
|
|
|
568
568
|
]
|
|
569
569
|
];
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
const [l, t] =
|
|
571
|
+
function Ot(u) {
|
|
572
|
+
const [l, t] = u.geometry.coordinates[0];
|
|
573
573
|
return { x: l, y: t };
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const [t, r] =
|
|
575
|
+
function Rt(u, l) {
|
|
576
|
+
const [t, r] = u.geometry.coordinates[l === "start" ? 0 : 1];
|
|
577
577
|
return { x: t, y: r };
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const [l, t] =
|
|
579
|
+
function Ft(u) {
|
|
580
|
+
const [l, t] = u.geometry.coordinates[1];
|
|
581
581
|
return { x: l, y: t };
|
|
582
582
|
}
|
|
583
|
-
function Ne(
|
|
584
|
-
|
|
583
|
+
function Ne(u, l, t) {
|
|
584
|
+
u.geometry.coordinates[0] = [l, t];
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
|
|
586
|
+
function Re(u, l, t) {
|
|
587
|
+
u.geometry.coordinates[1] = [l, t];
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
return { start:
|
|
589
|
+
function qt(u) {
|
|
590
|
+
return { start: Ot(u), end: Ft(u) };
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
l === "start" ? Ne(
|
|
592
|
+
function wt(u, l, t, r) {
|
|
593
|
+
l === "start" ? Ne(u, t, r) : Re(u, t, r);
|
|
594
594
|
}
|
|
595
|
-
const
|
|
596
|
-
function Xn(
|
|
597
|
-
return
|
|
595
|
+
const He = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
|
|
596
|
+
function Xn(u) {
|
|
597
|
+
return jt(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,162 +604,162 @@ function Xn(c) {
|
|
|
604
604
|
]
|
|
605
605
|
);
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function jt(u) {
|
|
608
608
|
let l = [];
|
|
609
|
-
return
|
|
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
|
-
}, []) :
|
|
612
|
-
(t, r) => t.concat(r.reduce((a,
|
|
611
|
+
}, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
|
|
612
|
+
(t, r) => t.concat(r.reduce((a, c) => a.concat(c), [])),
|
|
613
613
|
[]
|
|
614
|
-
) :
|
|
615
|
-
(t, r) => t.concat(
|
|
614
|
+
) : u.type == "Feature" ? l = jt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
|
|
615
|
+
(t, r) => t.concat(jt(r)),
|
|
616
616
|
[]
|
|
617
|
-
) :
|
|
618
|
-
(t, r) => t.concat(
|
|
617
|
+
) : u.type == "FeatureCollection" && (l = u.features.reduce(
|
|
618
|
+
(t, r) => t.concat(jt(r)),
|
|
619
619
|
[]
|
|
620
620
|
)), l;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
const r = Math.atan2(
|
|
622
|
+
function Ht(u, l, t) {
|
|
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),
|
|
626
626
|
y: l.y + t * Math.sin(r)
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function je(u, l = 5, t = 30) {
|
|
630
630
|
var s;
|
|
631
|
-
const { start: r, end: a } =
|
|
632
|
-
return Math.min(t, Math.max(3 *
|
|
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;
|
|
632
|
+
return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
|
|
633
633
|
}
|
|
634
|
-
function ke(
|
|
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
|
|
639
|
-
return `M ${
|
|
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}`}`;
|
|
640
640
|
}
|
|
641
|
-
function Ln(
|
|
642
|
-
const { start:
|
|
643
|
-
C.setAttribute("data-annotation", `${
|
|
644
|
-
const
|
|
645
|
-
C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${d}`), C.setAttribute("fill",
|
|
646
|
-
const
|
|
647
|
-
C.setAttribute("d",
|
|
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");
|
|
643
|
+
C.setAttribute("data-annotation", `${u.id}`), C.setAttribute("data-annotation-type", "arrow");
|
|
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;
|
|
647
|
+
C.setAttribute("d", D), l.appendChild(C);
|
|
648
648
|
}
|
|
649
|
-
const B = -1,
|
|
650
|
-
var
|
|
651
|
-
(function(
|
|
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";
|
|
650
|
+
var Fe = { exports: {} };
|
|
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(
|
|
657
|
-
this.fn =
|
|
656
|
+
function a(p, s, d) {
|
|
657
|
+
this.fn = p, this.context = s, this.once = d || !1;
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function c(p, s, d, m, A) {
|
|
660
660
|
if (typeof d != "function")
|
|
661
661
|
throw new TypeError("The listener must be a function");
|
|
662
|
-
var
|
|
663
|
-
return
|
|
662
|
+
var T = new a(d, m || p, A), S = t ? t + s : s;
|
|
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 p
|
|
666
|
-
--
|
|
665
|
+
function f(p, s) {
|
|
666
|
+
--p._eventsCount === 0 ? p._events = new r() : delete p._events[s];
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function g() {
|
|
669
669
|
this._events = new r(), this._eventsCount = 0;
|
|
670
670
|
}
|
|
671
|
-
|
|
671
|
+
g.prototype.eventNames = function() {
|
|
672
672
|
var s = [], d, m;
|
|
673
673
|
if (this._eventsCount === 0)
|
|
674
674
|
return s;
|
|
675
675
|
for (m in d = this._events)
|
|
676
676
|
l.call(d, m) && s.push(t ? m.slice(1) : m);
|
|
677
677
|
return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
|
|
678
|
-
},
|
|
678
|
+
}, g.prototype.listeners = function(s) {
|
|
679
679
|
var d = t ? t + s : s, m = this._events[d];
|
|
680
680
|
if (!m)
|
|
681
681
|
return [];
|
|
682
682
|
if (m.fn)
|
|
683
683
|
return [m.fn];
|
|
684
|
-
for (var A = 0,
|
|
685
|
-
|
|
686
|
-
return
|
|
687
|
-
},
|
|
684
|
+
for (var A = 0, T = m.length, S = new Array(T); A < T; A++)
|
|
685
|
+
S[A] = m[A].fn;
|
|
686
|
+
return S;
|
|
687
|
+
}, g.prototype.listenerCount = function(s) {
|
|
688
688
|
var d = t ? t + s : s, m = this._events[d];
|
|
689
689
|
return m ? m.fn ? 1 : m.length : 0;
|
|
690
|
-
},
|
|
690
|
+
}, g.prototype.emit = function(s, d, m, A, T, S) {
|
|
691
691
|
var C = t ? t + s : s;
|
|
692
692
|
if (!this._events[C])
|
|
693
693
|
return !1;
|
|
694
|
-
var
|
|
695
|
-
if (
|
|
696
|
-
switch (
|
|
694
|
+
var k = this._events[C], F = arguments.length, Y, D;
|
|
695
|
+
if (k.fn) {
|
|
696
|
+
switch (k.once && this.removeListener(s, k.fn, void 0, !0), F) {
|
|
697
697
|
case 1:
|
|
698
|
-
return
|
|
698
|
+
return k.fn.call(k.context), !0;
|
|
699
699
|
case 2:
|
|
700
|
-
return
|
|
700
|
+
return k.fn.call(k.context, d), !0;
|
|
701
701
|
case 3:
|
|
702
|
-
return
|
|
702
|
+
return k.fn.call(k.context, d, m), !0;
|
|
703
703
|
case 4:
|
|
704
|
-
return
|
|
704
|
+
return k.fn.call(k.context, d, m, A), !0;
|
|
705
705
|
case 5:
|
|
706
|
-
return
|
|
706
|
+
return k.fn.call(k.context, d, m, A, T), !0;
|
|
707
707
|
case 6:
|
|
708
|
-
return
|
|
708
|
+
return k.fn.call(k.context, d, m, A, T, S), !0;
|
|
709
709
|
}
|
|
710
|
-
for (
|
|
711
|
-
|
|
712
|
-
|
|
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);
|
|
713
713
|
} else {
|
|
714
|
-
var
|
|
715
|
-
for (
|
|
716
|
-
switch (
|
|
714
|
+
var U = k.length, X;
|
|
715
|
+
for (D = 0; D < U; D++)
|
|
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
|
-
|
|
721
|
+
k[D].fn.call(k[D].context, d);
|
|
722
722
|
break;
|
|
723
723
|
case 3:
|
|
724
|
-
|
|
724
|
+
k[D].fn.call(k[D].context, d, m);
|
|
725
725
|
break;
|
|
726
726
|
case 4:
|
|
727
|
-
|
|
727
|
+
k[D].fn.call(k[D].context, d, m, A);
|
|
728
728
|
break;
|
|
729
729
|
default:
|
|
730
|
-
if (!
|
|
731
|
-
for (
|
|
732
|
-
|
|
733
|
-
|
|
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);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
return !0;
|
|
737
|
-
},
|
|
738
|
-
return
|
|
739
|
-
},
|
|
740
|
-
return
|
|
741
|
-
},
|
|
742
|
-
var
|
|
743
|
-
if (!this._events[
|
|
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) {
|
|
742
|
+
var T = t ? t + s : s;
|
|
743
|
+
if (!this._events[T])
|
|
744
744
|
return this;
|
|
745
745
|
if (!d)
|
|
746
|
-
return
|
|
747
|
-
var
|
|
748
|
-
if (
|
|
749
|
-
|
|
746
|
+
return f(this, T), this;
|
|
747
|
+
var S = this._events[T];
|
|
748
|
+
if (S.fn)
|
|
749
|
+
S.fn === d && (!A || S.once) && (!m || S.context === m) && f(this, T);
|
|
750
750
|
else {
|
|
751
|
-
for (var C = 0,
|
|
752
|
-
(
|
|
753
|
-
|
|
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);
|
|
754
754
|
}
|
|
755
755
|
return this;
|
|
756
|
-
},
|
|
756
|
+
}, g.prototype.removeAllListeners = function(s) {
|
|
757
757
|
var d;
|
|
758
|
-
return s ? (d = t ? t + s : s, this._events[d] &&
|
|
759
|
-
},
|
|
760
|
-
})(
|
|
761
|
-
var
|
|
762
|
-
const qe = /* @__PURE__ */
|
|
758
|
+
return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
759
|
+
}, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
|
|
760
|
+
})(Fe);
|
|
761
|
+
var Rn = Fe.exports;
|
|
762
|
+
const qe = /* @__PURE__ */ ce(Rn);
|
|
763
763
|
class Be extends qe {
|
|
764
764
|
constructor(t, r) {
|
|
765
765
|
super();
|
|
@@ -774,6 +774,7 @@ class Be extends qe {
|
|
|
774
774
|
v(this, "ogmaOptions");
|
|
775
775
|
v(this, "shouldDetect");
|
|
776
776
|
v(this, "isDragging");
|
|
777
|
+
v(this, "showeditorOnHover");
|
|
777
778
|
v(this, "maxHandleScale", 1.5);
|
|
778
779
|
v(this, "_onKeyUp", (t) => {
|
|
779
780
|
t.code === 27 && this.selectedId !== B ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== B && this._canRemove() && this.remove(this.selectedId);
|
|
@@ -784,8 +785,8 @@ class Be extends qe {
|
|
|
784
785
|
const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
|
|
785
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
787
|
});
|
|
787
|
-
this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("newFrame", () => {
|
|
788
|
-
this.refreshEditor();
|
|
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", () => {
|
|
789
|
+
this.refreshEditor(), this.refreshDrawing();
|
|
789
790
|
}), this.layer = t.layers.addSVGLayer({
|
|
790
791
|
draw: (a) => this.draw(a)
|
|
791
792
|
}), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
|
|
@@ -800,7 +801,7 @@ class Be extends qe {
|
|
|
800
801
|
*/
|
|
801
802
|
add(t) {
|
|
802
803
|
const r = this.getDefaultOptions(), a = Object.assign(t, {
|
|
803
|
-
id: t.id === void 0 ?
|
|
804
|
+
id: t.id === void 0 ? Ut() : t.id,
|
|
804
805
|
type: t.type,
|
|
805
806
|
properties: {
|
|
806
807
|
...r.properties,
|
|
@@ -813,7 +814,7 @@ class Be extends qe {
|
|
|
813
814
|
...t.geometry
|
|
814
815
|
}
|
|
815
816
|
});
|
|
816
|
-
return this.elements.push(a), this.layer.refresh(), this.emit(
|
|
817
|
+
return this.elements.push(a), this.layer.refresh(), this.emit(le, a), a;
|
|
817
818
|
}
|
|
818
819
|
updateStyle(t, r) {
|
|
819
820
|
this.updateAnnotation(t, {
|
|
@@ -841,23 +842,23 @@ class Be extends qe {
|
|
|
841
842
|
if (!t)
|
|
842
843
|
return;
|
|
843
844
|
const a = t.id;
|
|
844
|
-
Object.keys(r).forEach((
|
|
845
|
-
if (
|
|
846
|
-
if (
|
|
847
|
-
const
|
|
845
|
+
Object.keys(r).forEach((c) => {
|
|
846
|
+
if (c !== "id")
|
|
847
|
+
if (c === "properties") {
|
|
848
|
+
const f = r.properties || { style: {} };
|
|
848
849
|
t.properties = {
|
|
849
850
|
...t.properties || {},
|
|
850
|
-
...
|
|
851
|
+
...f || {},
|
|
851
852
|
style: {
|
|
852
853
|
...t.properties.style || {},
|
|
853
|
-
...
|
|
854
|
+
...f.style || {}
|
|
854
855
|
}
|
|
855
856
|
};
|
|
856
857
|
} else
|
|
857
|
-
|
|
858
|
+
c === "geometry" ? t.geometry = {
|
|
858
859
|
...t.geometry,
|
|
859
860
|
...r.geometry
|
|
860
|
-
} : t[
|
|
861
|
+
} : t[c] = r[c];
|
|
861
862
|
}), a === this.selectedId && this.refreshEditor(), this.layer.refresh();
|
|
862
863
|
}
|
|
863
864
|
getById(t) {
|
|
@@ -874,22 +875,22 @@ class Be extends qe {
|
|
|
874
875
|
*/
|
|
875
876
|
select(t) {
|
|
876
877
|
const r = this.getById(t);
|
|
877
|
-
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
878
|
+
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(se, r));
|
|
878
879
|
}
|
|
879
880
|
hover(t) {
|
|
880
881
|
const r = this.getById(t);
|
|
881
|
-
r && (this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Cn, r));
|
|
882
|
+
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Cn, r));
|
|
882
883
|
}
|
|
883
884
|
getSelectedFeature() {
|
|
884
885
|
return this.selectedId === B ? null : this.getById(this.selectedId);
|
|
885
886
|
}
|
|
886
887
|
unselect() {
|
|
887
888
|
const t = this.getById(this.selectedId);
|
|
888
|
-
return t && this.emit(
|
|
889
|
+
return t && this.emit(oe, t), this.selectedId = B, this.hoveredId === B && this.editor.hide(), this.layer.refresh(), this;
|
|
889
890
|
}
|
|
890
891
|
unhover() {
|
|
891
892
|
const t = this.getById(this.hoveredId);
|
|
892
|
-
return this.emit(
|
|
893
|
+
return this.emit(Pn, t), this.hoveredId = B, this.selectedId === B && this.editor.hide(), this.layer.refresh(), this;
|
|
893
894
|
}
|
|
894
895
|
/**
|
|
895
896
|
* @method remove
|
|
@@ -898,7 +899,7 @@ class Be extends qe {
|
|
|
898
899
|
*/
|
|
899
900
|
remove(t) {
|
|
900
901
|
const r = this.getById(t);
|
|
901
|
-
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(
|
|
902
|
+
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(ae, r), this.layer.refresh();
|
|
902
903
|
}
|
|
903
904
|
/**
|
|
904
905
|
* @method disableDragging
|
|
@@ -939,6 +940,8 @@ class Be extends qe {
|
|
|
939
940
|
refreshLayer() {
|
|
940
941
|
this.layer.refresh();
|
|
941
942
|
}
|
|
943
|
+
refreshDrawing() {
|
|
944
|
+
}
|
|
942
945
|
getElements() {
|
|
943
946
|
return [...this.elements];
|
|
944
947
|
}
|
|
@@ -947,7 +950,7 @@ class Be extends qe {
|
|
|
947
950
|
}
|
|
948
951
|
}
|
|
949
952
|
const Te = "handle-line", Ie = "handle-start", _e = "handle-end";
|
|
950
|
-
class
|
|
953
|
+
class Hn extends Be {
|
|
951
954
|
constructor(t, r = {}) {
|
|
952
955
|
super(
|
|
953
956
|
t,
|
|
@@ -971,19 +974,19 @@ class Rn extends Be {
|
|
|
971
974
|
v(this, "handles", []);
|
|
972
975
|
v(this, "onHandleMouseDown", (t) => {
|
|
973
976
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
974
|
-
r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle =
|
|
977
|
+
r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = He(t.target));
|
|
975
978
|
});
|
|
976
979
|
v(this, "onMouseUp", () => {
|
|
977
|
-
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(
|
|
980
|
+
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(St, this.arrow));
|
|
978
981
|
});
|
|
979
982
|
v(this, "onMouseMove", (t) => {
|
|
980
983
|
if (!this.isDragging || this.draggedHandle === B)
|
|
981
984
|
return;
|
|
982
|
-
const r = this.handles[this.draggedHandle], a = this.ogma.view.
|
|
983
|
-
(
|
|
984
|
-
|
|
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
988
|
this.arrow,
|
|
986
|
-
|
|
989
|
+
g ? "line" : p ? "start" : "end"
|
|
987
990
|
), this.refreshEditor(), this.layer.refresh();
|
|
988
991
|
});
|
|
989
992
|
this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
@@ -998,68 +1001,68 @@ class Rn extends Be {
|
|
|
998
1001
|
* @param y
|
|
999
1002
|
* @param arrow
|
|
1000
1003
|
*/
|
|
1001
|
-
startDrawing(t, r, a = Dn(t, r, t, r,
|
|
1002
|
-
var
|
|
1004
|
+
startDrawing(t, r, a = Dn(t, r, t, r, Mt)) {
|
|
1005
|
+
var g;
|
|
1003
1006
|
this.add(a), this.hoveredId = a.id;
|
|
1004
|
-
const
|
|
1005
|
-
this.startDragging(this.getById(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;
|
|
1006
1009
|
}
|
|
1007
1010
|
cancelDrawing() {
|
|
1008
|
-
this.isDragging && (this.remove(this.arrow.id), this.emit(
|
|
1011
|
+
this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B);
|
|
1009
1012
|
}
|
|
1010
1013
|
startDragging(t, r, a) {
|
|
1011
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start =
|
|
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;
|
|
1012
1015
|
}
|
|
1013
1016
|
detect(t, r = 0) {
|
|
1014
1017
|
return this.elements.find((a) => {
|
|
1015
|
-
const { start:
|
|
1016
|
-
new
|
|
1017
|
-
),
|
|
1018
|
-
return Math.abs(d.dot(
|
|
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;
|
|
1019
1022
|
});
|
|
1020
1023
|
}
|
|
1021
1024
|
refreshEditor() {
|
|
1022
1025
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
1023
1026
|
return;
|
|
1024
|
-
const t = this.selectedId !== B ? this.getById(this.selectedId) : this.getById(this.hoveredId), r =
|
|
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(
|
|
1025
1028
|
this.editor.element.querySelectorAll(".handle")
|
|
1026
1029
|
);
|
|
1027
|
-
|
|
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}`;
|
|
1028
1031
|
const d = {
|
|
1029
|
-
x: (
|
|
1030
|
-
y: (
|
|
1031
|
-
}, m = new
|
|
1032
|
-
|
|
1032
|
+
x: (c.x + a.x) / 2,
|
|
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)`;
|
|
1033
1036
|
}
|
|
1034
1037
|
getDefaultOptions() {
|
|
1035
1038
|
return Ee;
|
|
1036
1039
|
}
|
|
1037
1040
|
draw(t) {
|
|
1038
1041
|
t.innerHTML = "";
|
|
1039
|
-
const r =
|
|
1042
|
+
const r = Dt("g");
|
|
1040
1043
|
this.elements.forEach(
|
|
1041
|
-
(a) => Ln(a, r,
|
|
1044
|
+
(a) => Ln(a, r, Mt, this.minArrowHeight, this.maxArrowHeight)
|
|
1042
1045
|
), t.appendChild(r);
|
|
1043
1046
|
}
|
|
1044
1047
|
destroy() {
|
|
1045
1048
|
super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
|
|
1046
1049
|
}
|
|
1047
1050
|
}
|
|
1048
|
-
const
|
|
1051
|
+
const At = {
|
|
1049
1052
|
font: "sans-serif",
|
|
1050
|
-
fontSize:
|
|
1053
|
+
fontSize: 12,
|
|
1051
1054
|
color: "black",
|
|
1052
1055
|
background: "",
|
|
1053
1056
|
strokeWidth: 1,
|
|
1054
1057
|
strokeColor: "#000",
|
|
1055
1058
|
strokeType: "plain"
|
|
1056
|
-
},
|
|
1059
|
+
}, re = {
|
|
1057
1060
|
id: 0,
|
|
1058
1061
|
type: "Feature",
|
|
1059
1062
|
properties: {
|
|
1060
1063
|
type: "text",
|
|
1061
1064
|
content: "",
|
|
1062
|
-
style: { ...
|
|
1065
|
+
style: { ...At }
|
|
1063
1066
|
},
|
|
1064
1067
|
geometry: {
|
|
1065
1068
|
type: "Polygon",
|
|
@@ -1078,31 +1081,31 @@ const bt = {
|
|
|
1078
1081
|
}, De = {
|
|
1079
1082
|
handleSize: 3.5,
|
|
1080
1083
|
placeholder: "Your text..."
|
|
1081
|
-
},
|
|
1082
|
-
id:
|
|
1084
|
+
}, jn = (u = 0, l = 0, t = 100, r = 50, a = "", c = { ...At }) => ({
|
|
1085
|
+
id: Ut(),
|
|
1083
1086
|
type: "Feature",
|
|
1084
1087
|
properties: {
|
|
1085
1088
|
type: "text",
|
|
1086
1089
|
content: a,
|
|
1087
|
-
style: { ...
|
|
1090
|
+
style: { ...At, ...c }
|
|
1088
1091
|
},
|
|
1089
1092
|
geometry: {
|
|
1090
1093
|
type: "Polygon",
|
|
1091
1094
|
coordinates: [
|
|
1092
1095
|
[
|
|
1093
|
-
[
|
|
1094
|
-
[
|
|
1095
|
-
[
|
|
1096
|
-
[
|
|
1097
|
-
[
|
|
1096
|
+
[u, l],
|
|
1097
|
+
[u + t, l],
|
|
1098
|
+
[u + t, l + r],
|
|
1099
|
+
[u, l + r],
|
|
1100
|
+
[u, l]
|
|
1098
1101
|
]
|
|
1099
1102
|
]
|
|
1100
1103
|
}
|
|
1101
1104
|
});
|
|
1102
1105
|
var Ve = { exports: {} };
|
|
1103
|
-
(function(
|
|
1106
|
+
(function(u, l) {
|
|
1104
1107
|
(function(t, r) {
|
|
1105
|
-
|
|
1108
|
+
u.exports = r();
|
|
1106
1109
|
})(In, () => (() => {
|
|
1107
1110
|
var t = { d: (e, n) => {
|
|
1108
1111
|
for (var o in n)
|
|
@@ -1115,43 +1118,43 @@ var Ve = { exports: {} };
|
|
|
1115
1118
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1116
1119
|
}, a(e);
|
|
1117
1120
|
}
|
|
1118
|
-
t.d(r, { default: () =>
|
|
1119
|
-
var
|
|
1121
|
+
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 };
|
|
1120
1123
|
function m(e) {
|
|
1121
1124
|
var n = "", o = this;
|
|
1122
1125
|
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;
|
|
1123
1126
|
}
|
|
1124
1127
|
var A = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
|
|
1125
|
-
function
|
|
1126
|
-
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o =
|
|
1128
|
+
function T(e) {
|
|
1129
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = c.exec(e);
|
|
1127
1130
|
n.family = (o[6] || "").trim();
|
|
1128
1131
|
var i = d[o[2]] || parseFloat(o[2]);
|
|
1129
1132
|
o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
|
|
1130
1133
|
var h = parseFloat(o[4]);
|
|
1131
|
-
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)),
|
|
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]))
|
|
1132
1135
|
n.weight = "bold";
|
|
1133
1136
|
else {
|
|
1134
|
-
var
|
|
1135
|
-
|
|
1137
|
+
var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
|
|
1138
|
+
y >= 100 && y !== 400 && (n.weight = y);
|
|
1136
1139
|
}
|
|
1137
1140
|
return n;
|
|
1138
1141
|
}
|
|
1139
|
-
function
|
|
1140
|
-
var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1142
|
+
function S() {
|
|
1143
|
+
var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, w = 12, x = null, b = null, E = "";
|
|
1141
1144
|
if (i && i.nodeType) {
|
|
1142
|
-
var
|
|
1143
|
-
e = M.getPropertyValue("font-family") || "", w = parseFloat(M.getPropertyValue("font-size")),
|
|
1145
|
+
var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), M = O.getComputedStyle(i, null);
|
|
1146
|
+
e = M.getPropertyValue("font-family") || "", w = parseFloat(M.getPropertyValue("font-size")), y = M.getPropertyValue("line-height"), x = M.getPropertyValue("font-weight"), b = M.getPropertyValue("font-style"), E = M.getPropertyValue("font-variant") || "";
|
|
1144
1147
|
} else if (typeof i == "string") {
|
|
1145
|
-
var
|
|
1146
|
-
e =
|
|
1148
|
+
var I = T(i);
|
|
1149
|
+
e = I.family, w = I.size, y = I.height, E = I.variant, b = I.style, x = I.weight;
|
|
1147
1150
|
} else
|
|
1148
|
-
a(i) === "object" && (e = i.family, w = i.size,
|
|
1149
|
-
h.size && h.size < 3 && (w *= h.size),
|
|
1150
|
-
var
|
|
1151
|
-
return
|
|
1151
|
+
a(i) === "object" && (e = i.family, w = i.size, y = i.height, E = i.variant, x = i.weight, b = i.style, n = i.baseline, o = i.color);
|
|
1152
|
+
h.size && h.size < 3 && (w *= h.size), y = y !== "normal" && y ? parseFloat(y) : w * (7 / 6), h.height && h.height < 3 && (y *= h.height);
|
|
1153
|
+
var z = Object.create(A);
|
|
1154
|
+
return z.family = h.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = h.variant || E || "", z.style = h.style || b || "", z.weight = h.weight || x || "", z.baseline = n || 0, h.baseline != null && (z.baseline = h.baseline), z.color = h.color || o || "", z.id = m.call(z, !0), z;
|
|
1152
1155
|
}
|
|
1153
1156
|
const C = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
|
|
1154
|
-
var
|
|
1157
|
+
var k, F = function(e) {
|
|
1155
1158
|
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
1156
1159
|
if (n && n.getContext) {
|
|
1157
1160
|
var o = n.getContext("2d");
|
|
@@ -1160,41 +1163,41 @@ var Ve = { exports: {} };
|
|
|
1160
1163
|
return o.font = String(h), o.measureText(i).width;
|
|
1161
1164
|
};
|
|
1162
1165
|
}
|
|
1163
|
-
}(typeof document < "u" ? document : null) || (
|
|
1164
|
-
if (!
|
|
1165
|
-
var o =
|
|
1166
|
-
|
|
1166
|
+
}(typeof document < "u" ? document : null) || (k = {}, function(e, n) {
|
|
1167
|
+
if (!k[n]) {
|
|
1168
|
+
var o = S(n);
|
|
1169
|
+
k[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
|
|
1167
1170
|
}
|
|
1168
|
-
return e.length *
|
|
1169
|
-
}),
|
|
1170
|
-
function
|
|
1171
|
-
var i = Object.assign({},
|
|
1171
|
+
return e.length * k[n].size;
|
|
1172
|
+
}), Y = {}, D = { trim: !0, collapse: !0 };
|
|
1173
|
+
function U(e, n, o) {
|
|
1174
|
+
var i = Object.assign({}, D, o), h = String(e);
|
|
1172
1175
|
if (!h)
|
|
1173
1176
|
return 0;
|
|
1174
1177
|
if (h in C) {
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
1178
|
+
var y = n.id + "/" + h;
|
|
1179
|
+
return y in Y || (Y[y] = F("_".concat(h, "_"), n) - F("__", n)), Y[y];
|
|
1177
1180
|
}
|
|
1178
|
-
return i.trim && i.collapse ? i.trim ? h = h.trim() : i.collapse && (h = h.replace(/\s+/g, " ")) : h = h.replace(/\n/g, " "),
|
|
1181
|
+
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);
|
|
1179
1182
|
}
|
|
1180
|
-
function
|
|
1181
|
-
return
|
|
1183
|
+
function X(e) {
|
|
1184
|
+
return X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1182
1185
|
return typeof n;
|
|
1183
1186
|
} : function(n) {
|
|
1184
1187
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1185
|
-
},
|
|
1188
|
+
}, X(e);
|
|
1186
1189
|
}
|
|
1187
|
-
function
|
|
1190
|
+
function Yt(e, n) {
|
|
1188
1191
|
if (typeof n != "function" && n !== null)
|
|
1189
1192
|
throw new TypeError("Super expression must either be null or a function");
|
|
1190
|
-
e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n &&
|
|
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);
|
|
1191
1194
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return
|
|
1195
|
+
function Xt(e, n) {
|
|
1196
|
+
return Xt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
|
|
1194
1197
|
return o.__proto__ = i, o;
|
|
1195
|
-
},
|
|
1198
|
+
}, Xt(e, n);
|
|
1196
1199
|
}
|
|
1197
|
-
function
|
|
1200
|
+
function Gt(e) {
|
|
1198
1201
|
var n = function() {
|
|
1199
1202
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
1200
1203
|
return !1;
|
|
@@ -1208,9 +1211,9 @@ var Ve = { exports: {} };
|
|
|
1208
1211
|
}
|
|
1209
1212
|
}();
|
|
1210
1213
|
return function() {
|
|
1211
|
-
var o, i =
|
|
1214
|
+
var o, i = zt(e);
|
|
1212
1215
|
if (n) {
|
|
1213
|
-
var h =
|
|
1216
|
+
var h = zt(this).constructor;
|
|
1214
1217
|
o = Reflect.construct(i, arguments, h);
|
|
1215
1218
|
} else
|
|
1216
1219
|
o = i.apply(this, arguments);
|
|
@@ -1218,7 +1221,7 @@ var Ve = { exports: {} };
|
|
|
1218
1221
|
};
|
|
1219
1222
|
}
|
|
1220
1223
|
function Ue(e, n) {
|
|
1221
|
-
if (n && (
|
|
1224
|
+
if (n && (X(n) === "object" || typeof n == "function"))
|
|
1222
1225
|
return n;
|
|
1223
1226
|
if (n !== void 0)
|
|
1224
1227
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
@@ -1228,42 +1231,42 @@ var Ve = { exports: {} };
|
|
|
1228
1231
|
return o;
|
|
1229
1232
|
}(e);
|
|
1230
1233
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1234
|
+
function zt(e) {
|
|
1235
|
+
return zt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
|
|
1233
1236
|
return n.__proto__ || Object.getPrototypeOf(n);
|
|
1234
|
-
},
|
|
1237
|
+
}, zt(e);
|
|
1235
1238
|
}
|
|
1236
|
-
function
|
|
1239
|
+
function Lt(e, n) {
|
|
1237
1240
|
if (!(e instanceof n))
|
|
1238
1241
|
throw new TypeError("Cannot call a class as a function");
|
|
1239
1242
|
}
|
|
1240
1243
|
function ue(e, n) {
|
|
1241
1244
|
for (var o = 0; o < n.length; o++) {
|
|
1242
1245
|
var i = n[o];
|
|
1243
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(
|
|
1244
|
-
if (
|
|
1245
|
-
return
|
|
1246
|
-
var x =
|
|
1246
|
+
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)
|
|
1248
|
+
return y;
|
|
1249
|
+
var x = y[Symbol.toPrimitive];
|
|
1247
1250
|
if (x !== void 0) {
|
|
1248
|
-
var b = x.call(
|
|
1249
|
-
if (
|
|
1251
|
+
var b = x.call(y, w);
|
|
1252
|
+
if (X(b) !== "object")
|
|
1250
1253
|
return b;
|
|
1251
1254
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1252
1255
|
}
|
|
1253
|
-
return String(
|
|
1254
|
-
}(i.key, "string"),
|
|
1256
|
+
return String(y);
|
|
1257
|
+
}(i.key, "string"), X(h) === "symbol" ? h : String(h)), i);
|
|
1255
1258
|
}
|
|
1256
1259
|
var h;
|
|
1257
1260
|
}
|
|
1258
|
-
function
|
|
1261
|
+
function Ct(e, n, o) {
|
|
1259
1262
|
return n && ue(e.prototype, n), o && ue(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1260
1263
|
}
|
|
1261
|
-
var
|
|
1264
|
+
var N = function() {
|
|
1262
1265
|
function e() {
|
|
1263
1266
|
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
1264
|
-
|
|
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;
|
|
1265
1268
|
}
|
|
1266
|
-
return
|
|
1269
|
+
return Ct(e, [{ key: "clone", value: function() {
|
|
1267
1270
|
var n = new e(this.value);
|
|
1268
1271
|
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;
|
|
1269
1272
|
} }, { key: "valueOf", value: function() {
|
|
@@ -1271,40 +1274,40 @@ var Ve = { exports: {} };
|
|
|
1271
1274
|
} }, { key: "toString", value: function() {
|
|
1272
1275
|
return this.value;
|
|
1273
1276
|
} }]), e;
|
|
1274
|
-
}(),
|
|
1275
|
-
|
|
1276
|
-
var n =
|
|
1277
|
+
}(), Et = function(e) {
|
|
1278
|
+
Yt(o, e);
|
|
1279
|
+
var n = Gt(o);
|
|
1277
1280
|
function o() {
|
|
1278
|
-
return
|
|
1281
|
+
return Lt(this, o), n.apply(this, arguments);
|
|
1279
1282
|
}
|
|
1280
|
-
return
|
|
1281
|
-
}(
|
|
1282
|
-
|
|
1283
|
-
var n =
|
|
1283
|
+
return Ct(o);
|
|
1284
|
+
}(N), nt = function(e) {
|
|
1285
|
+
Yt(o, e);
|
|
1286
|
+
var n = Gt(o);
|
|
1284
1287
|
function o() {
|
|
1285
|
-
return
|
|
1288
|
+
return Lt(this, o), n.apply(this, arguments);
|
|
1286
1289
|
}
|
|
1287
|
-
return
|
|
1288
|
-
}(
|
|
1289
|
-
|
|
1290
|
-
var n =
|
|
1290
|
+
return Ct(o);
|
|
1291
|
+
}(N), pt = function(e) {
|
|
1292
|
+
Yt(o, e);
|
|
1293
|
+
var n = Gt(o);
|
|
1291
1294
|
function o() {
|
|
1292
|
-
return
|
|
1295
|
+
return Lt(this, o), n.apply(this, arguments);
|
|
1293
1296
|
}
|
|
1294
|
-
return
|
|
1295
|
-
}(
|
|
1296
|
-
function
|
|
1297
|
+
return Ct(o);
|
|
1298
|
+
}(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) {
|
|
1297
1300
|
n !== !1 && (e = e.trim());
|
|
1298
|
-
for (var o, i, h = [],
|
|
1301
|
+
for (var o, i, h = [], y = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
|
|
1299
1302
|
o = e.charAt(x), i = e.charAt(x + 1);
|
|
1300
|
-
var
|
|
1301
|
-
if ((Ge.test(o) && !de.test(
|
|
1302
|
-
var
|
|
1303
|
-
/\u00AD$/.test(
|
|
1303
|
+
var E = Zt.test(y), O = Zt.test(o), M = O || E, I = void 0;
|
|
1304
|
+
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
|
+
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;
|
|
1304
1307
|
}
|
|
1305
|
-
|
|
1308
|
+
y = o;
|
|
1306
1309
|
}
|
|
1307
|
-
return h.push(new
|
|
1310
|
+
return h.push(new N(e.slice(w))), h;
|
|
1308
1311
|
}
|
|
1309
1312
|
const fe = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "", zwj: "", lrm: "", rlm: "", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
|
|
1310
1313
|
var Ze = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, We = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Ke = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Je = /^<!--(.+?)-->/, Qe = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, pe = { b: function(e) {
|
|
@@ -1337,8 +1340,8 @@ var Ve = { exports: {} };
|
|
|
1337
1340
|
function ge(e) {
|
|
1338
1341
|
return e.replace(Qe, function(n, o, i, h) {
|
|
1339
1342
|
if (o || i) {
|
|
1340
|
-
var
|
|
1341
|
-
return String.fromCharCode(parseInt(o || i,
|
|
1343
|
+
var y = o ? 10 : 16;
|
|
1344
|
+
return String.fromCharCode(parseInt(o || i, y));
|
|
1342
1345
|
}
|
|
1343
1346
|
return h in fe ? fe[h] : n;
|
|
1344
1347
|
});
|
|
@@ -1378,23 +1381,23 @@ var Ve = { exports: {} };
|
|
|
1378
1381
|
}, _: function(e) {
|
|
1379
1382
|
e.sub = !0;
|
|
1380
1383
|
}, par: function(e) {
|
|
1381
|
-
this.tokens.push(new
|
|
1384
|
+
this.tokens.push(new nt(), new nt());
|
|
1382
1385
|
}, newline: function(e) {
|
|
1383
|
-
this.tokens.push(new
|
|
1386
|
+
this.tokens.push(new nt());
|
|
1384
1387
|
}, url: function(e, n) {
|
|
1385
|
-
this.open_context().href = n, this.add_token(new
|
|
1388
|
+
this.open_context().href = n, this.add_token(new N(n)), this.close_context();
|
|
1386
1389
|
} };
|
|
1387
1390
|
V.textsuperscript = V["^"], V.textsubscript = V._, V.textsl = V.sl, V.mathbf = V.bf, V.mathit = V.it, V.textbf = V.bf, V.textit = V.it, V.textcolor = V.color;
|
|
1388
1391
|
var un = /[\r\n\xA0]+/g;
|
|
1389
1392
|
function dn(e, n) {
|
|
1390
1393
|
e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
|
|
1391
1394
|
var o = n;
|
|
1392
|
-
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o =
|
|
1395
|
+
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = S(n, e)), o;
|
|
1393
1396
|
}
|
|
1394
1397
|
function me(e, n, o) {
|
|
1395
|
-
for (var i, h,
|
|
1396
|
-
h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width =
|
|
1397
|
-
e[e.length - 1] instanceof
|
|
1398
|
+
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;
|
|
1400
|
+
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);
|
|
1398
1401
|
}
|
|
1399
1402
|
function mt(e) {
|
|
1400
1403
|
return Math.round(1e6 * e) / 1e6;
|
|
@@ -1402,146 +1405,146 @@ var Ve = { exports: {} };
|
|
|
1402
1405
|
function ve(e) {
|
|
1403
1406
|
return function(n) {
|
|
1404
1407
|
if (Array.isArray(n))
|
|
1405
|
-
return
|
|
1408
|
+
return Wt(n);
|
|
1406
1409
|
}(e) || function(n) {
|
|
1407
1410
|
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
|
|
1408
1411
|
return Array.from(n);
|
|
1409
1412
|
}(e) || function(n, o) {
|
|
1410
1413
|
if (n) {
|
|
1411
1414
|
if (typeof n == "string")
|
|
1412
|
-
return
|
|
1415
|
+
return Wt(n, o);
|
|
1413
1416
|
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1414
|
-
return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ?
|
|
1417
|
+
return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? Wt(n, o) : void 0;
|
|
1415
1418
|
}
|
|
1416
1419
|
}(e) || function() {
|
|
1417
1420
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1418
1421
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1419
1422
|
}();
|
|
1420
1423
|
}
|
|
1421
|
-
function
|
|
1424
|
+
function Wt(e, n) {
|
|
1422
1425
|
(n == null || n > e.length) && (n = e.length);
|
|
1423
1426
|
for (var o = 0, i = new Array(n); o < n; o++)
|
|
1424
1427
|
i[o] = e[o];
|
|
1425
1428
|
return i;
|
|
1426
1429
|
}
|
|
1427
|
-
var fn = { center: "middle", right: "end" }, pn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 },
|
|
1430
|
+
var fn = { center: "middle", right: "end" }, pn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Kt = function(e, n) {
|
|
1428
1431
|
return !e && !n || e === n;
|
|
1429
1432
|
};
|
|
1430
1433
|
function gn(e, n) {
|
|
1431
|
-
var o = [], i = n.font(), h = i.size,
|
|
1434
|
+
var o = [], i = n.font(), h = i.size, y = i.family, w = n.align(), x = n.createElement();
|
|
1432
1435
|
if (e.length) {
|
|
1433
|
-
var b = i.height,
|
|
1434
|
-
if (pn[
|
|
1435
|
-
var
|
|
1436
|
-
|
|
1436
|
+
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 = mt(b / h), Q = I ? null : mt(b / (1.15 * h + (b - h) / 2));
|
|
1437
|
+
if (pn[E] && isFinite(O)) {
|
|
1438
|
+
var P = E === "bottom" ? 1 : 0.5;
|
|
1439
|
+
Q += (O * P - b * e.length * P) / h;
|
|
1437
1440
|
}
|
|
1438
|
-
var L = w === "justify",
|
|
1439
|
-
w === "right" ?
|
|
1440
|
-
for (var
|
|
1441
|
+
var L = w === "justify", H = 0;
|
|
1442
|
+
w === "right" ? H = M : w === "center" && (H = M / 2);
|
|
1443
|
+
for (var $ = [], tt = "tspan", Z = null, j = "", _ = function() {
|
|
1441
1444
|
if (j) {
|
|
1442
|
-
var
|
|
1443
|
-
|
|
1445
|
+
var gt = x(tt, Z, j);
|
|
1446
|
+
$.push(gt);
|
|
1444
1447
|
}
|
|
1445
|
-
|
|
1446
|
-
},
|
|
1447
|
-
var ot = "",
|
|
1448
|
+
tt = "tspan", Z = null, j = "";
|
|
1449
|
+
}, it = 0, et = e.length; it < et; it++) {
|
|
1450
|
+
var ot = "", ut = "", st = 0, at = e[it];
|
|
1448
1451
|
if (at.length) {
|
|
1449
|
-
|
|
1450
|
-
for (var vt = 0,
|
|
1451
|
-
var q = at[
|
|
1452
|
-
q.whitespace && vt++,
|
|
1452
|
+
$ = [];
|
|
1453
|
+
for (var vt = 0, It = 0, lt = void 0, W = 0, $t = at.length; W < $t; W++) {
|
|
1454
|
+
var q = at[W], K = q.font;
|
|
1455
|
+
q.whitespace && vt++, It += q.width, W && !q.tracking && !st && Kt(K.id, ot) && Kt(q.class, ut) && Kt(lt, 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 = mt(st), st = 0), q.tracking && (st = K.size * q.tracking), q.href && !lt ? (lt = q.href, tt = "a", Z.href = lt, Z.rel = q.rel, Z.target = q.target) : lt = null, ot = K.id, ut = q.class);
|
|
1453
1456
|
}
|
|
1454
|
-
if (_(),
|
|
1455
|
-
o.push.apply(o, ve(
|
|
1457
|
+
if (_(), I)
|
|
1458
|
+
o.push.apply(o, ve($));
|
|
1456
1459
|
else {
|
|
1457
|
-
var
|
|
1458
|
-
L && at.length > 1 && !
|
|
1460
|
+
var Nt = null, _t = it === et - 1 || at[at.length - 1] instanceof nt;
|
|
1461
|
+
L && at.length > 1 && !_t && (Nt = mt((M - It) / vt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Nt, x: z(it) + H, dy: mt(it ? R : Q) + "em" }].concat(ve($))));
|
|
1459
1462
|
}
|
|
1460
1463
|
} else
|
|
1461
|
-
o.push(x("tspan", { x:
|
|
1464
|
+
o.push(x("tspan", { x: z(it), dy: mt(it ? R : Q) + "em" }, " "));
|
|
1462
1465
|
}
|
|
1463
1466
|
}
|
|
1464
|
-
return x.apply(void 0, ["text", { fontFamily:
|
|
1467
|
+
return x.apply(void 0, ["text", { fontFamily: y, fontSize: h, textAnchor: fn[w] || "start" }].concat(o));
|
|
1465
1468
|
}
|
|
1466
1469
|
var yn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
|
|
1467
1470
|
function mn(e, n, o) {
|
|
1468
1471
|
if (e.length) {
|
|
1469
1472
|
o.textBaseline = "middle";
|
|
1470
|
-
var i = n.font(), h = i.height,
|
|
1471
|
-
if (
|
|
1472
|
-
var
|
|
1473
|
-
M += x *
|
|
1473
|
+
var i = n.font(), h = i.height, y = i.size, w = n.valign(), x = n.height()(), b = n.width()(0), E = n.align(), O = E === "justify", M = 0.5 * h, I = yn[w];
|
|
1474
|
+
if (I && isFinite(x)) {
|
|
1475
|
+
var z = e.length * h;
|
|
1476
|
+
M += x * I - z * I;
|
|
1474
1477
|
}
|
|
1475
|
-
e.forEach(function(R,
|
|
1476
|
-
var
|
|
1478
|
+
e.forEach(function(R, Q) {
|
|
1479
|
+
var P = n.x()(Q), L = Q * h + M, H = 0, $ = 0;
|
|
1477
1480
|
R.forEach(function(j) {
|
|
1478
|
-
j.whitespace &&
|
|
1481
|
+
j.whitespace && H++, $ += j.width;
|
|
1479
1482
|
});
|
|
1480
|
-
var
|
|
1481
|
-
|
|
1483
|
+
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) {
|
|
1482
1485
|
o.font = j.font;
|
|
1483
|
-
var _ = j.font,
|
|
1484
|
-
o.fillStyle = function(
|
|
1485
|
-
return
|
|
1486
|
+
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";
|
|
1486
1489
|
}(_, j);
|
|
1487
|
-
var
|
|
1488
|
-
if (
|
|
1490
|
+
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) {
|
|
1489
1492
|
o.beginPath(), o.strokeStyle = o.fillStyle;
|
|
1490
|
-
var ot = Math.floor(L + 0.45 *
|
|
1491
|
-
o.moveTo(
|
|
1493
|
+
var ot = Math.floor(L + 0.45 * y) + 0.5;
|
|
1494
|
+
o.moveTo(P + et, ot), o.lineTo(P + et + j.width, ot), o.stroke();
|
|
1492
1495
|
}
|
|
1493
|
-
|
|
1496
|
+
P += j.width;
|
|
1494
1497
|
});
|
|
1495
1498
|
});
|
|
1496
1499
|
}
|
|
1497
1500
|
}
|
|
1498
|
-
function
|
|
1499
|
-
return
|
|
1501
|
+
function Jt(e) {
|
|
1502
|
+
return Jt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1500
1503
|
return typeof n;
|
|
1501
1504
|
} : function(n) {
|
|
1502
1505
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1503
|
-
},
|
|
1506
|
+
}, Jt(e);
|
|
1504
1507
|
}
|
|
1505
1508
|
function xe(e) {
|
|
1506
1509
|
for (var n = {}, o = 0; o < e.length; o++) {
|
|
1507
1510
|
var i = e[o];
|
|
1508
|
-
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i :
|
|
1511
|
+
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : Jt(i) === "object" && i._groups ? n.d3 = i : i && i.nodeType && i.getContext ? n.ctx = i.getContext("2d") : i && i.fillText && i.beginPath ? n.ctx = i : i && (n.text = i));
|
|
1509
1512
|
}
|
|
1510
1513
|
return n;
|
|
1511
1514
|
}
|
|
1512
|
-
function
|
|
1513
|
-
return
|
|
1515
|
+
function kt(e) {
|
|
1516
|
+
return kt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1514
1517
|
return typeof n;
|
|
1515
1518
|
} : function(n) {
|
|
1516
1519
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1517
|
-
},
|
|
1520
|
+
}, kt(e);
|
|
1518
1521
|
}
|
|
1519
1522
|
function vn(e, n) {
|
|
1520
1523
|
for (var o = 0; o < n.length; o++) {
|
|
1521
1524
|
var i = n[o];
|
|
1522
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(
|
|
1523
|
-
if (
|
|
1524
|
-
return
|
|
1525
|
-
var x =
|
|
1525
|
+
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)
|
|
1527
|
+
return y;
|
|
1528
|
+
var x = y[Symbol.toPrimitive];
|
|
1526
1529
|
if (x !== void 0) {
|
|
1527
|
-
var b = x.call(
|
|
1528
|
-
if (
|
|
1530
|
+
var b = x.call(y, w);
|
|
1531
|
+
if (kt(b) !== "object")
|
|
1529
1532
|
return b;
|
|
1530
1533
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1531
1534
|
}
|
|
1532
|
-
return String(
|
|
1533
|
-
}(i.key, "string"),
|
|
1535
|
+
return String(y);
|
|
1536
|
+
}(i.key, "string"), kt(h) === "symbol" ? h : String(h)), i);
|
|
1534
1537
|
}
|
|
1535
1538
|
var h;
|
|
1536
1539
|
}
|
|
1537
|
-
var xn =
|
|
1540
|
+
var xn = S(), Qt = function(e) {
|
|
1538
1541
|
return typeof e == "function" ? e : function() {
|
|
1539
1542
|
return e;
|
|
1540
1543
|
};
|
|
1541
|
-
},
|
|
1544
|
+
}, rt = function() {
|
|
1542
1545
|
function e(i) {
|
|
1543
|
-
if (function(
|
|
1544
|
-
if (!(
|
|
1546
|
+
if (function(y, w) {
|
|
1547
|
+
if (!(y instanceof w))
|
|
1545
1548
|
throw new TypeError("Cannot call a class as a function");
|
|
1546
1549
|
}(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
|
|
1547
1550
|
return 1 / 0;
|
|
@@ -1555,80 +1558,80 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1555
1558
|
}
|
|
1556
1559
|
var n, o;
|
|
1557
1560
|
return n = e, o = [{ key: "linebreak", value: function(i) {
|
|
1558
|
-
var h = this,
|
|
1561
|
+
var h = this, y = this.props.parser(String(i)), w = this.font(), x = function(b, E, O) {
|
|
1559
1562
|
if (!b.length)
|
|
1560
1563
|
return [];
|
|
1561
|
-
var M =
|
|
1562
|
-
if (!M() && !
|
|
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)
|
|
1563
1566
|
return [];
|
|
1564
|
-
for (var L = 0,
|
|
1565
|
-
var _ = b[L],
|
|
1566
|
-
if (_.width =
|
|
1567
|
-
if (_ instanceof
|
|
1568
|
-
|
|
1569
|
-
else if (_ instanceof
|
|
1570
|
-
|
|
1571
|
-
else if (_.whitespace ||
|
|
1572
|
-
|
|
1573
|
-
else if (
|
|
1574
|
-
var
|
|
1567
|
+
for (var L = 0, H = 0, $ = 0, tt = [], Z = [], j = !1; L < b.length && H < P; ) {
|
|
1568
|
+
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))
|
|
1570
|
+
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;
|
|
1576
|
+
else if (Z.length) {
|
|
1577
|
+
var et = void 0, ot = void 0;
|
|
1575
1578
|
do {
|
|
1576
|
-
ot = !0,
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
+
ot = !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) && (ot = !Z.length));
|
|
1579
1582
|
} while (!ot);
|
|
1580
|
-
|
|
1583
|
+
tt.push(et.index + 1), $ = 0, H++, L = et.index, Z = [];
|
|
1581
1584
|
} else if (R === "break-word") {
|
|
1582
|
-
var at =
|
|
1583
|
-
if (
|
|
1585
|
+
var at = I(H);
|
|
1586
|
+
if ($ + _.width > at) {
|
|
1584
1587
|
var vt = _.clone();
|
|
1585
1588
|
do
|
|
1586
|
-
_.value = _.value.slice(0, -1), _.width =
|
|
1589
|
+
_.value = _.value.slice(0, -1), _.width = U(_, _.font), $ += _.width;
|
|
1587
1590
|
while (_.value && _.width > at);
|
|
1588
|
-
vt.value = vt.value.slice(_.value.length), b.splice(L + 1, 0, new
|
|
1591
|
+
vt.value = vt.value.slice(_.value.length), b.splice(L + 1, 0, new Et(), vt);
|
|
1589
1592
|
}
|
|
1590
|
-
|
|
1593
|
+
tt.push(L + 1), $ = 0, H++;
|
|
1591
1594
|
} else
|
|
1592
|
-
|
|
1595
|
+
$ += _.width;
|
|
1593
1596
|
L++, j = _.whitespace;
|
|
1594
1597
|
}
|
|
1595
|
-
L !==
|
|
1596
|
-
var
|
|
1597
|
-
for (var
|
|
1598
|
-
|
|
1599
|
-
for (var
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
var xt = b.slice(
|
|
1603
|
-
return
|
|
1598
|
+
L !== tt[tt.length - 1] && tt.push(L);
|
|
1599
|
+
var It = 0, lt = 0, W = tt.map(function(gt) {
|
|
1600
|
+
for (var J, yt = It; (J = b[yt]) && (J.whitespace || !J.value); )
|
|
1601
|
+
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 xt = b.slice(yt, dt).filter(function(ie) {
|
|
1606
|
+
return ie.value;
|
|
1604
1607
|
});
|
|
1605
|
-
return
|
|
1606
|
-
return
|
|
1608
|
+
return ne && xt.push(ne), xt.width = xt.reduce(function(ie, En) {
|
|
1609
|
+
return ie + En.width;
|
|
1607
1610
|
}, 0), xt.width > lt && (lt = xt.width), xt;
|
|
1608
1611
|
});
|
|
1609
|
-
if (
|
|
1610
|
-
var $t =
|
|
1611
|
-
|
|
1612
|
-
var
|
|
1613
|
-
if (
|
|
1614
|
-
var
|
|
1615
|
-
|
|
1612
|
+
if (W.hasLineOverflow = !1, z) {
|
|
1613
|
+
var $t = z === "ellipsis" ? "…" : z;
|
|
1614
|
+
W.forEach(function(gt, J) {
|
|
1615
|
+
var yt = I(J);
|
|
1616
|
+
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;
|
|
1616
1619
|
}
|
|
1617
1620
|
});
|
|
1618
1621
|
}
|
|
1619
|
-
var q =
|
|
1622
|
+
var q = E.overflow() === "ellipsis" ? "…" : E.overflow();
|
|
1620
1623
|
if (q && L !== b.length) {
|
|
1621
|
-
var
|
|
1622
|
-
|
|
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;
|
|
1623
1626
|
} else
|
|
1624
|
-
|
|
1625
|
-
return
|
|
1626
|
-
}(
|
|
1627
|
+
W.hasOverflow = !1;
|
|
1628
|
+
return W.font = O, W.width = lt, W;
|
|
1629
|
+
}(y, this, w);
|
|
1627
1630
|
return x.height = x.length * w.height, x.render = function(b) {
|
|
1628
1631
|
return h.render(x, b);
|
|
1629
1632
|
}, x.svg = x.render, x.draw = x.render, x;
|
|
1630
1633
|
} }, { key: "font", value: function(i) {
|
|
1631
|
-
return arguments.length ? (this.props.font =
|
|
1634
|
+
return arguments.length ? (this.props.font = S(i), this) : this.props.font || S(xn);
|
|
1632
1635
|
} }, { key: "overflow", value: function(i) {
|
|
1633
1636
|
return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
|
|
1634
1637
|
} }, { key: "overflowLine", value: function(i) {
|
|
@@ -1646,11 +1649,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1646
1649
|
var h = String(i).toLowerCase();
|
|
1647
1650
|
return h === "break-word" ? this.props.overflowWrap = "break-word" : h !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1648
1651
|
} }, { key: "width", value: function(i) {
|
|
1649
|
-
return arguments.length ? (this.props.width =
|
|
1652
|
+
return arguments.length ? (this.props.width = Qt(i), this) : this.props.width;
|
|
1650
1653
|
} }, { key: "height", value: function(i) {
|
|
1651
|
-
return arguments.length ? (this.props.height =
|
|
1654
|
+
return arguments.length ? (this.props.height = Qt(i), this) : this.props.height;
|
|
1652
1655
|
} }, { key: "x", value: function(i) {
|
|
1653
|
-
return arguments.length ? (this.props.x =
|
|
1656
|
+
return arguments.length ? (this.props.x = Qt(i), this) : this.props.x;
|
|
1654
1657
|
} }, { key: "parser", value: function(i) {
|
|
1655
1658
|
if (!arguments.length)
|
|
1656
1659
|
return this.props.parser;
|
|
@@ -1668,14 +1671,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1668
1671
|
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? mn(i.text, this, i.ctx) : gn(i.text, this);
|
|
1669
1672
|
} }], o && vn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1670
1673
|
}();
|
|
1671
|
-
function
|
|
1672
|
-
return
|
|
1674
|
+
function Tt(e) {
|
|
1675
|
+
return Tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1673
1676
|
return typeof n;
|
|
1674
1677
|
} : function(n) {
|
|
1675
1678
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1676
|
-
},
|
|
1679
|
+
}, Tt(e);
|
|
1677
1680
|
}
|
|
1678
|
-
function
|
|
1681
|
+
function te(e, n) {
|
|
1679
1682
|
(n == null || n > e.length) && (n = e.length);
|
|
1680
1683
|
for (var o = 0, i = new Array(n); o < n; o++)
|
|
1681
1684
|
i[o] = e[o];
|
|
@@ -1684,18 +1687,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1684
1687
|
function wn(e, n) {
|
|
1685
1688
|
for (var o = 0; o < n.length; o++) {
|
|
1686
1689
|
var i = n[o];
|
|
1687
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(
|
|
1688
|
-
if (
|
|
1689
|
-
return
|
|
1690
|
-
var x =
|
|
1690
|
+
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)
|
|
1692
|
+
return y;
|
|
1693
|
+
var x = y[Symbol.toPrimitive];
|
|
1691
1694
|
if (x !== void 0) {
|
|
1692
|
-
var b = x.call(
|
|
1693
|
-
if (
|
|
1695
|
+
var b = x.call(y, w);
|
|
1696
|
+
if (Tt(b) !== "object")
|
|
1694
1697
|
return b;
|
|
1695
1698
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1696
1699
|
}
|
|
1697
|
-
return String(
|
|
1698
|
-
}(i.key, "string"),
|
|
1700
|
+
return String(y);
|
|
1701
|
+
}(i.key, "string"), Tt(h) === "symbol" ? h : String(h)), i);
|
|
1699
1702
|
}
|
|
1700
1703
|
var h;
|
|
1701
1704
|
}
|
|
@@ -1705,8 +1708,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1705
1708
|
};
|
|
1706
1709
|
}, be = function() {
|
|
1707
1710
|
function e(i) {
|
|
1708
|
-
if (function(
|
|
1709
|
-
if (!(
|
|
1711
|
+
if (function(y, w) {
|
|
1712
|
+
if (!(y instanceof w))
|
|
1710
1713
|
throw new TypeError("Cannot call a class as a function");
|
|
1711
1714
|
}(this, e), this.props = { width: function() {
|
|
1712
1715
|
return 1 / 0;
|
|
@@ -1719,13 +1722,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1719
1722
|
}
|
|
1720
1723
|
var n, o;
|
|
1721
1724
|
return n = e, o = [{ key: "anchor", value: function(i) {
|
|
1722
|
-
var h = this.props,
|
|
1725
|
+
var h = this.props, y = h.hAnchor, w = h.vAnchor, x = h.width, b = h.height;
|
|
1723
1726
|
if (!arguments.length)
|
|
1724
|
-
return [
|
|
1727
|
+
return [y * x(0), w * b(0)];
|
|
1725
1728
|
if (typeof i == "string") {
|
|
1726
|
-
var
|
|
1727
|
-
i.toLowerCase().trim().split(/\s+/).forEach(function(
|
|
1728
|
-
|
|
1729
|
+
var E = this.props;
|
|
1730
|
+
i.toLowerCase().trim().split(/\s+/).forEach(function(O) {
|
|
1731
|
+
O === "top" && (E.vAnchor = -0), O === "middle" && (E.vAnchor = -0.5), O === "bottom" && (E.vAnchor = -1), O === "left" && (E.hAnchor = -0), O === "center" && (E.hAnchor = -0.5), O === "right" && (E.hAnchor = -1);
|
|
1729
1732
|
});
|
|
1730
1733
|
}
|
|
1731
1734
|
return this;
|
|
@@ -1738,21 +1741,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1738
1741
|
} }, { key: "createElement", value: function(i) {
|
|
1739
1742
|
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1740
1743
|
} }, { key: "canvas", value: function(i, h) {
|
|
1741
|
-
var
|
|
1744
|
+
var y, w = i.getContext ? i.getContext("2d") : i;
|
|
1742
1745
|
return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
|
|
1743
1746
|
if (Array.isArray(x))
|
|
1744
|
-
return
|
|
1745
|
-
}(
|
|
1747
|
+
return te(x);
|
|
1748
|
+
}(y = this.anchor()) || function(x) {
|
|
1746
1749
|
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
|
|
1747
1750
|
return Array.from(x);
|
|
1748
|
-
}(
|
|
1751
|
+
}(y) || function(x, b) {
|
|
1749
1752
|
if (x) {
|
|
1750
1753
|
if (typeof x == "string")
|
|
1751
|
-
return
|
|
1752
|
-
var
|
|
1753
|
-
return
|
|
1754
|
+
return te(x, b);
|
|
1755
|
+
var E = Object.prototype.toString.call(x).slice(8, -1);
|
|
1756
|
+
return E === "Object" && x.constructor && (E = x.constructor.name), E === "Map" || E === "Set" ? Array.from(x) : E === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(E) ? te(x, b) : void 0;
|
|
1754
1757
|
}
|
|
1755
|
-
}(
|
|
1758
|
+
}(y) || function() {
|
|
1756
1759
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1757
1760
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1758
1761
|
}()), h(w), w.restore(), w;
|
|
@@ -1767,99 +1770,99 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1767
1770
|
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, h);
|
|
1768
1771
|
}
|
|
1769
1772
|
} }], o && wn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1770
|
-
}(), bn = Object.prototype.hasOwnProperty,
|
|
1771
|
-
function
|
|
1772
|
-
return
|
|
1773
|
+
}(), bn = Object.prototype.hasOwnProperty, ee = {};
|
|
1774
|
+
function An(e) {
|
|
1775
|
+
return ee[e] || (ee[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
|
|
1773
1776
|
return o + "-" + i.toLowerCase();
|
|
1774
|
-
})),
|
|
1777
|
+
})), ee[e];
|
|
1775
1778
|
}
|
|
1776
|
-
function
|
|
1779
|
+
function Ae(e, n) {
|
|
1777
1780
|
if (Array.isArray(n))
|
|
1778
1781
|
return n.forEach(function(o) {
|
|
1779
|
-
return
|
|
1782
|
+
return Ae(e, o);
|
|
1780
1783
|
});
|
|
1781
1784
|
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1782
1785
|
}
|
|
1783
|
-
function
|
|
1786
|
+
function Se(e, n) {
|
|
1784
1787
|
if (typeof document < "u") {
|
|
1785
1788
|
var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1786
1789
|
if (n && o.setAttribute)
|
|
1787
1790
|
for (var i in n)
|
|
1788
|
-
bn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" :
|
|
1789
|
-
for (var h = arguments.length,
|
|
1790
|
-
|
|
1791
|
-
return
|
|
1792
|
-
|
|
1791
|
+
bn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : An(i), n[i]);
|
|
1792
|
+
for (var h = arguments.length, y = new Array(h > 2 ? h - 2 : 0), w = 2; w < h; w++)
|
|
1793
|
+
y[w - 2] = arguments[w];
|
|
1794
|
+
return y != null && y.length && y.forEach(function(x) {
|
|
1795
|
+
Ae(o, x);
|
|
1793
1796
|
}), o;
|
|
1794
1797
|
}
|
|
1795
1798
|
}
|
|
1796
|
-
|
|
1799
|
+
rt.createElement = Se, rt.textparser = Pt, rt.defaultparser = Pt, rt.htmlparser = function(e) {
|
|
1797
1800
|
e = String(e || "").trim();
|
|
1798
|
-
for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, h = [],
|
|
1799
|
-
for (var
|
|
1800
|
-
i[
|
|
1801
|
+
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
|
+
for (var I in i)
|
|
1803
|
+
i[I] && (M[I] = i[I]);
|
|
1801
1804
|
h.push(M);
|
|
1802
1805
|
}, x = function(M) {
|
|
1803
|
-
var
|
|
1804
|
-
if (
|
|
1805
|
-
for (var R =
|
|
1806
|
+
var I = h.length, z = tn[M];
|
|
1807
|
+
if (I && z) {
|
|
1808
|
+
for (var R = I - 1; h[R] && (h[R] instanceof Et || Ze.test(h[R].value)); )
|
|
1806
1809
|
R--;
|
|
1807
|
-
for (;
|
|
1808
|
-
R--,
|
|
1809
|
-
for (;
|
|
1810
|
-
h.push(new
|
|
1810
|
+
for (; z && h[R] && h[R] instanceof nt; )
|
|
1811
|
+
R--, z--;
|
|
1812
|
+
for (; z-- > 0; )
|
|
1813
|
+
h.push(new nt());
|
|
1811
1814
|
}
|
|
1812
1815
|
}; e.length; ) {
|
|
1813
1816
|
if (n = /^[^<]+/.exec(e))
|
|
1814
|
-
|
|
1817
|
+
Pt(ge(n[0]), !1).forEach(w);
|
|
1815
1818
|
else if (!(n = Je.exec(e)))
|
|
1816
1819
|
if (n = We.exec(e))
|
|
1817
|
-
|
|
1820
|
+
y.length && (i = y.pop()), x(n[1]);
|
|
1818
1821
|
else if (n = Ke.exec(e)) {
|
|
1819
1822
|
var b = n[1];
|
|
1820
|
-
x(b),
|
|
1821
|
-
var
|
|
1822
|
-
b === "a" && (
|
|
1823
|
+
x(b), y.push(i), i = Object.create(i), pe[b] && pe[b](i, "");
|
|
1824
|
+
var E = rn(n[2]);
|
|
1825
|
+
b === "a" && (E.href && (i.href = E.href), E.rel && (i.rel = E.rel), E.target && (i.target = E.target)), E.class && (i.class = i.class ? i.class + " " + E.class : E.class), E.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(E.style)) && o[1] && (i.color = o[1]), b === "br" && h.push(new nt());
|
|
1823
1826
|
} else
|
|
1824
|
-
n = [e.slice(0, 1)], w(new
|
|
1827
|
+
n = [e.slice(0, 1)], w(new N(n[0]));
|
|
1825
1828
|
e = e.slice(n[0].length);
|
|
1826
1829
|
}
|
|
1827
|
-
for (var
|
|
1828
|
-
h.pop(),
|
|
1830
|
+
for (var O = h[h.length - 1]; O instanceof nt; )
|
|
1831
|
+
h.pop(), O = h[h.length - 1];
|
|
1829
1832
|
return h;
|
|
1830
|
-
},
|
|
1833
|
+
}, rt.latexparser = function(e) {
|
|
1831
1834
|
e = String(e || "").trim();
|
|
1832
1835
|
var n = [0];
|
|
1833
|
-
e = e.replace(/\\verb,(.*?),/, function(
|
|
1836
|
+
e = e.replace(/\\verb,(.*?),/, function(P, L) {
|
|
1834
1837
|
return n.push(L), "\\verb," + (n.length - 1) + ",";
|
|
1835
1838
|
}).replace(/\\\\\n/g, function() {
|
|
1836
1839
|
return "\\\\";
|
|
1837
|
-
}).replace(hn, function(
|
|
1838
|
-
return
|
|
1839
|
-
}).replace(/\n\s+/g, function(
|
|
1840
|
-
return /\n/.test(
|
|
1841
|
-
}).replace(/\\symbol\{(\d+)\}/, function(
|
|
1842
|
-
return
|
|
1843
|
-
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(
|
|
1844
|
-
return L +
|
|
1845
|
-
}).replace(/\\verb,(.*?),/, function(
|
|
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) {
|
|
1846
1849
|
return "\\verb,".concat(n[+L], ",");
|
|
1847
1850
|
});
|
|
1848
|
-
for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [],
|
|
1851
|
+
for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], y = [], w = function(P) {
|
|
1849
1852
|
for (var L in i)
|
|
1850
|
-
i[L] && (
|
|
1851
|
-
return h.push(
|
|
1853
|
+
i[L] && (P[L] = i[L]);
|
|
1854
|
+
return h.push(P), P;
|
|
1852
1855
|
}, x = function() {
|
|
1853
|
-
|
|
1856
|
+
y.push(i), i = Object.create(i);
|
|
1854
1857
|
}, b = function() {
|
|
1855
|
-
if (!
|
|
1858
|
+
if (!y.length)
|
|
1856
1859
|
throw new Error("Unexpected }");
|
|
1857
|
-
i =
|
|
1858
|
-
},
|
|
1860
|
+
i = y.pop();
|
|
1861
|
+
}, E = { tokens: h, open_context: x, close_context: b, add_token: w }; e.length; ) {
|
|
1859
1862
|
if (o = an.exec(e))
|
|
1860
|
-
|
|
1863
|
+
Pt(o[0], !1).forEach(w);
|
|
1861
1864
|
else if (o = ln.exec(e))
|
|
1862
|
-
w(new
|
|
1865
|
+
w(new N(o[1]));
|
|
1863
1866
|
else if (!(o = on.exec(e))) {
|
|
1864
1867
|
if (o = /^\{/.exec(e))
|
|
1865
1868
|
x();
|
|
@@ -1867,64 +1870,64 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1867
1870
|
b();
|
|
1868
1871
|
else if (!(o = /^\$/.exec(e)))
|
|
1869
1872
|
if (o = /^\\verb,([^,]+),/.exec(e))
|
|
1870
|
-
w(new
|
|
1873
|
+
w(new N(o[1]));
|
|
1871
1874
|
else if (o = sn.exec(e)) {
|
|
1872
|
-
var
|
|
1873
|
-
if (/^(La)?TeX$/i.test(
|
|
1875
|
+
var O = o[1].slice(1) || o[1], M = !!o[2];
|
|
1876
|
+
if (/^(La)?TeX$/i.test(O)) {
|
|
1874
1877
|
x(), i.family = "serif";
|
|
1875
|
-
var
|
|
1876
|
-
|
|
1877
|
-
} else if (
|
|
1878
|
-
w(new
|
|
1879
|
-
else if (
|
|
1880
|
-
var
|
|
1878
|
+
var I = void 0;
|
|
1879
|
+
O === "LaTeX" && ((I = w(new N("L"))).tracking = -0.25, (I = w(new N("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new N("T"))).tracking = -0.17, (I = w(new N("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new N("X")), b();
|
|
1880
|
+
} else if (O in ye)
|
|
1881
|
+
w(new N(ye[O])), M && x();
|
|
1882
|
+
else if (O in V) {
|
|
1883
|
+
var z = [], R = V[O].length - 1, Q = void 0;
|
|
1881
1884
|
if (R) {
|
|
1882
1885
|
for (M = !1, e = e.slice(o[0].length - 1); R--; ) {
|
|
1883
|
-
if (!(
|
|
1884
|
-
throw new Error(
|
|
1885
|
-
|
|
1886
|
+
if (!(Q = /^\{([^}]+)\}/.exec(e)))
|
|
1887
|
+
throw new Error(O + " is missing an argument");
|
|
1888
|
+
z.push(Q[1]), e = e.slice(Q[0].length);
|
|
1886
1889
|
}
|
|
1887
1890
|
o[0] = /^\{/.exec(e) ? "{" : "", M = !!o[0];
|
|
1888
1891
|
}
|
|
1889
|
-
M && x(), V[
|
|
1892
|
+
M && x(), V[O].apply(E, [i].concat(z));
|
|
1890
1893
|
} else
|
|
1891
|
-
console.warn("unknown latex command",
|
|
1894
|
+
console.warn("unknown latex command", O), w(new N(o[1])), M && x();
|
|
1892
1895
|
} else
|
|
1893
|
-
o = [e.slice(0, 1)], w(new
|
|
1896
|
+
o = [e.slice(0, 1)], w(new N(o[0]));
|
|
1894
1897
|
}
|
|
1895
1898
|
e = e.slice(o[0].length);
|
|
1896
1899
|
}
|
|
1897
1900
|
return h;
|
|
1898
|
-
},
|
|
1899
|
-
return
|
|
1900
|
-
},
|
|
1901
|
-
const
|
|
1901
|
+
}, 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;
|
|
1904
|
+
const Sn = rt;
|
|
1902
1905
|
return r.default;
|
|
1903
1906
|
})());
|
|
1904
1907
|
})(Ve);
|
|
1905
|
-
var
|
|
1906
|
-
const
|
|
1907
|
-
function qn(
|
|
1908
|
-
const t =
|
|
1908
|
+
var Fn = Ve.exports;
|
|
1909
|
+
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 || {};
|
|
1909
1912
|
if (t.width === t.height && t.width === 0)
|
|
1910
1913
|
return;
|
|
1911
|
-
const
|
|
1914
|
+
const p = new Oe({
|
|
1912
1915
|
font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
|
|
1913
|
-
width: t.width -
|
|
1914
|
-
height: t.height -
|
|
1916
|
+
width: t.width - c * 2,
|
|
1917
|
+
height: t.height - c * 2,
|
|
1915
1918
|
align: "left",
|
|
1916
1919
|
valign: "top",
|
|
1917
1920
|
x: 0,
|
|
1918
1921
|
overflow: "ellipsis",
|
|
1919
1922
|
parser: "html",
|
|
1920
|
-
createElement:
|
|
1923
|
+
createElement: Oe.createElement
|
|
1921
1924
|
}).linebreak(
|
|
1922
|
-
|
|
1925
|
+
u.properties.content.replaceAll(`
|
|
1923
1926
|
`, "<br>")
|
|
1924
1927
|
).render();
|
|
1925
|
-
|
|
1928
|
+
p.setAttribute("transform", `translate(${c}, ${c})`), l.appendChild(p);
|
|
1926
1929
|
}
|
|
1927
|
-
const
|
|
1930
|
+
const Me = 20;
|
|
1928
1931
|
class Bn extends Be {
|
|
1929
1932
|
constructor(t, r = {}) {
|
|
1930
1933
|
super(
|
|
@@ -1946,7 +1949,7 @@ class Bn extends Be {
|
|
|
1946
1949
|
v(this, "textArea");
|
|
1947
1950
|
v(this, "handleSize");
|
|
1948
1951
|
v(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
|
|
1949
|
-
v(this, "annotation", { ...
|
|
1952
|
+
v(this, "annotation", { ...re });
|
|
1950
1953
|
v(this, "startX", 0);
|
|
1951
1954
|
v(this, "startY", 0);
|
|
1952
1955
|
v(this, "handles", []);
|
|
@@ -1959,22 +1962,22 @@ class Bn extends Be {
|
|
|
1959
1962
|
v(this, "_onBlur", () => {
|
|
1960
1963
|
this.isFocused = !1;
|
|
1961
1964
|
});
|
|
1962
|
-
v(this, "startDrawing", (t, r, a =
|
|
1965
|
+
v(this, "startDrawing", (t, r, a = jn(t, r, 0, 0, "", At)) => {
|
|
1963
1966
|
this.add(a);
|
|
1964
|
-
const
|
|
1965
|
-
this.select(a.id), this.startDragging(this.getById(a.id),
|
|
1967
|
+
const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
|
|
1968
|
+
this.select(a.id), this.startDragging(this.getById(a.id), c.x, c.y), this.draggedHandle = 6;
|
|
1966
1969
|
});
|
|
1967
1970
|
v(this, "cancelDrawing", () => {
|
|
1968
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
1971
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = B, this.isDragging = !1, this.emit(St, this.annotation));
|
|
1969
1972
|
});
|
|
1970
1973
|
v(this, "startDragging", (t, r, a) => {
|
|
1971
1974
|
this.annotation = t;
|
|
1972
|
-
const
|
|
1973
|
-
this.rect.x =
|
|
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;
|
|
1974
1977
|
});
|
|
1975
1978
|
v(this, "onHandleMouseDown", (t) => {
|
|
1976
1979
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1977
|
-
r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle =
|
|
1980
|
+
r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = He(t.target));
|
|
1978
1981
|
});
|
|
1979
1982
|
v(this, "onMouseMove", (t) => {
|
|
1980
1983
|
requestAnimationFrame(() => this._onMouseMove(t));
|
|
@@ -1983,81 +1986,91 @@ class Bn extends Be {
|
|
|
1983
1986
|
if (!this.isDragging)
|
|
1984
1987
|
return;
|
|
1985
1988
|
t.stopPropagation(), t.preventDefault();
|
|
1986
|
-
const r = this.handles[this.draggedHandle], a = r.classList.contains("top"),
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
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);
|
|
1991
|
+
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),
|
|
1993
|
+
Me
|
|
1994
|
+
), F = Math.max(
|
|
1995
|
+
this.rect.height + m * (p || a ? 0 : 1),
|
|
1996
|
+
Me
|
|
1992
1997
|
);
|
|
1993
|
-
zn(this.annotation,
|
|
1998
|
+
zn(this.annotation, S, C, k, F), this.emit(Bt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
1994
1999
|
});
|
|
1995
2000
|
v(this, "onMouseUp", () => {
|
|
1996
|
-
!this.isDragging || this.draggedHandle === B || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(
|
|
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);
|
|
1997
2002
|
});
|
|
1998
2003
|
v(this, "onViewChanged", () => {
|
|
1999
2004
|
const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
|
|
2000
|
-
document.documentElement.style.setProperty("--handle-
|
|
2005
|
+
document.documentElement.style.setProperty("--handle-scale", `${1 / t}`);
|
|
2001
2006
|
});
|
|
2002
2007
|
v(this, "_onInput", () => {
|
|
2003
2008
|
const t = this.getById(this.selectedId);
|
|
2004
|
-
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(
|
|
2009
|
+
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(he, t), this.layer.refresh());
|
|
2005
2010
|
});
|
|
2006
|
-
this.handleSize = De.handleSize || r.textHandleSize, this.placeholder = De.placeholder || r.textPlaceholder || "";
|
|
2011
|
+
this.showeditorOnHover = !1, this.handleSize = De.handleSize || r.textHandleSize, this.placeholder = De.placeholder || r.textPlaceholder || "";
|
|
2007
2012
|
const a = this.textArea = this.editor.element.querySelector("textarea");
|
|
2008
2013
|
a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
2009
2014
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
2010
2015
|
), this.handles.forEach(
|
|
2011
|
-
(
|
|
2016
|
+
(c) => c.addEventListener("mousedown", this.onHandleMouseDown)
|
|
2012
2017
|
), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
|
|
2013
2018
|
}
|
|
2014
2019
|
_canRemove() {
|
|
2015
2020
|
return !this.isFocused;
|
|
2016
2021
|
}
|
|
2017
2022
|
detect({ x: t, y: r }, a = 0) {
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2023
|
+
const c = new G(t, r), f = this.ogma.view.getAngle();
|
|
2024
|
+
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;
|
|
2021
2027
|
});
|
|
2022
2028
|
}
|
|
2023
2029
|
draw(t) {
|
|
2024
2030
|
t.innerHTML = "";
|
|
2025
|
-
const r = "";
|
|
2026
|
-
this.elements.forEach((
|
|
2027
|
-
const
|
|
2028
|
-
color:
|
|
2029
|
-
fontSize:
|
|
2030
|
-
font:
|
|
2031
|
-
strokeColor:
|
|
2032
|
-
strokeWidth:
|
|
2033
|
-
strokeType:
|
|
2034
|
-
background:
|
|
2035
|
-
} =
|
|
2036
|
-
if (
|
|
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, {
|
|
2034
|
+
color: A,
|
|
2035
|
+
fontSize: T,
|
|
2036
|
+
font: S,
|
|
2037
|
+
strokeColor: C,
|
|
2038
|
+
strokeWidth: k,
|
|
2039
|
+
strokeType: F,
|
|
2040
|
+
background: Y
|
|
2041
|
+
} = f.properties.style || At;
|
|
2042
|
+
if (m === this.selectedId)
|
|
2037
2043
|
return;
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
const
|
|
2041
|
-
let
|
|
2042
|
-
|
|
2044
|
+
const D = Dt("g");
|
|
2045
|
+
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);
|
|
2049
|
+
});
|
|
2050
|
+
const c = Dt("style");
|
|
2051
|
+
c.innerHTML = r, t.firstChild && t.insertBefore(c, t.firstChild);
|
|
2052
|
+
}
|
|
2053
|
+
refreshDrawing() {
|
|
2054
|
+
const t = this.ogma.view.getAngle() * 180 / Math.PI;
|
|
2055
|
+
[...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})`);
|
|
2043
2058
|
});
|
|
2044
|
-
const a = It("style");
|
|
2045
|
-
a.innerHTML = r, t.firstChild && t.insertBefore(a, t.firstChild);
|
|
2046
2059
|
}
|
|
2047
2060
|
getDefaultOptions() {
|
|
2048
|
-
return
|
|
2061
|
+
return re;
|
|
2049
2062
|
}
|
|
2050
2063
|
refreshEditor() {
|
|
2051
2064
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
2052
2065
|
return;
|
|
2053
|
-
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r =
|
|
2054
|
-
font:
|
|
2055
|
-
fontSize:
|
|
2056
|
-
color:
|
|
2057
|
-
background:
|
|
2058
|
-
padding:
|
|
2059
|
-
} = t.properties.style ||
|
|
2060
|
-
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 *
|
|
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,
|
|
2068
|
+
fontSize: g,
|
|
2069
|
+
color: p,
|
|
2070
|
+
background: s,
|
|
2071
|
+
padding: d = 0
|
|
2072
|
+
} = 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 = `${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();
|
|
2061
2074
|
}
|
|
2062
2075
|
select(t) {
|
|
2063
2076
|
super.select(t), this.textArea.focus();
|
|
@@ -2072,20 +2085,20 @@ class Vn {
|
|
|
2072
2085
|
v(this, "linksByTargetId", {});
|
|
2073
2086
|
v(this, "linksByArrowId", {});
|
|
2074
2087
|
}
|
|
2075
|
-
add(l, t, r, a,
|
|
2076
|
-
const
|
|
2077
|
-
id:
|
|
2078
|
-
arrow:
|
|
2088
|
+
add(l, t, r, a, c) {
|
|
2089
|
+
const f = Ut(), g = l.id, p = {
|
|
2090
|
+
id: f,
|
|
2091
|
+
arrow: g,
|
|
2079
2092
|
target: r,
|
|
2080
2093
|
targetType: a,
|
|
2081
|
-
connectionPoint:
|
|
2094
|
+
connectionPoint: c,
|
|
2082
2095
|
side: t
|
|
2083
2096
|
};
|
|
2084
|
-
return this.links[
|
|
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] = {
|
|
2085
2098
|
id: r,
|
|
2086
2099
|
side: t,
|
|
2087
2100
|
type: a,
|
|
2088
|
-
magnet:
|
|
2101
|
+
magnet: c
|
|
2089
2102
|
}, this;
|
|
2090
2103
|
}
|
|
2091
2104
|
arrowIsLinked(l, t) {
|
|
@@ -2094,16 +2107,16 @@ class Vn {
|
|
|
2094
2107
|
}
|
|
2095
2108
|
// remove the link between the arrow and the target by arrow id and side
|
|
2096
2109
|
remove(l, t) {
|
|
2097
|
-
var
|
|
2098
|
-
const r = l.id, a = (
|
|
2099
|
-
if ((
|
|
2110
|
+
var g, p;
|
|
2111
|
+
const r = l.id, a = (g = this.linksByArrowId[r]) == null ? void 0 : g[t];
|
|
2112
|
+
if ((p = l.properties.link) == null || delete p[t], !a)
|
|
2100
2113
|
return this;
|
|
2101
|
-
const
|
|
2114
|
+
const c = this.links[a];
|
|
2102
2115
|
delete this.links[a];
|
|
2103
|
-
const
|
|
2104
|
-
for (let s = 0; s <
|
|
2105
|
-
if (
|
|
2106
|
-
|
|
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);
|
|
2107
2120
|
break;
|
|
2108
2121
|
}
|
|
2109
2122
|
return delete this.linksByArrowId[r][t], this;
|
|
@@ -2113,12 +2126,15 @@ class Vn {
|
|
|
2113
2126
|
const r = (a = this.linksByArrowId[l]) == null ? void 0 : a[t];
|
|
2114
2127
|
return r ? this.links[r] : null;
|
|
2115
2128
|
}
|
|
2116
|
-
getTargetLinks(l) {
|
|
2117
|
-
var
|
|
2118
|
-
return ((
|
|
2129
|
+
getTargetLinks(l, t) {
|
|
2130
|
+
var r;
|
|
2131
|
+
return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((a) => this.links[a]).filter((a) => a.targetType === t)) ?? [];
|
|
2132
|
+
}
|
|
2133
|
+
forEach(l) {
|
|
2134
|
+
Object.values(this.links).forEach(l);
|
|
2119
2135
|
}
|
|
2120
2136
|
}
|
|
2121
|
-
const ht = (
|
|
2137
|
+
const ht = (u) => u.properties.type === "arrow", bt = (u) => u.properties.type === "text", ze = (u) => u.type === "FeatureCollection", Un = {
|
|
2122
2138
|
magnetColor: "#3e8",
|
|
2123
2139
|
detectMargin: 20,
|
|
2124
2140
|
magnetHandleRadius: 5,
|
|
@@ -2162,40 +2178,40 @@ class Gn extends qe {
|
|
|
2162
2178
|
Ce.forEach((a) => {
|
|
2163
2179
|
if (!this.textToMagnet)
|
|
2164
2180
|
return;
|
|
2165
|
-
const
|
|
2166
|
-
t.moveTo(
|
|
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);
|
|
2182
|
+
t.moveTo(g, p), t.arc(g, p, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
|
|
2167
2183
|
}), t.fill(), t.closePath();
|
|
2168
2184
|
});
|
|
2169
2185
|
v(this, "_onFeatureDrag", (t, r) => {
|
|
2170
2186
|
const a = r;
|
|
2171
2187
|
if (ht(t) && a === "line")
|
|
2172
|
-
["start", "end"].find((
|
|
2173
|
-
const
|
|
2174
|
-
return this._snapToText(t, a,
|
|
2188
|
+
["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);
|
|
2175
2191
|
});
|
|
2176
2192
|
else if (ht(t) && a !== "line") {
|
|
2177
|
-
const
|
|
2178
|
-
this._snapToText(t, a,
|
|
2193
|
+
const c = a === "start" ? Ot(t) : Ft(t);
|
|
2194
|
+
this._snapToText(t, a, c) || this._findAndSnapToNode(t, a, c);
|
|
2179
2195
|
} else
|
|
2180
|
-
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2196
|
+
bt(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];
|
|
2183
2199
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
2184
|
-
this.layer.refresh();
|
|
2200
|
+
this.layer.refresh(), this.emit(Bt, t, r);
|
|
2185
2201
|
});
|
|
2186
2202
|
v(this, "_onFeatureDragEnd", (t) => {
|
|
2187
|
-
this.dragged !== null && ht(t) &&
|
|
2203
|
+
this.dragged !== null && ht(t) && Ot(this.dragged) && Le.forEach((r) => {
|
|
2188
2204
|
this.links.getArrowLink(t.id, r) && this.emit(Nn, {
|
|
2189
2205
|
arrow: t,
|
|
2190
2206
|
link: this.links.getArrowLink(t.id, r)
|
|
2191
2207
|
});
|
|
2192
|
-
}), (
|
|
2208
|
+
}), (bt(t) || ht(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh(), this.emit(St, t);
|
|
2193
2209
|
});
|
|
2194
2210
|
v(this, "_onFeatureDragStart", (t) => {
|
|
2195
|
-
this.textToMagnet = void 0, ht(t) ? this.dragged = t :
|
|
2211
|
+
this.textToMagnet = void 0, ht(t) ? this.dragged = t : bt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
|
|
2196
2212
|
const a = r.getSelectedFeature();
|
|
2197
2213
|
a && a !== t && r.unhover().unselect(), r.disableDetection();
|
|
2198
|
-
});
|
|
2214
|
+
}), this.emit(Vt, t);
|
|
2199
2215
|
});
|
|
2200
2216
|
v(this, "_onNodesDragStart", () => {
|
|
2201
2217
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
@@ -2206,26 +2222,26 @@ class Gn extends qe {
|
|
|
2206
2222
|
});
|
|
2207
2223
|
v(this, "_onLayoutEnd", (t) => {
|
|
2208
2224
|
t.ids.forEach((r, a) => {
|
|
2209
|
-
this.links.getTargetLinks(r).forEach((
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A =
|
|
2214
|
-
|
|
2225
|
+
this.links.getTargetLinks(r, "node").forEach((f) => {
|
|
2226
|
+
const g = this.getAnnotation(f.arrow), p = f.side, s = Rt(
|
|
2227
|
+
g,
|
|
2228
|
+
p === "start" ? "end" : "start"
|
|
2229
|
+
), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ht(s, d, +m);
|
|
2230
|
+
wt(g, p, A.x, A.y);
|
|
2215
2231
|
});
|
|
2216
2232
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
2217
2233
|
});
|
|
2218
2234
|
v(this, "_onAdded", (t) => {
|
|
2219
|
-
this.emit(
|
|
2235
|
+
this.emit(le, t);
|
|
2220
2236
|
});
|
|
2221
2237
|
v(this, "_onRemoved", (t) => {
|
|
2222
|
-
this.emit(
|
|
2238
|
+
this.emit(ae, t);
|
|
2223
2239
|
});
|
|
2224
2240
|
v(this, "_onUnselect", (t) => {
|
|
2225
|
-
this.selected = null, this.emit(
|
|
2241
|
+
this.selected = null, this.emit(oe, t);
|
|
2226
2242
|
});
|
|
2227
2243
|
v(this, "_onSelect", (t) => {
|
|
2228
|
-
this.selected !== t && (this.selected = t, this.emit(
|
|
2244
|
+
this.selected !== t && (this.selected = t, this.emit(se, this.selected));
|
|
2229
2245
|
});
|
|
2230
2246
|
/**
|
|
2231
2247
|
* Triggers the update event on the annotation
|
|
@@ -2237,49 +2253,61 @@ class Gn extends qe {
|
|
|
2237
2253
|
);
|
|
2238
2254
|
});
|
|
2239
2255
|
v(this, "_onUpdate", (t) => {
|
|
2240
|
-
this.emit(
|
|
2256
|
+
this.emit(he, t);
|
|
2241
2257
|
});
|
|
2242
|
-
this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new
|
|
2243
|
-
a.on(
|
|
2244
|
-
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd),
|
|
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);
|
|
2260
|
+
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
2261
|
+
this.refreshTextLinks();
|
|
2262
|
+
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
2245
2263
|
}
|
|
2246
2264
|
_moveNodes(t, r, a) {
|
|
2247
|
-
t.forEach((
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2250
|
-
const s = this.getAnnotation(
|
|
2265
|
+
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(
|
|
2251
2269
|
s,
|
|
2252
2270
|
d === "start" ? "end" : "start"
|
|
2253
2271
|
);
|
|
2254
|
-
let A =
|
|
2255
|
-
const
|
|
2256
|
-
(
|
|
2272
|
+
let A = g;
|
|
2273
|
+
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)), wt(s, d, A.x, A.y);
|
|
2257
2275
|
});
|
|
2258
2276
|
}), this.arrows.refreshLayer();
|
|
2259
2277
|
}
|
|
2260
2278
|
_snapToText(t, r, a) {
|
|
2261
|
-
const
|
|
2262
|
-
if (this.links.remove(t, r), !
|
|
2279
|
+
const c = this.texts.detect(a, this.options.detectMargin);
|
|
2280
|
+
if (this.links.remove(t, r), !c)
|
|
2263
2281
|
return !1;
|
|
2264
|
-
this.textToMagnet =
|
|
2265
|
-
const
|
|
2266
|
-
return
|
|
2282
|
+
this.textToMagnet = c;
|
|
2283
|
+
const f = this.findMagnetPoint(Ce, c, a);
|
|
2284
|
+
return f ? (wt(t, r, f.point.x, f.point.y), this.links.add(t, r, c.id, "text", f.magnet), !0) : !1;
|
|
2267
2285
|
}
|
|
2268
2286
|
_findAndSnapToNode(t, r, a) {
|
|
2269
|
-
const
|
|
2270
|
-
this.links.remove(t, r),
|
|
2271
|
-
}
|
|
2272
|
-
_snapToNode(t, r, a,
|
|
2273
|
-
const
|
|
2274
|
-
if (m <
|
|
2275
|
-
let
|
|
2276
|
-
if (m >
|
|
2277
|
-
const
|
|
2278
|
-
|
|
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);
|
|
2289
|
+
}
|
|
2290
|
+
_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();
|
|
2292
|
+
if (m < p + this.options.detectMargin) {
|
|
2293
|
+
let T = A;
|
|
2294
|
+
if (m > p / 2) {
|
|
2295
|
+
const S = Rt(t, r === "end" ? "start" : "end");
|
|
2296
|
+
T = Ht(S, T, g);
|
|
2279
2297
|
}
|
|
2280
|
-
|
|
2298
|
+
wt(t, r, T.x, T.y), this.links.add(t, r, a.getId(), "node", T);
|
|
2281
2299
|
}
|
|
2282
2300
|
}
|
|
2301
|
+
refreshTextLinks() {
|
|
2302
|
+
let t = !1;
|
|
2303
|
+
this.links.forEach(({ connectionPoint: r, targetType: a, target: c, arrow: f, side: g }) => {
|
|
2304
|
+
if (a !== "text")
|
|
2305
|
+
return;
|
|
2306
|
+
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);
|
|
2308
|
+
wt(s, g, A.x, A.y);
|
|
2309
|
+
}), t && this.arrows.refreshLayer();
|
|
2310
|
+
}
|
|
2283
2311
|
/**
|
|
2284
2312
|
* @returns the currently selected annotation
|
|
2285
2313
|
*/
|
|
@@ -2287,18 +2315,23 @@ class Gn extends qe {
|
|
|
2287
2315
|
return this.selected;
|
|
2288
2316
|
}
|
|
2289
2317
|
findMagnetPoint(t, r, a) {
|
|
2290
|
-
let
|
|
2291
|
-
for (const
|
|
2292
|
-
const
|
|
2318
|
+
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(
|
|
2321
|
+
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
2322
|
+
// when really zoomed in: avoid to snap on too far away magnets
|
|
2323
|
+
g.width / 2,
|
|
2324
|
+
g.height / 2
|
|
2325
|
+
);
|
|
2293
2326
|
if (d < Math.max(m, this.options.magnetHandleRadius)) {
|
|
2294
|
-
|
|
2327
|
+
c = {
|
|
2295
2328
|
point: s,
|
|
2296
|
-
magnet:
|
|
2329
|
+
magnet: f
|
|
2297
2330
|
};
|
|
2298
2331
|
break;
|
|
2299
2332
|
}
|
|
2300
2333
|
}
|
|
2301
|
-
return
|
|
2334
|
+
return c;
|
|
2302
2335
|
}
|
|
2303
2336
|
/**
|
|
2304
2337
|
* Set the options for the controller
|
|
@@ -2317,13 +2350,13 @@ class Gn extends qe {
|
|
|
2317
2350
|
*/
|
|
2318
2351
|
select(t) {
|
|
2319
2352
|
const r = this.getAnnotations().features.find((a) => a.id === t);
|
|
2320
|
-
return r ? (ht(r) ? this.arrows.select(r.id) :
|
|
2353
|
+
return r ? (ht(r) ? this.arrows.select(r.id) : bt(r) && this.texts.select(r.id), this) : this;
|
|
2321
2354
|
}
|
|
2322
2355
|
/**
|
|
2323
2356
|
* Unselects the currently selected annotation
|
|
2324
2357
|
*/
|
|
2325
2358
|
unselect() {
|
|
2326
|
-
return this.selected ? (ht(this.selected) ? this.arrows.unselect() :
|
|
2359
|
+
return this.selected ? (ht(this.selected) ? this.arrows.unselect() : bt(this.selected) && this.texts.unselect(), this) : this;
|
|
2327
2360
|
}
|
|
2328
2361
|
/**
|
|
2329
2362
|
* Add an annotation to the controller
|
|
@@ -2333,7 +2366,7 @@ class Gn extends qe {
|
|
|
2333
2366
|
if (ze(t))
|
|
2334
2367
|
return t.features.forEach(
|
|
2335
2368
|
(r) => this.add(r)
|
|
2336
|
-
), this;
|
|
2369
|
+
), this.arrows.refreshLayer(), this;
|
|
2337
2370
|
switch (t.properties.type) {
|
|
2338
2371
|
case "text":
|
|
2339
2372
|
this.texts.add(t);
|
|
@@ -2362,9 +2395,12 @@ class Gn extends qe {
|
|
|
2362
2395
|
if (this.getAnnotation(a.id))
|
|
2363
2396
|
this.links.add(t, r, a.id, a.type, a.magnet);
|
|
2364
2397
|
else {
|
|
2365
|
-
|
|
2398
|
+
const f = this.ogma.getNode(a.id);
|
|
2399
|
+
if (!f)
|
|
2366
2400
|
continue;
|
|
2367
2401
|
this.links.add(t, r, a.id, a.type, a.magnet);
|
|
2402
|
+
const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = Rt(t, r === "start" ? "end" : "start"), d = Ht(s, g, +p);
|
|
2403
|
+
wt(t, r, d.x, d.y);
|
|
2368
2404
|
}
|
|
2369
2405
|
}
|
|
2370
2406
|
}
|
|
@@ -2390,7 +2426,7 @@ class Gn extends qe {
|
|
|
2390
2426
|
* Cancel drawing on the current frame
|
|
2391
2427
|
*/
|
|
2392
2428
|
cancelDrawing() {
|
|
2393
|
-
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(
|
|
2429
|
+
this.annotations.forEach((t) => t.cancelDrawing()), this.emit($n);
|
|
2394
2430
|
}
|
|
2395
2431
|
/**
|
|
2396
2432
|
* Update the style of the annotation with the given id
|
|
@@ -2398,8 +2434,8 @@ class Gn extends qe {
|
|
|
2398
2434
|
* @param style The new style
|
|
2399
2435
|
*/
|
|
2400
2436
|
updateStyle(t, r) {
|
|
2401
|
-
const a = this.getAnnotations().features.find((
|
|
2402
|
-
return a ? (ht(a) ? this.arrows.updateStyle(a, r) :
|
|
2437
|
+
const a = this.getAnnotations().features.find((c) => c.id === t);
|
|
2438
|
+
return a ? (ht(a) ? this.arrows.updateStyle(a, r) : bt(a) && this.texts.updateStyle(a, r), this.onUpdate(a), this) : this;
|
|
2403
2439
|
}
|
|
2404
2440
|
/**
|
|
2405
2441
|
*
|
|
@@ -2430,34 +2466,34 @@ class Gn extends qe {
|
|
|
2430
2466
|
}
|
|
2431
2467
|
}
|
|
2432
2468
|
export {
|
|
2433
|
-
|
|
2469
|
+
Hn as Arrows,
|
|
2434
2470
|
Gn as Control,
|
|
2435
2471
|
Bn as Texts,
|
|
2436
2472
|
Dn as createArrow,
|
|
2437
|
-
|
|
2438
|
-
|
|
2473
|
+
Dt as createSVGElement,
|
|
2474
|
+
jn as createText,
|
|
2439
2475
|
Ee as defaultArrowOptions,
|
|
2440
|
-
|
|
2476
|
+
Mt as defaultArrowStyle,
|
|
2441
2477
|
De as defaultControllerOptions,
|
|
2442
|
-
|
|
2443
|
-
|
|
2478
|
+
re as defaultTextOptions,
|
|
2479
|
+
At as defaultTextStyle,
|
|
2444
2480
|
Xn as getAnnotationsBounds,
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2481
|
+
Ft as getArrowEnd,
|
|
2482
|
+
qt as getArrowEndPoints,
|
|
2483
|
+
Rt as getArrowSide,
|
|
2484
|
+
Ot as getArrowStart,
|
|
2485
|
+
Ht as getAttachmentPointOnNode,
|
|
2486
|
+
He as getHandleId,
|
|
2487
|
+
$e as getTextBbox,
|
|
2488
|
+
ft as getTextPosition,
|
|
2489
|
+
ct as getTextSize,
|
|
2454
2490
|
ze as isAnnotationCollection,
|
|
2455
2491
|
ht as isArrow,
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2492
|
+
bt as isText,
|
|
2493
|
+
Re as setArrowEnd,
|
|
2494
|
+
wt as setArrowEndPoint,
|
|
2459
2495
|
Ne as setArrowStart,
|
|
2460
2496
|
zn as setTextBbox,
|
|
2461
|
-
|
|
2497
|
+
Mn as updateTextBbox
|
|
2462
2498
|
};
|
|
2463
2499
|
//# sourceMappingURL=index.mjs.map
|