@linkurious/ogma-annotations 1.1.12 → 1.1.14

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,498 +1,14 @@
1
- var In = Object.defineProperty;
2
- var Mn = (u, l, t) => l in u ? In(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
3
- var v = (u, l, t) => (Mn(u, typeof l != "symbol" ? l + "" : l, t), t);
4
- var Dn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function fe(u) {
6
- return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
7
- }
8
- var Re = { exports: {} };
9
- (function(u) {
10
- (function(l, t) {
11
- u.exports = t();
12
- })("Vector", function() {
13
- var l = function() {
14
- var t = Math.PI * 2, r = 180 / Math.PI, a = Math.PI / 180;
15
- function h(s) {
16
- return Math.round(s * 1e8) / 1e8;
17
- }
18
- function f(s, d) {
19
- var m = d.x - s.x, A = d.y - s.y;
20
- return Math.sqrt(m * m + A * A);
21
- }
22
- function g(s, d, m) {
23
- var A = d.y - s.y, T = d.x - s.x, b = Math.atan2(A, T);
24
- if (m)
25
- for (; b < 0; )
26
- b += t;
27
- return b;
28
- }
29
- function p(s, d) {
30
- this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
31
- }
32
- return p.fromRadians = function(s) {
33
- var d = Math.cos(s), m = Math.sin(s);
34
- return new p(d, m);
35
- }, p.fromDegrees = function(s) {
36
- var d = s * (Math.PI / 180);
37
- return p.fromRadians(d);
38
- }, p.fromString = function(s) {
39
- var d = s.split(",");
40
- return new p(parseFloat(d[0]), parseFloat(d[1]));
41
- }, p.fromArray = function(s) {
42
- return new p(s[0], s[1]);
43
- }, p.prototype = {
44
- // version
45
- version: "2.0.1",
46
- // [API]
47
- // [chainable, clone]
48
- // clone the vector and return the cloned instance.
49
- // @return cloned vector.
50
- clone: function() {
51
- return new p(this.x, this.y);
52
- },
53
- // [API]
54
- // []
55
- // Get if equal to another vector
56
- // @param vector - other vector to compare with.
57
- // @return if vectors are equal.
58
- equals: function(s) {
59
- return this.prototype === s.prototype && this.x === s.x && this.y === s.y;
60
- },
61
- // [API]
62
- // [chainable, changeSelf]
63
- // set values from another vector. this changes value of self.
64
- // @param vector - other vector to get values from.
65
- // @return self.
66
- copy: function(s) {
67
- return this.x = s.x, this.y = s.y, this;
68
- },
69
- // [API]
70
- // [chainable, changeSelf]
71
- // set only the x component from another vector.
72
- // @return self.
73
- copyX: function(s) {
74
- return this.x = s.x, this;
75
- },
76
- // [API]
77
- // [chainable, changeSelf]
78
- // set only the y component from another vector.
79
- // @return self.
80
- copyY: function(s) {
81
- return this.y = s.y, this;
82
- },
83
- // [API]
84
- // []
85
- // convert to a dictionary with {x, y}.
86
- // @return a dictionary representation of the vector.
87
- toDict: function() {
88
- return { x: this.x, y: this.y };
89
- },
90
- // [API]
91
- // []
92
- // convert to array with [x, y].
93
- // @return an array representation of the vector.
94
- toArray: function() {
95
- return [this.x, this.y];
96
- },
97
- // [API]
98
- // [chainable, changeSelf]
99
- // set values from x, y.
100
- // @param x - optional x component to set.
101
- // @param y - optional y component to set.
102
- // @return self.
103
- set: function(s, d) {
104
- return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
105
- },
106
- // [API]
107
- // [chainable, clone]
108
- // clone and flip between x and y values.
109
- // @return cloned vector with flipped x and y components.
110
- flipXY: function() {
111
- return new p(this.y, this.x);
112
- },
113
- // [API]
114
- // [chainable, changeSelf]
115
- // flip between x and y values.
116
- // @return self.
117
- flipXYSelf: function() {
118
- return this.y = [this.x, this.x = this.y][0], this;
119
- },
120
- // [API]
121
- // [chainable, clone]
122
- // clone and invert x and y values (like multiply with -1, eg x, y => -x, -y)
123
- // @return cloned vector with inverted values.
124
- invert: function() {
125
- return this.mulScalar(-1);
126
- },
127
- // [API]
128
- // [chainable, changeSelf]
129
- // invert x and y values (like multiply with -1, eg x, y => -x, -y)
130
- // @return self.
131
- invertSelf: function() {
132
- return this.mulScalarSelf(-1), this;
133
- },
134
- // [API]
135
- // []
136
- // get the distance from another vector.
137
- // @param other - vector to get distance from.
138
- // @return distance between vectors.
139
- distanceFrom: function(s) {
140
- return f(this, s);
141
- },
142
- // [API]
143
- // []
144
- // get angle from another vector in radians.
145
- // @return angle in radians from this to other.
146
- radiansTo: function(s) {
147
- return g(this, s, !0);
148
- },
149
- // [API]
150
- // []
151
- // get degrees from another vector in degrees.
152
- // @return angle in degrees from this to other.
153
- degreesTo: function(s) {
154
- return g(this, s, !0) * r;
155
- },
156
- // [API]
157
- // []
158
- // convert this vector to a radian angle.
159
- // this is equivalent to doing Vector.zero.radiansTo(this).
160
- // @return angle in radians.
161
- toRadians: function(s) {
162
- return g(p.zero, this, !0);
163
- },
164
- // [API]
165
- // []
166
- // convert this vector to degree.
167
- // this is equivalent to doing Vector.zero.degreeTo(this).
168
- // @return angle in degrees (0-360).
169
- toDegrees: function(s) {
170
- return this.toRadians() * r;
171
- },
172
- // [API]
173
- // [chainable, changeSelf]
174
- // rotate this vector by a given degree.
175
- // @param degrees - degrees to rotate this vector by (can be positive or negative).
176
- // @return self.
177
- rotateDegreesSelf: function(s) {
178
- return this.rotateRadiansSelf(s * a);
179
- },
180
- // [API]
181
- // [chainable]
182
- // clone and rotate the vector by a given degree.
183
- // @param degrees - degree to rotate this vector by (can be positive or negative).
184
- // @return cloned rotated vector.
185
- rotateDegrees: function(s) {
186
- return this.clone().rotateDegreesSelf(s);
187
- },
188
- // [API]
189
- // [chainable, changeSelf]
190
- // rotate this vector by a given radian.
191
- // @param radians - radians to rotate this vector by (can be positive or negative).
192
- // @return self.
193
- rotateRadiansSelf: function(s) {
194
- var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, T = this.x * m + this.y * d;
195
- return this.x = h(A), this.y = h(T), this;
196
- },
197
- // [API]
198
- // [chainable]
199
- // clone and rotate the vector by a given degree.
200
- // @param radians - radians to rotate this vector by (can be positive or negative).
201
- // @return cloned rotated vector.
202
- rotateRadians: function(s) {
203
- return this.clone().rotateRadiansSelf(s);
204
- },
205
- // [API]
206
- // []
207
- // calculate the length of this vector (aka magnitude).
208
- // @return vector length.
209
- length: function() {
210
- return Math.sqrt(this.x * this.x + this.y * this.y);
211
- },
212
- // [API]
213
- // [chainable, changeSelf]
214
- // normalize this vector, eg make length equal 1.
215
- // @return self.
216
- normalizeSelf: function() {
217
- var s = Math.sqrt(this.x * this.x + this.y * this.y);
218
- return s === 0 ? this : (this.x /= s, this.y /= s, this);
219
- },
220
- // [API]
221
- // [chainable, clone]
222
- // clone and normalize the vector.
223
- // @return normalized vector.
224
- normalize: function() {
225
- return this.clone().normalizeSelf();
226
- },
227
- // [API]
228
- // [chainable, changeSelf]
229
- // add other vector to self.
230
- // for example, v(10, 11) + v(5, 6) = v(15, 17).
231
- // @param other - vector to add components to self.
232
- // @return self.
233
- addSelf: function(s) {
234
- return typeof s == "number" ? this.addScalarSelf(s) : (this.x += s.x, this.y += s.y, this);
235
- },
236
- // [API]
237
- // [chainable, changeSelf]
238
- // subtract other vector from self.
239
- // for example, v(10, 10) - v(2, 3) = v(8, 7).
240
- // @param other - vector to subtract components from self.
241
- // @return self.
242
- subSelf: function(s) {
243
- return typeof s == "number" ? this.subScalarSelf(s) : (this.x -= s.x, this.y -= s.y, this);
244
- },
245
- // [API]
246
- // [chainable, changeSelf]
247
- // divide self by other vector.
248
- // for example, v(10, 20) / v(2, 5) = v(5, 4).
249
- // @param other - vector to divide components from self.
250
- // @return self.
251
- divSelf: function(s) {
252
- return typeof s == "number" ? this.divScalarSelf(s) : (this.x /= s.x, this.y /= s.y, this);
253
- },
254
- // [API]
255
- // [chainable, changeSelf]
256
- // multiply self vector by other vector.
257
- // for example, v(2, 3) * v(3, 4) = v(6, 12).
258
- // @param other - vector to multiply components with self.
259
- // @return self.
260
- mulSelf: function(s) {
261
- return typeof s == "number" ? this.mulScalarSelf(s) : (this.x *= s.x, this.y *= s.y, this);
262
- },
263
- // [API]
264
- // [chainable, changeSelf]
265
- // add scalar value to self.
266
- // for example, v(2, 3) + 5 = v(7, 8).
267
- // @param val - value to add to components.
268
- // @return self.
269
- addScalarSelf: function(s) {
270
- return this.x += s, this.y += s, this;
271
- },
272
- // [API]
273
- // [chainable, changeSelf]
274
- // subtract scalar from self.
275
- // for example, v(7, 9) - 5 = v(3, 4).
276
- // @param val - value to subtract from components.
277
- // @return self.
278
- subScalarSelf: function(s) {
279
- return this.x -= s, this.y -= s, this;
280
- },
281
- // [API]
282
- // [chainable, changeSelf]
283
- // divide self by scalar.
284
- // for example, v(6, 8) / 5 = v(3, 4).
285
- // @param val - value to divide components by.
286
- // @return self.
287
- divScalarSelf: function(s) {
288
- return this.x /= s, this.y /= s, this;
289
- },
290
- // [API]
291
- // [chainable, changeSelf]
292
- // multiply self by scalar.
293
- // for example, v(2, 3) * 2 = v(4, 6).
294
- // @param val - value to multiply components with.
295
- // @return self.
296
- mulScalarSelf: function(s) {
297
- return this.x *= s, this.y *= s, this;
298
- },
299
- // [API]
300
- // [chainable, clone]
301
- // clone self and add other vector to it.
302
- // @param other - vector to add with.
303
- // @return cloned vector.
304
- add: function(s) {
305
- return this.clone().addSelf(s);
306
- },
307
- // [API]
308
- // [chainable, clone]
309
- // clone self and subtract other vector from it.
310
- // @param other - vector to subtract with.
311
- // @return cloned vector.
312
- sub: function(s) {
313
- return this.clone().subSelf(s);
314
- },
315
- // [API]
316
- // [chainable, clone]
317
- // clone self and multiply by other vector.
318
- // @param other - vector to multiply with.
319
- // @return cloned vector.
320
- mul: function(s) {
321
- return this.clone().mulSelf(s);
322
- },
323
- // [API]
324
- // [chainable, clone]
325
- // clone self and divide by other vector.
326
- // @param other - vector to divide with.
327
- // @param scalar - value to divide by.
328
- // @return cloned vector.
329
- div: function(s) {
330
- return this.clone().divSelf(s);
331
- },
332
- // [API]
333
- // [chainable, clone]
334
- // clone self and add scalar to it.
335
- // @param scalar - value to add.
336
- // @return cloned vector.
337
- addScalar: function(s) {
338
- return this.clone().addScalarSelf(s);
339
- },
340
- // [API]
341
- // [chainable, clone]
342
- // clone self and substract scalar from it.
343
- // @param scalar - value to subtract.
344
- // @return cloned vector.
345
- subScalar: function(s) {
346
- return this.clone().subScalarSelf(s);
347
- },
348
- // [API]
349
- // [chainable, clone]
350
- // clone self and multiply by scalar.
351
- // @param scalar - value to multiply with.
352
- // @return cloned vector.
353
- mulScalar: function(s) {
354
- return this.clone().mulScalarSelf(s);
355
- },
356
- // [API]
357
- // [chainable, clone]
358
- // clone self and divide by scalar.
359
- // @param scalar - value to divide by.
360
- // @return cloned vector.
361
- divScalar: function(s) {
362
- return this.clone().divScalarSelf(s);
363
- },
364
- // [API]
365
- // [chainable, changeSelf]
366
- // clamp vector values into range.
367
- // note: this function does not validate that min < max.
368
- // @param min - min value for x, y components.
369
- // @param max - max value for x, y components.
370
- // @return self.
371
- clampSelf: function(s, d) {
372
- return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > d.x && (this.x = d.x), this.y > d.y && (this.y = d.y), this;
373
- },
374
- // [API]
375
- // [chainable, clone]
376
- // clone vector and clamp its values.
377
- // note: this function does not validate that min < max.
378
- // @param min - min value for x, y components.
379
- // @param max - max value for x, y components.
380
- // @return cloned vector in range.
381
- clamp: function(s, d) {
382
- return this.clone().clampSelf(s, d);
383
- },
384
- // [API]
385
- // [chainable, changeSelf]
386
- // apply a function on x and y components of the vector.
387
- // for example, you can use Math.round to round the vector x, y values.
388
- // @param func - function to apply on components.
389
- // @return self.
390
- applySelf: function(s) {
391
- return this.x = s(this.x), this.y = s(this.y), this;
392
- },
393
- // [API]
394
- // [chainable, clone]
395
- // clone self and apply a function on x and y components of the clone vector.
396
- // for example, you can use Math.round to round the vector x, y values.
397
- // @param func - function to apply on components.
398
- // @return cloned vector.
399
- apply: function(s) {
400
- return this.clone().applySelf(s);
401
- },
402
- // [API]
403
- // [chainable, changeSelf]
404
- // turn self to absolute values (eg turn x, y positive).
405
- // @return self.
406
- absSelf: function() {
407
- return this.applySelf(Math.abs);
408
- },
409
- // [API]
410
- // [chainable, clone]
411
- // clone and turn to absolute values (eg turn x, y positive).
412
- // @return cloned vector.
413
- abs: function() {
414
- return this.clone().absSelf();
415
- },
416
- // [API]
417
- // [chainable, changeSelf]
418
- // turn self to round values (eg turn x, y positive).
419
- // @return self.
420
- roundSelf: function() {
421
- return this.applySelf(Math.round);
422
- },
423
- // [API]
424
- // [chainable, clone]
425
- // clone and turn to round values (eg turn x, y positive).
426
- // @return cloned vector.
427
- round: function() {
428
- return this.clone().roundSelf();
429
- },
430
- // [API]
431
- // []
432
- // calculate dot-product of this vector with another vector.
433
- // @param other - other vector to calculate dot-product with.
434
- // @return dot product.
435
- dot: function(s) {
436
- return this.x * s.x + this.y * s.y;
437
- },
438
- // [API]
439
- // []
440
- // calculate cross-product of this vector with another vector.
441
- // @param other - other vector to calculate cross-product with.
442
- // @return dot product.
443
- cross: function(s) {
444
- return this.x * s.y - this.y * s.x;
445
- },
446
- // [API]
447
- // [chainable, changeSelf]
448
- // if any of the components of this vector are NaN, null, undefined, etc. set them to defaults.
449
- // note: 0's are considered to be a valid number and will not be replaced with a default value.
450
- // @param x - default value for x if undefined (0 if not defined).
451
- // @param y - default value for y if undefined (0 if not defined).
452
- // @return self.
453
- repairSelf: function(s, d) {
454
- return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = d || 0), this;
455
- },
456
- // [API]
457
- // [chainable, clone]
458
- // create a clone and if any of the components of the vector are NaN, null, undefined, etc. set them to default.
459
- // note: 0's are considered to be a valid number and will not be replaced with a default value.
460
- // @param x - default value for x if undefined (0 if not defined).
461
- // @param y - default value for y if undefined (0 if not defined).
462
- // @return repaired clone.
463
- repair: function(s, d) {
464
- return this.clone().repairSelf(s, d);
465
- },
466
- // [API]
467
- // []
468
- // convert to string in the form of "x,y".
469
- // @return string representation of the vector.
470
- toString: function() {
471
- return this.x + "," + this.y;
472
- },
473
- // [API]
474
- // []
475
- // convert to a string with a given format.
476
- // @param format - a string in which %x and %y will be replaced with the vector values.
477
- // @return formatted string representing the vector.
478
- format: function(s) {
479
- return s = s || "%x,%y", s = s.replace(new RegExp("%x", "g"), this.x), s = s.replace(new RegExp("%y", "g"), this.y), s;
480
- }
481
- }, p;
482
- }();
483
- return l.zero = new l(0, 0), l.one = new l(1, 1), l.up = new l(0, -1), l.down = new l(0, 1), l.left = new l(-1, 0), l.right = new l(1, 0), l.upLeft = new l(-1, -1), l.downLeft = new l(-1, 1), l.upRight = new l(1, -1), l.downRight = new l(1, 1), l.prototype.magnitude = l.prototype.length, Object.freeze && (Object.freeze(l.zero), Object.freeze(l.one), Object.freeze(l.up), Object.freeze(l.down), Object.freeze(l.left), Object.freeze(l.right), Object.freeze(l.upLeft), Object.freeze(l.downLeft), Object.freeze(l.upRight), Object.freeze(l.downRight)), l;
484
- });
485
- })(Re);
486
- var On = Re.exports;
487
- const Y = /* @__PURE__ */ fe(On);
488
- let Xt = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
1
+ var $n = Object.defineProperty;
2
+ var zn = (a, l, t) => l in a ? $n(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
3
+ var m = (a, l, t) => (zn(a, typeof l != "symbol" ? l + "" : l, t), t);
4
+ let Kt = (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), "");
489
5
  const zt = {
490
6
  strokeType: "plain",
491
7
  strokeColor: "black",
492
8
  strokeWidth: 1,
493
9
  head: "none",
494
10
  tail: "none"
495
- }, _e = {
11
+ }, Me = {
496
12
  id: 0,
497
13
  type: "Feature",
498
14
  properties: {
@@ -518,83 +34,83 @@ const zt = {
518
34
  // tail: 'arrow-plain',
519
35
  // start: { x: 0, y: 0 },
520
36
  // end: { x: 100, y: 100 }
521
- }, Ln = (u = 0, l = 0, t = 0, r = 0, a = { ...zt }) => ({
522
- id: Xt(),
37
+ }, Nn = (a = 0, l = 0, t = 0, r = 0, o = { ...zt }) => ({
38
+ id: Kt(),
523
39
  type: "Feature",
524
40
  properties: {
525
41
  type: "arrow",
526
42
  style: {
527
43
  ...zt,
528
- ...a
44
+ ...o
529
45
  }
530
46
  },
531
47
  geometry: {
532
48
  type: "LineString",
533
49
  coordinates: [
534
- [u, l],
50
+ [a, l],
535
51
  [t, r]
536
52
  ]
537
53
  }
538
- }), zn = "http://www.w3.org/2000/svg";
539
- function Ot(u) {
540
- return document.createElementNS(zn, u);
54
+ }), Hn = "http://www.w3.org/2000/svg";
55
+ function Pt(a) {
56
+ return document.createElementNS(Hn, a);
541
57
  }
542
- function He(u) {
543
- return u.geometry.bbox || Cn(u), u.geometry.bbox;
58
+ function qe(a) {
59
+ return a.geometry.bbox || Fn(a), a.geometry.bbox;
544
60
  }
545
- function ut(u) {
546
- const l = He(u);
61
+ function ut(a) {
62
+ const l = qe(a);
547
63
  return {
548
64
  width: l[2] - l[0],
549
65
  height: l[3] - l[1]
550
66
  };
551
67
  }
552
- function ct(u) {
553
- const l = He(u);
68
+ function ct(a) {
69
+ const l = qe(a);
554
70
  return { x: l[0], y: l[1] };
555
71
  }
556
- function Cn(u) {
557
- const [l, t] = u.geometry.coordinates[0][0], [r, a] = u.geometry.coordinates[0][2];
558
- u.geometry.bbox = [l, t, r, a];
72
+ function Fn(a) {
73
+ const [l, t] = a.geometry.coordinates[0][0], [r, o] = a.geometry.coordinates[0][2];
74
+ a.geometry.bbox = [l, t, r, o];
559
75
  }
560
- function Pn(u, l, t, r, a) {
561
- u.geometry.bbox = [l, t, l + r, t + a], u.geometry.coordinates = [
76
+ function Bn(a, l, t, r, o) {
77
+ a.geometry.bbox = [l, t, l + r, t + o], a.geometry.coordinates = [
562
78
  [
563
79
  [l, t],
564
80
  [l + r, t],
565
- [l + r, t + a],
566
- [l, t + a],
81
+ [l + r, t + o],
82
+ [l, t + o],
567
83
  [l, t]
568
84
  ]
569
85
  ];
570
86
  }
571
- function Lt(u) {
572
- const [l, t] = u.geometry.coordinates[0];
87
+ function $t(a) {
88
+ const [l, t] = a.geometry.coordinates[0];
573
89
  return { x: l, y: t };
574
90
  }
575
- function jt(u, l) {
576
- const [t, r] = u.geometry.coordinates[l === "start" ? 0 : 1];
91
+ function Rt(a, l) {
92
+ const [t, r] = a.geometry.coordinates[l === "start" ? 0 : 1];
577
93
  return { x: t, y: r };
578
94
  }
579
- function Bt(u) {
580
- const [l, t] = u.geometry.coordinates[1];
95
+ function Gt(a) {
96
+ const [l, t] = a.geometry.coordinates[1];
581
97
  return { x: l, y: t };
582
98
  }
583
- function je(u, l, t) {
584
- u.geometry.coordinates[0] = [l, t];
99
+ function Re(a, l, t) {
100
+ a.geometry.coordinates[0] = [l, t];
585
101
  }
586
- function Fe(u, l, t) {
587
- u.geometry.coordinates[1] = [l, t];
102
+ function Ve(a, l, t) {
103
+ a.geometry.coordinates[1] = [l, t];
588
104
  }
589
- function Vt(u) {
590
- return { start: Lt(u), end: Bt(u) };
105
+ function Yt(a) {
106
+ return { start: $t(a), end: Gt(a) };
591
107
  }
592
- function bt(u, l, t, r) {
593
- l === "start" ? je(u, t, r) : Fe(u, t, r);
108
+ function At(a, l, t, r) {
109
+ l === "start" ? Re(a, t, r) : Ve(a, t, r);
594
110
  }
595
- const qe = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
- function Zn(u) {
597
- return qt(u).reduce(
111
+ const Ue = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
112
+ function ii(a) {
113
+ return Wt(a).reduce(
598
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),
599
115
  [
600
116
  Number.POSITIVE_INFINITY,
@@ -604,200 +120,234 @@ function Zn(u) {
604
120
  ]
605
121
  );
606
122
  }
607
- function qt(u) {
123
+ function Wt(a) {
608
124
  let l = [];
609
- return u.type == "Point" ? l = [u.coordinates] : u.type == "LineString" || u.type == "MultiPoint" ? l = u.coordinates : u.type == "Polygon" || u.type == "MultiLineString" ? l = u.coordinates.reduce(function(t, r) {
125
+ 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) {
610
126
  return t.concat(r);
611
- }, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
612
- (t, r) => t.concat(r.reduce((a, h) => a.concat(h), [])),
127
+ }, []) : a.type == "MultiPolygon" ? l = a.coordinates.reduce(
128
+ (t, r) => t.concat(r.reduce((o, h) => o.concat(h), [])),
613
129
  []
614
- ) : u.type == "Feature" ? l = qt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
- (t, r) => t.concat(qt(r)),
130
+ ) : a.type == "Feature" ? l = Wt(a.geometry) : a.type == "GeometryCollection" ? l = a.geometries.reduce(
131
+ (t, r) => t.concat(Wt(r)),
616
132
  []
617
- ) : u.type == "FeatureCollection" && (l = u.features.reduce(
618
- (t, r) => t.concat(qt(r)),
133
+ ) : a.type == "FeatureCollection" && (l = a.features.reduce(
134
+ (t, r) => t.concat(Wt(r)),
619
135
  []
620
136
  )), l;
621
137
  }
622
- function Ft(u, l, t) {
623
- const r = Math.atan2(u.y - l.y, u.x - l.x);
138
+ function Vt(a, l, t) {
139
+ const r = Math.atan2(a.y - l.y, a.x - l.x);
624
140
  return {
625
141
  x: l.x + t * Math.cos(r),
626
142
  y: l.y + t * Math.sin(r)
627
143
  };
628
144
  }
629
- function ae(u, l) {
145
+ function ue(a, l) {
630
146
  if (!l)
631
- return { x: u.clientX, y: u.clientY };
147
+ return { x: a.clientX, y: a.clientY };
632
148
  const t = l.getBoundingClientRect();
633
149
  return {
634
- x: u.clientX - t.left - l.clientLeft,
635
- y: u.clientY - t.top - l.clientTop
150
+ x: a.clientX - t.left - l.clientLeft,
151
+ y: a.clientY - t.top - l.clientTop
636
152
  };
637
153
  }
638
- function Be(u, l = 5, t = 30) {
639
- var s;
640
- const { start: r, end: a } = Vt(u), h = new Y(r.x, r.y), g = new Y(a.x, a.y).sub(h), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
641
- return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
154
+ const vt = (a, l) => ({
155
+ x: a.x - l.x,
156
+ y: a.y - l.y
157
+ }), kt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), We = (a) => ({
158
+ x: -a.x,
159
+ y: -a.y
160
+ }), Ge = (a) => {
161
+ const l = kt(a);
162
+ return l === 0 ? { x: 0, y: 0 } : {
163
+ x: a.x / l,
164
+ y: a.y / l
165
+ };
166
+ }, Et = (a, l) => ({
167
+ x: a.x + l.x,
168
+ y: a.y + l.y
169
+ }), Ye = (a, l) => ({
170
+ x: a.x * l,
171
+ y: a.y * l
172
+ }), Ut = (a, l) => ({
173
+ x: a.x * l.x,
174
+ y: a.y * l.y
175
+ }), rt = (a, l) => {
176
+ const t = Math.sin(l), r = Math.cos(l);
177
+ return {
178
+ x: a.x * r - a.y * t,
179
+ y: a.x * t + a.y * r
180
+ };
181
+ }, jn = (a, l) => ({
182
+ x: a.x / l,
183
+ y: a.y / l
184
+ }), Oe = (a, l) => a.x * l.x + a.y * l.y;
185
+ function Xe(a, l = 5, t = 30) {
186
+ var d;
187
+ const { start: r, end: o } = Yt(a), h = vt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
188
+ return Math.min(t, Math.max(3 * u, kt(h) * 0.1, l));
642
189
  }
643
- function Ie(u, l, t, r) {
644
- const a = l.clone().normalize().invert().mul(r);
190
+ function Le(a, l, t, r) {
191
+ const o = Ye(We(Ge(l)), r);
645
192
  if (!t || t === "none")
646
193
  return "";
647
- const h = u.clone().add(a.rotateRadians(Math.PI / 8)), f = u.clone().add(a.rotateRadians(-Math.PI / 8)), g = `${u.x} ${u.y}`;
648
- return `M ${h.x} ${h.y} L ${g} ${f.x} ${f.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
194
+ const h = Et(a, rt(o, Math.PI / 8)), u = Et(a, rt(o, -Math.PI / 8)), d = `${a.x} ${a.y}`;
195
+ return `M ${h.x} ${h.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
649
196
  }
650
- function $n(u, l, t, r, a) {
651
- const { start: h, end: f } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new Y(h.x, h.y), A = new Y(f.x, f.y), T = A.clone().sub(m), b = Be(u, r, a), I = Ot("path");
652
- I.setAttribute("data-annotation", `${u.id}`), I.setAttribute("data-annotation-type", "arrow");
653
- const S = p === "arrow-plain" || g === "arrow";
654
- I.setAttribute("stroke", s || "none"), I.setAttribute("stroke-width", `${d}`), I.setAttribute("fill", S ? s || "" : "none"), I.setAttribute("stroke-linecap", "round"), I.setAttribute("stroke-linejoin", "round");
655
- const P = Ie(m, T.clone().invert(), g, b), $ = Ie(A, T, p, b), _ = P + `M ${m.x} ${m.y} ${A.x} ${A.y}` + $;
656
- I.setAttribute("d", _), l.appendChild(I);
197
+ function qn(a, l, t, r, o) {
198
+ const { start: h, end: u } = Yt(a), { tail: d, head: g, strokeColor: f, strokeWidth: y } = a.properties.style || t, v = vt(u, h), T = Xe(a, r, o), A = Pt("path");
199
+ A.setAttribute("data-annotation", `${a.id}`), A.setAttribute("data-annotation-type", "arrow");
200
+ const b = g === "arrow-plain" || d === "arrow";
201
+ 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");
202
+ const C = Le(h, We(v), d, T), E = Le(u, v, g, T), $ = C + `M ${h.x} ${h.y} ${u.x} ${u.y}` + E;
203
+ A.setAttribute("d", $), l.appendChild(A);
657
204
  }
658
- const V = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", le = "select", he = "unselect", Nn = "hover", Rn = "unhover", ce = "remove", ue = "add", Hn = "cancelDrawing", de = "update", jn = "link";
659
- var Ve = { exports: {} };
660
- (function(u) {
205
+ const V = -1, Xt = "dragging", Zt = "dragstart", Tt = "dragend", de = "select", fe = "unselect", Rn = "hover", Vn = "unhover", pe = "remove", ge = "add", Un = "cancelDrawing", ye = "update", Wn = "link";
206
+ var Gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
207
+ function Ze(a) {
208
+ return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
209
+ }
210
+ var Ke = { exports: {} };
211
+ (function(a) {
661
212
  var l = Object.prototype.hasOwnProperty, t = "~";
662
213
  function r() {
663
214
  }
664
215
  Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
665
- function a(p, s, d) {
666
- this.fn = p, this.context = s, this.once = d || !1;
216
+ function o(g, f, y) {
217
+ this.fn = g, this.context = f, this.once = y || !1;
667
218
  }
668
- function h(p, s, d, m, A) {
669
- if (typeof d != "function")
219
+ function h(g, f, y, v, T) {
220
+ if (typeof y != "function")
670
221
  throw new TypeError("The listener must be a function");
671
- var T = new a(d, m || p, A), b = t ? t + s : s;
672
- return p._events[b] ? p._events[b].fn ? p._events[b] = [p._events[b], T] : p._events[b].push(T) : (p._events[b] = T, p._eventsCount++), p;
222
+ var A = new o(y, v || g, T), b = t ? t + f : f;
223
+ 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;
673
224
  }
674
- function f(p, s) {
675
- --p._eventsCount === 0 ? p._events = new r() : delete p._events[s];
225
+ function u(g, f) {
226
+ --g._eventsCount === 0 ? g._events = new r() : delete g._events[f];
676
227
  }
677
- function g() {
228
+ function d() {
678
229
  this._events = new r(), this._eventsCount = 0;
679
230
  }
680
- g.prototype.eventNames = function() {
681
- var s = [], d, m;
231
+ d.prototype.eventNames = function() {
232
+ var f = [], y, v;
682
233
  if (this._eventsCount === 0)
683
- return s;
684
- for (m in d = this._events)
685
- l.call(d, m) && s.push(t ? m.slice(1) : m);
686
- return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
687
- }, g.prototype.listeners = function(s) {
688
- var d = t ? t + s : s, m = this._events[d];
689
- if (!m)
234
+ return f;
235
+ for (v in y = this._events)
236
+ l.call(y, v) && f.push(t ? v.slice(1) : v);
237
+ return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(y)) : f;
238
+ }, d.prototype.listeners = function(f) {
239
+ var y = t ? t + f : f, v = this._events[y];
240
+ if (!v)
690
241
  return [];
691
- if (m.fn)
692
- return [m.fn];
693
- for (var A = 0, T = m.length, b = new Array(T); A < T; A++)
694
- b[A] = m[A].fn;
242
+ if (v.fn)
243
+ return [v.fn];
244
+ for (var T = 0, A = v.length, b = new Array(A); T < A; T++)
245
+ b[T] = v[T].fn;
695
246
  return b;
696
- }, g.prototype.listenerCount = function(s) {
697
- var d = t ? t + s : s, m = this._events[d];
698
- return m ? m.fn ? 1 : m.length : 0;
699
- }, g.prototype.emit = function(s, d, m, A, T, b) {
700
- var I = t ? t + s : s;
701
- if (!this._events[I])
247
+ }, d.prototype.listenerCount = function(f) {
248
+ var y = t ? t + f : f, v = this._events[y];
249
+ return v ? v.fn ? 1 : v.length : 0;
250
+ }, d.prototype.emit = function(f, y, v, T, A, b) {
251
+ var C = t ? t + f : f;
252
+ if (!this._events[C])
702
253
  return !1;
703
- var S = this._events[I], P = arguments.length, $, _;
704
- if (S.fn) {
705
- switch (S.once && this.removeListener(s, S.fn, void 0, !0), P) {
254
+ var E = this._events[C], $ = arguments.length, N, _;
255
+ if (E.fn) {
256
+ switch (E.once && this.removeListener(f, E.fn, void 0, !0), $) {
706
257
  case 1:
707
- return S.fn.call(S.context), !0;
258
+ return E.fn.call(E.context), !0;
708
259
  case 2:
709
- return S.fn.call(S.context, d), !0;
260
+ return E.fn.call(E.context, y), !0;
710
261
  case 3:
711
- return S.fn.call(S.context, d, m), !0;
262
+ return E.fn.call(E.context, y, v), !0;
712
263
  case 4:
713
- return S.fn.call(S.context, d, m, A), !0;
264
+ return E.fn.call(E.context, y, v, T), !0;
714
265
  case 5:
715
- return S.fn.call(S.context, d, m, A, T), !0;
266
+ return E.fn.call(E.context, y, v, T, A), !0;
716
267
  case 6:
717
- return S.fn.call(S.context, d, m, A, T, b), !0;
268
+ return E.fn.call(E.context, y, v, T, A, b), !0;
718
269
  }
719
- for (_ = 1, $ = new Array(P - 1); _ < P; _++)
720
- $[_ - 1] = arguments[_];
721
- S.fn.apply(S.context, $);
270
+ for (_ = 1, N = new Array($ - 1); _ < $; _++)
271
+ N[_ - 1] = arguments[_];
272
+ E.fn.apply(E.context, N);
722
273
  } else {
723
- var X = S.length, W;
724
- for (_ = 0; _ < X; _++)
725
- switch (S[_].once && this.removeListener(s, S[_].fn, void 0, !0), P) {
274
+ var W = E.length, G;
275
+ for (_ = 0; _ < W; _++)
276
+ switch (E[_].once && this.removeListener(f, E[_].fn, void 0, !0), $) {
726
277
  case 1:
727
- S[_].fn.call(S[_].context);
278
+ E[_].fn.call(E[_].context);
728
279
  break;
729
280
  case 2:
730
- S[_].fn.call(S[_].context, d);
281
+ E[_].fn.call(E[_].context, y);
731
282
  break;
732
283
  case 3:
733
- S[_].fn.call(S[_].context, d, m);
284
+ E[_].fn.call(E[_].context, y, v);
734
285
  break;
735
286
  case 4:
736
- S[_].fn.call(S[_].context, d, m, A);
287
+ E[_].fn.call(E[_].context, y, v, T);
737
288
  break;
738
289
  default:
739
- if (!$)
740
- for (W = 1, $ = new Array(P - 1); W < P; W++)
741
- $[W - 1] = arguments[W];
742
- S[_].fn.apply(S[_].context, $);
290
+ if (!N)
291
+ for (G = 1, N = new Array($ - 1); G < $; G++)
292
+ N[G - 1] = arguments[G];
293
+ E[_].fn.apply(E[_].context, N);
743
294
  }
744
295
  }
745
296
  return !0;
746
- }, g.prototype.on = function(s, d, m) {
747
- return h(this, s, d, m, !1);
748
- }, g.prototype.once = function(s, d, m) {
749
- return h(this, s, d, m, !0);
750
- }, g.prototype.removeListener = function(s, d, m, A) {
751
- var T = t ? t + s : s;
752
- if (!this._events[T])
297
+ }, d.prototype.on = function(f, y, v) {
298
+ return h(this, f, y, v, !1);
299
+ }, d.prototype.once = function(f, y, v) {
300
+ return h(this, f, y, v, !0);
301
+ }, d.prototype.removeListener = function(f, y, v, T) {
302
+ var A = t ? t + f : f;
303
+ if (!this._events[A])
753
304
  return this;
754
- if (!d)
755
- return f(this, T), this;
756
- var b = this._events[T];
305
+ if (!y)
306
+ return u(this, A), this;
307
+ var b = this._events[A];
757
308
  if (b.fn)
758
- b.fn === d && (!A || b.once) && (!m || b.context === m) && f(this, T);
309
+ b.fn === y && (!T || b.once) && (!v || b.context === v) && u(this, A);
759
310
  else {
760
- for (var I = 0, S = [], P = b.length; I < P; I++)
761
- (b[I].fn !== d || A && !b[I].once || m && b[I].context !== m) && S.push(b[I]);
762
- S.length ? this._events[T] = S.length === 1 ? S[0] : S : f(this, T);
311
+ for (var C = 0, E = [], $ = b.length; C < $; C++)
312
+ (b[C].fn !== y || T && !b[C].once || v && b[C].context !== v) && E.push(b[C]);
313
+ E.length ? this._events[A] = E.length === 1 ? E[0] : E : u(this, A);
763
314
  }
764
315
  return this;
765
- }, g.prototype.removeAllListeners = function(s) {
766
- var d;
767
- return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
768
- }, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
769
- })(Ve);
770
- var Fn = Ve.exports;
771
- const Ue = /* @__PURE__ */ fe(Fn);
772
- class Ye extends Ue {
316
+ }, d.prototype.removeAllListeners = function(f) {
317
+ var y;
318
+ return f ? (y = t ? t + f : f, this._events[y] && u(this, y)) : (this._events = new r(), this._eventsCount = 0), this;
319
+ }, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
320
+ })(Ke);
321
+ var Yn = Ke.exports;
322
+ const Je = /* @__PURE__ */ Ze(Yn);
323
+ class Qe extends Je {
773
324
  constructor(t, r) {
774
325
  super();
775
- v(this, "ogma");
776
- v(this, "elements");
326
+ m(this, "ogma");
327
+ m(this, "elements");
777
328
  // layer to draw elements
778
- v(this, "layer");
779
- v(this, "editor");
780
- v(this, "selectedId", V);
781
- v(this, "hoveredId", V);
329
+ m(this, "layer");
330
+ m(this, "editor");
331
+ m(this, "selectedId", V);
332
+ m(this, "hoveredId", V);
782
333
  // used to remember ogma options before we change them
783
- v(this, "ogmaOptions");
784
- v(this, "shouldDetect");
785
- v(this, "isDragging");
786
- v(this, "showeditorOnHover");
787
- v(this, "maxHandleScale", 1.5);
788
- v(this, "_onKeyUp", (t) => {
334
+ m(this, "ogmaOptions");
335
+ m(this, "shouldDetect");
336
+ m(this, "isDragging");
337
+ m(this, "showeditorOnHover");
338
+ m(this, "_onKeyUp", (t) => {
789
339
  t.code === 27 && this.selectedId !== V ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
790
340
  });
791
- v(this, "_onClickMouseMove", (t) => {
341
+ m(this, "_onClickMouseMove", (t) => {
792
342
  if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target && t.domEvent.target.tagName === "a")
793
343
  return;
794
- const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
795
- t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== V && this.unhover() : a ? this.select(a.id) : this.selectedId !== V && this.unselect();
344
+ const r = this.ogma.view.screenToGraphCoordinates(t), o = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
345
+ t.domEvent.type === "mousemove" ? o ? this.hover(o.id) : this.hoveredId !== V && this.unhover() : o ? this.select(o.id) : this.selectedId !== V && this.unselect();
796
346
  });
797
347
  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", () => {
798
348
  this.refreshEditor(), this.refreshDrawing();
799
349
  }), this.layer = t.layers.addSVGLayer({
800
- draw: (a) => this.draw(a)
350
+ draw: (o) => this.draw(o)
801
351
  }), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
802
352
  }
803
353
  _canRemove() {
@@ -809,8 +359,8 @@ class Ye extends Ue {
809
359
  * @returns the added annotation
810
360
  */
811
361
  add(t) {
812
- const r = this.getDefaultOptions(), a = Object.assign(t, {
813
- id: t.id === void 0 ? Xt() : t.id,
362
+ const r = this.getDefaultOptions(), o = Object.assign(t, {
363
+ id: t.id === void 0 ? Kt() : t.id,
814
364
  type: t.type,
815
365
  properties: {
816
366
  ...r.properties,
@@ -823,7 +373,7 @@ class Ye extends Ue {
823
373
  ...t.geometry
824
374
  }
825
375
  });
826
- return this.elements.push(a), this.layer.refresh(), this.emit(ue, a), a;
376
+ return this.elements.push(o), this.layer.refresh(), this.emit(ge, o), o;
827
377
  }
828
378
  updateStyle(t, r) {
829
379
  this.updateAnnotation(t, {
@@ -841,26 +391,26 @@ class Ye extends Ue {
841
391
  * @method update
842
392
  * Updates an annotation (position, color etc)
843
393
  * @param id Id of the annotation to update
844
- * @param new params of the annotation
394
+ * @param element params of the annotation
845
395
  */
846
396
  update(t, r) {
847
- const a = this.getById(t);
848
- this.updateAnnotation(a, r);
397
+ const o = this.getById(t);
398
+ this.updateAnnotation(o, r);
849
399
  }
850
400
  updateAnnotation(t, r) {
851
401
  if (!t)
852
402
  return;
853
- const a = t.id;
403
+ const o = t.id;
854
404
  Object.keys(r).forEach((h) => {
855
405
  if (h !== "id")
856
406
  if (h === "properties") {
857
- const f = r.properties || { style: {} };
407
+ const u = r.properties || { style: {} };
858
408
  t.properties = {
859
409
  ...t.properties || {},
860
- ...f || {},
410
+ ...u || {},
861
411
  style: {
862
412
  ...t.properties.style || {},
863
- ...f.style || {}
413
+ ...u.style || {}
864
414
  }
865
415
  };
866
416
  } else
@@ -868,12 +418,12 @@ class Ye extends Ue {
868
418
  ...t.geometry,
869
419
  ...r.geometry
870
420
  } : t[h] = r[h];
871
- }), a === this.selectedId && this.refreshEditor(), this.layer.refresh();
421
+ }), o === this.selectedId && this.refreshEditor(), this.layer.refresh();
872
422
  }
873
423
  getById(t) {
874
424
  const r = Number(t);
875
- for (let a = 0; a < this.elements.length; a++) {
876
- const h = this.elements[a];
425
+ for (let o = 0; o < this.elements.length; o++) {
426
+ const h = this.elements[o];
877
427
  if (!(h.id !== t && h.id !== r))
878
428
  return h;
879
429
  }
@@ -885,22 +435,22 @@ class Ye extends Ue {
885
435
  */
886
436
  select(t) {
887
437
  const r = this.getById(t);
888
- r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(le, r));
438
+ r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(de, r));
889
439
  }
890
440
  hover(t) {
891
441
  const r = this.getById(t);
892
- r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Nn, r));
442
+ r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Rn, r));
893
443
  }
894
444
  getSelectedFeature() {
895
445
  return this.selectedId === V ? null : this.getById(this.selectedId);
896
446
  }
897
447
  unselect() {
898
448
  const t = this.getById(this.selectedId);
899
- return t && this.emit(he, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
449
+ return t && this.emit(fe, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
900
450
  }
901
451
  unhover() {
902
452
  const t = this.getById(this.hoveredId);
903
- return this.emit(Rn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
453
+ return this.emit(Vn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
904
454
  }
905
455
  /**
906
456
  * @method remove
@@ -909,7 +459,7 @@ class Ye extends Ue {
909
459
  */
910
460
  remove(t) {
911
461
  const r = this.getById(t);
912
- t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(ce, r), this.layer.refresh();
462
+ 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();
913
463
  }
914
464
  /**
915
465
  * @method disableDragging
@@ -959,56 +509,59 @@ class Ye extends Ue {
959
509
  this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
960
510
  }
961
511
  }
962
- const Me = "handle-line", De = "handle-start", Oe = "handle-end";
963
- class qn extends Ye {
512
+ const Ce = "handle-line", Pe = "handle-start", $e = "handle-end";
513
+ class Xn extends Qe {
964
514
  constructor(t, r = {}) {
965
515
  super(
966
516
  t,
967
517
  `
968
518
  <div class="arrow-handle">
969
- <div id="${Me}" data-handle-id="0" class="handle line"></div>
970
- <div id="${De}" data-handle-id="1" class="handle"></div>
971
- <div id="${Oe}" data-handle-id="2" class="handle"></div>
519
+ <div id="${Ce}" data-handle-id="0" class="handle line"></div>
520
+ <div id="${Pe}" data-handle-id="1" class="handle point"></div>
521
+ <div id="${$e}" data-handle-id="2" class="handle point"></div>
972
522
  </div>
973
523
  `
974
524
  );
975
525
  // active handle id
976
- v(this, "draggedHandle", V);
977
- v(this, "start", { x: 0, y: 0 });
978
- v(this, "end", { x: 0, y: 0 });
979
- v(this, "arrow", { ..._e });
980
- v(this, "startX", 0);
981
- v(this, "startY", 0);
982
- v(this, "minArrowHeight", 0);
983
- v(this, "maxArrowHeight", 0);
984
- v(this, "handles", []);
985
- v(this, "onHandleMouseDown", (t) => {
526
+ m(this, "draggedHandle", V);
527
+ m(this, "start", { x: 0, y: 0 });
528
+ m(this, "end", { x: 0, y: 0 });
529
+ m(this, "arrow", { ...Me });
530
+ m(this, "startX", 0);
531
+ m(this, "startY", 0);
532
+ m(this, "minArrowHeight", 0);
533
+ m(this, "maxArrowHeight", 0);
534
+ m(this, "handles", []);
535
+ m(this, "onHandleMouseDown", (t) => {
986
536
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
987
537
  if (!r)
988
538
  return;
989
- const { x: a, y: h } = ae(t, this.ogma.getContainer());
990
- this.startDragging(r, a, h), this.draggedHandle = qe(t.target);
539
+ const { x: o, y: h } = ue(t, this.ogma.getContainer());
540
+ this.startDragging(r, o, h), this.draggedHandle = Ue(t.target);
991
541
  });
992
- v(this, "onMouseUp", () => {
993
- this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(St, this.arrow));
542
+ m(this, "onMouseUp", () => {
543
+ this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(Tt, this.arrow));
994
544
  });
995
- v(this, "onMouseMove", (t) => {
545
+ m(this, "onMouseMove", (t) => {
996
546
  if (!this.isDragging || this.draggedHandle === V)
997
547
  return;
998
- const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y: f } = new Y(
999
- t.clientX - this.startX,
1000
- t.clientY - this.startY
1001
- ).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Me, p = r.id === De, s = r.id === Oe;
1002
- (g || p) && je(this.arrow, this.start.x + h, this.start.y + f), (g || s) && Fe(this.arrow, this.end.x + h, this.end.y + f), this.emit(
1003
- Ut,
548
+ const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(), { x: h, y: u } = rt(
549
+ jn(
550
+ { x: t.clientX - this.startX, y: t.clientY - this.startY },
551
+ this.ogma.view.getZoom()
552
+ ),
553
+ o
554
+ ), d = r.id === Ce, g = r.id === Pe, f = r.id === $e;
555
+ (d || g) && Re(this.arrow, this.start.x + h, this.start.y + u), (d || f) && Ve(this.arrow, this.end.x + h, this.end.y + u), this.emit(
556
+ Xt,
1004
557
  this.arrow,
1005
- g ? "line" : p ? "start" : "end"
558
+ d ? "line" : g ? "start" : "end"
1006
559
  ), this.refreshEditor(), this.layer.refresh();
1007
560
  });
1008
561
  this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
1009
562
  this.editor.element.querySelectorAll(".arrow-handle>.handle")
1010
563
  ), this.handles.forEach(
1011
- (a) => a.addEventListener("mousedown", this.onHandleMouseDown)
564
+ (o) => o.addEventListener("mousedown", this.onHandleMouseDown)
1012
565
  ), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
1013
566
  }
1014
567
  /**
@@ -1017,54 +570,55 @@ class qn extends Ye {
1017
570
  * @param y
1018
571
  * @param arrow
1019
572
  */
1020
- startDrawing(t, r, a = Ln(t, r, t, r, zt)) {
1021
- var g;
1022
- this.disableDragging(), this.add(a), this.hoveredId = a.id;
1023
- const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || {
573
+ startDrawing(t, r, o = Nn(t, r, t, r, zt)) {
574
+ var d;
575
+ this.disableDragging(), this.add(o), this.hoveredId = o.id;
576
+ const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
1024
577
  left: 0,
1025
578
  top: 0
1026
579
  };
1027
580
  this.startDragging(
1028
- this.getById(a.id),
1029
- h.x + (f == null ? void 0 : f.left),
1030
- h.y + f.top
581
+ this.getById(o.id),
582
+ h.x + (u == null ? void 0 : u.left),
583
+ h.y + u.top
1031
584
  ), this.draggedHandle = 2;
1032
585
  }
1033
586
  cancelDrawing() {
1034
- this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
587
+ this.isDragging && (this.remove(this.arrow.id), this.emit(Tt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
1035
588
  }
1036
- startDragging(t, r, a) {
1037
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = Lt(this.arrow), this.end = Bt(this.arrow), this.disableDragging(), this.emit(Yt, this.arrow), this.isDragging = !0;
589
+ startDragging(t, r, o) {
590
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = $t(this.arrow), this.end = Gt(this.arrow), this.disableDragging(), this.emit(Zt, this.arrow), this.isDragging = !0;
1038
591
  }
1039
592
  detect(t, r = 0) {
1040
- return this.elements.find((a) => {
1041
- const { start: h, end: f } = Vt(a), g = new Y(t.x, t.y).sub(
1042
- new Y((h.x + f.x) / 2, (h.y + f.y) / 2)
1043
- ), p = new Y(f.x, f.y).sub(new Y(h.x, h.y)), s = p.length(), d = p.normalize(), m = Be(a);
1044
- return Math.abs(d.dot(g)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
593
+ return this.elements.find((o) => {
594
+ const { start: h, end: u } = Yt(o), d = vt(t, {
595
+ x: (h.x + u.x) / 2,
596
+ y: (h.y + u.y) / 2
597
+ }), g = vt(u, h), f = kt(g), y = Ge(g), v = Xe(o);
598
+ return Math.abs(Oe(y, d)) < f / 2 + r && Math.abs(Oe(rt(y, Math.PI / 2), d)) < v / 2 + r;
1045
599
  });
1046
600
  }
1047
601
  refreshEditor() {
1048
602
  if (+this.selectedId < 0 && +this.hoveredId < 0)
1049
603
  return;
1050
- const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Vt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), f = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
604
+ const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Yt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
1051
605
  this.editor.element.querySelectorAll(".handle")
1052
606
  );
1053
- p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${f})`, s.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%) scale(${f}`;
1054
- const d = {
1055
- x: (h.x + a.x) / 2,
1056
- y: (h.y + a.y) / 2
1057
- }, m = new Y(h.x - a.x, h.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1058
- g.style.width = `${m.length()}px`, g.style.left = `${d.x}px`, g.style.top = `${d.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
607
+ d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%)`;
608
+ const f = {
609
+ x: (h.x + o.x) / 2,
610
+ y: (h.y + o.y) / 2
611
+ }, y = vt(h, o), v = Ye(y, 1 / kt(y)), T = Math.atan2(v.y, v.x);
612
+ 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)`;
1059
613
  }
1060
614
  getDefaultOptions() {
1061
- return _e;
615
+ return Me;
1062
616
  }
1063
617
  draw(t) {
1064
618
  t.innerHTML = "";
1065
- const r = Ot("g"), a = this.ogma.view.getAngle();
1066
- r.setAttribute("transform", `rotate(${-a * (180 / Math.PI)})`), this.elements.forEach(
1067
- (h) => $n(h, r, zt, this.minArrowHeight, this.maxArrowHeight)
619
+ const r = Pt("g"), o = this.ogma.view.getAngle();
620
+ r.setAttribute("transform", `rotate(${-o * (180 / Math.PI)})`), this.elements.forEach(
621
+ (h) => qn(h, r, zt, this.minArrowHeight, this.maxArrowHeight)
1068
622
  ), t.appendChild(r);
1069
623
  }
1070
624
  refreshDrawing() {
@@ -1078,7 +632,7 @@ class qn extends Ye {
1078
632
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
1079
633
  }
1080
634
  }
1081
- const At = {
635
+ const St = {
1082
636
  font: "sans-serif",
1083
637
  fontSize: 12,
1084
638
  color: "black",
@@ -1086,13 +640,13 @@ const At = {
1086
640
  strokeWidth: 1,
1087
641
  strokeColor: "#000",
1088
642
  strokeType: "plain"
1089
- }, re = {
643
+ }, le = {
1090
644
  id: 0,
1091
645
  type: "Feature",
1092
646
  properties: {
1093
647
  type: "text",
1094
648
  content: "",
1095
- style: { ...At }
649
+ style: { ...St }
1096
650
  },
1097
651
  geometry: {
1098
652
  type: "Polygon",
@@ -1108,126 +662,126 @@ const At = {
1108
662
  }
1109
663
  // position: { x: 0, y: 0 },
1110
664
  // size: { width: 100, height: 50 }
1111
- }, Le = {
665
+ }, ze = {
1112
666
  handleSize: 3.5,
1113
667
  placeholder: "Your text..."
1114
- }, Bn = (u = 0, l = 0, t = 100, r = 50, a = "", h = { ...At }) => ({
1115
- id: Xt(),
668
+ }, Zn = (a = 0, l = 0, t = 100, r = 50, o = "", h = { ...St }) => ({
669
+ id: Kt(),
1116
670
  type: "Feature",
1117
671
  properties: {
1118
672
  type: "text",
1119
- content: a,
1120
- style: { ...At, ...h }
673
+ content: o,
674
+ style: { ...St, ...h }
1121
675
  },
1122
676
  geometry: {
1123
677
  type: "Polygon",
1124
678
  coordinates: [
1125
679
  [
1126
- [u, l],
1127
- [u + t, l],
1128
- [u + t, l + r],
1129
- [u, l + r],
1130
- [u, l]
680
+ [a, l],
681
+ [a + t, l],
682
+ [a + t, l + r],
683
+ [a, l + r],
684
+ [a, l]
1131
685
  ]
1132
686
  ]
1133
687
  }
1134
688
  });
1135
- var Xe = { exports: {} };
1136
- (function(u, l) {
689
+ var tn = { exports: {} };
690
+ (function(a, l) {
1137
691
  (function(t, r) {
1138
- u.exports = r();
1139
- })(Dn, () => (() => {
692
+ a.exports = r();
693
+ })(Gn, () => (() => {
1140
694
  var t = { d: (e, n) => {
1141
- for (var o in n)
1142
- t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
695
+ for (var s in n)
696
+ t.o(n, s) && !t.o(e, s) && Object.defineProperty(e, s, { enumerable: !0, get: n[s] });
1143
697
  }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
1144
- function a(e) {
1145
- return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
698
+ function o(e) {
699
+ return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1146
700
  return typeof n;
1147
701
  } : function(n) {
1148
702
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1149
- }, a(e);
703
+ }, o(e);
1150
704
  }
1151
- t.d(r, { default: () => Tn });
1152
- var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, f = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, d = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1153
- function m(e) {
1154
- var n = "", o = this;
1155
- 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;
705
+ t.d(r, { default: () => Cn });
706
+ 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 };
707
+ function v(e) {
708
+ var n = "", s = this;
709
+ 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;
1156
710
  }
1157
- var A = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
1158
- function T(e) {
1159
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
1160
- n.family = (o[6] || "").trim();
1161
- var i = d[o[2]] || parseFloat(o[2]);
1162
- o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
1163
- var c = parseFloat(o[4]);
1164
- if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * s : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), f.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
711
+ var T = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
712
+ function A(e) {
713
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = h.exec(e);
714
+ n.family = (s[6] || "").trim();
715
+ var i = y[s[2]] || parseFloat(s[2]);
716
+ s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
717
+ var c = parseFloat(s[4]);
718
+ 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]))
1165
719
  n.weight = "bold";
1166
720
  else {
1167
- var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
1168
- y >= 100 && y !== 400 && (n.weight = y);
721
+ var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
722
+ p >= 100 && p !== 400 && (n.weight = p);
1169
723
  }
1170
724
  return n;
1171
725
  }
1172
726
  function b() {
1173
- 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] : {}, y = 14, w = 12, x = null, E = null, k = "";
727
+ 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 = "";
1174
728
  if (i && i.nodeType) {
1175
- var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), L = O.getComputedStyle(i, null);
1176
- e = L.getPropertyValue("font-family") || "", w = parseFloat(L.getPropertyValue("font-size")), y = L.getPropertyValue("line-height"), x = L.getPropertyValue("font-weight"), E = L.getPropertyValue("font-style"), k = L.getPropertyValue("font-variant") || "";
729
+ var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
730
+ 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") || "";
1177
731
  } else if (typeof i == "string") {
1178
- var M = T(i);
1179
- e = M.family, w = M.size, y = M.height, k = M.variant, E = M.style, x = M.weight;
732
+ var I = A(i);
733
+ e = I.family, w = I.size, p = I.height, S = I.variant, k = I.style, x = I.weight;
1180
734
  } else
1181
- a(i) === "object" && (e = i.family, w = i.size, y = i.height, k = i.variant, x = i.weight, E = i.style, n = i.baseline, o = i.color);
1182
- c.size && c.size < 3 && (w *= c.size), y = y !== "normal" && y ? parseFloat(y) : w * (7 / 6), c.height && c.height < 3 && (y *= c.height);
1183
- var z = Object.create(A);
1184
- return z.family = c.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = c.variant || k || "", z.style = c.style || E || "", z.weight = c.weight || x || "", z.baseline = n || 0, c.baseline != null && (z.baseline = c.baseline), z.color = c.color || o || "", z.id = m.call(z, !0), z;
735
+ 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);
736
+ 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);
737
+ var L = Object.create(T);
738
+ 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;
1185
739
  }
1186
- const I = { "\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 };
1187
- var S, P = function(e) {
740
+ 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 };
741
+ var E, $ = function(e) {
1188
742
  var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
1189
743
  if (n && n.getContext) {
1190
- var o = n.getContext("2d");
1191
- if (o && typeof o.measureText == "function")
744
+ var s = n.getContext("2d");
745
+ if (s && typeof s.measureText == "function")
1192
746
  return function(i, c) {
1193
- return o.font = String(c), o.measureText(i).width;
747
+ return s.font = String(c), s.measureText(i).width;
1194
748
  };
1195
749
  }
1196
- }(typeof document < "u" ? document : null) || (S = {}, function(e, n) {
1197
- if (!S[n]) {
1198
- var o = b(n);
1199
- S[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
750
+ }(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
751
+ if (!E[n]) {
752
+ var s = b(n);
753
+ E[n] = s, /\bmonospace\b/.test(s.family) ? s.size *= 0.6 : (s.size *= 0.45, s.weight && (s.size *= 1.18));
1200
754
  }
1201
- return e.length * S[n].size;
1202
- }), $ = {}, _ = { trim: !0, collapse: !0 };
1203
- function X(e, n, o) {
1204
- var i = Object.assign({}, _, o), c = String(e);
755
+ return e.length * E[n].size;
756
+ }), N = {}, _ = { trim: !0, collapse: !0 };
757
+ function W(e, n, s) {
758
+ var i = Object.assign({}, _, s), c = String(e);
1205
759
  if (!c)
1206
760
  return 0;
1207
- if (c in I) {
1208
- var y = n.id + "/" + c;
1209
- return y in $ || ($[y] = P("_".concat(c, "_"), n) - P("__", n)), $[y];
761
+ if (c in C) {
762
+ var p = n.id + "/" + c;
763
+ return p in N || (N[p] = $("_".concat(c, "_"), n) - $("__", n)), N[p];
1210
764
  }
1211
- return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), P(c, n) + n.size * (e.tracking || 0);
765
+ 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);
1212
766
  }
1213
- function W(e) {
1214
- return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
767
+ function G(e) {
768
+ return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1215
769
  return typeof n;
1216
770
  } : function(n) {
1217
771
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1218
- }, W(e);
772
+ }, G(e);
1219
773
  }
1220
- function Et(e, n) {
774
+ function _t(e, n) {
1221
775
  if (typeof n != "function" && n !== null)
1222
776
  throw new TypeError("Super expression must either be null or a function");
1223
- e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && kt(e, n);
777
+ e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && It(e, n);
1224
778
  }
1225
- function kt(e, n) {
1226
- return kt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1227
- return o.__proto__ = i, o;
1228
- }, kt(e, n);
779
+ function It(e, n) {
780
+ return It = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, i) {
781
+ return s.__proto__ = i, s;
782
+ }, It(e, n);
1229
783
  }
1230
- function Wt(e) {
784
+ function Jt(e) {
1231
785
  var n = function() {
1232
786
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
1233
787
  return !1;
@@ -1241,62 +795,62 @@ var Xe = { exports: {} };
1241
795
  }
1242
796
  }();
1243
797
  return function() {
1244
- var o, i = Ct(e);
798
+ var s, i = Nt(e);
1245
799
  if (n) {
1246
- var c = Ct(this).constructor;
1247
- o = Reflect.construct(i, arguments, c);
800
+ var c = Nt(this).constructor;
801
+ s = Reflect.construct(i, arguments, c);
1248
802
  } else
1249
- o = i.apply(this, arguments);
1250
- return We(this, o);
803
+ s = i.apply(this, arguments);
804
+ return en(this, s);
1251
805
  };
1252
806
  }
1253
- function We(e, n) {
1254
- if (n && (W(n) === "object" || typeof n == "function"))
807
+ function en(e, n) {
808
+ if (n && (G(n) === "object" || typeof n == "function"))
1255
809
  return n;
1256
810
  if (n !== void 0)
1257
811
  throw new TypeError("Derived constructors may only return object or undefined");
1258
- return function(o) {
1259
- if (o === void 0)
812
+ return function(s) {
813
+ if (s === void 0)
1260
814
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1261
- return o;
815
+ return s;
1262
816
  }(e);
1263
817
  }
1264
- function Ct(e) {
1265
- return Ct = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
818
+ function Nt(e) {
819
+ return Nt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1266
820
  return n.__proto__ || Object.getPrototypeOf(n);
1267
- }, Ct(e);
821
+ }, Nt(e);
1268
822
  }
1269
- function Pt(e, n) {
823
+ function Ht(e, n) {
1270
824
  if (!(e instanceof n))
1271
825
  throw new TypeError("Cannot call a class as a function");
1272
826
  }
1273
- function pe(e, n) {
1274
- for (var o = 0; o < n.length; o++) {
1275
- var i = n[o];
1276
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1277
- if (W(y) !== "object" || y === null)
1278
- return y;
1279
- var x = y[Symbol.toPrimitive];
827
+ function me(e, n) {
828
+ for (var s = 0; s < n.length; s++) {
829
+ var i = n[s];
830
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
831
+ if (G(p) !== "object" || p === null)
832
+ return p;
833
+ var x = p[Symbol.toPrimitive];
1280
834
  if (x !== void 0) {
1281
- var E = x.call(y, w);
1282
- if (W(E) !== "object")
1283
- return E;
835
+ var k = x.call(p, w);
836
+ if (G(k) !== "object")
837
+ return k;
1284
838
  throw new TypeError("@@toPrimitive must return a primitive value.");
1285
839
  }
1286
- return String(y);
1287
- }(i.key, "string"), W(c) === "symbol" ? c : String(c)), i);
840
+ return String(p);
841
+ }(i.key, "string"), G(c) === "symbol" ? c : String(c)), i);
1288
842
  }
1289
843
  var c;
1290
844
  }
1291
- function $t(e, n, o) {
1292
- return n && pe(e.prototype, n), o && pe(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
845
+ function Ft(e, n, s) {
846
+ return n && me(e.prototype, n), s && me(e, s), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1293
847
  }
1294
- var H = function() {
848
+ var F = function() {
1295
849
  function e() {
1296
850
  var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
1297
- Pt(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
851
+ Ht(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1298
852
  }
1299
- return $t(e, [{ key: "clone", value: function() {
853
+ return Ft(e, [{ key: "clone", value: function() {
1300
854
  var n = new e(this.value);
1301
855
  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;
1302
856
  } }, { key: "valueOf", value: function() {
@@ -1304,43 +858,43 @@ var Xe = { exports: {} };
1304
858
  } }, { key: "toString", value: function() {
1305
859
  return this.value;
1306
860
  } }]), e;
1307
- }(), Tt = function(e) {
1308
- Et(o, e);
1309
- var n = Wt(o);
1310
- function o() {
1311
- return Pt(this, o), n.apply(this, arguments);
861
+ }(), Dt = function(e) {
862
+ _t(s, e);
863
+ var n = Jt(s);
864
+ function s() {
865
+ return Ht(this, s), n.apply(this, arguments);
1312
866
  }
1313
- return $t(o);
1314
- }(H), nt = function(e) {
1315
- Et(o, e);
1316
- var n = Wt(o);
1317
- function o() {
1318
- return Pt(this, o), n.apply(this, arguments);
867
+ return Ft(s);
868
+ }(F), et = function(e) {
869
+ _t(s, e);
870
+ var n = Jt(s);
871
+ function s() {
872
+ return Ht(this, s), n.apply(this, arguments);
1319
873
  }
1320
- return $t(o);
1321
- }(H), pt = function(e) {
1322
- Et(o, e);
1323
- var n = Wt(o);
1324
- function o() {
1325
- return Pt(this, o), n.apply(this, arguments);
874
+ return Ft(s);
875
+ }(F), pt = function(e) {
876
+ _t(s, e);
877
+ var n = Jt(s);
878
+ function s() {
879
+ return Ht(this, s), n.apply(this, arguments);
1326
880
  }
1327
- return $t(o);
1328
- }(H), Gt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ge = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, ge = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ze = /^(?:[;\xAD%?…]|,(?!\d))/, Ke = /^[´±°¢£¤$¥\u2212]/;
1329
- function Nt(e, n) {
881
+ return Ft(s);
882
+ }(F), Qt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, nn = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, ve = /^[\xA0\u2011\u202F\u2060\uFEFF]/, rn = /^(?:[;\xAD%?…]|,(?!\d))/, sn = /^[´±°¢£¤$¥\u2212]/;
883
+ function Bt(e, n) {
1330
884
  n !== !1 && (e = e.trim());
1331
- for (var o, i, c = [], y = e.charAt(0), w = 0, x = 1, E = e.length; x < E; x++) {
1332
- o = e.charAt(x), i = e.charAt(x + 1);
1333
- var k = Gt.test(y), O = Gt.test(o), L = O || k, M = void 0;
1334
- if ((Ke.test(o) && !ge.test(y) || Ze.test(y + i) && !ge.test(o)) && (L = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((M = Gt.test(e.charAt(x - 2))) && !O && (L = !1), !M && Ge.test(o + i) && (L = !0)), L) {
1335
- var z = e.slice(w, x);
1336
- /\u00AD$/.test(z) ? (c.push(new H(z.slice(0, -1))), c.push(new pt())) : (c.push(new H(z)), c.push(new Tt())), w = x;
885
+ for (var s, i, c = [], p = e.charAt(0), w = 0, x = 1, k = e.length; x < k; x++) {
886
+ s = e.charAt(x), i = e.charAt(x + 1);
887
+ var S = Qt.test(p), M = Qt.test(s), O = M || S, I = void 0;
888
+ if ((sn.test(s) && !ve.test(p) || rn.test(p + i) && !ve.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((I = Qt.test(e.charAt(x - 2))) && !M && (O = !1), !I && nn.test(s + i) && (O = !0)), O) {
889
+ var L = e.slice(w, x);
890
+ /\u00AD$/.test(L) ? (c.push(new F(L.slice(0, -1))), c.push(new pt())) : (c.push(new F(L)), c.push(new Dt())), w = x;
1337
891
  }
1338
- y = o;
892
+ p = s;
1339
893
  }
1340
- return c.push(new H(e.slice(w))), c;
894
+ return c.push(new F(e.slice(w))), c;
1341
895
  }
1342
- const ye = { 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: "›" };
1343
- var Je = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Qe = /^<\/([a-zA-Z0-9]+)([^>]*)>/, tn = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, en = /^<!--(.+?)-->/, nn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, me = { b: function(e) {
896
+ const xe = { 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: "›" };
897
+ 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, we = { b: function(e) {
1344
898
  e.weight = "bold";
1345
899
  }, strong: function(e) {
1346
900
  e.weight = "bold";
@@ -1366,37 +920,37 @@ var Xe = { exports: {} };
1366
920
  e.sub = !0;
1367
921
  }, sup: function(e) {
1368
922
  e.sup = !0;
1369
- } }, rn = { 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 };
1370
- function ve(e) {
1371
- return e.replace(nn, function(n, o, i, c) {
1372
- if (o || i) {
1373
- var y = o ? 10 : 16;
1374
- return String.fromCharCode(parseInt(o || i, y));
923
+ } }, 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 };
924
+ function be(e) {
925
+ return e.replace(cn, function(n, s, i, c) {
926
+ if (s || i) {
927
+ var p = s ? 10 : 16;
928
+ return String.fromCharCode(parseInt(s || i, p));
1375
929
  }
1376
- return c in ye ? ye[c] : n;
930
+ return c in xe ? xe[c] : n;
1377
931
  });
1378
932
  }
1379
- function sn(e) {
933
+ function dn(e) {
1380
934
  return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
1381
935
  }
1382
- var on = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1383
- function an(e) {
1384
- var n, o = {};
936
+ var fn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
937
+ function pn(e) {
938
+ var n, s = {};
1385
939
  if (e) {
1386
940
  do
1387
- if (n = on.exec(e)) {
1388
- var i = ve(sn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1389
- if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
941
+ if (n = fn.exec(e)) {
942
+ var i = be(dn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
943
+ if (s[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
1390
944
  throw new Error("Attribute error");
1391
945
  }
1392
946
  while (n && e.length);
1393
947
  if (/\S/.test(e))
1394
948
  throw new Error("Attribute error");
1395
949
  }
1396
- return o;
950
+ return s;
1397
951
  }
1398
- const xe = { 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: "Þ" };
1399
- var ln = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, hn = /^%[^\n]+(?:\n|$)/, cn = /^[^#$%&~_^\\{}]+/, un = /^\\([&{}$%#_])/, dn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, fn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
952
+ const Ae = { 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: "Þ" };
953
+ var gn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, yn = /^%[^\n]+(?:\n|$)/, mn = /^[^#$%&~_^\\{}]+/, vn = /^\\([&{}$%#_])/, xn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, wn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
1400
954
  e.weight = "bold";
1401
955
  }, it: function(e) {
1402
956
  e.style = "italic";
@@ -1411,170 +965,170 @@ var Xe = { exports: {} };
1411
965
  }, _: function(e) {
1412
966
  e.sub = !0;
1413
967
  }, par: function(e) {
1414
- this.tokens.push(new nt(), new nt());
968
+ this.tokens.push(new et(), new et());
1415
969
  }, newline: function(e) {
1416
- this.tokens.push(new nt());
970
+ this.tokens.push(new et());
1417
971
  }, url: function(e, n) {
1418
- this.open_context().href = n, this.add_token(new H(n)), this.close_context();
972
+ this.open_context().href = n, this.add_token(new F(n)), this.close_context();
1419
973
  } };
1420
974
  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;
1421
- var pn = /[\r\n\xA0]+/g;
1422
- function gn(e, n) {
975
+ var bn = /[\r\n\xA0]+/g;
976
+ function An(e, n) {
1423
977
  e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
1424
- var o = n;
1425
- return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = b(n, e)), o;
978
+ var s = n;
979
+ return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (s = b(n, e)), s;
1426
980
  }
1427
- function we(e, n, o) {
1428
- for (var i, c, y = e.width; y + o.width > n && e.length; )
1429
- c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = X(i, i.font), y += i.width) : e.pop(), y -= c;
1430
- e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font = b(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);
981
+ function Ee(e, n, s) {
982
+ for (var i, c, p = e.width; p + s.width > n && e.length; )
983
+ c = (i = e[e.length - 1]).width, i.width > s.width ? (i.value = i.value.slice(0, -1), i.width = W(i, i.font), p += i.width) : e.pop(), p -= c;
984
+ e[e.length - 1] instanceof pt && 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);
1431
985
  }
1432
- function vt(e) {
986
+ function xt(e) {
1433
987
  return Math.round(1e6 * e) / 1e6;
1434
988
  }
1435
- function be(e) {
989
+ function ke(e) {
1436
990
  return function(n) {
1437
991
  if (Array.isArray(n))
1438
- return Zt(n);
992
+ return te(n);
1439
993
  }(e) || function(n) {
1440
994
  if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
1441
995
  return Array.from(n);
1442
- }(e) || function(n, o) {
996
+ }(e) || function(n, s) {
1443
997
  if (n) {
1444
998
  if (typeof n == "string")
1445
- return Zt(n, o);
999
+ return te(n, s);
1446
1000
  var i = Object.prototype.toString.call(n).slice(8, -1);
1447
- 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) ? Zt(n, o) : void 0;
1001
+ return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? te(n, s) : void 0;
1448
1002
  }
1449
1003
  }(e) || function() {
1450
1004
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1451
1005
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1452
1006
  }();
1453
1007
  }
1454
- function Zt(e, n) {
1008
+ function te(e, n) {
1455
1009
  (n == null || n > e.length) && (n = e.length);
1456
- for (var o = 0, i = new Array(n); o < n; o++)
1457
- i[o] = e[o];
1010
+ for (var s = 0, i = new Array(n); s < n; s++)
1011
+ i[s] = e[s];
1458
1012
  return i;
1459
1013
  }
1460
- var yn = { center: "middle", right: "end" }, mn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Kt = function(e, n) {
1014
+ var En = { center: "middle", right: "end" }, kn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ee = function(e, n) {
1461
1015
  return !e && !n || e === n;
1462
1016
  };
1463
- function vn(e, n) {
1464
- var o = [], i = n.font(), c = i.size, y = i.family, w = n.align(), x = n.createElement();
1017
+ function Sn(e, n) {
1018
+ var s = [], i = n.font(), c = i.size, p = i.family, w = n.align(), x = n.createElement();
1465
1019
  if (e.length) {
1466
- var E = i.height, k = n.valign(), O = n.height()(), L = n.width()(0), M = !isFinite(L) && e.length === 1, z = M ? null : n.x(), j = vt(E / c), Q = M ? null : vt(E / (1.15 * c + (E - c) / 2));
1467
- if (mn[k] && isFinite(O)) {
1468
- var N = k === "bottom" ? 1 : 0.5;
1469
- Q += (O * N - E * e.length * N) / c;
1020
+ 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));
1021
+ if (kn[S] && isFinite(M)) {
1022
+ var z = S === "bottom" ? 1 : 0.5;
1023
+ J += (M * z - k * e.length * z) / c;
1470
1024
  }
1471
- var C = w === "justify", F = 0;
1472
- w === "right" ? F = L : w === "center" && (F = L / 2);
1473
- for (var R = [], tt = "tspan", G = null, q = "", D = function() {
1025
+ var P = w === "justify", j = 0;
1026
+ w === "right" ? j = O : w === "center" && (j = O / 2);
1027
+ for (var H = [], Q = "tspan", Y = null, q = "", D = function() {
1474
1028
  if (q) {
1475
- var gt = x(tt, G, q);
1476
- R.push(gt);
1029
+ var gt = x(Q, Y, q);
1030
+ H.push(gt);
1477
1031
  }
1478
- tt = "tspan", G = null, q = "";
1479
- }, it = 0, et = e.length; it < et; it++) {
1480
- var at = "", dt = "", st = 0, lt = e[it];
1032
+ Q = "tspan", Y = null, q = "";
1033
+ }, nt = 0, tt = e.length; nt < tt; nt++) {
1034
+ var at = "", dt = "", st = 0, lt = e[nt];
1481
1035
  if (lt.length) {
1482
- R = [];
1483
- for (var xt = 0, Mt = 0, ht = void 0, Z = 0, Rt = lt.length; Z < Rt; Z++) {
1484
- var B = lt[Z], K = B.font;
1485
- B.whitespace && xt++, Mt += B.width, Z && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? q += B.value : (D(), q = B.value, G = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== c ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: B.class || null }, st && (G.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", G.href = ht, G.rel = B.rel, G.target = B.target) : ht = null, at = K.id, dt = B.class);
1036
+ H = [];
1037
+ for (var wt = 0, Lt = 0, ht = void 0, X = 0, jt = lt.length; X < jt; X++) {
1038
+ var R = lt[X], Z = R.font;
1039
+ R.whitespace && wt++, Lt += R.width, X && !R.tracking && !st && ee(Z.id, at) && ee(R.class, dt) && ee(ht, R.href) ? q += R.value : (D(), q = R.value, Y = { fontFamily: Z.family !== p ? Z.family : null, fontSize: Z.size !== c ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: R.class || null }, st && (Y.dx = xt(st), st = 0), R.tracking && (st = 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);
1486
1040
  }
1487
- if (D(), M)
1488
- o.push.apply(o, be(R));
1041
+ if (D(), I)
1042
+ s.push.apply(s, ke(H));
1489
1043
  else {
1490
- var Ht = null, Dt = it === et - 1 || lt[lt.length - 1] instanceof nt;
1491
- C && lt.length > 1 && !Dt && (Ht = vt((L - Mt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Ht, x: z(it) + F, dy: vt(it ? j : Q) + "em" }].concat(be(R))));
1044
+ var qt = null, Ct = nt === tt - 1 || lt[lt.length - 1] instanceof et;
1045
+ 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(ke(H))));
1492
1046
  }
1493
1047
  } else
1494
- o.push(x("tspan", { x: z(it), dy: vt(it ? j : Q) + "em" }, " "));
1048
+ s.push(x("tspan", { x: L(nt), dy: xt(nt ? B : J) + "em" }, " "));
1495
1049
  }
1496
1050
  }
1497
- return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor: yn[w] || "start" }].concat(o));
1051
+ return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: En[w] || "start" }].concat(s));
1498
1052
  }
1499
- var xn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1500
- function wn(e, n, o) {
1053
+ var Tn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1054
+ function _n(e, n, s) {
1501
1055
  if (e.length) {
1502
- o.textBaseline = "middle";
1503
- var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(), E = n.width()(0), k = n.align(), O = k === "justify", L = 0.5 * c, M = xn[w];
1504
- if (M && isFinite(x)) {
1505
- var z = e.length * c;
1506
- L += x * M - z * M;
1056
+ s.textBaseline = "middle";
1057
+ 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];
1058
+ if (I && isFinite(x)) {
1059
+ var L = e.length * c;
1060
+ O += x * I - L * I;
1507
1061
  }
1508
- e.forEach(function(j, Q) {
1509
- var N = n.x()(Q), C = Q * c + L, F = 0, R = 0;
1510
- j.forEach(function(q) {
1511
- q.whitespace && F++, R += q.width;
1062
+ e.forEach(function(B, J) {
1063
+ var z = n.x()(J), P = J * c + O, j = 0, H = 0;
1064
+ B.forEach(function(q) {
1065
+ q.whitespace && j++, H += q.width;
1512
1066
  });
1513
- var tt = 0, G = Q === e.length - 1 || j[j.length - 1] instanceof nt;
1514
- O && j.length > 1 && !G && (tt = (E - R) / F), j.forEach(function(q) {
1515
- o.font = q.font;
1516
- var D = q.font, it = D.baseline ? y * -D.baseline + 0.15 * y : 0;
1517
- o.fillStyle = function(dt, st) {
1067
+ var Q = 0, Y = J === e.length - 1 || B[B.length - 1] instanceof et;
1068
+ M && B.length > 1 && !Y && (Q = (k - H) / j), B.forEach(function(q) {
1069
+ s.font = q.font;
1070
+ var D = q.font, nt = D.baseline ? p * -D.baseline + 0.15 * p : 0;
1071
+ s.fillStyle = function(dt, st) {
1518
1072
  return dt.color ? dt.color : st.href ? "#00C" : "#000";
1519
1073
  }(D, q);
1520
- var et = 0;
1521
- if (k === "right" ? et += E - R : k === "center" ? et += E / 2 - R / 2 : k === "justify" && (q.whitespace || q instanceof nt) && (N += tt), o.fillText(q.value, N + et, C + it), q.href) {
1522
- o.beginPath(), o.strokeStyle = o.fillStyle;
1523
- var at = Math.floor(C + 0.45 * y) + 0.5;
1524
- o.moveTo(N + et, at), o.lineTo(N + et + q.width, at), o.stroke();
1074
+ var tt = 0;
1075
+ 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) {
1076
+ s.beginPath(), s.strokeStyle = s.fillStyle;
1077
+ var at = Math.floor(P + 0.45 * p) + 0.5;
1078
+ s.moveTo(z + tt, at), s.lineTo(z + tt + q.width, at), s.stroke();
1525
1079
  }
1526
- N += q.width;
1080
+ z += q.width;
1527
1081
  });
1528
1082
  });
1529
1083
  }
1530
1084
  }
1531
- function Jt(e) {
1532
- return Jt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1085
+ function ne(e) {
1086
+ return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1533
1087
  return typeof n;
1534
1088
  } : function(n) {
1535
1089
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1536
- }, Jt(e);
1090
+ }, ne(e);
1537
1091
  }
1538
- function Ae(e) {
1539
- for (var n = {}, o = 0; o < e.length; o++) {
1540
- var i = e[o];
1541
- typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : Jt(i) === "object" && i._groups ? n.d3 = i : i && i.nodeType && i.getContext ? n.ctx = i.getContext("2d") : i && i.fillText && i.beginPath ? n.ctx = i : i && (n.text = i));
1092
+ function Se(e) {
1093
+ for (var n = {}, s = 0; s < e.length; s++) {
1094
+ var i = e[s];
1095
+ typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : ne(i) === "object" && i._groups ? n.d3 = i : i && i.nodeType && i.getContext ? n.ctx = i.getContext("2d") : i && i.fillText && i.beginPath ? n.ctx = i : i && (n.text = i));
1542
1096
  }
1543
1097
  return n;
1544
1098
  }
1545
- function _t(e) {
1546
- return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1099
+ function Mt(e) {
1100
+ return Mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1547
1101
  return typeof n;
1548
1102
  } : function(n) {
1549
1103
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1550
- }, _t(e);
1104
+ }, Mt(e);
1551
1105
  }
1552
- function bn(e, n) {
1553
- for (var o = 0; o < n.length; o++) {
1554
- var i = n[o];
1555
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1556
- if (_t(y) !== "object" || y === null)
1557
- return y;
1558
- var x = y[Symbol.toPrimitive];
1106
+ function In(e, n) {
1107
+ for (var s = 0; s < n.length; s++) {
1108
+ var i = n[s];
1109
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
1110
+ if (Mt(p) !== "object" || p === null)
1111
+ return p;
1112
+ var x = p[Symbol.toPrimitive];
1559
1113
  if (x !== void 0) {
1560
- var E = x.call(y, w);
1561
- if (_t(E) !== "object")
1562
- return E;
1114
+ var k = x.call(p, w);
1115
+ if (Mt(k) !== "object")
1116
+ return k;
1563
1117
  throw new TypeError("@@toPrimitive must return a primitive value.");
1564
1118
  }
1565
- return String(y);
1566
- }(i.key, "string"), _t(c) === "symbol" ? c : String(c)), i);
1119
+ return String(p);
1120
+ }(i.key, "string"), Mt(c) === "symbol" ? c : String(c)), i);
1567
1121
  }
1568
1122
  var c;
1569
1123
  }
1570
- var An = b(), Qt = function(e) {
1124
+ var Dn = b(), ie = function(e) {
1571
1125
  return typeof e == "function" ? e : function() {
1572
1126
  return e;
1573
1127
  };
1574
- }, rt = function() {
1128
+ }, it = function() {
1575
1129
  function e(i) {
1576
- if (function(y, w) {
1577
- if (!(y instanceof w))
1130
+ if (function(p, w) {
1131
+ if (!(p instanceof w))
1578
1132
  throw new TypeError("Cannot call a class as a function");
1579
1133
  }(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
1580
1134
  return 1 / 0;
@@ -1586,82 +1140,82 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1586
1140
  for (var c in i)
1587
1141
  typeof this[c] == "function" && this[c](i[c]);
1588
1142
  }
1589
- var n, o;
1590
- return n = e, o = [{ key: "linebreak", value: function(i) {
1591
- var c = this, y = this.props.parser(String(i)), w = this.font(), x = function(E, k, O) {
1592
- if (!E.length)
1143
+ var n, s;
1144
+ return n = e, s = [{ key: "linebreak", value: function(i) {
1145
+ var c = this, p = this.props.parser(String(i)), w = this.font(), x = function(k, S, M) {
1146
+ if (!k.length)
1593
1147
  return [];
1594
- var L = k.height(), M = k.width(), z = k.overflowLine(), j = k.overflowWrap(), Q = b(O, !0, !1), N = isFinite(L()) ? Math.floor(L() / O.height) : 1 / 0;
1595
- if (!L() && !M(0) || !N)
1148
+ 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;
1149
+ if (!O() && !I(0) || !z)
1596
1150
  return [];
1597
- for (var C = 0, F = 0, R = 0, tt = [], G = [], q = !1; C < E.length && F < N; ) {
1598
- var D = E[C], it = gn(D, O);
1599
- if (D.width = X(D, it), D.font = it, D.line = F, D.whitespace = D.value in I, D.value && (D.value = D.value.replace(pn, " ")), !(!R && D.whitespace || q && D.whitespace))
1600
- if (D instanceof nt)
1601
- R = 0, G = [], tt.push(C + 1), F++;
1602
- else if (D instanceof Tt || D instanceof pt)
1603
- G.push({ index: C, width: R });
1604
- else if (D.whitespace || R + D.width < M(F))
1605
- R += D.width;
1606
- else if (G.length) {
1607
- var et = void 0, at = void 0;
1151
+ for (var P = 0, j = 0, H = 0, Q = [], Y = [], q = !1; P < k.length && j < z; ) {
1152
+ var D = k[P], nt = An(D, M);
1153
+ if (D.width = W(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))
1154
+ if (D instanceof et)
1155
+ H = 0, Y = [], Q.push(P + 1), j++;
1156
+ else if (D instanceof Dt || D instanceof pt)
1157
+ Y.push({ index: P, width: H });
1158
+ else if (D.whitespace || H + D.width < I(j))
1159
+ H += D.width;
1160
+ else if (Y.length) {
1161
+ var tt = void 0, at = void 0;
1608
1162
  do {
1609
- at = !0, et = G.pop();
1610
- var dt = E[et.index], st = void 0;
1611
- dt instanceof pt && (st = X("-", dt.font), et.width + st > M(F) && (at = !G.length));
1163
+ at = !0, tt = Y.pop();
1164
+ var dt = k[tt.index], st = void 0;
1165
+ dt instanceof pt && (st = W("-", dt.font), tt.width + st > I(j) && (at = !Y.length));
1612
1166
  } while (!at);
1613
- tt.push(et.index + 1), R = 0, F++, C = et.index, G = [];
1614
- } else if (j === "break-word") {
1615
- var lt = M(F);
1616
- if (R + D.width > lt) {
1617
- var xt = D.clone();
1167
+ Q.push(tt.index + 1), H = 0, j++, P = tt.index, Y = [];
1168
+ } else if (B === "break-word") {
1169
+ var lt = I(j);
1170
+ if (H + D.width > lt) {
1171
+ var wt = D.clone();
1618
1172
  do
1619
- D.value = D.value.slice(0, -1), D.width = X(D, D.font), R += D.width;
1173
+ D.value = D.value.slice(0, -1), D.width = W(D, D.font), H += D.width;
1620
1174
  while (D.value && D.width > lt);
1621
- xt.value = xt.value.slice(D.value.length), E.splice(C + 1, 0, new Tt(), xt);
1175
+ wt.value = wt.value.slice(D.value.length), k.splice(P + 1, 0, new Dt(), wt);
1622
1176
  }
1623
- tt.push(C + 1), R = 0, F++;
1177
+ Q.push(P + 1), H = 0, j++;
1624
1178
  } else
1625
- R += D.width;
1626
- C++, q = D.whitespace;
1179
+ H += D.width;
1180
+ P++, q = D.whitespace;
1627
1181
  }
1628
- C !== tt[tt.length - 1] && tt.push(C);
1629
- var Mt = 0, ht = 0, Z = tt.map(function(gt) {
1630
- for (var J, yt = Mt; (J = E[yt]) && (J.whitespace || !J.value); )
1182
+ P !== Q[Q.length - 1] && Q.push(P);
1183
+ var Lt = 0, ht = 0, X = Q.map(function(gt) {
1184
+ for (var K, yt = Lt; (K = k[yt]) && (K.whitespace || !K.value); )
1631
1185
  yt++;
1632
- for (var ft = gt, ne = null; ft > yt && (J = E[ft - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
1633
- J instanceof nt && (ne = J), ft--;
1634
- J instanceof pt && (J.value = "-", J.width = X("-", J.font)), Mt = gt;
1635
- var wt = E.slice(yt, ft).filter(function(ie) {
1636
- return ie.value;
1186
+ for (var ft = gt, oe = null; ft > yt && (K = k[ft - 1]) && (K.whitespace || !(K.value || K instanceof pt)); )
1187
+ K instanceof et && (oe = K), ft--;
1188
+ K instanceof pt && (K.value = "-", K.width = W("-", K.font)), Lt = gt;
1189
+ var bt = k.slice(yt, ft).filter(function(ae) {
1190
+ return ae.value;
1637
1191
  });
1638
- return ne && wt.push(ne), wt.width = wt.reduce(function(ie, _n) {
1639
- return ie + _n.width;
1640
- }, 0), wt.width > ht && (ht = wt.width), wt;
1192
+ return oe && bt.push(oe), bt.width = bt.reduce(function(ae, Pn) {
1193
+ return ae + Pn.width;
1194
+ }, 0), bt.width > ht && (ht = bt.width), bt;
1641
1195
  });
1642
- if (Z.hasLineOverflow = !1, z) {
1643
- var Rt = z === "ellipsis" ? "…" : z;
1644
- Z.forEach(function(gt, J) {
1645
- var yt = M(J);
1196
+ if (X.hasLineOverflow = !1, L) {
1197
+ var jt = L === "ellipsis" ? "…" : L;
1198
+ X.forEach(function(gt, K) {
1199
+ var yt = I(K);
1646
1200
  if (gt.width > yt) {
1647
- var ft = new H(Rt);
1648
- ft.font = O, ft.width = X(Rt, Q), we(gt, yt, ft), Z.hasLineOverflow = !0;
1201
+ var ft = new F(jt);
1202
+ ft.font = M, ft.width = W(jt, J), Ee(gt, yt, ft), X.hasLineOverflow = !0;
1649
1203
  }
1650
1204
  });
1651
1205
  }
1652
- var B = k.overflow() === "ellipsis" ? "…" : k.overflow();
1653
- if (B && C !== E.length) {
1654
- var K = M(Z.length - 1), Ht = Z[Z.length - 1], Dt = new H(B);
1655
- Dt.font = O, Dt.width = X(B, Q), we(Ht, K, Dt), Z.hasOverflow = !0;
1206
+ var R = S.overflow() === "ellipsis" ? "…" : S.overflow();
1207
+ if (R && P !== k.length) {
1208
+ var Z = I(X.length - 1), qt = X[X.length - 1], Ct = new F(R);
1209
+ Ct.font = M, Ct.width = W(R, J), Ee(qt, Z, Ct), X.hasOverflow = !0;
1656
1210
  } else
1657
- Z.hasOverflow = !1;
1658
- return Z.font = O, Z.width = ht, Z;
1659
- }(y, this, w);
1660
- return x.height = x.length * w.height, x.render = function(E) {
1661
- return c.render(x, E);
1211
+ X.hasOverflow = !1;
1212
+ return X.font = M, X.width = ht, X;
1213
+ }(p, this, w);
1214
+ return x.height = x.length * w.height, x.render = function(k) {
1215
+ return c.render(x, k);
1662
1216
  }, x.svg = x.render, x.draw = x.render, x;
1663
1217
  } }, { key: "font", value: function(i) {
1664
- return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(An);
1218
+ return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(Dn);
1665
1219
  } }, { key: "overflow", value: function(i) {
1666
1220
  return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
1667
1221
  } }, { key: "overflowLine", value: function(i) {
@@ -1679,11 +1233,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1679
1233
  var c = String(i).toLowerCase();
1680
1234
  return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
1681
1235
  } }, { key: "width", value: function(i) {
1682
- return arguments.length ? (this.props.width = Qt(i), this) : this.props.width;
1236
+ return arguments.length ? (this.props.width = ie(i), this) : this.props.width;
1683
1237
  } }, { key: "height", value: function(i) {
1684
- return arguments.length ? (this.props.height = Qt(i), this) : this.props.height;
1238
+ return arguments.length ? (this.props.height = ie(i), this) : this.props.height;
1685
1239
  } }, { key: "x", value: function(i) {
1686
- return arguments.length ? (this.props.x = Qt(i), this) : this.props.x;
1240
+ return arguments.length ? (this.props.x = ie(i), this) : this.props.x;
1687
1241
  } }, { key: "parser", value: function(i) {
1688
1242
  if (!arguments.length)
1689
1243
  return this.props.parser;
@@ -1697,49 +1251,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1697
1251
  } }, { key: "createElement", value: function(i) {
1698
1252
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1699
1253
  } }, { key: "render", value: function() {
1700
- var i = Ae(arguments);
1701
- return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? wn(i.text, this, i.ctx) : vn(i.text, this);
1702
- } }], o && bn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1254
+ var i = Se(arguments);
1255
+ return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? _n(i.text, this, i.ctx) : Sn(i.text, this);
1256
+ } }], s && In(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1703
1257
  }();
1704
- function It(e) {
1705
- return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1258
+ function Ot(e) {
1259
+ return Ot = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1706
1260
  return typeof n;
1707
1261
  } : function(n) {
1708
1262
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1709
- }, It(e);
1263
+ }, Ot(e);
1710
1264
  }
1711
- function te(e, n) {
1265
+ function re(e, n) {
1712
1266
  (n == null || n > e.length) && (n = e.length);
1713
- for (var o = 0, i = new Array(n); o < n; o++)
1714
- i[o] = e[o];
1267
+ for (var s = 0, i = new Array(n); s < n; s++)
1268
+ i[s] = e[s];
1715
1269
  return i;
1716
1270
  }
1717
- function Sn(e, n) {
1718
- for (var o = 0; o < n.length; o++) {
1719
- var i = n[o];
1720
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1721
- if (It(y) !== "object" || y === null)
1722
- return y;
1723
- var x = y[Symbol.toPrimitive];
1271
+ function Mn(e, n) {
1272
+ for (var s = 0; s < n.length; s++) {
1273
+ var i = n[s];
1274
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
1275
+ if (Ot(p) !== "object" || p === null)
1276
+ return p;
1277
+ var x = p[Symbol.toPrimitive];
1724
1278
  if (x !== void 0) {
1725
- var E = x.call(y, w);
1726
- if (It(E) !== "object")
1727
- return E;
1279
+ var k = x.call(p, w);
1280
+ if (Ot(k) !== "object")
1281
+ return k;
1728
1282
  throw new TypeError("@@toPrimitive must return a primitive value.");
1729
1283
  }
1730
- return String(y);
1731
- }(i.key, "string"), It(c) === "symbol" ? c : String(c)), i);
1284
+ return String(p);
1285
+ }(i.key, "string"), Ot(c) === "symbol" ? c : String(c)), i);
1732
1286
  }
1733
1287
  var c;
1734
1288
  }
1735
- var Se = function(e) {
1289
+ var Te = function(e) {
1736
1290
  return typeof e == "function" ? e : function() {
1737
1291
  return e;
1738
1292
  };
1739
- }, Ee = function() {
1293
+ }, _e = function() {
1740
1294
  function e(i) {
1741
- if (function(y, w) {
1742
- if (!(y instanceof w))
1295
+ if (function(p, w) {
1296
+ if (!(p instanceof w))
1743
1297
  throw new TypeError("Cannot call a class as a function");
1744
1298
  }(this, e), this.props = { width: function() {
1745
1299
  return 1 / 0;
@@ -1750,47 +1304,47 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1750
1304
  typeof this[c] == "function" && this[c](i[c]);
1751
1305
  this.render = this.render.bind(this);
1752
1306
  }
1753
- var n, o;
1754
- return n = e, o = [{ key: "anchor", value: function(i) {
1755
- var c = this.props, y = c.hAnchor, w = c.vAnchor, x = c.width, E = c.height;
1307
+ var n, s;
1308
+ return n = e, s = [{ key: "anchor", value: function(i) {
1309
+ var c = this.props, p = c.hAnchor, w = c.vAnchor, x = c.width, k = c.height;
1756
1310
  if (!arguments.length)
1757
- return [y * x(0), w * E(0)];
1311
+ return [p * x(0), w * k(0)];
1758
1312
  if (typeof i == "string") {
1759
- var k = this.props;
1760
- i.toLowerCase().trim().split(/\s+/).forEach(function(O) {
1761
- O === "top" && (k.vAnchor = -0), O === "middle" && (k.vAnchor = -0.5), O === "bottom" && (k.vAnchor = -1), O === "left" && (k.hAnchor = -0), O === "center" && (k.hAnchor = -0.5), O === "right" && (k.hAnchor = -1);
1313
+ var S = this.props;
1314
+ i.toLowerCase().trim().split(/\s+/).forEach(function(M) {
1315
+ 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);
1762
1316
  });
1763
1317
  }
1764
1318
  return this;
1765
1319
  } }, { key: "width", value: function(i) {
1766
- return arguments.length ? (this.props.width = Se(i), this) : this.props.width;
1320
+ return arguments.length ? (this.props.width = Te(i), this) : this.props.width;
1767
1321
  } }, { key: "height", value: function(i) {
1768
- return arguments.length ? (this.props.height = Se(i), this) : this.props.height;
1322
+ return arguments.length ? (this.props.height = Te(i), this) : this.props.height;
1769
1323
  } }, { key: "rotate", value: function(i) {
1770
1324
  return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
1771
1325
  } }, { key: "createElement", value: function(i) {
1772
1326
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1773
1327
  } }, { key: "canvas", value: function(i, c) {
1774
- var y, w = i.getContext ? i.getContext("2d") : i;
1328
+ var p, w = i.getContext ? i.getContext("2d") : i;
1775
1329
  return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
1776
1330
  if (Array.isArray(x))
1777
- return te(x);
1778
- }(y = this.anchor()) || function(x) {
1331
+ return re(x);
1332
+ }(p = this.anchor()) || function(x) {
1779
1333
  if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
1780
1334
  return Array.from(x);
1781
- }(y) || function(x, E) {
1335
+ }(p) || function(x, k) {
1782
1336
  if (x) {
1783
1337
  if (typeof x == "string")
1784
- return te(x, E);
1785
- var k = Object.prototype.toString.call(x).slice(8, -1);
1786
- return k === "Object" && x.constructor && (k = x.constructor.name), k === "Map" || k === "Set" ? Array.from(x) : k === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k) ? te(x, E) : void 0;
1338
+ return re(x, k);
1339
+ var S = Object.prototype.toString.call(x).slice(8, -1);
1340
+ 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) ? re(x, k) : void 0;
1787
1341
  }
1788
- }(y) || function() {
1342
+ }(p) || function() {
1789
1343
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1790
1344
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1791
1345
  }()), c(w), w.restore(), w;
1792
1346
  } }, { key: "render", value: function() {
1793
- var i = Ae(arguments);
1347
+ var i = Se(arguments);
1794
1348
  if (i.d3)
1795
1349
  return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1796
1350
  if (i.ctx)
@@ -1799,156 +1353,156 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1799
1353
  var c = typeof i.text.render == "function" ? i.text.render() : i.text;
1800
1354
  return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
1801
1355
  }
1802
- } }], o && Sn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1803
- }(), En = Object.prototype.hasOwnProperty, ee = {};
1804
- function kn(e) {
1805
- return ee[e] || (ee[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
1806
- return o + "-" + i.toLowerCase();
1807
- })), ee[e];
1356
+ } }], s && Mn(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1357
+ }(), On = Object.prototype.hasOwnProperty, se = {};
1358
+ function Ln(e) {
1359
+ return se[e] || (se[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
1360
+ return s + "-" + i.toLowerCase();
1361
+ })), se[e];
1808
1362
  }
1809
- function ke(e, n) {
1363
+ function Ie(e, n) {
1810
1364
  if (Array.isArray(n))
1811
- return n.forEach(function(o) {
1812
- return ke(e, o);
1365
+ return n.forEach(function(s) {
1366
+ return Ie(e, s);
1813
1367
  });
1814
1368
  typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1815
1369
  }
1816
- function Te(e, n) {
1370
+ function De(e, n) {
1817
1371
  if (typeof document < "u") {
1818
- var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1819
- if (n && o.setAttribute)
1372
+ var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1373
+ if (n && s.setAttribute)
1820
1374
  for (var i in n)
1821
- En.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : kn(i), n[i]);
1822
- for (var c = arguments.length, y = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
1823
- y[w - 2] = arguments[w];
1824
- return y != null && y.length && y.forEach(function(x) {
1825
- ke(o, x);
1826
- }), o;
1375
+ On.call(n, i) && n[i] != null && s.setAttribute(i === "className" ? "class" : Ln(i), n[i]);
1376
+ for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
1377
+ p[w - 2] = arguments[w];
1378
+ return p != null && p.length && p.forEach(function(x) {
1379
+ Ie(s, x);
1380
+ }), s;
1827
1381
  }
1828
1382
  }
1829
- rt.createElement = Te, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
1383
+ it.createElement = De, it.textparser = Bt, it.defaultparser = Bt, it.htmlparser = function(e) {
1830
1384
  e = String(e || "").trim();
1831
- for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], y = [], w = function(L) {
1832
- for (var M in i)
1833
- i[M] && (L[M] = i[M]);
1834
- c.push(L);
1835
- }, x = function(L) {
1836
- var M = c.length, z = rn[L];
1837
- if (M && z) {
1838
- for (var j = M - 1; c[j] && (c[j] instanceof Tt || Je.test(c[j].value)); )
1839
- j--;
1840
- for (; z && c[j] && c[j] instanceof nt; )
1841
- j--, z--;
1842
- for (; z-- > 0; )
1843
- c.push(new nt());
1385
+ 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) {
1386
+ for (var I in i)
1387
+ i[I] && (O[I] = i[I]);
1388
+ c.push(O);
1389
+ }, x = function(O) {
1390
+ var I = c.length, L = un[O];
1391
+ if (I && L) {
1392
+ for (var B = I - 1; c[B] && (c[B] instanceof Dt || on.test(c[B].value)); )
1393
+ B--;
1394
+ for (; L && c[B] && c[B] instanceof et; )
1395
+ B--, L--;
1396
+ for (; L-- > 0; )
1397
+ c.push(new et());
1844
1398
  }
1845
1399
  }; e.length; ) {
1846
1400
  if (n = /^[^<]+/.exec(e))
1847
- Nt(ve(n[0]), !1).forEach(w);
1848
- else if (!(n = en.exec(e)))
1849
- if (n = Qe.exec(e))
1850
- y.length && (i = y.pop()), x(n[1]);
1851
- else if (n = tn.exec(e)) {
1852
- var E = n[1];
1853
- x(E), y.push(i), i = Object.create(i), me[E] && me[E](i, "");
1854
- var k = an(n[2]);
1855
- E === "a" && (k.href && (i.href = k.href), k.rel && (i.rel = k.rel), k.target && (i.target = k.target)), k.class && (i.class = i.class ? i.class + " " + k.class : k.class), k.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(k.style)) && o[1] && (i.color = o[1]), E === "br" && c.push(new nt());
1401
+ Bt(be(n[0]), !1).forEach(w);
1402
+ else if (!(n = hn.exec(e)))
1403
+ if (n = an.exec(e))
1404
+ p.length && (i = p.pop()), x(n[1]);
1405
+ else if (n = ln.exec(e)) {
1406
+ var k = n[1];
1407
+ x(k), p.push(i), i = Object.create(i), we[k] && we[k](i, "");
1408
+ var S = pn(n[2]);
1409
+ 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());
1856
1410
  } else
1857
- n = [e.slice(0, 1)], w(new H(n[0]));
1411
+ n = [e.slice(0, 1)], w(new F(n[0]));
1858
1412
  e = e.slice(n[0].length);
1859
1413
  }
1860
- for (var O = c[c.length - 1]; O instanceof nt; )
1861
- c.pop(), O = c[c.length - 1];
1414
+ for (var M = c[c.length - 1]; M instanceof et; )
1415
+ c.pop(), M = c[c.length - 1];
1862
1416
  return c;
1863
- }, rt.latexparser = function(e) {
1417
+ }, it.latexparser = function(e) {
1864
1418
  e = String(e || "").trim();
1865
1419
  var n = [0];
1866
- e = e.replace(/\\verb,(.*?),/, function(N, C) {
1867
- return n.push(C), "\\verb," + (n.length - 1) + ",";
1420
+ e = e.replace(/\\verb,(.*?),/, function(z, P) {
1421
+ return n.push(P), "\\verb," + (n.length - 1) + ",";
1868
1422
  }).replace(/\\\\\n/g, function() {
1869
1423
  return "\\\\";
1870
- }).replace(dn, function(N, C, F) {
1871
- return F.charAt(C - 1) === "\\" ? N : fn[N];
1872
- }).replace(/\n\s+/g, function(N) {
1873
- return /\n/.test(N.slice(1)) ? "\\par " : N;
1874
- }).replace(/\\symbol\{(\d+)\}/, function(N, C, F, R) {
1875
- return R.charAt(F - 1) === "\\" ? N : String.fromCharCode(1 * C);
1876
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(N, C, F, R) {
1877
- return C + F + "{" + R + "}";
1878
- }).replace(/\\verb,(.*?),/, function(N, C) {
1879
- return "\\verb,".concat(n[+C], ",");
1424
+ }).replace(xn, function(z, P, j) {
1425
+ return j.charAt(P - 1) === "\\" ? z : wn[z];
1426
+ }).replace(/\n\s+/g, function(z) {
1427
+ return /\n/.test(z.slice(1)) ? "\\par " : z;
1428
+ }).replace(/\\symbol\{(\d+)\}/, function(z, P, j, H) {
1429
+ return H.charAt(j - 1) === "\\" ? z : String.fromCharCode(1 * P);
1430
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(z, P, j, H) {
1431
+ return P + j + "{" + H + "}";
1432
+ }).replace(/\\verb,(.*?),/, function(z, P) {
1433
+ return "\\verb,".concat(n[+P], ",");
1880
1434
  });
1881
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function(N) {
1882
- for (var C in i)
1883
- i[C] && (N[C] = i[C]);
1884
- return c.push(N), N;
1435
+ for (var s, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], w = function(z) {
1436
+ for (var P in i)
1437
+ i[P] && (z[P] = i[P]);
1438
+ return c.push(z), z;
1885
1439
  }, x = function() {
1886
- y.push(i), i = Object.create(i);
1887
- }, E = function() {
1888
- if (!y.length)
1440
+ p.push(i), i = Object.create(i);
1441
+ }, k = function() {
1442
+ if (!p.length)
1889
1443
  throw new Error("Unexpected }");
1890
- i = y.pop();
1891
- }, k = { tokens: c, open_context: x, close_context: E, add_token: w }; e.length; ) {
1892
- if (o = cn.exec(e))
1893
- Nt(o[0], !1).forEach(w);
1894
- else if (o = un.exec(e))
1895
- w(new H(o[1]));
1896
- else if (!(o = hn.exec(e))) {
1897
- if (o = /^\{/.exec(e))
1444
+ i = p.pop();
1445
+ }, S = { tokens: c, open_context: x, close_context: k, add_token: w }; e.length; ) {
1446
+ if (s = mn.exec(e))
1447
+ Bt(s[0], !1).forEach(w);
1448
+ else if (s = vn.exec(e))
1449
+ w(new F(s[1]));
1450
+ else if (!(s = yn.exec(e))) {
1451
+ if (s = /^\{/.exec(e))
1898
1452
  x();
1899
- else if (o = /^\}/.exec(e))
1900
- E();
1901
- else if (!(o = /^\$/.exec(e)))
1902
- if (o = /^\\verb,([^,]+),/.exec(e))
1903
- w(new H(o[1]));
1904
- else if (o = ln.exec(e)) {
1905
- var O = o[1].slice(1) || o[1], L = !!o[2];
1906
- if (/^(La)?TeX$/i.test(O)) {
1453
+ else if (s = /^\}/.exec(e))
1454
+ k();
1455
+ else if (!(s = /^\$/.exec(e)))
1456
+ if (s = /^\\verb,([^,]+),/.exec(e))
1457
+ w(new F(s[1]));
1458
+ else if (s = gn.exec(e)) {
1459
+ var M = s[1].slice(1) || s[1], O = !!s[2];
1460
+ if (/^(La)?TeX$/i.test(M)) {
1907
1461
  x(), i.family = "serif";
1908
- var M = void 0;
1909
- O === "LaTeX" && ((M = w(new H("L"))).tracking = -0.25, (M = w(new H("A"))).size = 0.7, M.baseline = 0.3, M.tracking = -0.1), (M = w(new H("T"))).tracking = -0.17, (M = w(new H("E"))).baseline = -0.22, M.tracking = -0.13, M = w(new H("X")), E();
1910
- } else if (O in xe)
1911
- w(new H(xe[O])), L && x();
1912
- else if (O in U) {
1913
- var z = [], j = U[O].length - 1, Q = void 0;
1914
- if (j) {
1915
- for (L = !1, e = e.slice(o[0].length - 1); j--; ) {
1916
- if (!(Q = /^\{([^}]+)\}/.exec(e)))
1917
- throw new Error(O + " is missing an argument");
1918
- z.push(Q[1]), e = e.slice(Q[0].length);
1462
+ var I = void 0;
1463
+ 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();
1464
+ } else if (M in Ae)
1465
+ w(new F(Ae[M])), O && x();
1466
+ else if (M in U) {
1467
+ var L = [], B = U[M].length - 1, J = void 0;
1468
+ if (B) {
1469
+ for (O = !1, e = e.slice(s[0].length - 1); B--; ) {
1470
+ if (!(J = /^\{([^}]+)\}/.exec(e)))
1471
+ throw new Error(M + " is missing an argument");
1472
+ L.push(J[1]), e = e.slice(J[0].length);
1919
1473
  }
1920
- o[0] = /^\{/.exec(e) ? "{" : "", L = !!o[0];
1474
+ s[0] = /^\{/.exec(e) ? "{" : "", O = !!s[0];
1921
1475
  }
1922
- L && x(), U[O].apply(k, [i].concat(z));
1476
+ O && x(), U[M].apply(S, [i].concat(L));
1923
1477
  } else
1924
- console.warn("unknown latex command", O), w(new H(o[1])), L && x();
1478
+ console.warn("unknown latex command", M), w(new F(s[1])), O && x();
1925
1479
  } else
1926
- o = [e.slice(0, 1)], w(new H(o[0]));
1480
+ s = [e.slice(0, 1)], w(new F(s[0]));
1927
1481
  }
1928
- e = e.slice(o[0].length);
1482
+ e = e.slice(s[0].length);
1929
1483
  }
1930
1484
  return c;
1931
- }, rt.measureText = function(e, n, o) {
1932
- return X(e, b(n), o);
1933
- }, rt.Token = H, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = Ee, Ee.createElement = Te;
1934
- const Tn = rt;
1485
+ }, it.measureText = function(e, n, s) {
1486
+ return W(e, b(n), s);
1487
+ }, it.Token = F, it.Break = Dt, it.LineBreak = et, it.SoftHyphen = pt, it.Rotator = _e, _e.createElement = De;
1488
+ const Cn = it;
1935
1489
  return r.default;
1936
1490
  })());
1937
- })(Xe);
1938
- var Vn = Xe.exports;
1939
- const ze = /* @__PURE__ */ fe(Vn);
1940
- function se(u) {
1941
- return u.replace(/…$/, "");
1491
+ })(tn);
1492
+ var Kn = tn.exports;
1493
+ const Ne = /* @__PURE__ */ Ze(Kn);
1494
+ function he(a) {
1495
+ return a.replace(/…$/, "");
1942
1496
  }
1943
- function oe(u) {
1944
- return u.children[0].innerHTML;
1497
+ function ce(a) {
1498
+ return a.children[0].innerHTML;
1945
1499
  }
1946
- function Un(u, l) {
1947
- const t = ut(u), { fontSize: r, font: a, padding: h = 0 } = u.properties.style || {};
1500
+ function Jn(a, l) {
1501
+ const t = ut(a), { fontSize: r, font: o, padding: h = 0 } = a.properties.style || {};
1948
1502
  if (t.width === t.height && t.width === 0)
1949
1503
  return;
1950
- const f = new ze({
1951
- font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
1504
+ const u = new Ne({
1505
+ font: `${r}px/${r}px ${o}`.replace(/(px)+/g, "px"),
1952
1506
  width: t.width - h * 2,
1953
1507
  height: t.height - h * 2,
1954
1508
  align: "left",
@@ -1956,50 +1510,50 @@ function Un(u, l) {
1956
1510
  x: 0,
1957
1511
  overflow: "ellipsis",
1958
1512
  parser: "html",
1959
- createElement: ze.createElement
1513
+ createElement: Ne.createElement
1960
1514
  });
1961
- f.overflowWrap("break-word");
1962
- const p = f.linebreak(
1963
- u.properties.content.replaceAll(`
1515
+ u.overflowWrap("break-word");
1516
+ const g = u.linebreak(
1517
+ a.properties.content.replaceAll(`
1964
1518
  `, "<br>")
1965
- ).render(), s = [...p.children];
1966
- let d = 0;
1967
- const m = [];
1968
- u.properties.content.split(`
1519
+ ).render(), f = [...g.children];
1520
+ let y = 0;
1521
+ const v = [];
1522
+ a.properties.content.split(`
1969
1523
  `).forEach((b) => {
1970
- let I = b;
1971
- for (; I.length && d < s.length; ) {
1972
- if (s[d].innerHTML === "&nbsp;") {
1973
- I.startsWith(`
1974
- `) || m.push(d), d++;
1524
+ let C = b;
1525
+ for (; C.length && y < f.length; ) {
1526
+ if (f[y].innerHTML === "&nbsp;") {
1527
+ C.startsWith(`
1528
+ `) || v.push(y), y++;
1975
1529
  break;
1976
1530
  }
1977
- const S = se(oe(s[d]));
1978
- I.startsWith(S) && (I = I.slice(S.length).trim()), d++;
1531
+ const E = he(ce(f[y]));
1532
+ C.startsWith(E) && (C = C.slice(E.length).trim()), y++;
1979
1533
  }
1980
- }), m.forEach((b) => p.removeChild(s[b]));
1981
- const A = u.properties.content.match(/(https?:\/\/.*)/gm), T = A ? A.map((b) => b.split(" ")[0]) : [];
1982
- p.setAttribute("transform", `translate(${h}, ${h})`), T.forEach((b) => {
1983
- let I = b;
1984
- const S = [];
1985
- for (; I.length > 0; ) {
1986
- const P = s.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && I.startsWith(se(oe(_))));
1987
- if (!P)
1988
- break;
1989
- S.push(P);
1990
- const $ = se(P.children[0].innerHTML).length;
1534
+ }), v.forEach((b) => g.removeChild(f[b]));
1535
+ const T = a.properties.content.match(/(https?:\/\/.*)/gm), A = T ? T.map((b) => b.split(" ")[0]) : [];
1536
+ g.setAttribute("transform", `translate(${h}, ${h})`), A.forEach((b) => {
1537
+ let C = b;
1538
+ const E = [];
1539
+ for (; C.length > 0; ) {
1540
+ const $ = f.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && C.startsWith(he(ce(_))));
1991
1541
  if (!$)
1992
1542
  break;
1993
- I = I.slice($);
1543
+ E.push($);
1544
+ const N = he($.children[0].innerHTML).length;
1545
+ if (!N)
1546
+ break;
1547
+ C = C.slice(N);
1994
1548
  }
1995
- S.forEach((P) => {
1996
- const $ = document.createElementNS("http://www.w3.org/2000/svg", "a");
1997
- $.setAttribute("href", b), $.setAttribute("target", "_blank"), $.innerHTML = oe(P), P.children[0].innerHTML = "", P.children[0].appendChild($);
1549
+ E.forEach(($) => {
1550
+ const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
1551
+ N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = ce($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
1998
1552
  });
1999
- }), l.appendChild(p);
1553
+ }), l.appendChild(g);
2000
1554
  }
2001
- const Ce = 20;
2002
- class Yn extends Ye {
1555
+ const He = 20;
1556
+ class Qn extends Qe {
2003
1557
  constructor(t, r = {}) {
2004
1558
  super(
2005
1559
  t,
@@ -2017,81 +1571,81 @@ class Yn extends Ye {
2017
1571
  </div>
2018
1572
  `
2019
1573
  );
2020
- v(this, "textArea");
2021
- v(this, "handleSize");
2022
- v(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
2023
- v(this, "annotation", { ...re });
2024
- v(this, "startX", 0);
2025
- v(this, "startY", 0);
2026
- v(this, "handles", []);
2027
- v(this, "draggedHandle", V);
2028
- v(this, "isFocused", !1);
2029
- v(this, "placeholder", "Type your text here...");
2030
- v(this, "_onFocus", () => {
1574
+ m(this, "textArea");
1575
+ m(this, "handleSize");
1576
+ m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
1577
+ m(this, "annotation", { ...le });
1578
+ m(this, "startX", 0);
1579
+ m(this, "startY", 0);
1580
+ m(this, "handles", []);
1581
+ m(this, "draggedHandle", V);
1582
+ m(this, "isFocused", !1);
1583
+ m(this, "placeholder", "Type your text here...");
1584
+ m(this, "_onFocus", () => {
2031
1585
  this.textArea.value === this.placeholder && (this.textArea.value = ""), this.isFocused = !0;
2032
1586
  });
2033
- v(this, "_onBlur", () => {
1587
+ m(this, "_onBlur", () => {
2034
1588
  this.isFocused = !1;
2035
1589
  });
2036
- v(this, "startDrawing", (t, r, a = Bn(t, r, 0, 0, "", At)) => {
2037
- this.add(a);
1590
+ m(this, "startDrawing", (t, r, o = Zn(t, r, 0, 0, "", St)) => {
1591
+ this.add(o);
2038
1592
  const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
2039
- this.select(a.id), this.startDragging(this.getById(a.id), h.x, h.y), this.draggedHandle = 6;
1593
+ this.select(o.id), this.startDragging(this.getById(o.id), h.x, h.y), this.draggedHandle = 6;
2040
1594
  });
2041
- v(this, "cancelDrawing", () => {
2042
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = V, this.isDragging = !1, this.emit(St, this.annotation));
1595
+ m(this, "cancelDrawing", () => {
1596
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...le }, this.draggedHandle = V, this.isDragging = !1, this.emit(Tt, this.annotation));
2043
1597
  });
2044
- v(this, "startDragging", (t, r, a) => {
1598
+ m(this, "startDragging", (t, r, o) => {
2045
1599
  this.annotation = t;
2046
- const h = ct(this.annotation), f = ut(this.annotation);
2047
- this.rect.x = h.x, this.rect.y = h.y, this.rect.width = f.width, this.rect.height = f.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Yt, this.annotation), this.isDragging = !0;
1600
+ const h = ct(this.annotation), u = ut(this.annotation);
1601
+ 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 = o, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Zt, this.annotation), this.isDragging = !0;
2048
1602
  });
2049
- v(this, "onHandleMouseDown", (t) => {
1603
+ m(this, "onHandleMouseDown", (t) => {
2050
1604
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
2051
1605
  if (!r)
2052
1606
  return;
2053
1607
  this.selectedId !== r.id && this.select(this.hoveredId);
2054
- const { x: a, y: h } = ae(t, this.ogma.getContainer());
2055
- this.startDragging(r, a, h), this.draggedHandle = qe(t.target);
1608
+ const { x: o, y: h } = ue(t, this.ogma.getContainer());
1609
+ this.startDragging(r, o, h), this.draggedHandle = Ue(t.target);
2056
1610
  });
2057
- v(this, "onMouseMove", (t) => {
1611
+ m(this, "onMouseMove", (t) => {
2058
1612
  requestAnimationFrame(() => this._onMouseMove(t));
2059
1613
  });
2060
- v(this, "_onMouseMove", (t) => {
1614
+ m(this, "_onMouseMove", (t) => {
2061
1615
  if (!this.isDragging)
2062
1616
  return;
2063
1617
  t.stopPropagation(), t.preventDefault();
2064
- const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = r.classList.contains("left"), f = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), { x: s, y: d } = ae(
1618
+ const r = this.handles[this.draggedHandle], o = r.classList.contains("top"), h = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom"), g = r.classList.contains("line-handle"), { x: f, y } = ue(
2065
1619
  t,
2066
1620
  this.ogma.getContainer()
2067
- ), m = this.ogma.view.getZoom(), A = (s - this.startX) / m, T = (d - this.startY) / m, b = this.ogma.view.getAngle(), I = new Y(A, T).rotateRadians(b);
2068
- (g && h || a && f) && (I.y = 0, I.x = 0);
2069
- const S = h || p ? this.rect.x + I.x : this.rect.x, P = a || p ? this.rect.y + I.y : this.rect.y, $ = Math.max(
2070
- this.rect.width + A * (p || h ? 0 : 1),
2071
- Ce
1621
+ ), 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);
1622
+ (d && h || o && u) && (C.y = 0, C.x = 0);
1623
+ const E = h || g ? this.rect.x + C.x : this.rect.x, $ = o || g ? this.rect.y + C.y : this.rect.y, N = Math.max(
1624
+ this.rect.width + T * (g || h ? 0 : 1),
1625
+ He
2072
1626
  ), _ = Math.max(
2073
- this.rect.height + T * (p || a ? 0 : 1),
2074
- Ce
1627
+ this.rect.height + A * (g || o ? 0 : 1),
1628
+ He
2075
1629
  );
2076
- Pn(this.annotation, S, P, $, _), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1630
+ Bn(this.annotation, E, $, N, _), this.emit(Xt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2077
1631
  });
2078
- v(this, "onMouseUp", () => {
2079
- !this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = V);
1632
+ m(this, "onMouseUp", () => {
1633
+ !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);
2080
1634
  });
2081
- v(this, "_onMousedown", (t) => {
1635
+ m(this, "_onMousedown", (t) => {
2082
1636
  t.stopPropagation();
2083
1637
  });
2084
- v(this, "onViewChanged", () => {
1638
+ m(this, "onViewChanged", () => {
2085
1639
  const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
2086
1640
  document.documentElement.style.setProperty("--handle-scale", `${1 / t}`);
2087
1641
  });
2088
- v(this, "_onInput", () => {
1642
+ m(this, "_onInput", () => {
2089
1643
  const t = this.getById(this.selectedId);
2090
- t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(de, t), this.layer.refresh());
1644
+ 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());
2091
1645
  });
2092
- this.showeditorOnHover = !1, this.handleSize = Le.handleSize || r.textHandleSize, this.placeholder = Le.placeholder || r.textPlaceholder || "";
2093
- const a = this.textArea = this.editor.element.querySelector("textarea");
2094
- a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.addEventListener("mousedown", this._onMousedown), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
1646
+ this.showeditorOnHover = !1, this.handleSize = ze.handleSize || r.textHandleSize, this.placeholder = ze.placeholder || r.textPlaceholder || "";
1647
+ const o = this.textArea = this.editor.element.querySelector("textarea");
1648
+ 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(
2095
1649
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
2096
1650
  ), this.handles.forEach(
2097
1651
  (h) => h.addEventListener("mousedown", this.onHandleMouseDown)
@@ -2100,69 +1654,65 @@ class Yn extends Ye {
2100
1654
  _canRemove() {
2101
1655
  return !this.isFocused;
2102
1656
  }
2103
- detect({ x: t, y: r }, a = 0) {
2104
- const h = new Y(t, r), f = this.ogma.view.getAngle();
2105
- return this.elements.find((g) => {
2106
- const { x: p, y: s } = ct(g), { width: d, height: m } = ut(g), A = new Y(p, s), { x: T, y: b } = h.sub(A).rotateRadians(-f);
2107
- return T > -a && T < d + a && b > -a && b < m + a;
1657
+ detect({ x: t, y: r }, o = 0) {
1658
+ const h = { x: t, y: r }, u = this.ogma.view.getAngle();
1659
+ return this.elements.find((d) => {
1660
+ const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), T = { x: g, y: f }, { x: A, y: b } = rt(vt(h, T), -u);
1661
+ return A > -o && A < y + o && b > -o && b < v + o;
2108
1662
  });
2109
1663
  }
2110
1664
  draw(t) {
2111
1665
  t.innerHTML = "";
2112
- const r = "", a = this.ogma.view.getAngle();
2113
- this.elements.forEach((f, g) => {
2114
- const p = `class${g}`, s = ut(f), d = ct(f), m = f.id, {
2115
- color: A,
2116
- fontSize: T,
1666
+ const r = "", o = this.ogma.view.getAngle();
1667
+ this.elements.forEach((u, d) => {
1668
+ const g = `class${d}`, f = ut(u), y = ct(u), v = u.id, {
1669
+ color: T,
1670
+ fontSize: A,
2117
1671
  font: b,
2118
- strokeColor: I,
2119
- strokeWidth: S,
2120
- strokeType: P,
2121
- background: $
2122
- } = f.properties.style || At;
2123
- if (m === this.selectedId)
1672
+ strokeColor: C,
1673
+ strokeWidth: E,
1674
+ strokeType: $,
1675
+ background: N
1676
+ } = u.properties.style || St;
1677
+ if (v === this.selectedId)
2124
1678
  return;
2125
- const _ = Ot("g");
2126
- _.classList.add("annotation-text"), _.setAttribute("fill", `${A}`), _.setAttribute("font-size", `${T}px`), _.setAttribute("font-family", `${b}`);
2127
- const X = Ot("rect");
2128
- let W = !1;
2129
- P && P !== "none" && (W = !0, X.setAttribute("stroke", I || "black"), X.setAttribute("stroke-width", `${S}`), P === "dashed" && X.setAttribute("stroke-dasharray", "5,5")), ($ && $.length || W) && (W = !0, X.setAttribute("fill", $ || "transparent")), W && (X.setAttribute("width", `${s.width}`), X.setAttribute("height", `${s.height}`)), _.appendChild(X), Un(f, _);
2130
- const { x: Et, y: kt } = new Y(d.x, d.y).rotateRadians(
2131
- -a
2132
- );
2133
- _.setAttribute("transform", `translate(${Et},${kt})`), _.classList.add(p), _.setAttribute("data-annotation", `${f.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
1679
+ const _ = Pt("g");
1680
+ _.classList.add("annotation-text"), _.setAttribute("fill", `${T}`), _.setAttribute("font-size", `${A}px`), _.setAttribute("font-family", `${b}`);
1681
+ const W = Pt("rect");
1682
+ let G = !1;
1683
+ $ && $ !== "none" && (G = !0, W.setAttribute("stroke", C || "black"), W.setAttribute("stroke-width", `${E}`), $ === "dashed" && W.setAttribute("stroke-dasharray", "5,5")), (N && N.length || G) && (G = !0, W.setAttribute("fill", N || "transparent")), G && (W.setAttribute("width", `${f.width}`), W.setAttribute("height", `${f.height}`)), _.appendChild(W), Jn(u, _);
1684
+ const { x: _t, y: It } = rt(y, -o);
1685
+ _.setAttribute("transform", `translate(${_t},${It})`), _.classList.add(g), _.setAttribute("data-annotation", `${u.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
2134
1686
  });
2135
- const h = Ot("style");
1687
+ const h = Pt("style");
2136
1688
  h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
2137
1689
  }
2138
1690
  refreshDrawing() {
2139
1691
  const t = this.ogma.view.getAngle();
2140
1692
  [...this.layer.element.children].forEach((r) => {
2141
- const a = r.getAttribute("data-annotation");
2142
- if (!a)
1693
+ const o = r.getAttribute("data-annotation");
1694
+ if (!o)
2143
1695
  return;
2144
- const h = ct(this.getById(a)), { x: f, y: g } = new Y(h.x, h.y).rotateRadians(
2145
- -t
2146
- );
2147
- r.setAttribute("transform", `translate(${f},${g})`);
1696
+ const h = ct(this.getById(o)), { x: u, y: d } = rt(h, -t);
1697
+ r.setAttribute("transform", `translate(${u},${d})`);
2148
1698
  });
2149
1699
  }
2150
1700
  getDefaultOptions() {
2151
- return re;
1701
+ return le;
2152
1702
  }
2153
1703
  refreshEditor() {
2154
1704
  if (+this.selectedId < 0 && +this.hoveredId < 0)
2155
1705
  return;
2156
- const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), a = this.ogma.view.graphToScreenCoordinates(
1706
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), o = this.ogma.view.graphToScreenCoordinates(
2157
1707
  ct(t)
2158
1708
  ), h = this.ogma.view.getZoom(), {
2159
- font: f,
2160
- fontSize: g,
2161
- color: p,
2162
- background: s,
2163
- padding: d = 0
2164
- } = t.properties.style || At, m = (g || 1) * h;
2165
- this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${m} ${f}`, this.textArea.style.fontFamily = f || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${h * d}px`, this.textArea.style.lineHeight = `${m}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = p || "black", this.textArea.style.background = s || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
1709
+ font: u,
1710
+ fontSize: d,
1711
+ color: g,
1712
+ background: f,
1713
+ padding: y = 0
1714
+ } = t.properties.style || St, v = (d || 1) * h;
1715
+ 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 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${v} ${u}`, this.textArea.style.fontFamily = u || "sans-serif", this.textArea.style.fontSize = `${v}px`, this.textArea.style.padding = `${h * 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();
2166
1716
  }
2167
1717
  select(t) {
2168
1718
  super.select(t), this.textArea.focus();
@@ -2171,25 +1721,25 @@ class Yn extends Ye {
2171
1721
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
2172
1722
  }
2173
1723
  }
2174
- class Xn {
1724
+ class ti {
2175
1725
  constructor() {
2176
- v(this, "links", {});
2177
- v(this, "linksByTargetId", {});
2178
- v(this, "linksByArrowId", {});
2179
- }
2180
- add(l, t, r, a, h) {
2181
- const f = Xt(), g = l.id, p = {
2182
- id: f,
2183
- arrow: g,
1726
+ m(this, "links", {});
1727
+ m(this, "linksByTargetId", {});
1728
+ m(this, "linksByArrowId", {});
1729
+ }
1730
+ add(l, t, r, o, h) {
1731
+ const u = Kt(), d = l.id, g = {
1732
+ id: u,
1733
+ arrow: d,
2184
1734
  target: r,
2185
- targetType: a,
1735
+ targetType: o,
2186
1736
  connectionPoint: h,
2187
1737
  side: t
2188
1738
  };
2189
- return this.links[f] = p, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(f), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][t] = f, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
1739
+ 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] = {
2190
1740
  id: r,
2191
1741
  side: t,
2192
- type: a,
1742
+ type: o,
2193
1743
  magnet: h
2194
1744
  }, this;
2195
1745
  }
@@ -2199,34 +1749,34 @@ class Xn {
2199
1749
  }
2200
1750
  // remove the link between the arrow and the target by arrow id and side
2201
1751
  remove(l, t) {
2202
- var g, p;
2203
- const r = l.id, a = (g = this.linksByArrowId[r]) == null ? void 0 : g[t];
2204
- if ((p = l.properties.link) == null || delete p[t], !a)
1752
+ var d, g;
1753
+ const r = l.id, o = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
1754
+ if ((g = l.properties.link) == null || delete g[t], !o)
2205
1755
  return this;
2206
- const h = this.links[a];
2207
- delete this.links[a];
2208
- const f = this.linksByTargetId[h.target];
2209
- for (let s = 0; s < f.length; s++)
2210
- if (f[s] === a) {
2211
- f.splice(s, 1);
1756
+ const h = this.links[o];
1757
+ delete this.links[o];
1758
+ const u = this.linksByTargetId[h.target];
1759
+ for (let f = 0; f < u.length; f++)
1760
+ if (u[f] === o) {
1761
+ u.splice(f, 1);
2212
1762
  break;
2213
1763
  }
2214
1764
  return delete this.linksByArrowId[r][t], this;
2215
1765
  }
2216
1766
  getArrowLink(l, t) {
2217
- var a;
2218
- const r = (a = this.linksByArrowId[l]) == null ? void 0 : a[t];
1767
+ var o;
1768
+ const r = (o = this.linksByArrowId[l]) == null ? void 0 : o[t];
2219
1769
  return r ? this.links[r] : null;
2220
1770
  }
2221
1771
  getTargetLinks(l, t) {
2222
1772
  var r;
2223
- return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((a) => this.links[a]).filter((a) => a.targetType === t)) ?? [];
1773
+ return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((o) => this.links[o]).filter((o) => o.targetType === t)) ?? [];
2224
1774
  }
2225
1775
  forEach(l) {
2226
1776
  Object.values(this.links).forEach(l);
2227
1777
  }
2228
1778
  }
2229
- const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type === "text", Pe = (u) => u.type === "FeatureCollection", Wn = {
1779
+ const ot = (a) => a.properties.type === "arrow", mt = (a) => a.properties.type === "text", Fe = (a) => a.type === "FeatureCollection", ei = {
2230
1780
  magnetColor: "#3e8",
2231
1781
  detectMargin: 20,
2232
1782
  magnetHandleRadius: 5,
@@ -2236,7 +1786,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2236
1786
  textHandleSize: 3.5,
2237
1787
  minArrowHeight: 20,
2238
1788
  maxArrowHeight: 30
2239
- }, $e = ["start", "end"], Ne = [
1789
+ }, Be = ["start", "end"], je = [
2240
1790
  { x: 0, y: 0 },
2241
1791
  { x: 0.5, y: 0 },
2242
1792
  { x: 1, y: 0 },
@@ -2246,159 +1796,160 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2246
1796
  { x: 0.5, y: 1 },
2247
1797
  { x: 1, y: 1 }
2248
1798
  ];
2249
- class Kn extends Ue {
1799
+ class ri extends Je {
2250
1800
  constructor(t, r = {}) {
2251
1801
  super();
2252
- v(this, "arrows");
2253
- v(this, "texts");
2254
- v(this, "links", new Xn());
2255
- v(this, "layer");
2256
- v(this, "annotations");
2257
- v(this, "ogma");
2258
- v(this, "options");
2259
- v(this, "selected", null);
2260
- v(this, "updateTimeout", 0);
2261
- v(this, "hoveredNode", null);
2262
- v(this, "dragged", null);
2263
- v(this, "textToMagnet");
2264
- v(this, "activeLinks", []);
2265
- v(this, "_render", (t) => {
1802
+ m(this, "arrows");
1803
+ m(this, "texts");
1804
+ m(this, "links", new ti());
1805
+ m(this, "layer");
1806
+ m(this, "annotations");
1807
+ m(this, "ogma");
1808
+ m(this, "options");
1809
+ m(this, "selected", null);
1810
+ m(this, "updateTimeout", 0);
1811
+ m(this, "hoveredNode", null);
1812
+ m(this, "dragged", null);
1813
+ m(this, "textToMagnet");
1814
+ m(this, "activeLinks", []);
1815
+ m(this, "_render", (t) => {
2266
1816
  if (!this.dragged || this.textToMagnet === void 0)
2267
1817
  return;
2268
1818
  t.beginPath(), t.fillStyle = "green";
2269
1819
  const r = this.ogma.view.getZoom();
2270
- Ne.forEach((a) => {
1820
+ je.forEach((o) => {
2271
1821
  if (!this.textToMagnet)
2272
1822
  return;
2273
- const h = ut(this.textToMagnet), f = ct(this.textToMagnet), { x: g, y: p } = new Y(a.x, a.y).mul({ x: h.width, y: h.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
2274
- t.moveTo(g, p), t.arc(g, p, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
1823
+ const h = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Ut(o, { x: h.width, y: h.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = Et(g, u);
1824
+ t.moveTo(f, y), t.arc(f, y, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
2275
1825
  }), t.fill(), t.closePath();
2276
1826
  });
2277
- v(this, "_onFeatureDrag", (t, r) => {
2278
- const a = r;
2279
- if (ot(t) && a === "line")
1827
+ m(this, "_onFeatureDrag", (t, r) => {
1828
+ const o = r;
1829
+ if (ot(t) && o === "line")
2280
1830
  ["start", "end"].find((h) => {
2281
- const f = h === "start" ? Lt(t) : Bt(t);
2282
- return this._snapToText(t, a, f) || this._findAndSnapToNode(t, h, f);
1831
+ const u = h === "start" ? $t(t) : Gt(t);
1832
+ return this._snapToText(t, o, u) || this._findAndSnapToNode(t, h, u);
2283
1833
  });
2284
- else if (ot(t) && a !== "line") {
2285
- const h = a === "start" ? Lt(t) : Bt(t);
2286
- this._snapToText(t, a, h) || this._findAndSnapToNode(t, a, h);
1834
+ else if (ot(t) && o !== "line") {
1835
+ const h = o === "start" ? $t(t) : Gt(t);
1836
+ this._snapToText(t, o, h) || this._findAndSnapToNode(t, o, h);
2287
1837
  } else
2288
- mt(t) && (this.activeLinks.forEach(({ arrow: h, side: f, connectionPoint: g }) => {
2289
- const p = this.getAnnotation(h), s = ut(t), d = ct(t), m = new Y(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
2290
- p.geometry.coordinates[f === "start" ? 0 : 1] = [m.x, m.y];
1838
+ mt(t) && (this.activeLinks.forEach(({ arrow: h, side: u, connectionPoint: d }) => {
1839
+ const g = this.getAnnotation(h), 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);
1840
+ g.geometry.coordinates[u === "start" ? 0 : 1] = [A.x, A.y];
2291
1841
  }), this.activeLinks.length && this.arrows.refreshLayer());
2292
- this.layer.refresh(), this.emit(Ut, t, r);
1842
+ this.layer.refresh(), this.emit(Xt, t, r);
2293
1843
  });
2294
- v(this, "_onFeatureDragEnd", (t) => {
2295
- this.dragged !== null && ot(t) && Lt(this.dragged) && $e.forEach((r) => {
2296
- this.links.getArrowLink(t.id, r) && this.emit(jn, {
1844
+ m(this, "_onFeatureDragEnd", (t) => {
1845
+ this.dragged !== null && ot(t) && $t(this.dragged) && Be.forEach((r) => {
1846
+ this.links.getArrowLink(t.id, r) && this.emit(Wn, {
2297
1847
  arrow: t,
2298
1848
  link: this.links.getArrowLink(t.id, r)
2299
1849
  });
2300
- }), (mt(t) || ot(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh(), this.emit(St, t);
1850
+ }), (mt(t) || ot(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);
2301
1851
  });
2302
- v(this, "_onFeatureDragStart", (t) => {
1852
+ m(this, "_onFeatureDragStart", (t) => {
2303
1853
  this.textToMagnet = void 0, ot(t) ? this.dragged = t : mt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
2304
- const a = r.getSelectedFeature();
2305
- a && a !== t && r.unhover().unselect(), r.disableDetection();
2306
- }), this.emit(Yt, t);
1854
+ const o = r.getSelectedFeature();
1855
+ o && o !== t && r.unhover().unselect(), r.disableDetection();
1856
+ }), this.emit(Zt, t);
2307
1857
  });
2308
- v(this, "_onNodesDragStart", () => {
1858
+ m(this, "_onNodesDragStart", () => {
2309
1859
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
2310
1860
  });
2311
- v(this, "_onNodesDrag", (t) => {
2312
- const { dx: r, dy: a } = t;
2313
- this._moveNodes(t.nodes, r, a);
1861
+ m(this, "_onNodesDrag", (t) => {
1862
+ const { dx: r, dy: o } = t;
1863
+ this._moveNodes(t.nodes, r, o);
2314
1864
  });
2315
- v(this, "_onLayoutEnd", (t) => {
2316
- t.ids.forEach((r, a) => {
2317
- this.links.getTargetLinks(r, "node").forEach((f) => {
2318
- const g = this.getAnnotation(f.arrow), p = f.side, s = jt(
2319
- g,
2320
- p === "start" ? "end" : "start"
2321
- ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ft(s, d, +m);
2322
- bt(g, p, A.x, A.y);
1865
+ m(this, "_onLayoutEnd", (t) => {
1866
+ t.ids.forEach((r, o) => {
1867
+ this.links.getTargetLinks(r, "node").forEach((u) => {
1868
+ const d = this.getAnnotation(u.arrow), g = u.side, f = Rt(
1869
+ d,
1870
+ g === "start" ? "end" : "start"
1871
+ ), y = t.positions.current[o], v = this.ogma.getNode(r).getAttribute("radius"), T = Vt(f, y, +v);
1872
+ At(d, g, T.x, T.y);
2323
1873
  });
2324
1874
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
2325
1875
  });
2326
- v(this, "_onAdded", (t) => {
2327
- this.emit(ue, t);
1876
+ m(this, "_onAdded", (t) => {
1877
+ this.emit(ge, t);
2328
1878
  });
2329
- v(this, "_onRemoved", (t) => {
2330
- this.emit(ce, t);
1879
+ m(this, "_onRemoved", (t) => {
1880
+ this.emit(pe, t);
2331
1881
  });
2332
- v(this, "_onUnselect", (t) => {
2333
- this.selected = null, this.emit(he, t);
1882
+ m(this, "_onUnselect", (t) => {
1883
+ this.selected = null, this.emit(fe, t);
2334
1884
  });
2335
- v(this, "_onSelect", (t) => {
2336
- this.selected !== t && (this.selected = t, this.emit(le, this.selected));
1885
+ m(this, "_onSelect", (t) => {
1886
+ this.selected !== t && (this.selected = t, this.emit(de, this.selected));
2337
1887
  });
2338
1888
  /**
2339
1889
  * Triggers the update event on the annotation
2340
1890
  * @param annotation The annotation updated
2341
1891
  */
2342
- v(this, "onUpdate", (t) => {
1892
+ m(this, "onUpdate", (t) => {
2343
1893
  cancelAnimationFrame(this.updateTimeout), this.updateTimeout = requestAnimationFrame(
2344
1894
  () => this._onUpdate(t)
2345
1895
  );
2346
1896
  });
2347
- v(this, "_onUpdate", (t) => {
2348
- this.emit(de, t);
1897
+ m(this, "_onUpdate", (t) => {
1898
+ this.emit(ye, t);
2349
1899
  });
2350
- this.options = this.setOptions({ ...Wn, ...r }), this.ogma = t, this.arrows = new qn(t, this.options), this.texts = new Yn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2351
- a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(de, this.onUpdate).on(he, this._onUnselect).on(le, this._onSelect).on(ue, this._onAdded).on(ce, this._onRemoved);
1900
+ this.options = this.setOptions({ ...ei, ...r }), this.ogma = t, this.arrows = new Xn(t, this.options), this.texts = new Qn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
1901
+ o.on(Zt, this._onFeatureDragStart).on(Xt, 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);
2352
1902
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
2353
1903
  this.refreshTextLinks();
2354
1904
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2355
1905
  }
2356
- _moveNodes(t, r, a) {
1906
+ _moveNodes(t, r, o) {
2357
1907
  t.forEach((h) => {
2358
- const f = this.links.getTargetLinks(h.getId(), "node"), g = h.getPosition();
2359
- f.forEach((p) => {
2360
- const s = this.getAnnotation(p.arrow), d = p.side, m = jt(
2361
- s,
2362
- d === "start" ? "end" : "start"
1908
+ const u = this.links.getTargetLinks(h.getId(), "node"), d = h.getPosition();
1909
+ u.forEach((g) => {
1910
+ const f = this.getAnnotation(g.arrow), y = g.side, v = Rt(
1911
+ f,
1912
+ y === "start" ? "end" : "start"
2363
1913
  );
2364
- let A = g;
2365
- const T = +h.getAttribute("radius"), b = 1e-6;
2366
- (p.connectionPoint.x - (g.x - r) > b || p.connectionPoint.y - (g.y - a) > b) && (A = Ft(m, g, T)), bt(s, d, A.x, A.y);
1914
+ let T = d;
1915
+ const A = +h.getAttribute("radius"), b = 1e-6;
1916
+ (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);
2367
1917
  });
2368
1918
  }), this.arrows.refreshLayer();
2369
1919
  }
2370
- _snapToText(t, r, a) {
2371
- const h = this.texts.detect(a, this.options.detectMargin);
1920
+ _snapToText(t, r, o) {
1921
+ const h = this.texts.detect(o, this.options.detectMargin);
2372
1922
  if (this.links.remove(t, r), !h)
2373
1923
  return !1;
2374
1924
  this.textToMagnet = h;
2375
- const f = this.findMagnetPoint(Ne, h, a);
2376
- return f ? (bt(t, r, f.point.x, f.point.y), this.links.add(t, r, h.id, "text", f.magnet), !0) : !1;
2377
- }
2378
- _findAndSnapToNode(t, r, a) {
2379
- const h = this.ogma.view.graphToScreenCoordinates(a), f = this.ogma.view.getElementAt(h);
2380
- this.links.remove(t, r), f && f.isNode ? (this.hoveredNode = f, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, f, h)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2381
- }
2382
- _snapToNode(t, r, a, h) {
2383
- const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = h.x - f.x, d = h.y - f.y, m = Math.sqrt(s * s + d * d), A = a.getPosition();
2384
- if (m < p + this.options.detectMargin) {
2385
- let T = A;
2386
- if (m > p / 2) {
2387
- const b = jt(t, r === "end" ? "start" : "end");
2388
- T = Ft(b, T, g);
1925
+ const u = this.findMagnetPoint(je, h, o);
1926
+ return u ? (At(t, r, u.point.x, u.point.y), this.links.add(t, r, h.id, "text", u.magnet), !0) : !1;
1927
+ }
1928
+ _findAndSnapToNode(t, r, o) {
1929
+ var d, g;
1930
+ const h = this.ogma.view.graphToScreenCoordinates(o), u = this.ogma.view.getElementAt(h);
1931
+ 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);
1932
+ }
1933
+ _snapToNode(t, r, o, h) {
1934
+ const u = o.getPositionOnScreen(), d = +o.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), T = o.getPosition();
1935
+ if (v < g + this.options.detectMargin) {
1936
+ let A = T;
1937
+ if (v > g / 2) {
1938
+ const b = Rt(t, r === "end" ? "start" : "end");
1939
+ A = Vt(b, A, d);
2389
1940
  }
2390
- bt(t, r, T.x, T.y), this.links.add(t, r, a.getId(), "node", T);
1941
+ At(t, r, A.x, A.y), this.links.add(t, r, o.getId(), "node", A);
2391
1942
  }
2392
1943
  }
2393
1944
  refreshTextLinks() {
2394
1945
  let t = !1;
2395
1946
  this.links.forEach(
2396
- ({ connectionPoint: r, targetType: a, target: h, arrow: f, side: g }) => {
2397
- if (a !== "text")
1947
+ ({ connectionPoint: r, targetType: o, target: h, arrow: u, side: d }) => {
1948
+ if (o !== "text")
2398
1949
  return;
2399
1950
  t = !0;
2400
- const p = this.getAnnotation(h), s = this.getAnnotation(f), d = ut(p), m = ct(p), A = new Y(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2401
- bt(s, g, A.x, A.y);
1951
+ const g = this.getAnnotation(h), 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);
1952
+ At(f, d, b.x, b.y);
2402
1953
  }
2403
1954
  ), t && this.arrows.refreshLayer();
2404
1955
  }
@@ -2408,19 +1959,19 @@ class Kn extends Ue {
2408
1959
  getSelected() {
2409
1960
  return this.selected;
2410
1961
  }
2411
- findMagnetPoint(t, r, a) {
1962
+ findMagnetPoint(t, r, o) {
2412
1963
  let h;
2413
- for (const f of t) {
2414
- const g = ut(r), p = ct(r), s = new Y(f.x, f.y).mul({ x: g.width, y: g.height }).rotateRadians(this.ogma.view.getAngle()).add(p), d = s.sub(a).length(), m = Math.min(
1964
+ for (const u of t) {
1965
+ 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(
2415
1966
  this.options.magnetRadius * this.ogma.view.getZoom(),
2416
1967
  // when really zoomed in: avoid to snap on too far away magnets
2417
- g.width / 2,
2418
- g.height / 2
1968
+ d.width / 2,
1969
+ d.height / 2
2419
1970
  );
2420
- if (d < Math.max(m, this.options.magnetHandleRadius)) {
1971
+ if (T < Math.max(A, this.options.magnetHandleRadius)) {
2421
1972
  h = {
2422
- point: s,
2423
- magnet: f
1973
+ point: v,
1974
+ magnet: u
2424
1975
  };
2425
1976
  break;
2426
1977
  }
@@ -2443,7 +1994,7 @@ class Kn extends Ue {
2443
1994
  * @param id the id of the annotation to select
2444
1995
  */
2445
1996
  select(t) {
2446
- const r = this.getAnnotations().features.find((a) => a.id === t);
1997
+ const r = this.getAnnotations().features.find((o) => o.id === t);
2447
1998
  return r ? (ot(r) ? this.arrows.select(r.id) : mt(r) && this.texts.select(r.id), this) : this;
2448
1999
  }
2449
2000
  /**
@@ -2457,12 +2008,12 @@ class Kn extends Ue {
2457
2008
  * @param annotation The annotation to add
2458
2009
  */
2459
2010
  add(t) {
2460
- if (Pe(t)) {
2461
- const [r, a] = t.features.reduce(
2462
- (h, f) => (ot(f) ? h[1].push(f) : mt(f) && h[0].push(f), h),
2011
+ if (Fe(t)) {
2012
+ const [r, o] = t.features.reduce(
2013
+ (h, u) => (ot(u) ? h[1].push(u) : mt(u) && h[0].push(u), h),
2463
2014
  [[], []]
2464
2015
  );
2465
- return r.forEach((h) => this.add(h)), a.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
2016
+ return r.forEach((h) => this.add(h)), o.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
2466
2017
  }
2467
2018
  switch (t.properties.type) {
2468
2019
  case "text":
@@ -2479,29 +2030,29 @@ class Kn extends Ue {
2479
2030
  * @param annotation The annotation(s) to remove
2480
2031
  */
2481
2032
  remove(t) {
2482
- return Pe(t) ? (t.features.forEach(
2033
+ return Fe(t) ? (t.features.forEach(
2483
2034
  (r) => this.remove(r)
2484
2035
  ), this) : (ot(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
2485
2036
  }
2486
2037
  loadLink(t) {
2487
2038
  if (t.properties.link)
2488
- for (const r of $e) {
2489
- const a = t.properties.link[r];
2490
- if (!a)
2039
+ for (const r of Be) {
2040
+ const o = t.properties.link[r];
2041
+ if (!o)
2491
2042
  continue;
2492
- const h = this.getAnnotation(a.id);
2493
- if (a.type === "text" && h)
2494
- this.links.add(t, r, a.id, a.type, a.magnet);
2495
- else if (a.type === "node") {
2496
- const f = this.ogma.getNode(a.id);
2497
- if (!f)
2043
+ const h = this.getAnnotation(o.id);
2044
+ if (o.type === "text" && h)
2045
+ this.links.add(t, r, o.id, o.type, o.magnet);
2046
+ else if (o.type === "node") {
2047
+ const u = this.ogma.getNode(o.id);
2048
+ if (!u)
2498
2049
  continue;
2499
- this.links.add(t, r, a.id, a.type, a.magnet);
2500
- const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = jt(
2050
+ this.links.add(t, r, o.id, o.type, o.magnet);
2051
+ const d = u.getPosition(), g = u.getAttribute("radius") || 0, f = Rt(
2501
2052
  t,
2502
2053
  r === "start" ? "end" : "start"
2503
- ), d = Ft(s, g, +p);
2504
- bt(t, r, d.x, d.y);
2054
+ ), y = Vt(f, d, +g);
2055
+ At(t, r, y.x, y.y);
2505
2056
  }
2506
2057
  }
2507
2058
  }
@@ -2511,8 +2062,8 @@ class Kn extends Ue {
2511
2062
  * @param y coord of the first point
2512
2063
  * @param arrow The arrow to add
2513
2064
  */
2514
- startArrow(t, r, a) {
2515
- this.cancelDrawing(), this.arrows.startDrawing(t, r, a);
2065
+ startArrow(t, r, o) {
2066
+ this.cancelDrawing(), this.arrows.startDrawing(t, r, o);
2516
2067
  }
2517
2068
  /**
2518
2069
  * Start adding a text (add it, and give control to the user)
@@ -2520,14 +2071,14 @@ class Kn extends Ue {
2520
2071
  * @param y coord of the top left point
2521
2072
  * @param text The text to add
2522
2073
  */
2523
- startText(t, r, a) {
2524
- this.cancelDrawing(), this.texts.startDrawing(t, r, a);
2074
+ startText(t, r, o) {
2075
+ this.cancelDrawing(), this.texts.startDrawing(t, r, o);
2525
2076
  }
2526
2077
  /**
2527
2078
  * Cancel drawing on the current frame
2528
2079
  */
2529
2080
  cancelDrawing() {
2530
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Hn);
2081
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Un);
2531
2082
  }
2532
2083
  /**
2533
2084
  * Update the style of the annotation with the given id
@@ -2535,8 +2086,8 @@ class Kn extends Ue {
2535
2086
  * @param style The new style
2536
2087
  */
2537
2088
  updateStyle(t, r) {
2538
- const a = this.getAnnotations().features.find((h) => h.id === t);
2539
- return a ? (ot(a) ? this.arrows.updateStyle(a, r) : mt(a) && this.texts.updateStyle(a, r), this.onUpdate(a), this) : this;
2089
+ const o = this.getAnnotations().features.find((h) => h.id === t);
2090
+ return o ? (ot(o) ? this.arrows.updateStyle(o, r) : mt(o) && this.texts.updateStyle(o, r), this.onUpdate(o), this) : this;
2540
2091
  }
2541
2092
  /**
2542
2093
  *
@@ -2567,47 +2118,47 @@ class Kn extends Ue {
2567
2118
  }
2568
2119
  }
2569
2120
  export {
2570
- qn as Arrows,
2571
- Kn as Control,
2572
- ue as EVT_ADD,
2573
- Hn as EVT_CANCEL_DRAWING,
2574
- Ut as EVT_DRAG,
2575
- St as EVT_DRAG_END,
2576
- Yt as EVT_DRAG_START,
2577
- Nn as EVT_HOVER,
2578
- jn as EVT_LINK,
2579
- ce as EVT_REMOVE,
2580
- le as EVT_SELECT,
2581
- Rn as EVT_UNHOVER,
2582
- he as EVT_UNSELECT,
2583
- de as EVT_UPDATE,
2121
+ Xn as Arrows,
2122
+ ri as Control,
2123
+ ge as EVT_ADD,
2124
+ Un as EVT_CANCEL_DRAWING,
2125
+ Xt as EVT_DRAG,
2126
+ Tt as EVT_DRAG_END,
2127
+ Zt as EVT_DRAG_START,
2128
+ Rn as EVT_HOVER,
2129
+ Wn as EVT_LINK,
2130
+ pe as EVT_REMOVE,
2131
+ de as EVT_SELECT,
2132
+ Vn as EVT_UNHOVER,
2133
+ fe as EVT_UNSELECT,
2134
+ ye as EVT_UPDATE,
2584
2135
  V as NONE,
2585
- Yn as Texts,
2586
- ae as clientToContainerPosition,
2587
- Ln as createArrow,
2588
- Ot as createSVGElement,
2589
- Bn as createText,
2590
- _e as defaultArrowOptions,
2136
+ Qn as Texts,
2137
+ ue as clientToContainerPosition,
2138
+ Nn as createArrow,
2139
+ Pt as createSVGElement,
2140
+ Zn as createText,
2141
+ Me as defaultArrowOptions,
2591
2142
  zt as defaultArrowStyle,
2592
- Le as defaultControllerOptions,
2593
- re as defaultTextOptions,
2594
- At as defaultTextStyle,
2595
- Zn as getAnnotationsBounds,
2596
- Bt as getArrowEnd,
2597
- Vt as getArrowEndPoints,
2598
- jt as getArrowSide,
2599
- Lt as getArrowStart,
2600
- Ft as getAttachmentPointOnNode,
2601
- qe as getHandleId,
2602
- He as getTextBbox,
2143
+ ze as defaultControllerOptions,
2144
+ le as defaultTextOptions,
2145
+ St as defaultTextStyle,
2146
+ ii as getAnnotationsBounds,
2147
+ Gt as getArrowEnd,
2148
+ Yt as getArrowEndPoints,
2149
+ Rt as getArrowSide,
2150
+ $t as getArrowStart,
2151
+ Vt as getAttachmentPointOnNode,
2152
+ Ue as getHandleId,
2153
+ qe as getTextBbox,
2603
2154
  ct as getTextPosition,
2604
2155
  ut as getTextSize,
2605
- Pe as isAnnotationCollection,
2156
+ Fe as isAnnotationCollection,
2606
2157
  ot as isArrow,
2607
2158
  mt as isText,
2608
- Fe as setArrowEnd,
2609
- bt as setArrowEndPoint,
2610
- je as setArrowStart,
2611
- Pn as setTextBbox,
2612
- Cn as updateTextBbox
2159
+ Ve as setArrowEnd,
2160
+ At as setArrowEndPoint,
2161
+ Re as setArrowStart,
2162
+ Bn as setTextBbox,
2163
+ Fn as updateTextBbox
2613
2164
  };