@linkurious/ogma-annotations 1.0.5 → 1.0.10

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,45 +1,45 @@
1
- var En = Object.defineProperty;
2
- var kn = (u, l, t) => l in u ? En(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
3
- var m = (u, l, t) => (kn(u, typeof l != "symbol" ? l + "" : l, t), t);
4
- var Tn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function oe(u) {
6
- return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
1
+ var kn = Object.defineProperty;
2
+ var Tn = (c, l, t) => l in c ? kn(c, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[l] = t;
3
+ var v = (c, l, t) => (Tn(c, typeof l != "symbol" ? l + "" : l, t), t);
4
+ var In = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
+ function le(c) {
6
+ return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
7
7
  }
8
- var Pe = { exports: {} };
9
- (function(u) {
8
+ var $e = { exports: {} };
9
+ (function(c) {
10
10
  (function(l, t) {
11
- u.exports = t();
11
+ c.exports = t();
12
12
  })("Vector", function() {
13
13
  var l = function() {
14
- var t = Math.PI * 2, s = 180 / Math.PI, a = Math.PI / 180;
15
- function c(r) {
16
- return Math.round(r * 1e8) / 1e8;
14
+ var t = Math.PI * 2, r = 180 / Math.PI, a = Math.PI / 180;
15
+ function u(s) {
16
+ return Math.round(s * 1e8) / 1e8;
17
17
  }
18
- function g(r, d) {
19
- var v = d.x - r.x, T = d.y - r.y;
20
- return Math.sqrt(v * v + T * T);
18
+ function p(s, d) {
19
+ var m = d.x - s.x, A = d.y - s.y;
20
+ return Math.sqrt(m * m + A * A);
21
21
  }
22
- function y(r, d, v) {
23
- var T = d.y - r.y, _ = d.x - r.x, E = Math.atan2(T, _);
24
- if (v)
25
- for (; E < 0; )
26
- E += t;
27
- return E;
22
+ function y(s, d, m) {
23
+ var A = d.y - s.y, I = d.x - s.x, k = Math.atan2(A, I);
24
+ if (m)
25
+ for (; k < 0; )
26
+ k += t;
27
+ return k;
28
28
  }
29
- function f(r, d) {
30
- this.x = r !== void 0 ? r : 0, this.y = d !== void 0 ? d : 0;
29
+ function f(s, d) {
30
+ this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
31
31
  }
32
- return f.fromRadians = function(r) {
33
- var d = Math.cos(r), v = Math.sin(r);
34
- return new f(d, v);
35
- }, f.fromDegrees = function(r) {
36
- var d = r * (Math.PI / 180);
32
+ return f.fromRadians = function(s) {
33
+ var d = Math.cos(s), m = Math.sin(s);
34
+ return new f(d, m);
35
+ }, f.fromDegrees = function(s) {
36
+ var d = s * (Math.PI / 180);
37
37
  return f.fromRadians(d);
38
- }, f.fromString = function(r) {
39
- var d = r.split(",");
38
+ }, f.fromString = function(s) {
39
+ var d = s.split(",");
40
40
  return new f(parseFloat(d[0]), parseFloat(d[1]));
41
- }, f.fromArray = function(r) {
42
- return new f(r[0], r[1]);
41
+ }, f.fromArray = function(s) {
42
+ return new f(s[0], s[1]);
43
43
  }, f.prototype = {
44
44
  // version
45
45
  version: "2.0.1",
@@ -55,30 +55,30 @@ var Pe = { exports: {} };
55
55
  // Get if equal to another vector
56
56
  // @param vector - other vector to compare with.
57
57
  // @return if vectors are equal.
58
- equals: function(r) {
59
- return this.prototype === r.prototype && this.x === r.x && this.y === r.y;
58
+ equals: function(s) {
59
+ return this.prototype === s.prototype && this.x === s.x && this.y === s.y;
60
60
  },
61
61
  // [API]
62
62
  // [chainable, changeSelf]
63
63
  // set values from another vector. this changes value of self.
64
64
  // @param vector - other vector to get values from.
65
65
  // @return self.
66
- copy: function(r) {
67
- return this.x = r.x, this.y = r.y, this;
66
+ copy: function(s) {
67
+ return this.x = s.x, this.y = s.y, this;
68
68
  },
69
69
  // [API]
70
70
  // [chainable, changeSelf]
71
71
  // set only the x component from another vector.
72
72
  // @return self.
73
- copyX: function(r) {
74
- return this.x = r.x, this;
73
+ copyX: function(s) {
74
+ return this.x = s.x, this;
75
75
  },
76
76
  // [API]
77
77
  // [chainable, changeSelf]
78
78
  // set only the y component from another vector.
79
79
  // @return self.
80
- copyY: function(r) {
81
- return this.y = r.y, this;
80
+ copyY: function(s) {
81
+ return this.y = s.y, this;
82
82
  },
83
83
  // [API]
84
84
  // []
@@ -100,8 +100,8 @@ var Pe = { exports: {} };
100
100
  // @param x - optional x component to set.
101
101
  // @param y - optional y component to set.
102
102
  // @return self.
103
- set: function(r, d) {
104
- return r !== void 0 && (this.x = r), d !== void 0 && (this.y = d), this;
103
+ set: function(s, d) {
104
+ return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
105
105
  },
106
106
  // [API]
107
107
  // [chainable, clone]
@@ -136,29 +136,29 @@ var Pe = { exports: {} };
136
136
  // get the distance from another vector.
137
137
  // @param other - vector to get distance from.
138
138
  // @return distance between vectors.
139
- distanceFrom: function(r) {
140
- return g(this, r);
139
+ distanceFrom: function(s) {
140
+ return p(this, s);
141
141
  },
142
142
  // [API]
143
143
  // []
144
144
  // get angle from another vector in radians.
145
145
  // @return angle in radians from this to other.
146
- radiansTo: function(r) {
147
- return y(this, r, !0);
146
+ radiansTo: function(s) {
147
+ return y(this, s, !0);
148
148
  },
149
149
  // [API]
150
150
  // []
151
151
  // get degrees from another vector in degrees.
152
152
  // @return angle in degrees from this to other.
153
- degreesTo: function(r) {
154
- return y(this, r, !0) * s;
153
+ degreesTo: function(s) {
154
+ return y(this, s, !0) * r;
155
155
  },
156
156
  // [API]
157
157
  // []
158
158
  // convert this vector to a radian angle.
159
159
  // this is equivalent to doing Vector.zero.radiansTo(this).
160
160
  // @return angle in radians.
161
- toRadians: function(r) {
161
+ toRadians: function(s) {
162
162
  return y(f.zero, this, !0);
163
163
  },
164
164
  // [API]
@@ -166,41 +166,41 @@ var Pe = { exports: {} };
166
166
  // convert this vector to degree.
167
167
  // this is equivalent to doing Vector.zero.degreeTo(this).
168
168
  // @return angle in degrees (0-360).
169
- toDegrees: function(r) {
170
- return this.toRadians() * s;
169
+ toDegrees: function(s) {
170
+ return this.toRadians() * r;
171
171
  },
172
172
  // [API]
173
173
  // [chainable, changeSelf]
174
174
  // rotate this vector by a given degree.
175
175
  // @param degrees - degrees to rotate this vector by (can be positive or negative).
176
176
  // @return self.
177
- rotateDegreesSelf: function(r) {
178
- return this.rotateRadiansSelf(r * a);
177
+ rotateDegreesSelf: function(s) {
178
+ return this.rotateRadiansSelf(s * a);
179
179
  },
180
180
  // [API]
181
181
  // [chainable]
182
182
  // clone and rotate the vector by a given degree.
183
183
  // @param degrees - degree to rotate this vector by (can be positive or negative).
184
184
  // @return cloned rotated vector.
185
- rotateDegrees: function(r) {
186
- return this.clone().rotateDegreesSelf(r);
185
+ rotateDegrees: function(s) {
186
+ return this.clone().rotateDegreesSelf(s);
187
187
  },
188
188
  // [API]
189
189
  // [chainable, changeSelf]
190
190
  // rotate this vector by a given radian.
191
191
  // @param radians - radians to rotate this vector by (can be positive or negative).
192
192
  // @return self.
193
- rotateRadiansSelf: function(r) {
194
- var d = Math.cos(r), v = Math.sin(r), T = this.x * d - this.y * v, _ = this.x * v + this.y * d;
195
- return this.x = c(T), this.y = c(_), this;
193
+ rotateRadiansSelf: function(s) {
194
+ var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, I = this.x * m + this.y * d;
195
+ return this.x = u(A), this.y = u(I), this;
196
196
  },
197
197
  // [API]
198
198
  // [chainable]
199
199
  // clone and rotate the vector by a given degree.
200
200
  // @param radians - radians to rotate this vector by (can be positive or negative).
201
201
  // @return cloned rotated vector.
202
- rotateRadians: function(r) {
203
- return this.clone().rotateRadiansSelf(r);
202
+ rotateRadians: function(s) {
203
+ return this.clone().rotateRadiansSelf(s);
204
204
  },
205
205
  // [API]
206
206
  // []
@@ -214,8 +214,8 @@ var Pe = { exports: {} };
214
214
  // normalize this vector, eg make length equal 1.
215
215
  // @return self.
216
216
  normalizeSelf: function() {
217
- var r = Math.sqrt(this.x * this.x + this.y * this.y);
218
- return r === 0 ? this : (this.x /= r, this.y /= r, this);
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
219
  },
220
220
  // [API]
221
221
  // [chainable, clone]
@@ -230,8 +230,8 @@ var Pe = { exports: {} };
230
230
  // for example, v(10, 11) + v(5, 6) = v(15, 17).
231
231
  // @param other - vector to add components to self.
232
232
  // @return self.
233
- addSelf: function(r) {
234
- return typeof r == "number" ? this.addScalarSelf(r) : (this.x += r.x, this.y += r.y, this);
233
+ addSelf: function(s) {
234
+ return typeof s == "number" ? this.addScalarSelf(s) : (this.x += s.x, this.y += s.y, this);
235
235
  },
236
236
  // [API]
237
237
  // [chainable, changeSelf]
@@ -239,8 +239,8 @@ var Pe = { exports: {} };
239
239
  // for example, v(10, 10) - v(2, 3) = v(8, 7).
240
240
  // @param other - vector to subtract components from self.
241
241
  // @return self.
242
- subSelf: function(r) {
243
- return typeof r == "number" ? this.subScalarSelf(r) : (this.x -= r.x, this.y -= r.y, this);
242
+ subSelf: function(s) {
243
+ return typeof s == "number" ? this.subScalarSelf(s) : (this.x -= s.x, this.y -= s.y, this);
244
244
  },
245
245
  // [API]
246
246
  // [chainable, changeSelf]
@@ -248,8 +248,8 @@ var Pe = { exports: {} };
248
248
  // for example, v(10, 20) / v(2, 5) = v(5, 4).
249
249
  // @param other - vector to divide components from self.
250
250
  // @return self.
251
- divSelf: function(r) {
252
- return typeof r == "number" ? this.divScalarSelf(r) : (this.x /= r.x, this.y /= r.y, this);
251
+ divSelf: function(s) {
252
+ return typeof s == "number" ? this.divScalarSelf(s) : (this.x /= s.x, this.y /= s.y, this);
253
253
  },
254
254
  // [API]
255
255
  // [chainable, changeSelf]
@@ -257,8 +257,8 @@ var Pe = { exports: {} };
257
257
  // for example, v(2, 3) * v(3, 4) = v(6, 12).
258
258
  // @param other - vector to multiply components with self.
259
259
  // @return self.
260
- mulSelf: function(r) {
261
- return typeof r == "number" ? this.mulScalarSelf(r) : (this.x *= r.x, this.y *= r.y, this);
260
+ mulSelf: function(s) {
261
+ return typeof s == "number" ? this.mulScalarSelf(s) : (this.x *= s.x, this.y *= s.y, this);
262
262
  },
263
263
  // [API]
264
264
  // [chainable, changeSelf]
@@ -266,8 +266,8 @@ var Pe = { exports: {} };
266
266
  // for example, v(2, 3) + 5 = v(7, 8).
267
267
  // @param val - value to add to components.
268
268
  // @return self.
269
- addScalarSelf: function(r) {
270
- return this.x += r, this.y += r, this;
269
+ addScalarSelf: function(s) {
270
+ return this.x += s, this.y += s, this;
271
271
  },
272
272
  // [API]
273
273
  // [chainable, changeSelf]
@@ -275,8 +275,8 @@ var Pe = { exports: {} };
275
275
  // for example, v(7, 9) - 5 = v(3, 4).
276
276
  // @param val - value to subtract from components.
277
277
  // @return self.
278
- subScalarSelf: function(r) {
279
- return this.x -= r, this.y -= r, this;
278
+ subScalarSelf: function(s) {
279
+ return this.x -= s, this.y -= s, this;
280
280
  },
281
281
  // [API]
282
282
  // [chainable, changeSelf]
@@ -284,8 +284,8 @@ var Pe = { exports: {} };
284
284
  // for example, v(6, 8) / 5 = v(3, 4).
285
285
  // @param val - value to divide components by.
286
286
  // @return self.
287
- divScalarSelf: function(r) {
288
- return this.x /= r, this.y /= r, this;
287
+ divScalarSelf: function(s) {
288
+ return this.x /= s, this.y /= s, this;
289
289
  },
290
290
  // [API]
291
291
  // [chainable, changeSelf]
@@ -293,32 +293,32 @@ var Pe = { exports: {} };
293
293
  // for example, v(2, 3) * 2 = v(4, 6).
294
294
  // @param val - value to multiply components with.
295
295
  // @return self.
296
- mulScalarSelf: function(r) {
297
- return this.x *= r, this.y *= r, this;
296
+ mulScalarSelf: function(s) {
297
+ return this.x *= s, this.y *= s, this;
298
298
  },
299
299
  // [API]
300
300
  // [chainable, clone]
301
301
  // clone self and add other vector to it.
302
302
  // @param other - vector to add with.
303
303
  // @return cloned vector.
304
- add: function(r) {
305
- return this.clone().addSelf(r);
304
+ add: function(s) {
305
+ return this.clone().addSelf(s);
306
306
  },
307
307
  // [API]
308
308
  // [chainable, clone]
309
309
  // clone self and subtract other vector from it.
310
310
  // @param other - vector to subtract with.
311
311
  // @return cloned vector.
312
- sub: function(r) {
313
- return this.clone().subSelf(r);
312
+ sub: function(s) {
313
+ return this.clone().subSelf(s);
314
314
  },
315
315
  // [API]
316
316
  // [chainable, clone]
317
317
  // clone self and multiply by other vector.
318
318
  // @param other - vector to multiply with.
319
319
  // @return cloned vector.
320
- mul: function(r) {
321
- return this.clone().mulSelf(r);
320
+ mul: function(s) {
321
+ return this.clone().mulSelf(s);
322
322
  },
323
323
  // [API]
324
324
  // [chainable, clone]
@@ -326,40 +326,40 @@ var Pe = { exports: {} };
326
326
  // @param other - vector to divide with.
327
327
  // @param scalar - value to divide by.
328
328
  // @return cloned vector.
329
- div: function(r) {
330
- return this.clone().divSelf(r);
329
+ div: function(s) {
330
+ return this.clone().divSelf(s);
331
331
  },
332
332
  // [API]
333
333
  // [chainable, clone]
334
334
  // clone self and add scalar to it.
335
335
  // @param scalar - value to add.
336
336
  // @return cloned vector.
337
- addScalar: function(r) {
338
- return this.clone().addScalarSelf(r);
337
+ addScalar: function(s) {
338
+ return this.clone().addScalarSelf(s);
339
339
  },
340
340
  // [API]
341
341
  // [chainable, clone]
342
342
  // clone self and substract scalar from it.
343
343
  // @param scalar - value to subtract.
344
344
  // @return cloned vector.
345
- subScalar: function(r) {
346
- return this.clone().subScalarSelf(r);
345
+ subScalar: function(s) {
346
+ return this.clone().subScalarSelf(s);
347
347
  },
348
348
  // [API]
349
349
  // [chainable, clone]
350
350
  // clone self and multiply by scalar.
351
351
  // @param scalar - value to multiply with.
352
352
  // @return cloned vector.
353
- mulScalar: function(r) {
354
- return this.clone().mulScalarSelf(r);
353
+ mulScalar: function(s) {
354
+ return this.clone().mulScalarSelf(s);
355
355
  },
356
356
  // [API]
357
357
  // [chainable, clone]
358
358
  // clone self and divide by scalar.
359
359
  // @param scalar - value to divide by.
360
360
  // @return cloned vector.
361
- divScalar: function(r) {
362
- return this.clone().divScalarSelf(r);
361
+ divScalar: function(s) {
362
+ return this.clone().divScalarSelf(s);
363
363
  },
364
364
  // [API]
365
365
  // [chainable, changeSelf]
@@ -368,8 +368,8 @@ var Pe = { exports: {} };
368
368
  // @param min - min value for x, y components.
369
369
  // @param max - max value for x, y components.
370
370
  // @return self.
371
- clampSelf: function(r, d) {
372
- return this.x < r.x && (this.x = r.x), this.y < r.y && (this.y = r.y), this.x > d.x && (this.x = d.x), this.y > d.y && (this.y = d.y), this;
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
373
  },
374
374
  // [API]
375
375
  // [chainable, clone]
@@ -378,8 +378,8 @@ var Pe = { exports: {} };
378
378
  // @param min - min value for x, y components.
379
379
  // @param max - max value for x, y components.
380
380
  // @return cloned vector in range.
381
- clamp: function(r, d) {
382
- return this.clone().clampSelf(r, d);
381
+ clamp: function(s, d) {
382
+ return this.clone().clampSelf(s, d);
383
383
  },
384
384
  // [API]
385
385
  // [chainable, changeSelf]
@@ -387,8 +387,8 @@ var Pe = { exports: {} };
387
387
  // for example, you can use Math.round to round the vector x, y values.
388
388
  // @param func - function to apply on components.
389
389
  // @return self.
390
- applySelf: function(r) {
391
- return this.x = r(this.x), this.y = r(this.y), this;
390
+ applySelf: function(s) {
391
+ return this.x = s(this.x), this.y = s(this.y), this;
392
392
  },
393
393
  // [API]
394
394
  // [chainable, clone]
@@ -396,8 +396,8 @@ var Pe = { exports: {} };
396
396
  // for example, you can use Math.round to round the vector x, y values.
397
397
  // @param func - function to apply on components.
398
398
  // @return cloned vector.
399
- apply: function(r) {
400
- return this.clone().applySelf(r);
399
+ apply: function(s) {
400
+ return this.clone().applySelf(s);
401
401
  },
402
402
  // [API]
403
403
  // [chainable, changeSelf]
@@ -432,16 +432,16 @@ var Pe = { exports: {} };
432
432
  // calculate dot-product of this vector with another vector.
433
433
  // @param other - other vector to calculate dot-product with.
434
434
  // @return dot product.
435
- dot: function(r) {
436
- return this.x * r.x + this.y * r.y;
435
+ dot: function(s) {
436
+ return this.x * s.x + this.y * s.y;
437
437
  },
438
438
  // [API]
439
439
  // []
440
440
  // calculate cross-product of this vector with another vector.
441
441
  // @param other - other vector to calculate cross-product with.
442
442
  // @return dot product.
443
- cross: function(r) {
444
- return this.x * r.y - this.y * r.x;
443
+ cross: function(s) {
444
+ return this.x * s.y - this.y * s.x;
445
445
  },
446
446
  // [API]
447
447
  // [chainable, changeSelf]
@@ -450,8 +450,8 @@ var Pe = { exports: {} };
450
450
  // @param x - default value for x if undefined (0 if not defined).
451
451
  // @param y - default value for y if undefined (0 if not defined).
452
452
  // @return self.
453
- repairSelf: function(r, d) {
454
- return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = r || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = d || 0), this;
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
455
  },
456
456
  // [API]
457
457
  // [chainable, clone]
@@ -460,8 +460,8 @@ var Pe = { exports: {} };
460
460
  // @param x - default value for x if undefined (0 if not defined).
461
461
  // @param y - default value for y if undefined (0 if not defined).
462
462
  // @return repaired clone.
463
- repair: function(r, d) {
464
- return this.clone().repairSelf(r, d);
463
+ repair: function(s, d) {
464
+ return this.clone().repairSelf(s, d);
465
465
  },
466
466
  // [API]
467
467
  // []
@@ -475,24 +475,24 @@ var Pe = { exports: {} };
475
475
  // convert to a string with a given format.
476
476
  // @param format - a string in which %x and %y will be replaced with the vector values.
477
477
  // @return formatted string representing the vector.
478
- format: function(r) {
479
- return r = r || "%x,%y", r = r.replace(new RegExp("%x", "g"), this.x), r = r.replace(new RegExp("%y", "g"), this.y), r;
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
480
  }
481
481
  }, f;
482
482
  }();
483
483
  return l.zero = new l(0, 0), l.one = new l(1, 1), l.up = new l(0, -1), l.down = new l(0, 1), l.left = new l(-1, 0), l.right = new l(1, 0), l.upLeft = new l(-1, -1), l.downLeft = new l(-1, 1), l.upRight = new l(1, -1), l.downRight = new l(1, 1), l.prototype.magnitude = l.prototype.length, Object.freeze && (Object.freeze(l.zero), Object.freeze(l.one), Object.freeze(l.up), Object.freeze(l.down), Object.freeze(l.left), Object.freeze(l.right), Object.freeze(l.upLeft), Object.freeze(l.downLeft), Object.freeze(l.upRight), Object.freeze(l.downRight)), l;
484
484
  });
485
- })(Pe);
486
- var In = Pe.exports;
487
- const rt = /* @__PURE__ */ oe(In);
488
- let jt = (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), "");
485
+ })($e);
486
+ var _n = $e.exports;
487
+ const rt = /* @__PURE__ */ le(_n);
488
+ let jt = (c = 21) => crypto.getRandomValues(new Uint8Array(c)).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
489
  const Dt = {
490
490
  strokeType: "plain",
491
491
  strokeColor: "black",
492
492
  strokeWidth: 1,
493
493
  head: "none",
494
494
  tail: "none"
495
- }, Se = {
495
+ }, Ee = {
496
496
  id: 0,
497
497
  type: "Feature",
498
498
  properties: {
@@ -518,7 +518,7 @@ const Dt = {
518
518
  // tail: 'arrow-plain',
519
519
  // start: { x: 0, y: 0 },
520
520
  // end: { x: 100, y: 100 }
521
- }, _n = (u = 0, l = 0, t = 0, s = 0, a = { ...Dt }) => ({
521
+ }, Dn = (c = 0, l = 0, t = 0, r = 0, a = { ...Dt }) => ({
522
522
  id: jt(),
523
523
  type: "Feature",
524
524
  properties: {
@@ -531,70 +531,70 @@ const Dt = {
531
531
  geometry: {
532
532
  type: "LineString",
533
533
  coordinates: [
534
- [u, l],
535
- [t, s]
534
+ [c, l],
535
+ [t, r]
536
536
  ]
537
537
  }
538
- }), Dn = "http://www.w3.org/2000/svg";
539
- function It(u) {
540
- return document.createElementNS(Dn, u);
538
+ }), Mn = "http://www.w3.org/2000/svg";
539
+ function It(c) {
540
+ return document.createElementNS(Mn, c);
541
541
  }
542
- function Ce(u) {
543
- return u.geometry.bbox || On(u), u.geometry.bbox;
542
+ function Pe(c) {
543
+ return c.geometry.bbox || On(c), c.geometry.bbox;
544
544
  }
545
- function dt(u) {
546
- const l = Ce(u);
545
+ function dt(c) {
546
+ const l = Pe(c);
547
547
  return {
548
548
  width: l[2] - l[0],
549
549
  height: l[3] - l[1]
550
550
  };
551
551
  }
552
- function yt(u) {
553
- const l = Ce(u);
552
+ function yt(c) {
553
+ const l = Pe(c);
554
554
  return { x: l[0], y: l[1] };
555
555
  }
556
- function On(u) {
557
- const [l, t] = u.geometry.coordinates[0][0], [s, a] = u.geometry.coordinates[0][2];
558
- u.geometry.bbox = [l, t, s, a];
556
+ function On(c) {
557
+ const [l, t] = c.geometry.coordinates[0][0], [r, a] = c.geometry.coordinates[0][2];
558
+ c.geometry.bbox = [l, t, r, a];
559
559
  }
560
- function Mn(u, l, t, s, a) {
561
- u.geometry.bbox = [l, t, l + s, t + a], u.geometry.coordinates = [
560
+ function zn(c, l, t, r, a) {
561
+ c.geometry.bbox = [l, t, l + r, t + a], c.geometry.coordinates = [
562
562
  [
563
563
  [l, t],
564
- [l + s, t],
565
- [l + s, t + a],
564
+ [l + r, t],
565
+ [l + r, t + a],
566
566
  [l, t + a],
567
567
  [l, t]
568
568
  ]
569
569
  ];
570
570
  }
571
- function _t(u) {
572
- const [l, t] = u.geometry.coordinates[0];
571
+ function _t(c) {
572
+ const [l, t] = c.geometry.coordinates[0];
573
573
  return { x: l, y: t };
574
574
  }
575
- function Ae(u, l) {
576
- const [t, s] = u.geometry.coordinates[l === "start" ? 0 : 1];
577
- return { x: t, y: s };
575
+ function te(c, l) {
576
+ const [t, r] = c.geometry.coordinates[l === "start" ? 0 : 1];
577
+ return { x: t, y: r };
578
578
  }
579
- function Ht(u) {
580
- const [l, t] = u.geometry.coordinates[1];
579
+ function Rt(c) {
580
+ const [l, t] = c.geometry.coordinates[1];
581
581
  return { x: l, y: t };
582
582
  }
583
- function Ne(u, l, t) {
584
- u.geometry.coordinates[0] = [l, t];
583
+ function Ne(c, l, t) {
584
+ c.geometry.coordinates[0] = [l, t];
585
585
  }
586
- function $e(u, l, t) {
587
- u.geometry.coordinates[1] = [l, t];
586
+ function He(c, l, t) {
587
+ c.geometry.coordinates[1] = [l, t];
588
588
  }
589
- function Rt(u) {
590
- return { start: _t(u), end: Ht(u) };
589
+ function Ft(c) {
590
+ return { start: _t(c), end: Rt(c) };
591
591
  }
592
- function Qt(u, l, t, s) {
593
- l === "start" ? Ne(u, t, s) : $e(u, t, s);
592
+ function Nt(c, l, t, r) {
593
+ l === "start" ? Ne(c, t, r) : He(c, t, r);
594
594
  }
595
- const He = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
- function Xn(u) {
597
- return $t(u).reduce(
595
+ const Re = (c) => parseInt(c.getAttribute("data-handle-id") || "-1");
596
+ function Xn(c) {
597
+ return Ht(c).reduce(
598
598
  (l, t) => (l[0] = Math.min(t[0], l[0]), l[1] = Math.min(t[1], l[1]), l[2] = Math.max(t[0], l[2]), l[3] = Math.max(t[1], l[3]), l),
599
599
  [
600
600
  Number.POSITIVE_INFINITY,
@@ -604,192 +604,191 @@ function Xn(u) {
604
604
  ]
605
605
  );
606
606
  }
607
- function $t(u) {
607
+ function Ht(c) {
608
608
  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, s) {
610
- return t.concat(s);
611
- }, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
612
- (t, s) => t.concat(s.reduce((a, c) => a.concat(c), [])),
609
+ return c.type == "Point" ? l = [c.coordinates] : c.type == "LineString" || c.type == "MultiPoint" ? l = c.coordinates : c.type == "Polygon" || c.type == "MultiLineString" ? l = c.coordinates.reduce(function(t, r) {
610
+ return t.concat(r);
611
+ }, []) : c.type == "MultiPolygon" ? l = c.coordinates.reduce(
612
+ (t, r) => t.concat(r.reduce((a, u) => a.concat(u), [])),
613
613
  []
614
- ) : u.type == "Feature" ? l = $t(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
- (t, s) => t.concat($t(s)),
614
+ ) : c.type == "Feature" ? l = Ht(c.geometry) : c.type == "GeometryCollection" ? l = c.geometries.reduce(
615
+ (t, r) => t.concat(Ht(r)),
616
616
  []
617
- ) : u.type == "FeatureCollection" && (l = u.features.reduce(
618
- (t, s) => t.concat($t(s)),
617
+ ) : c.type == "FeatureCollection" && (l = c.features.reduce(
618
+ (t, r) => t.concat(Ht(r)),
619
619
  []
620
620
  )), l;
621
621
  }
622
- function Ee(u, l, t) {
623
- const s = Math.atan2(u.y - l.y, u.x - l.x);
622
+ function ee(c, l, t) {
623
+ const r = Math.atan2(c.y - l.y, c.x - l.x);
624
624
  return {
625
- x: l.x + t * Math.cos(s),
626
- y: l.y + t * Math.sin(s)
625
+ x: l.x + t * Math.cos(r),
626
+ y: l.y + t * Math.sin(r)
627
627
  };
628
628
  }
629
- function Re(u, l = 5, t = 30) {
630
- var r;
631
- const { start: s, end: a } = Rt(u), c = new rt(s.x, s.y), y = new rt(a.x, a.y).sub(c), f = u.properties.style && u.properties.style.strokeWidth ? (r = u.properties.style) == null ? void 0 : r.strokeWidth : 0;
629
+ function Fe(c, l = 5, t = 30) {
630
+ var s;
631
+ const { start: r, end: a } = Ft(c), u = new rt(r.x, r.y), y = new rt(a.x, a.y).sub(u), f = c.properties.style && c.properties.style.strokeWidth ? (s = c.properties.style) == null ? void 0 : s.strokeWidth : 0;
632
632
  return Math.min(t, Math.max(3 * f, y.length() * 0.1, l));
633
633
  }
634
- function ke(u, l, t, s) {
635
- const a = l.clone().normalize().invert().mul(s);
634
+ function ke(c, l, t, r) {
635
+ const a = l.clone().normalize().invert().mul(r);
636
636
  if (!t || t === "none")
637
637
  return "";
638
- const c = u.clone().add(a.rotateRadians(Math.PI / 8)), g = u.clone().add(a.rotateRadians(-Math.PI / 8)), y = `${u.x} ${u.y}`;
639
- return `M ${c.x} ${c.y} L ${y} ${g.x} ${g.y} ${t === "arrow" ? "" : `${c.x} ${c.y}`}`;
638
+ const u = c.clone().add(a.rotateRadians(Math.PI / 8)), p = c.clone().add(a.rotateRadians(-Math.PI / 8)), y = `${c.x} ${c.y}`;
639
+ return `M ${u.x} ${u.y} L ${y} ${p.x} ${p.y} ${t === "arrow" ? "" : `${u.x} ${u.y}`}`;
640
640
  }
641
- function zn(u, l, t, s, a) {
642
- const { start: c, end: g } = Rt(u), { tail: y, head: f, strokeColor: r, strokeWidth: d } = u.properties.style || t, v = new rt(c.x, c.y), T = new rt(g.x, g.y), _ = T.clone().sub(v), E = Re(u, s, a), P = It("path");
643
- P.setAttribute("data-annotation", `${u.id}`), P.setAttribute("data-annotation-type", "arrow");
644
- const A = f === "arrow-plain" || y === "arrow";
645
- P.setAttribute("stroke", r || "none"), P.setAttribute("stroke-width", `${d}`), P.setAttribute("fill", A ? r || "" : "none"), P.setAttribute("stroke-linecap", "round"), P.setAttribute("stroke-linejoin", "round");
646
- const U = ke(v, _.clone().invert(), y, E), N = ke(T, _, f, E), z = U + `M ${v.x} ${v.y} ${T.x} ${T.y}` + N;
647
- P.setAttribute("d", z), l.appendChild(P);
641
+ function Ln(c, l, t, r, a) {
642
+ const { start: u, end: p } = Ft(c), { tail: y, head: f, strokeColor: s, strokeWidth: d } = c.properties.style || t, m = new rt(u.x, u.y), A = new rt(p.x, p.y), I = A.clone().sub(m), k = Fe(c, r, a), C = It("path");
643
+ C.setAttribute("data-annotation", `${c.id}`), C.setAttribute("data-annotation-type", "arrow");
644
+ const E = f === "arrow-plain" || y === "arrow";
645
+ C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${d}`), C.setAttribute("fill", E ? s || "" : "none"), C.setAttribute("stroke-linecap", "round"), C.setAttribute("stroke-linejoin", "round");
646
+ const U = ke(m, I.clone().invert(), y, k), P = ke(A, I, f, k), z = U + `M ${m.x} ${m.y} ${A.x} ${A.y}` + P;
647
+ C.setAttribute("d", z), l.appendChild(C);
648
648
  }
649
- const B = -1, ae = "dragging", le = "dragstart", Ot = "dragend", ee = "select", ne = "unselect", Ln = "hover", Pn = "unhover", ie = "remove", re = "add", Cn = "cancelDrawing", se = "update", Nn = "link";
649
+ const B = -1, he = "dragging", ce = "dragstart", Mt = "dragend", ie = "select", re = "unselect", Cn = "hover", $n = "unhover", se = "remove", oe = "add", Pn = "cancelDrawing", ae = "update", Nn = "link";
650
650
  var je = { exports: {} };
651
- (function(u) {
651
+ (function(c) {
652
652
  var l = Object.prototype.hasOwnProperty, t = "~";
653
- function s() {
653
+ function r() {
654
654
  }
655
- Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (t = !1));
656
- function a(f, r, d) {
657
- this.fn = f, this.context = r, this.once = d || !1;
655
+ Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
656
+ function a(f, s, d) {
657
+ this.fn = f, this.context = s, this.once = d || !1;
658
658
  }
659
- function c(f, r, d, v, T) {
659
+ function u(f, s, d, m, A) {
660
660
  if (typeof d != "function")
661
661
  throw new TypeError("The listener must be a function");
662
- var _ = new a(d, v || f, T), E = t ? t + r : r;
663
- return f._events[E] ? f._events[E].fn ? f._events[E] = [f._events[E], _] : f._events[E].push(_) : (f._events[E] = _, f._eventsCount++), f;
662
+ var I = new a(d, m || f, A), k = t ? t + s : s;
663
+ return f._events[k] ? f._events[k].fn ? f._events[k] = [f._events[k], I] : f._events[k].push(I) : (f._events[k] = I, f._eventsCount++), f;
664
664
  }
665
- function g(f, r) {
666
- --f._eventsCount === 0 ? f._events = new s() : delete f._events[r];
665
+ function p(f, s) {
666
+ --f._eventsCount === 0 ? f._events = new r() : delete f._events[s];
667
667
  }
668
668
  function y() {
669
- this._events = new s(), this._eventsCount = 0;
669
+ this._events = new r(), this._eventsCount = 0;
670
670
  }
671
671
  y.prototype.eventNames = function() {
672
- var r = [], d, v;
672
+ var s = [], d, m;
673
673
  if (this._eventsCount === 0)
674
- return r;
675
- for (v in d = this._events)
676
- l.call(d, v) && r.push(t ? v.slice(1) : v);
677
- return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(d)) : r;
678
- }, y.prototype.listeners = function(r) {
679
- var d = t ? t + r : r, v = this._events[d];
680
- if (!v)
674
+ return s;
675
+ for (m in d = this._events)
676
+ l.call(d, m) && s.push(t ? m.slice(1) : m);
677
+ return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
678
+ }, y.prototype.listeners = function(s) {
679
+ var d = t ? t + s : s, m = this._events[d];
680
+ if (!m)
681
681
  return [];
682
- if (v.fn)
683
- return [v.fn];
684
- for (var T = 0, _ = v.length, E = new Array(_); T < _; T++)
685
- E[T] = v[T].fn;
686
- return E;
687
- }, y.prototype.listenerCount = function(r) {
688
- var d = t ? t + r : r, v = this._events[d];
689
- return v ? v.fn ? 1 : v.length : 0;
690
- }, y.prototype.emit = function(r, d, v, T, _, E) {
691
- var P = t ? t + r : r;
692
- if (!this._events[P])
682
+ if (m.fn)
683
+ return [m.fn];
684
+ for (var A = 0, I = m.length, k = new Array(I); A < I; A++)
685
+ k[A] = m[A].fn;
686
+ return k;
687
+ }, y.prototype.listenerCount = function(s) {
688
+ var d = t ? t + s : s, m = this._events[d];
689
+ return m ? m.fn ? 1 : m.length : 0;
690
+ }, y.prototype.emit = function(s, d, m, A, I, k) {
691
+ var C = t ? t + s : s;
692
+ if (!this._events[C])
693
693
  return !1;
694
- var A = this._events[P], U = arguments.length, N, z;
695
- if (A.fn) {
696
- switch (A.once && this.removeListener(r, A.fn, void 0, !0), U) {
694
+ var E = this._events[C], U = arguments.length, P, z;
695
+ if (E.fn) {
696
+ switch (E.once && this.removeListener(s, E.fn, void 0, !0), U) {
697
697
  case 1:
698
- return A.fn.call(A.context), !0;
698
+ return E.fn.call(E.context), !0;
699
699
  case 2:
700
- return A.fn.call(A.context, d), !0;
700
+ return E.fn.call(E.context, d), !0;
701
701
  case 3:
702
- return A.fn.call(A.context, d, v), !0;
702
+ return E.fn.call(E.context, d, m), !0;
703
703
  case 4:
704
- return A.fn.call(A.context, d, v, T), !0;
704
+ return E.fn.call(E.context, d, m, A), !0;
705
705
  case 5:
706
- return A.fn.call(A.context, d, v, T, _), !0;
706
+ return E.fn.call(E.context, d, m, A, I), !0;
707
707
  case 6:
708
- return A.fn.call(A.context, d, v, T, _, E), !0;
708
+ return E.fn.call(E.context, d, m, A, I, k), !0;
709
709
  }
710
- for (z = 1, N = new Array(U - 1); z < U; z++)
711
- N[z - 1] = arguments[z];
712
- A.fn.apply(A.context, N);
710
+ for (z = 1, P = new Array(U - 1); z < U; z++)
711
+ P[z - 1] = arguments[z];
712
+ E.fn.apply(E.context, P);
713
713
  } else {
714
- var W = A.length, nt;
715
- for (z = 0; z < W; z++)
716
- switch (A[z].once && this.removeListener(r, A[z].fn, void 0, !0), U) {
714
+ var Z = E.length, nt;
715
+ for (z = 0; z < Z; z++)
716
+ switch (E[z].once && this.removeListener(s, E[z].fn, void 0, !0), U) {
717
717
  case 1:
718
- A[z].fn.call(A[z].context);
718
+ E[z].fn.call(E[z].context);
719
719
  break;
720
720
  case 2:
721
- A[z].fn.call(A[z].context, d);
721
+ E[z].fn.call(E[z].context, d);
722
722
  break;
723
723
  case 3:
724
- A[z].fn.call(A[z].context, d, v);
724
+ E[z].fn.call(E[z].context, d, m);
725
725
  break;
726
726
  case 4:
727
- A[z].fn.call(A[z].context, d, v, T);
727
+ E[z].fn.call(E[z].context, d, m, A);
728
728
  break;
729
729
  default:
730
- if (!N)
731
- for (nt = 1, N = new Array(U - 1); nt < U; nt++)
732
- N[nt - 1] = arguments[nt];
733
- A[z].fn.apply(A[z].context, N);
730
+ if (!P)
731
+ for (nt = 1, P = new Array(U - 1); nt < U; nt++)
732
+ P[nt - 1] = arguments[nt];
733
+ E[z].fn.apply(E[z].context, P);
734
734
  }
735
735
  }
736
736
  return !0;
737
- }, y.prototype.on = function(r, d, v) {
738
- return c(this, r, d, v, !1);
739
- }, y.prototype.once = function(r, d, v) {
740
- return c(this, r, d, v, !0);
741
- }, y.prototype.removeListener = function(r, d, v, T) {
742
- var _ = t ? t + r : r;
743
- if (!this._events[_])
737
+ }, y.prototype.on = function(s, d, m) {
738
+ return u(this, s, d, m, !1);
739
+ }, y.prototype.once = function(s, d, m) {
740
+ return u(this, s, d, m, !0);
741
+ }, y.prototype.removeListener = function(s, d, m, A) {
742
+ var I = t ? t + s : s;
743
+ if (!this._events[I])
744
744
  return this;
745
745
  if (!d)
746
- return g(this, _), this;
747
- var E = this._events[_];
748
- if (E.fn)
749
- E.fn === d && (!T || E.once) && (!v || E.context === v) && g(this, _);
746
+ return p(this, I), this;
747
+ var k = this._events[I];
748
+ if (k.fn)
749
+ k.fn === d && (!A || k.once) && (!m || k.context === m) && p(this, I);
750
750
  else {
751
- for (var P = 0, A = [], U = E.length; P < U; P++)
752
- (E[P].fn !== d || T && !E[P].once || v && E[P].context !== v) && A.push(E[P]);
753
- A.length ? this._events[_] = A.length === 1 ? A[0] : A : g(this, _);
751
+ for (var C = 0, E = [], U = k.length; C < U; C++)
752
+ (k[C].fn !== d || A && !k[C].once || m && k[C].context !== m) && E.push(k[C]);
753
+ E.length ? this._events[I] = E.length === 1 ? E[0] : E : p(this, I);
754
754
  }
755
755
  return this;
756
- }, y.prototype.removeAllListeners = function(r) {
756
+ }, y.prototype.removeAllListeners = function(s) {
757
757
  var d;
758
- return r ? (d = t ? t + r : r, this._events[d] && g(this, d)) : (this._events = new s(), this._eventsCount = 0), this;
759
- }, y.prototype.off = y.prototype.removeListener, y.prototype.addListener = y.prototype.on, y.prefixed = t, y.EventEmitter = y, u.exports = y;
758
+ return s ? (d = t ? t + s : s, this._events[d] && p(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
759
+ }, y.prototype.off = y.prototype.removeListener, y.prototype.addListener = y.prototype.on, y.prefixed = t, y.EventEmitter = y, c.exports = y;
760
760
  })(je);
761
- var $n = je.exports;
762
- const Fe = /* @__PURE__ */ oe($n);
763
- class qe extends Fe {
764
- constructor(t, s) {
761
+ var Hn = je.exports;
762
+ const qe = /* @__PURE__ */ le(Hn);
763
+ class Be extends qe {
764
+ constructor(t, r) {
765
765
  super();
766
- m(this, "ogma");
767
- m(this, "elements");
766
+ v(this, "ogma");
767
+ v(this, "elements");
768
768
  // layer to draw elements
769
- m(this, "layer");
770
- m(this, "editor");
771
- m(this, "selectedId", B);
772
- m(this, "hoveredId", B);
769
+ v(this, "layer");
770
+ v(this, "editor");
771
+ v(this, "selectedId", B);
772
+ v(this, "hoveredId", B);
773
773
  // used to remember ogma options before we change them
774
- m(this, "ogmaOptions");
775
- m(this, "shouldDetect");
776
- m(this, "isDragging");
777
- m(this, "_onKeyUp", (t) => {
774
+ v(this, "ogmaOptions");
775
+ v(this, "shouldDetect");
776
+ v(this, "isDragging");
777
+ v(this, "maxHandleScale", 1.5);
778
+ v(this, "_onKeyUp", (t) => {
778
779
  t.code === 27 && this.selectedId !== B ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== B && this._canRemove() && this.remove(this.selectedId);
779
780
  });
780
- m(this, "_onClickMouseMove", (t) => {
781
+ v(this, "_onClickMouseMove", (t) => {
781
782
  if (!t.domEvent || this.isDragging || !this.shouldDetect)
782
783
  return;
783
- const s = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(s, 0) : void 0;
784
+ const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
784
785
  t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== B && this.unhover() : a ? this.select(a.id) : this.selectedId !== B && this.unselect();
785
786
  });
786
- this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp), this.layer = t.layers.addSVGLayer({
787
+ this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("newFrame", () => {
788
+ this.refreshEditor();
789
+ }), this.layer = t.layers.addSVGLayer({
787
790
  draw: (a) => this.draw(a)
788
- }), this.layer.moveToTop(), this.editor = t.layers.addOverlay({
789
- element: s,
790
- position: { x: 0, y: 0 },
791
- size: { width: 0, height: 0 }
792
- }), this.editor.hide();
791
+ }), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
793
792
  }
794
793
  _canRemove() {
795
794
  return !0;
@@ -800,32 +799,32 @@ class qe extends Fe {
800
799
  * @returns the added annotation
801
800
  */
802
801
  add(t) {
803
- const s = this.getDefaultOptions(), a = Object.assign(t, {
802
+ const r = this.getDefaultOptions(), a = Object.assign(t, {
804
803
  id: t.id === void 0 ? jt() : t.id,
805
804
  type: t.type,
806
805
  properties: {
807
- ...s.properties,
806
+ ...r.properties,
808
807
  ...t.properties || {},
809
808
  // styles need to be merged
810
- style: { ...s.properties.style, ...t.properties.style || {} }
809
+ style: { ...r.properties.style, ...t.properties.style || {} }
811
810
  },
812
811
  geometry: {
813
- ...s.geometry,
812
+ ...r.geometry,
814
813
  ...t.geometry
815
814
  }
816
815
  });
817
- return this.elements.push(a), this.layer.refresh(), this.emit(re, a), a;
816
+ return this.elements.push(a), this.layer.refresh(), this.emit(oe, a), a;
818
817
  }
819
- updateStyle(t, s) {
818
+ updateStyle(t, r) {
820
819
  this.updateAnnotation(t, {
821
820
  properties: {
822
- style: s
821
+ style: r
823
822
  }
824
823
  });
825
824
  }
826
- updateGeometry(t, s) {
825
+ updateGeometry(t, r) {
827
826
  this.updateAnnotation(t, {
828
- geometry: s
827
+ geometry: r
829
828
  });
830
829
  }
831
830
  /**
@@ -834,36 +833,36 @@ class qe extends Fe {
834
833
  * @param id Id of the annotation to update
835
834
  * @param new params of the annotation
836
835
  */
837
- update(t, s) {
836
+ update(t, r) {
838
837
  const a = this.getById(t);
839
- this.updateAnnotation(a, s);
838
+ this.updateAnnotation(a, r);
840
839
  }
841
- updateAnnotation(t, s) {
840
+ updateAnnotation(t, r) {
842
841
  if (!t)
843
842
  return;
844
843
  const a = t.id;
845
- Object.keys(s).forEach((c) => {
846
- if (c !== "id")
847
- if (c === "properties") {
848
- const g = s.properties || { style: {} };
844
+ Object.keys(r).forEach((u) => {
845
+ if (u !== "id")
846
+ if (u === "properties") {
847
+ const p = r.properties || { style: {} };
849
848
  t.properties = {
850
849
  ...t.properties || {},
851
- ...g || {},
850
+ ...p || {},
852
851
  style: {
853
852
  ...t.properties.style || {},
854
- ...g.style || {}
853
+ ...p.style || {}
855
854
  }
856
855
  };
857
856
  } else
858
- c === "geometry" ? t.geometry = {
857
+ u === "geometry" ? t.geometry = {
859
858
  ...t.geometry,
860
- ...s.geometry
861
- } : t[c] = s[c];
859
+ ...r.geometry
860
+ } : t[u] = r[u];
862
861
  }), a === this.selectedId && this.refreshEditor(), this.layer.refresh();
863
862
  }
864
863
  getById(t) {
865
- for (let s = 0; s < this.elements.length; s++) {
866
- const a = this.elements[s];
864
+ for (let r = 0; r < this.elements.length; r++) {
865
+ const a = this.elements[r];
867
866
  if (a.id === t)
868
867
  return a;
869
868
  }
@@ -874,23 +873,23 @@ class qe extends Fe {
874
873
  * Select element, show editor, disable Ogma dragging and fire event
875
874
  */
876
875
  select(t) {
877
- const s = this.getById(t);
878
- s && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(ee, s));
876
+ const r = this.getById(t);
877
+ r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(ie, r));
879
878
  }
880
879
  hover(t) {
881
- const s = this.getById(t);
882
- s && (this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Ln, s));
880
+ const r = this.getById(t);
881
+ r && (this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Cn, r));
883
882
  }
884
883
  getSelectedFeature() {
885
884
  return this.selectedId === B ? null : this.getById(this.selectedId);
886
885
  }
887
886
  unselect() {
888
887
  const t = this.getById(this.selectedId);
889
- return t && this.emit(ne, t), this.selectedId = B, this.hoveredId === B && this.editor.hide(), this.layer.refresh(), this;
888
+ return t && this.emit(re, t), this.selectedId = B, this.hoveredId === B && this.editor.hide(), this.layer.refresh(), this;
890
889
  }
891
890
  unhover() {
892
891
  const t = this.getById(this.hoveredId);
893
- return this.emit(Pn, t), this.hoveredId = B, this.selectedId === B && this.editor.hide(), this.layer.refresh(), this;
892
+ return this.emit($n, t), this.hoveredId = B, this.selectedId === B && this.editor.hide(), this.layer.refresh(), this;
894
893
  }
895
894
  /**
896
895
  * @method remove
@@ -898,8 +897,8 @@ class qe extends Fe {
898
897
  * Removes annotation with the given id
899
898
  */
900
899
  remove(t) {
901
- const s = this.getById(t);
902
- t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), s && this.emit(ie, s), this.layer.refresh();
900
+ const r = this.getById(t);
901
+ t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(se, r), this.layer.refresh();
903
902
  }
904
903
  /**
905
904
  * @method disableDragging
@@ -948,8 +947,8 @@ class qe extends Fe {
948
947
  }
949
948
  }
950
949
  const Te = "handle-line", Ie = "handle-start", _e = "handle-end";
951
- class Hn extends qe {
952
- constructor(t, s = {}) {
950
+ class Rn extends Be {
951
+ constructor(t, r = {}) {
953
952
  super(
954
953
  t,
955
954
  `
@@ -961,33 +960,33 @@ class Hn extends qe {
961
960
  `
962
961
  );
963
962
  // active handle id
964
- m(this, "draggedHandle", B);
965
- m(this, "start", { x: 0, y: 0 });
966
- m(this, "end", { x: 0, y: 0 });
967
- m(this, "arrow", { ...Se });
968
- m(this, "startX", 0);
969
- m(this, "startY", 0);
970
- m(this, "minArrowHeight", 0);
971
- m(this, "maxArrowHeight", 0);
972
- m(this, "handles", []);
973
- m(this, "onHandleMouseDown", (t) => {
974
- const s = this.getById(this.selectedId) || this.getById(this.hoveredId);
975
- s && (this.startDragging(s, t.clientX, t.clientY), this.draggedHandle = He(t.target));
963
+ v(this, "draggedHandle", B);
964
+ v(this, "start", { x: 0, y: 0 });
965
+ v(this, "end", { x: 0, y: 0 });
966
+ v(this, "arrow", { ...Ee });
967
+ v(this, "startX", 0);
968
+ v(this, "startY", 0);
969
+ v(this, "minArrowHeight", 0);
970
+ v(this, "maxArrowHeight", 0);
971
+ v(this, "handles", []);
972
+ v(this, "onHandleMouseDown", (t) => {
973
+ const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
974
+ r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Re(t.target));
976
975
  });
977
- m(this, "onMouseUp", () => {
978
- this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(Ot, this.arrow));
976
+ v(this, "onMouseUp", () => {
977
+ this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(Mt, this.arrow));
979
978
  });
980
- m(this, "onMouseMove", (t) => {
979
+ v(this, "onMouseMove", (t) => {
981
980
  if (!this.isDragging || this.draggedHandle === B)
982
981
  return;
983
- const s = this.handles[this.draggedHandle], a = this.ogma.view.getZoom(), c = (t.clientX - this.startX) / a, g = (t.clientY - this.startY) / a, y = s.id === Te, f = s.id === Ie, r = s.id === _e;
984
- (y || f) && Ne(this.arrow, this.start.x + c, this.start.y + g), (y || r) && $e(this.arrow, this.end.x + c, this.end.y + g), this.emit(
985
- ae,
982
+ const r = this.handles[this.draggedHandle], a = this.ogma.view.getZoom(), u = (t.clientX - this.startX) / a, p = (t.clientY - this.startY) / a, y = r.id === Te, f = r.id === Ie, s = r.id === _e;
983
+ (y || f) && Ne(this.arrow, this.start.x + u, this.start.y + p), (y || s) && He(this.arrow, this.end.x + u, this.end.y + p), this.emit(
984
+ he,
986
985
  this.arrow,
987
986
  y ? "line" : f ? "start" : "end"
988
987
  ), this.refreshEditor(), this.layer.refresh();
989
988
  });
990
- this.minArrowHeight = s.minArrowHeight || 0, this.maxArrowHeight = s.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
989
+ this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
991
990
  this.editor.element.querySelectorAll(".arrow-handle>.handle")
992
991
  ), this.handles.forEach(
993
992
  (a) => a.addEventListener("mousedown", this.onHandleMouseDown)
@@ -999,49 +998,48 @@ class Hn extends qe {
999
998
  * @param y
1000
999
  * @param arrow
1001
1000
  */
1002
- startDrawing(t, s, a = _n(t, s, t, s, Dt)) {
1001
+ startDrawing(t, r, a = Dn(t, r, t, r, Dt)) {
1002
+ var y;
1003
1003
  this.add(a), this.hoveredId = a.id;
1004
- const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: s });
1005
- this.startDragging(this.getById(a.id), c.x, c.y), this.draggedHandle = 2;
1004
+ const u = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), p = ((y = this.ogma.getContainer()) == null ? void 0 : y.getBoundingClientRect()) || { left: 0, top: 0 };
1005
+ this.startDragging(this.getById(a.id), u.x + (p == null ? void 0 : p.left), u.y + p.top), this.draggedHandle = 2;
1006
1006
  }
1007
1007
  cancelDrawing() {
1008
- this.isDragging && (this.remove(this.arrow.id), this.emit(Ot, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B);
1008
+ this.isDragging && (this.remove(this.arrow.id), this.emit(Mt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B);
1009
1009
  }
1010
- startDragging(t, s, a) {
1011
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = s, this.startY = a, this.start = _t(this.arrow), this.end = Ht(this.arrow), this.disableDragging(), this.emit(le, this.arrow), this.isDragging = !0;
1010
+ startDragging(t, r, a) {
1011
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = _t(this.arrow), this.end = Rt(this.arrow), this.disableDragging(), this.emit(ce, this.arrow), this.isDragging = !0;
1012
1012
  }
1013
- detect(t, s = 0) {
1013
+ detect(t, r = 0) {
1014
1014
  return this.elements.find((a) => {
1015
- const { start: c, end: g } = Rt(a), y = new rt(t.x, t.y).sub(
1016
- new rt((c.x + g.x) / 2, (c.y + g.y) / 2)
1017
- ), f = new rt(g.x, g.y).sub(new rt(c.x, c.y)), r = f.length(), d = f.normalize(), v = Re(a);
1018
- return Math.abs(d.dot(y)) < r / 2 + s && Math.abs(d.rotateRadians(Math.PI / 2).dot(y)) < v / 2 + s;
1015
+ const { start: u, end: p } = Ft(a), y = new rt(t.x, t.y).sub(
1016
+ new rt((u.x + p.x) / 2, (u.y + p.y) / 2)
1017
+ ), f = new rt(p.x, p.y).sub(new rt(u.x, u.y)), s = f.length(), d = f.normalize(), m = Fe(a);
1018
+ return Math.abs(d.dot(y)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(y)) < m / 2 + r;
1019
1019
  });
1020
1020
  }
1021
1021
  refreshEditor() {
1022
1022
  if (+this.selectedId < 0 && +this.hoveredId < 0)
1023
1023
  return;
1024
- const t = this.selectedId !== B ? this.getById(this.selectedId) : this.getById(this.hoveredId), { start: s, end: a } = Rt(t);
1025
- this.editor.setPosition({ x: 0, y: 0 }).setSize({ width: "100%", height: "100%" });
1026
- const [c, g, y] = Array.prototype.slice.call(
1024
+ const t = this.selectedId !== B ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Ft(t), a = this.ogma.view.graphToScreenCoordinates(r.start), u = this.ogma.view.graphToScreenCoordinates(r.end), p = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [y, f, s] = Array.prototype.slice.call(
1027
1025
  this.editor.element.querySelectorAll(".handle")
1028
1026
  );
1029
- g.style.left = `${s.x}px`, g.style.top = `${s.y}px`, y.style.left = `${a.x}px`, y.style.top = `${a.y}px`;
1030
- const f = {
1031
- x: (a.x + s.x) / 2,
1032
- y: (a.y + s.y) / 2
1033
- }, r = new rt(a.x - s.x, a.y - s.y), d = r.mul(1 / r.length()), v = Math.atan2(d.y, d.x);
1034
- c.style.width = `${r.length()}px`, c.style.left = `${f.x}px`, c.style.top = `${f.y}px`, c.style.transform = `translate(-50%, -50%) rotate(${v}rad)`;
1027
+ f.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${p})`, s.style.transform = `translate(${u.x}px, ${u.y}px) translate(-50%, -50%) scale(${p}`;
1028
+ const d = {
1029
+ x: (u.x + a.x) / 2,
1030
+ y: (u.y + a.y) / 2
1031
+ }, m = new rt(u.x - a.x, u.y - a.y), A = m.mul(1 / m.length()), I = Math.atan2(A.y, A.x);
1032
+ y.style.width = `${m.length() / p}px`, y.style.left = `${d.x}px`, y.style.top = `${d.y}px`, y.style.transform = `translate(-50%, -50%) rotate(${I}rad) scale(${p}) `;
1035
1033
  }
1036
1034
  getDefaultOptions() {
1037
- return Se;
1035
+ return Ee;
1038
1036
  }
1039
1037
  draw(t) {
1040
1038
  t.innerHTML = "";
1041
- const s = It("g");
1039
+ const r = It("g");
1042
1040
  this.elements.forEach(
1043
- (a) => zn(a, s, Dt, this.minArrowHeight, this.maxArrowHeight)
1044
- ), t.appendChild(s);
1041
+ (a) => Ln(a, r, Dt, this.minArrowHeight, this.maxArrowHeight)
1042
+ ), t.appendChild(r);
1045
1043
  }
1046
1044
  destroy() {
1047
1045
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
@@ -1055,7 +1053,7 @@ const bt = {
1055
1053
  strokeWidth: 1,
1056
1054
  strokeColor: "#000",
1057
1055
  strokeType: "plain"
1058
- }, te = {
1056
+ }, ne = {
1059
1057
  id: 0,
1060
1058
  type: "Feature",
1061
1059
  properties: {
@@ -1080,36 +1078,36 @@ const bt = {
1080
1078
  }, De = {
1081
1079
  handleSize: 3.5,
1082
1080
  placeholder: "Your text..."
1083
- }, Rn = (u = 0, l = 0, t = 100, s = 50, a = "", c = { ...bt }) => ({
1081
+ }, Fn = (c = 0, l = 0, t = 100, r = 50, a = "", u = { ...bt }) => ({
1084
1082
  id: jt(),
1085
1083
  type: "Feature",
1086
1084
  properties: {
1087
1085
  type: "text",
1088
1086
  content: a,
1089
- style: { ...bt, ...c }
1087
+ style: { ...bt, ...u }
1090
1088
  },
1091
1089
  geometry: {
1092
1090
  type: "Polygon",
1093
1091
  coordinates: [
1094
1092
  [
1095
- [u, l],
1096
- [u + t, l],
1097
- [u + t, l + s],
1098
- [u, l + s],
1099
- [u, l]
1093
+ [c, l],
1094
+ [c + t, l],
1095
+ [c + t, l + r],
1096
+ [c, l + r],
1097
+ [c, l]
1100
1098
  ]
1101
1099
  ]
1102
1100
  }
1103
1101
  });
1104
- var Be = { exports: {} };
1105
- (function(u, l) {
1106
- (function(t, s) {
1107
- u.exports = s();
1108
- })(Tn, () => (() => {
1102
+ var Ve = { exports: {} };
1103
+ (function(c, l) {
1104
+ (function(t, r) {
1105
+ c.exports = r();
1106
+ })(In, () => (() => {
1109
1107
  var t = { d: (e, n) => {
1110
1108
  for (var o in n)
1111
1109
  t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
1112
- }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, s = {};
1110
+ }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
1113
1111
  function a(e) {
1114
1112
  return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1115
1113
  return typeof n;
@@ -1117,43 +1115,43 @@ var Be = { exports: {} };
1117
1115
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1118
1116
  }, a(e);
1119
1117
  }
1120
- t.d(s, { default: () => Sn });
1121
- var c = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, g = /\bsmall-caps\b/, y = /\b(?:italic|oblique)\b/, f = /\bbold(?:er)?\b/, r = 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 };
1122
- function v(e) {
1118
+ t.d(r, { default: () => An });
1119
+ var u = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, p = /\bsmall-caps\b/, y = /\b(?:italic|oblique)\b/, f = /\bbold(?:er)?\b/, s = 13.3333333, d = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1120
+ function m(e) {
1123
1121
  var n = "", o = this;
1124
1122
  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;
1125
1123
  }
1126
- var T = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
1127
- function _(e) {
1128
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = c.exec(e);
1124
+ var A = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
1125
+ function I(e) {
1126
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = u.exec(e);
1129
1127
  n.family = (o[6] || "").trim();
1130
1128
  var i = d[o[2]] || parseFloat(o[2]);
1131
- o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= r), n.size = i;
1129
+ o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
1132
1130
  var h = parseFloat(o[4]);
1133
- if (h !== "normal" && h !== "inherit" && h ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = h * r : o[5] === "%" ? n.height = 0.01 * i : n.height = h : n.height = h * i : n.height = Math.round(i * (7 / 6)), g.test(o[1]) && (n.variant = "small-caps"), y.test(o[1]) && (n.style = "italic"), f.test(o[1]))
1131
+ if (h !== "normal" && h !== "inherit" && h ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = h * s : o[5] === "%" ? n.height = 0.01 * i : n.height = h : n.height = h * i : n.height = Math.round(i * (7 / 6)), p.test(o[1]) && (n.variant = "small-caps"), y.test(o[1]) && (n.style = "italic"), f.test(o[1]))
1134
1132
  n.weight = "bold";
1135
1133
  else {
1136
- var p = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
1137
- p >= 100 && p !== 400 && (n.weight = p);
1134
+ var g = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
1135
+ g >= 100 && g !== 400 && (n.weight = g);
1138
1136
  }
1139
1137
  return n;
1140
1138
  }
1141
- function E() {
1142
- var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = 14, w = 12, x = null, b = null, S = "";
1139
+ function k() {
1140
+ var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = 14, w = 12, x = null, b = null, S = "";
1143
1141
  if (i && i.nodeType) {
1144
- var D = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = D.getComputedStyle(i, null);
1145
- e = O.getPropertyValue("font-family") || "", w = parseFloat(O.getPropertyValue("font-size")), p = O.getPropertyValue("line-height"), x = O.getPropertyValue("font-weight"), b = O.getPropertyValue("font-style"), S = O.getPropertyValue("font-variant") || "";
1142
+ var D = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), M = D.getComputedStyle(i, null);
1143
+ e = M.getPropertyValue("font-family") || "", w = parseFloat(M.getPropertyValue("font-size")), g = M.getPropertyValue("line-height"), x = M.getPropertyValue("font-weight"), b = M.getPropertyValue("font-style"), S = M.getPropertyValue("font-variant") || "";
1146
1144
  } else if (typeof i == "string") {
1147
- var k = _(i);
1148
- e = k.family, w = k.size, p = k.height, S = k.variant, b = k.style, x = k.weight;
1145
+ var T = I(i);
1146
+ e = T.family, w = T.size, g = T.height, S = T.variant, b = T.style, x = T.weight;
1149
1147
  } else
1150
- a(i) === "object" && (e = i.family, w = i.size, p = i.height, S = i.variant, x = i.weight, b = i.style, n = i.baseline, o = i.color);
1151
- h.size && h.size < 3 && (w *= h.size), p = p !== "normal" && p ? parseFloat(p) : w * (7 / 6), h.height && h.height < 3 && (p *= h.height);
1152
- var M = Object.create(T);
1153
- return M.family = h.family || e || "sans-serif", M.height = p ?? 14, M.size = w ?? 12, M.variant = h.variant || S || "", M.style = h.style || b || "", M.weight = h.weight || x || "", M.baseline = n || 0, h.baseline != null && (M.baseline = h.baseline), M.color = h.color || o || "", M.id = v.call(M, !0), M;
1148
+ a(i) === "object" && (e = i.family, w = i.size, g = i.height, S = i.variant, x = i.weight, b = i.style, n = i.baseline, o = i.color);
1149
+ h.size && h.size < 3 && (w *= h.size), g = g !== "normal" && g ? parseFloat(g) : w * (7 / 6), h.height && h.height < 3 && (g *= h.height);
1150
+ var O = Object.create(A);
1151
+ return O.family = h.family || e || "sans-serif", O.height = g ?? 14, O.size = w ?? 12, O.variant = h.variant || S || "", O.style = h.style || b || "", O.weight = h.weight || x || "", O.baseline = n || 0, h.baseline != null && (O.baseline = h.baseline), O.color = h.color || o || "", O.id = m.call(O, !0), O;
1154
1152
  }
1155
- const P = { "\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 };
1156
- var A, U = function(e) {
1153
+ const C = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "᠎": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "​": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
1154
+ var E, U = function(e) {
1157
1155
  var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
1158
1156
  if (n && n.getContext) {
1159
1157
  var o = n.getContext("2d");
@@ -1162,20 +1160,20 @@ var Be = { exports: {} };
1162
1160
  return o.font = String(h), o.measureText(i).width;
1163
1161
  };
1164
1162
  }
1165
- }(typeof document < "u" ? document : null) || (A = {}, function(e, n) {
1166
- if (!A[n]) {
1167
- var o = E(n);
1168
- A[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1163
+ }(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
1164
+ if (!E[n]) {
1165
+ var o = k(n);
1166
+ E[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1169
1167
  }
1170
- return e.length * A[n].size;
1171
- }), N = {}, z = { trim: !0, collapse: !0 };
1172
- function W(e, n, o) {
1168
+ return e.length * E[n].size;
1169
+ }), P = {}, z = { trim: !0, collapse: !0 };
1170
+ function Z(e, n, o) {
1173
1171
  var i = Object.assign({}, z, o), h = String(e);
1174
1172
  if (!h)
1175
1173
  return 0;
1176
- if (h in P) {
1177
- var p = n.id + "/" + h;
1178
- return p in N || (N[p] = U("_".concat(h, "_"), n) - U("__", n)), N[p];
1174
+ if (h in C) {
1175
+ var g = n.id + "/" + h;
1176
+ return g in P || (P[g] = U("_".concat(h, "_"), n) - U("__", n)), P[g];
1179
1177
  }
1180
1178
  return i.trim && i.collapse ? i.trim ? h = h.trim() : i.collapse && (h = h.replace(/\s+/g, " ")) : h = h.replace(/\n/g, " "), U(h, n) + n.size * (e.tracking || 0);
1181
1179
  }
@@ -1186,17 +1184,17 @@ var Be = { exports: {} };
1186
1184
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1187
1185
  }, nt(e);
1188
1186
  }
1189
- function Ft(e, n) {
1187
+ function qt(e, n) {
1190
1188
  if (typeof n != "function" && n !== null)
1191
1189
  throw new TypeError("Super expression must either be null or a function");
1192
- e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && qt(e, n);
1190
+ e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Bt(e, n);
1193
1191
  }
1194
- function qt(e, n) {
1195
- return qt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1192
+ function Bt(e, n) {
1193
+ return Bt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1196
1194
  return o.__proto__ = i, o;
1197
- }, qt(e, n);
1195
+ }, Bt(e, n);
1198
1196
  }
1199
- function Bt(e) {
1197
+ function Vt(e) {
1200
1198
  var n = function() {
1201
1199
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
1202
1200
  return !1;
@@ -1210,16 +1208,16 @@ var Be = { exports: {} };
1210
1208
  }
1211
1209
  }();
1212
1210
  return function() {
1213
- var o, i = Mt(e);
1211
+ var o, i = Ot(e);
1214
1212
  if (n) {
1215
- var h = Mt(this).constructor;
1213
+ var h = Ot(this).constructor;
1216
1214
  o = Reflect.construct(i, arguments, h);
1217
1215
  } else
1218
1216
  o = i.apply(this, arguments);
1219
- return Ve(this, o);
1217
+ return Ue(this, o);
1220
1218
  };
1221
1219
  }
1222
- function Ve(e, n) {
1220
+ function Ue(e, n) {
1223
1221
  if (n && (nt(n) === "object" || typeof n == "function"))
1224
1222
  return n;
1225
1223
  if (n !== void 0)
@@ -1230,35 +1228,35 @@ var Be = { exports: {} };
1230
1228
  return o;
1231
1229
  }(e);
1232
1230
  }
1233
- function Mt(e) {
1234
- return Mt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1231
+ function Ot(e) {
1232
+ return Ot = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1235
1233
  return n.__proto__ || Object.getPrototypeOf(n);
1236
- }, Mt(e);
1234
+ }, Ot(e);
1237
1235
  }
1238
1236
  function zt(e, n) {
1239
1237
  if (!(e instanceof n))
1240
1238
  throw new TypeError("Cannot call a class as a function");
1241
1239
  }
1242
- function he(e, n) {
1240
+ function ue(e, n) {
1243
1241
  for (var o = 0; o < n.length; o++) {
1244
1242
  var i = n[o];
1245
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(p, w) {
1246
- if (nt(p) !== "object" || p === null)
1247
- return p;
1248
- var x = p[Symbol.toPrimitive];
1243
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(g, w) {
1244
+ if (nt(g) !== "object" || g === null)
1245
+ return g;
1246
+ var x = g[Symbol.toPrimitive];
1249
1247
  if (x !== void 0) {
1250
- var b = x.call(p, w);
1248
+ var b = x.call(g, w);
1251
1249
  if (nt(b) !== "object")
1252
1250
  return b;
1253
1251
  throw new TypeError("@@toPrimitive must return a primitive value.");
1254
1252
  }
1255
- return String(p);
1253
+ return String(g);
1256
1254
  }(i.key, "string"), nt(h) === "symbol" ? h : String(h)), i);
1257
1255
  }
1258
1256
  var h;
1259
1257
  }
1260
1258
  function Lt(e, n, o) {
1261
- return n && he(e.prototype, n), o && he(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1259
+ return n && ue(e.prototype, n), o && ue(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1262
1260
  }
1263
1261
  var H = function() {
1264
1262
  function e() {
@@ -1274,42 +1272,42 @@ var Be = { exports: {} };
1274
1272
  return this.value;
1275
1273
  } }]), e;
1276
1274
  }(), St = function(e) {
1277
- Ft(o, e);
1278
- var n = Bt(o);
1275
+ qt(o, e);
1276
+ var n = Vt(o);
1279
1277
  function o() {
1280
1278
  return zt(this, o), n.apply(this, arguments);
1281
1279
  }
1282
1280
  return Lt(o);
1283
1281
  }(H), tt = function(e) {
1284
- Ft(o, e);
1285
- var n = Bt(o);
1282
+ qt(o, e);
1283
+ var n = Vt(o);
1286
1284
  function o() {
1287
1285
  return zt(this, o), n.apply(this, arguments);
1288
1286
  }
1289
1287
  return Lt(o);
1290
1288
  }(H), ft = function(e) {
1291
- Ft(o, e);
1292
- var n = Bt(o);
1289
+ qt(o, e);
1290
+ var n = Vt(o);
1293
1291
  function o() {
1294
1292
  return zt(this, o), n.apply(this, arguments);
1295
1293
  }
1296
1294
  return Lt(o);
1297
- }(H), Vt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ue = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, ue = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ye = /^(?:[;\xAD%?…]|,(?!\d))/, Xe = /^[´±°¢£¤$¥\u2212]/;
1298
- function Pt(e, n) {
1295
+ }(H), Ut = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ye = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, de = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Xe = /^(?:[;\xAD%?…]|,(?!\d))/, Ge = /^[´±°¢£¤$¥\u2212]/;
1296
+ function Ct(e, n) {
1299
1297
  n !== !1 && (e = e.trim());
1300
- for (var o, i, h = [], p = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
1298
+ for (var o, i, h = [], g = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
1301
1299
  o = e.charAt(x), i = e.charAt(x + 1);
1302
- var S = Vt.test(p), D = Vt.test(o), O = D || S, k = void 0;
1303
- if ((Xe.test(o) && !ue.test(p) || Ye.test(p + i) && !ue.test(o)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((k = Vt.test(e.charAt(x - 2))) && !D && (O = !1), !k && Ue.test(o + i) && (O = !0)), O) {
1304
- var M = e.slice(w, x);
1305
- /\u00AD$/.test(M) ? (h.push(new H(M.slice(0, -1))), h.push(new ft())) : (h.push(new H(M)), h.push(new St())), w = x;
1300
+ var S = Ut.test(g), D = Ut.test(o), M = D || S, T = void 0;
1301
+ if ((Ge.test(o) && !de.test(g) || Xe.test(g + i) && !de.test(o)) && (M = !0), g !== "-" && g !== "‐" && g !== "–" && g !== "—" || ((T = Ut.test(e.charAt(x - 2))) && !D && (M = !1), !T && Ye.test(o + i) && (M = !0)), M) {
1302
+ var O = e.slice(w, x);
1303
+ /\u00AD$/.test(O) ? (h.push(new H(O.slice(0, -1))), h.push(new ft())) : (h.push(new H(O)), h.push(new St())), w = x;
1306
1304
  }
1307
- p = o;
1305
+ g = o;
1308
1306
  }
1309
1307
  return h.push(new H(e.slice(w))), h;
1310
1308
  }
1311
- const ce = { 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: "›" };
1312
- var Ge = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, We = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Ze = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Ke = /^<!--(.+?)-->/, Je = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, de = { b: function(e) {
1309
+ const fe = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "­", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "‌", zwj: "‍", lrm: "‎", rlm: "‏", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
1310
+ var Ze = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, We = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Ke = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Je = /^<!--(.+?)-->/, Qe = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, pe = { b: function(e) {
1313
1311
  e.weight = "bold";
1314
1312
  }, strong: function(e) {
1315
1313
  e.weight = "bold";
@@ -1335,26 +1333,26 @@ var Be = { exports: {} };
1335
1333
  e.sub = !0;
1336
1334
  }, sup: function(e) {
1337
1335
  e.sup = !0;
1338
- } }, Qe = { 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 };
1339
- function fe(e) {
1340
- return e.replace(Je, function(n, o, i, h) {
1336
+ } }, tn = { 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 };
1337
+ function ge(e) {
1338
+ return e.replace(Qe, function(n, o, i, h) {
1341
1339
  if (o || i) {
1342
- var p = o ? 10 : 16;
1343
- return String.fromCharCode(parseInt(o || i, p));
1340
+ var g = o ? 10 : 16;
1341
+ return String.fromCharCode(parseInt(o || i, g));
1344
1342
  }
1345
- return h in ce ? ce[h] : n;
1343
+ return h in fe ? fe[h] : n;
1346
1344
  });
1347
1345
  }
1348
- function tn(e) {
1346
+ function en(e) {
1349
1347
  return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
1350
1348
  }
1351
- var en = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1352
- function nn(e) {
1349
+ var nn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1350
+ function rn(e) {
1353
1351
  var n, o = {};
1354
1352
  if (e) {
1355
1353
  do
1356
- if (n = en.exec(e)) {
1357
- var i = fe(tn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1354
+ if (n = nn.exec(e)) {
1355
+ var i = ge(en(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1358
1356
  if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
1359
1357
  throw new Error("Attribute error");
1360
1358
  }
@@ -1364,8 +1362,8 @@ var Be = { exports: {} };
1364
1362
  }
1365
1363
  return o;
1366
1364
  }
1367
- const pe = { 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: "Þ" };
1368
- var rn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, sn = /^%[^\n]+(?:\n|$)/, on = /^[^#$%&~_^\\{}]+/, an = /^\\([&{}$%#_])/, ln = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, hn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, V = { bf: function(e) {
1365
+ const ye = { 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: "Þ" };
1366
+ var sn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, on = /^%[^\n]+(?:\n|$)/, an = /^[^#$%&~_^\\{}]+/, ln = /^\\([&{}$%#_])/, hn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, cn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, V = { bf: function(e) {
1369
1367
  e.weight = "bold";
1370
1368
  }, it: function(e) {
1371
1369
  e.style = "italic";
@@ -1388,126 +1386,126 @@ var Be = { exports: {} };
1388
1386
  } };
1389
1387
  V.textsuperscript = V["^"], V.textsubscript = V._, V.textsl = V.sl, V.mathbf = V.bf, V.mathit = V.it, V.textbf = V.bf, V.textit = V.it, V.textcolor = V.color;
1390
1388
  var un = /[\r\n\xA0]+/g;
1391
- function cn(e, n) {
1389
+ function dn(e, n) {
1392
1390
  e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
1393
1391
  var o = n;
1394
- return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = E(n, e)), o;
1392
+ return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = k(n, e)), o;
1395
1393
  }
1396
- function ge(e, n, o) {
1397
- for (var i, h, p = e.width; p + o.width > n && e.length; )
1398
- h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = W(i, i.font), p += i.width) : e.pop(), p -= h;
1399
- e[e.length - 1] instanceof ft && e.pop(), i = e[e.length - 1] || i || {}, o.font = E(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);
1394
+ function me(e, n, o) {
1395
+ for (var i, h, g = e.width; g + o.width > n && e.length; )
1396
+ h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = Z(i, i.font), g += i.width) : e.pop(), g -= h;
1397
+ e[e.length - 1] instanceof ft && e.pop(), i = e[e.length - 1] || i || {}, o.font = k(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);
1400
1398
  }
1401
1399
  function mt(e) {
1402
1400
  return Math.round(1e6 * e) / 1e6;
1403
1401
  }
1404
- function ye(e) {
1402
+ function ve(e) {
1405
1403
  return function(n) {
1406
1404
  if (Array.isArray(n))
1407
- return Ut(n);
1405
+ return Yt(n);
1408
1406
  }(e) || function(n) {
1409
1407
  if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
1410
1408
  return Array.from(n);
1411
1409
  }(e) || function(n, o) {
1412
1410
  if (n) {
1413
1411
  if (typeof n == "string")
1414
- return Ut(n, o);
1412
+ return Yt(n, o);
1415
1413
  var i = Object.prototype.toString.call(n).slice(8, -1);
1416
- 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) ? Ut(n, o) : void 0;
1414
+ return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? Yt(n, o) : void 0;
1417
1415
  }
1418
1416
  }(e) || function() {
1419
1417
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1420
1418
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1421
1419
  }();
1422
1420
  }
1423
- function Ut(e, n) {
1421
+ function Yt(e, n) {
1424
1422
  (n == null || n > e.length) && (n = e.length);
1425
1423
  for (var o = 0, i = new Array(n); o < n; o++)
1426
1424
  i[o] = e[o];
1427
1425
  return i;
1428
1426
  }
1429
- var dn = { center: "middle", right: "end" }, fn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Yt = function(e, n) {
1427
+ var fn = { center: "middle", right: "end" }, pn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Xt = function(e, n) {
1430
1428
  return !e && !n || e === n;
1431
1429
  };
1432
- function pn(e, n) {
1433
- var o = [], i = n.font(), h = i.size, p = i.family, w = n.align(), x = n.createElement();
1430
+ function gn(e, n) {
1431
+ var o = [], i = n.font(), h = i.size, g = i.family, w = n.align(), x = n.createElement();
1434
1432
  if (e.length) {
1435
- var b = i.height, S = n.valign(), D = n.height()(), O = n.width()(0), k = !isFinite(O) && e.length === 1, M = k ? null : n.x(), R = mt(b / h), K = k ? null : mt(b / (1.15 * h + (b - h) / 2));
1436
- if (fn[S] && isFinite(D)) {
1437
- var C = S === "bottom" ? 1 : 0.5;
1438
- K += (D * C - b * e.length * C) / h;
1433
+ var b = i.height, S = n.valign(), D = n.height()(), M = n.width()(0), T = !isFinite(M) && e.length === 1, O = T ? null : n.x(), R = mt(b / h), K = T ? null : mt(b / (1.15 * h + (b - h) / 2));
1434
+ if (pn[S] && isFinite(D)) {
1435
+ var $ = S === "bottom" ? 1 : 0.5;
1436
+ K += (D * $ - b * e.length * $) / h;
1439
1437
  }
1440
- var L = w === "justify", j = 0;
1441
- w === "right" ? j = O : w === "center" && (j = O / 2);
1442
- for (var $ = [], J = "tspan", Y = null, F = "", I = function() {
1443
- if (F) {
1444
- var pt = x(J, Y, F);
1445
- $.push(pt);
1438
+ var L = w === "justify", F = 0;
1439
+ w === "right" ? F = M : w === "center" && (F = M / 2);
1440
+ for (var N = [], J = "tspan", Y = null, j = "", _ = function() {
1441
+ if (j) {
1442
+ var pt = x(J, Y, j);
1443
+ N.push(pt);
1446
1444
  }
1447
- J = "tspan", Y = null, F = "";
1445
+ J = "tspan", Y = null, j = "";
1448
1446
  }, et = 0, Q = e.length; et < Q; et++) {
1449
- var ot = "", ht = "", st = 0, at = e[et];
1447
+ var ot = "", ct = "", st = 0, at = e[et];
1450
1448
  if (at.length) {
1451
- $ = [];
1452
- for (var vt = 0, kt = 0, lt = void 0, X = 0, Ct = at.length; X < Ct; X++) {
1449
+ N = [];
1450
+ for (var vt = 0, kt = 0, lt = void 0, X = 0, $t = at.length; X < $t; X++) {
1453
1451
  var q = at[X], G = q.font;
1454
- q.whitespace && vt++, kt += q.width, X && !q.tracking && !st && Yt(G.id, ot) && Yt(q.class, ht) && Yt(lt, q.href) ? F += q.value : (I(), F = q.value, Y = { fontFamily: G.family !== p ? G.family : null, fontSize: G.size !== h ? G.size : null, fontWeight: G.weight || null, fontStyle: G.style || null, fontVariant: G.variant !== "normal" && G.variant || null, fill: G.color || null, baselineShift: G.baseline ? 100 * G.baseline + "%" : null, className: q.class || null }, st && (Y.dx = mt(st), st = 0), q.tracking && (st = G.size * q.tracking), q.href && !lt ? (lt = q.href, J = "a", Y.href = lt, Y.rel = q.rel, Y.target = q.target) : lt = null, ot = G.id, ht = q.class);
1452
+ q.whitespace && vt++, kt += q.width, X && !q.tracking && !st && Xt(G.id, ot) && Xt(q.class, ct) && Xt(lt, q.href) ? j += q.value : (_(), j = q.value, Y = { fontFamily: G.family !== g ? G.family : null, fontSize: G.size !== h ? G.size : null, fontWeight: G.weight || null, fontStyle: G.style || null, fontVariant: G.variant !== "normal" && G.variant || null, fill: G.color || null, baselineShift: G.baseline ? 100 * G.baseline + "%" : null, className: q.class || null }, st && (Y.dx = mt(st), st = 0), q.tracking && (st = G.size * q.tracking), q.href && !lt ? (lt = q.href, J = "a", Y.href = lt, Y.rel = q.rel, Y.target = q.target) : lt = null, ot = G.id, ct = q.class);
1455
1453
  }
1456
- if (I(), k)
1457
- o.push.apply(o, ye($));
1454
+ if (_(), T)
1455
+ o.push.apply(o, ve(N));
1458
1456
  else {
1459
- var Nt = null, Tt = et === Q - 1 || at[at.length - 1] instanceof tt;
1460
- L && at.length > 1 && !Tt && (Nt = mt((O - kt) / vt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Nt, x: M(et) + j, dy: mt(et ? R : K) + "em" }].concat(ye($))));
1457
+ var Pt = null, Tt = et === Q - 1 || at[at.length - 1] instanceof tt;
1458
+ L && at.length > 1 && !Tt && (Pt = mt((M - kt) / vt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Pt, x: O(et) + F, dy: mt(et ? R : K) + "em" }].concat(ve(N))));
1461
1459
  }
1462
1460
  } else
1463
- o.push(x("tspan", { x: M(et), dy: mt(et ? R : K) + "em" }, " "));
1461
+ o.push(x("tspan", { x: O(et), dy: mt(et ? R : K) + "em" }, " "));
1464
1462
  }
1465
1463
  }
1466
- return x.apply(void 0, ["text", { fontFamily: p, fontSize: h, textAnchor: dn[w] || "start" }].concat(o));
1464
+ return x.apply(void 0, ["text", { fontFamily: g, fontSize: h, textAnchor: fn[w] || "start" }].concat(o));
1467
1465
  }
1468
- var gn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1469
- function yn(e, n, o) {
1466
+ var yn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1467
+ function mn(e, n, o) {
1470
1468
  if (e.length) {
1471
1469
  o.textBaseline = "middle";
1472
- var i = n.font(), h = i.height, p = i.size, w = n.valign(), x = n.height()(), b = n.width()(0), S = n.align(), D = S === "justify", O = 0.5 * h, k = gn[w];
1473
- if (k && isFinite(x)) {
1474
- var M = e.length * h;
1475
- O += x * k - M * k;
1470
+ var i = n.font(), h = i.height, g = i.size, w = n.valign(), x = n.height()(), b = n.width()(0), S = n.align(), D = S === "justify", M = 0.5 * h, T = yn[w];
1471
+ if (T && isFinite(x)) {
1472
+ var O = e.length * h;
1473
+ M += x * T - O * T;
1476
1474
  }
1477
1475
  e.forEach(function(R, K) {
1478
- var C = n.x()(K), L = K * h + O, j = 0, $ = 0;
1479
- R.forEach(function(F) {
1480
- F.whitespace && j++, $ += F.width;
1476
+ var $ = n.x()(K), L = K * h + M, F = 0, N = 0;
1477
+ R.forEach(function(j) {
1478
+ j.whitespace && F++, N += j.width;
1481
1479
  });
1482
1480
  var J = 0, Y = K === e.length - 1 || R[R.length - 1] instanceof tt;
1483
- D && R.length > 1 && !Y && (J = (b - $) / j), R.forEach(function(F) {
1484
- o.font = F.font;
1485
- var I = F.font, et = I.baseline ? p * -I.baseline + 0.15 * p : 0;
1486
- o.fillStyle = function(ht, st) {
1487
- return ht.color ? ht.color : st.href ? "#00C" : "#000";
1488
- }(I, F);
1481
+ D && R.length > 1 && !Y && (J = (b - N) / F), R.forEach(function(j) {
1482
+ o.font = j.font;
1483
+ var _ = j.font, et = _.baseline ? g * -_.baseline + 0.15 * g : 0;
1484
+ o.fillStyle = function(ct, st) {
1485
+ return ct.color ? ct.color : st.href ? "#00C" : "#000";
1486
+ }(_, j);
1489
1487
  var Q = 0;
1490
- if (S === "right" ? Q += b - $ : S === "center" ? Q += b / 2 - $ / 2 : S === "justify" && (F.whitespace || F instanceof tt) && (C += J), o.fillText(F.value, C + Q, L + et), F.href) {
1488
+ if (S === "right" ? Q += b - N : S === "center" ? Q += b / 2 - N / 2 : S === "justify" && (j.whitespace || j instanceof tt) && ($ += J), o.fillText(j.value, $ + Q, L + et), j.href) {
1491
1489
  o.beginPath(), o.strokeStyle = o.fillStyle;
1492
- var ot = Math.floor(L + 0.45 * p) + 0.5;
1493
- o.moveTo(C + Q, ot), o.lineTo(C + Q + F.width, ot), o.stroke();
1490
+ var ot = Math.floor(L + 0.45 * g) + 0.5;
1491
+ o.moveTo($ + Q, ot), o.lineTo($ + Q + j.width, ot), o.stroke();
1494
1492
  }
1495
- C += F.width;
1493
+ $ += j.width;
1496
1494
  });
1497
1495
  });
1498
1496
  }
1499
1497
  }
1500
- function Xt(e) {
1501
- return Xt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1498
+ function Gt(e) {
1499
+ return Gt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1502
1500
  return typeof n;
1503
1501
  } : function(n) {
1504
1502
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1505
- }, Xt(e);
1503
+ }, Gt(e);
1506
1504
  }
1507
- function me(e) {
1505
+ function xe(e) {
1508
1506
  for (var n = {}, o = 0; o < e.length; o++) {
1509
1507
  var i = e[o];
1510
- typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : Xt(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));
1508
+ typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : Gt(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));
1511
1509
  }
1512
1510
  return n;
1513
1511
  }
@@ -1518,32 +1516,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1518
1516
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1519
1517
  }, At(e);
1520
1518
  }
1521
- function mn(e, n) {
1519
+ function vn(e, n) {
1522
1520
  for (var o = 0; o < n.length; o++) {
1523
1521
  var i = n[o];
1524
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(p, w) {
1525
- if (At(p) !== "object" || p === null)
1526
- return p;
1527
- var x = p[Symbol.toPrimitive];
1522
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(g, w) {
1523
+ if (At(g) !== "object" || g === null)
1524
+ return g;
1525
+ var x = g[Symbol.toPrimitive];
1528
1526
  if (x !== void 0) {
1529
- var b = x.call(p, w);
1527
+ var b = x.call(g, w);
1530
1528
  if (At(b) !== "object")
1531
1529
  return b;
1532
1530
  throw new TypeError("@@toPrimitive must return a primitive value.");
1533
1531
  }
1534
- return String(p);
1532
+ return String(g);
1535
1533
  }(i.key, "string"), At(h) === "symbol" ? h : String(h)), i);
1536
1534
  }
1537
1535
  var h;
1538
1536
  }
1539
- var vn = E(), Gt = function(e) {
1537
+ var xn = k(), Zt = function(e) {
1540
1538
  return typeof e == "function" ? e : function() {
1541
1539
  return e;
1542
1540
  };
1543
1541
  }, it = function() {
1544
1542
  function e(i) {
1545
- if (function(p, w) {
1546
- if (!(p instanceof w))
1543
+ if (function(g, w) {
1544
+ if (!(g instanceof w))
1547
1545
  throw new TypeError("Cannot call a class as a function");
1548
1546
  }(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
1549
1547
  return 1 / 0;
@@ -1557,80 +1555,80 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1557
1555
  }
1558
1556
  var n, o;
1559
1557
  return n = e, o = [{ key: "linebreak", value: function(i) {
1560
- var h = this, p = this.props.parser(String(i)), w = this.font(), x = function(b, S, D) {
1558
+ var h = this, g = this.props.parser(String(i)), w = this.font(), x = function(b, S, D) {
1561
1559
  if (!b.length)
1562
1560
  return [];
1563
- var O = S.height(), k = S.width(), M = S.overflowLine(), R = S.overflowWrap(), K = E(D, !0, !1), C = isFinite(O()) ? Math.floor(O() / D.height) : 1 / 0;
1564
- if (!O() && !k(0) || !C)
1561
+ var M = S.height(), T = S.width(), O = S.overflowLine(), R = S.overflowWrap(), K = k(D, !0, !1), $ = isFinite(M()) ? Math.floor(M() / D.height) : 1 / 0;
1562
+ if (!M() && !T(0) || !$)
1565
1563
  return [];
1566
- for (var L = 0, j = 0, $ = 0, J = [], Y = [], F = !1; L < b.length && j < C; ) {
1567
- var I = b[L], et = cn(I, D);
1568
- if (I.width = W(I, et), I.font = et, I.line = j, I.whitespace = I.value in P, I.value && (I.value = I.value.replace(un, " ")), !(!$ && I.whitespace || F && I.whitespace))
1569
- if (I instanceof tt)
1570
- $ = 0, Y = [], J.push(L + 1), j++;
1571
- else if (I instanceof St || I instanceof ft)
1572
- Y.push({ index: L, width: $ });
1573
- else if (I.whitespace || $ + I.width < k(j))
1574
- $ += I.width;
1564
+ for (var L = 0, F = 0, N = 0, J = [], Y = [], j = !1; L < b.length && F < $; ) {
1565
+ var _ = b[L], et = dn(_, D);
1566
+ if (_.width = Z(_, et), _.font = et, _.line = F, _.whitespace = _.value in C, _.value && (_.value = _.value.replace(un, " ")), !(!N && _.whitespace || j && _.whitespace))
1567
+ if (_ instanceof tt)
1568
+ N = 0, Y = [], J.push(L + 1), F++;
1569
+ else if (_ instanceof St || _ instanceof ft)
1570
+ Y.push({ index: L, width: N });
1571
+ else if (_.whitespace || N + _.width < T(F))
1572
+ N += _.width;
1575
1573
  else if (Y.length) {
1576
1574
  var Q = void 0, ot = void 0;
1577
1575
  do {
1578
1576
  ot = !0, Q = Y.pop();
1579
- var ht = b[Q.index], st = void 0;
1580
- ht instanceof ft && (st = W("-", ht.font), Q.width + st > k(j) && (ot = !Y.length));
1577
+ var ct = b[Q.index], st = void 0;
1578
+ ct instanceof ft && (st = Z("-", ct.font), Q.width + st > T(F) && (ot = !Y.length));
1581
1579
  } while (!ot);
1582
- J.push(Q.index + 1), $ = 0, j++, L = Q.index, Y = [];
1580
+ J.push(Q.index + 1), N = 0, F++, L = Q.index, Y = [];
1583
1581
  } else if (R === "break-word") {
1584
- var at = k(j);
1585
- if ($ + I.width > at) {
1586
- var vt = I.clone();
1582
+ var at = T(F);
1583
+ if (N + _.width > at) {
1584
+ var vt = _.clone();
1587
1585
  do
1588
- I.value = I.value.slice(0, -1), I.width = W(I, I.font), $ += I.width;
1589
- while (I.value && I.width > at);
1590
- vt.value = vt.value.slice(I.value.length), b.splice(L + 1, 0, new St(), vt);
1586
+ _.value = _.value.slice(0, -1), _.width = Z(_, _.font), N += _.width;
1587
+ while (_.value && _.width > at);
1588
+ vt.value = vt.value.slice(_.value.length), b.splice(L + 1, 0, new St(), vt);
1591
1589
  }
1592
- J.push(L + 1), $ = 0, j++;
1590
+ J.push(L + 1), N = 0, F++;
1593
1591
  } else
1594
- $ += I.width;
1595
- L++, F = I.whitespace;
1592
+ N += _.width;
1593
+ L++, j = _.whitespace;
1596
1594
  }
1597
1595
  L !== J[J.length - 1] && J.push(L);
1598
1596
  var kt = 0, lt = 0, X = J.map(function(pt) {
1599
- for (var Z, gt = kt; (Z = b[gt]) && (Z.whitespace || !Z.value); )
1597
+ for (var W, gt = kt; (W = b[gt]) && (W.whitespace || !W.value); )
1600
1598
  gt++;
1601
- for (var ut = pt, Kt = null; ut > gt && (Z = b[ut - 1]) && (Z.whitespace || !(Z.value || Z instanceof ft)); )
1602
- Z instanceof tt && (Kt = Z), ut--;
1603
- Z instanceof ft && (Z.value = "-", Z.width = W("-", Z.font)), kt = pt;
1604
- var xt = b.slice(gt, ut).filter(function(Jt) {
1605
- return Jt.value;
1599
+ for (var ut = pt, Jt = null; ut > gt && (W = b[ut - 1]) && (W.whitespace || !(W.value || W instanceof ft)); )
1600
+ W instanceof tt && (Jt = W), ut--;
1601
+ W instanceof ft && (W.value = "-", W.width = Z("-", W.font)), kt = pt;
1602
+ var xt = b.slice(gt, ut).filter(function(Qt) {
1603
+ return Qt.value;
1606
1604
  });
1607
- return Kt && xt.push(Kt), xt.width = xt.reduce(function(Jt, An) {
1608
- return Jt + An.width;
1605
+ return Jt && xt.push(Jt), xt.width = xt.reduce(function(Qt, En) {
1606
+ return Qt + En.width;
1609
1607
  }, 0), xt.width > lt && (lt = xt.width), xt;
1610
1608
  });
1611
- if (X.hasLineOverflow = !1, M) {
1612
- var Ct = M === "ellipsis" ? "…" : M;
1613
- X.forEach(function(pt, Z) {
1614
- var gt = k(Z);
1609
+ if (X.hasLineOverflow = !1, O) {
1610
+ var $t = O === "ellipsis" ? "…" : O;
1611
+ X.forEach(function(pt, W) {
1612
+ var gt = T(W);
1615
1613
  if (pt.width > gt) {
1616
- var ut = new H(Ct);
1617
- ut.font = D, ut.width = W(Ct, K), ge(pt, gt, ut), X.hasLineOverflow = !0;
1614
+ var ut = new H($t);
1615
+ ut.font = D, ut.width = Z($t, K), me(pt, gt, ut), X.hasLineOverflow = !0;
1618
1616
  }
1619
1617
  });
1620
1618
  }
1621
1619
  var q = S.overflow() === "ellipsis" ? "…" : S.overflow();
1622
1620
  if (q && L !== b.length) {
1623
- var G = k(X.length - 1), Nt = X[X.length - 1], Tt = new H(q);
1624
- Tt.font = D, Tt.width = W(q, K), ge(Nt, G, Tt), X.hasOverflow = !0;
1621
+ var G = T(X.length - 1), Pt = X[X.length - 1], Tt = new H(q);
1622
+ Tt.font = D, Tt.width = Z(q, K), me(Pt, G, Tt), X.hasOverflow = !0;
1625
1623
  } else
1626
1624
  X.hasOverflow = !1;
1627
1625
  return X.font = D, X.width = lt, X;
1628
- }(p, this, w);
1626
+ }(g, this, w);
1629
1627
  return x.height = x.length * w.height, x.render = function(b) {
1630
1628
  return h.render(x, b);
1631
1629
  }, x.svg = x.render, x.draw = x.render, x;
1632
1630
  } }, { key: "font", value: function(i) {
1633
- return arguments.length ? (this.props.font = E(i), this) : this.props.font || E(vn);
1631
+ return arguments.length ? (this.props.font = k(i), this) : this.props.font || k(xn);
1634
1632
  } }, { key: "overflow", value: function(i) {
1635
1633
  return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
1636
1634
  } }, { key: "overflowLine", value: function(i) {
@@ -1648,11 +1646,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1648
1646
  var h = String(i).toLowerCase();
1649
1647
  return h === "break-word" ? this.props.overflowWrap = "break-word" : h !== "normal" && i != null || (this.props.overflowWrap = null), this;
1650
1648
  } }, { key: "width", value: function(i) {
1651
- return arguments.length ? (this.props.width = Gt(i), this) : this.props.width;
1649
+ return arguments.length ? (this.props.width = Zt(i), this) : this.props.width;
1652
1650
  } }, { key: "height", value: function(i) {
1653
- return arguments.length ? (this.props.height = Gt(i), this) : this.props.height;
1651
+ return arguments.length ? (this.props.height = Zt(i), this) : this.props.height;
1654
1652
  } }, { key: "x", value: function(i) {
1655
- return arguments.length ? (this.props.x = Gt(i), this) : this.props.x;
1653
+ return arguments.length ? (this.props.x = Zt(i), this) : this.props.x;
1656
1654
  } }, { key: "parser", value: function(i) {
1657
1655
  if (!arguments.length)
1658
1656
  return this.props.parser;
@@ -1666,9 +1664,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1666
1664
  } }, { key: "createElement", value: function(i) {
1667
1665
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1668
1666
  } }, { key: "render", value: function() {
1669
- var i = me(arguments);
1670
- return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? yn(i.text, this, i.ctx) : pn(i.text, this);
1671
- } }], o && mn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1667
+ var i = xe(arguments);
1668
+ return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? mn(i.text, this, i.ctx) : gn(i.text, this);
1669
+ } }], o && vn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1672
1670
  }();
1673
1671
  function Et(e) {
1674
1672
  return Et = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
@@ -1683,32 +1681,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1683
1681
  i[o] = e[o];
1684
1682
  return i;
1685
1683
  }
1686
- function xn(e, n) {
1684
+ function wn(e, n) {
1687
1685
  for (var o = 0; o < n.length; o++) {
1688
1686
  var i = n[o];
1689
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(p, w) {
1690
- if (Et(p) !== "object" || p === null)
1691
- return p;
1692
- var x = p[Symbol.toPrimitive];
1687
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(g, w) {
1688
+ if (Et(g) !== "object" || g === null)
1689
+ return g;
1690
+ var x = g[Symbol.toPrimitive];
1693
1691
  if (x !== void 0) {
1694
- var b = x.call(p, w);
1692
+ var b = x.call(g, w);
1695
1693
  if (Et(b) !== "object")
1696
1694
  return b;
1697
1695
  throw new TypeError("@@toPrimitive must return a primitive value.");
1698
1696
  }
1699
- return String(p);
1697
+ return String(g);
1700
1698
  }(i.key, "string"), Et(h) === "symbol" ? h : String(h)), i);
1701
1699
  }
1702
1700
  var h;
1703
1701
  }
1704
- var ve = function(e) {
1702
+ var we = function(e) {
1705
1703
  return typeof e == "function" ? e : function() {
1706
1704
  return e;
1707
1705
  };
1708
- }, xe = function() {
1706
+ }, be = function() {
1709
1707
  function e(i) {
1710
- if (function(p, w) {
1711
- if (!(p instanceof w))
1708
+ if (function(g, w) {
1709
+ if (!(g instanceof w))
1712
1710
  throw new TypeError("Cannot call a class as a function");
1713
1711
  }(this, e), this.props = { width: function() {
1714
1712
  return 1 / 0;
@@ -1721,9 +1719,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1721
1719
  }
1722
1720
  var n, o;
1723
1721
  return n = e, o = [{ key: "anchor", value: function(i) {
1724
- var h = this.props, p = h.hAnchor, w = h.vAnchor, x = h.width, b = h.height;
1722
+ var h = this.props, g = h.hAnchor, w = h.vAnchor, x = h.width, b = h.height;
1725
1723
  if (!arguments.length)
1726
- return [p * x(0), w * b(0)];
1724
+ return [g * x(0), w * b(0)];
1727
1725
  if (typeof i == "string") {
1728
1726
  var S = this.props;
1729
1727
  i.toLowerCase().trim().split(/\s+/).forEach(function(D) {
@@ -1732,34 +1730,34 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1732
1730
  }
1733
1731
  return this;
1734
1732
  } }, { key: "width", value: function(i) {
1735
- return arguments.length ? (this.props.width = ve(i), this) : this.props.width;
1733
+ return arguments.length ? (this.props.width = we(i), this) : this.props.width;
1736
1734
  } }, { key: "height", value: function(i) {
1737
- return arguments.length ? (this.props.height = ve(i), this) : this.props.height;
1735
+ return arguments.length ? (this.props.height = we(i), this) : this.props.height;
1738
1736
  } }, { key: "rotate", value: function(i) {
1739
1737
  return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
1740
1738
  } }, { key: "createElement", value: function(i) {
1741
1739
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1742
1740
  } }, { key: "canvas", value: function(i, h) {
1743
- var p, w = i.getContext ? i.getContext("2d") : i;
1741
+ var g, w = i.getContext ? i.getContext("2d") : i;
1744
1742
  return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
1745
1743
  if (Array.isArray(x))
1746
1744
  return Wt(x);
1747
- }(p = this.anchor()) || function(x) {
1745
+ }(g = this.anchor()) || function(x) {
1748
1746
  if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
1749
1747
  return Array.from(x);
1750
- }(p) || function(x, b) {
1748
+ }(g) || function(x, b) {
1751
1749
  if (x) {
1752
1750
  if (typeof x == "string")
1753
1751
  return Wt(x, b);
1754
1752
  var S = Object.prototype.toString.call(x).slice(8, -1);
1755
1753
  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) ? Wt(x, b) : void 0;
1756
1754
  }
1757
- }(p) || function() {
1755
+ }(g) || function() {
1758
1756
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1759
1757
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1760
1758
  }()), h(w), w.restore(), w;
1761
1759
  } }, { key: "render", value: function() {
1762
- var i = me(arguments);
1760
+ var i = xe(arguments);
1763
1761
  if (i.d3)
1764
1762
  return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1765
1763
  if (i.ctx)
@@ -1768,59 +1766,59 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1768
1766
  var h = typeof i.text.render == "function" ? i.text.render() : i.text;
1769
1767
  return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, h);
1770
1768
  }
1771
- } }], o && xn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1772
- }(), wn = Object.prototype.hasOwnProperty, Zt = {};
1773
- function bn(e) {
1774
- return Zt[e] || (Zt[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
1769
+ } }], o && wn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1770
+ }(), bn = Object.prototype.hasOwnProperty, Kt = {};
1771
+ function Sn(e) {
1772
+ return Kt[e] || (Kt[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
1775
1773
  return o + "-" + i.toLowerCase();
1776
- })), Zt[e];
1774
+ })), Kt[e];
1777
1775
  }
1778
- function we(e, n) {
1776
+ function Se(e, n) {
1779
1777
  if (Array.isArray(n))
1780
1778
  return n.forEach(function(o) {
1781
- return we(e, o);
1779
+ return Se(e, o);
1782
1780
  });
1783
1781
  typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1784
1782
  }
1785
- function be(e, n) {
1783
+ function Ae(e, n) {
1786
1784
  if (typeof document < "u") {
1787
1785
  var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1788
1786
  if (n && o.setAttribute)
1789
1787
  for (var i in n)
1790
- wn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : bn(i), n[i]);
1791
- for (var h = arguments.length, p = new Array(h > 2 ? h - 2 : 0), w = 2; w < h; w++)
1792
- p[w - 2] = arguments[w];
1793
- return p != null && p.length && p.forEach(function(x) {
1794
- we(o, x);
1788
+ bn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : Sn(i), n[i]);
1789
+ for (var h = arguments.length, g = new Array(h > 2 ? h - 2 : 0), w = 2; w < h; w++)
1790
+ g[w - 2] = arguments[w];
1791
+ return g != null && g.length && g.forEach(function(x) {
1792
+ Se(o, x);
1795
1793
  }), o;
1796
1794
  }
1797
1795
  }
1798
- it.createElement = be, it.textparser = Pt, it.defaultparser = Pt, it.htmlparser = function(e) {
1796
+ it.createElement = Ae, it.textparser = Ct, it.defaultparser = Ct, it.htmlparser = function(e) {
1799
1797
  e = String(e || "").trim();
1800
- for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, h = [], p = [], w = function(O) {
1801
- for (var k in i)
1802
- i[k] && (O[k] = i[k]);
1803
- h.push(O);
1804
- }, x = function(O) {
1805
- var k = h.length, M = Qe[O];
1806
- if (k && M) {
1807
- for (var R = k - 1; h[R] && (h[R] instanceof St || Ge.test(h[R].value)); )
1798
+ for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, h = [], g = [], w = function(M) {
1799
+ for (var T in i)
1800
+ i[T] && (M[T] = i[T]);
1801
+ h.push(M);
1802
+ }, x = function(M) {
1803
+ var T = h.length, O = tn[M];
1804
+ if (T && O) {
1805
+ for (var R = T - 1; h[R] && (h[R] instanceof St || Ze.test(h[R].value)); )
1808
1806
  R--;
1809
- for (; M && h[R] && h[R] instanceof tt; )
1810
- R--, M--;
1811
- for (; M-- > 0; )
1807
+ for (; O && h[R] && h[R] instanceof tt; )
1808
+ R--, O--;
1809
+ for (; O-- > 0; )
1812
1810
  h.push(new tt());
1813
1811
  }
1814
1812
  }; e.length; ) {
1815
1813
  if (n = /^[^<]+/.exec(e))
1816
- Pt(fe(n[0]), !1).forEach(w);
1817
- else if (!(n = Ke.exec(e)))
1814
+ Ct(ge(n[0]), !1).forEach(w);
1815
+ else if (!(n = Je.exec(e)))
1818
1816
  if (n = We.exec(e))
1819
- p.length && (i = p.pop()), x(n[1]);
1820
- else if (n = Ze.exec(e)) {
1817
+ g.length && (i = g.pop()), x(n[1]);
1818
+ else if (n = Ke.exec(e)) {
1821
1819
  var b = n[1];
1822
- x(b), p.push(i), i = Object.create(i), de[b] && de[b](i, "");
1823
- var S = nn(n[2]);
1820
+ x(b), g.push(i), i = Object.create(i), pe[b] && pe[b](i, "");
1821
+ var S = rn(n[2]);
1824
1822
  b === "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 && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(S.style)) && o[1] && (i.color = o[1]), b === "br" && h.push(new tt());
1825
1823
  } else
1826
1824
  n = [e.slice(0, 1)], w(new H(n[0]));
@@ -1832,37 +1830,37 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1832
1830
  }, it.latexparser = function(e) {
1833
1831
  e = String(e || "").trim();
1834
1832
  var n = [0];
1835
- e = e.replace(/\\verb,(.*?),/, function(C, L) {
1833
+ e = e.replace(/\\verb,(.*?),/, function($, L) {
1836
1834
  return n.push(L), "\\verb," + (n.length - 1) + ",";
1837
1835
  }).replace(/\\\\\n/g, function() {
1838
1836
  return "\\\\";
1839
- }).replace(ln, function(C, L, j) {
1840
- return j.charAt(L - 1) === "\\" ? C : hn[C];
1841
- }).replace(/\n\s+/g, function(C) {
1842
- return /\n/.test(C.slice(1)) ? "\\par " : C;
1843
- }).replace(/\\symbol\{(\d+)\}/, function(C, L, j, $) {
1844
- return $.charAt(j - 1) === "\\" ? C : String.fromCharCode(1 * L);
1845
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(C, L, j, $) {
1846
- return L + j + "{" + $ + "}";
1847
- }).replace(/\\verb,(.*?),/, function(C, L) {
1837
+ }).replace(hn, function($, L, F) {
1838
+ return F.charAt(L - 1) === "\\" ? $ : cn[$];
1839
+ }).replace(/\n\s+/g, function($) {
1840
+ return /\n/.test($.slice(1)) ? "\\par " : $;
1841
+ }).replace(/\\symbol\{(\d+)\}/, function($, L, F, N) {
1842
+ return N.charAt(F - 1) === "\\" ? $ : String.fromCharCode(1 * L);
1843
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function($, L, F, N) {
1844
+ return L + F + "{" + N + "}";
1845
+ }).replace(/\\verb,(.*?),/, function($, L) {
1848
1846
  return "\\verb,".concat(n[+L], ",");
1849
1847
  });
1850
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], p = [], w = function(C) {
1848
+ for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], g = [], w = function($) {
1851
1849
  for (var L in i)
1852
- i[L] && (C[L] = i[L]);
1853
- return h.push(C), C;
1850
+ i[L] && ($[L] = i[L]);
1851
+ return h.push($), $;
1854
1852
  }, x = function() {
1855
- p.push(i), i = Object.create(i);
1853
+ g.push(i), i = Object.create(i);
1856
1854
  }, b = function() {
1857
- if (!p.length)
1855
+ if (!g.length)
1858
1856
  throw new Error("Unexpected }");
1859
- i = p.pop();
1857
+ i = g.pop();
1860
1858
  }, S = { tokens: h, open_context: x, close_context: b, add_token: w }; e.length; ) {
1861
- if (o = on.exec(e))
1862
- Pt(o[0], !1).forEach(w);
1863
- else if (o = an.exec(e))
1859
+ if (o = an.exec(e))
1860
+ Ct(o[0], !1).forEach(w);
1861
+ else if (o = ln.exec(e))
1864
1862
  w(new H(o[1]));
1865
- else if (!(o = sn.exec(e))) {
1863
+ else if (!(o = on.exec(e))) {
1866
1864
  if (o = /^\{/.exec(e))
1867
1865
  x();
1868
1866
  else if (o = /^\}/.exec(e))
@@ -1870,27 +1868,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1870
1868
  else if (!(o = /^\$/.exec(e)))
1871
1869
  if (o = /^\\verb,([^,]+),/.exec(e))
1872
1870
  w(new H(o[1]));
1873
- else if (o = rn.exec(e)) {
1874
- var D = o[1].slice(1) || o[1], O = !!o[2];
1871
+ else if (o = sn.exec(e)) {
1872
+ var D = o[1].slice(1) || o[1], M = !!o[2];
1875
1873
  if (/^(La)?TeX$/i.test(D)) {
1876
1874
  x(), i.family = "serif";
1877
- var k = void 0;
1878
- D === "LaTeX" && ((k = w(new H("L"))).tracking = -0.25, (k = w(new H("A"))).size = 0.7, k.baseline = 0.3, k.tracking = -0.1), (k = w(new H("T"))).tracking = -0.17, (k = w(new H("E"))).baseline = -0.22, k.tracking = -0.13, k = w(new H("X")), b();
1879
- } else if (D in pe)
1880
- w(new H(pe[D])), O && x();
1875
+ var T = void 0;
1876
+ D === "LaTeX" && ((T = w(new H("L"))).tracking = -0.25, (T = w(new H("A"))).size = 0.7, T.baseline = 0.3, T.tracking = -0.1), (T = w(new H("T"))).tracking = -0.17, (T = w(new H("E"))).baseline = -0.22, T.tracking = -0.13, T = w(new H("X")), b();
1877
+ } else if (D in ye)
1878
+ w(new H(ye[D])), M && x();
1881
1879
  else if (D in V) {
1882
- var M = [], R = V[D].length - 1, K = void 0;
1880
+ var O = [], R = V[D].length - 1, K = void 0;
1883
1881
  if (R) {
1884
- for (O = !1, e = e.slice(o[0].length - 1); R--; ) {
1882
+ for (M = !1, e = e.slice(o[0].length - 1); R--; ) {
1885
1883
  if (!(K = /^\{([^}]+)\}/.exec(e)))
1886
1884
  throw new Error(D + " is missing an argument");
1887
- M.push(K[1]), e = e.slice(K[0].length);
1885
+ O.push(K[1]), e = e.slice(K[0].length);
1888
1886
  }
1889
- o[0] = /^\{/.exec(e) ? "{" : "", O = !!o[0];
1887
+ o[0] = /^\{/.exec(e) ? "{" : "", M = !!o[0];
1890
1888
  }
1891
- O && x(), V[D].apply(S, [i].concat(M));
1889
+ M && x(), V[D].apply(S, [i].concat(O));
1892
1890
  } else
1893
- console.warn("unknown latex command", D), w(new H(o[1])), O && x();
1891
+ console.warn("unknown latex command", D), w(new H(o[1])), M && x();
1894
1892
  } else
1895
1893
  o = [e.slice(0, 1)], w(new H(o[0]));
1896
1894
  }
@@ -1898,168 +1896,168 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1898
1896
  }
1899
1897
  return h;
1900
1898
  }, it.measureText = function(e, n, o) {
1901
- return W(e, E(n), o);
1902
- }, it.Token = H, it.Break = St, it.LineBreak = tt, it.SoftHyphen = ft, it.Rotator = xe, xe.createElement = be;
1903
- const Sn = it;
1904
- return s.default;
1899
+ return Z(e, k(n), o);
1900
+ }, it.Token = H, it.Break = St, it.LineBreak = tt, it.SoftHyphen = ft, it.Rotator = be, be.createElement = Ae;
1901
+ const An = it;
1902
+ return r.default;
1905
1903
  })());
1906
- })(Be);
1907
- var jn = Be.exports;
1908
- const Oe = /* @__PURE__ */ oe(jn);
1909
- function Fn(u, l) {
1910
- const t = dt(u), { fontSize: s, font: a, padding: c = 0 } = u.properties.style || {};
1904
+ })(Ve);
1905
+ var jn = Ve.exports;
1906
+ const Me = /* @__PURE__ */ le(jn);
1907
+ function qn(c, l) {
1908
+ const t = dt(c), { fontSize: r, font: a, padding: u = 0 } = c.properties.style || {};
1911
1909
  if (t.width === t.height && t.width === 0)
1912
1910
  return;
1913
- const f = new Oe({
1914
- font: `${s}px/${s}px ${a}`.replace(/(px)+/g, "px"),
1915
- width: t.width - c * 2,
1916
- height: t.height - c * 2,
1911
+ const f = new Me({
1912
+ font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
1913
+ width: t.width - u * 2,
1914
+ height: t.height - u * 2,
1917
1915
  align: "left",
1918
1916
  valign: "top",
1919
1917
  x: 0,
1920
1918
  overflow: "ellipsis",
1921
1919
  parser: "html",
1922
- createElement: Oe.createElement
1920
+ createElement: Me.createElement
1923
1921
  }).linebreak(
1924
- u.properties.content.replaceAll(`
1922
+ c.properties.content.replaceAll(`
1925
1923
  `, "<br>")
1926
1924
  ).render();
1927
- f.setAttribute("transform", `translate(${c}, ${c})`), l.appendChild(f);
1925
+ f.setAttribute("transform", `translate(${u}, ${u})`), l.appendChild(f);
1928
1926
  }
1929
- const Me = 20;
1930
- class qn extends qe {
1931
- constructor(t, s = {}) {
1927
+ const Oe = 20;
1928
+ class Bn extends Be {
1929
+ constructor(t, r = {}) {
1932
1930
  super(
1933
1931
  t,
1934
1932
  `
1935
1933
  <div class="annotation-text-handle">
1936
- <span class="handle line-handle top" data-handle-id="0"></span>
1937
- <span class="handle line-handle bottom" data-handle-id="1"></span>
1938
- <span class="handle line-handle left" data-handle-id="2"></span>
1939
- <span class="handle line-handle right" data-handle-id="3"></span>
1940
- <span class="handle top right point-handle top-right" data-handle-id="4"></span>
1941
- <span class="handle left top point-handle top-left" data-handle-id="5"></span>
1942
- <span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
1943
- <span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
1944
- <textarea wrap="off"></textarea>
1934
+ <span class="handle line-handle top" data-handle-id="0"></span>
1935
+ <span class="handle line-handle bottom" data-handle-id="1"></span>
1936
+ <span class="handle line-handle left" data-handle-id="2"></span>
1937
+ <span class="handle line-handle right" data-handle-id="3"></span>
1938
+ <span class="handle top right point-handle top-right" data-handle-id="4"></span>
1939
+ <span class="handle left top point-handle top-left" data-handle-id="5"></span>
1940
+ <span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
1941
+ <span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
1942
+ <textarea wrap="off"></textarea>
1945
1943
  </div>
1946
1944
  `
1947
1945
  );
1948
- m(this, "textArea");
1949
- m(this, "handleSize");
1950
- m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
1951
- m(this, "annotation", { ...te });
1952
- m(this, "startX", 0);
1953
- m(this, "startY", 0);
1954
- m(this, "handles", []);
1955
- m(this, "draggedHandle", B);
1956
- m(this, "isFocused", !1);
1957
- m(this, "placeholder", "Type your text here...");
1958
- m(this, "_onFocus", () => {
1946
+ v(this, "textArea");
1947
+ v(this, "handleSize");
1948
+ v(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
1949
+ v(this, "annotation", { ...ne });
1950
+ v(this, "startX", 0);
1951
+ v(this, "startY", 0);
1952
+ v(this, "handles", []);
1953
+ v(this, "draggedHandle", B);
1954
+ v(this, "isFocused", !1);
1955
+ v(this, "placeholder", "Type your text here...");
1956
+ v(this, "_onFocus", () => {
1959
1957
  this.textArea.value === this.placeholder && (this.textArea.value = ""), this.isFocused = !0;
1960
1958
  });
1961
- m(this, "_onBlur", () => {
1959
+ v(this, "_onBlur", () => {
1962
1960
  this.isFocused = !1;
1963
1961
  });
1964
- m(this, "startDrawing", (t, s, a = Rn(t, s, 0, 0, "", bt)) => {
1962
+ v(this, "startDrawing", (t, r, a = Fn(t, r, 0, 0, "", bt)) => {
1965
1963
  this.add(a);
1966
- const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: s });
1967
- this.select(a.id), this.startDragging(this.getById(a.id), c.x, c.y), this.draggedHandle = 6;
1964
+ const u = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1965
+ this.select(a.id), this.startDragging(this.getById(a.id), u.x, u.y), this.draggedHandle = 6;
1968
1966
  });
1969
- m(this, "cancelDrawing", () => {
1970
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...te }, this.draggedHandle = B, this.isDragging = !1, this.emit(Ot, this.annotation));
1967
+ v(this, "cancelDrawing", () => {
1968
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ne }, this.draggedHandle = B, this.isDragging = !1, this.emit(Mt, this.annotation));
1971
1969
  });
1972
- m(this, "startDragging", (t, s, a) => {
1970
+ v(this, "startDragging", (t, r, a) => {
1973
1971
  this.annotation = t;
1974
- const c = yt(this.annotation), g = dt(this.annotation);
1975
- this.rect.x = c.x, this.rect.y = c.y, this.rect.width = g.width, this.rect.height = g.height, this.startX = s, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(le, this.annotation), this.isDragging = !0;
1972
+ const u = yt(this.annotation), p = dt(this.annotation);
1973
+ this.rect.x = u.x, this.rect.y = u.y, this.rect.width = p.width, this.rect.height = p.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(ce, this.annotation), this.isDragging = !0;
1976
1974
  });
1977
- m(this, "onHandleMouseDown", (t) => {
1978
- const s = this.getById(this.selectedId) || this.getById(this.hoveredId);
1979
- s && (this.selectedId !== s.id && this.select(this.hoveredId), this.startDragging(s, t.clientX, t.clientY), this.draggedHandle = He(t.target));
1975
+ v(this, "onHandleMouseDown", (t) => {
1976
+ const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
1977
+ r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Re(t.target));
1980
1978
  });
1981
- m(this, "onMouseMove", (t) => {
1979
+ v(this, "onMouseMove", (t) => {
1982
1980
  requestAnimationFrame(() => this._onMouseMove(t));
1983
1981
  });
1984
- m(this, "_onMouseMove", (t) => {
1982
+ v(this, "_onMouseMove", (t) => {
1985
1983
  if (!this.isDragging)
1986
1984
  return;
1987
1985
  t.stopPropagation(), t.preventDefault();
1988
- const s = this.handles[this.draggedHandle], a = s.classList.contains("top"), c = s.classList.contains("left"), g = s.classList.contains("right"), y = s.classList.contains("bottom"), f = s.classList.contains("line-handle"), r = this.ogma.view.getZoom(), d = (t.clientX - this.startX) / r, v = (t.clientY - this.startY) / r, T = c || f ? this.rect.x + d : this.rect.x, _ = a || f ? this.rect.y + v : this.rect.y, E = Math.max(
1989
- this.rect.width + d * (f ? 0 : c ? -1 : g ? 1 : 0),
1990
- Me
1991
- ), P = Math.max(
1992
- this.rect.height + v * (f ? 0 : a ? -1 : y ? 1 : 0),
1993
- Me
1986
+ const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), u = r.classList.contains("left"), p = r.classList.contains("right"), y = r.classList.contains("bottom"), f = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), d = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, A = u || f ? this.rect.x + d : this.rect.x, I = a || f ? this.rect.y + m : this.rect.y, k = Math.max(
1987
+ this.rect.width + d * (f ? 0 : u ? -1 : p ? 1 : 0),
1988
+ Oe
1989
+ ), C = Math.max(
1990
+ this.rect.height + m * (f ? 0 : a ? -1 : y ? 1 : 0),
1991
+ Oe
1994
1992
  );
1995
- Mn(this.annotation, T, _, E, P), this.emit(ae, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1993
+ zn(this.annotation, A, I, k, C), this.emit(he, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1996
1994
  });
1997
- m(this, "onMouseUp", () => {
1998
- !this.isDragging || this.draggedHandle === B || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Ot, this.annotation), this.isDragging = !1, this.draggedHandle = B);
1995
+ v(this, "onMouseUp", () => {
1996
+ !this.isDragging || this.draggedHandle === B || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Mt, this.annotation), this.isDragging = !1, this.draggedHandle = B);
1999
1997
  });
2000
- m(this, "onViewChanged", () => {
1998
+ v(this, "onViewChanged", () => {
2001
1999
  const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
2002
2000
  document.documentElement.style.setProperty("--handle-width", `${t}px`);
2003
2001
  });
2004
- m(this, "_onInput", () => {
2002
+ v(this, "_onInput", () => {
2005
2003
  const t = this.getById(this.selectedId);
2006
- t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(se, t), this.layer.refresh());
2004
+ t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ae, t), this.layer.refresh());
2007
2005
  });
2008
- this.handleSize = De.handleSize || s.textHandleSize, this.placeholder = De.placeholder || s.textPlaceholder || "";
2006
+ this.handleSize = De.handleSize || r.textHandleSize, this.placeholder = De.placeholder || r.textPlaceholder || "";
2009
2007
  const a = this.textArea = this.editor.element.querySelector("textarea");
2010
2008
  a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
2011
2009
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
2012
2010
  ), this.handles.forEach(
2013
- (c) => c.addEventListener("mousedown", this.onHandleMouseDown)
2011
+ (u) => u.addEventListener("mousedown", this.onHandleMouseDown)
2014
2012
  ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
2015
2013
  }
2016
2014
  _canRemove() {
2017
2015
  return !this.isFocused;
2018
2016
  }
2019
- detect({ x: t, y: s }, a = 0) {
2020
- return this.elements.find((c) => {
2021
- const { x: g, y } = yt(c), { width: f, height: r } = dt(c);
2022
- return g - a < t && y - a < s && g + f + a > t && y + r + a > s;
2017
+ detect({ x: t, y: r }, a = 0) {
2018
+ return this.elements.find((u) => {
2019
+ const { x: p, y } = yt(u), { width: f, height: s } = dt(u);
2020
+ return p - a < t && y - a < r && p + f + a > t && y + s + a > r;
2023
2021
  });
2024
2022
  }
2025
2023
  draw(t) {
2026
2024
  t.innerHTML = "";
2027
- const s = "";
2028
- this.elements.forEach((c, g) => {
2029
- const y = `class${g}`, f = dt(c), r = yt(c), d = c.id, {
2030
- color: v,
2031
- fontSize: T,
2032
- font: _,
2033
- strokeColor: E,
2034
- strokeWidth: P,
2035
- strokeType: A,
2025
+ const r = "";
2026
+ this.elements.forEach((u, p) => {
2027
+ const y = `class${p}`, f = dt(u), s = yt(u), d = u.id, {
2028
+ color: m,
2029
+ fontSize: A,
2030
+ font: I,
2031
+ strokeColor: k,
2032
+ strokeWidth: C,
2033
+ strokeType: E,
2036
2034
  background: U
2037
- } = c.properties.style || bt;
2035
+ } = u.properties.style || bt;
2038
2036
  if (d === this.selectedId || this.selectedId === -1 && d === this.hoveredId)
2039
2037
  return;
2040
- const N = It("g");
2041
- N.setAttribute("fill", `${v}`), N.setAttribute("font-size", `${T}`), N.setAttribute("font-family", `${_}`);
2038
+ const P = It("g");
2039
+ P.setAttribute("fill", `${m}`), P.setAttribute("font-size", `${A}`), P.setAttribute("font-family", `${I}`);
2042
2040
  const z = It("rect");
2043
- let W = !1;
2044
- A && A !== "none" && (W = !0, z.setAttribute("stroke", E || "black"), z.setAttribute("stroke-width", `${P}`), A === "dashed" && z.setAttribute("stroke-dasharray", "5,5")), (U && U.length || W) && (W = !0, z.setAttribute("fill", U || "transparent")), W && (z.setAttribute("width", `${f.width}`), z.setAttribute("height", `${f.height}`)), N.appendChild(z), Fn(c, N), N.setAttribute("transform", `translate(${r.x},${r.y})`), N.classList.add(y), N.setAttribute("data-annotation", `${c.id}`), N.setAttribute("data-annotation-type", "text"), t.appendChild(N);
2041
+ let Z = !1;
2042
+ E && E !== "none" && (Z = !0, z.setAttribute("stroke", k || "black"), z.setAttribute("stroke-width", `${C}`), E === "dashed" && z.setAttribute("stroke-dasharray", "5,5")), (U && U.length || Z) && (Z = !0, z.setAttribute("fill", U || "transparent")), Z && (z.setAttribute("width", `${f.width}`), z.setAttribute("height", `${f.height}`)), P.appendChild(z), qn(u, P), P.setAttribute("transform", `translate(${s.x},${s.y})`), P.classList.add(y), P.setAttribute("data-annotation", `${u.id}`), P.setAttribute("data-annotation-type", "text"), t.appendChild(P);
2045
2043
  });
2046
2044
  const a = It("style");
2047
- a.innerHTML = s, t.firstChild && t.insertBefore(a, t.firstChild);
2045
+ a.innerHTML = r, t.firstChild && t.insertBefore(a, t.firstChild);
2048
2046
  }
2049
2047
  getDefaultOptions() {
2050
- return te;
2048
+ return ne;
2051
2049
  }
2052
2050
  refreshEditor() {
2053
2051
  if (+this.selectedId < 0 && +this.hoveredId < 0)
2054
2052
  return;
2055
- const t = this.getById(this.selectedId) || this.getById(this.hoveredId), s = dt(t), a = yt(t), {
2056
- font: c,
2057
- fontSize: g,
2058
- color: y,
2059
- background: f,
2060
- padding: r = 0
2061
- } = t.properties.style || bt;
2062
- this.textArea.value = t.properties.content, this.editor.setPosition({ x: a.x, y: a.y }), this.editor.setSize(s), this.textArea.style.fontFamily = c || "sans-serif", this.textArea.style.fontSize = `${g}px`, this.textArea.style.padding = `${r}px`, this.textArea.style.lineHeight = `${g}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = y || "black", this.textArea.style.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2053
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = dt(t), a = this.ogma.view.graphToScreenCoordinates(yt(t)), u = this.ogma.view.getZoom(), p = Math.min(u, this.maxHandleScale), {
2054
+ font: y,
2055
+ fontSize: f,
2056
+ color: s,
2057
+ background: d,
2058
+ padding: m = 0
2059
+ } = t.properties.style || bt, A = f;
2060
+ this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * u}px, ${r.height / 2 * u}px)scale(${p})`, this.editor.element.style.width = `${r.width}px`, this.editor.element.style.height = `${r.height}px`, this.textArea.style.font = `${A} ${y}`, this.textArea.style.fontFamily = y || "sans-serif", this.textArea.style.fontSize = `${A}px`, this.textArea.style.padding = `${m}px`, this.textArea.style.lineHeight = `${A}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = s || "black", this.textArea.style.background = d || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2063
2061
  }
2064
2062
  select(t) {
2065
2063
  super.select(t), this.textArea.focus();
@@ -2068,59 +2066,59 @@ class qn extends qe {
2068
2066
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
2069
2067
  }
2070
2068
  }
2071
- class Bn {
2069
+ class Vn {
2072
2070
  constructor() {
2073
- m(this, "links", {});
2074
- m(this, "linksByTargetId", {});
2075
- m(this, "linksByArrowId", {});
2071
+ v(this, "links", {});
2072
+ v(this, "linksByTargetId", {});
2073
+ v(this, "linksByArrowId", {});
2076
2074
  }
2077
- add(l, t, s, a, c) {
2078
- const g = jt(), y = l.id, f = {
2079
- id: g,
2075
+ add(l, t, r, a, u) {
2076
+ const p = jt(), y = l.id, f = {
2077
+ id: p,
2080
2078
  arrow: y,
2081
- target: s,
2079
+ target: r,
2082
2080
  targetType: a,
2083
- connectionPoint: c,
2081
+ connectionPoint: u,
2084
2082
  side: t
2085
2083
  };
2086
- return this.links[g] = f, this.linksByTargetId[s] || (this.linksByTargetId[s] = []), this.linksByTargetId[s].push(g), this.linksByArrowId[y] || (this.linksByArrowId[y] = {}), this.linksByArrowId[y][t] = g, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2087
- id: s,
2084
+ return this.links[p] = f, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(p), this.linksByArrowId[y] || (this.linksByArrowId[y] = {}), this.linksByArrowId[y][t] = p, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2085
+ id: r,
2088
2086
  side: t,
2089
2087
  type: a,
2090
- magnet: c
2088
+ magnet: u
2091
2089
  }, this;
2092
2090
  }
2093
2091
  arrowIsLinked(l, t) {
2094
- var s;
2095
- return !!((s = this.linksByArrowId[l]) != null && s[t]);
2092
+ var r;
2093
+ return !!((r = this.linksByArrowId[l]) != null && r[t]);
2096
2094
  }
2097
2095
  // remove the link between the arrow and the target by arrow id and side
2098
2096
  remove(l, t) {
2099
2097
  var y, f;
2100
- const s = l.id, a = (y = this.linksByArrowId[s]) == null ? void 0 : y[t];
2098
+ const r = l.id, a = (y = this.linksByArrowId[r]) == null ? void 0 : y[t];
2101
2099
  if ((f = l.properties.link) == null || delete f[t], !a)
2102
2100
  return this;
2103
- const c = this.links[a];
2101
+ const u = this.links[a];
2104
2102
  delete this.links[a];
2105
- const g = this.linksByTargetId[c.target];
2106
- for (let r = 0; r < g.length; r++)
2107
- if (g[r] === a) {
2108
- g.splice(r, 1);
2103
+ const p = this.linksByTargetId[u.target];
2104
+ for (let s = 0; s < p.length; s++)
2105
+ if (p[s] === a) {
2106
+ p.splice(s, 1);
2109
2107
  break;
2110
2108
  }
2111
- return delete this.linksByArrowId[s][t], this;
2109
+ return delete this.linksByArrowId[r][t], this;
2112
2110
  }
2113
2111
  getArrowLink(l, t) {
2114
2112
  var a;
2115
- const s = (a = this.linksByArrowId[l]) == null ? void 0 : a[t];
2116
- return s ? this.links[s] : null;
2113
+ const r = (a = this.linksByArrowId[l]) == null ? void 0 : a[t];
2114
+ return r ? this.links[r] : null;
2117
2115
  }
2118
2116
  getTargetLinks(l) {
2119
2117
  var t;
2120
- return ((t = this.linksByTargetId[l]) == null ? void 0 : t.map((s) => this.links[s])) ?? [];
2118
+ return ((t = this.linksByTargetId[l]) == null ? void 0 : t.map((r) => this.links[r])) ?? [];
2121
2119
  }
2122
2120
  }
2123
- const ct = (u) => u.properties.type === "arrow", wt = (u) => u.properties.type === "text", Vn = (u) => u.type === "FeatureCollection", Un = {
2121
+ const ht = (c) => c.properties.type === "arrow", wt = (c) => c.properties.type === "text", ze = (c) => c.type === "FeatureCollection", Un = {
2124
2122
  magnetColor: "#3e8",
2125
2123
  detectMargin: 20,
2126
2124
  magnetHandleRadius: 5,
@@ -2130,7 +2128,7 @@ const ct = (u) => u.properties.type === "arrow", wt = (u) => u.properties.type =
2130
2128
  textHandleSize: 3.5,
2131
2129
  minArrowHeight: 20,
2132
2130
  maxArrowHeight: 30
2133
- }, ze = ["start", "end"], Le = [
2131
+ }, Le = ["start", "end"], Ce = [
2134
2132
  { x: 0, y: 0 },
2135
2133
  { x: 0.5, y: 0 },
2136
2134
  { x: 1, y: 0 },
@@ -2140,135 +2138,146 @@ const ct = (u) => u.properties.type === "arrow", wt = (u) => u.properties.type =
2140
2138
  { x: 0.5, y: 1 },
2141
2139
  { x: 1, y: 1 }
2142
2140
  ];
2143
- class Gn extends Fe {
2144
- constructor(t, s = {}) {
2141
+ class Gn extends qe {
2142
+ constructor(t, r = {}) {
2145
2143
  super();
2146
- m(this, "arrows");
2147
- m(this, "texts");
2148
- m(this, "links", new Bn());
2149
- m(this, "layer");
2150
- m(this, "annotations");
2151
- m(this, "ogma");
2152
- m(this, "options");
2153
- m(this, "selected", null);
2154
- m(this, "updateTimeout", 0);
2155
- m(this, "hoveredNode", null);
2156
- m(this, "dragged", null);
2157
- m(this, "textToMagnet");
2158
- m(this, "activeLinks", []);
2159
- m(this, "_render", (t) => {
2144
+ v(this, "arrows");
2145
+ v(this, "texts");
2146
+ v(this, "links", new Vn());
2147
+ v(this, "layer");
2148
+ v(this, "annotations");
2149
+ v(this, "ogma");
2150
+ v(this, "options");
2151
+ v(this, "selected", null);
2152
+ v(this, "updateTimeout", 0);
2153
+ v(this, "hoveredNode", null);
2154
+ v(this, "dragged", null);
2155
+ v(this, "textToMagnet");
2156
+ v(this, "activeLinks", []);
2157
+ v(this, "_render", (t) => {
2160
2158
  if (!this.dragged || this.textToMagnet === void 0)
2161
2159
  return;
2162
2160
  t.beginPath(), t.fillStyle = "green";
2163
- const s = this.ogma.view.getZoom();
2164
- Le.forEach((a) => {
2161
+ const r = this.ogma.view.getZoom();
2162
+ Ce.forEach((a) => {
2165
2163
  if (!this.textToMagnet)
2166
2164
  return;
2167
- const c = dt(this.textToMagnet), g = yt(this.textToMagnet), { x: y, y: f } = new rt(a.x, a.y).mul({ x: c.width, y: c.height }).add(g);
2168
- t.moveTo(y, f), t.arc(y, f, this.options.magnetHandleRadius / s, 0, Math.PI * 2);
2165
+ const u = dt(this.textToMagnet), p = yt(this.textToMagnet), { x: y, y: f } = new rt(a.x, a.y).mul({ x: u.width, y: u.height }).add(p);
2166
+ t.moveTo(y, f), t.arc(y, f, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
2169
2167
  }), t.fill(), t.closePath();
2170
2168
  });
2171
- m(this, "_onFeatureDrag", (t, s) => {
2172
- const a = s;
2173
- if (ct(t) && a === "line")
2174
- ["start", "end"].find((c) => {
2175
- const g = c === "start" ? _t(t) : Ht(t);
2176
- return this._snapToText(t, a, g) || this._findAndSnapToNode(t, c, g);
2169
+ v(this, "_onFeatureDrag", (t, r) => {
2170
+ const a = r;
2171
+ if (ht(t) && a === "line")
2172
+ ["start", "end"].find((u) => {
2173
+ const p = u === "start" ? _t(t) : Rt(t);
2174
+ return this._snapToText(t, a, p) || this._findAndSnapToNode(t, u, p);
2177
2175
  });
2178
- else if (ct(t) && a !== "line") {
2179
- const c = a === "start" ? _t(t) : Ht(t);
2180
- this._snapToText(t, a, c) || this._findAndSnapToNode(t, a, c);
2176
+ else if (ht(t) && a !== "line") {
2177
+ const u = a === "start" ? _t(t) : Rt(t);
2178
+ this._snapToText(t, a, u) || this._findAndSnapToNode(t, a, u);
2181
2179
  } else
2182
- wt(t) && (this.activeLinks.forEach(({ arrow: c, side: g, connectionPoint: y }) => {
2183
- const f = this.getAnnotation(c), r = dt(t), d = yt(t), v = new rt(y.x, y.y).mul({ x: r.width, y: r.height }).add(d);
2184
- f.geometry.coordinates[g === "start" ? 0 : 1] = [v.x, v.y];
2180
+ wt(t) && (this.activeLinks.forEach(({ arrow: u, side: p, connectionPoint: y }) => {
2181
+ const f = this.getAnnotation(u), s = dt(t), d = yt(t), m = new rt(y.x, y.y).mul({ x: s.width, y: s.height }).add(d);
2182
+ f.geometry.coordinates[p === "start" ? 0 : 1] = [m.x, m.y];
2185
2183
  }), this.activeLinks.length && this.arrows.refreshLayer());
2186
2184
  this.layer.refresh();
2187
2185
  });
2188
- m(this, "_onFeatureDragEnd", (t) => {
2189
- this.dragged !== null && ct(t) && _t(this.dragged) && ze.forEach((s) => {
2190
- this.links.getArrowLink(t.id, s) && this.emit(Nn, {
2186
+ v(this, "_onFeatureDragEnd", (t) => {
2187
+ this.dragged !== null && ht(t) && _t(this.dragged) && Le.forEach((r) => {
2188
+ this.links.getArrowLink(t.id, r) && this.emit(Nn, {
2191
2189
  arrow: t,
2192
- link: this.links.getArrowLink(t.id, s)
2190
+ link: this.links.getArrowLink(t.id, r)
2193
2191
  });
2194
- }), (wt(t) || ct(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((s) => s.enableDetection()), this.layer.refresh();
2192
+ }), (wt(t) || ht(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh();
2195
2193
  });
2196
- m(this, "_onFeatureDragStart", (t) => {
2197
- this.textToMagnet = void 0, ct(t) ? this.dragged = t : wt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id)), this.annotations.forEach((s) => {
2198
- const a = s.getSelectedFeature();
2199
- a && a !== t && s.unhover().unselect(), s.disableDetection();
2194
+ v(this, "_onFeatureDragStart", (t) => {
2195
+ this.textToMagnet = void 0, ht(t) ? this.dragged = t : wt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id)), this.annotations.forEach((r) => {
2196
+ const a = r.getSelectedFeature();
2197
+ a && a !== t && r.unhover().unselect(), r.disableDetection();
2200
2198
  });
2201
2199
  });
2202
- m(this, "_onNodesDragStart", () => {
2200
+ v(this, "_onNodesDragStart", () => {
2203
2201
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
2204
2202
  });
2205
- m(this, "_onNodesDrag", (t) => {
2206
- const { dx: s, dy: a } = t;
2207
- this._moveNodes(t.nodes, s, a);
2203
+ v(this, "_onNodesDrag", (t) => {
2204
+ const { dx: r, dy: a } = t;
2205
+ this._moveNodes(t.nodes, r, a);
2208
2206
  });
2209
- m(this, "_onAdded", (t) => {
2210
- this.emit(re, t);
2207
+ v(this, "_onLayoutEnd", (t) => {
2208
+ t.ids.forEach((r, a) => {
2209
+ this.links.getTargetLinks(r).forEach((p) => {
2210
+ const y = this.getAnnotation(p.arrow), f = p.side, s = te(
2211
+ y,
2212
+ f === "start" ? "end" : "start"
2213
+ ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = ee(s, d, +m);
2214
+ Nt(y, f, A.x, A.y);
2215
+ });
2216
+ }), this.arrows.refreshLayer(), this.texts.refreshLayer();
2211
2217
  });
2212
- m(this, "_onRemoved", (t) => {
2213
- this.emit(ie, t);
2218
+ v(this, "_onAdded", (t) => {
2219
+ this.emit(oe, t);
2220
+ });
2221
+ v(this, "_onRemoved", (t) => {
2222
+ this.emit(se, t);
2214
2223
  });
2215
- m(this, "_onUnselect", (t) => {
2216
- this.selected = null, this.emit(ne, t);
2224
+ v(this, "_onUnselect", (t) => {
2225
+ this.selected = null, this.emit(re, t);
2217
2226
  });
2218
- m(this, "_onSelect", (t) => {
2219
- this.selected !== t && (this.selected = t, this.emit(ee, this.selected));
2227
+ v(this, "_onSelect", (t) => {
2228
+ this.selected !== t && (this.selected = t, this.emit(ie, this.selected));
2220
2229
  });
2221
2230
  /**
2222
2231
  * Triggers the update event on the annotation
2223
2232
  * @param annotation The annotation updated
2224
2233
  */
2225
- m(this, "onUpdate", (t) => {
2234
+ v(this, "onUpdate", (t) => {
2226
2235
  cancelAnimationFrame(this.updateTimeout), this.updateTimeout = requestAnimationFrame(
2227
2236
  () => this._onUpdate(t)
2228
2237
  );
2229
2238
  });
2230
- m(this, "_onUpdate", (t) => {
2231
- this.emit(se, t);
2239
+ v(this, "_onUpdate", (t) => {
2240
+ this.emit(ae, t);
2232
2241
  });
2233
- this.options = this.setOptions({ ...Un, ...s }), this.ogma = t, this.arrows = new Hn(t, this.options), this.texts = new qn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2234
- a.on(le, this._onFeatureDragStart).on(ae, this._onFeatureDrag).on(Ot, this._onFeatureDragEnd).on(se, this.onUpdate).on(ne, this._onUnselect).on(ee, this._onSelect).on(re, this._onAdded).on(ie, this._onRemoved);
2235
- }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2236
- }
2237
- _moveNodes(t, s, a) {
2238
- t.forEach((c) => {
2239
- const g = this.links.getTargetLinks(c.getId()), y = c.getPosition();
2240
- g.forEach((f) => {
2241
- const r = this.getAnnotation(f.arrow), d = f.side, v = Ae(
2242
- r,
2242
+ this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new Rn(t, this.options), this.texts = new Bn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2243
+ a.on(ce, this._onFeatureDragStart).on(he, this._onFeatureDrag).on(Mt, this._onFeatureDragEnd).on(ae, this.onUpdate).on(re, this._onUnselect).on(ie, this._onSelect).on(oe, this._onAdded).on(se, this._onRemoved);
2244
+ }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2245
+ }
2246
+ _moveNodes(t, r, a) {
2247
+ t.forEach((u) => {
2248
+ const p = this.links.getTargetLinks(u.getId()), y = u.getPosition();
2249
+ p.forEach((f) => {
2250
+ const s = this.getAnnotation(f.arrow), d = f.side, m = te(
2251
+ s,
2243
2252
  d === "start" ? "end" : "start"
2244
2253
  );
2245
- let T = y;
2246
- const _ = +c.getAttribute("radius"), E = 1e-6;
2247
- (f.connectionPoint.x - (y.x - s) > E || f.connectionPoint.y - (y.y - a) > E) && (T = Ee(v, y, _)), Qt(r, d, T.x, T.y);
2254
+ let A = y;
2255
+ const I = +u.getAttribute("radius"), k = 1e-6;
2256
+ (f.connectionPoint.x - (y.x - r) > k || f.connectionPoint.y - (y.y - a) > k) && (A = ee(m, y, I)), Nt(s, d, A.x, A.y);
2248
2257
  });
2249
2258
  }), this.arrows.refreshLayer();
2250
2259
  }
2251
- _snapToText(t, s, a) {
2252
- const c = this.texts.detect(a, this.options.detectMargin);
2253
- if (this.links.remove(t, s), !c)
2260
+ _snapToText(t, r, a) {
2261
+ const u = this.texts.detect(a, this.options.detectMargin);
2262
+ if (this.links.remove(t, r), !u)
2254
2263
  return !1;
2255
- this.textToMagnet = c;
2256
- const g = this.findMagnetPoint(Le, c, a);
2257
- return g ? (Qt(t, s, g.point.x, g.point.y), this.links.add(t, s, c.id, "text", g.magnet), !0) : !1;
2258
- }
2259
- _findAndSnapToNode(t, s, a) {
2260
- const c = this.ogma.view.graphToScreenCoordinates(a), g = this.ogma.view.getElementAt(c);
2261
- this.links.remove(t, s), g && g.isNode ? (this.hoveredNode = g, this.hoveredNode.setSelected(!0), this._snapToNode(t, s, g, c)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2262
- }
2263
- _snapToNode(t, s, a, c) {
2264
- const g = a.getPositionOnScreen(), y = +a.getAttribute("radius"), f = y * this.ogma.view.getZoom(), r = c.x - g.x, d = c.y - g.y, v = Math.sqrt(r * r + d * d), T = a.getPosition();
2265
- if (v < f + this.options.detectMargin) {
2266
- let _ = T;
2267
- if (v > f / 2) {
2268
- const E = Ae(t, s === "end" ? "start" : "end");
2269
- _ = Ee(E, _, y);
2264
+ this.textToMagnet = u;
2265
+ const p = this.findMagnetPoint(Ce, u, a);
2266
+ return p ? (Nt(t, r, p.point.x, p.point.y), this.links.add(t, r, u.id, "text", p.magnet), !0) : !1;
2267
+ }
2268
+ _findAndSnapToNode(t, r, a) {
2269
+ const u = this.ogma.view.graphToScreenCoordinates(a), p = this.ogma.view.getElementAt(u);
2270
+ this.links.remove(t, r), p && p.isNode ? (this.hoveredNode = p, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, p, u)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2271
+ }
2272
+ _snapToNode(t, r, a, u) {
2273
+ const p = a.getPositionOnScreen(), y = +a.getAttribute("radius"), f = y * this.ogma.view.getZoom(), s = u.x - p.x, d = u.y - p.y, m = Math.sqrt(s * s + d * d), A = a.getPosition();
2274
+ if (m < f + this.options.detectMargin) {
2275
+ let I = A;
2276
+ if (m > f / 2) {
2277
+ const k = te(t, r === "end" ? "start" : "end");
2278
+ I = ee(k, I, y);
2270
2279
  }
2271
- Qt(t, s, _.x, _.y), this.links.add(t, s, a.getId(), "node", _);
2280
+ Nt(t, r, I.x, I.y), this.links.add(t, r, a.getId(), "node", I);
2272
2281
  }
2273
2282
  }
2274
2283
  /**
@@ -2277,19 +2286,19 @@ class Gn extends Fe {
2277
2286
  getSelected() {
2278
2287
  return this.selected;
2279
2288
  }
2280
- findMagnetPoint(t, s, a) {
2281
- let c;
2282
- for (const g of t) {
2283
- const y = dt(s), f = yt(s), r = new rt(g.x, g.y).mul({ x: y.width, y: y.height }).add(f), d = r.sub(a).length(), v = this.options.magnetRadius * this.ogma.view.getZoom();
2284
- if (d < Math.max(v, this.options.magnetHandleRadius)) {
2285
- c = {
2286
- point: r,
2287
- magnet: g
2289
+ findMagnetPoint(t, r, a) {
2290
+ let u;
2291
+ for (const p of t) {
2292
+ const y = dt(r), f = yt(r), s = new rt(p.x, p.y).mul({ x: y.width, y: y.height }).add(f), d = s.sub(a).length(), m = this.options.magnetRadius * this.ogma.view.getZoom();
2293
+ if (d < Math.max(m, this.options.magnetHandleRadius)) {
2294
+ u = {
2295
+ point: s,
2296
+ magnet: p
2288
2297
  };
2289
2298
  break;
2290
2299
  }
2291
2300
  }
2292
- return c;
2301
+ return u;
2293
2302
  }
2294
2303
  /**
2295
2304
  * Set the options for the controller
@@ -2307,23 +2316,23 @@ class Gn extends Fe {
2307
2316
  * @param id the id of the annotation to select
2308
2317
  */
2309
2318
  select(t) {
2310
- const s = this.getAnnotations().features.find((a) => a.id === t);
2311
- return s ? (ct(s) ? this.arrows.select(s.id) : wt(s) && this.texts.select(s.id), this) : this;
2319
+ const r = this.getAnnotations().features.find((a) => a.id === t);
2320
+ return r ? (ht(r) ? this.arrows.select(r.id) : wt(r) && this.texts.select(r.id), this) : this;
2312
2321
  }
2313
2322
  /**
2314
2323
  * Unselects the currently selected annotation
2315
2324
  */
2316
2325
  unselect() {
2317
- return this.selected ? (ct(this.selected) ? this.arrows.unselect() : wt(this.selected) && this.texts.unselect(), this) : this;
2326
+ return this.selected ? (ht(this.selected) ? this.arrows.unselect() : wt(this.selected) && this.texts.unselect(), this) : this;
2318
2327
  }
2319
2328
  /**
2320
2329
  * Add an annotation to the controller
2321
2330
  * @param annotation The annotation to add
2322
2331
  */
2323
2332
  add(t) {
2324
- if (Vn(t))
2333
+ if (ze(t))
2325
2334
  return t.features.forEach(
2326
- (s) => this.add(s)
2335
+ (r) => this.add(r)
2327
2336
  ), this;
2328
2337
  switch (t.properties.type) {
2329
2338
  case "text":
@@ -2335,18 +2344,27 @@ class Gn extends Fe {
2335
2344
  }
2336
2345
  return this;
2337
2346
  }
2347
+ /**
2348
+ * Remove an annotation or an array of annotations from the controller
2349
+ * @param annotation The annotation(s) to remove
2350
+ */
2351
+ remove(t) {
2352
+ return ze(t) ? (t.features.forEach(
2353
+ (r) => this.remove(r)
2354
+ ), this) : (ht(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
2355
+ }
2338
2356
  loadLink(t) {
2339
2357
  if (t.properties.link)
2340
- for (const s of ze) {
2341
- const a = t.properties.link[s];
2358
+ for (const r of Le) {
2359
+ const a = t.properties.link[r];
2342
2360
  if (!a)
2343
2361
  continue;
2344
2362
  if (this.getAnnotation(a.id))
2345
- this.links.add(t, s, a.id, a.type, a.magnet);
2363
+ this.links.add(t, r, a.id, a.type, a.magnet);
2346
2364
  else {
2347
2365
  if (!this.ogma.getNode(a.id))
2348
2366
  continue;
2349
- this.links.add(t, s, a.id, a.type, a.magnet);
2367
+ this.links.add(t, r, a.id, a.type, a.magnet);
2350
2368
  }
2351
2369
  }
2352
2370
  }
@@ -2356,8 +2374,8 @@ class Gn extends Fe {
2356
2374
  * @param y coord of the first point
2357
2375
  * @param arrow The arrow to add
2358
2376
  */
2359
- startArrow(t, s, a) {
2360
- this.cancelDrawing(), this.arrows.startDrawing(t, s, a);
2377
+ startArrow(t, r, a) {
2378
+ this.cancelDrawing(), this.arrows.startDrawing(t, r, a);
2361
2379
  }
2362
2380
  /**
2363
2381
  * Start adding a text (add it, and give control to the user)
@@ -2365,23 +2383,23 @@ class Gn extends Fe {
2365
2383
  * @param y coord of the top left point
2366
2384
  * @param text The text to add
2367
2385
  */
2368
- startText(t, s, a) {
2369
- this.cancelDrawing(), this.texts.startDrawing(t, s, a);
2386
+ startText(t, r, a) {
2387
+ this.cancelDrawing(), this.texts.startDrawing(t, r, a);
2370
2388
  }
2371
2389
  /**
2372
2390
  * Cancel drawing on the current frame
2373
2391
  */
2374
2392
  cancelDrawing() {
2375
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Cn);
2393
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Pn);
2376
2394
  }
2377
2395
  /**
2378
2396
  * Update the style of the annotation with the given id
2379
2397
  * @param id The id of the annotation to update
2380
2398
  * @param style The new style
2381
2399
  */
2382
- updateStyle(t, s) {
2383
- const a = this.getAnnotations().features.find((c) => c.id === t);
2384
- return a ? (ct(a) ? this.arrows.updateStyle(a, s) : wt(a) && this.texts.updateStyle(a, s), this.onUpdate(a), this) : this;
2400
+ updateStyle(t, r) {
2401
+ const a = this.getAnnotations().features.find((u) => u.id === t);
2402
+ return a ? (ht(a) ? this.arrows.updateStyle(a, r) : wt(a) && this.texts.updateStyle(a, r), this.onUpdate(a), this) : this;
2385
2403
  }
2386
2404
  /**
2387
2405
  *
@@ -2392,8 +2410,8 @@ class Gn extends Fe {
2392
2410
  type: "FeatureCollection",
2393
2411
  features: []
2394
2412
  };
2395
- return this.annotations.forEach((s) => {
2396
- t.features = [...t.features, ...s.getElements()];
2413
+ return this.annotations.forEach((r) => {
2414
+ t.features = [...t.features, ...r.getElements()];
2397
2415
  }), t;
2398
2416
  }
2399
2417
  /**
@@ -2402,7 +2420,7 @@ class Gn extends Fe {
2402
2420
  * @returns The annotation with the given id
2403
2421
  */
2404
2422
  getAnnotation(t) {
2405
- return this.getAnnotations().features.find((s) => s.id === t);
2423
+ return this.getAnnotations().features.find((r) => r.id === t);
2406
2424
  }
2407
2425
  /**
2408
2426
  * Destroy the controller and its elements
@@ -2412,34 +2430,34 @@ class Gn extends Fe {
2412
2430
  }
2413
2431
  }
2414
2432
  export {
2415
- Hn as Arrows,
2433
+ Rn as Arrows,
2416
2434
  Gn as Control,
2417
- qn as Texts,
2418
- _n as createArrow,
2435
+ Bn as Texts,
2436
+ Dn as createArrow,
2419
2437
  It as createSVGElement,
2420
- Rn as createText,
2421
- Se as defaultArrowOptions,
2438
+ Fn as createText,
2439
+ Ee as defaultArrowOptions,
2422
2440
  Dt as defaultArrowStyle,
2423
2441
  De as defaultControllerOptions,
2424
- te as defaultTextOptions,
2442
+ ne as defaultTextOptions,
2425
2443
  bt as defaultTextStyle,
2426
2444
  Xn as getAnnotationsBounds,
2427
- Ht as getArrowEnd,
2428
- Rt as getArrowEndPoints,
2429
- Ae as getArrowSide,
2445
+ Rt as getArrowEnd,
2446
+ Ft as getArrowEndPoints,
2447
+ te as getArrowSide,
2430
2448
  _t as getArrowStart,
2431
- Ee as getAttachmentPointOnNode,
2432
- He as getHandleId,
2433
- Ce as getTextBbox,
2449
+ ee as getAttachmentPointOnNode,
2450
+ Re as getHandleId,
2451
+ Pe as getTextBbox,
2434
2452
  yt as getTextPosition,
2435
2453
  dt as getTextSize,
2436
- Vn as isAnnotationCollection,
2437
- ct as isArrow,
2454
+ ze as isAnnotationCollection,
2455
+ ht as isArrow,
2438
2456
  wt as isText,
2439
- $e as setArrowEnd,
2440
- Qt as setArrowEndPoint,
2457
+ He as setArrowEnd,
2458
+ Nt as setArrowEndPoint,
2441
2459
  Ne as setArrowStart,
2442
- Mn as setTextBbox,
2460
+ zn as setTextBbox,
2443
2461
  On as updateTextBbox
2444
2462
  };
2445
2463
  //# sourceMappingURL=index.mjs.map