@linkurious/ogma-annotations 1.1.18 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,20 +1,20 @@
1
- var $n = Object.defineProperty;
2
- var zn = (a, h, t) => h in a ? $n(a, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[h] = t;
3
- var m = (a, h, t) => (zn(a, typeof h != "symbol" ? h + "" : h, t), t);
4
- let Jt = (a = 21) => crypto.getRandomValues(new Uint8Array(a)).reduce((h, t) => (t &= 63, t < 36 ? h += t.toString(36) : t < 62 ? h += (t - 26).toString(36).toUpperCase() : t > 62 ? h += "-" : h += "_", h), "");
5
- const zt = {
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: "black",
7
+ strokeColor: "#202020",
8
8
  strokeWidth: 1,
9
9
  head: "none",
10
10
  tail: "none"
11
- }, De = {
11
+ }, Oe = {
12
12
  id: 0,
13
13
  type: "Feature",
14
14
  properties: {
15
15
  type: "arrow",
16
16
  style: {
17
- ...zt
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
- }, Nn = (a = 0, h = 0, t = 0, r = 0, o = { ...zt }) => ({
38
- id: Jt(),
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
- ...zt,
44
- ...o
43
+ ...Nt,
44
+ ...s
45
45
  }
46
46
  },
47
47
  geometry: {
48
48
  type: "LineString",
49
49
  coordinates: [
50
- [a, h],
50
+ [a, l],
51
51
  [t, r]
52
52
  ]
53
53
  }
54
- }), Hn = "http://www.w3.org/2000/svg";
55
- function Pt(a) {
56
- return document.createElementNS(Hn, a);
54
+ }), Bn = "http://www.w3.org/2000/svg";
55
+ function xt(a) {
56
+ return document.createElementNS(Bn, a);
57
57
  }
58
- function je(a) {
59
- return a.geometry.bbox || Fn(a), 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 h = je(a);
62
+ const l = Ge(a);
63
63
  return {
64
- width: h[2] - h[0],
65
- height: h[3] - h[1]
64
+ width: l[2] - l[0],
65
+ height: l[3] - l[1]
66
66
  };
67
67
  }
68
68
  function ct(a) {
69
- const h = je(a);
70
- return { x: h[0], y: h[1] };
69
+ const l = Ge(a);
70
+ return { x: l[0], y: l[1] };
71
71
  }
72
- function Fn(a) {
73
- const [h, t] = a.geometry.coordinates[0][0], [r, o] = a.geometry.coordinates[0][2];
74
- a.geometry.bbox = [h, t, r, o];
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 Bn(a, h, t, r, o) {
77
- a.geometry.bbox = [h, t, h + r, t + o], a.geometry.coordinates = [
76
+ function Vn(a, l, t, r, s) {
77
+ a.geometry.bbox = [l, t, l + r, t + s], a.geometry.coordinates = [
78
78
  [
79
- [h, t],
80
- [h + r, t],
81
- [h + r, t + o],
82
- [h, t + o],
83
- [h, t]
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 $t(a) {
88
- const [h, t] = a.geometry.coordinates[0];
89
- return { x: h, y: t };
87
+ function zt(a) {
88
+ const [l, t] = a.geometry.coordinates[0];
89
+ return { x: l, y: t };
90
90
  }
91
- function Rt(a, h) {
92
- const [t, r] = a.geometry.coordinates[h === "start" ? 0 : 1];
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 Wt(a) {
96
- const [h, t] = a.geometry.coordinates[1];
97
- return { x: h, y: t };
95
+ function Xt(a) {
96
+ const [l, t] = a.geometry.coordinates[1];
97
+ return { x: l, y: t };
98
98
  }
99
- function qe(a, h, t) {
100
- a.geometry.coordinates[0] = [h, t];
99
+ function Ye(a, l, t) {
100
+ a.geometry.coordinates[0] = [l, t];
101
101
  }
102
- function Re(a, h, t) {
103
- a.geometry.coordinates[1] = [h, t];
102
+ function Xe(a, l, t) {
103
+ a.geometry.coordinates[1] = [l, t];
104
104
  }
105
- function Yt(a) {
106
- return { start: $t(a), end: Wt(a) };
105
+ function Zt(a) {
106
+ return { start: zt(a), end: Xt(a) };
107
107
  }
108
- function At(a, h, t, r) {
109
- h === "start" ? qe(a, t, r) : Re(a, t, r);
108
+ function kt(a, l, t, r) {
109
+ l === "start" ? Ye(a, t, r) : Xe(a, t, r);
110
110
  }
111
- const Ve = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
112
- function si(a) {
111
+ const Ze = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
112
+ function mr(a) {
113
113
  return Gt(a).reduce(
114
- (h, t) => (h[0] = Math.min(t[0], h[0]), h[1] = Math.min(t[1], h[1]), h[2] = Math.max(t[0], h[2]), h[3] = Math.max(t[1], h[3]), h),
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 jn(a) {
123
+ function Un(a) {
124
124
  return Array.isArray(a) && a.length === 2 && a.every(isFinite);
125
125
  }
126
- function qn(a, h, t, r) {
127
- for (let o = 0; o < a.coordinates.length; o++) {
128
- const l = a.coordinates[o];
129
- if (jn(l))
130
- l[0] = t + (l[0] - t) * h, l[1] = r + (l[1] - r) * h;
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 < l.length; u++) {
133
- const d = l[u];
134
- d[0] = t + (d[0] - t) * h, d[1] = r + (d[1] - r) * h;
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 h = [];
141
- return a.type == "Point" ? h = [a.coordinates] : a.type == "LineString" || a.type == "MultiPoint" ? h = a.coordinates : a.type == "Polygon" || a.type == "MultiLineString" ? h = a.coordinates.reduce(function(t, r) {
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" ? h = a.coordinates.reduce(
144
- (t, r) => t.concat(r.reduce((o, l) => o.concat(l), [])),
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" ? h = Gt(a.geometry) : a.type == "GeometryCollection" ? h = a.geometries.reduce(
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" && (h = a.features.reduce(
149
+ ) : a.type == "FeatureCollection" && (l = a.features.reduce(
150
150
  (t, r) => t.concat(Gt(r)),
151
151
  []
152
- )), h;
152
+ )), l;
153
153
  }
154
- function Vt(a, h, t) {
155
- const r = Math.atan2(a.y - h.y, a.x - h.x);
154
+ function Ut(a, l, t) {
155
+ const r = Math.atan2(a.y - l.y, a.x - l.x);
156
156
  return {
157
- x: h.x + t * Math.cos(r),
158
- y: h.y + t * Math.sin(r)
157
+ x: l.x + t * Math.cos(r),
158
+ y: l.y + t * Math.sin(r)
159
159
  };
160
160
  }
161
- function Xt(a, h) {
162
- if (!h)
163
- return { x: a.clientX, y: a.clientY };
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 - h.clientLeft,
167
- y: a.clientY - t.top - h.clientTop
165
+ x: a.clientX - t.left - l.clientLeft,
166
+ y: a.clientY - t.top - l.clientTop
168
167
  };
169
168
  }
170
- const vt = (a, h) => ({
171
- x: a.x - h.x,
172
- y: a.y - h.y
173
- }), kt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), Ue = (a) => ({
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
- }), Ge = (a) => {
177
- const h = kt(a);
178
- return h === 0 ? { x: 0, y: 0 } : {
179
- x: a.x / h,
180
- y: a.y / h
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
- }, Et = (a, h) => ({
183
- x: a.x + h.x,
184
- y: a.y + h.y
185
- }), We = (a, h) => ({
186
- x: a.x * h,
187
- y: a.y * h
188
- }), Ut = (a, h) => ({
189
- x: a.x * h.x,
190
- y: a.y * h.y
191
- }), rt = (a, h) => {
192
- const t = Math.sin(h), r = Math.cos(h);
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
- }, Rn = (a, h) => ({
198
- x: a.x / h,
199
- y: a.y / h
200
- }), Me = (a, h) => a.x * h.x + a.y * h.y;
201
- function Ye(a, h = 5, t = 30) {
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: o } = Yt(a), l = vt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
204
- return Math.min(t, Math.max(3 * u, kt(l) * 0.1, h));
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 Oe(a, h, t, r) {
207
- const o = We(Ue(Ge(h)), r);
208
- if (!t || t === "none")
209
- return "";
210
- const l = Et(a, rt(o, Math.PI / 8)), u = Et(a, rt(o, -Math.PI / 8)), d = `${a.x} ${a.y}`;
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 Vn(a, h, t, r, o) {
214
- const { start: l, end: u } = Yt(a), { tail: d, head: g, strokeColor: f, strokeWidth: y } = a.properties.style || t, v = vt(u, l), T = Ye(a, r, o), A = Pt("path");
215
- A.setAttribute("data-annotation", `${a.id}`), A.setAttribute("data-annotation-type", "arrow");
216
- const b = g === "arrow-plain" || d === "arrow";
217
- A.setAttribute("stroke", f || "none"), A.setAttribute("stroke-width", `${y}`), A.setAttribute("fill", b ? f || "" : "none"), A.setAttribute("stroke-linecap", "round"), A.setAttribute("stroke-linejoin", "round");
218
- const C = Oe(l, Ue(v), d, T), E = Oe(u, v, g, T), $ = C + `M ${l.x} ${l.y} ${u.x} ${u.y}` + E;
219
- A.setAttribute("d", $), h.appendChild(A);
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
- const V = -1, Zt = "dragging", Kt = "dragstart", Tt = "dragend", de = "select", fe = "unselect", Un = "hover", Gn = "unhover", pe = "remove", ge = "add", Wn = "cancelDrawing", ye = "update", Yn = "link";
222
- var Xn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
223
- function Xe(a) {
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 Ze = { exports: {} };
227
- (function(a) {
228
- var h = Object.prototype.hasOwnProperty, t = "~";
229
- function r() {
230
- }
231
- Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
232
- function o(g, f, y) {
233
- this.fn = g, this.context = f, this.once = y || !1;
234
- }
235
- function l(g, f, y, v, T) {
236
- if (typeof y != "function")
237
- throw new TypeError("The listener must be a function");
238
- var A = new o(y, v || g, T), b = t ? t + f : f;
239
- return g._events[b] ? g._events[b].fn ? g._events[b] = [g._events[b], A] : g._events[b].push(A) : (g._events[b] = A, g._eventsCount++), g;
240
- }
241
- function u(g, f) {
242
- --g._eventsCount === 0 ? g._events = new r() : delete g._events[f];
243
- }
244
- function d() {
245
- this._events = new r(), this._eventsCount = 0;
246
- }
247
- d.prototype.eventNames = function() {
248
- var f = [], y, v;
249
- if (this._eventsCount === 0)
250
- return f;
251
- for (v in y = this._events)
252
- h.call(y, v) && f.push(t ? v.slice(1) : v);
253
- return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(y)) : f;
254
- }, d.prototype.listeners = function(f) {
255
- var y = t ? t + f : f, v = this._events[y];
256
- if (!v)
257
- return [];
258
- if (v.fn)
259
- return [v.fn];
260
- for (var T = 0, A = v.length, b = new Array(A); T < A; T++)
261
- b[T] = v[T].fn;
262
- return b;
263
- }, d.prototype.listenerCount = function(f) {
264
- var y = t ? t + f : f, v = this._events[y];
265
- return v ? v.fn ? 1 : v.length : 0;
266
- }, d.prototype.emit = function(f, y, v, T, A, b) {
267
- var C = t ? t + f : f;
268
- if (!this._events[C])
269
- return !1;
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[_].fn.call(E[_].context);
295
- break;
297
+ return E.fn.call(E.context), !0;
296
298
  case 2:
297
- E[_].fn.call(E[_].context, y);
298
- break;
299
+ return E.fn.call(E.context, y), !0;
299
300
  case 3:
300
- E[_].fn.call(E[_].context, y, v);
301
- break;
301
+ return E.fn.call(E.context, y, v), !0;
302
302
  case 4:
303
- E[_].fn.call(E[_].context, y, v, T);
304
- break;
305
- default:
306
- if (!N)
307
- for (W = 1, N = new Array($ - 1); W < $; W++)
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
- return !0;
313
- }, d.prototype.on = function(f, y, v) {
314
- return l(this, f, y, v, !1);
315
- }, d.prototype.once = function(f, y, v) {
316
- return l(this, f, y, v, !0);
317
- }, d.prototype.removeListener = function(f, y, v, T) {
318
- var A = t ? t + f : f;
319
- if (!this._events[A])
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
- if (!y)
322
- return u(this, A), this;
323
- var b = this._events[A];
324
- if (b.fn)
325
- b.fn === y && (!T || b.once) && (!v || b.context === v) && u(this, A);
326
- else {
327
- for (var C = 0, E = [], $ = b.length; C < $; C++)
328
- (b[C].fn !== y || T && !b[C].once || v && b[C].context !== v) && E.push(b[C]);
329
- E.length ? this._events[A] = E.length === 1 ? E[0] : E : u(this, A);
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", V);
348
- m(this, "hoveredId", V);
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 !== V ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(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), o = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
361
- t.domEvent.type === "mousemove" ? o ? this.hover(o.id) : this.hoveredId !== V && this.unhover() : o ? this.select(o.id) : this.selectedId !== V && this.unselect();
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: (o) => this.draw(o)
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(), o = Object.assign(t, {
379
- id: t.id === void 0 ? Jt() : t.id,
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(o), this.layer.refresh(), this.emit(ge, o), o;
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, o, l) {
428
+ scale(t, r, s, h) {
407
429
  this.updateGeometry(
408
430
  t,
409
- qn(t.geometry, r, o, l)
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 o = this.getById(t);
420
- this.updateAnnotation(o, r);
441
+ const s = this.getById(t);
442
+ this.updateAnnotation(s, r);
421
443
  }
422
444
  updateAnnotation(t, r) {
423
- if (!t)
424
- return;
425
- const o = t.id;
426
- Object.keys(r).forEach((l) => {
427
- if (l !== "id")
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
- l === "geometry" ? t.geometry = {
440
- ...t.geometry,
441
- ...r.geometry
442
- } : t[l] = r[l];
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 o = 0; o < this.elements.length; o++) {
448
- const l = this.elements[o];
449
- if (!(l.id !== t && l.id !== r))
450
- return l;
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(de, r));
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(Un, r));
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 === V ? null : this.getById(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(fe, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
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(Gn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
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((o) => o.id !== t), r && this.emit(pe, r), this.layer.refresh();
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 Le = "handle-line", Ce = "handle-start", Pe = "handle-end";
535
- class Kn extends Je {
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="${Le}" data-handle-id="0" class="handle line"></div>
542
- <div id="${Ce}" data-handle-id="1" class="handle point"></div>
543
- <div id="${Pe}" data-handle-id="2" class="handle point"></div>
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", V);
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", { ...De });
571
+ m(this, "arrow", { ...Oe });
552
572
  m(this, "startX", 0);
553
573
  m(this, "startY", 0);
554
574
  m(this, "minArrowHeight", 0);
@@ -556,37 +576,32 @@ 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
- return;
561
- const { x: o, y: l } = Xt(t, this.ogma.getContainer());
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 = V, this.emit(Tt, this.arrow));
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 === V)
569
- return;
570
- const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(), l = Xt(
571
- t,
572
- this.ogma.getContainer()
573
- ), { x: u, y: d } = rt(
574
- Rn(
575
- { x: l.x - this.startX, y: l.y - this.startY },
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(
590
+ { x: t.x - this.startX, y: t.y - this.startY },
576
591
  this.ogma.view.getZoom()
577
592
  ),
578
- o
579
- ), g = r.id === Le, f = r.id === Ce, y = r.id === Pe;
580
- (g || f) && qe(this.arrow, this.start.x + u, this.start.y + d), (g || y) && Re(this.arrow, this.end.x + u, this.end.y + d), this.emit(
581
- Zt,
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,
582
597
  this.arrow,
583
- g ? "line" : f ? "start" : "end"
598
+ d ? "line" : g ? "start" : "end"
584
599
  ), this.refreshEditor(), this.layer.refresh();
585
600
  });
586
601
  this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
587
602
  this.editor.element.querySelectorAll(".arrow-handle>.handle")
588
603
  ), this.handles.forEach(
589
- (o) => o.addEventListener("mousedown", this.onHandleMouseDown)
604
+ (s) => s.addEventListener("mousedown", this.onHandleMouseDown)
590
605
  ), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
591
606
  }
592
607
  /**
@@ -595,60 +610,59 @@ class Kn extends Je {
595
610
  * @param y
596
611
  * @param arrow
597
612
  */
598
- startDrawing(t, r, o = Nn(t, r, t, r, zt)) {
613
+ startDrawing(t, r, s = qn(t, r, t, r, Nt)) {
599
614
  var d;
600
- this.disableDragging(), this.add(o), this.hoveredId = o.id;
601
- const l = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
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()) || {
602
617
  left: 0,
603
618
  top: 0
604
619
  };
605
620
  this.startDragging(
606
- this.getById(o.id),
607
- l.x + (u == null ? void 0 : u.left),
608
- l.y + u.top
621
+ this.getById(s.id),
622
+ h.x + (u == null ? void 0 : u.left),
623
+ h.y + u.top
609
624
  ), this.draggedHandle = 2;
610
625
  }
611
626
  cancelDrawing() {
612
- this.isDragging && (this.remove(this.arrow.id), this.emit(Tt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
627
+ this.isDragging && (this.remove(this.arrow.id), this.emit(It, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W);
613
628
  }
614
- startDragging(t, r, o) {
615
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = $t(this.arrow), this.end = Wt(this.arrow), this.disableDragging(), this.emit(Kt, this.arrow), this.isDragging = !0;
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;
616
631
  }
617
632
  detect(t, r = 0) {
618
- return this.elements.find((o) => {
619
- const { start: l, end: u } = Yt(o), d = vt(t, {
620
- x: (l.x + u.x) / 2,
621
- y: (l.y + u.y) / 2
622
- }), g = vt(u, l), f = kt(g), y = Ge(g), v = Ye(o);
623
- return Math.abs(Me(y, d)) < f / 2 + r && Math.abs(Me(rt(y, Math.PI / 2), d)) < v / 2 + r;
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;
624
639
  });
625
640
  }
626
641
  refreshEditor() {
627
- if (+this.selectedId < 0 && +this.hoveredId < 0)
628
- return;
629
- 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(
630
644
  this.editor.element.querySelectorAll(".handle")
631
645
  );
632
- d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;
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%)`;
633
647
  const f = {
634
- x: (l.x + o.x) / 2,
635
- y: (l.y + o.y) / 2
636
- }, y = vt(l, o), v = We(y, 1 / kt(y)), T = Math.atan2(v.y, v.x);
637
- u.style.width = `${kt(y)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
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)`;
638
652
  }
639
653
  getDefaultOptions() {
640
- return De;
654
+ return Oe;
641
655
  }
642
656
  draw(t) {
643
657
  t.innerHTML = "";
644
- const r = Pt("g"), o = this.ogma.view.getAngle();
645
- r.setAttribute("transform", `rotate(${-o * (180 / Math.PI)})`), this.elements.forEach(
646
- (l) => Vn(l, r, zt, this.minArrowHeight, this.maxArrowHeight)
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)
647
661
  ), t.appendChild(r);
648
662
  }
649
663
  refreshDrawing() {
650
664
  const t = this.ogma.view.getAngle();
651
- this.layer.element !== null && this.layer.element.children[0].setAttribute(
665
+ this.layer.element !== null && t !== 0 && this.layer.element.children[0].setAttribute(
652
666
  "transform",
653
667
  `rotate(${-t * (180 / Math.PI)})`
654
668
  );
@@ -657,21 +671,22 @@ class Kn extends Je {
657
671
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
658
672
  }
659
673
  }
660
- const St = {
674
+ const _t = {
661
675
  font: "sans-serif",
662
- fontSize: 12,
663
- color: "black",
664
- background: "",
665
- strokeWidth: 1,
666
- strokeColor: "#000",
676
+ fontSize: 18,
677
+ color: "#505050",
678
+ background: "#f5f5f5",
679
+ strokeWidth: 0,
680
+ borderRadius: 8,
681
+ padding: 16,
667
682
  strokeType: "plain"
668
- }, he = {
683
+ }, ce = {
669
684
  id: 0,
670
685
  type: "Feature",
671
686
  properties: {
672
687
  type: "text",
673
688
  content: "",
674
- style: { ...St }
689
+ style: { ..._t }
675
690
  },
676
691
  geometry: {
677
692
  type: "Polygon",
@@ -687,855 +702,776 @@ const St = {
687
702
  }
688
703
  // position: { x: 0, y: 0 },
689
704
  // size: { width: 100, height: 50 }
690
- }, $e = {
705
+ }, Re = {
691
706
  handleSize: 3.5,
692
707
  placeholder: "Your text..."
693
- }, Jn = (a = 0, h = 0, t = 100, r = 50, o = "", l = { ...St }) => ({
694
- id: Jt(),
708
+ }, lr = (a = 0, l = 0, t = 100, r = 50, s = "", h = { ..._t }) => ({
709
+ id: Qt(),
695
710
  type: "Feature",
696
711
  properties: {
697
712
  type: "text",
698
- content: o,
699
- style: { ...St, ...l }
713
+ content: s,
714
+ style: { ..._t, ...h }
700
715
  },
701
716
  geometry: {
702
717
  type: "Polygon",
703
718
  coordinates: [
704
719
  [
705
- [a, h],
706
- [a + t, h],
707
- [a + t, h + r],
708
- [a, h + r],
709
- [a, h]
720
+ [a, l],
721
+ [a + t, l],
722
+ [a + t, l + r],
723
+ [a, l + r],
724
+ [a, l]
710
725
  ]
711
726
  ]
712
727
  }
713
728
  });
714
- var Qe = { exports: {} };
715
- (function(a, h) {
716
- (function(t, r) {
717
- a.exports = r();
718
- })(Xn, () => (() => {
719
- var t = { d: (e, n) => {
720
- for (var s in n)
721
- t.o(n, s) && !t.o(e, s) && Object.defineProperty(e, s, { enumerable: !0, get: n[s] });
722
- }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
723
- function o(e) {
724
- return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
725
- return typeof n;
726
- } : function(n) {
727
- return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
728
- }, o(e);
729
- }
730
- t.d(r, { default: () => Cn });
731
- 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 };
732
- function v(e) {
733
- var n = "", s = this;
734
- 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;
735
- }
736
- var T = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
737
- function A(e) {
738
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = l.exec(e);
739
- n.family = (s[6] || "").trim();
740
- var i = y[s[2]] || parseFloat(s[2]);
741
- s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
742
- var c = parseFloat(s[4]);
743
- 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]))
744
- n.weight = "bold";
745
- else {
746
- var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
747
- 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);
748
744
  }
749
- return n;
750
- }
751
- function b() {
752
- var e, n, s, 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, w = 12, x = null, k = null, S = "";
753
- if (i && i.nodeType) {
754
- var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
755
- 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") || "";
756
- } else if (typeof i == "string") {
757
- var I = A(i);
758
- e = I.family, w = I.size, p = I.height, S = I.variant, k = I.style, x = I.weight;
759
- } else
760
- 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);
761
- 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);
762
- var L = Object.create(T);
763
- 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;
764
- }
765
- 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 };
766
- var E, $ = function(e) {
767
- var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
768
- if (n && n.getContext) {
769
- var s = n.getContext("2d");
770
- if (s && typeof s.measureText == "function")
771
- return function(i, c) {
772
- return s.font = String(c), s.measureText(i).width;
773
- };
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;
774
750
  }
775
- }(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
776
- if (!E[n]) {
777
- var s = b(n);
778
- E[n] = s, /\bmonospace\b/.test(s.family) ? s.size *= 0.6 : (s.size *= 0.45, s.weight && (s.size *= 1.18));
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;
779
764
  }
780
- return e.length * E[n].size;
781
- }), N = {}, _ = { trim: !0, collapse: !0 };
782
- function G(e, n, s) {
783
- var i = Object.assign({}, _, s), c = String(e);
784
- if (!c)
785
- return 0;
786
- if (c in C) {
787
- var p = n.id + "/" + c;
788
- return p in N || (N[p] = $("_".concat(c, "_"), n) - $("__", n)), N[p];
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;
789
777
  }
790
- return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), $(c, n) + n.size * (e.tracking || 0);
791
- }
792
- function W(e) {
793
- return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
794
- return typeof n;
795
- } : function(n) {
796
- return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
797
- }, W(e);
798
- }
799
- function _t(e, n) {
800
- if (typeof n != "function" && n !== null)
801
- throw new TypeError("Super expression must either be null or a function");
802
- e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && It(e, n);
803
- }
804
- function It(e, n) {
805
- return It = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, i) {
806
- return s.__proto__ = i, s;
807
- }, It(e, n);
808
- }
809
- function Qt(e) {
810
- var n = function() {
811
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
812
- return !1;
813
- if (typeof Proxy == "function")
814
- return !0;
815
- try {
816
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
817
- })), !0;
818
- } catch {
819
- 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
+ };
820
786
  }
821
- }();
822
- return function() {
823
- var s, i = Nt(e);
824
- if (n) {
825
- var c = Nt(this).constructor;
826
- s = Reflect.construct(i, arguments, c);
827
- } else
828
- s = i.apply(this, arguments);
829
- return tn(this, s);
830
- };
831
- }
832
- function tn(e, n) {
833
- if (n && (W(n) === "object" || typeof n == "function"))
834
- return n;
835
- if (n !== void 0)
836
- throw new TypeError("Derived constructors may only return object or undefined");
837
- return function(s) {
838
- if (s === void 0)
839
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
840
- return s;
841
- }(e);
842
- }
843
- function Nt(e) {
844
- return Nt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
845
- return n.__proto__ || Object.getPrototypeOf(n);
846
- }, Nt(e);
847
- }
848
- function Ht(e, n) {
849
- if (!(e instanceof n))
850
- throw new TypeError("Cannot call a class as a function");
851
- }
852
- function en(e, n) {
853
- for (var s = 0; s < n.length; s++) {
854
- var i = n[s];
855
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
856
- if (W(p) !== "object" || p === null)
857
- return p;
858
- var x = p[Symbol.toPrimitive];
859
- if (x !== void 0) {
860
- var k = x.call(p, w);
861
- if (W(k) !== "object")
862
- return k;
863
- throw new TypeError("@@toPrimitive must return a primitive value.");
864
- }
865
- return String(p);
866
- }(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);
867
802
  }
868
- var c;
869
- }
870
- function Ft(e, n, s) {
871
- return n && en(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
872
- }
873
- var F = function() {
874
- function e() {
875
- var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
876
- 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);
809
+ }
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);
877
813
  }
878
- return Ft(e, [{ key: "clone", value: function() {
879
- var n = new e(this.value);
880
- 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;
881
- } }, { key: "valueOf", value: function() {
882
- return this.value;
883
- } }, { key: "toString", value: function() {
884
- return this.value;
885
- } }]), e;
886
- }(), Dt = function(e) {
887
- _t(s, e);
888
- var n = Qt(s);
889
- function s() {
890
- 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);
891
818
  }
892
- return Ft(s);
893
- }(F), et = function(e) {
894
- _t(s, e);
895
- var n = Qt(s);
896
- function s() {
897
- return Ht(this, s), n.apply(this, arguments);
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
+ };
838
+ }
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);
898
846
  }
899
- return Ft(s);
900
- }(F), gt = function(e) {
901
- _t(s, e);
902
- var n = Qt(s);
903
- function s() {
904
- return Ht(this, s), n.apply(this, arguments);
847
+ function Ht(e) {
848
+ return Ht = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
849
+ return n.__proto__ || Object.getPrototypeOf(n);
850
+ }, Ht(e);
905
851
  }
906
- return Ft(s);
907
- }(F), te = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, nn = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, me = /^[\xA0\u2011\u202F\u2060\uFEFF]/, rn = /^(?:[;\xAD%?…]|,(?!\d))/, sn = /^[´±°¢£¤$¥\u2212]/;
908
- function Bt(e, n) {
909
- n !== !1 && (e = e.trim());
910
- for (var s, i, c = [], p = e.charAt(0), w = 0, x = 1, k = e.length; x < k; x++) {
911
- s = e.charAt(x), i = e.charAt(x + 1);
912
- var S = te.test(p), M = te.test(s), O = M || S, I = void 0;
913
- if ((sn.test(s) && !me.test(p) || rn.test(p + i) && !me.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((I = te.test(e.charAt(x - 2))) && !M && (O = !1), !I && nn.test(s + i) && (O = !0)), O) {
914
- var L = e.slice(w, x);
915
- /\u00AD$/.test(L) ? (c.push(new F(L.slice(0, -1))), c.push(new gt())) : (c.push(new F(L)), c.push(new Dt())), w = x;
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);
916
868
  }
917
- p = s;
869
+ var c;
918
870
  }
919
- return c.push(new F(e.slice(w))), c;
920
- }
921
- const ve = { 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: "›" };
922
- var on = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, an = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ln = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, hn = /^<!--(.+?)-->/, cn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, xe = { b: function(e) {
923
- e.weight = "bold";
924
- }, strong: function(e) {
925
- e.weight = "bold";
926
- }, i: function(e) {
927
- e.style = "italic";
928
- }, em: function(e) {
929
- e.style = "italic";
930
- }, dfn: function(e) {
931
- e.style = "italic";
932
- }, cite: function(e) {
933
- e.style = "italic";
934
- }, code: function(e) {
935
- e.family = "monospace";
936
- }, kbd: function(e) {
937
- e.family = "monospace";
938
- }, samp: function(e) {
939
- e.family = "monospace";
940
- }, var: function(e) {
941
- e.family = "monospace";
942
- }, tt: function(e) {
943
- e.family = "monospace";
944
- }, sub: function(e) {
945
- e.sub = !0;
946
- }, sup: function(e) {
947
- e.sup = !0;
948
- } }, 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 };
949
- function we(e) {
950
- return e.replace(cn, function(n, s, i, c) {
951
- if (s || i) {
952
- var p = s ? 10 : 16;
953
- 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;
954
878
  }
955
- return c in ve ? ve[c] : n;
956
- });
957
- }
958
- function dn(e) {
959
- return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
960
- }
961
- var fn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
962
- function pn(e) {
963
- var n, s = {};
964
- if (e) {
965
- do
966
- if (n = fn.exec(e)) {
967
- var i = we(dn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
968
- if (s[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
969
- throw new Error("Attribute error");
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;
970
917
  }
971
- while (n && e.length);
972
- if (/\S/.test(e))
973
- throw new Error("Attribute error");
918
+ p = o;
919
+ }
920
+ return c.push(new q(e.slice(A))), c;
974
921
  }
975
- return s;
976
- }
977
- const be = { 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: "Þ" };
978
- var gn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, yn = /^%[^\n]+(?:\n|$)/, mn = /^[^#$%&~_^\\{}]+/, vn = /^\\([&{}$%#_])/, xn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, wn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
979
- e.weight = "bold";
980
- }, it: function(e) {
981
- e.style = "italic";
982
- }, sl: function(e) {
983
- e.style = "italic";
984
- }, color: function(e, n) {
985
- e.color = n;
986
- }, href: function(e, n) {
987
- e.href = n;
988
- }, "^": function(e) {
989
- e.sup = !0;
990
- }, _: function(e) {
991
- e.sub = !0;
992
- }, par: function(e) {
993
- this.tokens.push(new et(), new et());
994
- }, newline: function(e) {
995
- this.tokens.push(new et());
996
- }, url: function(e, n) {
997
- this.open_context().href = n, this.add_token(new F(n)), this.close_context();
998
- } };
999
- U.textsuperscript = U["^"], U.textsubscript = U._, U.textsl = U.sl, U.mathbf = U.bf, U.mathit = U.it, U.textbf = U.bf, U.textit = U.it, U.textcolor = U.color;
1000
- var bn = /[\r\n\xA0]+/g;
1001
- function An(e, n) {
1002
- e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
1003
- var s = n;
1004
- return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (s = b(n, e)), s;
1005
- }
1006
- function Ae(e, n, s) {
1007
- for (var i, c, p = e.width; p + s.width > n && e.length; )
1008
- c = (i = e[e.length - 1]).width, i.width > s.width ? (i.value = i.value.slice(0, -1), i.width = G(i, i.font), p += i.width) : e.pop(), p -= c;
1009
- e[e.length - 1] instanceof gt && e.pop(), i = e[e.length - 1] || i || {}, s.font = b(s.font, i.bold, i.italic, ""), s.href = e.length ? i.href : null, s.rel = e.length ? i.rel : null, s.target = e.length ? i.target : null, e.push(s);
1010
- }
1011
- function xt(e) {
1012
- return Math.round(1e6 * e) / 1e6;
1013
- }
1014
- function Ee(e) {
1015
- return function(n) {
1016
- if (Array.isArray(n))
1017
- return ee(n);
1018
- }(e) || function(n) {
1019
- if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
1020
- return Array.from(n);
1021
- }(e) || function(n, s) {
1022
- if (n) {
1023
- if (typeof n == "string")
1024
- return ee(n, s);
1025
- var i = Object.prototype.toString.call(n).slice(8, -1);
1026
- 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, 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");
1027
973
  }
1028
- }(e) || function() {
1029
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
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.
1030
1025
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1031
- }();
1032
- }
1033
- function ee(e, n) {
1034
- (n == null || n > e.length) && (n = e.length);
1035
- for (var s = 0, i = new Array(n); s < n; s++)
1036
- i[s] = e[s];
1037
- return i;
1038
- }
1039
- var En = { center: "middle", right: "end" }, kn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ne = function(e, n) {
1040
- return !e && !n || e === n;
1041
- };
1042
- function Sn(e, n) {
1043
- var s = [], i = n.font(), c = i.size, p = i.family, w = n.align(), x = n.createElement();
1044
- if (e.length) {
1045
- var k = i.height, S = n.valign(), M = n.height()(), O = n.width()(0), I = !isFinite(O) && e.length === 1, L = I ? null : n.x(), B = xt(k / c), J = I ? null : xt(k / (1.15 * c + (k - c) / 2));
1046
- if (kn[S] && isFinite(M)) {
1047
- var z = S === "bottom" ? 1 : 0.5;
1048
- J += (M * z - k * e.length * z) / c;
1049
- }
1050
- var P = w === "justify", j = 0;
1051
- w === "right" ? j = O : w === "center" && (j = O / 2);
1052
- for (var H = [], Q = "tspan", Y = null, q = "", D = function() {
1053
- if (q) {
1054
- var yt = x(Q, Y, q);
1055
- 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;
1056
1043
  }
1057
- Q = "tspan", Y = null, q = "";
1058
- }, nt = 0, tt = e.length; nt < tt; nt++) {
1059
- var at = "", dt = "", ot = 0, lt = e[nt];
1060
- if (lt.length) {
1061
- H = [];
1062
- for (var wt = 0, Lt = 0, ht = void 0, X = 0, jt = lt.length; X < jt; X++) {
1063
- var R = lt[X], Z = R.font;
1064
- R.whitespace && wt++, Lt += R.width, X && !R.tracking && !ot && ne(Z.id, at) && ne(R.class, dt) && ne(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);
1065
- }
1066
- if (D(), I)
1067
- s.push.apply(s, Ee(H));
1068
- else {
1069
- var qt = null, Ct = nt === tt - 1 || lt[lt.length - 1] instanceof et;
1070
- 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);
1071
1050
  }
1072
- } else
1073
- s.push(x("tspan", { x: L(nt), dy: xt(nt ? B : J) + "em" }, " "));
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
+ }
1074
1067
  }
1068
+ return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: _n[A] || "start" }].concat(o));
1075
1069
  }
1076
- return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: En[w] || "start" }].concat(s));
1077
- }
1078
- var Tn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1079
- function _n(e, n, s) {
1080
- if (e.length) {
1081
- s.textBaseline = "middle";
1082
- var i = n.font(), c = i.height, p = i.size, w = n.valign(), x = n.height()(), k = n.width()(0), S = n.align(), M = S === "justify", O = 0.5 * c, I = Tn[w];
1083
- if (I && isFinite(x)) {
1084
- var L = e.length * c;
1085
- O += x * I - L * I;
1086
- }
1087
- e.forEach(function(B, J) {
1088
- var z = n.x()(J), P = J * c + O, j = 0, H = 0;
1089
- B.forEach(function(q) {
1090
- q.whitespace && j++, H += q.width;
1091
- });
1092
- var Q = 0, Y = J === e.length - 1 || B[B.length - 1] instanceof et;
1093
- M && B.length > 1 && !Y && (Q = (k - H) / j), B.forEach(function(q) {
1094
- s.font = q.font;
1095
- var D = q.font, nt = D.baseline ? p * -D.baseline + 0.15 * p : 0;
1096
- s.fillStyle = function(dt, ot) {
1097
- return dt.color ? dt.color : ot.href ? "#00C" : "#000";
1098
- }(D, q);
1099
- var tt = 0;
1100
- if (S === "right" ? tt += k - H : S === "center" ? tt += k / 2 - H / 2 : S === "justify" && (q.whitespace || q instanceof et) && (z += Q), s.fillText(q.value, z + tt, P + nt), q.href) {
1101
- s.beginPath(), s.strokeStyle = s.fillStyle;
1102
- var at = Math.floor(P + 0.45 * p) + 0.5;
1103
- s.moveTo(z + tt, at), s.lineTo(z + tt + q.width, at), s.stroke();
1104
- }
1105
- 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
+ });
1106
1099
  });
1107
- });
1100
+ }
1108
1101
  }
1109
- }
1110
- function ie(e) {
1111
- return ie = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1112
- return typeof n;
1113
- } : function(n) {
1114
- return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1115
- }, ie(e);
1116
- }
1117
- function ke(e) {
1118
- for (var n = {}, s = 0; s < e.length; s++) {
1119
- var i = e[s];
1120
- typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : ie(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);
1121
1108
  }
1122
- return n;
1123
- }
1124
- function Mt(e) {
1125
- return Mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1126
- return typeof n;
1127
- } : function(n) {
1128
- return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1129
- }, Mt(e);
1130
- }
1131
- function In(e, n) {
1132
- for (var s = 0; s < n.length; s++) {
1133
- var i = n[s];
1134
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
1135
- if (Mt(p) !== "object" || p === null)
1136
- return p;
1137
- var x = p[Symbol.toPrimitive];
1138
- if (x !== void 0) {
1139
- var k = x.call(p, w);
1140
- if (Mt(k) !== "object")
1141
- return k;
1142
- throw new TypeError("@@toPrimitive must return a primitive value.");
1143
- }
1144
- return String(p);
1145
- }(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;
1146
1115
  }
1147
- var c;
1148
- }
1149
- var Dn = b(), re = function(e) {
1150
- return typeof e == "function" ? e : function() {
1151
- return e;
1152
- };
1153
- }, it = function() {
1154
- function e(i) {
1155
- if (function(p, w) {
1156
- if (!(p instanceof w))
1157
- throw new TypeError("Cannot call a class as a function");
1158
- }(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
1159
- return 1 / 0;
1160
- }, height: function() {
1161
- return 1 / 0;
1162
- }, x: function() {
1163
- return 0;
1164
- }, font: null, tAnchor: 0, parser: e.defaultparser }, i)
1165
- for (var c in i)
1166
- 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);
1167
1122
  }
1168
- var n, s;
1169
- return n = e, s = [{ key: "linebreak", value: function(i) {
1170
- var c = this, p = this.props.parser(String(i)), w = this.font(), x = function(k, S, M) {
1171
- if (!k.length)
1172
- return [];
1173
- var O = S.height(), I = S.width(), L = S.overflowLine(), B = S.overflowWrap(), J = b(M, !0, !1), z = isFinite(O()) ? Math.floor(O() / M.height) : 1 / 0;
1174
- if (!O() && !I(0) || !z)
1175
- return [];
1176
- for (var P = 0, j = 0, H = 0, Q = [], Y = [], q = !1; P < k.length && j < z; ) {
1177
- var D = k[P], nt = An(D, M);
1178
- if (D.width = G(D, nt), D.font = nt, D.line = j, D.whitespace = D.value in C, D.value && (D.value = D.value.replace(bn, " ")), !(!H && D.whitespace || q && D.whitespace))
1179
- if (D instanceof et)
1180
- H = 0, Y = [], Q.push(P + 1), j++;
1181
- else if (D instanceof Dt || D instanceof gt)
1182
- Y.push({ index: P, width: H });
1183
- else if (D.whitespace || H + D.width < I(j))
1184
- H += D.width;
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;
1185
1166
  else if (Y.length) {
1186
1167
  var tt = void 0, at = void 0;
1187
1168
  do {
1188
1169
  at = !0, tt = Y.pop();
1189
- var dt = k[tt.index], ot = void 0;
1190
- dt instanceof gt && (ot = G("-", dt.font), tt.width + ot > I(j) && (at = !Y.length));
1170
+ var ft = S[tt.index], ot = void 0;
1171
+ ft instanceof yt && (ot = z("-", ft.font), tt.width + ot > _(j) && (at = !Y.length));
1191
1172
  } while (!at);
1192
- Q.push(tt.index + 1), H = 0, j++, P = tt.index, Y = [];
1173
+ Q.push(tt.index + 1), F = 0, j++, P = tt.index, Y = [];
1193
1174
  } else if (B === "break-word") {
1194
- var lt = I(j);
1195
- if (H + D.width > lt) {
1196
- var wt = D.clone();
1175
+ var lt = _(j);
1176
+ if (F + I.width > lt) {
1177
+ var At = I.clone();
1197
1178
  do
1198
- D.value = D.value.slice(0, -1), D.width = G(D, D.font), H += D.width;
1199
- while (D.value && D.width > lt);
1200
- wt.value = wt.value.slice(D.value.length), k.splice(P + 1, 0, new Dt(), wt);
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);
1201
1182
  }
1202
- Q.push(P + 1), H = 0, j++;
1203
- } else
1204
- H += D.width;
1205
- P++, q = D.whitespace;
1206
- }
1207
- P !== Q[Q.length - 1] && Q.push(P);
1208
- var Lt = 0, ht = 0, X = Q.map(function(yt) {
1209
- for (var K, mt = Lt; (K = k[mt]) && (K.whitespace || !K.value); )
1210
- mt++;
1211
- for (var ft = yt, ae = null; ft > mt && (K = k[ft - 1]) && (K.whitespace || !(K.value || K instanceof gt)); )
1212
- K instanceof et && (ae = K), ft--;
1213
- K instanceof gt && (K.value = "-", K.width = G("-", K.font)), Lt = yt;
1214
- var bt = k.slice(mt, ft).filter(function(le) {
1215
- return le.value;
1216
- });
1217
- return ae && bt.push(ae), bt.width = bt.reduce(function(le, Pn) {
1218
- return le + Pn.width;
1219
- }, 0), bt.width > ht && (ht = bt.width), bt;
1220
- });
1221
- if (X.hasLineOverflow = !1, L) {
1222
- var jt = L === "ellipsis" ? "…" : L;
1223
- X.forEach(function(yt, K) {
1224
- var mt = I(K);
1225
- if (yt.width > mt) {
1226
- var ft = new F(jt);
1227
- ft.font = M, ft.width = G(jt, J), Ae(yt, mt, ft), X.hasLineOverflow = !0;
1228
- }
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;
1229
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);
1230
1246
  }
1231
- var R = S.overflow() === "ellipsis" ? "…" : S.overflow();
1232
- if (R && P !== k.length) {
1233
- var Z = I(X.length - 1), qt = X[X.length - 1], Ct = new F(R);
1234
- Ct.font = M, Ct.width = G(R, J), Ae(qt, Z, Ct), X.hasOverflow = !0;
1235
- } else
1236
- X.hasOverflow = !1;
1237
- return X.font = M, X.width = ht, X;
1238
- }(p, this, w);
1239
- return x.height = x.length * w.height, x.render = function(k) {
1240
- return c.render(x, k);
1241
- }, x.svg = x.render, x.draw = x.render, x;
1242
- } }, { key: "font", value: function(i) {
1243
- return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(Dn);
1244
- } }, { key: "overflow", value: function(i) {
1245
- return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
1246
- } }, { key: "overflowLine", value: function(i) {
1247
- return arguments.length ? (this.props.lineclamp = String(i), this) : this.props.lineclamp;
1248
- } }, { key: "valign", value: function(i) {
1249
- return arguments.length ? (this.props.valign = i, this) : this.props.valign;
1250
- } }, { key: "align", value: function(i) {
1251
- if (!arguments.length)
1252
- return this.props.align;
1253
- var c = String(i).toLowerCase();
1254
- 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;
1255
- } }, { key: "overflowWrap", value: function(i) {
1256
- if (!arguments.length)
1257
- return this.props.overflowWrap || "normal";
1258
- var c = String(i).toLowerCase();
1259
- return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
1260
- } }, { key: "width", value: function(i) {
1261
- return arguments.length ? (this.props.width = re(i), this) : this.props.width;
1262
- } }, { key: "height", value: function(i) {
1263
- return arguments.length ? (this.props.height = re(i), this) : this.props.height;
1264
- } }, { key: "x", value: function(i) {
1265
- return arguments.length ? (this.props.x = re(i), this) : this.props.x;
1266
- } }, { key: "parser", value: function(i) {
1267
- if (!arguments.length)
1268
- return this.props.parser;
1269
- if (typeof i == "string") {
1270
- var c = e[i] || e[i + "parser"];
1271
- typeof c == "function" && (i = c);
1272
- }
1273
- if (typeof i != "function")
1274
- throw new Error("Unknown parser: " + i);
1275
- return this.props.parser = i, this;
1276
- } }, { key: "createElement", value: function(i) {
1277
- return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1278
- } }, { key: "render", value: function() {
1279
- var i = ke(arguments);
1280
- return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? _n(i.text, this, i.ctx) : Sn(i.text, this);
1281
- } }], s && In(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1282
- }();
1283
- function Ot(e) {
1284
- return Ot = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1285
- return typeof n;
1286
- } : function(n) {
1287
- return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1288
- }, Ot(e);
1289
- }
1290
- function se(e, n) {
1291
- (n == null || n > e.length) && (n = e.length);
1292
- for (var s = 0, i = new Array(n); s < n; s++)
1293
- i[s] = e[s];
1294
- return i;
1295
- }
1296
- function Mn(e, n) {
1297
- for (var s = 0; s < n.length; s++) {
1298
- var i = n[s];
1299
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
1300
- if (Ot(p) !== "object" || p === null)
1301
- return p;
1302
- var x = p[Symbol.toPrimitive];
1303
- if (x !== void 0) {
1304
- var k = x.call(p, w);
1305
- if (Ot(k) !== "object")
1306
- return k;
1307
- throw new TypeError("@@toPrimitive must return a primitive value.");
1308
- }
1309
- return String(p);
1310
- }(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);
1311
1262
  }
1312
- var c;
1313
- }
1314
- var Se = function(e) {
1315
- return typeof e == "function" ? e : function() {
1316
- return e;
1317
- };
1318
- }, Te = function() {
1319
- function e(i) {
1320
- if (function(p, w) {
1321
- if (!(p instanceof w))
1322
- throw new TypeError("Cannot call a class as a function");
1323
- }(this, e), this.props = { width: function() {
1324
- return 1 / 0;
1325
- }, height: function() {
1326
- return 1 / 0;
1327
- }, rotation: 0, vAnchor: 0, hAnchor: 0 }, i)
1328
- for (var c in i)
1329
- typeof this[c] == "function" && this[c](i[c]);
1330
- 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;
1331
1267
  }
1332
- var n, s;
1333
- return n = e, s = [{ key: "anchor", value: function(i) {
1334
- var c = this.props, p = c.hAnchor, w = c.vAnchor, x = c.width, k = c.height;
1335
- if (!arguments.length)
1336
- return [p * x(0), w * k(0)];
1337
- if (typeof i == "string") {
1338
- var S = this.props;
1339
- i.toLowerCase().trim().split(/\s+/).forEach(function(M) {
1340
- M === "top" && (S.vAnchor = -0), M === "middle" && (S.vAnchor = -0.5), M === "bottom" && (S.vAnchor = -1), M === "left" && (S.hAnchor = -0), M === "center" && (S.hAnchor = -0.5), M === "right" && (S.hAnchor = -1);
1341
- });
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);
1342
1281
  }
1343
- return this;
1344
- } }, { key: "width", value: function(i) {
1345
- return arguments.length ? (this.props.width = Se(i), this) : this.props.width;
1346
- } }, { key: "height", value: function(i) {
1347
- return arguments.length ? (this.props.height = Se(i), this) : this.props.height;
1348
- } }, { key: "rotate", value: function(i) {
1349
- return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
1350
- } }, { key: "createElement", value: function(i) {
1351
- return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1352
- } }, { key: "canvas", value: function(i, c) {
1353
- var p, w = i.getContext ? i.getContext("2d") : i;
1354
- return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
1355
- if (Array.isArray(x))
1356
- return se(x);
1357
- }(p = this.anchor()) || function(x) {
1358
- if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
1359
- return Array.from(x);
1360
- }(p) || function(x, k) {
1361
- if (x) {
1362
- if (typeof x == "string")
1363
- return se(x, k);
1364
- var S = Object.prototype.toString.call(x).slice(8, -1);
1365
- return S === "Object" && x.constructor && (S = x.constructor.name), S === "Map" || S === "Set" ? Array.from(x) : S === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S) ? se(x, k) : void 0;
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
+ });
1366
1308
  }
1367
- }(p) || function() {
1368
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
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.
1369
1332
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1370
- }()), c(w), w.restore(), w;
1371
- } }, { key: "render", value: function() {
1372
- var i = ke(arguments);
1373
- if (i.d3)
1374
- return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1375
- if (i.ctx)
1376
- return this.canvas(i.ctx, i.fn);
1377
- if (i.text) {
1378
- var c = typeof i.text.render == "function" ? i.text.render() : i.text;
1379
- return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
1380
- }
1381
- } }], s && Mn(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1382
- }(), On = Object.prototype.hasOwnProperty, oe = {};
1383
- function Ln(e) {
1384
- return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
1385
- return s + "-" + i.toLowerCase();
1386
- })), oe[e];
1387
- }
1388
- function _e(e, n) {
1389
- if (Array.isArray(n))
1390
- return n.forEach(function(s) {
1391
- 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);
1392
1352
  });
1393
- typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1394
- }
1395
- function Ie(e, n) {
1396
- if (typeof document < "u") {
1397
- var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1398
- if (n && s.setAttribute)
1399
- for (var i in n)
1400
- On.call(n, i) && n[i] != null && s.setAttribute(i === "className" ? "class" : Ln(i), n[i]);
1401
- for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
1402
- p[w - 2] = arguments[w];
1403
- return p != null && p.length && p.forEach(function(x) {
1404
- _e(s, x);
1405
- }), s;
1353
+ typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1406
1354
  }
1407
- }
1408
- it.createElement = Ie, it.textparser = Bt, it.defaultparser = Bt, it.htmlparser = function(e) {
1409
- e = String(e || "").trim();
1410
- for (var n, s, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], w = function(O) {
1411
- for (var I in i)
1412
- i[I] && (O[I] = i[I]);
1413
- c.push(O);
1414
- }, x = function(O) {
1415
- var I = c.length, L = un[O];
1416
- if (I && L) {
1417
- for (var B = I - 1; c[B] && (c[B] instanceof Dt || on.test(c[B].value)); )
1418
- B--;
1419
- for (; L && c[B] && c[B] instanceof et; )
1420
- B--, L--;
1421
- for (; L-- > 0; )
1422
- 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;
1423
1363
  }
1424
- }; e.length; ) {
1425
- if (n = /^[^<]+/.exec(e))
1426
- Bt(we(n[0]), !1).forEach(w);
1427
- else if (!(n = hn.exec(e)))
1428
- if (n = an.exec(e))
1429
- p.length && (i = p.pop()), x(n[1]);
1430
- else if (n = ln.exec(e)) {
1431
- var k = n[1];
1432
- x(k), p.push(i), i = Object.create(i), xe[k] && xe[k](i, "");
1433
- var S = pn(n[2]);
1434
- 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());
1435
- } else
1436
- n = [e.slice(0, 1)], w(new F(n[0]));
1437
- e = e.slice(n[0].length);
1438
1364
  }
1439
- for (var M = c[c.length - 1]; M instanceof et; )
1440
- c.pop(), M = c[c.length - 1];
1441
- return c;
1442
- }, it.latexparser = function(e) {
1443
- e = String(e || "").trim();
1444
- var n = [0];
1445
- e = e.replace(/\\verb,(.*?),/, function(z, P) {
1446
- return n.push(P), "\\verb," + (n.length - 1) + ",";
1447
- }).replace(/\\\\\n/g, function() {
1448
- return "\\\\";
1449
- }).replace(xn, function(z, P, j) {
1450
- return j.charAt(P - 1) === "\\" ? z : wn[z];
1451
- }).replace(/\n\s+/g, function(z) {
1452
- return /\n/.test(z.slice(1)) ? "\\par " : z;
1453
- }).replace(/\\symbol\{(\d+)\}/, function(z, P, j, H) {
1454
- return H.charAt(j - 1) === "\\" ? z : String.fromCharCode(1 * P);
1455
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(z, P, j, H) {
1456
- return P + j + "{" + H + "}";
1457
- }).replace(/\\verb,(.*?),/, function(z, P) {
1458
- return "\\verb,".concat(n[+P], ",");
1459
- });
1460
- for (var s, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], w = function(z) {
1461
- for (var P in i)
1462
- i[P] && (z[P] = i[P]);
1463
- return c.push(z), z;
1464
- }, x = function() {
1465
- p.push(i), i = Object.create(i);
1466
- }, k = function() {
1467
- if (!p.length)
1468
- throw new Error("Unexpected }");
1469
- i = p.pop();
1470
- }, S = { tokens: c, open_context: x, close_context: k, add_token: w }; e.length; ) {
1471
- if (s = mn.exec(e))
1472
- Bt(s[0], !1).forEach(w);
1473
- else if (s = vn.exec(e))
1474
- w(new F(s[1]));
1475
- else if (!(s = yn.exec(e))) {
1476
- if (s = /^\{/.exec(e))
1477
- x();
1478
- else if (s = /^\}/.exec(e))
1479
- k();
1480
- else if (!(s = /^\$/.exec(e)))
1481
- if (s = /^\\verb,([^,]+),/.exec(e))
1482
- w(new F(s[1]));
1483
- else if (s = gn.exec(e)) {
1484
- var M = s[1].slice(1) || s[1], O = !!s[2];
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];
1485
1425
  if (/^(La)?TeX$/i.test(M)) {
1486
1426
  x(), i.family = "serif";
1487
- var I = void 0;
1488
- M === "LaTeX" && ((I = w(new F("L"))).tracking = -0.25, (I = w(new F("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new F("T"))).tracking = -0.17, (I = w(new F("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new F("X")), k();
1489
- } else if (M in be)
1490
- w(new F(be[M])), O && x();
1491
- else if (M in U) {
1492
- 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;
1493
1432
  if (B) {
1494
- for (O = !1, e = e.slice(s[0].length - 1); B--; ) {
1495
- if (!(J = /^\{([^}]+)\}/.exec(e)))
1496
- 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");
1497
1435
  L.push(J[1]), e = e.slice(J[0].length);
1498
1436
  }
1499
- s[0] = /^\{/.exec(e) ? "{" : "", O = !!s[0];
1437
+ o[0] = /^\{/.exec(e) ? "{" : "", O = !!o[0];
1500
1438
  }
1501
- O && x(), U[M].apply(S, [i].concat(L));
1502
- } else
1503
- console.warn("unknown latex command", M), w(new F(s[1])), O && x();
1504
- } else
1505
- s = [e.slice(0, 1)], w(new F(s[0]));
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);
1506
1444
  }
1507
- e = e.slice(s[0].length);
1508
- }
1509
- return c;
1510
- }, it.measureText = function(e, n, s) {
1511
- return G(e, b(n), s);
1512
- }, it.Token = F, it.Break = Dt, it.LineBreak = et, it.SoftHyphen = gt, it.Rotator = Te, Te.createElement = Ie;
1513
- const Cn = it;
1514
- return r.default;
1515
- })());
1516
- })(Qe);
1517
- var Qn = Qe.exports;
1518
- const ze = /* @__PURE__ */ Xe(Qn);
1519
- function ce(a) {
1520
- return a.replace(/…$/, "");
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;
1521
1453
  }
1454
+ var ur = cr();
1455
+ const Be = /* @__PURE__ */ en(ur);
1522
1456
  function ue(a) {
1457
+ return a.replace(/…$/, "");
1458
+ }
1459
+ function de(a) {
1523
1460
  return a.children[0].innerHTML;
1524
1461
  }
1525
- function ti(a, h) {
1526
- const t = ut(a), { fontSize: r, font: o, padding: l = 0 } = a.properties.style || {};
1527
- if (t.width === t.height && t.width === 0)
1528
- return;
1529
- const u = new ze({
1530
- font: `${r}px/${r}px ${o}`.replace(/(px)+/g, "px"),
1531
- width: t.width - l * 2,
1532
- 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,
1533
1469
  align: "left",
1534
1470
  valign: "top",
1535
1471
  x: 0,
1536
1472
  overflow: "ellipsis",
1537
1473
  parser: "html",
1538
- createElement: ze.createElement
1474
+ createElement: Be.createElement
1539
1475
  });
1540
1476
  u.overflowWrap("break-word");
1541
1477
  const g = u.linebreak(
@@ -1545,65 +1481,65 @@ function ti(a, h) {
1545
1481
  let y = 0;
1546
1482
  const v = [];
1547
1483
  a.properties.content.split(`
1548
- `).forEach((b) => {
1549
- let C = b;
1550
- for (; C.length && y < f.length; ) {
1484
+ `).forEach((w) => {
1485
+ let $ = w;
1486
+ for (; $.length && y < f.length; ) {
1551
1487
  if (f[y].innerHTML === "&nbsp;") {
1552
- C.startsWith(`
1488
+ $.startsWith(`
1553
1489
  `) || v.push(y), y++;
1554
1490
  break;
1555
1491
  }
1556
- const E = ce(ue(f[y]));
1557
- C.startsWith(E) && (C = C.slice(E.length).trim()), y++;
1492
+ const E = ue(de(f[y]));
1493
+ $.startsWith(E) && ($ = $.slice(E.length).trim()), y++;
1558
1494
  }
1559
- }), v.forEach((b) => g.removeChild(f[b]));
1560
- const T = a.properties.content.match(/(https?:\/\/.*)/gm), A = T ? T.map((b) => b.split(" ")[0]) : [];
1561
- g.setAttribute("transform", `translate(${l}, ${l})`), A.forEach((b) => {
1562
- let C = b;
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;
1563
1499
  const E = [];
1564
- for (; C.length > 0; ) {
1565
- const $ = f.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && C.startsWith(ce(ue(_))));
1566
- if (!$)
1567
- break;
1568
- E.push($);
1569
- const N = ce($.children[0].innerHTML).length;
1570
- if (!N)
1571
- break;
1572
- C = C.slice(N);
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);
1573
1509
  }
1574
- E.forEach(($) => {
1510
+ E.forEach((C) => {
1575
1511
  const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
1576
- N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = ue($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
1512
+ N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML = de(C), C.children[0].innerHTML = "", C.children[0].appendChild(N);
1577
1513
  });
1578
- }), h.appendChild(g);
1514
+ }), l.appendChild(g);
1579
1515
  }
1580
- const Ne = 20;
1581
- class ei extends Je {
1516
+ const je = 20;
1517
+ class fr extends rn {
1582
1518
  constructor(t, r = {}) {
1583
1519
  super(
1584
1520
  t,
1585
1521
  `
1586
- <div class="annotation-text-handle">
1587
- <span class="handle line-handle top" data-handle-id="0"></span>
1588
- <span class="handle line-handle bottom" data-handle-id="1"></span>
1589
- <span class="handle line-handle left" data-handle-id="2"></span>
1590
- <span class="handle line-handle right" data-handle-id="3"></span>
1591
- <span class="handle top right point-handle top-right" data-handle-id="4"></span>
1592
- <span class="handle left top point-handle top-left" data-handle-id="5"></span>
1593
- <span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
1594
- <span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
1595
- <textarea wrap="on"></textarea>
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>
1596
1532
  </div>
1597
1533
  `
1598
1534
  );
1599
1535
  m(this, "textArea");
1600
1536
  m(this, "handleSize");
1601
1537
  m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
1602
- m(this, "annotation", { ...he });
1538
+ m(this, "annotation", { ...ce });
1603
1539
  m(this, "startX", 0);
1604
1540
  m(this, "startY", 0);
1605
1541
  m(this, "handles", []);
1606
- m(this, "draggedHandle", V);
1542
+ m(this, "draggedHandle", W);
1607
1543
  m(this, "isFocused", !1);
1608
1544
  m(this, "placeholder", "Type your text here...");
1609
1545
  m(this, "_onFocus", () => {
@@ -1612,50 +1548,47 @@ class ei extends Je {
1612
1548
  m(this, "_onBlur", () => {
1613
1549
  this.isFocused = !1;
1614
1550
  });
1615
- m(this, "startDrawing", (t, r, o = Jn(t, r, 0, 0, "", St)) => {
1616
- this.add(o);
1617
- const l = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1618
- this.select(o.id), this.startDragging(this.getById(o.id), l.x, l.y), this.draggedHandle = 6;
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;
1619
1555
  });
1620
1556
  m(this, "cancelDrawing", () => {
1621
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...he }, this.draggedHandle = V, this.isDragging = !1, this.emit(Tt, this.annotation));
1557
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ce }, this.draggedHandle = W, this.isDragging = !1, this.emit(It, this.annotation));
1622
1558
  });
1623
- m(this, "startDragging", (t, r, o) => {
1559
+ m(this, "startDragging", (t, r, s) => {
1624
1560
  this.annotation = t;
1625
- const l = ct(this.annotation), u = ut(this.annotation);
1626
- this.rect.x = l.x, this.rect.y = l.y, this.rect.width = u.width, this.rect.height = u.height, this.startX = r, this.startY = o, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Kt, this.annotation), this.isDragging = !0;
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;
1627
1563
  });
1628
1564
  m(this, "onHandleMouseDown", (t) => {
1629
1565
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
1630
- if (!r)
1631
- return;
1566
+ if (!r) return;
1632
1567
  this.selectedId !== r.id && this.select(this.hoveredId);
1633
- const { x: o, y: l } = Xt(t, this.ogma.getContainer());
1634
- this.startDragging(r, o, l), this.draggedHandle = Ve(t.target);
1568
+ const { x: s, y: h } = fe(t, this.ogma.getContainer());
1569
+ this.startDragging(r, s, h), this.draggedHandle = Ze(t.target);
1635
1570
  });
1636
1571
  m(this, "onMouseMove", (t) => {
1637
1572
  requestAnimationFrame(() => this._onMouseMove(t));
1638
1573
  });
1639
1574
  m(this, "_onMouseMove", (t) => {
1640
- if (!this.isDragging)
1641
- return;
1575
+ if (!this.isDragging) return;
1642
1576
  t.stopPropagation(), t.preventDefault();
1643
- const r = this.handles[this.draggedHandle], o = r.classList.contains("top"), l = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom"), g = r.classList.contains("line-handle"), { x: f, y } = Xt(
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(
1644
1583
  t,
1645
1584
  this.ogma.getContainer()
1646
- ), 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);
1647
- (d && l || o && u) && (C.y = 0, C.x = 0);
1648
- 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(
1649
- this.rect.width + T * (g || l ? 0 : 1),
1650
- Ne
1651
- ), _ = Math.max(
1652
- this.rect.height + A * (g || o ? 0 : 1),
1653
- Ne
1654
1585
  );
1655
- Bn(this.annotation, E, $, N, _), this.emit(Zt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
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();
1656
1589
  });
1657
1590
  m(this, "onMouseUp", () => {
1658
- !this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Tt, this.annotation), this.isDragging = !1, this.draggedHandle = V);
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);
1659
1592
  });
1660
1593
  m(this, "_onMousedown", (t) => {
1661
1594
  t.stopPropagation();
@@ -1666,142 +1599,144 @@ class ei extends Je {
1666
1599
  });
1667
1600
  m(this, "_onInput", () => {
1668
1601
  const t = this.getById(this.selectedId);
1669
- t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ye, t), this.layer.refresh());
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());
1670
1603
  });
1671
- this.showeditorOnHover = !1, this.handleSize = $e.handleSize || r.textHandleSize, this.placeholder = $e.placeholder || r.textPlaceholder || "";
1672
- const o = this.textArea = this.editor.element.querySelector("textarea");
1673
- o.addEventListener("input", this._onInput), o.addEventListener("focus", this._onFocus), o.addEventListener("blur", this._onBlur), o.addEventListener("mousedown", this._onMousedown), o.spellcheck = !1, this.handles = Array.prototype.slice.call(
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(
1674
1607
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
1675
- ), this.handles.forEach(
1676
- (l) => l.addEventListener("mousedown", this.onHandleMouseDown)
1608
+ ), this.handles.push(this.editor.element), this.handles.forEach(
1609
+ (h) => h.addEventListener("mousedown", this.onHandleMouseDown)
1677
1610
  ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
1678
1611
  }
1679
1612
  _canRemove() {
1680
1613
  return !this.isFocused;
1681
1614
  }
1682
- detect({ x: t, y: r }, o = 0) {
1683
- const l = { x: t, y: r }, u = this.ogma.view.getAngle();
1615
+ detect({ x: t, y: r }, s = 0) {
1616
+ const h = { x: t, y: r }, u = this.ogma.view.getAngle();
1684
1617
  return this.elements.find((d) => {
1685
- const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), T = { x: g, y: f }, { x: A, y: b } = rt(vt(l, T), -u);
1686
- return A > -o && A < y + o && b > -o && b < v + o;
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;
1687
1620
  });
1688
1621
  }
1689
1622
  draw(t) {
1690
1623
  t.innerHTML = "";
1691
- const r = "", o = this.ogma.view.getAngle();
1692
- this.elements.forEach((u, d) => {
1693
- const g = `class${d}`, f = ut(u), y = ct(u), v = u.id, {
1694
- color: T,
1695
- fontSize: A,
1696
- font: b,
1697
- strokeColor: C,
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: $,
1698
1633
  strokeWidth: E,
1699
- strokeType: $,
1700
- background: N
1701
- } = u.properties.style || St;
1702
- if (v === this.selectedId)
1703
- return;
1704
- const _ = Pt("g");
1705
- _.classList.add("annotation-text"), _.setAttribute("fill", `${T}`), _.setAttribute("font-size", `${A}px`), _.setAttribute("font-family", `${b}`);
1706
- const G = Pt("rect");
1707
- let W = !1;
1708
- $ && $ !== "none" && (W = !0, G.setAttribute("stroke", C || "black"), G.setAttribute("stroke-width", `${E}`), $ === "dashed" && G.setAttribute("stroke-dasharray", "5,5")), (N && N.length || W) && (W = !0, G.setAttribute("fill", N || "transparent")), W && (G.setAttribute("width", `${f.width}`), G.setAttribute("height", `${f.height}`)), _.appendChild(G), ti(u, _);
1709
- const { x: _t, y: It } = rt(y, -o);
1710
- _.setAttribute("transform", `translate(${_t},${It})`), _.classList.add(g), _.setAttribute("data-annotation", `${u.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
1711
- });
1712
- const l = Pt("style");
1713
- 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);
1714
1648
  }
1715
1649
  refreshDrawing() {
1716
- const t = this.ogma.view.getAngle();
1717
- [...this.layer.element.children].forEach((r) => {
1718
- const o = r.getAttribute("data-annotation");
1719
- if (!o)
1720
- return;
1721
- const l = ct(this.getById(o)), { x: u, y: d } = rt(l, -t);
1722
- r.setAttribute("transform", `translate(${u},${d})`);
1723
- });
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
+ }
1724
1657
  }
1725
1658
  getDefaultOptions() {
1726
- return he;
1659
+ return ce;
1727
1660
  }
1728
1661
  refreshEditor() {
1729
- if (+this.selectedId < 0 && +this.hoveredId < 0)
1730
- return;
1731
- 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(
1732
1664
  ct(t)
1733
- ), l = this.ogma.view.getZoom(), {
1665
+ ), h = this.ogma.view.getZoom(), {
1734
1666
  font: u,
1735
1667
  fontSize: d,
1736
1668
  color: g,
1737
1669
  background: f,
1738
1670
  padding: y = 0
1739
- } = t.properties.style || St, v = (d || 1) * l;
1740
- this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${o.x}px, ${o.y}px)translate(-50%, -50%)translate(${r.width / 2 * l}px, ${r.height / 2 * l}px)`, this.editor.element.style.width = `${r.width * l}px`, this.editor.element.style.height = `${r.height * l}px`, this.textArea.style.font = `${v} ${u}`, this.textArea.style.fontFamily = u || "sans-serif", this.textArea.style.fontSize = `${v}px`, this.textArea.style.padding = `${l * y}px`, this.textArea.style.lineHeight = `${v}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = g || "black", this.textArea.style.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
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();
1741
1677
  }
1742
1678
  select(t) {
1743
- super.select(t), this.textArea.focus();
1679
+ super.select(t), this.textArea.classList.add("noevents");
1744
1680
  }
1745
1681
  destroy() {
1746
1682
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
1747
1683
  }
1748
1684
  }
1749
- class ni {
1685
+ class pr {
1750
1686
  constructor() {
1751
1687
  m(this, "links", {});
1752
1688
  m(this, "linksByTargetId", {});
1753
1689
  m(this, "linksByArrowId", {});
1754
1690
  }
1755
- add(h, t, r, o, l) {
1756
- const u = Jt(), d = h.id, g = {
1691
+ add(l, t, r, s, h) {
1692
+ const u = Qt(), d = l.id, g = {
1757
1693
  id: u,
1758
1694
  arrow: d,
1759
1695
  target: r,
1760
- targetType: o,
1761
- connectionPoint: l,
1696
+ targetType: s,
1697
+ connectionPoint: h,
1762
1698
  side: t
1763
1699
  };
1764
- 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, h.properties.link = h.properties.link || {}, h.properties.link[t] = {
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] = {
1765
1701
  id: r,
1766
1702
  side: t,
1767
- type: o,
1768
- magnet: l
1703
+ type: s,
1704
+ magnet: h
1769
1705
  }, this;
1770
1706
  }
1771
- arrowIsLinked(h, t) {
1707
+ arrowIsLinked(l, t) {
1772
1708
  var r;
1773
- return !!((r = this.linksByArrowId[h]) != null && r[t]);
1709
+ return !!((r = this.linksByArrowId[l]) != null && r[t]);
1774
1710
  }
1775
1711
  // remove the link between the arrow and the target by arrow id and side
1776
- remove(h, t) {
1712
+ remove(l, t) {
1777
1713
  var d, g;
1778
- const r = h.id, o = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
1779
- if ((g = h.properties.link) == null || delete g[t], !o)
1780
- return this;
1781
- const l = this.links[o];
1782
- delete this.links[o];
1783
- 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];
1784
1719
  for (let f = 0; f < u.length; f++)
1785
- if (u[f] === o) {
1720
+ if (u[f] === s) {
1786
1721
  u.splice(f, 1);
1787
1722
  break;
1788
1723
  }
1789
1724
  return delete this.linksByArrowId[r][t], this;
1790
1725
  }
1791
- getArrowLink(h, t) {
1792
- var o;
1793
- const r = (o = this.linksByArrowId[h]) == null ? void 0 : o[t];
1726
+ getArrowLink(l, t) {
1727
+ var s;
1728
+ const r = (s = this.linksByArrowId[l]) == null ? void 0 : s[t];
1794
1729
  return r ? this.links[r] : null;
1795
1730
  }
1796
- getTargetLinks(h, t) {
1731
+ getTargetLinks(l, t) {
1797
1732
  var r;
1798
- return ((r = this.linksByTargetId[h]) == null ? void 0 : r.map((o) => this.links[o]).filter((o) => o.targetType === t)) ?? [];
1733
+ return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((s) => this.links[s]).filter((s) => s.targetType === t)) ?? [];
1799
1734
  }
1800
- forEach(h) {
1801
- Object.values(this.links).forEach(h);
1735
+ forEach(l) {
1736
+ Object.values(this.links).forEach(l);
1802
1737
  }
1803
1738
  }
1804
- const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type === "text", He = (a) => a.type === "FeatureCollection", ii = {
1739
+ const st = (a) => a.properties.type === "arrow", gt = (a) => a.properties.type === "text", Ve = (a) => a.type === "FeatureCollection", gr = {
1805
1740
  magnetColor: "#3e8",
1806
1741
  detectMargin: 20,
1807
1742
  magnetHandleRadius: 5,
@@ -1811,7 +1746,7 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
1811
1746
  textHandleSize: 3.5,
1812
1747
  minArrowHeight: 20,
1813
1748
  maxArrowHeight: 30
1814
- }, Fe = ["start", "end"], Be = [
1749
+ }, Ue = ["start", "end"], We = [
1815
1750
  { x: 0, y: 0 },
1816
1751
  { x: 0.5, y: 0 },
1817
1752
  { x: 1, y: 0 },
@@ -1821,12 +1756,12 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
1821
1756
  { x: 0.5, y: 1 },
1822
1757
  { x: 1, y: 1 }
1823
1758
  ];
1824
- class oi extends Ke {
1759
+ class vr extends nn {
1825
1760
  constructor(t, r = {}) {
1826
1761
  super();
1827
1762
  m(this, "arrows");
1828
1763
  m(this, "texts");
1829
- m(this, "links", new ni());
1764
+ m(this, "links", new pr());
1830
1765
  m(this, "layer");
1831
1766
  m(this, "annotations");
1832
1767
  m(this, "ogma");
@@ -1838,77 +1773,74 @@ class oi extends Ke {
1838
1773
  m(this, "textToMagnet");
1839
1774
  m(this, "activeLinks", []);
1840
1775
  m(this, "_render", (t) => {
1841
- if (!this.dragged || this.textToMagnet === void 0)
1842
- return;
1776
+ if (!this.dragged || this.textToMagnet === void 0) return;
1843
1777
  t.beginPath(), t.fillStyle = "green";
1844
1778
  const r = this.ogma.view.getZoom();
1845
- Be.forEach((o) => {
1846
- if (!this.textToMagnet)
1847
- return;
1848
- 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);
1849
1782
  t.moveTo(f, y), t.arc(f, y, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
1850
1783
  }), t.fill(), t.closePath();
1851
1784
  });
1852
1785
  m(this, "_onFeatureDrag", (t, r) => {
1853
- const o = r;
1854
- if (st(t) && o === "line")
1855
- ["start", "end"].find((l) => {
1856
- const u = l === "start" ? $t(t) : Wt(t);
1857
- return this._snapToText(t, o, u) || this._findAndSnapToNode(t, l, u);
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);
1858
1791
  });
1859
- else if (st(t) && o !== "line") {
1860
- const l = o === "start" ? $t(t) : Wt(t);
1861
- this._snapToText(t, o, l) || this._findAndSnapToNode(t, o, l);
1862
- } else
1863
- pt(t) && (this.activeLinks.forEach(({ arrow: l, side: u, connectionPoint: d }) => {
1864
- const g = this.getAnnotation(l), f = ut(t), y = ct(t), v = Ut(d, { x: f.width, y: f.height }), T = rt(v, this.ogma.view.getAngle()), A = Et(T, y);
1865
- g.geometry.coordinates[u === "start" ? 0 : 1] = [A.x, A.y];
1866
- }), this.activeLinks.length && this.arrows.refreshLayer());
1867
- this.layer.refresh(), this.emit(Zt, 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);
1868
1800
  });
1869
1801
  m(this, "_onFeatureDragEnd", (t) => {
1870
- this.dragged !== null && st(t) && $t(this.dragged) && Fe.forEach((r) => {
1871
- this.links.getArrowLink(t.id, r) && this.emit(Yn, {
1802
+ this.dragged !== null && st(t) && zt(this.dragged) && Ue.forEach((r) => {
1803
+ this.links.getArrowLink(t.id, r) && this.emit(ir, {
1872
1804
  arrow: t,
1873
1805
  link: this.links.getArrowLink(t.id, r)
1874
1806
  });
1875
- }), (pt(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(Tt, t);
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);
1876
1808
  });
1877
1809
  m(this, "_onFeatureDragStart", (t) => {
1878
- this.textToMagnet = void 0, st(t) ? this.dragged = t : pt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
1879
- const o = r.getSelectedFeature();
1880
- o && o !== t && r.unhover().unselect(), r.disableDetection();
1881
- }), this.emit(Kt, t);
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);
1882
1814
  });
1883
1815
  m(this, "_onNodesDragStart", () => {
1884
1816
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
1885
1817
  });
1886
1818
  m(this, "_onNodesDrag", (t) => {
1887
- const { dx: r, dy: o } = t;
1888
- this._moveNodes(t.nodes, r, o);
1819
+ const { dx: r, dy: s } = t;
1820
+ this._moveNodes(t.nodes, r, s);
1889
1821
  });
1890
1822
  m(this, "_onLayoutEnd", (t) => {
1891
- t.ids.forEach((r, o) => {
1823
+ t.ids.forEach((r, s) => {
1892
1824
  this.links.getTargetLinks(r, "node").forEach((u) => {
1893
- const d = this.getAnnotation(u.arrow), g = u.side, f = Rt(
1825
+ const d = this.getAnnotation(u.arrow), g = u.side, f = Vt(
1894
1826
  d,
1895
1827
  g === "start" ? "end" : "start"
1896
- ), y = t.positions.current[o], v = this.ogma.getNode(r).getAttribute("radius"), T = Vt(f, y, +v);
1897
- At(d, g, T.x, T.y);
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);
1898
1830
  });
1899
1831
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
1900
1832
  });
1901
1833
  m(this, "_onAdded", (t) => {
1902
- this.emit(ge, t);
1834
+ this.emit(me, t);
1903
1835
  });
1904
1836
  m(this, "_onRemoved", (t) => {
1905
- this.emit(pe, t);
1837
+ this.emit(ye, t);
1906
1838
  });
1907
1839
  m(this, "_onUnselect", (t) => {
1908
- this.selected = null, this.emit(fe, t);
1840
+ this.selected = null, this.emit(ge, t);
1909
1841
  });
1910
1842
  m(this, "_onSelect", (t) => {
1911
- this.selected !== t && (this.selected = t, this.emit(de, this.selected));
1843
+ this.selected !== t && (this.selected = t, this.emit(pe, this.selected));
1912
1844
  });
1913
1845
  /**
1914
1846
  * Triggers the update event on the annotation
@@ -1920,61 +1852,59 @@ class oi extends Ke {
1920
1852
  );
1921
1853
  });
1922
1854
  m(this, "_onUpdate", (t) => {
1923
- this.emit(ye, t);
1855
+ this.emit(ve, t);
1924
1856
  });
1925
- this.options = this.setOptions({ ...ii, ...r }), this.ogma = t, this.arrows = new Kn(t, this.options), this.texts = new ei(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
1926
- o.on(Kt, this._onFeatureDragStart).on(Zt, this._onFeatureDrag).on(Tt, this._onFeatureDragEnd).on(ye, this.onUpdate).on(fe, this._onUnselect).on(de, this._onSelect).on(ge, this._onAdded).on(pe, this._onRemoved);
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);
1927
1859
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
1928
1860
  this.refreshTextLinks();
1929
1861
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
1930
1862
  }
1931
- _moveNodes(t, r, o) {
1932
- t.forEach((l) => {
1933
- const u = this.links.getTargetLinks(l.getId(), "node"), d = l.getPosition();
1863
+ _moveNodes(t, r, s) {
1864
+ t.forEach((h) => {
1865
+ const u = this.links.getTargetLinks(h.getId(), "node"), d = h.getPosition();
1934
1866
  u.forEach((g) => {
1935
- const f = this.getAnnotation(g.arrow), y = g.side, v = Rt(
1867
+ const f = this.getAnnotation(g.arrow), y = g.side, v = Vt(
1936
1868
  f,
1937
1869
  y === "start" ? "end" : "start"
1938
1870
  );
1939
- let T = d;
1940
- const A = +l.getAttribute("radius"), b = 1e-6;
1941
- (g.connectionPoint.x - (d.x - r) > b || g.connectionPoint.y - (d.y - o) > b) && (T = Vt(v, d, A)), At(f, y, T.x, T.y);
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);
1942
1874
  });
1943
1875
  }), this.arrows.refreshLayer();
1944
1876
  }
1945
- _snapToText(t, r, o) {
1946
- const l = this.texts.detect(o, this.options.detectMargin);
1947
- if (this.links.remove(t, r), !l)
1948
- return !1;
1949
- this.textToMagnet = l;
1950
- const u = this.findMagnetPoint(Be, l, o);
1951
- 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;
1952
1883
  }
1953
- _findAndSnapToNode(t, r, o) {
1884
+ _findAndSnapToNode(t, r, s) {
1954
1885
  var d, g;
1955
- const l = this.ogma.view.graphToScreenCoordinates(o), u = this.ogma.view.getElementAt(l);
1956
- 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, l)) : ((g = this.hoveredNode) == null || g.setSelected(!1), this.hoveredNode = null);
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);
1957
1888
  }
1958
- _snapToNode(t, r, o, l) {
1959
- const u = o.getPositionOnScreen(), d = +o.getAttribute("radius"), g = d * this.ogma.view.getZoom(), f = l.x - u.x, y = l.y - u.y, v = Math.sqrt(f * f + y * y), T = o.getPosition();
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();
1960
1891
  if (v < g + this.options.detectMargin) {
1961
- let A = T;
1892
+ let b = k;
1962
1893
  if (v > g / 2) {
1963
- const b = Rt(t, r === "end" ? "start" : "end");
1964
- A = Vt(b, A, d);
1894
+ const w = Vt(t, r === "end" ? "start" : "end");
1895
+ b = Ut(w, b, d);
1965
1896
  }
1966
- At(t, r, A.x, A.y), this.links.add(t, r, o.getId(), "node", A);
1897
+ kt(t, r, b.x, b.y), this.links.add(t, r, s.getId(), "node", b);
1967
1898
  }
1968
1899
  }
1969
1900
  refreshTextLinks() {
1970
1901
  let t = !1;
1971
1902
  this.links.forEach(
1972
- ({ connectionPoint: r, targetType: o, target: l, arrow: u, side: d }) => {
1973
- if (o !== "text")
1974
- return;
1903
+ ({ connectionPoint: r, targetType: s, target: h, arrow: u, side: d }) => {
1904
+ if (s !== "text") return;
1975
1905
  t = !0;
1976
- const g = this.getAnnotation(l), f = this.getAnnotation(u), y = ut(g), v = ct(g), T = Ut(r, { x: y.width, y: y.height }), A = rt(T, this.ogma.view.getAngle()), b = Et(A, v);
1977
- At(f, d, b.x, b.y);
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);
1978
1908
  }
1979
1909
  ), t && this.arrows.refreshLayer();
1980
1910
  }
@@ -1984,24 +1914,24 @@ class oi extends Ke {
1984
1914
  getSelected() {
1985
1915
  return this.selected;
1986
1916
  }
1987
- findMagnetPoint(t, r, o) {
1988
- let l;
1917
+ findMagnetPoint(t, r, s) {
1918
+ let h;
1989
1919
  for (const u of t) {
1990
- const d = ut(r), g = ct(r), f = Ut(u, { x: d.width, y: d.height }), y = rt(f, this.ogma.view.getAngle()), v = Et(y, g), T = kt(vt(v, o)), A = Math.min(
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(
1991
1921
  this.options.magnetRadius * this.ogma.view.getZoom(),
1992
1922
  // when really zoomed in: avoid to snap on too far away magnets
1993
1923
  d.width / 2,
1994
1924
  d.height / 2
1995
1925
  );
1996
- if (T < Math.max(A, this.options.magnetHandleRadius)) {
1997
- l = {
1926
+ if (k < Math.max(b, this.options.magnetHandleRadius)) {
1927
+ h = {
1998
1928
  point: v,
1999
1929
  magnet: u
2000
1930
  };
2001
1931
  break;
2002
1932
  }
2003
1933
  }
2004
- return l;
1934
+ return h;
2005
1935
  }
2006
1936
  /**
2007
1937
  * Set the options for the controller
@@ -2019,31 +1949,32 @@ class oi extends Ke {
2019
1949
  * @param id the id of the annotation to select
2020
1950
  */
2021
1951
  select(t) {
2022
- const r = this.getAnnotations().features.find((o) => o.id === t);
2023
- return r ? (st(r) ? this.arrows.select(r.id) : pt(r) && this.texts.select(r.id), this) : this;
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;
2024
1954
  }
2025
1955
  /**
2026
1956
  * Unselects the currently selected annotation
2027
1957
  */
2028
1958
  unselect() {
2029
- return this.selected ? (st(this.selected) ? this.arrows.unselect() : pt(this.selected) && this.texts.unselect(), this) : this;
1959
+ return this.selected ? (st(this.selected) ? this.arrows.unselect() : gt(this.selected) && this.texts.unselect(), this) : this;
2030
1960
  }
2031
1961
  /**
2032
1962
  * Add an annotation to the controller
2033
1963
  * @param annotation The annotation to add
2034
1964
  */
2035
1965
  add(t) {
2036
- if (He(t)) {
2037
- const [r, o] = t.features.reduce(
2038
- (l, u) => (st(u) ? l[1].push(u) : pt(u) && l[0].push(u), l),
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),
2039
1969
  [[], []]
2040
1970
  );
2041
- return r.forEach((l) => this.add(l)), o.forEach((l) => this.add(l)), this.arrows.refreshLayer(), this;
1971
+ return r.forEach((h) => this.add(h)), s.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
2042
1972
  }
2043
1973
  switch (t.properties.type) {
2044
1974
  case "text":
2045
1975
  this.texts.add(t);
2046
1976
  break;
1977
+ // more to follow
2047
1978
  default:
2048
1979
  this.arrows.add(t), this.loadLink(t);
2049
1980
  break;
@@ -2055,29 +1986,27 @@ class oi extends Ke {
2055
1986
  * @param annotation The annotation(s) to remove
2056
1987
  */
2057
1988
  remove(t) {
2058
- return He(t) ? (t.features.forEach(
1989
+ return Ve(t) ? (t.features.forEach(
2059
1990
  (r) => this.remove(r)
2060
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);
2061
1992
  }
2062
1993
  loadLink(t) {
2063
1994
  if (t.properties.link)
2064
- for (const r of Fe) {
2065
- const o = t.properties.link[r];
2066
- if (!o)
2067
- continue;
2068
- const l = this.getAnnotation(o.id);
2069
- if (o.type === "text" && l)
2070
- this.links.add(t, r, o.id, o.type, o.magnet);
2071
- else if (o.type === "node") {
2072
- const u = this.ogma.getNode(o.id);
2073
- if (!u)
2074
- continue;
2075
- this.links.add(t, r, o.id, o.type, o.magnet);
2076
- 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(
2077
2006
  t,
2078
2007
  r === "start" ? "end" : "start"
2079
- ), y = Vt(f, d, +g);
2080
- At(t, r, y.x, y.y);
2008
+ ), y = Ut(f, d, +g);
2009
+ kt(t, r, y.x, y.y);
2081
2010
  }
2082
2011
  }
2083
2012
  }
@@ -2087,8 +2016,8 @@ class oi extends Ke {
2087
2016
  * @param y coord of the first point
2088
2017
  * @param arrow The arrow to add
2089
2018
  */
2090
- startArrow(t, r, o) {
2091
- this.cancelDrawing(), this.arrows.startDrawing(t, r, o);
2019
+ startArrow(t, r, s) {
2020
+ this.cancelDrawing(), this.arrows.startDrawing(t, r, s);
2092
2021
  }
2093
2022
  /**
2094
2023
  * Start adding a text (add it, and give control to the user)
@@ -2096,14 +2025,14 @@ class oi extends Ke {
2096
2025
  * @param y coord of the top left point
2097
2026
  * @param text The text to add
2098
2027
  */
2099
- startText(t, r, o) {
2100
- this.cancelDrawing(), this.texts.startDrawing(t, r, o);
2028
+ startText(t, r, s) {
2029
+ this.cancelDrawing(), this.texts.startDrawing(t, r, s);
2101
2030
  }
2102
2031
  /**
2103
2032
  * Cancel drawing on the current frame
2104
2033
  */
2105
2034
  cancelDrawing() {
2106
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Wn);
2035
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(rr);
2107
2036
  }
2108
2037
  /**
2109
2038
  * Update the style of the annotation with the given id
@@ -2111,12 +2040,12 @@ class oi extends Ke {
2111
2040
  * @param style The new style
2112
2041
  */
2113
2042
  updateStyle(t, r) {
2114
- const o = this.getAnnotations().features.find((l) => l.id === t);
2115
- return o ? (st(o) ? this.arrows.updateStyle(o, r) : pt(o) && this.texts.updateStyle(o, r), this.onUpdate(o), this) : this;
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;
2116
2045
  }
2117
- setScale(t, r, o, l) {
2046
+ setScale(t, r, s, h) {
2118
2047
  const u = this.getAnnotations().features.find((d) => d.id === t);
2119
- return u ? (st(u) ? this.arrows.scale(u, r, o, l) : pt(u) && this.texts.scale(u, r, o, l), this.onUpdate(u), this) : this;
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;
2120
2049
  }
2121
2050
  /**
2122
2051
  *
@@ -2147,48 +2076,52 @@ class oi extends Ke {
2147
2076
  }
2148
2077
  }
2149
2078
  export {
2150
- Kn as Arrows,
2151
- oi as Control,
2152
- ge as EVT_ADD,
2153
- Wn as EVT_CANCEL_DRAWING,
2154
- Zt as EVT_DRAG,
2155
- Tt as EVT_DRAG_END,
2156
- Kt as EVT_DRAG_START,
2157
- Un as EVT_HOVER,
2158
- Yn as EVT_LINK,
2159
- pe as EVT_REMOVE,
2160
- de as EVT_SELECT,
2161
- Gn as EVT_UNHOVER,
2162
- fe as EVT_UNSELECT,
2163
- ye as EVT_UPDATE,
2164
- V as NONE,
2165
- ei as Texts,
2166
- Xt as clientToContainerPosition,
2167
- Nn as createArrow,
2168
- Pt as createSVGElement,
2169
- Jn as createText,
2170
- De as defaultArrowOptions,
2171
- zt as defaultArrowStyle,
2172
- $e as defaultControllerOptions,
2173
- he as defaultTextOptions,
2174
- St as defaultTextStyle,
2175
- si as getAnnotationsBounds,
2176
- Wt as getArrowEnd,
2177
- Yt as getArrowEndPoints,
2178
- Rt as getArrowSide,
2179
- $t as getArrowStart,
2180
- Vt as getAttachmentPointOnNode,
2181
- Ve as getHandleId,
2182
- je as getTextBbox,
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,
2183
2113
  ct as getTextPosition,
2184
2114
  ut as getTextSize,
2185
- He as isAnnotationCollection,
2115
+ Yn as hexShortToLong,
2116
+ Xn as hexToRgba,
2117
+ Ve as isAnnotationCollection,
2186
2118
  st as isArrow,
2187
- pt as isText,
2188
- qn as scaleGeometry,
2189
- Re as setArrowEnd,
2190
- At as setArrowEndPoint,
2191
- qe as setArrowStart,
2192
- Bn as setTextBbox,
2193
- Fn as updateTextBbox
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
2194
2127
  };