@linkurious/ogma-annotations 1.1.19 → 1.1.22
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.js +21 -21
- package/dist/index.mjs +1317 -1381
- package/dist/types/index.d.ts +11 -1
- package/package.json +10 -7
- package/dist/style.css +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (a,
|
|
4
|
-
let
|
|
5
|
-
const
|
|
1
|
+
var Fn = Object.defineProperty;
|
|
2
|
+
var Rn = (a, l, t) => l in a ? Fn(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
|
|
3
|
+
var m = (a, l, t) => Rn(a, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
let Qt = (a = 21) => crypto.getRandomValues(new Uint8Array(a)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
|
|
5
|
+
const Nt = {
|
|
6
6
|
strokeType: "plain",
|
|
7
|
-
strokeColor: "
|
|
7
|
+
strokeColor: "#202020",
|
|
8
8
|
strokeWidth: 1,
|
|
9
9
|
head: "none",
|
|
10
10
|
tail: "none"
|
|
11
|
-
},
|
|
11
|
+
}, Oe = {
|
|
12
12
|
id: 0,
|
|
13
13
|
type: "Feature",
|
|
14
14
|
properties: {
|
|
15
15
|
type: "arrow",
|
|
16
16
|
style: {
|
|
17
|
-
...
|
|
17
|
+
...Nt
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
geometry: {
|
|
@@ -34,84 +34,84 @@ const zt = {
|
|
|
34
34
|
// tail: 'arrow-plain',
|
|
35
35
|
// start: { x: 0, y: 0 },
|
|
36
36
|
// end: { x: 100, y: 100 }
|
|
37
|
-
},
|
|
38
|
-
id:
|
|
37
|
+
}, qn = (a = 0, l = 0, t = 0, r = 0, s = { ...Nt }) => ({
|
|
38
|
+
id: Qt(),
|
|
39
39
|
type: "Feature",
|
|
40
40
|
properties: {
|
|
41
41
|
type: "arrow",
|
|
42
42
|
style: {
|
|
43
|
-
...
|
|
44
|
-
...
|
|
43
|
+
...Nt,
|
|
44
|
+
...s
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
geometry: {
|
|
48
48
|
type: "LineString",
|
|
49
49
|
coordinates: [
|
|
50
|
-
[a,
|
|
50
|
+
[a, l],
|
|
51
51
|
[t, r]
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
|
-
}),
|
|
55
|
-
function
|
|
56
|
-
return document.createElementNS(
|
|
54
|
+
}), Bn = "http://www.w3.org/2000/svg";
|
|
55
|
+
function xt(a) {
|
|
56
|
+
return document.createElementNS(Bn, a);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return a.geometry.bbox ||
|
|
58
|
+
function Ge(a) {
|
|
59
|
+
return a.geometry.bbox || jn(a), a.geometry.bbox;
|
|
60
60
|
}
|
|
61
61
|
function ut(a) {
|
|
62
|
-
const
|
|
62
|
+
const l = Ge(a);
|
|
63
63
|
return {
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
64
|
+
width: l[2] - l[0],
|
|
65
|
+
height: l[3] - l[1]
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function ct(a) {
|
|
69
|
-
const
|
|
70
|
-
return { x:
|
|
69
|
+
const l = Ge(a);
|
|
70
|
+
return { x: l[0], y: l[1] };
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const [
|
|
74
|
-
a.geometry.bbox = [
|
|
72
|
+
function jn(a) {
|
|
73
|
+
const [l, t] = a.geometry.coordinates[0][0], [r, s] = a.geometry.coordinates[0][2];
|
|
74
|
+
a.geometry.bbox = [l, t, r, s];
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
a.geometry.bbox = [
|
|
76
|
+
function Vn(a, l, t, r, s) {
|
|
77
|
+
a.geometry.bbox = [l, t, l + r, t + s], a.geometry.coordinates = [
|
|
78
78
|
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
79
|
+
[l, t],
|
|
80
|
+
[l + r, t],
|
|
81
|
+
[l + r, t + s],
|
|
82
|
+
[l, t + s],
|
|
83
|
+
[l, t]
|
|
84
84
|
]
|
|
85
85
|
];
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const [
|
|
89
|
-
return { x:
|
|
87
|
+
function zt(a) {
|
|
88
|
+
const [l, t] = a.geometry.coordinates[0];
|
|
89
|
+
return { x: l, y: t };
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const [t, r] = a.geometry.coordinates[
|
|
91
|
+
function Vt(a, l) {
|
|
92
|
+
const [t, r] = a.geometry.coordinates[l === "start" ? 0 : 1];
|
|
93
93
|
return { x: t, y: r };
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const [
|
|
97
|
-
return { x:
|
|
95
|
+
function Xt(a) {
|
|
96
|
+
const [l, t] = a.geometry.coordinates[1];
|
|
97
|
+
return { x: l, y: t };
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
a.geometry.coordinates[0] = [
|
|
99
|
+
function Ye(a, l, t) {
|
|
100
|
+
a.geometry.coordinates[0] = [l, t];
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
a.geometry.coordinates[1] = [
|
|
102
|
+
function Xe(a, l, t) {
|
|
103
|
+
a.geometry.coordinates[1] = [l, t];
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return { start:
|
|
105
|
+
function Zt(a) {
|
|
106
|
+
return { start: zt(a), end: Xt(a) };
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function kt(a, l, t, r) {
|
|
109
|
+
l === "start" ? Ye(a, t, r) : Xe(a, t, r);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
function
|
|
111
|
+
const Ze = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
|
|
112
|
+
function mr(a) {
|
|
113
113
|
return Gt(a).reduce(
|
|
114
|
-
(
|
|
114
|
+
(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),
|
|
115
115
|
[
|
|
116
116
|
Number.POSITIVE_INFINITY,
|
|
117
117
|
Number.POSITIVE_INFINITY,
|
|
@@ -120,223 +120,245 @@ function si(a) {
|
|
|
120
120
|
]
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Un(a) {
|
|
124
124
|
return Array.isArray(a) && a.length === 2 && a.every(isFinite);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
for (let
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
126
|
+
function Wn(a, l, t, r) {
|
|
127
|
+
for (let s = 0; s < a.coordinates.length; s++) {
|
|
128
|
+
const h = a.coordinates[s];
|
|
129
|
+
if (Un(h))
|
|
130
|
+
h[0] = t + (h[0] - t) * l, h[1] = r + (h[1] - r) * l;
|
|
131
131
|
else
|
|
132
|
-
for (let u = 0; u <
|
|
133
|
-
const d =
|
|
134
|
-
d[0] = t + (d[0] - t) *
|
|
132
|
+
for (let u = 0; u < h.length; u++) {
|
|
133
|
+
const d = h[u];
|
|
134
|
+
d[0] = t + (d[0] - t) * l, d[1] = r + (d[1] - r) * l;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
return a;
|
|
138
138
|
}
|
|
139
139
|
function Gt(a) {
|
|
140
|
-
let
|
|
141
|
-
return a.type == "Point" ?
|
|
140
|
+
let l = [];
|
|
141
|
+
return a.type == "Point" ? l = [a.coordinates] : a.type == "LineString" || a.type == "MultiPoint" ? l = a.coordinates : a.type == "Polygon" || a.type == "MultiLineString" ? l = a.coordinates.reduce(function(t, r) {
|
|
142
142
|
return t.concat(r);
|
|
143
|
-
}, []) : a.type == "MultiPolygon" ?
|
|
144
|
-
(t, r) => t.concat(r.reduce((
|
|
143
|
+
}, []) : a.type == "MultiPolygon" ? l = a.coordinates.reduce(
|
|
144
|
+
(t, r) => t.concat(r.reduce((s, h) => s.concat(h), [])),
|
|
145
145
|
[]
|
|
146
|
-
) : a.type == "Feature" ?
|
|
146
|
+
) : a.type == "Feature" ? l = Gt(a.geometry) : a.type == "GeometryCollection" ? l = a.geometries.reduce(
|
|
147
147
|
(t, r) => t.concat(Gt(r)),
|
|
148
148
|
[]
|
|
149
|
-
) : a.type == "FeatureCollection" && (
|
|
149
|
+
) : a.type == "FeatureCollection" && (l = a.features.reduce(
|
|
150
150
|
(t, r) => t.concat(Gt(r)),
|
|
151
151
|
[]
|
|
152
|
-
)),
|
|
152
|
+
)), l;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
const r = Math.atan2(a.y -
|
|
154
|
+
function Ut(a, l, t) {
|
|
155
|
+
const r = Math.atan2(a.y - l.y, a.x - l.x);
|
|
156
156
|
return {
|
|
157
|
-
x:
|
|
158
|
-
y:
|
|
157
|
+
x: l.x + t * Math.cos(r),
|
|
158
|
+
y: l.y + t * Math.sin(r)
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
if (!
|
|
163
|
-
|
|
164
|
-
const t = h.getBoundingClientRect();
|
|
161
|
+
function fe(a, l) {
|
|
162
|
+
if (!l) return { x: a.clientX, y: a.clientY };
|
|
163
|
+
const t = l.getBoundingClientRect();
|
|
165
164
|
return {
|
|
166
|
-
x: a.clientX - t.left -
|
|
167
|
-
y: a.clientY - t.top -
|
|
165
|
+
x: a.clientX - t.left - l.clientLeft,
|
|
166
|
+
y: a.clientY - t.top - l.clientTop
|
|
168
167
|
};
|
|
169
168
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
function Gn(a, l) {
|
|
170
|
+
return a.startsWith("#") ? Xn(a, l) : a.startsWith("rgb") ? Zn(a, l) : a;
|
|
171
|
+
}
|
|
172
|
+
function Yn(a) {
|
|
173
|
+
return a.length === 4 ? a.split("").map((l) => l + l).join("") : a;
|
|
174
|
+
}
|
|
175
|
+
function Xn(a, l) {
|
|
176
|
+
const [t, r, s] = Yn(a).match(/\w\w/g).map((h) => parseInt(h, 16));
|
|
177
|
+
return `rgba(${t}, ${r}, ${s}, ${l})`;
|
|
178
|
+
}
|
|
179
|
+
function Zn(a, l) {
|
|
180
|
+
const [t, r, s] = a.match(/\d+/g).map((h) => parseInt(h, 10));
|
|
181
|
+
return `rgba(${t}, ${r}, ${s}, ${l})`;
|
|
182
|
+
}
|
|
183
|
+
const wt = (a, l) => ({
|
|
184
|
+
x: a.x - l.x,
|
|
185
|
+
y: a.y - l.y
|
|
186
|
+
}), Tt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), Ke = (a) => ({
|
|
174
187
|
x: -a.x,
|
|
175
188
|
y: -a.y
|
|
176
|
-
}),
|
|
177
|
-
const
|
|
178
|
-
return
|
|
179
|
-
x: a.x /
|
|
180
|
-
y: a.y /
|
|
189
|
+
}), Je = (a) => {
|
|
190
|
+
const l = Tt(a);
|
|
191
|
+
return l === 0 ? { x: 0, y: 0 } : {
|
|
192
|
+
x: a.x / l,
|
|
193
|
+
y: a.y / l
|
|
181
194
|
};
|
|
182
|
-
},
|
|
183
|
-
x: a.x +
|
|
184
|
-
y: a.y +
|
|
185
|
-
}),
|
|
186
|
-
x: a.x *
|
|
187
|
-
y: a.y *
|
|
188
|
-
}),
|
|
189
|
-
x: a.x *
|
|
190
|
-
y: a.y *
|
|
191
|
-
}), rt = (a,
|
|
192
|
-
const t = Math.sin(
|
|
195
|
+
}, St = (a, l) => ({
|
|
196
|
+
x: a.x + l.x,
|
|
197
|
+
y: a.y + l.y
|
|
198
|
+
}), Qe = (a, l) => ({
|
|
199
|
+
x: a.x * l,
|
|
200
|
+
y: a.y * l
|
|
201
|
+
}), Wt = (a, l) => ({
|
|
202
|
+
x: a.x * l.x,
|
|
203
|
+
y: a.y * l.y
|
|
204
|
+
}), rt = (a, l) => {
|
|
205
|
+
const t = Math.sin(l), r = Math.cos(l);
|
|
193
206
|
return {
|
|
194
207
|
x: a.x * r - a.y * t,
|
|
195
208
|
y: a.x * t + a.y * r
|
|
196
209
|
};
|
|
197
|
-
},
|
|
198
|
-
x: a.x /
|
|
199
|
-
y: a.y /
|
|
200
|
-
}),
|
|
201
|
-
function
|
|
210
|
+
}, Kn = (a, l) => ({
|
|
211
|
+
x: a.x / l,
|
|
212
|
+
y: a.y / l
|
|
213
|
+
}), Le = (a, l) => a.x * l.x + a.y * l.y, Jn = 0.5;
|
|
214
|
+
function tn(a, l = 5, t = 30) {
|
|
202
215
|
var d;
|
|
203
|
-
const { start: r, end:
|
|
204
|
-
return Math.min(t, Math.max(3 * u,
|
|
216
|
+
const { start: r, end: s } = Zt(a), h = wt(s, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
|
|
217
|
+
return Math.min(t, Math.max(3 * u, Tt(h) * 0.01, l));
|
|
205
218
|
}
|
|
206
|
-
function
|
|
207
|
-
const
|
|
208
|
-
if (!t || t
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return `M ${l.x} ${l.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${l.x} ${l.y}`}`;
|
|
219
|
+
function Ce(a, l, t, r) {
|
|
220
|
+
const s = Qe(Ke(Je(l)), r);
|
|
221
|
+
if (!t || t !== "arrow" && t !== "arrow-plain") return "";
|
|
222
|
+
const h = St(a, rt(s, Math.PI / 10)), u = St(a, rt(s, -Math.PI / 10)), d = `${a.x} ${a.y}`;
|
|
223
|
+
return `M ${h.x} ${h.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
|
|
212
224
|
}
|
|
213
|
-
function
|
|
214
|
-
const { start:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
function Qn(a, l, t, r, s) {
|
|
226
|
+
const { start: h, end: u } = Zt(a), {
|
|
227
|
+
tail: d,
|
|
228
|
+
head: g,
|
|
229
|
+
strokeColor: f,
|
|
230
|
+
strokeWidth: y = 0
|
|
231
|
+
} = a.properties.style || t, v = wt(u, h), k = tn(a, r, s), b = xt("g"), w = xt("path");
|
|
232
|
+
b.setAttribute("data-annotation", `${a.id}`), b.setAttribute("data-annotation-type", "arrow");
|
|
233
|
+
const $ = g === "arrow-plain" || d === "arrow", E = f || "none";
|
|
234
|
+
w.setAttribute("stroke", E), w.setAttribute("stroke-width", `${y}`), w.setAttribute("fill", $ ? f || "" : "none"), w.setAttribute("stroke-linecap", "round"), w.setAttribute("stroke-linejoin", "round");
|
|
235
|
+
const C = Ce(h, Ke(v), d, k), N = Ce(u, v, g, k), D = C + `M ${h.x} ${h.y} ${u.x} ${u.y}` + N;
|
|
236
|
+
w.setAttribute("d", D), b.appendChild(w), $e(b, h, E, d, y), $e(b, u, E, g, y), l.appendChild(b);
|
|
220
237
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
238
|
+
function $e(a, l, t, r, s) {
|
|
239
|
+
r === "halo-dot" && Pe(a, l, tr(t), s * 4), (r === "dot" || r === "halo-dot") && Pe(a, l, t, s * 2);
|
|
240
|
+
}
|
|
241
|
+
function tr(a) {
|
|
242
|
+
return a === "none" ? "none" : Gn(a, Jn);
|
|
243
|
+
}
|
|
244
|
+
function Pe(a, l, t, r) {
|
|
245
|
+
const s = xt("circle");
|
|
246
|
+
s.setAttribute("cx", `${l.x}`), s.setAttribute("cy", `${l.y}`), s.setAttribute("r", `${r}`), s.setAttribute("fill", t), a.appendChild(s);
|
|
247
|
+
}
|
|
248
|
+
const W = -1, Kt = "dragging", Jt = "dragstart", It = "dragend", pe = "select", ge = "unselect", er = "hover", nr = "unhover", ye = "remove", me = "add", rr = "cancelDrawing", ve = "update", ir = "link";
|
|
249
|
+
function en(a) {
|
|
224
250
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
225
251
|
}
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return f;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return [];
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var E = this._events[C], $ = arguments.length, N, _;
|
|
271
|
-
if (E.fn) {
|
|
272
|
-
switch (E.once && this.removeListener(f, E.fn, void 0, !0), $) {
|
|
273
|
-
case 1:
|
|
274
|
-
return E.fn.call(E.context), !0;
|
|
275
|
-
case 2:
|
|
276
|
-
return E.fn.call(E.context, y), !0;
|
|
277
|
-
case 3:
|
|
278
|
-
return E.fn.call(E.context, y, v), !0;
|
|
279
|
-
case 4:
|
|
280
|
-
return E.fn.call(E.context, y, v, T), !0;
|
|
281
|
-
case 5:
|
|
282
|
-
return E.fn.call(E.context, y, v, T, A), !0;
|
|
283
|
-
case 6:
|
|
284
|
-
return E.fn.call(E.context, y, v, T, A, b), !0;
|
|
285
|
-
}
|
|
286
|
-
for (_ = 1, N = new Array($ - 1); _ < $; _++)
|
|
287
|
-
N[_ - 1] = arguments[_];
|
|
288
|
-
E.fn.apply(E.context, N);
|
|
289
|
-
} else {
|
|
290
|
-
var G = E.length, W;
|
|
291
|
-
for (_ = 0; _ < G; _++)
|
|
292
|
-
switch (E[_].once && this.removeListener(f, E[_].fn, void 0, !0), $) {
|
|
252
|
+
var he = { exports: {} }, ze;
|
|
253
|
+
function sr() {
|
|
254
|
+
return ze || (ze = 1, function(a) {
|
|
255
|
+
var l = Object.prototype.hasOwnProperty, t = "~";
|
|
256
|
+
function r() {
|
|
257
|
+
}
|
|
258
|
+
Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
|
|
259
|
+
function s(g, f, y) {
|
|
260
|
+
this.fn = g, this.context = f, this.once = y || !1;
|
|
261
|
+
}
|
|
262
|
+
function h(g, f, y, v, k) {
|
|
263
|
+
if (typeof y != "function")
|
|
264
|
+
throw new TypeError("The listener must be a function");
|
|
265
|
+
var b = new s(y, v || g, k), w = t ? t + f : f;
|
|
266
|
+
return g._events[w] ? g._events[w].fn ? g._events[w] = [g._events[w], b] : g._events[w].push(b) : (g._events[w] = b, g._eventsCount++), g;
|
|
267
|
+
}
|
|
268
|
+
function u(g, f) {
|
|
269
|
+
--g._eventsCount === 0 ? g._events = new r() : delete g._events[f];
|
|
270
|
+
}
|
|
271
|
+
function d() {
|
|
272
|
+
this._events = new r(), this._eventsCount = 0;
|
|
273
|
+
}
|
|
274
|
+
d.prototype.eventNames = function() {
|
|
275
|
+
var f = [], y, v;
|
|
276
|
+
if (this._eventsCount === 0) return f;
|
|
277
|
+
for (v in y = this._events)
|
|
278
|
+
l.call(y, v) && f.push(t ? v.slice(1) : v);
|
|
279
|
+
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(y)) : f;
|
|
280
|
+
}, d.prototype.listeners = function(f) {
|
|
281
|
+
var y = t ? t + f : f, v = this._events[y];
|
|
282
|
+
if (!v) return [];
|
|
283
|
+
if (v.fn) return [v.fn];
|
|
284
|
+
for (var k = 0, b = v.length, w = new Array(b); k < b; k++)
|
|
285
|
+
w[k] = v[k].fn;
|
|
286
|
+
return w;
|
|
287
|
+
}, d.prototype.listenerCount = function(f) {
|
|
288
|
+
var y = t ? t + f : f, v = this._events[y];
|
|
289
|
+
return v ? v.fn ? 1 : v.length : 0;
|
|
290
|
+
}, d.prototype.emit = function(f, y, v, k, b, w) {
|
|
291
|
+
var $ = t ? t + f : f;
|
|
292
|
+
if (!this._events[$]) return !1;
|
|
293
|
+
var E = this._events[$], C = arguments.length, N, D;
|
|
294
|
+
if (E.fn) {
|
|
295
|
+
switch (E.once && this.removeListener(f, E.fn, void 0, !0), C) {
|
|
293
296
|
case 1:
|
|
294
|
-
E
|
|
295
|
-
break;
|
|
297
|
+
return E.fn.call(E.context), !0;
|
|
296
298
|
case 2:
|
|
297
|
-
E
|
|
298
|
-
break;
|
|
299
|
+
return E.fn.call(E.context, y), !0;
|
|
299
300
|
case 3:
|
|
300
|
-
E
|
|
301
|
-
break;
|
|
301
|
+
return E.fn.call(E.context, y, v), !0;
|
|
302
302
|
case 4:
|
|
303
|
-
E
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
N[W - 1] = arguments[W];
|
|
309
|
-
E[_].fn.apply(E[_].context, N);
|
|
303
|
+
return E.fn.call(E.context, y, v, k), !0;
|
|
304
|
+
case 5:
|
|
305
|
+
return E.fn.call(E.context, y, v, k, b), !0;
|
|
306
|
+
case 6:
|
|
307
|
+
return E.fn.call(E.context, y, v, k, b, w), !0;
|
|
310
308
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
309
|
+
for (D = 1, N = new Array(C - 1); D < C; D++)
|
|
310
|
+
N[D - 1] = arguments[D];
|
|
311
|
+
E.fn.apply(E.context, N);
|
|
312
|
+
} else {
|
|
313
|
+
var z = E.length, R;
|
|
314
|
+
for (D = 0; D < z; D++)
|
|
315
|
+
switch (E[D].once && this.removeListener(f, E[D].fn, void 0, !0), C) {
|
|
316
|
+
case 1:
|
|
317
|
+
E[D].fn.call(E[D].context);
|
|
318
|
+
break;
|
|
319
|
+
case 2:
|
|
320
|
+
E[D].fn.call(E[D].context, y);
|
|
321
|
+
break;
|
|
322
|
+
case 3:
|
|
323
|
+
E[D].fn.call(E[D].context, y, v);
|
|
324
|
+
break;
|
|
325
|
+
case 4:
|
|
326
|
+
E[D].fn.call(E[D].context, y, v, k);
|
|
327
|
+
break;
|
|
328
|
+
default:
|
|
329
|
+
if (!N) for (R = 1, N = new Array(C - 1); R < C; R++)
|
|
330
|
+
N[R - 1] = arguments[R];
|
|
331
|
+
E[D].fn.apply(E[D].context, N);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return !0;
|
|
335
|
+
}, d.prototype.on = function(f, y, v) {
|
|
336
|
+
return h(this, f, y, v, !1);
|
|
337
|
+
}, d.prototype.once = function(f, y, v) {
|
|
338
|
+
return h(this, f, y, v, !0);
|
|
339
|
+
}, d.prototype.removeListener = function(f, y, v, k) {
|
|
340
|
+
var b = t ? t + f : f;
|
|
341
|
+
if (!this._events[b]) return this;
|
|
342
|
+
if (!y)
|
|
343
|
+
return u(this, b), this;
|
|
344
|
+
var w = this._events[b];
|
|
345
|
+
if (w.fn)
|
|
346
|
+
w.fn === y && (!k || w.once) && (!v || w.context === v) && u(this, b);
|
|
347
|
+
else {
|
|
348
|
+
for (var $ = 0, E = [], C = w.length; $ < C; $++)
|
|
349
|
+
(w[$].fn !== y || k && !w[$].once || v && w[$].context !== v) && E.push(w[$]);
|
|
350
|
+
E.length ? this._events[b] = E.length === 1 ? E[0] : E : u(this, b);
|
|
351
|
+
}
|
|
320
352
|
return this;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
return this;
|
|
332
|
-
}, d.prototype.removeAllListeners = function(f) {
|
|
333
|
-
var y;
|
|
334
|
-
return f ? (y = t ? t + f : f, this._events[y] && u(this, y)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
335
|
-
}, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
|
|
336
|
-
})(Ze);
|
|
337
|
-
var Zn = Ze.exports;
|
|
338
|
-
const Ke = /* @__PURE__ */ Xe(Zn);
|
|
339
|
-
class Je extends Ke {
|
|
353
|
+
}, d.prototype.removeAllListeners = function(f) {
|
|
354
|
+
var y;
|
|
355
|
+
return f ? (y = t ? t + f : f, this._events[y] && u(this, y)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
356
|
+
}, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
|
|
357
|
+
}(he)), he.exports;
|
|
358
|
+
}
|
|
359
|
+
var or = sr();
|
|
360
|
+
const nn = /* @__PURE__ */ en(or);
|
|
361
|
+
class rn extends nn {
|
|
340
362
|
constructor(t, r) {
|
|
341
363
|
super();
|
|
342
364
|
m(this, "ogma");
|
|
@@ -344,26 +366,26 @@ class Je extends Ke {
|
|
|
344
366
|
// layer to draw elements
|
|
345
367
|
m(this, "layer");
|
|
346
368
|
m(this, "editor");
|
|
347
|
-
m(this, "selectedId",
|
|
348
|
-
m(this, "hoveredId",
|
|
369
|
+
m(this, "selectedId", W);
|
|
370
|
+
m(this, "hoveredId", W);
|
|
349
371
|
// used to remember ogma options before we change them
|
|
350
372
|
m(this, "ogmaOptions");
|
|
351
373
|
m(this, "shouldDetect");
|
|
352
374
|
m(this, "isDragging");
|
|
353
375
|
m(this, "showeditorOnHover");
|
|
354
376
|
m(this, "_onKeyUp", (t) => {
|
|
355
|
-
t.code === 27 && this.selectedId !==
|
|
377
|
+
t.code === 27 && this.selectedId !== W ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== W && this._canRemove() && this.remove(this.selectedId);
|
|
356
378
|
});
|
|
357
379
|
m(this, "_onClickMouseMove", (t) => {
|
|
358
380
|
if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target && t.domEvent.target.tagName === "a")
|
|
359
381
|
return;
|
|
360
|
-
const r = this.ogma.view.screenToGraphCoordinates(t),
|
|
361
|
-
t.domEvent.type === "mousemove" ?
|
|
382
|
+
const r = this.ogma.view.screenToGraphCoordinates(t), s = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
|
|
383
|
+
t.domEvent.type === "mousemove" ? s ? this.hover(s.id) : this.hoveredId !== W && this.unhover() : s ? this.select(s.id) : this.selectedId !== W && this.unselect();
|
|
362
384
|
});
|
|
363
385
|
this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
|
|
364
386
|
this.refreshEditor(), this.refreshDrawing();
|
|
365
387
|
}), this.layer = t.layers.addSVGLayer({
|
|
366
|
-
draw: (
|
|
388
|
+
draw: (s) => this.draw(s)
|
|
367
389
|
}), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
|
|
368
390
|
}
|
|
369
391
|
_canRemove() {
|
|
@@ -375,8 +397,8 @@ class Je extends Ke {
|
|
|
375
397
|
* @returns the added annotation
|
|
376
398
|
*/
|
|
377
399
|
add(t) {
|
|
378
|
-
const r = this.getDefaultOptions(),
|
|
379
|
-
id: t.id === void 0 ?
|
|
400
|
+
const r = this.getDefaultOptions(), s = Object.assign(t, {
|
|
401
|
+
id: t.id === void 0 ? Qt() : t.id,
|
|
380
402
|
type: t.type,
|
|
381
403
|
properties: {
|
|
382
404
|
...r.properties,
|
|
@@ -389,7 +411,7 @@ class Je extends Ke {
|
|
|
389
411
|
...t.geometry
|
|
390
412
|
}
|
|
391
413
|
});
|
|
392
|
-
return this.elements.push(
|
|
414
|
+
return this.elements.push(s), this.layer.refresh(), this.emit(me, s), s;
|
|
393
415
|
}
|
|
394
416
|
updateStyle(t, r) {
|
|
395
417
|
this.updateAnnotation(t, {
|
|
@@ -403,10 +425,10 @@ class Je extends Ke {
|
|
|
403
425
|
geometry: r
|
|
404
426
|
});
|
|
405
427
|
}
|
|
406
|
-
scale(t, r,
|
|
428
|
+
scale(t, r, s, h) {
|
|
407
429
|
this.updateGeometry(
|
|
408
430
|
t,
|
|
409
|
-
|
|
431
|
+
Wn(t.geometry, r, s, h)
|
|
410
432
|
);
|
|
411
433
|
}
|
|
412
434
|
/**
|
|
@@ -416,16 +438,15 @@ class Je extends Ke {
|
|
|
416
438
|
* @param element params of the annotation
|
|
417
439
|
*/
|
|
418
440
|
update(t, r) {
|
|
419
|
-
const
|
|
420
|
-
this.updateAnnotation(
|
|
441
|
+
const s = this.getById(t);
|
|
442
|
+
this.updateAnnotation(s, r);
|
|
421
443
|
}
|
|
422
444
|
updateAnnotation(t, r) {
|
|
423
|
-
if (!t)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
if (l === "properties") {
|
|
445
|
+
if (!t) return;
|
|
446
|
+
const s = t.id;
|
|
447
|
+
Object.keys(r).forEach((h) => {
|
|
448
|
+
if (h !== "id")
|
|
449
|
+
if (h === "properties") {
|
|
429
450
|
const u = r.properties || { style: {} };
|
|
430
451
|
t.properties = {
|
|
431
452
|
...t.properties || {},
|
|
@@ -435,19 +456,18 @@ class Je extends Ke {
|
|
|
435
456
|
...u.style || {}
|
|
436
457
|
}
|
|
437
458
|
};
|
|
438
|
-
} else
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}), o === this.selectedId && this.refreshEditor(), this.layer.refresh();
|
|
459
|
+
} else h === "geometry" ? t.geometry = {
|
|
460
|
+
...t.geometry,
|
|
461
|
+
...r.geometry
|
|
462
|
+
} : t[h] = r[h];
|
|
463
|
+
}), s === this.selectedId && this.refreshEditor(), this.layer.refresh();
|
|
444
464
|
}
|
|
445
465
|
getById(t) {
|
|
446
466
|
const r = Number(t);
|
|
447
|
-
for (let
|
|
448
|
-
const
|
|
449
|
-
if (!(
|
|
450
|
-
return
|
|
467
|
+
for (let s = 0; s < this.elements.length; s++) {
|
|
468
|
+
const h = this.elements[s];
|
|
469
|
+
if (!(h.id !== t && h.id !== r))
|
|
470
|
+
return h;
|
|
451
471
|
}
|
|
452
472
|
}
|
|
453
473
|
/**
|
|
@@ -457,22 +477,22 @@ class Je extends Ke {
|
|
|
457
477
|
*/
|
|
458
478
|
select(t) {
|
|
459
479
|
const r = this.getById(t);
|
|
460
|
-
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
480
|
+
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(pe, r));
|
|
461
481
|
}
|
|
462
482
|
hover(t) {
|
|
463
483
|
const r = this.getById(t);
|
|
464
|
-
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
484
|
+
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(er, r));
|
|
465
485
|
}
|
|
466
486
|
getSelectedFeature() {
|
|
467
|
-
return this.selectedId ===
|
|
487
|
+
return this.selectedId === W ? null : this.getById(this.selectedId);
|
|
468
488
|
}
|
|
469
489
|
unselect() {
|
|
470
490
|
const t = this.getById(this.selectedId);
|
|
471
|
-
return t && this.emit(
|
|
491
|
+
return t && this.emit(ge, t), this.selectedId = W, this.hoveredId === W && this.editor.hide(), this.layer.refresh(), this;
|
|
472
492
|
}
|
|
473
493
|
unhover() {
|
|
474
494
|
const t = this.getById(this.hoveredId);
|
|
475
|
-
return this.emit(
|
|
495
|
+
return this.emit(nr, t), this.hoveredId = W, this.selectedId === W && this.editor.hide(), this.layer.refresh(), this;
|
|
476
496
|
}
|
|
477
497
|
/**
|
|
478
498
|
* @method remove
|
|
@@ -481,7 +501,7 @@ class Je extends Ke {
|
|
|
481
501
|
*/
|
|
482
502
|
remove(t) {
|
|
483
503
|
const r = this.getById(t);
|
|
484
|
-
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((
|
|
504
|
+
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((s) => s.id !== t), r && this.emit(ye, r), this.layer.refresh();
|
|
485
505
|
}
|
|
486
506
|
/**
|
|
487
507
|
* @method disableDragging
|
|
@@ -531,24 +551,24 @@ class Je extends Ke {
|
|
|
531
551
|
this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
|
|
532
552
|
}
|
|
533
553
|
}
|
|
534
|
-
const
|
|
535
|
-
class
|
|
554
|
+
const Ne = "handle-line", He = "handle-start", Fe = "handle-end";
|
|
555
|
+
class ar extends rn {
|
|
536
556
|
constructor(t, r = {}) {
|
|
537
557
|
super(
|
|
538
558
|
t,
|
|
539
559
|
`
|
|
540
560
|
<div class="arrow-handle">
|
|
541
|
-
<div id="${
|
|
542
|
-
<div id="${
|
|
543
|
-
<div id="${
|
|
561
|
+
<div id="${Ne}" data-handle-id="0" class="handle line"></div>
|
|
562
|
+
<div id="${He}" data-handle-id="1" class="handle point"></div>
|
|
563
|
+
<div id="${Fe}" data-handle-id="2" class="handle point"></div>
|
|
544
564
|
</div>
|
|
545
565
|
`
|
|
546
566
|
);
|
|
547
567
|
// active handle id
|
|
548
|
-
m(this, "draggedHandle",
|
|
568
|
+
m(this, "draggedHandle", W);
|
|
549
569
|
m(this, "start", { x: 0, y: 0 });
|
|
550
570
|
m(this, "end", { x: 0, y: 0 });
|
|
551
|
-
m(this, "arrow", { ...
|
|
571
|
+
m(this, "arrow", { ...Oe });
|
|
552
572
|
m(this, "startX", 0);
|
|
553
573
|
m(this, "startY", 0);
|
|
554
574
|
m(this, "minArrowHeight", 0);
|
|
@@ -556,26 +576,24 @@ class Kn extends Je {
|
|
|
556
576
|
m(this, "handles", []);
|
|
557
577
|
m(this, "onHandleMouseDown", (t) => {
|
|
558
578
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
559
|
-
if (!r)
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
this.startDragging(r, o, l), this.draggedHandle = Ve(t.target);
|
|
579
|
+
if (!r) return;
|
|
580
|
+
const { x: s, y: h } = fe(t, this.ogma.getContainer());
|
|
581
|
+
this.startDragging(r, s, h), this.draggedHandle = Ze(t.target);
|
|
563
582
|
});
|
|
564
583
|
m(this, "onMouseUp", () => {
|
|
565
|
-
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle =
|
|
584
|
+
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W, this.emit(It, this.arrow));
|
|
566
585
|
});
|
|
567
586
|
m(this, "onMouseMove", (t) => {
|
|
568
|
-
if (!this.isDragging || this.draggedHandle ===
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
Rn(
|
|
587
|
+
if (!this.isDragging || this.draggedHandle === W) return;
|
|
588
|
+
const r = this.handles[this.draggedHandle], s = this.ogma.view.getAngle(), { x: h, y: u } = rt(
|
|
589
|
+
Kn(
|
|
572
590
|
{ x: t.x - this.startX, y: t.y - this.startY },
|
|
573
591
|
this.ogma.view.getZoom()
|
|
574
592
|
),
|
|
575
|
-
|
|
576
|
-
), d = r.id ===
|
|
577
|
-
(d || g) &&
|
|
578
|
-
|
|
593
|
+
s
|
|
594
|
+
), d = r.id === Ne, g = r.id === He, f = r.id === Fe;
|
|
595
|
+
(d || g) && Ye(this.arrow, this.start.x + h, this.start.y + u), (d || f) && Xe(this.arrow, this.end.x + h, this.end.y + u), this.emit(
|
|
596
|
+
Kt,
|
|
579
597
|
this.arrow,
|
|
580
598
|
d ? "line" : g ? "start" : "end"
|
|
581
599
|
), this.refreshEditor(), this.layer.refresh();
|
|
@@ -583,7 +601,7 @@ class Kn extends Je {
|
|
|
583
601
|
this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
584
602
|
this.editor.element.querySelectorAll(".arrow-handle>.handle")
|
|
585
603
|
), this.handles.forEach(
|
|
586
|
-
(
|
|
604
|
+
(s) => s.addEventListener("mousedown", this.onHandleMouseDown)
|
|
587
605
|
), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
|
|
588
606
|
}
|
|
589
607
|
/**
|
|
@@ -592,60 +610,59 @@ class Kn extends Je {
|
|
|
592
610
|
* @param y
|
|
593
611
|
* @param arrow
|
|
594
612
|
*/
|
|
595
|
-
startDrawing(t, r,
|
|
613
|
+
startDrawing(t, r, s = qn(t, r, t, r, Nt)) {
|
|
596
614
|
var d;
|
|
597
|
-
this.disableDragging(), this.add(
|
|
598
|
-
const
|
|
615
|
+
this.disableDragging(), this.add(s), this.hoveredId = s.id;
|
|
616
|
+
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
|
|
599
617
|
left: 0,
|
|
600
618
|
top: 0
|
|
601
619
|
};
|
|
602
620
|
this.startDragging(
|
|
603
|
-
this.getById(
|
|
604
|
-
|
|
605
|
-
|
|
621
|
+
this.getById(s.id),
|
|
622
|
+
h.x + (u == null ? void 0 : u.left),
|
|
623
|
+
h.y + u.top
|
|
606
624
|
), this.draggedHandle = 2;
|
|
607
625
|
}
|
|
608
626
|
cancelDrawing() {
|
|
609
|
-
this.isDragging && (this.remove(this.arrow.id), this.emit(
|
|
627
|
+
this.isDragging && (this.remove(this.arrow.id), this.emit(It, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W);
|
|
610
628
|
}
|
|
611
|
-
startDragging(t, r,
|
|
612
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY =
|
|
629
|
+
startDragging(t, r, s) {
|
|
630
|
+
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = s, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(Jt, this.arrow), this.isDragging = !0;
|
|
613
631
|
}
|
|
614
632
|
detect(t, r = 0) {
|
|
615
|
-
return this.elements.find((
|
|
616
|
-
const { start:
|
|
617
|
-
x: (
|
|
618
|
-
y: (
|
|
619
|
-
}), g =
|
|
620
|
-
return Math.abs(
|
|
633
|
+
return this.elements.find((s) => {
|
|
634
|
+
const { start: h, end: u } = Zt(s), d = wt(t, {
|
|
635
|
+
x: (h.x + u.x) / 2,
|
|
636
|
+
y: (h.y + u.y) / 2
|
|
637
|
+
}), g = wt(u, h), f = Tt(g), y = Je(g), v = tn(s);
|
|
638
|
+
return Math.abs(Le(y, d)) < f / 2 + r && Math.abs(Le(rt(y, Math.PI / 2), d)) < v / 2 + r;
|
|
621
639
|
});
|
|
622
640
|
}
|
|
623
641
|
refreshEditor() {
|
|
624
|
-
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
625
|
-
|
|
626
|
-
const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Yt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), l = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
|
|
642
|
+
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
643
|
+
const t = this.selectedId !== W ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Zt(t), s = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
|
|
627
644
|
this.editor.element.querySelectorAll(".handle")
|
|
628
645
|
);
|
|
629
|
-
d.style.transform = `translate(${
|
|
646
|
+
d.style.transform = `translate(${s.x}px, ${s.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%)`;
|
|
630
647
|
const f = {
|
|
631
|
-
x: (
|
|
632
|
-
y: (
|
|
633
|
-
}, y =
|
|
634
|
-
u.style.width = `${
|
|
648
|
+
x: (h.x + s.x) / 2,
|
|
649
|
+
y: (h.y + s.y) / 2
|
|
650
|
+
}, y = wt(h, s), v = Qe(y, 1 / Tt(y)), k = Math.atan2(v.y, v.x);
|
|
651
|
+
u.style.width = `${Tt(y)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${k}rad)`;
|
|
635
652
|
}
|
|
636
653
|
getDefaultOptions() {
|
|
637
|
-
return
|
|
654
|
+
return Oe;
|
|
638
655
|
}
|
|
639
656
|
draw(t) {
|
|
640
657
|
t.innerHTML = "";
|
|
641
|
-
const r =
|
|
642
|
-
r.setAttribute("transform", `rotate(${-
|
|
643
|
-
(
|
|
658
|
+
const r = xt("g"), s = this.ogma.view.getAngle();
|
|
659
|
+
s !== 0 && r.setAttribute("transform", `rotate(${-s * (180 / Math.PI)})`), this.elements.forEach(
|
|
660
|
+
(h) => Qn(h, r, Nt, this.minArrowHeight, this.maxArrowHeight)
|
|
644
661
|
), t.appendChild(r);
|
|
645
662
|
}
|
|
646
663
|
refreshDrawing() {
|
|
647
664
|
const t = this.ogma.view.getAngle();
|
|
648
|
-
this.layer.element !== null && this.layer.element.children[0].setAttribute(
|
|
665
|
+
this.layer.element !== null && t !== 0 && this.layer.element.children[0].setAttribute(
|
|
649
666
|
"transform",
|
|
650
667
|
`rotate(${-t * (180 / Math.PI)})`
|
|
651
668
|
);
|
|
@@ -654,21 +671,22 @@ class Kn extends Je {
|
|
|
654
671
|
super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
|
|
655
672
|
}
|
|
656
673
|
}
|
|
657
|
-
const
|
|
674
|
+
const _t = {
|
|
658
675
|
font: "sans-serif",
|
|
659
|
-
fontSize:
|
|
660
|
-
color: "
|
|
661
|
-
background: "",
|
|
662
|
-
strokeWidth:
|
|
663
|
-
|
|
676
|
+
fontSize: 18,
|
|
677
|
+
color: "#505050",
|
|
678
|
+
background: "#f5f5f5",
|
|
679
|
+
strokeWidth: 0,
|
|
680
|
+
borderRadius: 8,
|
|
681
|
+
padding: 16,
|
|
664
682
|
strokeType: "plain"
|
|
665
|
-
},
|
|
683
|
+
}, ce = {
|
|
666
684
|
id: 0,
|
|
667
685
|
type: "Feature",
|
|
668
686
|
properties: {
|
|
669
687
|
type: "text",
|
|
670
688
|
content: "",
|
|
671
|
-
style: { ...
|
|
689
|
+
style: { ..._t }
|
|
672
690
|
},
|
|
673
691
|
geometry: {
|
|
674
692
|
type: "Polygon",
|
|
@@ -684,855 +702,776 @@ const St = {
|
|
|
684
702
|
}
|
|
685
703
|
// position: { x: 0, y: 0 },
|
|
686
704
|
// size: { width: 100, height: 50 }
|
|
687
|
-
},
|
|
705
|
+
}, Re = {
|
|
688
706
|
handleSize: 3.5,
|
|
689
707
|
placeholder: "Your text..."
|
|
690
|
-
},
|
|
691
|
-
id:
|
|
708
|
+
}, lr = (a = 0, l = 0, t = 100, r = 50, s = "", h = { ..._t }) => ({
|
|
709
|
+
id: Qt(),
|
|
692
710
|
type: "Feature",
|
|
693
711
|
properties: {
|
|
694
712
|
type: "text",
|
|
695
|
-
content:
|
|
696
|
-
style: { ...
|
|
713
|
+
content: s,
|
|
714
|
+
style: { ..._t, ...h }
|
|
697
715
|
},
|
|
698
716
|
geometry: {
|
|
699
717
|
type: "Polygon",
|
|
700
718
|
coordinates: [
|
|
701
719
|
[
|
|
702
|
-
[a,
|
|
703
|
-
[a + t,
|
|
704
|
-
[a + t,
|
|
705
|
-
[a,
|
|
706
|
-
[a,
|
|
720
|
+
[a, l],
|
|
721
|
+
[a + t, l],
|
|
722
|
+
[a + t, l + r],
|
|
723
|
+
[a, l + r],
|
|
724
|
+
[a, l]
|
|
707
725
|
]
|
|
708
726
|
]
|
|
709
727
|
}
|
|
710
728
|
});
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
(function(
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
t.o(n,
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
t.d(r, { default: () => Cn });
|
|
728
|
-
var l = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, u = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/, g = /\bbold(?:er)?\b/, f = 13.3333333, y = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
729
|
-
function v(e) {
|
|
730
|
-
var n = "", s = this;
|
|
731
|
-
return s.style && s.style !== "normal" && (n += s.style), s.variant && s.variant !== "normal" && (n += (n ? " " : "") + s.variant), s.weight && s.weight !== "normal" && (n += (n ? " " : "") + s.weight), s.size && (n += (n ? " " : "") + s.size + "px", s.height !== s.size && (n += "/" + s.height + "px")), s.family && (n += (n ? " " : "") + s.family), e && (n += "::" + s.baseline), e && (n += "::" + s.color), n;
|
|
732
|
-
}
|
|
733
|
-
var T = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
|
|
734
|
-
function A(e) {
|
|
735
|
-
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = l.exec(e);
|
|
736
|
-
n.family = (s[6] || "").trim();
|
|
737
|
-
var i = y[s[2]] || parseFloat(s[2]);
|
|
738
|
-
s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
|
|
739
|
-
var c = parseFloat(s[4]);
|
|
740
|
-
if (c !== "normal" && c !== "inherit" && c ? s[5] && s[5] !== "em" ? s[5] === "pt" ? n.height = c * f : s[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(s[1]) && (n.variant = "small-caps"), d.test(s[1]) && (n.style = "italic"), g.test(s[1]))
|
|
741
|
-
n.weight = "bold";
|
|
742
|
-
else {
|
|
743
|
-
var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
|
|
744
|
-
p >= 100 && p !== 400 && (n.weight = p);
|
|
729
|
+
var Yt = { exports: {} }, hr = Yt.exports, qe;
|
|
730
|
+
function cr() {
|
|
731
|
+
return qe || (qe = 1, function(a, l) {
|
|
732
|
+
(function(t, r) {
|
|
733
|
+
a.exports = r();
|
|
734
|
+
})(hr, () => (() => {
|
|
735
|
+
var t = { d: (e, n) => {
|
|
736
|
+
for (var o in n) t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
|
|
737
|
+
}, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
|
|
738
|
+
function s(e) {
|
|
739
|
+
return s = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
740
|
+
return typeof n;
|
|
741
|
+
} : function(n) {
|
|
742
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
743
|
+
}, s(e);
|
|
745
744
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
|
|
752
|
-
e = O.getPropertyValue("font-family") || "", w = parseFloat(O.getPropertyValue("font-size")), p = O.getPropertyValue("line-height"), x = O.getPropertyValue("font-weight"), k = O.getPropertyValue("font-style"), S = O.getPropertyValue("font-variant") || "";
|
|
753
|
-
} else if (typeof i == "string") {
|
|
754
|
-
var I = A(i);
|
|
755
|
-
e = I.family, w = I.size, p = I.height, S = I.variant, k = I.style, x = I.weight;
|
|
756
|
-
} else
|
|
757
|
-
o(i) === "object" && (e = i.family, w = i.size, p = i.height, S = i.variant, x = i.weight, k = i.style, n = i.baseline, s = i.color);
|
|
758
|
-
c.size && c.size < 3 && (w *= c.size), p = p !== "normal" && p ? parseFloat(p) : w * (7 / 6), c.height && c.height < 3 && (p *= c.height);
|
|
759
|
-
var L = Object.create(T);
|
|
760
|
-
return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = w ?? 12, L.variant = c.variant || S || "", L.style = c.style || k || "", L.weight = c.weight || x || "", L.baseline = n || 0, c.baseline != null && (L.baseline = c.baseline), L.color = c.color || s || "", L.id = v.call(L, !0), L;
|
|
761
|
-
}
|
|
762
|
-
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 };
|
|
763
|
-
var E, $ = function(e) {
|
|
764
|
-
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
765
|
-
if (n && n.getContext) {
|
|
766
|
-
var s = n.getContext("2d");
|
|
767
|
-
if (s && typeof s.measureText == "function")
|
|
768
|
-
return function(i, c) {
|
|
769
|
-
return s.font = String(c), s.measureText(i).width;
|
|
770
|
-
};
|
|
745
|
+
t.d(r, { default: () => Nn });
|
|
746
|
+
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, u = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/, g = /\bbold(?:er)?\b/, f = 13.3333333, y = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
747
|
+
function v(e) {
|
|
748
|
+
var n = "", o = this;
|
|
749
|
+
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;
|
|
771
750
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
var
|
|
775
|
-
|
|
751
|
+
var k = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
|
|
752
|
+
function b(e) {
|
|
753
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
|
|
754
|
+
n.family = (o[6] || "").trim();
|
|
755
|
+
var i = y[o[2]] || parseFloat(o[2]);
|
|
756
|
+
o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= f), n.size = i;
|
|
757
|
+
var c = parseFloat(o[4]);
|
|
758
|
+
if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * f : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(o[1]) && (n.variant = "small-caps"), d.test(o[1]) && (n.style = "italic"), g.test(o[1])) n.weight = "bold";
|
|
759
|
+
else {
|
|
760
|
+
var p = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
|
|
761
|
+
p >= 100 && p !== 400 && (n.weight = p);
|
|
762
|
+
}
|
|
763
|
+
return n;
|
|
776
764
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
765
|
+
function w() {
|
|
766
|
+
var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = 14, A = 12, x = null, S = null, T = "";
|
|
767
|
+
if (i && i.nodeType) {
|
|
768
|
+
var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
|
|
769
|
+
e = O.getPropertyValue("font-family") || "", A = parseFloat(O.getPropertyValue("font-size")), p = O.getPropertyValue("line-height"), x = O.getPropertyValue("font-weight"), S = O.getPropertyValue("font-style"), T = O.getPropertyValue("font-variant") || "";
|
|
770
|
+
} else if (typeof i == "string") {
|
|
771
|
+
var _ = b(i);
|
|
772
|
+
e = _.family, A = _.size, p = _.height, T = _.variant, S = _.style, x = _.weight;
|
|
773
|
+
} else s(i) === "object" && (e = i.family, A = i.size, p = i.height, T = i.variant, x = i.weight, S = i.style, n = i.baseline, o = i.color);
|
|
774
|
+
c.size && c.size < 3 && (A *= c.size), p = p !== "normal" && p ? parseFloat(p) : A * (7 / 6), c.height && c.height < 3 && (p *= c.height);
|
|
775
|
+
var L = Object.create(k);
|
|
776
|
+
return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = A ?? 12, L.variant = c.variant || T || "", L.style = c.style || S || "", L.weight = c.weight || x || "", L.baseline = n || 0, c.baseline != null && (L.baseline = c.baseline), L.color = c.color || o || "", L.id = v.call(L, !0), L;
|
|
786
777
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
function _t(e, n) {
|
|
797
|
-
if (typeof n != "function" && n !== null)
|
|
798
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
799
|
-
e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && It(e, n);
|
|
800
|
-
}
|
|
801
|
-
function It(e, n) {
|
|
802
|
-
return It = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, i) {
|
|
803
|
-
return s.__proto__ = i, s;
|
|
804
|
-
}, It(e, n);
|
|
805
|
-
}
|
|
806
|
-
function Jt(e) {
|
|
807
|
-
var n = function() {
|
|
808
|
-
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
809
|
-
return !1;
|
|
810
|
-
if (typeof Proxy == "function")
|
|
811
|
-
return !0;
|
|
812
|
-
try {
|
|
813
|
-
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
814
|
-
})), !0;
|
|
815
|
-
} catch {
|
|
816
|
-
return !1;
|
|
778
|
+
const $ = { "\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 };
|
|
779
|
+
var E, C = function(e) {
|
|
780
|
+
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
781
|
+
if (n && n.getContext) {
|
|
782
|
+
var o = n.getContext("2d");
|
|
783
|
+
if (o && typeof o.measureText == "function") return function(i, c) {
|
|
784
|
+
return o.font = String(c), o.measureText(i).width;
|
|
785
|
+
};
|
|
817
786
|
}
|
|
818
|
-
}()
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
834
|
-
return function(s) {
|
|
835
|
-
if (s === void 0)
|
|
836
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
837
|
-
return s;
|
|
838
|
-
}(e);
|
|
839
|
-
}
|
|
840
|
-
function Nt(e) {
|
|
841
|
-
return Nt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
|
|
842
|
-
return n.__proto__ || Object.getPrototypeOf(n);
|
|
843
|
-
}, Nt(e);
|
|
844
|
-
}
|
|
845
|
-
function Ht(e, n) {
|
|
846
|
-
if (!(e instanceof n))
|
|
847
|
-
throw new TypeError("Cannot call a class as a function");
|
|
848
|
-
}
|
|
849
|
-
function en(e, n) {
|
|
850
|
-
for (var s = 0; s < n.length; s++) {
|
|
851
|
-
var i = n[s];
|
|
852
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
853
|
-
if (W(p) !== "object" || p === null)
|
|
854
|
-
return p;
|
|
855
|
-
var x = p[Symbol.toPrimitive];
|
|
856
|
-
if (x !== void 0) {
|
|
857
|
-
var k = x.call(p, w);
|
|
858
|
-
if (W(k) !== "object")
|
|
859
|
-
return k;
|
|
860
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
861
|
-
}
|
|
862
|
-
return String(p);
|
|
863
|
-
}(i.key, "string"), W(c) === "symbol" ? c : String(c)), i);
|
|
787
|
+
}(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
|
|
788
|
+
if (!E[n]) {
|
|
789
|
+
var o = w(n);
|
|
790
|
+
E[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
|
|
791
|
+
}
|
|
792
|
+
return e.length * E[n].size;
|
|
793
|
+
}), N = {}, D = { trim: !0, collapse: !0 };
|
|
794
|
+
function z(e, n, o) {
|
|
795
|
+
var i = Object.assign({}, D, o), c = String(e);
|
|
796
|
+
if (!c) return 0;
|
|
797
|
+
if (c in $) {
|
|
798
|
+
var p = n.id + "/" + c;
|
|
799
|
+
return p in N || (N[p] = C("_".concat(c, "_"), n) - C("__", n)), N[p];
|
|
800
|
+
}
|
|
801
|
+
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), C(c, n) + n.size * (e.tracking || 0);
|
|
864
802
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
function e() {
|
|
872
|
-
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
873
|
-
Ht(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
|
|
803
|
+
function R(e) {
|
|
804
|
+
return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
805
|
+
return typeof n;
|
|
806
|
+
} : function(n) {
|
|
807
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
808
|
+
}, R(e);
|
|
874
809
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
} }, { key: "valueOf", value: function() {
|
|
879
|
-
return this.value;
|
|
880
|
-
} }, { key: "toString", value: function() {
|
|
881
|
-
return this.value;
|
|
882
|
-
} }]), e;
|
|
883
|
-
}(), Dt = function(e) {
|
|
884
|
-
_t(s, e);
|
|
885
|
-
var n = Jt(s);
|
|
886
|
-
function s() {
|
|
887
|
-
return Ht(this, s), n.apply(this, arguments);
|
|
810
|
+
function dt(e, n) {
|
|
811
|
+
if (typeof n != "function" && n !== null) throw new TypeError("Super expression must either be null or a function");
|
|
812
|
+
e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Dt(e, n);
|
|
888
813
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
function s() {
|
|
894
|
-
return Ht(this, s), n.apply(this, arguments);
|
|
814
|
+
function Dt(e, n) {
|
|
815
|
+
return Dt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
|
|
816
|
+
return o.__proto__ = i, o;
|
|
817
|
+
}, Dt(e, n);
|
|
895
818
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
819
|
+
function Mt(e) {
|
|
820
|
+
var n = function() {
|
|
821
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
822
|
+
if (typeof Proxy == "function") return !0;
|
|
823
|
+
try {
|
|
824
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
825
|
+
})), !0;
|
|
826
|
+
} catch {
|
|
827
|
+
return !1;
|
|
828
|
+
}
|
|
829
|
+
}();
|
|
830
|
+
return function() {
|
|
831
|
+
var o, i = Ht(e);
|
|
832
|
+
if (n) {
|
|
833
|
+
var c = Ht(this).constructor;
|
|
834
|
+
o = Reflect.construct(i, arguments, c);
|
|
835
|
+
} else o = i.apply(this, arguments);
|
|
836
|
+
return sn(this, o);
|
|
837
|
+
};
|
|
902
838
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
839
|
+
function sn(e, n) {
|
|
840
|
+
if (n && (R(n) === "object" || typeof n == "function")) return n;
|
|
841
|
+
if (n !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
842
|
+
return function(o) {
|
|
843
|
+
if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
844
|
+
return o;
|
|
845
|
+
}(e);
|
|
846
|
+
}
|
|
847
|
+
function Ht(e) {
|
|
848
|
+
return Ht = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
|
|
849
|
+
return n.__proto__ || Object.getPrototypeOf(n);
|
|
850
|
+
}, Ht(e);
|
|
851
|
+
}
|
|
852
|
+
function Ft(e, n) {
|
|
853
|
+
if (!(e instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
854
|
+
}
|
|
855
|
+
function on(e, n) {
|
|
856
|
+
for (var o = 0; o < n.length; o++) {
|
|
857
|
+
var i = n[o];
|
|
858
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
|
|
859
|
+
if (R(p) !== "object" || p === null) return p;
|
|
860
|
+
var x = p[Symbol.toPrimitive];
|
|
861
|
+
if (x !== void 0) {
|
|
862
|
+
var S = x.call(p, A);
|
|
863
|
+
if (R(S) !== "object") return S;
|
|
864
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
865
|
+
}
|
|
866
|
+
return String(p);
|
|
867
|
+
}(i.key, "string"), R(c) === "symbol" ? c : String(c)), i);
|
|
913
868
|
}
|
|
914
|
-
|
|
869
|
+
var c;
|
|
915
870
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}, i: function(e) {
|
|
924
|
-
e.style = "italic";
|
|
925
|
-
}, em: function(e) {
|
|
926
|
-
e.style = "italic";
|
|
927
|
-
}, dfn: function(e) {
|
|
928
|
-
e.style = "italic";
|
|
929
|
-
}, cite: function(e) {
|
|
930
|
-
e.style = "italic";
|
|
931
|
-
}, code: function(e) {
|
|
932
|
-
e.family = "monospace";
|
|
933
|
-
}, kbd: function(e) {
|
|
934
|
-
e.family = "monospace";
|
|
935
|
-
}, samp: function(e) {
|
|
936
|
-
e.family = "monospace";
|
|
937
|
-
}, var: function(e) {
|
|
938
|
-
e.family = "monospace";
|
|
939
|
-
}, tt: function(e) {
|
|
940
|
-
e.family = "monospace";
|
|
941
|
-
}, sub: function(e) {
|
|
942
|
-
e.sub = !0;
|
|
943
|
-
}, sup: function(e) {
|
|
944
|
-
e.sup = !0;
|
|
945
|
-
} }, un = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
|
|
946
|
-
function we(e) {
|
|
947
|
-
return e.replace(cn, function(n, s, i, c) {
|
|
948
|
-
if (s || i) {
|
|
949
|
-
var p = s ? 10 : 16;
|
|
950
|
-
return String.fromCharCode(parseInt(s || i, p));
|
|
871
|
+
function Rt(e, n, o) {
|
|
872
|
+
return n && on(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
873
|
+
}
|
|
874
|
+
var q = function() {
|
|
875
|
+
function e() {
|
|
876
|
+
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
877
|
+
Ft(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
|
|
951
878
|
}
|
|
952
|
-
return
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
879
|
+
return Rt(e, [{ key: "clone", value: function() {
|
|
880
|
+
var n = new e(this.value);
|
|
881
|
+
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;
|
|
882
|
+
} }, { key: "valueOf", value: function() {
|
|
883
|
+
return this.value;
|
|
884
|
+
} }, { key: "toString", value: function() {
|
|
885
|
+
return this.value;
|
|
886
|
+
} }]), e;
|
|
887
|
+
}(), Ot = function(e) {
|
|
888
|
+
dt(o, e);
|
|
889
|
+
var n = Mt(o);
|
|
890
|
+
function o() {
|
|
891
|
+
return Ft(this, o), n.apply(this, arguments);
|
|
892
|
+
}
|
|
893
|
+
return Rt(o);
|
|
894
|
+
}(q), et = function(e) {
|
|
895
|
+
dt(o, e);
|
|
896
|
+
var n = Mt(o);
|
|
897
|
+
function o() {
|
|
898
|
+
return Ft(this, o), n.apply(this, arguments);
|
|
899
|
+
}
|
|
900
|
+
return Rt(o);
|
|
901
|
+
}(q), yt = function(e) {
|
|
902
|
+
dt(o, e);
|
|
903
|
+
var n = Mt(o);
|
|
904
|
+
function o() {
|
|
905
|
+
return Ft(this, o), n.apply(this, arguments);
|
|
906
|
+
}
|
|
907
|
+
return Rt(o);
|
|
908
|
+
}(q), te = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, an = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, xe = /^[\xA0\u2011\u202F\u2060\uFEFF]/, ln = /^(?:[;\xAD%?…]|,(?!\d))/, hn = /^[´±°¢£¤$¥\u2212]/;
|
|
909
|
+
function qt(e, n) {
|
|
910
|
+
n !== !1 && (e = e.trim());
|
|
911
|
+
for (var o, i, c = [], p = e.charAt(0), A = 0, x = 1, S = e.length; x < S; x++) {
|
|
912
|
+
o = e.charAt(x), i = e.charAt(x + 1);
|
|
913
|
+
var T = te.test(p), M = te.test(o), O = M || T, _ = void 0;
|
|
914
|
+
if ((hn.test(o) && !xe.test(p) || ln.test(p + i) && !xe.test(o)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((_ = te.test(e.charAt(x - 2))) && !M && (O = !1), !_ && an.test(o + i) && (O = !0)), O) {
|
|
915
|
+
var L = e.slice(A, x);
|
|
916
|
+
/\u00AD$/.test(L) ? (c.push(new q(L.slice(0, -1))), c.push(new yt())) : (c.push(new q(L)), c.push(new Ot())), A = x;
|
|
967
917
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
918
|
+
p = o;
|
|
919
|
+
}
|
|
920
|
+
return c.push(new q(e.slice(A))), c;
|
|
971
921
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
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) ? te(n, s) : void 0;
|
|
922
|
+
const we = { 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: "›" };
|
|
923
|
+
var cn = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, un = /^<\/([a-zA-Z0-9]+)([^>]*)>/, dn = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, fn = /^<!--(.+?)-->/, pn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, be = { b: function(e) {
|
|
924
|
+
e.weight = "bold";
|
|
925
|
+
}, strong: function(e) {
|
|
926
|
+
e.weight = "bold";
|
|
927
|
+
}, i: function(e) {
|
|
928
|
+
e.style = "italic";
|
|
929
|
+
}, em: function(e) {
|
|
930
|
+
e.style = "italic";
|
|
931
|
+
}, dfn: function(e) {
|
|
932
|
+
e.style = "italic";
|
|
933
|
+
}, cite: function(e) {
|
|
934
|
+
e.style = "italic";
|
|
935
|
+
}, code: function(e) {
|
|
936
|
+
e.family = "monospace";
|
|
937
|
+
}, kbd: function(e) {
|
|
938
|
+
e.family = "monospace";
|
|
939
|
+
}, samp: function(e) {
|
|
940
|
+
e.family = "monospace";
|
|
941
|
+
}, var: function(e) {
|
|
942
|
+
e.family = "monospace";
|
|
943
|
+
}, tt: function(e) {
|
|
944
|
+
e.family = "monospace";
|
|
945
|
+
}, sub: function(e) {
|
|
946
|
+
e.sub = !0;
|
|
947
|
+
}, sup: function(e) {
|
|
948
|
+
e.sup = !0;
|
|
949
|
+
} }, gn = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
|
|
950
|
+
function Ae(e) {
|
|
951
|
+
return e.replace(pn, function(n, o, i, c) {
|
|
952
|
+
if (o || i) {
|
|
953
|
+
var p = o ? 10 : 16;
|
|
954
|
+
return String.fromCharCode(parseInt(o || i, p));
|
|
955
|
+
}
|
|
956
|
+
return c in we ? we[c] : n;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function yn(e) {
|
|
960
|
+
return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
|
|
961
|
+
}
|
|
962
|
+
var mn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
|
|
963
|
+
function vn(e) {
|
|
964
|
+
var n, o = {};
|
|
965
|
+
if (e) {
|
|
966
|
+
do
|
|
967
|
+
if (n = mn.exec(e)) {
|
|
968
|
+
var i = Ae(yn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
|
|
969
|
+
if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0])) throw new Error("Attribute error");
|
|
970
|
+
}
|
|
971
|
+
while (n && e.length);
|
|
972
|
+
if (/\S/.test(e)) throw new Error("Attribute error");
|
|
1024
973
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
974
|
+
return o;
|
|
975
|
+
}
|
|
976
|
+
const Ee = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
|
|
977
|
+
var xn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, wn = /^%[^\n]+(?:\n|$)/, bn = /^[^#$%&~_^\\{}]+/, An = /^\\([&{}$%#_])/, En = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, kn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, G = { bf: function(e) {
|
|
978
|
+
e.weight = "bold";
|
|
979
|
+
}, it: function(e) {
|
|
980
|
+
e.style = "italic";
|
|
981
|
+
}, sl: function(e) {
|
|
982
|
+
e.style = "italic";
|
|
983
|
+
}, color: function(e, n) {
|
|
984
|
+
e.color = n;
|
|
985
|
+
}, href: function(e, n) {
|
|
986
|
+
e.href = n;
|
|
987
|
+
}, "^": function(e) {
|
|
988
|
+
e.sup = !0;
|
|
989
|
+
}, _: function(e) {
|
|
990
|
+
e.sub = !0;
|
|
991
|
+
}, par: function(e) {
|
|
992
|
+
this.tokens.push(new et(), new et());
|
|
993
|
+
}, newline: function(e) {
|
|
994
|
+
this.tokens.push(new et());
|
|
995
|
+
}, url: function(e, n) {
|
|
996
|
+
this.open_context().href = n, this.add_token(new q(n)), this.close_context();
|
|
997
|
+
} };
|
|
998
|
+
G.textsuperscript = G["^"], G.textsubscript = G._, G.textsl = G.sl, G.mathbf = G.bf, G.mathit = G.it, G.textbf = G.bf, G.textit = G.it, G.textcolor = G.color;
|
|
999
|
+
var Sn = /[\r\n\xA0]+/g;
|
|
1000
|
+
function Tn(e, n) {
|
|
1001
|
+
e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
|
|
1002
|
+
var o = n;
|
|
1003
|
+
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = w(n, e)), o;
|
|
1004
|
+
}
|
|
1005
|
+
function ke(e, n, o) {
|
|
1006
|
+
for (var i, c, p = e.width; p + o.width > n && e.length; ) c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = z(i, i.font), p += i.width) : e.pop(), p -= c;
|
|
1007
|
+
e[e.length - 1] instanceof yt && e.pop(), i = e[e.length - 1] || i || {}, o.font = w(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);
|
|
1008
|
+
}
|
|
1009
|
+
function bt(e) {
|
|
1010
|
+
return Math.round(1e6 * e) / 1e6;
|
|
1011
|
+
}
|
|
1012
|
+
function Se(e) {
|
|
1013
|
+
return function(n) {
|
|
1014
|
+
if (Array.isArray(n)) return ee(n);
|
|
1015
|
+
}(e) || function(n) {
|
|
1016
|
+
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
|
|
1017
|
+
}(e) || function(n, o) {
|
|
1018
|
+
if (n) {
|
|
1019
|
+
if (typeof n == "string") return ee(n, o);
|
|
1020
|
+
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1021
|
+
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) ? ee(n, o) : void 0;
|
|
1022
|
+
}
|
|
1023
|
+
}(e) || function() {
|
|
1024
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1027
1025
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
i
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
J += (M * z - k * e.length * z) / c;
|
|
1046
|
-
}
|
|
1047
|
-
var P = w === "justify", j = 0;
|
|
1048
|
-
w === "right" ? j = O : w === "center" && (j = O / 2);
|
|
1049
|
-
for (var H = [], Q = "tspan", Y = null, q = "", D = function() {
|
|
1050
|
-
if (q) {
|
|
1051
|
-
var yt = x(Q, Y, q);
|
|
1052
|
-
H.push(yt);
|
|
1026
|
+
}();
|
|
1027
|
+
}
|
|
1028
|
+
function ee(e, n) {
|
|
1029
|
+
(n == null || n > e.length) && (n = e.length);
|
|
1030
|
+
for (var o = 0, i = new Array(n); o < n; o++) i[o] = e[o];
|
|
1031
|
+
return i;
|
|
1032
|
+
}
|
|
1033
|
+
var _n = { center: "middle", right: "end" }, In = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ne = function(e, n) {
|
|
1034
|
+
return !e && !n || e === n;
|
|
1035
|
+
};
|
|
1036
|
+
function Dn(e, n) {
|
|
1037
|
+
var o = [], i = n.font(), c = i.size, p = i.family, A = n.align(), x = n.createElement();
|
|
1038
|
+
if (e.length) {
|
|
1039
|
+
var S = i.height, T = n.valign(), M = n.height()(), O = n.width()(0), _ = !isFinite(O) && e.length === 1, L = _ ? null : n.x(), B = bt(S / c), J = _ ? null : bt(S / (1.15 * c + (S - c) / 2));
|
|
1040
|
+
if (In[T] && isFinite(M)) {
|
|
1041
|
+
var H = T === "bottom" ? 1 : 0.5;
|
|
1042
|
+
J += (M * H - S * e.length * H) / c;
|
|
1053
1043
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
var
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
var R = lt[X], Z = R.font;
|
|
1061
|
-
R.whitespace && wt++, Lt += R.width, X && !R.tracking && !ot && ee(Z.id, at) && ee(R.class, dt) && ee(ht, R.href) ? q += R.value : (D(), q = R.value, Y = { fontFamily: Z.family !== p ? Z.family : null, fontSize: Z.size !== c ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: R.class || null }, ot && (Y.dx = xt(ot), ot = 0), R.tracking && (ot = Z.size * R.tracking), R.href && !ht ? (ht = R.href, Q = "a", Y.href = ht, Y.rel = R.rel, Y.target = R.target) : ht = null, at = Z.id, dt = R.class);
|
|
1062
|
-
}
|
|
1063
|
-
if (D(), I)
|
|
1064
|
-
s.push.apply(s, Ee(H));
|
|
1065
|
-
else {
|
|
1066
|
-
var qt = null, Ct = nt === tt - 1 || lt[lt.length - 1] instanceof et;
|
|
1067
|
-
P && lt.length > 1 && !Ct && (qt = xt((O - Lt) / wt)), s.push(x.apply(void 0, ["tspan", { wordSpacing: qt, x: L(nt) + j, dy: xt(nt ? B : J) + "em" }].concat(Ee(H))));
|
|
1044
|
+
var P = A === "justify", j = 0;
|
|
1045
|
+
A === "right" ? j = O : A === "center" && (j = O / 2);
|
|
1046
|
+
for (var F = [], Q = "tspan", Y = null, V = "", I = function() {
|
|
1047
|
+
if (V) {
|
|
1048
|
+
var mt = x(Q, Y, V);
|
|
1049
|
+
F.push(mt);
|
|
1068
1050
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1051
|
+
Q = "tspan", Y = null, V = "";
|
|
1052
|
+
}, nt = 0, tt = e.length; nt < tt; nt++) {
|
|
1053
|
+
var at = "", ft = "", ot = 0, lt = e[nt];
|
|
1054
|
+
if (lt.length) {
|
|
1055
|
+
F = [];
|
|
1056
|
+
for (var At = 0, $t = 0, ht = void 0, X = 0, Bt = lt.length; X < Bt; X++) {
|
|
1057
|
+
var U = lt[X], Z = U.font;
|
|
1058
|
+
U.whitespace && At++, $t += U.width, X && !U.tracking && !ot && ne(Z.id, at) && ne(U.class, ft) && ne(ht, U.href) ? V += U.value : (I(), V = U.value, Y = { fontFamily: Z.family !== p ? Z.family : null, fontSize: Z.size !== c ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: U.class || null }, ot && (Y.dx = bt(ot), ot = 0), U.tracking && (ot = Z.size * U.tracking), U.href && !ht ? (ht = U.href, Q = "a", Y.href = ht, Y.rel = U.rel, Y.target = U.target) : ht = null, at = Z.id, ft = U.class);
|
|
1059
|
+
}
|
|
1060
|
+
if (I(), _) o.push.apply(o, Se(F));
|
|
1061
|
+
else {
|
|
1062
|
+
var jt = null, Pt = nt === tt - 1 || lt[lt.length - 1] instanceof et;
|
|
1063
|
+
P && lt.length > 1 && !Pt && (jt = bt((O - $t) / At)), o.push(x.apply(void 0, ["tspan", { wordSpacing: jt, x: L(nt) + j, dy: bt(nt ? B : J) + "em" }].concat(Se(F))));
|
|
1064
|
+
}
|
|
1065
|
+
} else o.push(x("tspan", { x: L(nt), dy: bt(nt ? B : J) + "em" }, " "));
|
|
1066
|
+
}
|
|
1071
1067
|
}
|
|
1068
|
+
return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: _n[A] || "start" }].concat(o));
|
|
1072
1069
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
z += q.width;
|
|
1070
|
+
var Mn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
|
|
1071
|
+
function On(e, n, o) {
|
|
1072
|
+
if (e.length) {
|
|
1073
|
+
o.textBaseline = "middle";
|
|
1074
|
+
var i = n.font(), c = i.height, p = i.size, A = n.valign(), x = n.height()(), S = n.width()(0), T = n.align(), M = T === "justify", O = 0.5 * c, _ = Mn[A];
|
|
1075
|
+
if (_ && isFinite(x)) {
|
|
1076
|
+
var L = e.length * c;
|
|
1077
|
+
O += x * _ - L * _;
|
|
1078
|
+
}
|
|
1079
|
+
e.forEach(function(B, J) {
|
|
1080
|
+
var H = n.x()(J), P = J * c + O, j = 0, F = 0;
|
|
1081
|
+
B.forEach(function(V) {
|
|
1082
|
+
V.whitespace && j++, F += V.width;
|
|
1083
|
+
});
|
|
1084
|
+
var Q = 0, Y = J === e.length - 1 || B[B.length - 1] instanceof et;
|
|
1085
|
+
M && B.length > 1 && !Y && (Q = (S - F) / j), B.forEach(function(V) {
|
|
1086
|
+
o.font = V.font;
|
|
1087
|
+
var I = V.font, nt = I.baseline ? p * -I.baseline + 0.15 * p : 0;
|
|
1088
|
+
o.fillStyle = function(ft, ot) {
|
|
1089
|
+
return ft.color ? ft.color : ot.href ? "#00C" : "#000";
|
|
1090
|
+
}(I, V);
|
|
1091
|
+
var tt = 0;
|
|
1092
|
+
if (T === "right" ? tt += S - F : T === "center" ? tt += S / 2 - F / 2 : T === "justify" && (V.whitespace || V instanceof et) && (H += Q), o.fillText(V.value, H + tt, P + nt), V.href) {
|
|
1093
|
+
o.beginPath(), o.strokeStyle = o.fillStyle;
|
|
1094
|
+
var at = Math.floor(P + 0.45 * p) + 0.5;
|
|
1095
|
+
o.moveTo(H + tt, at), o.lineTo(H + tt + V.width, at), o.stroke();
|
|
1096
|
+
}
|
|
1097
|
+
H += V.width;
|
|
1098
|
+
});
|
|
1103
1099
|
});
|
|
1104
|
-
}
|
|
1100
|
+
}
|
|
1105
1101
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}, ne(e);
|
|
1113
|
-
}
|
|
1114
|
-
function ke(e) {
|
|
1115
|
-
for (var n = {}, s = 0; s < e.length; s++) {
|
|
1116
|
-
var i = e[s];
|
|
1117
|
-
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : ne(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));
|
|
1102
|
+
function re(e) {
|
|
1103
|
+
return re = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1104
|
+
return typeof n;
|
|
1105
|
+
} : function(n) {
|
|
1106
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1107
|
+
}, re(e);
|
|
1118
1108
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1126
|
-
}, Mt(e);
|
|
1127
|
-
}
|
|
1128
|
-
function In(e, n) {
|
|
1129
|
-
for (var s = 0; s < n.length; s++) {
|
|
1130
|
-
var i = n[s];
|
|
1131
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
1132
|
-
if (Mt(p) !== "object" || p === null)
|
|
1133
|
-
return p;
|
|
1134
|
-
var x = p[Symbol.toPrimitive];
|
|
1135
|
-
if (x !== void 0) {
|
|
1136
|
-
var k = x.call(p, w);
|
|
1137
|
-
if (Mt(k) !== "object")
|
|
1138
|
-
return k;
|
|
1139
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1140
|
-
}
|
|
1141
|
-
return String(p);
|
|
1142
|
-
}(i.key, "string"), Mt(c) === "symbol" ? c : String(c)), i);
|
|
1109
|
+
function Te(e) {
|
|
1110
|
+
for (var n = {}, o = 0; o < e.length; o++) {
|
|
1111
|
+
var i = e[o];
|
|
1112
|
+
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : re(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));
|
|
1113
|
+
}
|
|
1114
|
+
return n;
|
|
1143
1115
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}, it = function() {
|
|
1151
|
-
function e(i) {
|
|
1152
|
-
if (function(p, w) {
|
|
1153
|
-
if (!(p instanceof w))
|
|
1154
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1155
|
-
}(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
|
|
1156
|
-
return 1 / 0;
|
|
1157
|
-
}, height: function() {
|
|
1158
|
-
return 1 / 0;
|
|
1159
|
-
}, x: function() {
|
|
1160
|
-
return 0;
|
|
1161
|
-
}, font: null, tAnchor: 0, parser: e.defaultparser }, i)
|
|
1162
|
-
for (var c in i)
|
|
1163
|
-
typeof this[c] == "function" && this[c](i[c]);
|
|
1116
|
+
function Lt(e) {
|
|
1117
|
+
return Lt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1118
|
+
return typeof n;
|
|
1119
|
+
} : function(n) {
|
|
1120
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1121
|
+
}, Lt(e);
|
|
1164
1122
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
return
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1123
|
+
function Ln(e, n) {
|
|
1124
|
+
for (var o = 0; o < n.length; o++) {
|
|
1125
|
+
var i = n[o];
|
|
1126
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
|
|
1127
|
+
if (Lt(p) !== "object" || p === null) return p;
|
|
1128
|
+
var x = p[Symbol.toPrimitive];
|
|
1129
|
+
if (x !== void 0) {
|
|
1130
|
+
var S = x.call(p, A);
|
|
1131
|
+
if (Lt(S) !== "object") return S;
|
|
1132
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1133
|
+
}
|
|
1134
|
+
return String(p);
|
|
1135
|
+
}(i.key, "string"), Lt(c) === "symbol" ? c : String(c)), i);
|
|
1136
|
+
}
|
|
1137
|
+
var c;
|
|
1138
|
+
}
|
|
1139
|
+
var Cn = w(), ie = function(e) {
|
|
1140
|
+
return typeof e == "function" ? e : function() {
|
|
1141
|
+
return e;
|
|
1142
|
+
};
|
|
1143
|
+
}, it = function() {
|
|
1144
|
+
function e(i) {
|
|
1145
|
+
if (function(p, A) {
|
|
1146
|
+
if (!(p instanceof A)) throw new TypeError("Cannot call a class as a function");
|
|
1147
|
+
}(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
|
|
1148
|
+
return 1 / 0;
|
|
1149
|
+
}, height: function() {
|
|
1150
|
+
return 1 / 0;
|
|
1151
|
+
}, x: function() {
|
|
1152
|
+
return 0;
|
|
1153
|
+
}, font: null, tAnchor: 0, parser: e.defaultparser }, i) for (var c in i) typeof this[c] == "function" && this[c](i[c]);
|
|
1154
|
+
}
|
|
1155
|
+
var n, o;
|
|
1156
|
+
return n = e, o = [{ key: "linebreak", value: function(i) {
|
|
1157
|
+
var c = this, p = this.props.parser(String(i)), A = this.font(), x = function(S, T, M) {
|
|
1158
|
+
if (!S.length) return [];
|
|
1159
|
+
var O = T.height(), _ = T.width(), L = T.overflowLine(), B = T.overflowWrap(), J = w(M, !0, !1), H = isFinite(O()) ? Math.floor(O() / M.height) : 1 / 0;
|
|
1160
|
+
if (!O() && !_(0) || !H) return [];
|
|
1161
|
+
for (var P = 0, j = 0, F = 0, Q = [], Y = [], V = !1; P < S.length && j < H; ) {
|
|
1162
|
+
var I = S[P], nt = Tn(I, M);
|
|
1163
|
+
if (I.width = z(I, nt), I.font = nt, I.line = j, I.whitespace = I.value in $, I.value && (I.value = I.value.replace(Sn, " ")), !(!F && I.whitespace || V && I.whitespace)) if (I instanceof et) F = 0, Y = [], Q.push(P + 1), j++;
|
|
1164
|
+
else if (I instanceof Ot || I instanceof yt) Y.push({ index: P, width: F });
|
|
1165
|
+
else if (I.whitespace || F + I.width < _(j)) F += I.width;
|
|
1182
1166
|
else if (Y.length) {
|
|
1183
1167
|
var tt = void 0, at = void 0;
|
|
1184
1168
|
do {
|
|
1185
1169
|
at = !0, tt = Y.pop();
|
|
1186
|
-
var
|
|
1187
|
-
|
|
1170
|
+
var ft = S[tt.index], ot = void 0;
|
|
1171
|
+
ft instanceof yt && (ot = z("-", ft.font), tt.width + ot > _(j) && (at = !Y.length));
|
|
1188
1172
|
} while (!at);
|
|
1189
|
-
Q.push(tt.index + 1),
|
|
1173
|
+
Q.push(tt.index + 1), F = 0, j++, P = tt.index, Y = [];
|
|
1190
1174
|
} else if (B === "break-word") {
|
|
1191
|
-
var lt =
|
|
1192
|
-
if (
|
|
1193
|
-
var
|
|
1175
|
+
var lt = _(j);
|
|
1176
|
+
if (F + I.width > lt) {
|
|
1177
|
+
var At = I.clone();
|
|
1194
1178
|
do
|
|
1195
|
-
|
|
1196
|
-
while (
|
|
1197
|
-
|
|
1179
|
+
I.value = I.value.slice(0, -1), I.width = z(I, I.font), F += I.width;
|
|
1180
|
+
while (I.value && I.width > lt);
|
|
1181
|
+
At.value = At.value.slice(I.value.length), S.splice(P + 1, 0, new Ot(), At);
|
|
1198
1182
|
}
|
|
1199
|
-
Q.push(P + 1),
|
|
1200
|
-
} else
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
mt
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
return oe && bt.push(oe), bt.width = bt.reduce(function(ae, Pn) {
|
|
1215
|
-
return ae + Pn.width;
|
|
1216
|
-
}, 0), bt.width > ht && (ht = bt.width), bt;
|
|
1217
|
-
});
|
|
1218
|
-
if (X.hasLineOverflow = !1, L) {
|
|
1219
|
-
var jt = L === "ellipsis" ? "…" : L;
|
|
1220
|
-
X.forEach(function(yt, K) {
|
|
1221
|
-
var mt = I(K);
|
|
1222
|
-
if (yt.width > mt) {
|
|
1223
|
-
var ft = new F(jt);
|
|
1224
|
-
ft.font = M, ft.width = G(jt, J), Ae(yt, mt, ft), X.hasLineOverflow = !0;
|
|
1225
|
-
}
|
|
1183
|
+
Q.push(P + 1), F = 0, j++;
|
|
1184
|
+
} else F += I.width;
|
|
1185
|
+
P++, V = I.whitespace;
|
|
1186
|
+
}
|
|
1187
|
+
P !== Q[Q.length - 1] && Q.push(P);
|
|
1188
|
+
var $t = 0, ht = 0, X = Q.map(function(mt) {
|
|
1189
|
+
for (var K, vt = $t; (K = S[vt]) && (K.whitespace || !K.value); ) vt++;
|
|
1190
|
+
for (var pt = mt, ae = null; pt > vt && (K = S[pt - 1]) && (K.whitespace || !(K.value || K instanceof yt)); ) K instanceof et && (ae = K), pt--;
|
|
1191
|
+
K instanceof yt && (K.value = "-", K.width = z("-", K.font)), $t = mt;
|
|
1192
|
+
var Et = S.slice(vt, pt).filter(function(le) {
|
|
1193
|
+
return le.value;
|
|
1194
|
+
});
|
|
1195
|
+
return ae && Et.push(ae), Et.width = Et.reduce(function(le, Hn) {
|
|
1196
|
+
return le + Hn.width;
|
|
1197
|
+
}, 0), Et.width > ht && (ht = Et.width), Et;
|
|
1226
1198
|
});
|
|
1199
|
+
if (X.hasLineOverflow = !1, L) {
|
|
1200
|
+
var Bt = L === "ellipsis" ? "…" : L;
|
|
1201
|
+
X.forEach(function(mt, K) {
|
|
1202
|
+
var vt = _(K);
|
|
1203
|
+
if (mt.width > vt) {
|
|
1204
|
+
var pt = new q(Bt);
|
|
1205
|
+
pt.font = M, pt.width = z(Bt, J), ke(mt, vt, pt), X.hasLineOverflow = !0;
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
var U = T.overflow() === "ellipsis" ? "…" : T.overflow();
|
|
1210
|
+
if (U && P !== S.length) {
|
|
1211
|
+
var Z = _(X.length - 1), jt = X[X.length - 1], Pt = new q(U);
|
|
1212
|
+
Pt.font = M, Pt.width = z(U, J), ke(jt, Z, Pt), X.hasOverflow = !0;
|
|
1213
|
+
} else X.hasOverflow = !1;
|
|
1214
|
+
return X.font = M, X.width = ht, X;
|
|
1215
|
+
}(p, this, A);
|
|
1216
|
+
return x.height = x.length * A.height, x.render = function(S) {
|
|
1217
|
+
return c.render(x, S);
|
|
1218
|
+
}, x.svg = x.render, x.draw = x.render, x;
|
|
1219
|
+
} }, { key: "font", value: function(i) {
|
|
1220
|
+
return arguments.length ? (this.props.font = w(i), this) : this.props.font || w(Cn);
|
|
1221
|
+
} }, { key: "overflow", value: function(i) {
|
|
1222
|
+
return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
|
|
1223
|
+
} }, { key: "overflowLine", value: function(i) {
|
|
1224
|
+
return arguments.length ? (this.props.lineclamp = String(i), this) : this.props.lineclamp;
|
|
1225
|
+
} }, { key: "valign", value: function(i) {
|
|
1226
|
+
return arguments.length ? (this.props.valign = i, this) : this.props.valign;
|
|
1227
|
+
} }, { key: "align", value: function(i) {
|
|
1228
|
+
if (!arguments.length) return this.props.align;
|
|
1229
|
+
var c = String(i).toLowerCase();
|
|
1230
|
+
return c === "left" || c === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : c === "center" || c === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : c === "end" || c === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : c === "justify" && (this.props.align = i, this.props.tAnchor = 0), this;
|
|
1231
|
+
} }, { key: "overflowWrap", value: function(i) {
|
|
1232
|
+
if (!arguments.length) return this.props.overflowWrap || "normal";
|
|
1233
|
+
var c = String(i).toLowerCase();
|
|
1234
|
+
return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1235
|
+
} }, { key: "width", value: function(i) {
|
|
1236
|
+
return arguments.length ? (this.props.width = ie(i), this) : this.props.width;
|
|
1237
|
+
} }, { key: "height", value: function(i) {
|
|
1238
|
+
return arguments.length ? (this.props.height = ie(i), this) : this.props.height;
|
|
1239
|
+
} }, { key: "x", value: function(i) {
|
|
1240
|
+
return arguments.length ? (this.props.x = ie(i), this) : this.props.x;
|
|
1241
|
+
} }, { key: "parser", value: function(i) {
|
|
1242
|
+
if (!arguments.length) return this.props.parser;
|
|
1243
|
+
if (typeof i == "string") {
|
|
1244
|
+
var c = e[i] || e[i + "parser"];
|
|
1245
|
+
typeof c == "function" && (i = c);
|
|
1227
1246
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
return
|
|
1235
|
-
}(
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
} }, { key: "overflowLine", value: function(i) {
|
|
1244
|
-
return arguments.length ? (this.props.lineclamp = String(i), this) : this.props.lineclamp;
|
|
1245
|
-
} }, { key: "valign", value: function(i) {
|
|
1246
|
-
return arguments.length ? (this.props.valign = i, this) : this.props.valign;
|
|
1247
|
-
} }, { key: "align", value: function(i) {
|
|
1248
|
-
if (!arguments.length)
|
|
1249
|
-
return this.props.align;
|
|
1250
|
-
var c = String(i).toLowerCase();
|
|
1251
|
-
return c === "left" || c === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : c === "center" || c === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : c === "end" || c === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : c === "justify" && (this.props.align = i, this.props.tAnchor = 0), this;
|
|
1252
|
-
} }, { key: "overflowWrap", value: function(i) {
|
|
1253
|
-
if (!arguments.length)
|
|
1254
|
-
return this.props.overflowWrap || "normal";
|
|
1255
|
-
var c = String(i).toLowerCase();
|
|
1256
|
-
return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1257
|
-
} }, { key: "width", value: function(i) {
|
|
1258
|
-
return arguments.length ? (this.props.width = ie(i), this) : this.props.width;
|
|
1259
|
-
} }, { key: "height", value: function(i) {
|
|
1260
|
-
return arguments.length ? (this.props.height = ie(i), this) : this.props.height;
|
|
1261
|
-
} }, { key: "x", value: function(i) {
|
|
1262
|
-
return arguments.length ? (this.props.x = ie(i), this) : this.props.x;
|
|
1263
|
-
} }, { key: "parser", value: function(i) {
|
|
1264
|
-
if (!arguments.length)
|
|
1265
|
-
return this.props.parser;
|
|
1266
|
-
if (typeof i == "string") {
|
|
1267
|
-
var c = e[i] || e[i + "parser"];
|
|
1268
|
-
typeof c == "function" && (i = c);
|
|
1269
|
-
}
|
|
1270
|
-
if (typeof i != "function")
|
|
1271
|
-
throw new Error("Unknown parser: " + i);
|
|
1272
|
-
return this.props.parser = i, this;
|
|
1273
|
-
} }, { key: "createElement", value: function(i) {
|
|
1274
|
-
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1275
|
-
} }, { key: "render", value: function() {
|
|
1276
|
-
var i = ke(arguments);
|
|
1277
|
-
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? _n(i.text, this, i.ctx) : Sn(i.text, this);
|
|
1278
|
-
} }], s && In(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1279
|
-
}();
|
|
1280
|
-
function Ot(e) {
|
|
1281
|
-
return Ot = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1282
|
-
return typeof n;
|
|
1283
|
-
} : function(n) {
|
|
1284
|
-
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1285
|
-
}, Ot(e);
|
|
1286
|
-
}
|
|
1287
|
-
function re(e, n) {
|
|
1288
|
-
(n == null || n > e.length) && (n = e.length);
|
|
1289
|
-
for (var s = 0, i = new Array(n); s < n; s++)
|
|
1290
|
-
i[s] = e[s];
|
|
1291
|
-
return i;
|
|
1292
|
-
}
|
|
1293
|
-
function Mn(e, n) {
|
|
1294
|
-
for (var s = 0; s < n.length; s++) {
|
|
1295
|
-
var i = n[s];
|
|
1296
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
1297
|
-
if (Ot(p) !== "object" || p === null)
|
|
1298
|
-
return p;
|
|
1299
|
-
var x = p[Symbol.toPrimitive];
|
|
1300
|
-
if (x !== void 0) {
|
|
1301
|
-
var k = x.call(p, w);
|
|
1302
|
-
if (Ot(k) !== "object")
|
|
1303
|
-
return k;
|
|
1304
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1305
|
-
}
|
|
1306
|
-
return String(p);
|
|
1307
|
-
}(i.key, "string"), Ot(c) === "symbol" ? c : String(c)), i);
|
|
1247
|
+
if (typeof i != "function") throw new Error("Unknown parser: " + i);
|
|
1248
|
+
return this.props.parser = i, this;
|
|
1249
|
+
} }, { key: "createElement", value: function(i) {
|
|
1250
|
+
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1251
|
+
} }, { key: "render", value: function() {
|
|
1252
|
+
var i = Te(arguments);
|
|
1253
|
+
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? On(i.text, this, i.ctx) : Dn(i.text, this);
|
|
1254
|
+
} }], o && Ln(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1255
|
+
}();
|
|
1256
|
+
function Ct(e) {
|
|
1257
|
+
return Ct = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1258
|
+
return typeof n;
|
|
1259
|
+
} : function(n) {
|
|
1260
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1261
|
+
}, Ct(e);
|
|
1308
1262
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
return e;
|
|
1314
|
-
};
|
|
1315
|
-
}, Te = function() {
|
|
1316
|
-
function e(i) {
|
|
1317
|
-
if (function(p, w) {
|
|
1318
|
-
if (!(p instanceof w))
|
|
1319
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1320
|
-
}(this, e), this.props = { width: function() {
|
|
1321
|
-
return 1 / 0;
|
|
1322
|
-
}, height: function() {
|
|
1323
|
-
return 1 / 0;
|
|
1324
|
-
}, rotation: 0, vAnchor: 0, hAnchor: 0 }, i)
|
|
1325
|
-
for (var c in i)
|
|
1326
|
-
typeof this[c] == "function" && this[c](i[c]);
|
|
1327
|
-
this.render = this.render.bind(this);
|
|
1263
|
+
function se(e, n) {
|
|
1264
|
+
(n == null || n > e.length) && (n = e.length);
|
|
1265
|
+
for (var o = 0, i = new Array(n); o < n; o++) i[o] = e[o];
|
|
1266
|
+
return i;
|
|
1328
1267
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1268
|
+
function $n(e, n) {
|
|
1269
|
+
for (var o = 0; o < n.length; o++) {
|
|
1270
|
+
var i = n[o];
|
|
1271
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
|
|
1272
|
+
if (Ct(p) !== "object" || p === null) return p;
|
|
1273
|
+
var x = p[Symbol.toPrimitive];
|
|
1274
|
+
if (x !== void 0) {
|
|
1275
|
+
var S = x.call(p, A);
|
|
1276
|
+
if (Ct(S) !== "object") return S;
|
|
1277
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1278
|
+
}
|
|
1279
|
+
return String(p);
|
|
1280
|
+
}(i.key, "string"), Ct(c) === "symbol" ? c : String(c)), i);
|
|
1339
1281
|
}
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
return
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1282
|
+
var c;
|
|
1283
|
+
}
|
|
1284
|
+
var _e = function(e) {
|
|
1285
|
+
return typeof e == "function" ? e : function() {
|
|
1286
|
+
return e;
|
|
1287
|
+
};
|
|
1288
|
+
}, Ie = function() {
|
|
1289
|
+
function e(i) {
|
|
1290
|
+
if (function(p, A) {
|
|
1291
|
+
if (!(p instanceof A)) throw new TypeError("Cannot call a class as a function");
|
|
1292
|
+
}(this, e), this.props = { width: function() {
|
|
1293
|
+
return 1 / 0;
|
|
1294
|
+
}, height: function() {
|
|
1295
|
+
return 1 / 0;
|
|
1296
|
+
}, rotation: 0, vAnchor: 0, hAnchor: 0 }, i) for (var c in i) typeof this[c] == "function" && this[c](i[c]);
|
|
1297
|
+
this.render = this.render.bind(this);
|
|
1298
|
+
}
|
|
1299
|
+
var n, o;
|
|
1300
|
+
return n = e, o = [{ key: "anchor", value: function(i) {
|
|
1301
|
+
var c = this.props, p = c.hAnchor, A = c.vAnchor, x = c.width, S = c.height;
|
|
1302
|
+
if (!arguments.length) return [p * x(0), A * S(0)];
|
|
1303
|
+
if (typeof i == "string") {
|
|
1304
|
+
var T = this.props;
|
|
1305
|
+
i.toLowerCase().trim().split(/\s+/).forEach(function(M) {
|
|
1306
|
+
M === "top" && (T.vAnchor = -0), M === "middle" && (T.vAnchor = -0.5), M === "bottom" && (T.vAnchor = -1), M === "left" && (T.hAnchor = -0), M === "center" && (T.hAnchor = -0.5), M === "right" && (T.hAnchor = -1);
|
|
1307
|
+
});
|
|
1363
1308
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1309
|
+
return this;
|
|
1310
|
+
} }, { key: "width", value: function(i) {
|
|
1311
|
+
return arguments.length ? (this.props.width = _e(i), this) : this.props.width;
|
|
1312
|
+
} }, { key: "height", value: function(i) {
|
|
1313
|
+
return arguments.length ? (this.props.height = _e(i), this) : this.props.height;
|
|
1314
|
+
} }, { key: "rotate", value: function(i) {
|
|
1315
|
+
return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
|
|
1316
|
+
} }, { key: "createElement", value: function(i) {
|
|
1317
|
+
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1318
|
+
} }, { key: "canvas", value: function(i, c) {
|
|
1319
|
+
var p, A = i.getContext ? i.getContext("2d") : i;
|
|
1320
|
+
return A.save(), A.rotate(this.rotate() * Math.PI / 180), A.translate.apply(A, function(x) {
|
|
1321
|
+
if (Array.isArray(x)) return se(x);
|
|
1322
|
+
}(p = this.anchor()) || function(x) {
|
|
1323
|
+
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null) return Array.from(x);
|
|
1324
|
+
}(p) || function(x, S) {
|
|
1325
|
+
if (x) {
|
|
1326
|
+
if (typeof x == "string") return se(x, S);
|
|
1327
|
+
var T = Object.prototype.toString.call(x).slice(8, -1);
|
|
1328
|
+
return T === "Object" && x.constructor && (T = x.constructor.name), T === "Map" || T === "Set" ? Array.from(x) : T === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(T) ? se(x, S) : void 0;
|
|
1329
|
+
}
|
|
1330
|
+
}(p) || function() {
|
|
1331
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1366
1332
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
if (Array.isArray(n))
|
|
1387
|
-
return n.forEach(function(s) {
|
|
1388
|
-
return _e(e, s);
|
|
1333
|
+
}()), c(A), A.restore(), A;
|
|
1334
|
+
} }, { key: "render", value: function() {
|
|
1335
|
+
var i = Te(arguments);
|
|
1336
|
+
if (i.d3) return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
|
|
1337
|
+
if (i.ctx) return this.canvas(i.ctx, i.fn);
|
|
1338
|
+
if (i.text) {
|
|
1339
|
+
var c = typeof i.text.render == "function" ? i.text.render() : i.text;
|
|
1340
|
+
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
|
|
1341
|
+
}
|
|
1342
|
+
} }], o && $n(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1343
|
+
}(), Pn = Object.prototype.hasOwnProperty, oe = {};
|
|
1344
|
+
function zn(e) {
|
|
1345
|
+
return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
|
|
1346
|
+
return o + "-" + i.toLowerCase();
|
|
1347
|
+
})), oe[e];
|
|
1348
|
+
}
|
|
1349
|
+
function De(e, n) {
|
|
1350
|
+
if (Array.isArray(n)) return n.forEach(function(o) {
|
|
1351
|
+
return De(e, o);
|
|
1389
1352
|
});
|
|
1390
|
-
|
|
1391
|
-
}
|
|
1392
|
-
function Ie(e, n) {
|
|
1393
|
-
if (typeof document < "u") {
|
|
1394
|
-
var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1395
|
-
if (n && s.setAttribute)
|
|
1396
|
-
for (var i in n)
|
|
1397
|
-
On.call(n, i) && n[i] != null && s.setAttribute(i === "className" ? "class" : Ln(i), n[i]);
|
|
1398
|
-
for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
|
|
1399
|
-
p[w - 2] = arguments[w];
|
|
1400
|
-
return p != null && p.length && p.forEach(function(x) {
|
|
1401
|
-
_e(s, x);
|
|
1402
|
-
}), s;
|
|
1353
|
+
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1403
1354
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
var I = c.length, L = un[O];
|
|
1413
|
-
if (I && L) {
|
|
1414
|
-
for (var B = I - 1; c[B] && (c[B] instanceof Dt || on.test(c[B].value)); )
|
|
1415
|
-
B--;
|
|
1416
|
-
for (; L && c[B] && c[B] instanceof et; )
|
|
1417
|
-
B--, L--;
|
|
1418
|
-
for (; L-- > 0; )
|
|
1419
|
-
c.push(new et());
|
|
1355
|
+
function Me(e, n) {
|
|
1356
|
+
if (typeof document < "u") {
|
|
1357
|
+
var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1358
|
+
if (n && o.setAttribute) for (var i in n) Pn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : zn(i), n[i]);
|
|
1359
|
+
for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), A = 2; A < c; A++) p[A - 2] = arguments[A];
|
|
1360
|
+
return p != null && p.length && p.forEach(function(x) {
|
|
1361
|
+
De(o, x);
|
|
1362
|
+
}), o;
|
|
1420
1363
|
}
|
|
1421
|
-
}; e.length; ) {
|
|
1422
|
-
if (n = /^[^<]+/.exec(e))
|
|
1423
|
-
Bt(we(n[0]), !1).forEach(w);
|
|
1424
|
-
else if (!(n = hn.exec(e)))
|
|
1425
|
-
if (n = an.exec(e))
|
|
1426
|
-
p.length && (i = p.pop()), x(n[1]);
|
|
1427
|
-
else if (n = ln.exec(e)) {
|
|
1428
|
-
var k = n[1];
|
|
1429
|
-
x(k), p.push(i), i = Object.create(i), xe[k] && xe[k](i, "");
|
|
1430
|
-
var S = pn(n[2]);
|
|
1431
|
-
k === "a" && (S.href && (i.href = S.href), S.rel && (i.rel = S.rel), S.target && (i.target = S.target)), S.class && (i.class = i.class ? i.class + " " + S.class : S.class), S.style && (s = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(S.style)) && s[1] && (i.color = s[1]), k === "br" && c.push(new et());
|
|
1432
|
-
} else
|
|
1433
|
-
n = [e.slice(0, 1)], w(new F(n[0]));
|
|
1434
|
-
e = e.slice(n[0].length);
|
|
1435
1364
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
return c
|
|
1461
|
-
},
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1365
|
+
it.createElement = Me, it.textparser = qt, it.defaultparser = qt, it.htmlparser = function(e) {
|
|
1366
|
+
e = String(e || "").trim();
|
|
1367
|
+
for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], A = function(O) {
|
|
1368
|
+
for (var _ in i) i[_] && (O[_] = i[_]);
|
|
1369
|
+
c.push(O);
|
|
1370
|
+
}, x = function(O) {
|
|
1371
|
+
var _ = c.length, L = gn[O];
|
|
1372
|
+
if (_ && L) {
|
|
1373
|
+
for (var B = _ - 1; c[B] && (c[B] instanceof Ot || cn.test(c[B].value)); ) B--;
|
|
1374
|
+
for (; L && c[B] && c[B] instanceof et; ) B--, L--;
|
|
1375
|
+
for (; L-- > 0; ) c.push(new et());
|
|
1376
|
+
}
|
|
1377
|
+
}; e.length; ) {
|
|
1378
|
+
if (n = /^[^<]+/.exec(e)) qt(Ae(n[0]), !1).forEach(A);
|
|
1379
|
+
else if (!(n = fn.exec(e))) if (n = un.exec(e)) p.length && (i = p.pop()), x(n[1]);
|
|
1380
|
+
else if (n = dn.exec(e)) {
|
|
1381
|
+
var S = n[1];
|
|
1382
|
+
x(S), p.push(i), i = Object.create(i), be[S] && be[S](i, "");
|
|
1383
|
+
var T = vn(n[2]);
|
|
1384
|
+
S === "a" && (T.href && (i.href = T.href), T.rel && (i.rel = T.rel), T.target && (i.target = T.target)), T.class && (i.class = i.class ? i.class + " " + T.class : T.class), T.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(T.style)) && o[1] && (i.color = o[1]), S === "br" && c.push(new et());
|
|
1385
|
+
} else n = [e.slice(0, 1)], A(new q(n[0]));
|
|
1386
|
+
e = e.slice(n[0].length);
|
|
1387
|
+
}
|
|
1388
|
+
for (var M = c[c.length - 1]; M instanceof et; ) c.pop(), M = c[c.length - 1];
|
|
1389
|
+
return c;
|
|
1390
|
+
}, it.latexparser = function(e) {
|
|
1391
|
+
e = String(e || "").trim();
|
|
1392
|
+
var n = [0];
|
|
1393
|
+
e = e.replace(/\\verb,(.*?),/, function(H, P) {
|
|
1394
|
+
return n.push(P), "\\verb," + (n.length - 1) + ",";
|
|
1395
|
+
}).replace(/\\\\\n/g, function() {
|
|
1396
|
+
return "\\\\";
|
|
1397
|
+
}).replace(En, function(H, P, j) {
|
|
1398
|
+
return j.charAt(P - 1) === "\\" ? H : kn[H];
|
|
1399
|
+
}).replace(/\n\s+/g, function(H) {
|
|
1400
|
+
return /\n/.test(H.slice(1)) ? "\\par " : H;
|
|
1401
|
+
}).replace(/\\symbol\{(\d+)\}/, function(H, P, j, F) {
|
|
1402
|
+
return F.charAt(j - 1) === "\\" ? H : String.fromCharCode(1 * P);
|
|
1403
|
+
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(H, P, j, F) {
|
|
1404
|
+
return P + j + "{" + F + "}";
|
|
1405
|
+
}).replace(/\\verb,(.*?),/, function(H, P) {
|
|
1406
|
+
return "\\verb,".concat(n[+P], ",");
|
|
1407
|
+
});
|
|
1408
|
+
for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], A = function(H) {
|
|
1409
|
+
for (var P in i) i[P] && (H[P] = i[P]);
|
|
1410
|
+
return c.push(H), H;
|
|
1411
|
+
}, x = function() {
|
|
1412
|
+
p.push(i), i = Object.create(i);
|
|
1413
|
+
}, S = function() {
|
|
1414
|
+
if (!p.length) throw new Error("Unexpected }");
|
|
1415
|
+
i = p.pop();
|
|
1416
|
+
}, T = { tokens: c, open_context: x, close_context: S, add_token: A }; e.length; ) {
|
|
1417
|
+
if (o = bn.exec(e)) qt(o[0], !1).forEach(A);
|
|
1418
|
+
else if (o = An.exec(e)) A(new q(o[1]));
|
|
1419
|
+
else if (!(o = wn.exec(e))) {
|
|
1420
|
+
if (o = /^\{/.exec(e)) x();
|
|
1421
|
+
else if (o = /^\}/.exec(e)) S();
|
|
1422
|
+
else if (!(o = /^\$/.exec(e))) if (o = /^\\verb,([^,]+),/.exec(e)) A(new q(o[1]));
|
|
1423
|
+
else if (o = xn.exec(e)) {
|
|
1424
|
+
var M = o[1].slice(1) || o[1], O = !!o[2];
|
|
1482
1425
|
if (/^(La)?TeX$/i.test(M)) {
|
|
1483
1426
|
x(), i.family = "serif";
|
|
1484
|
-
var
|
|
1485
|
-
M === "LaTeX" && ((
|
|
1486
|
-
} else if (M in
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
var L = [], B = U[M].length - 1, J = void 0;
|
|
1427
|
+
var _ = void 0;
|
|
1428
|
+
M === "LaTeX" && ((_ = A(new q("L"))).tracking = -0.25, (_ = A(new q("A"))).size = 0.7, _.baseline = 0.3, _.tracking = -0.1), (_ = A(new q("T"))).tracking = -0.17, (_ = A(new q("E"))).baseline = -0.22, _.tracking = -0.13, _ = A(new q("X")), S();
|
|
1429
|
+
} else if (M in Ee) A(new q(Ee[M])), O && x();
|
|
1430
|
+
else if (M in G) {
|
|
1431
|
+
var L = [], B = G[M].length - 1, J = void 0;
|
|
1490
1432
|
if (B) {
|
|
1491
|
-
for (O = !1, e = e.slice(
|
|
1492
|
-
if (!(J = /^\{([^}]+)\}/.exec(e)))
|
|
1493
|
-
throw new Error(M + " is missing an argument");
|
|
1433
|
+
for (O = !1, e = e.slice(o[0].length - 1); B--; ) {
|
|
1434
|
+
if (!(J = /^\{([^}]+)\}/.exec(e))) throw new Error(M + " is missing an argument");
|
|
1494
1435
|
L.push(J[1]), e = e.slice(J[0].length);
|
|
1495
1436
|
}
|
|
1496
|
-
|
|
1437
|
+
o[0] = /^\{/.exec(e) ? "{" : "", O = !!o[0];
|
|
1497
1438
|
}
|
|
1498
|
-
O && x(),
|
|
1499
|
-
} else
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1439
|
+
O && x(), G[M].apply(T, [i].concat(L));
|
|
1440
|
+
} else console.warn("unknown latex command", M), A(new q(o[1])), O && x();
|
|
1441
|
+
} else o = [e.slice(0, 1)], A(new q(o[0]));
|
|
1442
|
+
}
|
|
1443
|
+
e = e.slice(o[0].length);
|
|
1503
1444
|
}
|
|
1504
|
-
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
function he(a) {
|
|
1445
|
+
return c;
|
|
1446
|
+
}, it.measureText = function(e, n, o) {
|
|
1447
|
+
return z(e, w(n), o);
|
|
1448
|
+
}, it.Token = q, it.Break = Ot, it.LineBreak = et, it.SoftHyphen = yt, it.Rotator = Ie, Ie.createElement = Me;
|
|
1449
|
+
const Nn = it;
|
|
1450
|
+
return r.default;
|
|
1451
|
+
})());
|
|
1452
|
+
}(Yt)), Yt.exports;
|
|
1453
|
+
}
|
|
1454
|
+
var ur = cr();
|
|
1455
|
+
const Be = /* @__PURE__ */ en(ur);
|
|
1456
|
+
function ue(a) {
|
|
1517
1457
|
return a.replace(/…$/, "");
|
|
1518
1458
|
}
|
|
1519
|
-
function
|
|
1459
|
+
function de(a) {
|
|
1520
1460
|
return a.children[0].innerHTML;
|
|
1521
1461
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const t = ut(a), { fontSize: r, font:
|
|
1524
|
-
if (t.width === t.height && t.width === 0)
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
height: t.height - l * 2,
|
|
1462
|
+
function dr(a, l) {
|
|
1463
|
+
const t = ut(a), { fontSize: r, font: s, padding: h = 0 } = a.properties.style || {};
|
|
1464
|
+
if (t.width === t.height && t.width === 0) return;
|
|
1465
|
+
const u = new Be({
|
|
1466
|
+
font: `${r}px/${r}px ${s}`.replace(/(px)+/g, "px"),
|
|
1467
|
+
width: t.width - h * 2,
|
|
1468
|
+
height: t.height - h * 2,
|
|
1530
1469
|
align: "left",
|
|
1531
1470
|
valign: "top",
|
|
1532
1471
|
x: 0,
|
|
1533
1472
|
overflow: "ellipsis",
|
|
1534
1473
|
parser: "html",
|
|
1535
|
-
createElement:
|
|
1474
|
+
createElement: Be.createElement
|
|
1536
1475
|
});
|
|
1537
1476
|
u.overflowWrap("break-word");
|
|
1538
1477
|
const g = u.linebreak(
|
|
@@ -1542,65 +1481,65 @@ function ti(a, h) {
|
|
|
1542
1481
|
let y = 0;
|
|
1543
1482
|
const v = [];
|
|
1544
1483
|
a.properties.content.split(`
|
|
1545
|
-
`).forEach((
|
|
1546
|
-
let
|
|
1547
|
-
for (;
|
|
1484
|
+
`).forEach((w) => {
|
|
1485
|
+
let $ = w;
|
|
1486
|
+
for (; $.length && y < f.length; ) {
|
|
1548
1487
|
if (f[y].innerHTML === " ") {
|
|
1549
|
-
|
|
1488
|
+
$.startsWith(`
|
|
1550
1489
|
`) || v.push(y), y++;
|
|
1551
1490
|
break;
|
|
1552
1491
|
}
|
|
1553
|
-
const E =
|
|
1554
|
-
|
|
1492
|
+
const E = ue(de(f[y]));
|
|
1493
|
+
$.startsWith(E) && ($ = $.slice(E.length).trim()), y++;
|
|
1555
1494
|
}
|
|
1556
|
-
}), v.forEach((
|
|
1557
|
-
const
|
|
1558
|
-
g.setAttribute("transform", `translate(${
|
|
1559
|
-
let
|
|
1495
|
+
}), v.forEach((w) => g.removeChild(f[w]));
|
|
1496
|
+
const k = a.properties.content.match(/(https?:\/\/.*)/gm), b = k ? k.map((w) => w.split(" ")[0]) : [];
|
|
1497
|
+
g.setAttribute("transform", `translate(${h}, ${h})`), b.forEach((w) => {
|
|
1498
|
+
let $ = w;
|
|
1560
1499
|
const E = [];
|
|
1561
|
-
for (;
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1500
|
+
for (; $.length > 0; ) {
|
|
1501
|
+
const C = f.find(
|
|
1502
|
+
(D) => !!D.children[0] && D.children[0].tagName === "tspan" && $.startsWith(ue(de(D)))
|
|
1503
|
+
);
|
|
1504
|
+
if (!C) break;
|
|
1505
|
+
E.push(C);
|
|
1506
|
+
const N = ue(C.children[0].innerHTML).length;
|
|
1507
|
+
if (!N) break;
|
|
1508
|
+
$ = $.slice(N);
|
|
1570
1509
|
}
|
|
1571
|
-
E.forEach((
|
|
1510
|
+
E.forEach((C) => {
|
|
1572
1511
|
const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1573
|
-
N.setAttribute("href",
|
|
1512
|
+
N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML = de(C), C.children[0].innerHTML = "", C.children[0].appendChild(N);
|
|
1574
1513
|
});
|
|
1575
|
-
}),
|
|
1514
|
+
}), l.appendChild(g);
|
|
1576
1515
|
}
|
|
1577
|
-
const
|
|
1578
|
-
class
|
|
1516
|
+
const je = 20;
|
|
1517
|
+
class fr extends rn {
|
|
1579
1518
|
constructor(t, r = {}) {
|
|
1580
1519
|
super(
|
|
1581
1520
|
t,
|
|
1582
1521
|
`
|
|
1583
|
-
<div class="annotation-text-handle">
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1522
|
+
<div class="annotation-text-handle" data-handle-id="8">
|
|
1523
|
+
<span class="handle line-handle top" data-handle-id="0"></span>
|
|
1524
|
+
<span class="handle line-handle bottom" data-handle-id="1"></span>
|
|
1525
|
+
<span class="handle line-handle left" data-handle-id="2"></span>
|
|
1526
|
+
<span class="handle line-handle right" data-handle-id="3"></span>
|
|
1527
|
+
<span class="handle top right point-handle top-right" data-handle-id="4"></span>
|
|
1528
|
+
<span class="handle left top point-handle top-left" data-handle-id="5"></span>
|
|
1529
|
+
<span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
|
|
1530
|
+
<span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
|
|
1531
|
+
<textarea wrap="on"></textarea>
|
|
1593
1532
|
</div>
|
|
1594
1533
|
`
|
|
1595
1534
|
);
|
|
1596
1535
|
m(this, "textArea");
|
|
1597
1536
|
m(this, "handleSize");
|
|
1598
1537
|
m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
|
|
1599
|
-
m(this, "annotation", { ...
|
|
1538
|
+
m(this, "annotation", { ...ce });
|
|
1600
1539
|
m(this, "startX", 0);
|
|
1601
1540
|
m(this, "startY", 0);
|
|
1602
1541
|
m(this, "handles", []);
|
|
1603
|
-
m(this, "draggedHandle",
|
|
1542
|
+
m(this, "draggedHandle", W);
|
|
1604
1543
|
m(this, "isFocused", !1);
|
|
1605
1544
|
m(this, "placeholder", "Type your text here...");
|
|
1606
1545
|
m(this, "_onFocus", () => {
|
|
@@ -1609,196 +1548,195 @@ class ei extends Je {
|
|
|
1609
1548
|
m(this, "_onBlur", () => {
|
|
1610
1549
|
this.isFocused = !1;
|
|
1611
1550
|
});
|
|
1612
|
-
m(this, "startDrawing", (t, r,
|
|
1613
|
-
this.add(
|
|
1614
|
-
const
|
|
1615
|
-
this.select(
|
|
1551
|
+
m(this, "startDrawing", (t, r, s = lr(t, r, 0, 0, "", _t)) => {
|
|
1552
|
+
this.add(s);
|
|
1553
|
+
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
|
|
1554
|
+
this.select(s.id), this.startDragging(this.getById(s.id), h.x, h.y), this.draggedHandle = 6;
|
|
1616
1555
|
});
|
|
1617
1556
|
m(this, "cancelDrawing", () => {
|
|
1618
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
1557
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ce }, this.draggedHandle = W, this.isDragging = !1, this.emit(It, this.annotation));
|
|
1619
1558
|
});
|
|
1620
|
-
m(this, "startDragging", (t, r,
|
|
1559
|
+
m(this, "startDragging", (t, r, s) => {
|
|
1621
1560
|
this.annotation = t;
|
|
1622
|
-
const
|
|
1623
|
-
this.rect.x =
|
|
1561
|
+
const h = ct(this.annotation), u = ut(this.annotation);
|
|
1562
|
+
this.rect.x = h.x, this.rect.y = h.y, this.rect.width = u.width, this.rect.height = u.height, this.startX = r, this.startY = s, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Jt, this.annotation), this.isDragging = !0;
|
|
1624
1563
|
});
|
|
1625
1564
|
m(this, "onHandleMouseDown", (t) => {
|
|
1626
1565
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1627
|
-
if (!r)
|
|
1628
|
-
return;
|
|
1566
|
+
if (!r) return;
|
|
1629
1567
|
this.selectedId !== r.id && this.select(this.hoveredId);
|
|
1630
|
-
const { x:
|
|
1631
|
-
this.startDragging(r,
|
|
1568
|
+
const { x: s, y: h } = fe(t, this.ogma.getContainer());
|
|
1569
|
+
this.startDragging(r, s, h), this.draggedHandle = Ze(t.target);
|
|
1632
1570
|
});
|
|
1633
1571
|
m(this, "onMouseMove", (t) => {
|
|
1634
1572
|
requestAnimationFrame(() => this._onMouseMove(t));
|
|
1635
1573
|
});
|
|
1636
1574
|
m(this, "_onMouseMove", (t) => {
|
|
1637
|
-
if (!this.isDragging)
|
|
1638
|
-
return;
|
|
1575
|
+
if (!this.isDragging) return;
|
|
1639
1576
|
t.stopPropagation(), t.preventDefault();
|
|
1640
|
-
const r = this.handles[this.draggedHandle]
|
|
1577
|
+
const r = this.handles[this.draggedHandle];
|
|
1578
|
+
let s = r.classList.contains("top");
|
|
1579
|
+
const h = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom");
|
|
1580
|
+
let g = r.classList.contains("line-handle");
|
|
1581
|
+
!g && !s && !d && !h && !u && (s = !0, g = !0);
|
|
1582
|
+
const { x: f, y } = fe(
|
|
1641
1583
|
t,
|
|
1642
1584
|
this.ogma.getContainer()
|
|
1643
|
-
), v = this.ogma.view.getZoom(), T = (f - this.startX) / v, A = (y - this.startY) / v, b = this.ogma.view.getAngle(), C = rt({ x: T, y: A }, b);
|
|
1644
|
-
(d && l || o && u) && (C.y = 0, C.x = 0);
|
|
1645
|
-
const E = l || g ? this.rect.x + C.x : this.rect.x, $ = o || g ? this.rect.y + C.y : this.rect.y, N = Math.max(
|
|
1646
|
-
this.rect.width + T * (g || l ? 0 : 1),
|
|
1647
|
-
Ne
|
|
1648
|
-
), _ = Math.max(
|
|
1649
|
-
this.rect.height + A * (g || o ? 0 : 1),
|
|
1650
|
-
Ne
|
|
1651
1585
|
);
|
|
1652
|
-
|
|
1586
|
+
let v = this.rect.x, k = this.rect.y, b = Math.max(this.rect.width, je), w = Math.max(this.rect.height, je);
|
|
1587
|
+
const $ = this.ogma.view.getZoom(), E = (f - this.startX) / $, C = (y - this.startY) / $, N = this.ogma.view.getAngle(), D = rt({ x: E, y: C }, N), z = rt({ x: E, y: C }, -N);
|
|
1588
|
+
g ? (v = this.rect.x + D.x, k = this.rect.y + D.y) : h && s ? (v += D.x, k += D.y, b -= E, w -= C) : u && d ? (b += E, w += C) : h && d ? (v += z.x, b -= z.x, w += z.y) : u && s && (k += z.y, b += z.x, w -= z.y), Vn(this.annotation, v, k, b, w), this.emit(Kt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
1653
1589
|
});
|
|
1654
1590
|
m(this, "onMouseUp", () => {
|
|
1655
|
-
!this.isDragging || this.draggedHandle ===
|
|
1591
|
+
!this.isDragging || this.draggedHandle === W || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(It, this.annotation), this.isDragging = !1, this.draggedHandle = W);
|
|
1656
1592
|
});
|
|
1657
1593
|
m(this, "_onMousedown", (t) => {
|
|
1658
1594
|
t.stopPropagation();
|
|
1659
1595
|
});
|
|
1660
1596
|
m(this, "onViewChanged", () => {
|
|
1661
1597
|
const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
|
|
1662
|
-
document.documentElement.style.setProperty("--handle-scale", `${1 / t}`);
|
|
1598
|
+
document.documentElement.style.setProperty("--handle-scale", `${1 / t}`), this.ogma.view.getAngle() === 0 ? this.editor.element.classList.remove("rotated") : this.editor.element.classList.add("rotated");
|
|
1663
1599
|
});
|
|
1664
1600
|
m(this, "_onInput", () => {
|
|
1665
1601
|
const t = this.getById(this.selectedId);
|
|
1666
|
-
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(
|
|
1602
|
+
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ve, t), this.layer.refresh());
|
|
1667
1603
|
});
|
|
1668
|
-
this.showeditorOnHover = !1, this.handleSize =
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1604
|
+
this.showeditorOnHover = !1, this.handleSize = Re.handleSize || r.textHandleSize, this.placeholder = Re.placeholder || r.textPlaceholder || "";
|
|
1605
|
+
const s = this.textArea = this.editor.element.querySelector("textarea");
|
|
1606
|
+
s.addEventListener("input", this._onInput), s.addEventListener("focus", this._onFocus), s.addEventListener("blur", this._onBlur), s.addEventListener("mousedown", this._onMousedown), s.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
1671
1607
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
1672
|
-
), this.handles.forEach(
|
|
1673
|
-
(
|
|
1608
|
+
), this.handles.push(this.editor.element), this.handles.forEach(
|
|
1609
|
+
(h) => h.addEventListener("mousedown", this.onHandleMouseDown)
|
|
1674
1610
|
), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
|
|
1675
1611
|
}
|
|
1676
1612
|
_canRemove() {
|
|
1677
1613
|
return !this.isFocused;
|
|
1678
1614
|
}
|
|
1679
|
-
detect({ x: t, y: r },
|
|
1680
|
-
const
|
|
1615
|
+
detect({ x: t, y: r }, s = 0) {
|
|
1616
|
+
const h = { x: t, y: r }, u = this.ogma.view.getAngle();
|
|
1681
1617
|
return this.elements.find((d) => {
|
|
1682
|
-
const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d),
|
|
1683
|
-
return
|
|
1618
|
+
const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), k = { x: g, y: f }, { x: b, y: w } = rt(wt(h, k), -u);
|
|
1619
|
+
return b > -s && b < y + s && w > -s && w < v + s;
|
|
1684
1620
|
});
|
|
1685
1621
|
}
|
|
1686
1622
|
draw(t) {
|
|
1687
1623
|
t.innerHTML = "";
|
|
1688
|
-
const r = "",
|
|
1689
|
-
this.elements.
|
|
1690
|
-
const g = `class${
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1624
|
+
const r = "", s = this.ogma.view.getAngle();
|
|
1625
|
+
for (let u = 0; u < this.elements.length; u++) {
|
|
1626
|
+
const d = this.elements[u], g = `class${u}`, f = ut(d), y = ct(d);
|
|
1627
|
+
if (d.id === this.selectedId) continue;
|
|
1628
|
+
const {
|
|
1629
|
+
color: k,
|
|
1630
|
+
fontSize: b,
|
|
1631
|
+
font: w,
|
|
1632
|
+
strokeColor: $,
|
|
1695
1633
|
strokeWidth: E,
|
|
1696
|
-
strokeType:
|
|
1697
|
-
background: N
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
l.innerHTML = r, t.firstChild && t.insertBefore(l, t.firstChild);
|
|
1634
|
+
strokeType: C,
|
|
1635
|
+
background: N,
|
|
1636
|
+
borderRadius: D
|
|
1637
|
+
} = d.properties.style || _t, z = xt("g");
|
|
1638
|
+
z.classList.add("annotation-text"), z.setAttribute("fill", `${k}`), z.setAttribute("font-size", `${b}px`), z.setAttribute("font-family", `${w}`);
|
|
1639
|
+
const R = xt("rect");
|
|
1640
|
+
D && (R.setAttribute("rx", `${D}`), R.setAttribute("ry", `${D}`));
|
|
1641
|
+
let dt = !1;
|
|
1642
|
+
C && C !== "none" && (dt = !0, R.setAttribute("stroke", $ || "black"), R.setAttribute("stroke-width", `${E}`), C === "dashed" && R.setAttribute("stroke-dasharray", "5,5")), (N && N.length || dt) && (dt = !0, R.setAttribute("fill", N || "transparent")), dt && (R.setAttribute("width", `${f.width}`), R.setAttribute("height", `${f.height}`)), z.appendChild(R), dr(d, z);
|
|
1643
|
+
const { x: Dt, y: Mt } = rt(y, -s);
|
|
1644
|
+
z.setAttribute("transform", `translate(${Dt},${Mt})`), z.classList.add(g), z.setAttribute("data-annotation", `${d.id}`), z.setAttribute("data-annotation-type", "text"), t.appendChild(z);
|
|
1645
|
+
}
|
|
1646
|
+
const h = xt("style");
|
|
1647
|
+
h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
|
|
1711
1648
|
}
|
|
1712
1649
|
refreshDrawing() {
|
|
1713
|
-
const t = this.ogma.view.getAngle();
|
|
1714
|
-
|
|
1715
|
-
const
|
|
1716
|
-
if (!
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
});
|
|
1650
|
+
const t = this.ogma.view.getAngle(), r = this.layer.element.children;
|
|
1651
|
+
for (let s = 0; s < r.length; s++) {
|
|
1652
|
+
const h = r[s];
|
|
1653
|
+
if (!h.hasAttribute("data-annotation")) continue;
|
|
1654
|
+
const u = h.getAttribute("data-annotation"), d = ct(this.getById(u)), { x: g, y: f } = rt(d, -t);
|
|
1655
|
+
h.setAttribute("transform", `translate(${g},${f})`);
|
|
1656
|
+
}
|
|
1721
1657
|
}
|
|
1722
1658
|
getDefaultOptions() {
|
|
1723
|
-
return
|
|
1659
|
+
return ce;
|
|
1724
1660
|
}
|
|
1725
1661
|
refreshEditor() {
|
|
1726
|
-
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
1727
|
-
|
|
1728
|
-
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), o = this.ogma.view.graphToScreenCoordinates(
|
|
1662
|
+
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
1663
|
+
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), s = this.ogma.view.graphToScreenCoordinates(
|
|
1729
1664
|
ct(t)
|
|
1730
|
-
),
|
|
1665
|
+
), h = this.ogma.view.getZoom(), {
|
|
1731
1666
|
font: u,
|
|
1732
1667
|
fontSize: d,
|
|
1733
1668
|
color: g,
|
|
1734
1669
|
background: f,
|
|
1735
1670
|
padding: y = 0
|
|
1736
|
-
} = t.properties.style ||
|
|
1737
|
-
this.textArea.value = t.properties.content
|
|
1671
|
+
} = t.properties.style || _t, v = (d || 1) * h;
|
|
1672
|
+
this.textArea.value = t.properties.content;
|
|
1673
|
+
const k = this.editor.element.style;
|
|
1674
|
+
k.transform = `translate(${s.x}px, ${s.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, k.width = `${r.width * h}px`, k.height = `${r.height * h}px`;
|
|
1675
|
+
const b = this.textArea.style;
|
|
1676
|
+
b.font = `${v} ${u}`, b.fontFamily = u || "sans-serif", b.fontSize = `${v}px`, b.padding = `${h * y}px`, b.lineHeight = `${v}px`, b.boxSizing = "border-box", b.color = g || "black", b.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
|
|
1738
1677
|
}
|
|
1739
1678
|
select(t) {
|
|
1740
|
-
super.select(t), this.textArea.
|
|
1679
|
+
super.select(t), this.textArea.classList.add("noevents");
|
|
1741
1680
|
}
|
|
1742
1681
|
destroy() {
|
|
1743
1682
|
super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
|
|
1744
1683
|
}
|
|
1745
1684
|
}
|
|
1746
|
-
class
|
|
1685
|
+
class pr {
|
|
1747
1686
|
constructor() {
|
|
1748
1687
|
m(this, "links", {});
|
|
1749
1688
|
m(this, "linksByTargetId", {});
|
|
1750
1689
|
m(this, "linksByArrowId", {});
|
|
1751
1690
|
}
|
|
1752
|
-
add(
|
|
1753
|
-
const u =
|
|
1691
|
+
add(l, t, r, s, h) {
|
|
1692
|
+
const u = Qt(), d = l.id, g = {
|
|
1754
1693
|
id: u,
|
|
1755
1694
|
arrow: d,
|
|
1756
1695
|
target: r,
|
|
1757
|
-
targetType:
|
|
1758
|
-
connectionPoint:
|
|
1696
|
+
targetType: s,
|
|
1697
|
+
connectionPoint: h,
|
|
1759
1698
|
side: t
|
|
1760
1699
|
};
|
|
1761
|
-
return this.links[u] = g, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(u), this.linksByArrowId[d] || (this.linksByArrowId[d] = {}), this.linksByArrowId[d][t] = u,
|
|
1700
|
+
return this.links[u] = g, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(u), this.linksByArrowId[d] || (this.linksByArrowId[d] = {}), this.linksByArrowId[d][t] = u, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
|
|
1762
1701
|
id: r,
|
|
1763
1702
|
side: t,
|
|
1764
|
-
type:
|
|
1765
|
-
magnet:
|
|
1703
|
+
type: s,
|
|
1704
|
+
magnet: h
|
|
1766
1705
|
}, this;
|
|
1767
1706
|
}
|
|
1768
|
-
arrowIsLinked(
|
|
1707
|
+
arrowIsLinked(l, t) {
|
|
1769
1708
|
var r;
|
|
1770
|
-
return !!((r = this.linksByArrowId[
|
|
1709
|
+
return !!((r = this.linksByArrowId[l]) != null && r[t]);
|
|
1771
1710
|
}
|
|
1772
1711
|
// remove the link between the arrow and the target by arrow id and side
|
|
1773
|
-
remove(
|
|
1712
|
+
remove(l, t) {
|
|
1774
1713
|
var d, g;
|
|
1775
|
-
const r =
|
|
1776
|
-
if ((g =
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
const u = this.linksByTargetId[l.target];
|
|
1714
|
+
const r = l.id, s = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
|
|
1715
|
+
if ((g = l.properties.link) == null || delete g[t], !s) return this;
|
|
1716
|
+
const h = this.links[s];
|
|
1717
|
+
delete this.links[s];
|
|
1718
|
+
const u = this.linksByTargetId[h.target];
|
|
1781
1719
|
for (let f = 0; f < u.length; f++)
|
|
1782
|
-
if (u[f] ===
|
|
1720
|
+
if (u[f] === s) {
|
|
1783
1721
|
u.splice(f, 1);
|
|
1784
1722
|
break;
|
|
1785
1723
|
}
|
|
1786
1724
|
return delete this.linksByArrowId[r][t], this;
|
|
1787
1725
|
}
|
|
1788
|
-
getArrowLink(
|
|
1789
|
-
var
|
|
1790
|
-
const r = (
|
|
1726
|
+
getArrowLink(l, t) {
|
|
1727
|
+
var s;
|
|
1728
|
+
const r = (s = this.linksByArrowId[l]) == null ? void 0 : s[t];
|
|
1791
1729
|
return r ? this.links[r] : null;
|
|
1792
1730
|
}
|
|
1793
|
-
getTargetLinks(
|
|
1731
|
+
getTargetLinks(l, t) {
|
|
1794
1732
|
var r;
|
|
1795
|
-
return ((r = this.linksByTargetId[
|
|
1733
|
+
return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((s) => this.links[s]).filter((s) => s.targetType === t)) ?? [];
|
|
1796
1734
|
}
|
|
1797
|
-
forEach(
|
|
1798
|
-
Object.values(this.links).forEach(
|
|
1735
|
+
forEach(l) {
|
|
1736
|
+
Object.values(this.links).forEach(l);
|
|
1799
1737
|
}
|
|
1800
1738
|
}
|
|
1801
|
-
const st = (a) => a.properties.type === "arrow",
|
|
1739
|
+
const st = (a) => a.properties.type === "arrow", gt = (a) => a.properties.type === "text", Ve = (a) => a.type === "FeatureCollection", gr = {
|
|
1802
1740
|
magnetColor: "#3e8",
|
|
1803
1741
|
detectMargin: 20,
|
|
1804
1742
|
magnetHandleRadius: 5,
|
|
@@ -1808,7 +1746,7 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
|
|
|
1808
1746
|
textHandleSize: 3.5,
|
|
1809
1747
|
minArrowHeight: 20,
|
|
1810
1748
|
maxArrowHeight: 30
|
|
1811
|
-
},
|
|
1749
|
+
}, Ue = ["start", "end"], We = [
|
|
1812
1750
|
{ x: 0, y: 0 },
|
|
1813
1751
|
{ x: 0.5, y: 0 },
|
|
1814
1752
|
{ x: 1, y: 0 },
|
|
@@ -1818,12 +1756,12 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
|
|
|
1818
1756
|
{ x: 0.5, y: 1 },
|
|
1819
1757
|
{ x: 1, y: 1 }
|
|
1820
1758
|
];
|
|
1821
|
-
class
|
|
1759
|
+
class vr extends nn {
|
|
1822
1760
|
constructor(t, r = {}) {
|
|
1823
1761
|
super();
|
|
1824
1762
|
m(this, "arrows");
|
|
1825
1763
|
m(this, "texts");
|
|
1826
|
-
m(this, "links", new
|
|
1764
|
+
m(this, "links", new pr());
|
|
1827
1765
|
m(this, "layer");
|
|
1828
1766
|
m(this, "annotations");
|
|
1829
1767
|
m(this, "ogma");
|
|
@@ -1835,77 +1773,74 @@ class oi extends Ke {
|
|
|
1835
1773
|
m(this, "textToMagnet");
|
|
1836
1774
|
m(this, "activeLinks", []);
|
|
1837
1775
|
m(this, "_render", (t) => {
|
|
1838
|
-
if (!this.dragged || this.textToMagnet === void 0)
|
|
1839
|
-
return;
|
|
1776
|
+
if (!this.dragged || this.textToMagnet === void 0) return;
|
|
1840
1777
|
t.beginPath(), t.fillStyle = "green";
|
|
1841
1778
|
const r = this.ogma.view.getZoom();
|
|
1842
|
-
|
|
1843
|
-
if (!this.textToMagnet)
|
|
1844
|
-
|
|
1845
|
-
const l = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Ut(o, { x: l.width, y: l.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = Et(g, u);
|
|
1779
|
+
We.forEach((s) => {
|
|
1780
|
+
if (!this.textToMagnet) return;
|
|
1781
|
+
const h = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Wt(s, { x: h.width, y: h.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = St(g, u);
|
|
1846
1782
|
t.moveTo(f, y), t.arc(f, y, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
|
|
1847
1783
|
}), t.fill(), t.closePath();
|
|
1848
1784
|
});
|
|
1849
1785
|
m(this, "_onFeatureDrag", (t, r) => {
|
|
1850
|
-
const
|
|
1851
|
-
if (st(t) &&
|
|
1852
|
-
["start", "end"].find((
|
|
1853
|
-
const u =
|
|
1854
|
-
return this._snapToText(t,
|
|
1786
|
+
const s = r;
|
|
1787
|
+
if (st(t) && s === "line")
|
|
1788
|
+
["start", "end"].find((h) => {
|
|
1789
|
+
const u = h === "start" ? zt(t) : Xt(t);
|
|
1790
|
+
return this._snapToText(t, s, u) || this._findAndSnapToNode(t, h, u);
|
|
1855
1791
|
});
|
|
1856
|
-
else if (st(t) &&
|
|
1857
|
-
const
|
|
1858
|
-
this._snapToText(t,
|
|
1859
|
-
} else
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
this.layer.refresh(), this.emit(Xt, t, r);
|
|
1792
|
+
else if (st(t) && s !== "line") {
|
|
1793
|
+
const h = s === "start" ? zt(t) : Xt(t);
|
|
1794
|
+
this._snapToText(t, s, h) || this._findAndSnapToNode(t, s, h);
|
|
1795
|
+
} else gt(t) && (this.activeLinks.forEach(({ arrow: h, side: u, connectionPoint: d }) => {
|
|
1796
|
+
const g = this.getAnnotation(h), f = ut(t), y = ct(t), v = Wt(d, { x: f.width, y: f.height }), k = rt(v, this.ogma.view.getAngle()), b = St(k, y);
|
|
1797
|
+
g.geometry.coordinates[u === "start" ? 0 : 1] = [b.x, b.y];
|
|
1798
|
+
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
1799
|
+
this.layer.refresh(), this.emit(Kt, t, r);
|
|
1865
1800
|
});
|
|
1866
1801
|
m(this, "_onFeatureDragEnd", (t) => {
|
|
1867
|
-
this.dragged !== null && st(t) &&
|
|
1868
|
-
this.links.getArrowLink(t.id, r) && this.emit(
|
|
1802
|
+
this.dragged !== null && st(t) && zt(this.dragged) && Ue.forEach((r) => {
|
|
1803
|
+
this.links.getArrowLink(t.id, r) && this.emit(ir, {
|
|
1869
1804
|
arrow: t,
|
|
1870
1805
|
link: this.links.getArrowLink(t.id, r)
|
|
1871
1806
|
});
|
|
1872
|
-
}), (
|
|
1807
|
+
}), (gt(t) || st(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh(), this.emit(It, t);
|
|
1873
1808
|
});
|
|
1874
1809
|
m(this, "_onFeatureDragStart", (t) => {
|
|
1875
|
-
this.textToMagnet = void 0, st(t) ? this.dragged = t :
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
}), this.emit(
|
|
1810
|
+
this.textToMagnet = void 0, st(t) ? this.dragged = t : gt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
|
|
1811
|
+
const s = r.getSelectedFeature();
|
|
1812
|
+
s && s !== t && r.unhover().unselect(), r.disableDetection();
|
|
1813
|
+
}), this.emit(Jt, t);
|
|
1879
1814
|
});
|
|
1880
1815
|
m(this, "_onNodesDragStart", () => {
|
|
1881
1816
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
1882
1817
|
});
|
|
1883
1818
|
m(this, "_onNodesDrag", (t) => {
|
|
1884
|
-
const { dx: r, dy:
|
|
1885
|
-
this._moveNodes(t.nodes, r,
|
|
1819
|
+
const { dx: r, dy: s } = t;
|
|
1820
|
+
this._moveNodes(t.nodes, r, s);
|
|
1886
1821
|
});
|
|
1887
1822
|
m(this, "_onLayoutEnd", (t) => {
|
|
1888
|
-
t.ids.forEach((r,
|
|
1823
|
+
t.ids.forEach((r, s) => {
|
|
1889
1824
|
this.links.getTargetLinks(r, "node").forEach((u) => {
|
|
1890
|
-
const d = this.getAnnotation(u.arrow), g = u.side, f =
|
|
1825
|
+
const d = this.getAnnotation(u.arrow), g = u.side, f = Vt(
|
|
1891
1826
|
d,
|
|
1892
1827
|
g === "start" ? "end" : "start"
|
|
1893
|
-
), y = t.positions.current[
|
|
1894
|
-
|
|
1828
|
+
), y = t.positions.current[s], v = this.ogma.getNode(r).getAttribute("radius"), k = Ut(f, y, +v);
|
|
1829
|
+
kt(d, g, k.x, k.y);
|
|
1895
1830
|
});
|
|
1896
1831
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
1897
1832
|
});
|
|
1898
1833
|
m(this, "_onAdded", (t) => {
|
|
1899
|
-
this.emit(
|
|
1834
|
+
this.emit(me, t);
|
|
1900
1835
|
});
|
|
1901
1836
|
m(this, "_onRemoved", (t) => {
|
|
1902
|
-
this.emit(
|
|
1837
|
+
this.emit(ye, t);
|
|
1903
1838
|
});
|
|
1904
1839
|
m(this, "_onUnselect", (t) => {
|
|
1905
|
-
this.selected = null, this.emit(
|
|
1840
|
+
this.selected = null, this.emit(ge, t);
|
|
1906
1841
|
});
|
|
1907
1842
|
m(this, "_onSelect", (t) => {
|
|
1908
|
-
this.selected !== t && (this.selected = t, this.emit(
|
|
1843
|
+
this.selected !== t && (this.selected = t, this.emit(pe, this.selected));
|
|
1909
1844
|
});
|
|
1910
1845
|
/**
|
|
1911
1846
|
* Triggers the update event on the annotation
|
|
@@ -1917,61 +1852,59 @@ class oi extends Ke {
|
|
|
1917
1852
|
);
|
|
1918
1853
|
});
|
|
1919
1854
|
m(this, "_onUpdate", (t) => {
|
|
1920
|
-
this.emit(
|
|
1855
|
+
this.emit(ve, t);
|
|
1921
1856
|
});
|
|
1922
|
-
this.options = this.setOptions({ ...
|
|
1923
|
-
|
|
1857
|
+
this.options = this.setOptions({ ...gr, ...r }), this.ogma = t, this.arrows = new ar(t, this.options), this.texts = new fr(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((s) => {
|
|
1858
|
+
s.on(Jt, this._onFeatureDragStart).on(Kt, this._onFeatureDrag).on(It, this._onFeatureDragEnd).on(ve, this.onUpdate).on(ge, this._onUnselect).on(pe, this._onSelect).on(me, this._onAdded).on(ye, this._onRemoved);
|
|
1924
1859
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
1925
1860
|
this.refreshTextLinks();
|
|
1926
1861
|
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
1927
1862
|
}
|
|
1928
|
-
_moveNodes(t, r,
|
|
1929
|
-
t.forEach((
|
|
1930
|
-
const u = this.links.getTargetLinks(
|
|
1863
|
+
_moveNodes(t, r, s) {
|
|
1864
|
+
t.forEach((h) => {
|
|
1865
|
+
const u = this.links.getTargetLinks(h.getId(), "node"), d = h.getPosition();
|
|
1931
1866
|
u.forEach((g) => {
|
|
1932
|
-
const f = this.getAnnotation(g.arrow), y = g.side, v =
|
|
1867
|
+
const f = this.getAnnotation(g.arrow), y = g.side, v = Vt(
|
|
1933
1868
|
f,
|
|
1934
1869
|
y === "start" ? "end" : "start"
|
|
1935
1870
|
);
|
|
1936
|
-
let
|
|
1937
|
-
const
|
|
1938
|
-
(g.connectionPoint.x - (d.x - r) >
|
|
1871
|
+
let k = d;
|
|
1872
|
+
const b = +h.getAttribute("radius"), w = 1e-6;
|
|
1873
|
+
(g.connectionPoint.x - (d.x - r) > w || g.connectionPoint.y - (d.y - s) > w) && (k = Ut(v, d, b)), kt(f, y, k.x, k.y);
|
|
1939
1874
|
});
|
|
1940
1875
|
}), this.arrows.refreshLayer();
|
|
1941
1876
|
}
|
|
1942
|
-
_snapToText(t, r,
|
|
1943
|
-
const
|
|
1944
|
-
if (this.links.remove(t, r), !
|
|
1945
|
-
|
|
1946
|
-
this.
|
|
1947
|
-
|
|
1948
|
-
return u ? (At(t, r, u.point.x, u.point.y), this.links.add(t, r, l.id, "text", u.magnet), !0) : !1;
|
|
1877
|
+
_snapToText(t, r, s) {
|
|
1878
|
+
const h = this.texts.detect(s, this.options.detectMargin);
|
|
1879
|
+
if (this.links.remove(t, r), !h) return !1;
|
|
1880
|
+
this.textToMagnet = h;
|
|
1881
|
+
const u = this.findMagnetPoint(We, h, s);
|
|
1882
|
+
return u ? (kt(t, r, u.point.x, u.point.y), this.links.add(t, r, h.id, "text", u.magnet), !0) : !1;
|
|
1949
1883
|
}
|
|
1950
|
-
_findAndSnapToNode(t, r,
|
|
1884
|
+
_findAndSnapToNode(t, r, s) {
|
|
1951
1885
|
var d, g;
|
|
1952
|
-
const
|
|
1953
|
-
this.links.remove(t, r), u && u.isNode ? ((d = this.hoveredNode) == null || d.setSelected(!1), this.hoveredNode = u, u.setSelected(!0), this._snapToNode(t, r, u,
|
|
1886
|
+
const h = this.ogma.view.graphToScreenCoordinates(s), u = this.ogma.view.getElementAt(h);
|
|
1887
|
+
this.links.remove(t, r), u && u.isNode ? ((d = this.hoveredNode) == null || d.setSelected(!1), this.hoveredNode = u, u.setSelected(!0), this._snapToNode(t, r, u, h)) : ((g = this.hoveredNode) == null || g.setSelected(!1), this.hoveredNode = null);
|
|
1954
1888
|
}
|
|
1955
|
-
_snapToNode(t, r,
|
|
1956
|
-
const u =
|
|
1889
|
+
_snapToNode(t, r, s, h) {
|
|
1890
|
+
const u = s.getPositionOnScreen(), d = +s.getAttribute("radius"), g = d * this.ogma.view.getZoom(), f = h.x - u.x, y = h.y - u.y, v = Math.sqrt(f * f + y * y), k = s.getPosition();
|
|
1957
1891
|
if (v < g + this.options.detectMargin) {
|
|
1958
|
-
let
|
|
1892
|
+
let b = k;
|
|
1959
1893
|
if (v > g / 2) {
|
|
1960
|
-
const
|
|
1961
|
-
|
|
1894
|
+
const w = Vt(t, r === "end" ? "start" : "end");
|
|
1895
|
+
b = Ut(w, b, d);
|
|
1962
1896
|
}
|
|
1963
|
-
|
|
1897
|
+
kt(t, r, b.x, b.y), this.links.add(t, r, s.getId(), "node", b);
|
|
1964
1898
|
}
|
|
1965
1899
|
}
|
|
1966
1900
|
refreshTextLinks() {
|
|
1967
1901
|
let t = !1;
|
|
1968
1902
|
this.links.forEach(
|
|
1969
|
-
({ connectionPoint: r, targetType:
|
|
1970
|
-
if (
|
|
1971
|
-
return;
|
|
1903
|
+
({ connectionPoint: r, targetType: s, target: h, arrow: u, side: d }) => {
|
|
1904
|
+
if (s !== "text") return;
|
|
1972
1905
|
t = !0;
|
|
1973
|
-
const g = this.getAnnotation(
|
|
1974
|
-
|
|
1906
|
+
const g = this.getAnnotation(h), f = this.getAnnotation(u), y = ut(g), v = ct(g), k = Wt(r, { x: y.width, y: y.height }), b = rt(k, this.ogma.view.getAngle()), w = St(b, v);
|
|
1907
|
+
kt(f, d, w.x, w.y);
|
|
1975
1908
|
}
|
|
1976
1909
|
), t && this.arrows.refreshLayer();
|
|
1977
1910
|
}
|
|
@@ -1981,24 +1914,24 @@ class oi extends Ke {
|
|
|
1981
1914
|
getSelected() {
|
|
1982
1915
|
return this.selected;
|
|
1983
1916
|
}
|
|
1984
|
-
findMagnetPoint(t, r,
|
|
1985
|
-
let
|
|
1917
|
+
findMagnetPoint(t, r, s) {
|
|
1918
|
+
let h;
|
|
1986
1919
|
for (const u of t) {
|
|
1987
|
-
const d = ut(r), g = ct(r), f =
|
|
1920
|
+
const d = ut(r), g = ct(r), f = Wt(u, { x: d.width, y: d.height }), y = rt(f, this.ogma.view.getAngle()), v = St(y, g), k = Tt(wt(v, s)), b = Math.min(
|
|
1988
1921
|
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
1989
1922
|
// when really zoomed in: avoid to snap on too far away magnets
|
|
1990
1923
|
d.width / 2,
|
|
1991
1924
|
d.height / 2
|
|
1992
1925
|
);
|
|
1993
|
-
if (
|
|
1994
|
-
|
|
1926
|
+
if (k < Math.max(b, this.options.magnetHandleRadius)) {
|
|
1927
|
+
h = {
|
|
1995
1928
|
point: v,
|
|
1996
1929
|
magnet: u
|
|
1997
1930
|
};
|
|
1998
1931
|
break;
|
|
1999
1932
|
}
|
|
2000
1933
|
}
|
|
2001
|
-
return
|
|
1934
|
+
return h;
|
|
2002
1935
|
}
|
|
2003
1936
|
/**
|
|
2004
1937
|
* Set the options for the controller
|
|
@@ -2016,31 +1949,32 @@ class oi extends Ke {
|
|
|
2016
1949
|
* @param id the id of the annotation to select
|
|
2017
1950
|
*/
|
|
2018
1951
|
select(t) {
|
|
2019
|
-
const r = this.getAnnotations().features.find((
|
|
2020
|
-
return r ? (st(r) ? this.arrows.select(r.id) :
|
|
1952
|
+
const r = this.getAnnotations().features.find((s) => s.id === t);
|
|
1953
|
+
return r ? (st(r) ? this.arrows.select(r.id) : gt(r) && this.texts.select(r.id), this) : this;
|
|
2021
1954
|
}
|
|
2022
1955
|
/**
|
|
2023
1956
|
* Unselects the currently selected annotation
|
|
2024
1957
|
*/
|
|
2025
1958
|
unselect() {
|
|
2026
|
-
return this.selected ? (st(this.selected) ? this.arrows.unselect() :
|
|
1959
|
+
return this.selected ? (st(this.selected) ? this.arrows.unselect() : gt(this.selected) && this.texts.unselect(), this) : this;
|
|
2027
1960
|
}
|
|
2028
1961
|
/**
|
|
2029
1962
|
* Add an annotation to the controller
|
|
2030
1963
|
* @param annotation The annotation to add
|
|
2031
1964
|
*/
|
|
2032
1965
|
add(t) {
|
|
2033
|
-
if (
|
|
2034
|
-
const [r,
|
|
2035
|
-
(
|
|
1966
|
+
if (Ve(t)) {
|
|
1967
|
+
const [r, s] = t.features.reduce(
|
|
1968
|
+
(h, u) => (st(u) ? h[1].push(u) : gt(u) && h[0].push(u), h),
|
|
2036
1969
|
[[], []]
|
|
2037
1970
|
);
|
|
2038
|
-
return r.forEach((
|
|
1971
|
+
return r.forEach((h) => this.add(h)), s.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
|
|
2039
1972
|
}
|
|
2040
1973
|
switch (t.properties.type) {
|
|
2041
1974
|
case "text":
|
|
2042
1975
|
this.texts.add(t);
|
|
2043
1976
|
break;
|
|
1977
|
+
// more to follow
|
|
2044
1978
|
default:
|
|
2045
1979
|
this.arrows.add(t), this.loadLink(t);
|
|
2046
1980
|
break;
|
|
@@ -2052,29 +1986,27 @@ class oi extends Ke {
|
|
|
2052
1986
|
* @param annotation The annotation(s) to remove
|
|
2053
1987
|
*/
|
|
2054
1988
|
remove(t) {
|
|
2055
|
-
return
|
|
1989
|
+
return Ve(t) ? (t.features.forEach(
|
|
2056
1990
|
(r) => this.remove(r)
|
|
2057
1991
|
), this) : (st(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
|
|
2058
1992
|
}
|
|
2059
1993
|
loadLink(t) {
|
|
2060
1994
|
if (t.properties.link)
|
|
2061
|
-
for (const r of
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
this.links.add(t, r, o.id, o.type, o.magnet);
|
|
2073
|
-
const d = u.getPosition(), g = u.getAttribute("radius") || 0, f = Rt(
|
|
1995
|
+
for (const r of Ue) {
|
|
1996
|
+
const s = t.properties.link[r];
|
|
1997
|
+
if (!s) continue;
|
|
1998
|
+
const h = this.getAnnotation(s.id);
|
|
1999
|
+
if (s.type === "text" && h)
|
|
2000
|
+
this.links.add(t, r, s.id, s.type, s.magnet);
|
|
2001
|
+
else if (s.type === "node") {
|
|
2002
|
+
const u = this.ogma.getNode(s.id);
|
|
2003
|
+
if (!u) continue;
|
|
2004
|
+
this.links.add(t, r, s.id, s.type, s.magnet);
|
|
2005
|
+
const d = u.getPosition(), g = u.getAttribute("radius") || 0, f = Vt(
|
|
2074
2006
|
t,
|
|
2075
2007
|
r === "start" ? "end" : "start"
|
|
2076
|
-
), y =
|
|
2077
|
-
|
|
2008
|
+
), y = Ut(f, d, +g);
|
|
2009
|
+
kt(t, r, y.x, y.y);
|
|
2078
2010
|
}
|
|
2079
2011
|
}
|
|
2080
2012
|
}
|
|
@@ -2084,8 +2016,8 @@ class oi extends Ke {
|
|
|
2084
2016
|
* @param y coord of the first point
|
|
2085
2017
|
* @param arrow The arrow to add
|
|
2086
2018
|
*/
|
|
2087
|
-
startArrow(t, r,
|
|
2088
|
-
this.cancelDrawing(), this.arrows.startDrawing(t, r,
|
|
2019
|
+
startArrow(t, r, s) {
|
|
2020
|
+
this.cancelDrawing(), this.arrows.startDrawing(t, r, s);
|
|
2089
2021
|
}
|
|
2090
2022
|
/**
|
|
2091
2023
|
* Start adding a text (add it, and give control to the user)
|
|
@@ -2093,14 +2025,14 @@ class oi extends Ke {
|
|
|
2093
2025
|
* @param y coord of the top left point
|
|
2094
2026
|
* @param text The text to add
|
|
2095
2027
|
*/
|
|
2096
|
-
startText(t, r,
|
|
2097
|
-
this.cancelDrawing(), this.texts.startDrawing(t, r,
|
|
2028
|
+
startText(t, r, s) {
|
|
2029
|
+
this.cancelDrawing(), this.texts.startDrawing(t, r, s);
|
|
2098
2030
|
}
|
|
2099
2031
|
/**
|
|
2100
2032
|
* Cancel drawing on the current frame
|
|
2101
2033
|
*/
|
|
2102
2034
|
cancelDrawing() {
|
|
2103
|
-
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(
|
|
2035
|
+
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(rr);
|
|
2104
2036
|
}
|
|
2105
2037
|
/**
|
|
2106
2038
|
* Update the style of the annotation with the given id
|
|
@@ -2108,12 +2040,12 @@ class oi extends Ke {
|
|
|
2108
2040
|
* @param style The new style
|
|
2109
2041
|
*/
|
|
2110
2042
|
updateStyle(t, r) {
|
|
2111
|
-
const
|
|
2112
|
-
return
|
|
2043
|
+
const s = this.getAnnotations().features.find((h) => h.id === t);
|
|
2044
|
+
return s ? (st(s) ? this.arrows.updateStyle(s, r) : gt(s) && this.texts.updateStyle(s, r), this.onUpdate(s), this) : this;
|
|
2113
2045
|
}
|
|
2114
|
-
setScale(t, r,
|
|
2046
|
+
setScale(t, r, s, h) {
|
|
2115
2047
|
const u = this.getAnnotations().features.find((d) => d.id === t);
|
|
2116
|
-
return u ? (st(u) ? this.arrows.scale(u, r,
|
|
2048
|
+
return u ? (st(u) ? this.arrows.scale(u, r, s, h) : gt(u) && this.texts.scale(u, r, s, h), this.onUpdate(u), this) : this;
|
|
2117
2049
|
}
|
|
2118
2050
|
/**
|
|
2119
2051
|
*
|
|
@@ -2144,48 +2076,52 @@ class oi extends Ke {
|
|
|
2144
2076
|
}
|
|
2145
2077
|
}
|
|
2146
2078
|
export {
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2079
|
+
ar as Arrows,
|
|
2080
|
+
vr as Control,
|
|
2081
|
+
me as EVT_ADD,
|
|
2082
|
+
rr as EVT_CANCEL_DRAWING,
|
|
2083
|
+
Kt as EVT_DRAG,
|
|
2084
|
+
It as EVT_DRAG_END,
|
|
2085
|
+
Jt as EVT_DRAG_START,
|
|
2086
|
+
er as EVT_HOVER,
|
|
2087
|
+
ir as EVT_LINK,
|
|
2088
|
+
ye as EVT_REMOVE,
|
|
2089
|
+
pe as EVT_SELECT,
|
|
2090
|
+
nr as EVT_UNHOVER,
|
|
2091
|
+
ge as EVT_UNSELECT,
|
|
2092
|
+
ve as EVT_UPDATE,
|
|
2093
|
+
W as NONE,
|
|
2094
|
+
fr as Texts,
|
|
2095
|
+
fe as clientToContainerPosition,
|
|
2096
|
+
Gn as colorToRgba,
|
|
2097
|
+
qn as createArrow,
|
|
2098
|
+
xt as createSVGElement,
|
|
2099
|
+
lr as createText,
|
|
2100
|
+
Oe as defaultArrowOptions,
|
|
2101
|
+
Nt as defaultArrowStyle,
|
|
2102
|
+
Re as defaultControllerOptions,
|
|
2103
|
+
ce as defaultTextOptions,
|
|
2104
|
+
_t as defaultTextStyle,
|
|
2105
|
+
mr as getAnnotationsBounds,
|
|
2106
|
+
Xt as getArrowEnd,
|
|
2107
|
+
Zt as getArrowEndPoints,
|
|
2108
|
+
Vt as getArrowSide,
|
|
2109
|
+
zt as getArrowStart,
|
|
2110
|
+
Ut as getAttachmentPointOnNode,
|
|
2111
|
+
Ze as getHandleId,
|
|
2112
|
+
Ge as getTextBbox,
|
|
2180
2113
|
ct as getTextPosition,
|
|
2181
2114
|
ut as getTextSize,
|
|
2182
|
-
|
|
2115
|
+
Yn as hexShortToLong,
|
|
2116
|
+
Xn as hexToRgba,
|
|
2117
|
+
Ve as isAnnotationCollection,
|
|
2183
2118
|
st as isArrow,
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2119
|
+
gt as isText,
|
|
2120
|
+
Zn as rgbToRgba,
|
|
2121
|
+
Wn as scaleGeometry,
|
|
2122
|
+
Xe as setArrowEnd,
|
|
2123
|
+
kt as setArrowEndPoint,
|
|
2124
|
+
Ye as setArrowStart,
|
|
2125
|
+
Vn as setTextBbox,
|
|
2126
|
+
jn as updateTextBbox
|
|
2191
2127
|
};
|