@linkurious/ogma-annotations 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- var Tn = Object.defineProperty;
2
- var Fn = (i, e, t) => e in i ? Tn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var y = (i, e, t) => Fn(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { Node as Pn, geometry as zt } from "@linkurious/ogma";
5
- function Dn(i) {
1
+ var Fn = Object.defineProperty;
2
+ var Pn = (i, e, t) => e in i ? Fn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var y = (i, e, t) => Pn(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Node as Dn, geometry as zt } from "@linkurious/ogma";
5
+ function Ln(i) {
6
6
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
7
7
  }
8
- var Wt = { exports: {} }, pe;
9
- function Ln() {
10
- return pe || (pe = 1, (function(i) {
8
+ var jt = { exports: {} }, me;
9
+ function Hn() {
10
+ return me || (me = 1, (function(i) {
11
11
  var e = Object.prototype.hasOwnProperty, t = "~";
12
12
  function n() {
13
13
  }
@@ -18,8 +18,8 @@ function Ln() {
18
18
  function r(l, h, c, d, u) {
19
19
  if (typeof c != "function")
20
20
  throw new TypeError("The listener must be a function");
21
- var g = new s(c, d || l, u), p = t ? t + h : h;
22
- return l._events[p] ? l._events[p].fn ? l._events[p] = [l._events[p], g] : l._events[p].push(g) : (l._events[p] = g, l._eventsCount++), l;
21
+ var g = new s(c, d || l, u), f = t ? t + h : h;
22
+ return l._events[f] ? l._events[f].fn ? l._events[f] = [l._events[f], g] : l._events[f].push(g) : (l._events[f] = g, l._eventsCount++), l;
23
23
  }
24
24
  function o(l, h) {
25
25
  --l._eventsCount === 0 ? l._events = new n() : delete l._events[h];
@@ -37,18 +37,18 @@ function Ln() {
37
37
  var c = t ? t + h : h, d = this._events[c];
38
38
  if (!d) return [];
39
39
  if (d.fn) return [d.fn];
40
- for (var u = 0, g = d.length, p = new Array(g); u < g; u++)
41
- p[u] = d[u].fn;
42
- return p;
40
+ for (var u = 0, g = d.length, f = new Array(g); u < g; u++)
41
+ f[u] = d[u].fn;
42
+ return f;
43
43
  }, a.prototype.listenerCount = function(h) {
44
44
  var c = t ? t + h : h, d = this._events[c];
45
45
  return d ? d.fn ? 1 : d.length : 0;
46
- }, a.prototype.emit = function(h, c, d, u, g, p) {
47
- var f = t ? t + h : h;
48
- if (!this._events[f]) return !1;
49
- var m = this._events[f], x = arguments.length, b, v;
46
+ }, a.prototype.emit = function(h, c, d, u, g, f) {
47
+ var p = t ? t + h : h;
48
+ if (!this._events[p]) return !1;
49
+ var m = this._events[p], w = arguments.length, b, v;
50
50
  if (m.fn) {
51
- switch (m.once && this.removeListener(h, m.fn, void 0, !0), x) {
51
+ switch (m.once && this.removeListener(h, m.fn, void 0, !0), w) {
52
52
  case 1:
53
53
  return m.fn.call(m.context), !0;
54
54
  case 2:
@@ -60,15 +60,15 @@ function Ln() {
60
60
  case 5:
61
61
  return m.fn.call(m.context, c, d, u, g), !0;
62
62
  case 6:
63
- return m.fn.call(m.context, c, d, u, g, p), !0;
63
+ return m.fn.call(m.context, c, d, u, g, f), !0;
64
64
  }
65
- for (v = 1, b = new Array(x - 1); v < x; v++)
65
+ for (v = 1, b = new Array(w - 1); v < w; v++)
66
66
  b[v - 1] = arguments[v];
67
67
  m.fn.apply(m.context, b);
68
68
  } else {
69
- var S = m.length, w;
69
+ var S = m.length, x;
70
70
  for (v = 0; v < S; v++)
71
- switch (m[v].once && this.removeListener(h, m[v].fn, void 0, !0), x) {
71
+ switch (m[v].once && this.removeListener(h, m[v].fn, void 0, !0), w) {
72
72
  case 1:
73
73
  m[v].fn.call(m[v].context);
74
74
  break;
@@ -82,8 +82,8 @@ function Ln() {
82
82
  m[v].fn.call(m[v].context, c, d, u);
83
83
  break;
84
84
  default:
85
- if (!b) for (w = 1, b = new Array(x - 1); w < x; w++)
86
- b[w - 1] = arguments[w];
85
+ if (!b) for (x = 1, b = new Array(w - 1); x < w; x++)
86
+ b[x - 1] = arguments[x];
87
87
  m[v].fn.apply(m[v].context, b);
88
88
  }
89
89
  }
@@ -97,12 +97,12 @@ function Ln() {
97
97
  if (!this._events[g]) return this;
98
98
  if (!c)
99
99
  return o(this, g), this;
100
- var p = this._events[g];
101
- if (p.fn)
102
- p.fn === c && (!u || p.once) && (!d || p.context === d) && o(this, g);
100
+ var f = this._events[g];
101
+ if (f.fn)
102
+ f.fn === c && (!u || f.once) && (!d || f.context === d) && o(this, g);
103
103
  else {
104
- for (var f = 0, m = [], x = p.length; f < x; f++)
105
- (p[f].fn !== c || u && !p[f].once || d && p[f].context !== d) && m.push(p[f]);
104
+ for (var p = 0, m = [], w = f.length; p < w; p++)
105
+ (f[p].fn !== c || u && !f[p].once || d && f[p].context !== d) && m.push(f[p]);
106
106
  m.length ? this._events[g] = m.length === 1 ? m[0] : m : o(this, g);
107
107
  }
108
108
  return this;
@@ -110,14 +110,14 @@ function Ln() {
110
110
  var c;
111
111
  return h ? (c = t ? t + h : h, this._events[c] && o(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
112
112
  }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = t, a.EventEmitter = a, i.exports = a;
113
- })(Wt)), Wt.exports;
113
+ })(jt)), jt.exports;
114
114
  }
115
- var Hn = Ln();
116
- const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", Bt = "dragend", re = "click", In = "select", zn = "unselect", vr = "hover", Sr = "unhover", Bn = "remove", oe = "add", Rn = "cancelDrawing", Ve = "completeDrawing", $n = "update", Nn = "link", Yn = "history", Ar = "data-annotation", Ze = 5, Xn = 3, de = {
115
+ var _n = Hn();
116
+ const In = /* @__PURE__ */ Ln(_n), vr = -1, Ut = "dragging", Ct = "dragstart", Bt = "dragend", oe = "click", zn = "select", Bn = "unselect", Sr = "hover", Ar = "unhover", Rn = "remove", ae = "add", $n = "cancelDrawing", Ze = "completeDrawing", Nn = "update", Yn = "link", On = "history", Er = "data-annotation", Ke = 5, Xn = 3, ue = {
117
117
  SHAPES: 1,
118
118
  EDITOR: 2,
119
119
  HANDLES: 3
120
- }, O = "start", it = "end", I = {
120
+ }, X = "start", it = "end", I = {
121
121
  default: "default",
122
122
  move: "move",
123
123
  pointer: "pointer",
@@ -136,7 +136,7 @@ const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", B
136
136
  eResize: "e-resize",
137
137
  sResize: "s-resize",
138
138
  wResize: "w-resize"
139
- }, at = "collapsed", Rt = "expanded", $t = 1.2, Ke = 0.2, T = {
139
+ }, at = "collapsed", Rt = "expanded", $t = 1.2, Je = 0.2, T = {
140
140
  TEXT: "text",
141
141
  NODE: "node",
142
142
  BOX: "box",
@@ -144,18 +144,18 @@ const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", B
144
144
  POLYGON: "polygon",
145
145
  ANNOTATION: "annotation",
146
146
  EDGE: "edge"
147
- }, Je = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
147
+ }, Qe = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
148
148
  <path d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
149
- </svg>`, Qe = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
149
+ </svg>`, tn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
150
150
  <path d="M12 6.00015H7.33333C6.97971 6.00015 6.64057 6.14063 6.39052 6.39068C6.14048 6.64072 6 6.97986 6 7.33348V16.6668C6 17.0204 6.14048 17.3596 6.39052 17.6096C6.64057 17.8597 6.97971 18.0002 7.33333 18.0002H16.6667C17.0203 18.0002 17.3594 17.8597 17.6095 17.6096C17.8595 17.3596 18 17.0204 18 16.6668V12.0002M16.25 5.75015C16.5152 5.48493 16.8749 5.33594 17.25 5.33594C17.6251 5.33594 17.9848 5.48493 18.25 5.75015C18.5152 6.01537 18.6642 6.37508 18.6642 6.75015C18.6642 7.12522 18.5152 7.48493 18.25 7.75015L12.2413 13.7595C12.083 13.9176 11.8875 14.0334 11.6727 14.0962L9.75733 14.6562C9.69997 14.6729 9.63916 14.6739 9.58127 14.6591C9.52339 14.6442 9.47055 14.6141 9.4283 14.5719C9.38604 14.5296 9.35593 14.4768 9.3411 14.4189C9.32627 14.361 9.32727 14.3002 9.344 14.2428L9.904 12.3275C9.96702 12.1129 10.083 11.9175 10.2413 11.7595L16.25 5.75015Z" stroke="#1A70E5" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
151
151
  </svg>
152
152
  `;
153
153
  let ut = (i = 21) => crypto.getRandomValues(new Uint8Array(i)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), "");
154
- function On(i, e) {
154
+ function Un(i, e) {
155
155
  const t = i[0] - e[0], n = i[1] - e[1];
156
156
  return t * t + n * n;
157
157
  }
158
- function Un(i, e, t) {
158
+ function qn(i, e, t) {
159
159
  let n = e[0], s = e[1], r = t[0] - n, o = t[1] - s;
160
160
  if (r !== 0 || o !== 0) {
161
161
  const a = ((i[0] - n) * r + (i[1] - s) * o) / (r * r + o * o);
@@ -163,32 +163,32 @@ function Un(i, e, t) {
163
163
  }
164
164
  return r = i[0] - n, o = i[1] - s, r * r + o * o;
165
165
  }
166
- function qn(i, e) {
166
+ function Wn(i, e) {
167
167
  let t = i[0];
168
168
  const n = [t];
169
169
  let s;
170
170
  for (let r = 1, o = i.length; r < o; r++)
171
- s = i[r], On(s, t) > e && (n.push(s), t = s);
171
+ s = i[r], Un(s, t) > e && (n.push(s), t = s);
172
172
  return t !== s && n.push(s), n;
173
173
  }
174
- function ae(i, e, t, n, s) {
174
+ function ce(i, e, t, n, s) {
175
175
  let r = n, o = 0;
176
176
  for (let a = e + 1; a < t; a++) {
177
- const l = Un(i[a], i[e], i[t]);
177
+ const l = qn(i[a], i[e], i[t]);
178
178
  l > r && (o = a, r = l);
179
179
  }
180
- r > n && (o - e > 1 && ae(i, e, o, n, s), s.push(i[o]), t - o > 1 && ae(i, o, t, n, s));
180
+ r > n && (o - e > 1 && ce(i, e, o, n, s), s.push(i[o]), t - o > 1 && ce(i, o, t, n, s));
181
181
  }
182
- function Wn(i, e) {
182
+ function jn(i, e) {
183
183
  const t = i.length - 1, n = [i[0]];
184
- return ae(i, 0, t, e, n), n.push(i[t]), n;
184
+ return ce(i, 0, t, e, n), n.push(i[t]), n;
185
185
  }
186
- function me(i, e, t) {
186
+ function ye(i, e, t) {
187
187
  if (i.length <= 2) return i;
188
188
  const n = e !== void 0 ? e * e : 1;
189
- return i = t ? i : qn(i, n), i = Wn(i, n), i;
189
+ return i = t ? i : Wn(i, n), i = jn(i, n), i;
190
190
  }
191
- function ye(i) {
191
+ function we(i) {
192
192
  if (i.geometry.bbox) return i.geometry.bbox;
193
193
  const e = i.geometry.coordinates[0];
194
194
  let t = 1 / 0, n = 1 / 0, s = -1 / 0, r = -1 / 0;
@@ -196,7 +196,7 @@ function ye(i) {
196
196
  o < t && (t = o), o > s && (s = o), a < n && (n = a), a > r && (r = a);
197
197
  return [t, n, s, r];
198
198
  }
199
- function tn(i) {
199
+ function en(i) {
200
200
  const e = i.geometry.coordinates[0];
201
201
  let t = 0, n = 0;
202
202
  const s = e.length - 1;
@@ -207,7 +207,7 @@ function tn(i) {
207
207
  y: n / s
208
208
  };
209
209
  }
210
- function Er(i, e, t) {
210
+ function Cr(i, e, t) {
211
211
  const n = i.geometry.coordinates.map(
212
212
  (o) => o.map(([a, l]) => [a + e, l + t])
213
213
  ), s = i.geometry.bbox, r = s ? [s[0] + e, s[1] + t, s[2] + e, s[3] + t] : void 0;
@@ -220,14 +220,14 @@ function Er(i, e, t) {
220
220
  }
221
221
  };
222
222
  }
223
- function en(i) {
223
+ function nn(i) {
224
224
  const e = i.geometry.coordinates[0];
225
225
  let t = 1 / 0, n = 1 / 0, s = -1 / 0, r = -1 / 0;
226
226
  for (const [o, a] of e)
227
227
  o < t && (t = o), o > s && (s = o), a < n && (n = a), a > r && (r = a);
228
228
  i.geometry.bbox = [t, n, s, r];
229
229
  }
230
- function Cr(i, e, t, n) {
230
+ function kr(i, e, t, n) {
231
231
  const s = i.geometry.coordinates.map(
232
232
  (o) => o.map(([a, l]) => {
233
233
  const h = a - t, c = l - n;
@@ -240,11 +240,11 @@ function Cr(i, e, t, n) {
240
240
  coordinates: s
241
241
  }
242
242
  };
243
- return en(r), r;
243
+ return nn(r), r;
244
244
  }
245
- const jn = "http://www.w3.org/2000/svg";
245
+ const Gn = "http://www.w3.org/2000/svg";
246
246
  function M(i) {
247
- return document.createElementNS(jn, i);
247
+ return document.createElementNS(Gn, i);
248
248
  }
249
249
  function rt(i) {
250
250
  return i.geometry.bbox || kt(i), i.geometry.bbox;
@@ -301,35 +301,35 @@ function kt(i) {
301
301
  i.geometry.bbox = [t, n, s, r];
302
302
  }
303
303
  }
304
- function kr(i, e, t, n, s) {
304
+ function Mr(i, e, t, n, s) {
305
305
  i.geometry.coordinates = [e + n / 2, t + s / 2], i.geometry.bbox = [e, t, e + n, t + s], i.properties.width = n, i.properties.height = s;
306
306
  }
307
- function nn(i) {
307
+ function sn(i) {
308
308
  const [e, t] = i.geometry.coordinates[0];
309
309
  return { x: e, y: t };
310
310
  }
311
311
  function Ht(i, e) {
312
- const [t, n] = i.geometry.coordinates[e === O ? 0 : 1];
312
+ const [t, n] = i.geometry.coordinates[e === X ? 0 : 1];
313
313
  return { x: t, y: n };
314
314
  }
315
- function sn(i) {
315
+ function rn(i) {
316
316
  const [e, t] = i.geometry.coordinates[1];
317
317
  return { x: e, y: t };
318
318
  }
319
- function Gn(i, e, t) {
319
+ function Vn(i, e, t) {
320
320
  i.geometry.coordinates[0] = [e, t];
321
321
  }
322
- function Vn(i, e, t) {
322
+ function Zn(i, e, t) {
323
323
  i.geometry.coordinates[1] = [e, t];
324
324
  }
325
- function ue(i) {
326
- return { start: nn(i), end: sn(i) };
325
+ function ge(i) {
326
+ return { start: sn(i), end: rn(i) };
327
327
  }
328
- function Zn(i, e, t, n) {
329
- e === O ? Gn(i, t, n) : Vn(i, t, n);
328
+ function Kn(i, e, t, n) {
329
+ e === X ? Vn(i, t, n) : Zn(i, t, n);
330
330
  }
331
- const Mr = (i) => parseInt(i.getAttribute("data-handle-id") || "-1");
332
- function Tr(i) {
331
+ const Tr = (i) => parseInt(i.getAttribute("data-handle-id") || "-1");
332
+ function Fr(i) {
333
333
  return _t(i).reduce(
334
334
  (e, t) => (e[0] = Math.min(t[0], e[0]), e[1] = Math.min(t[1], e[1]), e[2] = Math.max(t[0], e[2]), e[3] = Math.max(t[1], e[3]), e),
335
335
  [
@@ -340,13 +340,13 @@ function Tr(i) {
340
340
  ]
341
341
  );
342
342
  }
343
- function Kn(i) {
343
+ function Jn(i) {
344
344
  return Array.isArray(i) && i.length === 2 && i.every(isFinite);
345
345
  }
346
- function Fr(i, e, t, n) {
346
+ function Pr(i, e, t, n) {
347
347
  for (let s = 0; s < i.coordinates.length; s++) {
348
348
  const r = i.coordinates[s];
349
- if (Kn(r))
349
+ if (Jn(r))
350
350
  r[0] = t + (r[0] - t) * e, r[1] = n + (r[1] - n) * e;
351
351
  else
352
352
  for (let o = 0; o < r.length; o++) {
@@ -391,7 +391,7 @@ function _t(i) {
391
391
  ));
392
392
  return e;
393
393
  }
394
- function Pr(i, e, t) {
394
+ function Dr(i, e, t) {
395
395
  const n = Math.atan2(i.y - e.y, i.x - e.x);
396
396
  return {
397
397
  x: e.x + t * Math.cos(n),
@@ -406,12 +406,12 @@ function It(i, e) {
406
406
  y: i.clientY - t.top - e.clientTop
407
407
  };
408
408
  }
409
- function Dr(i, e) {
410
- return i.startsWith("#") ? Jn(i, e) : i.startsWith("rgb") ? Qn(i, e) : i;
409
+ function Lr(i, e) {
410
+ return i.startsWith("#") ? Qn(i, e) : i.startsWith("rgb") ? ts(i, e) : i;
411
411
  }
412
- function Lr(i) {
412
+ function Hr(i) {
413
413
  if (i.startsWith("#")) {
414
- const e = ge(i), t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
414
+ const e = fe(i), t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
415
415
  return { r: t, g: n, b: s, a: 1 };
416
416
  } else {
417
417
  const e = i.match(
@@ -426,21 +426,21 @@ function Lr(i) {
426
426
  };
427
427
  }
428
428
  }
429
- function ge(i) {
429
+ function fe(i) {
430
430
  return i.length === 4 ? i.split("").map((e) => e + e).join("") : i;
431
431
  }
432
- function Jn(i, e) {
433
- const [t, n, s] = ge(i).match(/\w\w/g).map((r) => parseInt(r, 16));
432
+ function Qn(i, e) {
433
+ const [t, n, s] = fe(i).match(/\w\w/g).map((r) => parseInt(r, 16));
434
434
  return `rgba(${t}, ${n}, ${s}, ${e})`;
435
435
  }
436
- function Qn(i, e) {
436
+ function ts(i, e) {
437
437
  const [t, n, s] = i.match(/\d+/g).map((r) => parseInt(r, 10));
438
438
  return `rgba(${t}, ${n}, ${s}, ${e})`;
439
439
  }
440
- function we() {
440
+ function xe() {
441
441
  return typeof window < "u" ? window : void 0;
442
442
  }
443
- const rn = (i, e = 16, t = !1) => {
443
+ const on = (i, e = 16, t = !1) => {
444
444
  let n = !1, s = null;
445
445
  const r = Math.max(1, Math.round(e * 60 / 1e3)), o = (a) => {
446
446
  requestAnimationFrame(() => {
@@ -459,13 +459,13 @@ const rn = (i, e = 16, t = !1) => {
459
459
  }
460
460
  i(...a), n = !0, o(r);
461
461
  };
462
- }, Hr = (i, e) => {
462
+ }, _r = (i, e) => {
463
463
  let t;
464
464
  return (...s) => {
465
465
  clearTimeout(t), t = setTimeout(() => i(...s), e);
466
466
  };
467
467
  };
468
- function _r(i, e) {
468
+ function Ir(i, e) {
469
469
  let t;
470
470
  return function(...n) {
471
471
  clearTimeout(t), t = setTimeout(() => {
@@ -473,7 +473,7 @@ function _r(i, e) {
473
473
  }, e);
474
474
  };
475
475
  }
476
- function ts(i) {
476
+ function es(i) {
477
477
  if ((W(i) || _(i)) && i.geometry.type === "Polygon") {
478
478
  const e = i.geometry.coordinates[0], t = e[0][0], n = e[0][1], s = e[2][0], r = e[2][1], o = s - t, a = r - n, l = t + o / 2, h = n + a / 2;
479
479
  return {
@@ -492,11 +492,11 @@ function ts(i) {
492
492
  }
493
493
  return i;
494
494
  }
495
- function on(i, e) {
495
+ function an(i, e) {
496
496
  let t, n, s, r = 1;
497
497
  const o = i.trim();
498
498
  if (o.startsWith("#")) {
499
- const d = (o.length === 4 ? ge(o) : o).match(/#?(\w{2})(\w{2})(\w{2})/);
499
+ const d = (o.length === 4 ? fe(o) : o).match(/#?(\w{2})(\w{2})(\w{2})/);
500
500
  if (!d) return i;
501
501
  t = parseInt(d[1], 16), n = parseInt(d[2], 16), s = parseInt(d[3], 16);
502
502
  } else {
@@ -509,14 +509,14 @@ function on(i, e) {
509
509
  const a = e * 100, h = 0.299 * t + 0.587 * n + 0.114 * s > 186 ? -a / 2 : a;
510
510
  return t = Math.max(0, Math.min(255, t + Math.round(2.55 * h))), n = Math.max(0, Math.min(255, n + Math.round(2.55 * h))), s = Math.max(0, Math.min(255, s + Math.round(2.55 * h))), `rgba(${t},${n},${s},${r})`;
511
511
  }
512
- const Ft = (i) => on(i, Ke), Ir = (i) => on(i, -Ke), X = (i, e) => ({
512
+ const Ft = (i) => an(i, Je), zr = (i) => an(i, -Je), Y = (i, e) => ({
513
513
  x: i.x - e.x,
514
514
  y: i.y - e.y
515
- }), K = (i) => Math.sqrt(i.x * i.x + i.y * i.y), es = (i) => ({
515
+ }), J = (i) => Math.sqrt(i.x * i.x + i.y * i.y), ns = (i) => ({
516
516
  x: -i.x,
517
517
  y: -i.y
518
518
  }), Nt = (i) => {
519
- const e = K(i);
519
+ const e = J(i);
520
520
  return e === 0 ? { x: 0, y: 0 } : {
521
521
  x: i.x / e,
522
522
  y: i.y / e
@@ -527,16 +527,16 @@ const Ft = (i) => on(i, Ke), Ir = (i) => on(i, -Ke), X = (i, e) => ({
527
527
  }), ot = (i, e) => ({
528
528
  x: i.x * e,
529
529
  y: i.y * e
530
- }), xe = (i, e) => {
530
+ }), be = (i, e) => {
531
531
  const t = Math.sin(e), n = Math.cos(e);
532
532
  return {
533
533
  x: i.x * n - i.y * t,
534
534
  y: i.x * t + i.y * n
535
535
  };
536
- }, mt = (i, e) => i.x * e.x + i.y * e.y, ns = (i, e) => i.x * e.y - i.y * e.x, tt = (i) => i.properties.type === "arrow";
537
- function an(i, e, t) {
538
- const { start: n, end: s } = ue(i), r = X(e, n), o = i.properties.style.strokeWidth, a = X(s, n), l = K(a), h = mt(r, Nt(a));
539
- return h > 0 && h < l && Math.abs(ns(r, Nt(a))) < o / 2 + t;
536
+ }, mt = (i, e) => i.x * e.x + i.y * e.y, ss = (i, e) => i.x * e.y - i.y * e.x, tt = (i) => i.properties.type === "arrow";
537
+ function cn(i, e, t) {
538
+ const { start: n, end: s } = ge(i), r = Y(e, n), o = i.properties.style.strokeWidth, a = Y(s, n), l = J(a), h = mt(r, Nt(a));
539
+ return h > 0 && h < l && Math.abs(ss(r, Nt(a))) < o / 2 + t;
540
540
  }
541
541
  const yt = {
542
542
  strokeType: "plain",
@@ -544,7 +544,7 @@ const yt = {
544
544
  strokeWidth: 1,
545
545
  head: "none",
546
546
  tail: "none"
547
- }, zr = {
547
+ }, Br = {
548
548
  id: void 0,
549
549
  // will be set by the editor
550
550
  type: "Feature",
@@ -589,7 +589,7 @@ const yt = {
589
589
  ]
590
590
  }
591
591
  }), W = (i) => i.properties.type === "box";
592
- function ss(i, e, t = 0, n = 1, s = 0) {
592
+ function is(i, e, t = 0, n = 1, s = 0) {
593
593
  const r = St(i), { width: o, height: a } = q(i), l = e.x - r.x, h = e.y - r.y, c = l * n - h * t, d = l * t + h * n;
594
594
  return c > -s && c < o + s && d > -s && d < a + s;
595
595
  }
@@ -600,7 +600,7 @@ const Mt = {
600
600
  boxShadow: "",
601
601
  padding: 16,
602
602
  strokeType: "plain"
603
- }, Br = {
603
+ }, Rr = {
604
604
  id: void 0,
605
605
  // will be set by the editor
606
606
  type: "Feature",
@@ -616,7 +616,7 @@ const Mt = {
616
616
  // center of 100x50 box
617
617
  bbox: [0, 0, 100, 50]
618
618
  }
619
- }, be = (i = 0, e = 0, t = 100, n = 50, s = { ...Mt }) => ({
619
+ }, ve = (i = 0, e = 0, t = 100, n = 50, s = { ...Mt }) => ({
620
620
  id: ut(),
621
621
  type: "Feature",
622
622
  properties: {
@@ -630,7 +630,7 @@ const Mt = {
630
630
  coordinates: [i + t / 2, e + n / 2]
631
631
  // center
632
632
  }
633
- }), _ = (i) => i.properties.type === "text", U = {
633
+ }), _ = (i) => i.properties.type === "text", G = {
634
634
  font: "sans-serif",
635
635
  fontSize: 18,
636
636
  color: "#505050",
@@ -640,7 +640,7 @@ const Mt = {
640
640
  padding: 16,
641
641
  strokeType: "plain",
642
642
  fixedSize: !1
643
- }, Rr = {
643
+ }, $r = {
644
644
  id: ut(),
645
645
  type: "Feature",
646
646
  properties: {
@@ -648,7 +648,7 @@ const Mt = {
648
648
  content: "",
649
649
  width: 100,
650
650
  height: 50,
651
- style: { ...U }
651
+ style: { ...G }
652
652
  },
653
653
  geometry: {
654
654
  type: "Point",
@@ -656,7 +656,7 @@ const Mt = {
656
656
  // center of 100x50 box
657
657
  bbox: [0, 0, 100, 50]
658
658
  }
659
- }, ve = (i = 0, e = 0, t = 100, n = 50, s = "", r = { ...U }) => ({
659
+ }, Se = (i = 0, e = 0, t = 100, n = 50, s = "", r = { ...G }) => ({
660
660
  id: ut(),
661
661
  type: "Feature",
662
662
  properties: {
@@ -664,7 +664,7 @@ const Mt = {
664
664
  content: s,
665
665
  width: t,
666
666
  height: n,
667
- style: { ...U, ...r }
667
+ style: { ...G, ...r }
668
668
  },
669
669
  geometry: {
670
670
  type: "Point",
@@ -673,15 +673,15 @@ const Mt = {
673
673
  bbox: [i, e, i + t, e + n]
674
674
  }
675
675
  });
676
- function cn(i, e, t = 0, n = 0, s = 1, r = 1) {
676
+ function ln(i, e, t = 0, n = 0, s = 1, r = 1) {
677
677
  var m;
678
678
  const [o, a] = i.geometry.coordinates;
679
679
  let { width: l, height: h } = q(i);
680
680
  (m = i.properties.style) != null && m.fixedSize && (l /= r, h /= r);
681
- const c = l / 2, d = h / 2, u = e.x - o, g = e.y - a, p = u * s - g * n, f = u * n + g * s;
682
- return p > -c - t && p < c + t && f > -d - t && f < d + t;
681
+ const c = l / 2, d = h / 2, u = e.x - o, g = e.y - a, f = u * s - g * n, p = u * n + g * s;
682
+ return f > -c - t && f < c + t && p > -d - t && p < d + t;
683
683
  }
684
- const D = (i) => i.properties.type === "comment", J = {
684
+ const P = (i) => i.properties.type === "comment", V = {
685
685
  // Box styling
686
686
  background: "#FFFACD",
687
687
  // Light yellow (sticky note color)
@@ -691,11 +691,11 @@ const D = (i) => i.properties.type === "comment", J = {
691
691
  strokeWidth: 1,
692
692
  strokeType: "plain",
693
693
  // Icon styling (collapsed mode)
694
- iconColor: "#FFCB2F",
694
+ iconColor: "#FFFACD",
695
695
  // Gold
696
696
  iconSymbol: "💬",
697
697
  iconBorderColor: "#aaa",
698
- iconBorderWidth: 2,
698
+ iconBorderWidth: 1,
699
699
  // Size properties
700
700
  minHeight: 60,
701
701
  maxHeight: 480,
@@ -708,26 +708,29 @@ const D = (i) => i.properties.type === "comment", J = {
708
708
  // Editing UI
709
709
  showSendButton: !0,
710
710
  autoGrow: !0,
711
+ // Visual effects
712
+ shadow: !0,
713
+ expandOnSelect: !1,
711
714
  // Fixed size (always screen-aligned)
712
715
  fixedSize: !0
713
- }, jt = {
716
+ }, Gt = {
714
717
  mode: "expanded",
715
718
  width: 200,
716
719
  height: 60,
717
720
  // Initial height, will auto-grow
718
- style: J
721
+ style: V
719
722
  };
720
- function ln(i, e, t, n) {
723
+ function hn(i, e, t, n) {
721
724
  const s = {
722
725
  type: "comment",
723
726
  content: t,
724
- mode: (n == null ? void 0 : n.mode) ?? jt.mode,
725
- width: (n == null ? void 0 : n.width) ?? jt.width,
726
- height: (n == null ? void 0 : n.height) ?? jt.height,
727
+ mode: (n == null ? void 0 : n.mode) ?? Gt.mode,
728
+ width: (n == null ? void 0 : n.width) ?? Gt.width,
729
+ height: (n == null ? void 0 : n.height) ?? Gt.height,
727
730
  author: n == null ? void 0 : n.author,
728
731
  timestamp: n == null ? void 0 : n.timestamp,
729
732
  style: {
730
- ...J,
733
+ ...V,
731
734
  ...n == null ? void 0 : n.style
732
735
  }
733
736
  };
@@ -741,7 +744,7 @@ function ln(i, e, t, n) {
741
744
  }
742
745
  };
743
746
  }
744
- function $r(i) {
747
+ function Nr(i) {
745
748
  return {
746
749
  ...i,
747
750
  properties: {
@@ -750,9 +753,9 @@ function $r(i) {
750
753
  }
751
754
  };
752
755
  }
753
- function is(i, e, t = 0, n, s, r = 1) {
756
+ function rs(i, e, t = 0, n, s, r = 1) {
754
757
  if (i.properties.mode !== at)
755
- return cn(
758
+ return ln(
756
759
  i,
757
760
  e,
758
761
  t,
@@ -760,30 +763,30 @@ function is(i, e, t = 0, n, s, r = 1) {
760
763
  s,
761
764
  r
762
765
  );
763
- const o = i.properties, a = { ...J, ...o.style };
766
+ const o = i.properties, a = { ...V, ...o.style };
764
767
  let l = a.iconSize, h = a.iconSize;
765
768
  a.fixedSize && (l /= r, h /= r);
766
769
  const c = l / 2, d = h / 2, u = e.x - i.geometry.coordinates[0], g = e.y - i.geometry.coordinates[1];
767
770
  return u >= -c - t && u <= c + t && g >= -d - t && g <= d + t;
768
771
  }
769
- function Nr(i) {
772
+ function Yr(i) {
770
773
  const [e, t] = i.geometry.coordinates;
771
774
  return { x: e, y: t };
772
775
  }
773
- function Yr(i) {
774
- const e = i.properties, t = { ...J, ...e.style };
776
+ function Or(i) {
777
+ const e = i.properties, t = { ...V, ...e.style };
775
778
  return e.mode === at ? { width: t.iconSize, height: t.iconSize } : { width: e.width, height: e.height };
776
779
  }
777
- function rs(i, e = 80) {
780
+ function os(i, e = 80) {
778
781
  const t = e / i.properties.width;
779
782
  return Math.max(0.1, Math.min(1, t));
780
783
  }
781
784
  function Xr(i) {
782
- const e = { ...J, ...i.properties.style };
783
- return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : rs(i);
785
+ const e = { ...V, ...i.properties.style };
786
+ return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : os(i);
784
787
  }
785
- function Or(i, e, t, n, s = "", r) {
786
- const o = ln(
788
+ function Ur(i, e, t, n, s = "", r) {
789
+ const o = hn(
787
790
  t,
788
791
  n,
789
792
  s,
@@ -795,19 +798,19 @@ function Or(i, e, t, n, s = "", r) {
795
798
  ...r == null ? void 0 : r.arrowStyle
796
799
  }, l = Yt(t, n, i, e, a);
797
800
  return l.properties.link = {
798
- [O]: {
801
+ [X]: {
799
802
  id: o.id,
800
- side: O,
803
+ side: X,
801
804
  type: "comment",
802
805
  magnet: { x: 0, y: 0 }
803
806
  }
804
807
  }, { comment: o, arrow: l };
805
808
  }
806
- function os(i, e, t, n, s, r, o, a, l) {
807
- const h = i - o, c = e - a, d = o + h * r - c * s, u = a + h * s + c * r, g = o + (h + t) * r - c * s, p = a + (h + t) * s + c * r, f = o + (h + t) * r - (c + n) * s, m = a + (h + t) * s + (c + n) * r, x = o + h * r - (c + n) * s, b = a + h * s + (c + n) * r;
808
- return l[0] = Math.min(d, g, f, x), l[1] = Math.min(u, p, m, b), l[2] = Math.max(d, g, f, x), l[3] = Math.max(u, p, m, b), l;
809
+ function as(i, e, t, n, s, r, o, a, l) {
810
+ const h = i - o, c = e - a, d = o + h * r - c * s, u = a + h * s + c * r, g = o + (h + t) * r - c * s, f = a + (h + t) * s + c * r, p = o + (h + t) * r - (c + n) * s, m = a + (h + t) * s + (c + n) * r, w = o + h * r - (c + n) * s, b = a + h * s + (c + n) * r;
811
+ return l[0] = Math.min(d, g, p, w), l[1] = Math.min(u, f, m, b), l[2] = Math.max(d, g, p, w), l[3] = Math.max(u, f, m, b), l;
809
812
  }
810
- function as(i, e, t) {
813
+ function cs(i, e, t) {
811
814
  const n = t.x - e.x, s = t.y - e.y, r = n * n + s * s;
812
815
  if (r === 0) {
813
816
  const d = i.x - e.x, u = i.y - e.y;
@@ -818,8 +821,8 @@ function as(i, e, t) {
818
821
  const a = e.x + o * n, l = e.y + o * s, h = i.x - a, c = i.y - l;
819
822
  return Math.sqrt(h * h + c * c);
820
823
  }
821
- const nt = (i) => i.properties.type === "polygon";
822
- function hn(i, e, t = 0) {
824
+ const st = (i) => i.properties.type === "polygon";
825
+ function dn(i, e, t = 0) {
823
826
  const n = i.geometry.coordinates[0], s = i.geometry.bbox;
824
827
  if (s) {
825
828
  const [o, a, l, h] = s;
@@ -835,11 +838,11 @@ function hn(i, e, t = 0) {
835
838
  if (t > 0)
836
839
  for (let o = 0; o < n.length - 1; o++) {
837
840
  const [a, l] = n[o], [h, c] = n[o + 1];
838
- if (as(e, { x: a, y: l }, { x: h, y: c }) <= t) return !0;
841
+ if (cs(e, { x: a, y: l }, { x: h, y: c }) <= t) return !0;
839
842
  }
840
843
  return !1;
841
844
  }
842
- function cs(i, e) {
845
+ function ls(i, e) {
843
846
  const t = i[0];
844
847
  t.length > 0 && (t[0][0] !== t[t.length - 1][0] || t[0][1] !== t[t.length - 1][1]) && t.push([t[0][0], t[0][1]]);
845
848
  let n = 1 / 0, s = 1 / 0, r = -1 / 0, o = -1 / 0;
@@ -869,43 +872,43 @@ const lt = {
869
872
  strokeColor: "#000000",
870
873
  strokeWidth: 2,
871
874
  background: "transparent"
872
- }, Ur = {
875
+ }, qr = {
873
876
  type: "polygon",
874
877
  style: {
875
878
  ...lt
876
879
  }
877
- }, Se = (i) => i.type === "FeatureCollection";
878
- function dn(i) {
880
+ }, Ae = (i) => i.type === "FeatureCollection";
881
+ function un(i) {
879
882
  return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(i.trim());
880
883
  }
881
- function un(i) {
884
+ function gn(i) {
882
885
  return /^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(i.trim());
883
886
  }
884
- function gn(i) {
887
+ function fn(i) {
885
888
  return /^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[0-9.]+\s*\)$/.test(
886
889
  i.trim()
887
890
  );
888
891
  }
889
- function ls(i) {
890
- return dn(i) || un(i) || gn(i);
891
- }
892
- function qr(i) {
893
- if (ls(i)) return i;
894
- throw new Error(`Invalid color format: ${i}`);
892
+ function hs(i) {
893
+ return un(i) || gn(i) || fn(i);
895
894
  }
896
895
  function Wr(i) {
897
- if (dn(i)) return i;
898
- throw new Error(`Invalid hex color format: ${i}`);
896
+ if (hs(i)) return i;
897
+ throw new Error(`Invalid color format: ${i}`);
899
898
  }
900
899
  function jr(i) {
901
900
  if (un(i)) return i;
902
- throw new Error(`Invalid RGB color format: ${i}`);
901
+ throw new Error(`Invalid hex color format: ${i}`);
903
902
  }
904
903
  function Gr(i) {
905
904
  if (gn(i)) return i;
905
+ throw new Error(`Invalid RGB color format: ${i}`);
906
+ }
907
+ function Vr(i) {
908
+ if (fn(i)) return i;
906
909
  throw new Error(`Invalid RGBA color format: ${i}`);
907
910
  }
908
- class hs {
911
+ class ds {
909
912
  constructor(e) {
910
913
  y(this, "previousZoom", -1);
911
914
  this.store = e;
@@ -916,7 +919,7 @@ class hs {
916
919
  */
917
920
  toggleComment(e) {
918
921
  const t = this.store.getState().getFeature(e);
919
- if (!t || !D(t)) return;
922
+ if (!t || !P(t)) return;
920
923
  const n = t;
921
924
  this.store.getState().applyLiveUpdate(e, {
922
925
  properties: {
@@ -935,7 +938,7 @@ class hs {
935
938
  this.previousZoom = e;
936
939
  const t = this.store.getState(), n = t.features, s = {};
937
940
  Object.values(n).forEach((r) => {
938
- if (D(r)) {
941
+ if (P(r)) {
939
942
  const o = r, a = this.getCommentZoomThreshold(o), l = e < a ? at : Rt;
940
943
  if (o.properties.mode === l) return;
941
944
  s[o.id] = {
@@ -1053,13 +1056,13 @@ class qt extends EventTarget {
1053
1056
  if (this.annotation = t ? t.id : null, this.annotation !== null) {
1054
1057
  const n = this.ogma.getContainer();
1055
1058
  if (n) {
1056
- const s = we() || n;
1059
+ const s = xe() || n;
1057
1060
  s.addEventListener("mousemove", this.handleMouseMove), s.addEventListener("mouseup", this.handleMouseUp, !1), n.addEventListener("mousedown", this.handleMouseDown, !0), s.addEventListener("click", this.onClick, !0);
1058
1061
  }
1059
1062
  } else {
1060
1063
  const n = this.ogma.getContainer();
1061
1064
  if (n) {
1062
- const s = we() || n;
1065
+ const s = xe() || n;
1063
1066
  s.removeEventListener("mousemove", this.handleMouseMove), s.removeEventListener("mouseup", this.handleMouseUp), n.removeEventListener("mousedown", this.handleMouseDown), s.removeEventListener("click", this.onClick);
1064
1067
  }
1065
1068
  this.clearDragState(), this.setCursor(I.default);
@@ -1089,7 +1092,7 @@ class qt extends EventTarget {
1089
1092
  return this.annotation !== null;
1090
1093
  }
1091
1094
  }
1092
- class ds extends qt {
1095
+ class us extends qt {
1093
1096
  constructor(t, n, s, r, o, a, l) {
1094
1097
  super(t, n);
1095
1098
  y(this, "links");
@@ -1102,7 +1105,7 @@ class ds extends qt {
1102
1105
  y(this, "startX", 0);
1103
1106
  y(this, "startY", 0);
1104
1107
  y(this, "onArrowComplete", () => {
1105
- var x;
1108
+ var v;
1106
1109
  this.arrowHandler.removeEventListener("dragend", this.onArrowComplete);
1107
1110
  const t = this.store.getState(), n = Array.from(t.selectedFeatures);
1108
1111
  if (n.length === 0) return;
@@ -1113,15 +1116,15 @@ class ds extends qt {
1113
1116
  h < 5 ? (c = this.startX + this.offsetX, d = this.startY + this.offsetY) : (c = o[0], d = o[1]);
1114
1117
  const u = this.comment;
1115
1118
  u.geometry.coordinates = [c, d], t.addFeature(u), this.store.setState({ drawingFeature: u.id });
1116
- const g = u.properties.height, p = c, f = d + g * 0.5;
1119
+ const g = u.properties.height, f = t.zoom, p = g / f, m = c, w = d + p * 0.5;
1117
1120
  this.snapArrowStart(s, r[0], r[1]);
1118
- const m = (x = s.properties.link) == null ? void 0 : x.start;
1121
+ const b = (v = s.properties.link) == null ? void 0 : v.start;
1119
1122
  t.updateFeature(s.id, {
1120
1123
  ...s,
1121
1124
  geometry: {
1122
1125
  ...s.geometry,
1123
1126
  coordinates: [
1124
- [p, f],
1127
+ [m, w],
1125
1128
  // Start: comment bottom edge
1126
1129
  r
1127
1130
  // End: original mousedown point (with any snapping from ArrowHandler)
@@ -1131,30 +1134,30 @@ class ds extends qt {
1131
1134
  ...s.properties,
1132
1135
  link: {
1133
1136
  start: {
1134
- side: O,
1137
+ side: X,
1135
1138
  id: u.id,
1136
1139
  type: T.COMMENT,
1137
1140
  magnet: { x: 0, y: 0.5 }
1138
1141
  },
1139
1142
  // If ArrowHandler snapped to something at the original start point,
1140
1143
  // that becomes the end point now
1141
- end: m ? {
1144
+ end: b ? {
1142
1145
  side: it,
1143
- id: m.id,
1144
- type: m.type,
1145
- magnet: m.magnet
1146
+ id: b.id,
1147
+ type: b.type,
1148
+ magnet: b.magnet
1146
1149
  } : void 0
1147
1150
  }
1148
1151
  }
1149
- }), this.links.add(s, O, u.id, T.COMMENT, {
1152
+ }), this.links.add(s, X, u.id, T.COMMENT, {
1150
1153
  x: 0,
1151
1154
  y: 0.5
1152
- }), m && m.magnet && this.links.add(
1155
+ }), b && b.magnet && this.links.add(
1153
1156
  s,
1154
1157
  it,
1155
- m.id,
1156
- m.type,
1157
- m.magnet
1158
+ b.id,
1159
+ b.type,
1160
+ b.magnet
1158
1161
  ), t.setSelectedFeatures([u.id]), this.store.setState({ drawingFeature: null });
1159
1162
  });
1160
1163
  this.links = s, this.arrowHandler = o, this.snapping = r, this.offsetX = (l == null ? void 0 : l.offsetX) ?? 100, this.offsetY = (l == null ? void 0 : l.offsetY) ?? -50, this.arrowStyle = l == null ? void 0 : l.arrowStyle, this.comment = a;
@@ -1175,38 +1178,38 @@ class ds extends qt {
1175
1178
  const r = this.snapping.snap({ x: n, y: s });
1176
1179
  r && (t.geometry.coordinates[0] = [r.point.x, r.point.y], t.properties.link = {
1177
1180
  start: {
1178
- side: O,
1181
+ side: X,
1179
1182
  id: r.id,
1180
1183
  type: r.type,
1181
1184
  magnet: r.magnet
1182
1185
  }
1183
- }, this.links.add(t, O, r.id, r.type, r.magnet));
1186
+ }, this.links.add(t, X, r.id, r.type, r.magnet));
1184
1187
  }
1185
1188
  }
1186
- function us(i, e, t, n, s) {
1187
- const { width: r, height: o } = n.view.getSize(), a = 8, l = 16, h = a * l, c = { width: 150, height: 50 }, d = c.width, u = c.height, g = Math.max(r, o), p = 200, f = {
1189
+ function gs(i, e, t, n, s) {
1190
+ const { width: r, height: o } = n.view.getSize(), a = 8, l = 16, h = a * l, c = { width: 150, height: 50 }, d = c.width, u = c.height, g = Math.max(r, o), f = 200, p = {
1188
1191
  minX: 0,
1189
1192
  minY: 0,
1190
1193
  maxX: 0,
1191
1194
  maxY: 0
1192
1195
  }, m = n.view.graphToScreenCoordinates({ x: i, y: e });
1193
- for (let x = 0; x < h; x++) {
1194
- const b = x % a, v = Math.floor(x / a), S = 2 * Math.PI * (b / a), w = p + v / l * (g - p), A = Math.cos(S) * w, C = Math.sin(S) * w, E = m.x + A, k = m.y + C;
1195
- if (f.minX = E, f.minY = k - u / 2, f.maxX = E + d, f.maxY = k + u / 2, A < 0 && (f.minX -= d, f.maxX -= d), f.minX < 0 || f.maxX > r || f.minY < 0 || f.maxY > o)
1196
+ for (let w = 0; w < h; w++) {
1197
+ const b = w % a, v = Math.floor(w / a), S = 2 * Math.PI * (b / a), x = f + v / l * (g - f), A = Math.cos(S) * x, C = Math.sin(S) * x, E = m.x + A, k = m.y + C;
1198
+ if (p.minX = E, p.minY = k - u / 2, p.maxX = E + d, p.maxY = k + u / 2, A < 0 && (p.minX -= d, p.maxX -= d), p.minX < 0 || p.maxX > r || p.minY < 0 || p.maxY > o)
1196
1199
  continue;
1197
1200
  const F = n.view.screenToGraphCoordinates({
1198
- x: f.minX,
1199
- y: f.minY
1200
- }), j = n.view.screenToGraphCoordinates({
1201
- x: f.maxX,
1202
- y: f.maxY
1201
+ x: p.minX,
1202
+ y: p.minY
1203
+ }), O = n.view.screenToGraphCoordinates({
1204
+ x: p.maxX,
1205
+ y: p.maxY
1203
1206
  });
1204
- if (f.minX = F.x, f.minY = F.y, f.maxX = j.x, f.maxY = j.y, !t.query(f).filter((R) => R.properties.type !== "arrow").length)
1207
+ if (p.minX = F.x, p.minY = F.y, p.maxX = O.x, p.maxY = O.y, !t.query(p).filter((B) => B.properties.type !== "arrow").length)
1205
1208
  return n.view.screenToGraphCoordinates({ x: E, y: k });
1206
1209
  }
1207
1210
  return n.view.screenToGraphCoordinates({ x: r / 2, y: o / 2 });
1208
1211
  }
1209
- class gs {
1212
+ class fs {
1210
1213
  constructor(e, t, n, s, r, o, a) {
1211
1214
  y(this, "ogma");
1212
1215
  y(this, "store");
@@ -1252,7 +1255,7 @@ class gs {
1252
1255
  }
1253
1256
  enableTextDrawing(e) {
1254
1257
  return this.enableDrawingMode((t, n) => {
1255
- const s = ve(t, n, 0, 0, void 0, e);
1258
+ const s = Se(t, n, 0, 0, void 0, e);
1256
1259
  this.startText(t, n, s);
1257
1260
  });
1258
1261
  }
@@ -1263,7 +1266,7 @@ class gs {
1263
1266
  */
1264
1267
  enableBoxDrawing(e) {
1265
1268
  return this.enableDrawingMode((t, n) => {
1266
- const s = be(t, n, 0, 0, e);
1269
+ const s = ve(t, n, 0, 0, e);
1267
1270
  this.startBox(t, n, s);
1268
1271
  });
1269
1272
  }
@@ -1274,7 +1277,7 @@ class gs {
1274
1277
  */
1275
1278
  enablePolygonDrawing(e) {
1276
1279
  return this.enableDrawingMode((t, n) => {
1277
- const s = cs([[[t, n]]], { style: e });
1280
+ const s = ls([[[t, n]]], { style: e });
1278
1281
  this.startPolygon(t, n, s);
1279
1282
  });
1280
1283
  }
@@ -1291,10 +1294,10 @@ class gs {
1291
1294
  return this.enableDrawingMode((t, n) => {
1292
1295
  let s = e.offsetX, r = e.offsetY;
1293
1296
  if (s === void 0 && r === void 0) {
1294
- const a = us(t, n, this.index, this.ogma);
1297
+ const a = gs(t, n, this.index, this.ogma);
1295
1298
  s = a.x, r = a.y;
1296
1299
  }
1297
- const o = ln(t, n, "", e == null ? void 0 : e.commentStyle);
1300
+ const o = hn(t, n, "", e == null ? void 0 : e.commentStyle);
1298
1301
  this.startComment(t, n, o, {
1299
1302
  ...e,
1300
1303
  offsetX: s,
@@ -1339,7 +1342,7 @@ class gs {
1339
1342
  }
1340
1343
  startComment(e, t, n, s) {
1341
1344
  this.editor.getActiveHandler() && this.editor.getActiveHandler().stopEditing(), this.control.cancelDrawing(), this.store.setState({ drawingFeature: n.id }), this.interactions.suppressClicksTemporarily(200);
1342
- const r = new ds(
1345
+ const r = new us(
1343
1346
  this.ogma,
1344
1347
  this.store,
1345
1348
  this.links,
@@ -1349,24 +1352,24 @@ class gs {
1349
1352
  s
1350
1353
  ), o = (a) => {
1351
1354
  var l;
1352
- a.id === n.id && (this.control.select(a.id), this.control.off(oe, o), (l = this.editor.getActiveHandler()) == null || l.startEditingText());
1355
+ a.id === n.id && (this.control.select(a.id), this.control.off(ae, o), (l = this.editor.getActiveHandler()) == null || l.startEditingText());
1353
1356
  };
1354
- return this.control.on(oe, o), r.startDrawing(n.id, e, t), this.control;
1357
+ return this.control.on(ae, o), r.startDrawing(n.id, e, t), this.control;
1355
1358
  }
1356
1359
  startBox(e, t, n) {
1357
- return n || (n = be(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1360
+ return n || (n = ve(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1358
1361
  }
1359
1362
  startArrow(e, t, n) {
1360
1363
  return n || (n = Yt(e, t)), this.editor.getActiveHandler() && this.editor.getActiveHandler().stopEditing(), this.control.cancelDrawing(), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1361
1364
  }
1362
1365
  startText(e, t, n) {
1363
- return n || (n = ve(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1366
+ return n || (n = Se(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1364
1367
  }
1365
1368
  startPolygon(e, t, n) {
1366
1369
  return this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1367
1370
  }
1368
1371
  }
1369
- class fs {
1372
+ class ps {
1370
1373
  constructor(e, t) {
1371
1374
  this.store = e, this.links = t;
1372
1375
  }
@@ -1405,7 +1408,7 @@ class fs {
1405
1408
  this.store.temporal.getState().clear();
1406
1409
  }
1407
1410
  }
1408
- class ps {
1411
+ class ms {
1409
1412
  constructor(e) {
1410
1413
  this.store = e;
1411
1414
  }
@@ -1454,7 +1457,7 @@ class ps {
1454
1457
  return t ? e.features[t] : null;
1455
1458
  }
1456
1459
  }
1457
- class ms {
1460
+ class ys {
1458
1461
  constructor(e) {
1459
1462
  this.store = e;
1460
1463
  }
@@ -1463,10 +1466,10 @@ class ms {
1463
1466
  * @param annotation The annotation to add
1464
1467
  */
1465
1468
  add(e) {
1466
- if (Se(e))
1469
+ if (Ae(e))
1467
1470
  for (const t of e.features) this.add(t);
1468
1471
  else {
1469
- const t = ts(e);
1472
+ const t = es(e);
1470
1473
  this.store.getState().addFeature(t);
1471
1474
  }
1472
1475
  }
@@ -1475,7 +1478,7 @@ class ms {
1475
1478
  * @param annotation The annotation(s) to remove
1476
1479
  */
1477
1480
  remove(e) {
1478
- if (Se(e))
1481
+ if (Ae(e))
1479
1482
  for (const t of e.features) this.remove(t);
1480
1483
  else
1481
1484
  this.store.getState().removeFeature(e.id);
@@ -1602,12 +1605,12 @@ class ms {
1602
1605
  }
1603
1606
  });
1604
1607
  } else if (_(r) || W(r)) {
1605
- const [a, l] = r.geometry.coordinates, h = a - n, c = l - s, d = n + h * t, u = s + c * t, g = r.properties.width * t, p = r.properties.height * t;
1608
+ const [a, l] = r.geometry.coordinates, h = a - n, c = l - s, d = n + h * t, u = s + c * t, g = r.properties.width * t, f = r.properties.height * t;
1606
1609
  o.updateFeature(e, {
1607
1610
  properties: {
1608
1611
  ...r.properties,
1609
1612
  width: g,
1610
- height: p
1613
+ height: f
1611
1614
  },
1612
1615
  geometry: {
1613
1616
  ...r.geometry,
@@ -1617,19 +1620,19 @@ class ms {
1617
1620
  }
1618
1621
  }
1619
1622
  }
1620
- function ys(i) {
1623
+ function ws(i) {
1621
1624
  var t, n;
1622
1625
  const e = i.properties.link;
1623
1626
  return e ? ((t = e.start) == null ? void 0 : t.type) === T.COMMENT || ((n = e.end) == null ? void 0 : n.type) === T.COMMENT : !1;
1624
1627
  }
1625
- function ws(i) {
1628
+ function xs(i) {
1626
1629
  var e, t;
1627
1630
  return ((t = (e = i.properties.link) == null ? void 0 : e.start) == null ? void 0 : t.type) !== T.COMMENT;
1628
1631
  }
1629
- function Vr(i) {
1632
+ function Zr(i) {
1630
1633
  return !0;
1631
1634
  }
1632
- function fe(i, e, t, n, s = !1) {
1635
+ function pe(i, e, t, n, s = !1) {
1633
1636
  const r = i.getState(), o = r.getFeature(t);
1634
1637
  if (!o) return;
1635
1638
  const a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
@@ -1647,17 +1650,17 @@ function fe(i, e, t, n, s = !1) {
1647
1650
  for (const d of a) {
1648
1651
  const u = r.getFeature(d);
1649
1652
  if (!u) continue;
1650
- const g = xs(u, n);
1653
+ const g = bs(u, n);
1651
1654
  g && (c[d] = g, e.updateLinkedArrowsDuringDrag(d, n, c));
1652
1655
  }
1653
1656
  for (const d of l) {
1654
1657
  const u = r.getFeature(d);
1655
1658
  if (!u) continue;
1656
- const g = u.properties.link || {}, p = u.geometry.coordinates, f = [...p];
1657
- (g.start && Pt(g.start.type) || h === d) && (f[0] = [p[0][0] + n.x, p[0][1] + n.y]), (g.end && Pt(g.end.type) || h === d) && (f[1] = [p[1][0] + n.x, p[1][1] + n.y]), c[d] = {
1659
+ const g = u.properties.link || {}, f = u.geometry.coordinates, p = [...f];
1660
+ (g.start && Pt(g.start.type) || h === d) && (p[0] = [f[0][0] + n.x, f[0][1] + n.y]), (g.end && Pt(g.end.type) || h === d) && (p[1] = [f[1][0] + n.x, f[1][1] + n.y]), c[d] = {
1658
1661
  geometry: {
1659
1662
  ...u.geometry,
1660
- coordinates: f
1663
+ coordinates: p
1661
1664
  }
1662
1665
  };
1663
1666
  }
@@ -1666,8 +1669,8 @@ function fe(i, e, t, n, s = !1) {
1666
1669
  function Pt(i) {
1667
1670
  return i !== T.NODE && i !== T.EDGE;
1668
1671
  }
1669
- function xs(i, e) {
1670
- if (_(i) || W(i) || D(i)) {
1672
+ function bs(i, e) {
1673
+ if (_(i) || W(i) || P(i)) {
1671
1674
  const t = Q(i);
1672
1675
  return {
1673
1676
  geometry: {
@@ -1676,7 +1679,7 @@ function xs(i, e) {
1676
1679
  }
1677
1680
  };
1678
1681
  }
1679
- if (nt(i)) {
1682
+ if (st(i)) {
1680
1683
  const t = i, n = t.geometry.coordinates.map(
1681
1684
  (s) => s.map((r) => [r[0] + e.x, r[1] + e.y])
1682
1685
  );
@@ -1689,7 +1692,7 @@ function xs(i, e) {
1689
1692
  }
1690
1693
  return null;
1691
1694
  }
1692
- class bs extends qt {
1695
+ class vs extends qt {
1693
1696
  constructor(t, n, s, r) {
1694
1697
  super(t, n);
1695
1698
  y(this, "snapping");
@@ -1698,12 +1701,12 @@ class bs extends qt {
1698
1701
  this.snapping = s, this.links = r;
1699
1702
  }
1700
1703
  detectHandle(t) {
1701
- const n = this.getAnnotation(), s = this.clientToCanvas(t), r = Ze, o = n.geometry.coordinates[0], a = n.geometry.coordinates[1], l = Math.sqrt(
1704
+ const n = this.getAnnotation(), s = this.clientToCanvas(t), r = Ke, o = n.geometry.coordinates[0], a = n.geometry.coordinates[1], l = Math.sqrt(
1702
1705
  Math.pow(s.x - o[0], 2) + Math.pow(s.y - o[1], 2)
1703
1706
  ), h = Math.sqrt(
1704
1707
  Math.pow(s.x - a[0], 2) + Math.pow(s.y - a[1], 2)
1705
1708
  );
1706
- l < r ? this.grabHandle("start", o[0], o[1]) : h < r ? this.grabHandle("end", a[0], a[1]) : an(n, s, r) ? (this.setCursor(I.grab), this.hoveredHandle = {
1709
+ l < r ? this.grabHandle("start", o[0], o[1]) : h < r ? this.grabHandle("end", a[0], a[1]) : cn(n, s, r) ? (this.setCursor(I.grab), this.hoveredHandle = {
1707
1710
  type: "body",
1708
1711
  point: s
1709
1712
  }, this.store.setState({ hoveredHandle: 2, hoveredFeature: this.annotation })) : (this.store.setState({ hoveredHandle: -1, hoveredFeature: null }), this.hoveredHandle = void 0);
@@ -1727,7 +1730,7 @@ class bs extends qt {
1727
1730
  }), h = [...s.geometry.coordinates];
1728
1731
  if (n.type === "body") {
1729
1732
  const d = a.x - n.point.x, u = a.y - n.point.y;
1730
- fe(this.store, this.links, s.id, { x: d, y: u }, !0), this.dispatchEvent(l);
1733
+ pe(this.store, this.links, s.id, { x: d, y: u }, !0), this.dispatchEvent(l);
1731
1734
  return;
1732
1735
  } else n.type === "start" ? (h[0] = [a.x, a.y], this.snap && (r.start = {
1733
1736
  side: n.type,
@@ -1752,7 +1755,7 @@ class bs extends qt {
1752
1755
  onDragStart(t) {
1753
1756
  if (!super.onDragStart(t)) return !1;
1754
1757
  const n = this.getAnnotation(), s = this.hoveredHandle;
1755
- return s.type === "end" && !1 || s.type === "start" && !ws(n) ? (this.clearDragState(), !1) : (this.store.getState().startLiveUpdate([this.annotation]), !0);
1758
+ return s.type === "end" && !1 || s.type === "start" && !xs(n) ? (this.clearDragState(), !1) : (this.store.getState().startLiveUpdate([this.annotation]), !0);
1756
1759
  }
1757
1760
  onDragEnd(t) {
1758
1761
  var r, o, a, l;
@@ -1778,7 +1781,7 @@ class bs extends qt {
1778
1781
  c.id,
1779
1782
  c.type,
1780
1783
  c.magnet
1781
- ) : ((o = (r = n.properties.link) == null ? void 0 : r.start) == null ? void 0 : o.type) !== "comment" && this.links.remove(n, O), d ? this.links.add(
1784
+ ) : ((o = (r = n.properties.link) == null ? void 0 : r.start) == null ? void 0 : o.type) !== "comment" && this.links.remove(n, X), d ? this.links.add(
1782
1785
  n,
1783
1786
  "end",
1784
1787
  d.id,
@@ -1825,7 +1828,7 @@ class bs extends qt {
1825
1828
  ...t.properties,
1826
1829
  link: {
1827
1830
  start: {
1828
- side: O,
1831
+ side: X,
1829
1832
  id: r.id,
1830
1833
  type: r.type,
1831
1834
  magnet: r.magnet
@@ -1853,7 +1856,7 @@ class bs extends qt {
1853
1856
  let r = Ht(t, s);
1854
1857
  const o = t.properties.link || {};
1855
1858
  let a = null;
1856
- if (n instanceof Pn)
1859
+ if (n instanceof Dn)
1857
1860
  r = n.getPosition(), a = this.snapping.snapToNodes(r, n.toList());
1858
1861
  else {
1859
1862
  const l = this.store.getState().getFeature(n);
@@ -1861,8 +1864,8 @@ class bs extends qt {
1861
1864
  throw new Error(`Annotation with id ${n} not found`);
1862
1865
  if (_(l) || W(l))
1863
1866
  r = Q(l), a = this.snapping.snapToText(r, [l]);
1864
- else if (nt(l))
1865
- r = tn(l), a = this.snapping.snapToPolygon(r, [l]);
1867
+ else if (st(l))
1868
+ r = en(l), a = this.snapping.snapToPolygon(r, [l]);
1866
1869
  else
1867
1870
  throw new Error(
1868
1871
  `Cannot link arrow to annotation of type ${l.properties.type}`
@@ -1873,7 +1876,7 @@ class bs extends qt {
1873
1876
  id: a.id,
1874
1877
  type: a.type,
1875
1878
  magnet: a.magnet
1876
- }, this.links.add(t, s, a.id, a.type, a.magnet), Zn(t, s, r.x, r.y), this.store.getState().updateFeature(t.id, {
1879
+ }, this.links.add(t, s, a.id, a.type, a.magnet), Kn(t, s, r.x, r.y), this.store.getState().updateFeature(t.id, {
1877
1880
  properties: { ...t.properties, link: o },
1878
1881
  geometry: {
1879
1882
  type: t.geometry.type,
@@ -1882,7 +1885,7 @@ class bs extends qt {
1882
1885
  }));
1883
1886
  }
1884
1887
  }
1885
- class vs extends qt {
1888
+ class Ss extends qt {
1886
1889
  // Graph units
1887
1890
  constructor(t, n, s) {
1888
1891
  super(t, n);
@@ -1921,7 +1924,7 @@ class vs extends qt {
1921
1924
  detectHandle(t, n = 1) {
1922
1925
  const s = this.getAnnotation();
1923
1926
  if (!s) return;
1924
- const r = this.clientToCanvas(t), o = Ze / n, a = s.geometry.coordinates[0];
1927
+ const r = this.clientToCanvas(t), o = Ke / n, a = s.geometry.coordinates[0];
1925
1928
  for (let l = 0; l < a.length - 1; l++) {
1926
1929
  const [h, c] = a[l];
1927
1930
  if (Math.sqrt(
@@ -1931,7 +1934,7 @@ class vs extends qt {
1931
1934
  return;
1932
1935
  }
1933
1936
  }
1934
- hn(s, r, o) ? (this.setCursor(I.grab), this.hoveredHandle = {
1937
+ dn(s, r, o) ? (this.setCursor(I.grab), this.hoveredHandle = {
1935
1938
  type: "body",
1936
1939
  point: r
1937
1940
  }, this.store.setState({ hoveredHandle: -1, hoveredFeature: this.annotation })) : (this.store.setState({ hoveredHandle: -1, hoveredFeature: null }), this.hoveredHandle = void 0);
@@ -1970,18 +1973,18 @@ class vs extends qt {
1970
1973
  if (this.isDrawingMode && this.dragging) {
1971
1974
  const a = this.clientToCanvas(t), l = this.store.getState(), h = this.getAnnotation();
1972
1975
  if (!h) return;
1973
- const c = l.liveUpdates[this.annotation], d = c ? { ...h, ...c } : h, g = l.drawingPoints.slice(0, -1), p = [
1976
+ const c = l.liveUpdates[this.annotation], d = c ? { ...h, ...c } : h, g = l.drawingPoints.slice(0, -1), f = [
1974
1977
  ...g,
1975
1978
  [a.x, a.y],
1976
1979
  g[0]
1977
1980
  ];
1978
- l.setDrawingPoints(p);
1979
- const f = me(
1980
- p,
1981
+ l.setDrawingPoints(f);
1982
+ const p = ye(
1983
+ f,
1981
1984
  // Exclude closing point
1982
1985
  this.simplificationTolerance,
1983
1986
  !1
1984
- ), m = [...f, f[0]];
1987
+ ), m = [...p, p[0]];
1985
1988
  l.applyLiveUpdate(this.annotation, {
1986
1989
  ...d,
1987
1990
  geometry: {
@@ -1995,7 +1998,7 @@ class vs extends qt {
1995
1998
  const n = this.clientToCanvas(t), s = n.x - this.dragStartPoint.x, r = n.y - this.dragStartPoint.y, o = this.getAnnotation();
1996
1999
  if (o) {
1997
2000
  if (this.hoveredHandle.type === "body")
1998
- fe(this.store, this.links, o.id, { x: s, y: r });
2001
+ pe(this.store, this.links, o.id, { x: s, y: r });
1999
2002
  else if (this.hoveredHandle.type === "vertex" && this.hoveredHandle.vertexIndex !== void 0) {
2000
2003
  const a = o.geometry.coordinates[0].map((h, c) => c === this.hoveredHandle.vertexIndex ? [
2001
2004
  this.hoveredHandle.point.x + s,
@@ -2010,7 +2013,7 @@ class vs extends qt {
2010
2013
  coordinates: [a]
2011
2014
  }
2012
2015
  };
2013
- en(l), this.store.getState().applyLiveUpdate(o.id, l), this.links.snapLinkedArrowsDuringDrag(o.id);
2016
+ nn(l), this.store.getState().applyLiveUpdate(o.id, l), this.links.snapLinkedArrowsDuringDrag(o.id);
2014
2017
  }
2015
2018
  this.dispatchEvent(new Event(Ut));
2016
2019
  }
@@ -2022,7 +2025,7 @@ class vs extends qt {
2022
2025
  const r = n.drawingPoints;
2023
2026
  if (r.length < 3) this.cancelDrawing();
2024
2027
  else {
2025
- const o = me(
2028
+ const o = ye(
2026
2029
  r.slice(1, -1),
2027
2030
  // Exclude closing point
2028
2031
  this.simplificationTolerance,
@@ -2035,7 +2038,7 @@ class vs extends qt {
2035
2038
  }
2036
2039
  };
2037
2040
  kt(a), this.store.getState().applyLiveUpdate(s.id, a), this.store.setState({ drawingFeature: null }), this.commitChange(), this.isDrawingMode = !1, this.dragging = !1, this.restorePanning(), this.dispatchEvent(
2038
- new CustomEvent(Ve, { detail: a })
2041
+ new CustomEvent(Ze, { detail: a })
2039
2042
  );
2040
2043
  }
2041
2044
  }
@@ -2048,7 +2051,7 @@ class vs extends qt {
2048
2051
  return this.store.getState().getFeature(this.annotation);
2049
2052
  }
2050
2053
  }
2051
- class Ss {
2054
+ class As {
2052
2055
  constructor(e, t, n, s = () => {
2053
2056
  }) {
2054
2057
  y(this, "layer");
@@ -2080,9 +2083,9 @@ class Ss {
2080
2083
  y(this, "update", () => {
2081
2084
  this.getAnnotation() && (this.updateStyle(), this.updatePosition(), this.layer.setSize(this.getSize()));
2082
2085
  });
2083
- var u, g, p;
2086
+ var u, g, f;
2084
2087
  this.ogma = e, this.store = t, this.annotation = n, this.onSendHandler = s;
2085
- const r = this.getPosition(), o = this.getSize(), a = this.getAnnotation(), l = this.store.getState(), h = D(a) && (((u = l.options) == null ? void 0 : u.showSendButton) ?? !0), c = ((g = l.options) == null ? void 0 : g.sendButtonIcon) || "", d = ((p = l.options) == null ? void 0 : p.textPlaceholder) || "Enter text";
2088
+ const r = this.getPosition(), o = this.getSize(), a = this.getAnnotation(), l = this.store.getState(), h = P(a) && (((u = l.options) == null ? void 0 : u.showSendButton) ?? !0), c = ((g = l.options) == null ? void 0 : g.sendButtonIcon) || "", d = ((f = l.options) == null ? void 0 : f.textPlaceholder) || "Enter text";
2086
2089
  this.layer = this.ogma.layers.addOverlay(
2087
2090
  {
2088
2091
  element: `<div class="ogma-annotation-text-editor">
@@ -2094,16 +2097,16 @@ class Ss {
2094
2097
  position: r,
2095
2098
  size: o
2096
2099
  },
2097
- de.EDITOR
2100
+ ue.EDITOR
2098
2101
  ), this.textarea = this.layer.element.querySelector("textarea"), this.textarea.setAttribute("wrap", "on"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.value = a.properties.content || "", h && (this.sendButton = this.layer.element.querySelector(".ogma-send-button"), this.sendButton.addEventListener("click", this.onSendClick), this.updateSendButtonState()), this.isFocused = !1, this.textarea.addEventListener("focus", this.onFocus), this.textarea.addEventListener("blur", this.onBlur), this.textarea.addEventListener("input", this.onInput), this.textarea.addEventListener("keyup", this.onKeyup), this.textarea.addEventListener("keydown", this.onKeydown), this.textarea.addEventListener("wheel", this.onMouseEvent), this.textarea.addEventListener("mouseup", this.onMouseEvent), this.textarea.addEventListener("mousedown", this.onMouseEvent), this.textarea.addEventListener("click", this.onMouseEvent), this.textarea.addEventListener("drag", this.onMouseEvent), this.updateStyle(), this.updatePosition(), this.textarea.focus(), this.unsubscribe = this.store.subscribe(
2099
- (f) => ({
2100
- rotation: f.rotation,
2101
- zoom: f.zoom,
2102
- annotation: f.features[this.annotation]
2102
+ (p) => ({
2103
+ rotation: p.rotation,
2104
+ zoom: p.zoom,
2105
+ annotation: p.features[this.annotation]
2103
2106
  }),
2104
2107
  this.update,
2105
2108
  {
2106
- equalityFn: (f, m) => f.rotation === m.rotation && f.zoom === m.zoom && f.annotation === m.annotation
2109
+ equalityFn: (p, m) => p.rotation === m.rotation && p.zoom === m.zoom && p.annotation === m.annotation
2107
2110
  }
2108
2111
  );
2109
2112
  }
@@ -2116,7 +2119,7 @@ class Ss {
2116
2119
  getPosition() {
2117
2120
  const e = this.getAnnotation();
2118
2121
  if (!e) return { x: 0, y: 0 };
2119
- const t = e.properties.style, n = (t == null ? void 0 : t.fixedSize) || !1, s = t == null ? void 0 : t.maxHeight, r = this.store.getState().zoom, o = Gt(e), [a, l] = e.geometry.coordinates, h = e.properties.width;
2122
+ const t = e.properties.style, n = (t == null ? void 0 : t.fixedSize) || !1, s = t == null ? void 0 : t.maxHeight, r = this.store.getState().zoom, o = Vt(e), [a, l] = e.geometry.coordinates, h = e.properties.width;
2120
2123
  let c = e.properties.height;
2121
2124
  s && (c = Math.min(c, s));
2122
2125
  const d = n ? 1 / r : 1;
@@ -2129,11 +2132,11 @@ class Ss {
2129
2132
  var g;
2130
2133
  const e = this.getAnnotation();
2131
2134
  if (!e) return { width: 0, height: 0 };
2132
- const t = q(e), n = Gt(e), s = e.properties.style, r = (s == null ? void 0 : s.fixedSize) || !1, o = s == null ? void 0 : s.maxHeight, a = this.store.getState().zoom, l = this.store.getState(), h = D(e) && (((g = l.options) == null ? void 0 : g.showSendButton) ?? !0), c = r ? 1 / a : 1;
2135
+ const t = q(e), n = Vt(e), s = e.properties.style, r = (s == null ? void 0 : s.fixedSize) || !1, o = s == null ? void 0 : s.maxHeight, a = this.store.getState().zoom, l = this.store.getState(), h = P(e) && (((g = l.options) == null ? void 0 : g.showSendButton) ?? !0), c = r ? 1 / a : 1;
2133
2136
  let d = (t.height - n * 2) * c;
2134
2137
  if (o) {
2135
- const p = (o - n * 2) * c;
2136
- d = Math.min(d, p);
2138
+ const f = (o - n * 2) * c;
2139
+ d = Math.min(d, f);
2137
2140
  }
2138
2141
  const u = h ? 28 * c : 0;
2139
2142
  return {
@@ -2142,60 +2145,63 @@ class Ss {
2142
2145
  };
2143
2146
  }
2144
2147
  updateStyle() {
2145
- var x;
2148
+ var b;
2146
2149
  const e = this.getAnnotation();
2147
2150
  if (!e) return;
2148
- const {
2149
- font: t,
2150
- fontSize: n = U.fontSize,
2151
- borderRadius: s,
2152
- color: r,
2153
- background: o,
2154
- padding: a = 0,
2155
- fixedSize: l = U.fixedSize
2156
- } = e.properties.style || U, h = this.textarea, c = this.layer.element, d = this.store.getState().zoom, u = l ? 1 / d : 1, g = parseFloat(n.toString()) * u, p = a * u, f = c.style;
2157
- f.display = "grid", f.gridTemplateRows = "1fr auto", f.boxSizing = "border-box", f.background = o || "transparent", f.borderRadius = `${(s || 0) * u}px`, f.padding = `${p}px`, f.transformOrigin = "center", f.transform = `rotate(${this.store.getState().rotation}rad)`;
2158
- const m = h.style;
2159
- if (m.font = `${g} ${t}`, m.fontFamily = t || "sans-serif", m.fontSize = `${g}px`, m.lineHeight = `${g * $t}px`, m.padding = "0", m.border = "none", m.outline = "none", m.boxSizing = "border-box", m.color = r || "black", m.background = "transparent", m.flex = "1", m.minHeight = "0", m.resize = "none", this.sendButton) {
2160
- const b = 24 * u, v = 4 * u;
2161
- this.sendButton.style.width = `${b}px`, this.sendButton.style.height = `${b}px`, this.sendButton.style.padding = `${v}px`, this.sendButton.style.transform = "";
2162
- const S = this.sendButton.querySelector(
2151
+ const t = P(e) ? V : G, {
2152
+ font: n,
2153
+ fontSize: s = t.fontSize,
2154
+ borderRadius: r,
2155
+ color: o,
2156
+ background: a = t.background,
2157
+ padding: l = 0,
2158
+ fixedSize: h = t.fixedSize
2159
+ } = e.properties.style || t, c = this.textarea, d = this.layer.element, u = this.store.getState().zoom, g = h ? 1 / u : 1, f = parseFloat(s.toString()) * g, p = l * g, m = d.style;
2160
+ if (m.display = "grid", m.gridTemplateRows = "1fr auto", m.boxSizing = "border-box", m.background = a || "transparent", m.borderRadius = `${(r || 0) * g}px`, m.padding = `${p}px`, m.transformOrigin = "center", m.transform = `rotate(${this.store.getState().rotation}rad)`, e.properties.type === "comment") {
2161
+ const v = e.properties.style, S = (v == null ? void 0 : v.shadow) !== !1;
2162
+ m.boxShadow = S ? "0 2px 8px rgba(0, 0, 0, 0.15)" : "none";
2163
+ }
2164
+ const w = c.style;
2165
+ if (w.font = `${f} ${n}`, w.fontFamily = n || "sans-serif", w.fontSize = `${f}px`, w.lineHeight = `${f * $t}px`, w.padding = "0", w.border = "none", w.outline = "none", w.boxSizing = "border-box", w.color = o || "black", w.background = "transparent", w.flex = "1", w.minHeight = "0", w.resize = "none", this.sendButton) {
2166
+ const v = 24 * g, S = 4 * g;
2167
+ this.sendButton.style.width = `${v}px`, this.sendButton.style.height = `${v}px`, this.sendButton.style.padding = `${S}px`, this.sendButton.style.transform = "";
2168
+ const x = this.sendButton.querySelector(
2163
2169
  ".ogma-send-button-icon"
2164
2170
  );
2165
- if (S) {
2166
- const w = 16 * u;
2167
- S.style.width = `${w}px`, S.style.height = `${w}px`;
2171
+ if (x) {
2172
+ const A = 16 * g;
2173
+ x.style.width = `${A}px`, x.style.height = `${A}px`;
2168
2174
  }
2169
2175
  }
2170
- if (l) {
2171
- const b = (x = e.properties.style) == null ? void 0 : x.maxHeight, v = b && e.properties.height >= b;
2172
- m.overflowY = v ? "auto" : "hidden", m.overflowX = "hidden";
2176
+ if (h) {
2177
+ const v = (b = e.properties.style) == null ? void 0 : b.maxHeight, S = v && e.properties.height >= v;
2178
+ w.overflowY = S ? "auto" : "hidden", w.overflowX = "hidden";
2173
2179
  }
2174
2180
  }
2175
2181
  updatePosition() {
2176
2182
  this.layer.setPosition(this.getPosition());
2177
2183
  }
2178
2184
  updateContent() {
2179
- var o, a, l;
2185
+ var o, a, l, h;
2180
2186
  const e = this.getAnnotation();
2181
2187
  if (!e) return;
2182
2188
  let t = e.properties.height, n = e.geometry.coordinates;
2183
2189
  const s = (o = e.properties.style) == null ? void 0 : o.fixedSize;
2184
2190
  if (s) {
2185
- const h = this.textarea.style.height;
2191
+ const c = this.textarea.style.height;
2186
2192
  this.textarea.style.height = "0px";
2187
- const c = this.textarea.scrollHeight;
2188
- this.textarea.style.height = h;
2189
- const d = Gt(e), u = this.store.getState().zoom, g = (c + d * 2 / u) * u, p = ((a = e.properties.style) == null ? void 0 : a.minHeight) || 50;
2190
- t = Math.max(p, g);
2191
- const f = (l = e.properties.style) == null ? void 0 : l.maxHeight, m = e.properties.height, x = t - m;
2192
- if (Math.abs(x) > 1) {
2193
- const [b, v] = e.geometry.coordinates;
2194
- if (f && t > f) {
2195
- const S = f - m;
2196
- t = f, Math.abs(S) > 1 && (n = [b, v + S / 2]);
2193
+ const d = this.textarea.scrollHeight;
2194
+ this.textarea.style.height = c;
2195
+ const u = Vt(e), g = this.store.getState().zoom, f = ((a = e.properties.style) == null ? void 0 : a.padding) || 0, p = (d + u * 2 / g) * g + f * 2, m = ((l = e.properties.style) == null ? void 0 : l.minHeight) || 50;
2196
+ t = Math.max(m, p);
2197
+ const w = (h = e.properties.style) == null ? void 0 : h.maxHeight, b = e.properties.height, v = t - b;
2198
+ if (Math.abs(v) > 1) {
2199
+ const [S, x] = e.geometry.coordinates;
2200
+ if (w && t > w) {
2201
+ const A = w - b;
2202
+ t = w, Math.abs(A) > 1 && (n = [S, x + A / 2]);
2197
2203
  } else
2198
- n = [b, v + x / 2];
2204
+ n = [S, x + v / 2];
2199
2205
  }
2200
2206
  }
2201
2207
  const r = {
@@ -2221,21 +2227,21 @@ class Ss {
2221
2227
  this.store.getState().commitLiveUpdates(/* @__PURE__ */ new Set([this.annotation])), this.unsubscribe(), this.sendButton && this.sendButton.removeEventListener("click", this.onSendClick), this.layer.destroy();
2222
2228
  }
2223
2229
  }
2224
- function Gt(i) {
2230
+ function Vt(i) {
2225
2231
  var e;
2226
2232
  return ((e = i.properties.style) == null ? void 0 : e.strokeWidth) || 0;
2227
2233
  }
2228
- const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2229
- ["top", Ee, -0.5, -0.5, 0.5, -0.5],
2230
- ["right", Ae, 0.5, -0.5, 0.5, 0.5],
2231
- ["bottom", Ee, -0.5, 0.5, 0.5, 0.5],
2232
- ["left", Ae, -0.5, -0.5, -0.5, 0.5]
2233
- ], Es = {
2234
+ const Ee = { x: 1, y: 0 }, Ce = { x: 0, y: 1 }, Es = [
2235
+ ["top", Ce, -0.5, -0.5, 0.5, -0.5],
2236
+ ["right", Ee, 0.5, -0.5, 0.5, 0.5],
2237
+ ["bottom", Ce, -0.5, 0.5, 0.5, 0.5],
2238
+ ["left", Ee, -0.5, -0.5, -0.5, 0.5]
2239
+ ], Cs = {
2234
2240
  top: [0, 1],
2235
2241
  right: [1, 2],
2236
2242
  bottom: [2, 3],
2237
2243
  left: [3, 0]
2238
- }, Ce = [
2244
+ }, ke = [
2239
2245
  [-0.5, -0.5],
2240
2246
  // top-left (index 0)
2241
2247
  [0.5, -0.5],
@@ -2244,7 +2250,7 @@ const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2244
2250
  // bottom-right (index 2)
2245
2251
  [-0.5, 0.5]
2246
2252
  // bottom-left (index 3)
2247
- ], Cs = [
2253
+ ], ks = [
2248
2254
  I.nwResize,
2249
2255
  // top-left (0)
2250
2256
  I.neResize,
@@ -2254,7 +2260,7 @@ const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2254
2260
  I.swResize
2255
2261
  // bottom-left (3)
2256
2262
  ];
2257
- class Vt extends qt {
2263
+ class Zt extends qt {
2258
2264
  constructor(t, n, s) {
2259
2265
  super(t, n);
2260
2266
  y(this, "links");
@@ -2263,7 +2269,7 @@ class Vt extends qt {
2263
2269
  y(this, "onClick", (t) => {
2264
2270
  const n = this.getAnnotation();
2265
2271
  if (n) {
2266
- if (D(n) && n.properties.mode === at) {
2272
+ if (P(n) && n.properties.mode === at) {
2267
2273
  this.store.getState().updateFeature(n.id, {
2268
2274
  properties: {
2269
2275
  ...n.properties,
@@ -2273,11 +2279,11 @@ class Vt extends qt {
2273
2279
  return;
2274
2280
  }
2275
2281
  if (this.store.getState().selectedFeatures.has(n.id)) {
2276
- if (D(n) && this.justActivated) {
2282
+ if (P(n) && this.justActivated) {
2277
2283
  this.justActivated = !1;
2278
2284
  return;
2279
2285
  }
2280
- n && (_(n) || D(n)) && this.startEditingText();
2286
+ n && (_(n) || P(n)) && this.startEditingText();
2281
2287
  }
2282
2288
  }
2283
2289
  });
@@ -2292,28 +2298,28 @@ class Vt extends qt {
2292
2298
  let { width: a, height: l } = q(s);
2293
2299
  const h = 5 / n, c = Q(s), d = this.store.getState();
2294
2300
  let { revSin: u, revCos: g } = d;
2295
- (W(s) || D(s)) && (u = 0, g = 1), this.hoveredHandle = void 0;
2296
- const p = Xn * (1 / n), f = r - c.x, m = o - c.y, x = f * g - m * u, b = f * u + m * g, v = ((S = s.properties.style) == null ? void 0 : S.fixedSize) === !0 || D(s);
2301
+ (W(s) || P(s)) && (u = 0, g = 1), this.hoveredHandle = void 0;
2302
+ const f = Xn * (1 / n), p = r - c.x, m = o - c.y, w = p * g - m * u, b = p * u + m * g, v = ((S = s.properties.style) == null ? void 0 : S.fixedSize) === !0 || P(s);
2297
2303
  if (v && (a /= n, l /= n), !v) {
2298
- for (let w = 0; w < Ce.length; w++) {
2299
- const [A, C] = Ce[w], E = a * A, k = l * C;
2300
- if (x >= E - p - h && x <= E + p + h && b >= k - p - h && b <= k + p + h) {
2304
+ for (let x = 0; x < ke.length; x++) {
2305
+ const [A, C] = ke[x], E = a * A, k = l * C;
2306
+ if (w >= E - f - h && w <= E + f + h && b >= k - f - h && b <= k + f + h) {
2301
2307
  this.hoveredHandle = {
2302
2308
  type: "corner",
2303
- corner: w
2304
- }, this.store.setState({ hoveredHandle: w, hoveredFeature: this.annotation }), this.setCursor(this.getCornerCursor(w));
2309
+ corner: x
2310
+ }, this.store.setState({ hoveredHandle: x, hoveredFeature: this.annotation }), this.setCursor(this.getCornerCursor(x));
2305
2311
  return;
2306
2312
  }
2307
2313
  }
2308
- for (const [w, A, C, E, k, F] of As) {
2309
- const j = a * C, z = l * E, R = a * k, et = l * F, Y = mt(A, { x: x - j, y: b - z });
2310
- if (Math.abs(Y) < h && x >= j - h && x <= R + h && b >= z - h && b <= et + h) {
2311
- this.hoveredHandle = { type: "edge", edge: w, corner: -1 }, this.store.setState({ hoveredHandle: Es[w][0] + 4, hoveredFeature: this.annotation }), this.setCursor(this.getEdgeCursor(w));
2314
+ for (const [x, A, C, E, k, F] of Es) {
2315
+ const O = a * C, N = l * E, B = a * k, et = l * F, nt = mt(A, { x: w - O, y: b - N });
2316
+ if (Math.abs(nt) < h && w >= O - h && w <= B + h && b >= N - h && b <= et + h) {
2317
+ this.hoveredHandle = { type: "edge", edge: x, corner: -1 }, this.store.setState({ hoveredHandle: Cs[x][0] + 4, hoveredFeature: this.annotation }), this.setCursor(this.getEdgeCursor(x));
2312
2318
  return;
2313
2319
  }
2314
2320
  }
2315
2321
  }
2316
- if (x >= -a / 2 - h && x <= a / 2 + h && b >= -l / 2 - h && b <= l / 2 + h) {
2322
+ if (w >= -a / 2 - h && w <= a / 2 + h && b >= -l / 2 - h && b <= l / 2 + h) {
2317
2323
  this.store.setState({ hoveredHandle: 8, hoveredFeature: this.annotation }), this.hoveredHandle = { type: "body", corner: -1 }, this.setCursor(I.grab);
2318
2324
  return;
2319
2325
  }
@@ -2327,7 +2333,7 @@ class Vt extends qt {
2327
2333
  y: s.y - this.dragStartPoint.y
2328
2334
  }, o = this.hoveredHandle, a = this.getAnnotation();
2329
2335
  let l = null;
2330
- o.type === "corner" ? l = this.dragCorner(a, r, o.corner) : o.type === "edge" && o.edge ? l = this.dragEdge(a, r, o) : o.type === "body" && (fe(this.store, this.links, n.id, r), this.textEditor && this.textEditor.update()), l && (this.store.getState().applyLiveUpdate(n.id, l), this.links.updateLinkedArrowsDuringDrag(n.id, r), this.textEditor && this.textEditor.update()), this.dispatchEvent(
2336
+ o.type === "corner" ? l = this.dragCorner(a, r, o.corner) : o.type === "edge" && o.edge ? l = this.dragEdge(a, r, o) : o.type === "body" && (pe(this.store, this.links, n.id, r), this.textEditor && this.textEditor.update()), l && (this.store.getState().applyLiveUpdate(n.id, l), this.links.updateLinkedArrowsDuringDrag(n.id, r), this.textEditor && this.textEditor.update()), this.dispatchEvent(
2331
2337
  new CustomEvent(Ut, {
2332
2338
  detail: {
2333
2339
  point: s,
@@ -2340,11 +2346,11 @@ class Vt extends qt {
2340
2346
  dragCorner(t, n, s) {
2341
2347
  const r = s === 0 || s === 1, o = s === 0 || s === 3, a = s === 1 || s === 2, l = s === 2 || s === 3, { width: h, height: c } = q(t), d = this.store.getState();
2342
2348
  let { revSin: u, revCos: g } = d;
2343
- (W(t) || D(t)) && (u = 0, g = 1);
2344
- const p = n.x * g - n.y * u, f = n.x * u + n.y * g;
2345
- let m = 0, x = 0;
2346
- o ? m = -p : a && (m = p), r ? x = -f : l && (x = f);
2347
- const b = Math.max(0, h + m), v = Math.max(0, c + x), S = Q(t), w = S.x + n.x / 2, A = S.y + n.y / 2;
2349
+ (W(t) || P(t)) && (u = 0, g = 1);
2350
+ const f = n.x * g - n.y * u, p = n.x * u + n.y * g;
2351
+ let m = 0, w = 0;
2352
+ o ? m = -f : a && (m = f), r ? w = -p : l && (w = p);
2353
+ const b = Math.max(0, h + m), v = Math.max(0, c + w), S = Q(t), x = S.x + n.x / 2, A = S.y + n.y / 2;
2348
2354
  return {
2349
2355
  ...t,
2350
2356
  properties: {
@@ -2354,41 +2360,41 @@ class Vt extends qt {
2354
2360
  },
2355
2361
  geometry: {
2356
2362
  type: t.geometry.type,
2357
- coordinates: [w, A]
2363
+ coordinates: [x, A]
2358
2364
  }
2359
2365
  };
2360
2366
  }
2361
2367
  dragEdge(t, n, s) {
2362
2368
  const { width: r, height: o } = q(t), a = Q(t), l = this.store.getState();
2363
2369
  let { revSin: h, revCos: c } = l;
2364
- (W(t) || D(t)) && (h = 0, c = 1);
2370
+ (W(t) || P(t)) && (h = 0, c = 1);
2365
2371
  const d = n.x * c - n.y * h, u = n.x * h + n.y * c;
2366
- let g = r, p = o, f = 0, m = 0;
2372
+ let g = r, f = o, p = 0, m = 0;
2367
2373
  switch (s.edge) {
2368
2374
  case "top":
2369
- p = Math.max(0, o - u), m = u / 2;
2375
+ f = Math.max(0, o - u), m = u / 2;
2370
2376
  break;
2371
2377
  case "bottom":
2372
- p = Math.max(0, o + u), m = u / 2;
2378
+ f = Math.max(0, o + u), m = u / 2;
2373
2379
  break;
2374
2380
  case "left":
2375
- g = Math.max(0, r - d), f = d / 2;
2381
+ g = Math.max(0, r - d), p = d / 2;
2376
2382
  break;
2377
2383
  case "right":
2378
- g = Math.max(0, r + d), f = d / 2;
2384
+ g = Math.max(0, r + d), p = d / 2;
2379
2385
  break;
2380
2386
  }
2381
- const x = f * c + m * h, b = -f * h + m * c;
2387
+ const w = p * c + m * h, b = -p * h + m * c;
2382
2388
  return {
2383
2389
  ...t,
2384
2390
  properties: {
2385
2391
  ...t.properties,
2386
2392
  width: g,
2387
- height: p
2393
+ height: f
2388
2394
  },
2389
2395
  geometry: {
2390
2396
  type: t.geometry.type,
2391
- coordinates: [a.x + x, a.y + b]
2397
+ coordinates: [a.x + w, a.y + b]
2392
2398
  }
2393
2399
  };
2394
2400
  }
@@ -2396,7 +2402,7 @@ class Vt extends qt {
2396
2402
  return super.onDragStart(t) ? (this.stopEditingText(), this.store.getState().startLiveUpdate([this.annotation]), !0) : !1;
2397
2403
  }
2398
2404
  startEditingText() {
2399
- this.textEditor === null && (this.store.setState({ editingFeature: this.annotation }), this.textEditor = new Ss(
2405
+ this.textEditor === null && (this.store.setState({ editingFeature: this.annotation }), this.textEditor = new As(
2400
2406
  this.ogma,
2401
2407
  this.store,
2402
2408
  this.annotation,
@@ -2414,7 +2420,7 @@ class Vt extends qt {
2414
2420
  })) : this.commitChange(), this.hoveredHandle = void 0, this.dragStartPoint = void 0, this.dragging = !1, !0;
2415
2421
  }
2416
2422
  getCornerCursor(t) {
2417
- return Cs[t];
2423
+ return ks[t];
2418
2424
  }
2419
2425
  getEdgeCursor(t) {
2420
2426
  switch (t) {
@@ -2442,7 +2448,7 @@ class Vt extends qt {
2442
2448
  this.dragStartPoint = r, this.disablePanning(), this.onDragStart({ clientX: r.x, clientY: r.y });
2443
2449
  }
2444
2450
  setAnnotation(t) {
2445
- t && D(t) && (this.justActivated = !0), super.setAnnotation(t), t && D(t) && t.properties.mode === at && this.store.getState().updateFeature(t.id, {
2451
+ t && P(t) && (this.justActivated = !0), super.setAnnotation(t), t && P(t) && t.properties.mode === at && this.store.getState().updateFeature(t.id, {
2446
2452
  properties: {
2447
2453
  ...t.properties,
2448
2454
  mode: Rt
@@ -2450,7 +2456,7 @@ class Vt extends qt {
2450
2456
  });
2451
2457
  }
2452
2458
  }
2453
- class ks extends EventTarget {
2459
+ class Ms extends EventTarget {
2454
2460
  constructor(t, n, s, r, o) {
2455
2461
  super();
2456
2462
  y(this, "handlers", /* @__PURE__ */ new Map());
@@ -2459,12 +2465,12 @@ class ks extends EventTarget {
2459
2465
  y(this, "ogma");
2460
2466
  y(this, "snapping");
2461
2467
  y(this, "store");
2462
- this.ogma = t, this.store = n, this.snapping = s, this.interaction = o, this.handlers.set("box", new Vt(this.ogma, this.store, r)), this.handlers.set("text", new Vt(this.ogma, this.store, r)), this.handlers.set("comment", new Vt(this.ogma, this.store, r)), this.handlers.set(
2468
+ this.ogma = t, this.store = n, this.snapping = s, this.interaction = o, this.handlers.set("box", new Zt(this.ogma, this.store, r)), this.handlers.set("text", new Zt(this.ogma, this.store, r)), this.handlers.set("comment", new Zt(this.ogma, this.store, r)), this.handlers.set(
2463
2469
  "arrow",
2464
- new bs(this.ogma, this.store, this.snapping, r)
2470
+ new vs(this.ogma, this.store, this.snapping, r)
2465
2471
  ), this.handlers.set(
2466
2472
  "polygon",
2467
- new vs(this.ogma, this.store, r)
2473
+ new Ss(this.ogma, this.store, r)
2468
2474
  ), this.handlers.forEach((a) => {
2469
2475
  a.addEventListener("dragstart", ((l) => {
2470
2476
  this.dispatchEvent(
@@ -2524,8 +2530,8 @@ class ks extends EventTarget {
2524
2530
  destroy() {
2525
2531
  }
2526
2532
  }
2527
- const Ms = ["x", "y", "radius"], Ts = 1;
2528
- class Fs {
2533
+ const Ts = ["x", "y", "radius"], Fs = 1;
2534
+ class Ps {
2529
2535
  constructor(e, t, n, s) {
2530
2536
  y(this, "links", /* @__PURE__ */ new Map());
2531
2537
  y(this, "nodeToLink", /* @__PURE__ */ new Map());
@@ -2551,7 +2557,7 @@ class Fs {
2551
2557
  var a;
2552
2558
  const r = e.getFeature(s);
2553
2559
  if (!r) return;
2554
- (_(r) && ((a = r.properties.style) == null ? void 0 : a.fixedSize) || D(r)) && n.forEach((l) => {
2560
+ (_(r) && ((a = r.properties.style) == null ? void 0 : a.fixedSize) || P(r)) && n.forEach((l) => {
2555
2561
  const h = this.links.get(l);
2556
2562
  if (!h) return;
2557
2563
  const c = h.arrow;
@@ -2559,7 +2565,7 @@ class Fs {
2559
2565
  });
2560
2566
  }), t.size > 0 && this.update(t);
2561
2567
  });
2562
- y(this, "throttledRefresh", rn(() => this.refresh(), 20));
2568
+ y(this, "throttledRefresh", on(() => this.refresh(), 20));
2563
2569
  y(this, "onAddRemoveEdges", (e) => {
2564
2570
  const t = e.edges;
2565
2571
  if (!t.size || !this.edgeToLink.size) return;
@@ -2593,7 +2599,7 @@ class Fs {
2593
2599
  const u = h.properties.link.start;
2594
2600
  this.add(
2595
2601
  h,
2596
- O,
2602
+ X,
2597
2603
  u.id,
2598
2604
  u.type,
2599
2605
  u.magnet
@@ -2601,19 +2607,13 @@ class Fs {
2601
2607
  }
2602
2608
  if ((d = h.properties.link) != null && d.end) {
2603
2609
  const u = h.properties.link.end;
2604
- this.add(
2605
- h,
2606
- it,
2607
- u.id,
2608
- u.type,
2609
- u.magnet
2610
- );
2610
+ this.add(h, it, u.id, u.type, u.magnet);
2611
2611
  }
2612
2612
  }), o.forEach((a) => {
2613
2613
  const l = t[a];
2614
2614
  if (tt(l)) {
2615
2615
  const h = l;
2616
- this.remove(h, O), this.remove(h, it);
2616
+ this.remove(h, X), this.remove(h, it);
2617
2617
  } else {
2618
2618
  const h = this.annotationToLink.get(a);
2619
2619
  if (!h) return;
@@ -2648,7 +2648,7 @@ class Fs {
2648
2648
  if (!l) continue;
2649
2649
  const h = s.getFeature(l.arrow), c = Ht(h, l.side), d = dt(c, t), u = {
2650
2650
  ...h.geometry,
2651
- coordinates: h.geometry.coordinates.map((g, p) => l.side === O && p === 0 || l.side === it && p === 1 ? [d.x, d.y] : [...g])
2651
+ coordinates: h.geometry.coordinates.map((g, f) => l.side === X && f === 0 || l.side === it && f === 1 ? [d.x, d.y] : [...g])
2652
2652
  };
2653
2653
  n ? n[h.id] = {
2654
2654
  geometry: u
@@ -2671,20 +2671,20 @@ class Fs {
2671
2671
  let h = n.getFeature(l.arrow);
2672
2672
  const c = n.liveUpdates[h.id];
2673
2673
  h = c ? { ...h, ...c } : h;
2674
- const d = h.geometry.coordinates[l.side === O ? 0 : 1], u = {
2674
+ const d = h.geometry.coordinates[l.side === X ? 0 : 1], u = {
2675
2675
  x: d[0],
2676
2676
  y: d[1]
2677
2677
  };
2678
2678
  let g;
2679
- if (_(s) || D(s) || W(s) ? g = this.snapping.snapToText(u, [s]) : nt(s) && (g = this.snapping.snapToPolygon(u, [s])), !g) continue;
2680
- const p = g.point, f = {
2679
+ if (_(s) || P(s) || W(s) ? g = this.snapping.snapToText(u, [s]) : st(s) && (g = this.snapping.snapToPolygon(u, [s])), !g) continue;
2680
+ const f = g.point, p = {
2681
2681
  ...h.geometry,
2682
- coordinates: h.geometry.coordinates.map((m, x) => l.side === O && x === 0 || l.side === it && x === 1 ? [p.x, p.y] : [...m])
2682
+ coordinates: h.geometry.coordinates.map((m, w) => l.side === X && w === 0 || l.side === it && w === 1 ? [f.x, f.y] : [...m])
2683
2683
  };
2684
2684
  t ? t[h.id] = {
2685
- geometry: f
2685
+ geometry: p
2686
2686
  } : n.applyLiveUpdate(h.id, {
2687
- geometry: f
2687
+ geometry: p
2688
2688
  });
2689
2689
  }
2690
2690
  }
@@ -2693,8 +2693,8 @@ class Fs {
2693
2693
  let l = r;
2694
2694
  if (s === T.POLYGON) {
2695
2695
  const u = this.store.getState().getFeature(n);
2696
- if (u && nt(u)) {
2697
- const g = ye(u), p = g[2] - g[0], f = g[3] - g[1], m = r.x - g[0], x = r.y - g[1], b = p > 0 ? m / p : 0.5, v = f > 0 ? x / f : 0.5;
2696
+ if (u && st(u)) {
2697
+ const g = we(u), f = g[2] - g[0], p = g[3] - g[1], m = r.x - g[0], w = r.y - g[1], b = f > 0 ? m / f : 0.5, v = p > 0 ? w / p : 0.5;
2698
2698
  l = { x: b, y: v };
2699
2699
  }
2700
2700
  }
@@ -2748,27 +2748,27 @@ class Fs {
2748
2748
  n.set(g, this.linksByArrowId.get(g)), s.set(g, this.linksByArrowId.get(g));
2749
2749
  });
2750
2750
  });
2751
- const o = e.getAttributes(Ms), a = this.store.getState(), l = {};
2751
+ const o = e.getAttributes(Ts), a = this.store.getState(), l = {};
2752
2752
  for (let h = 0; h < t.length; h++) {
2753
2753
  const c = t[h], d = this.nodeToLink.get(c);
2754
2754
  if (d)
2755
2755
  for (const u of d) {
2756
2756
  const g = this.links.get(u);
2757
2757
  if (!g) continue;
2758
- const p = g.arrow, f = this.store.getState().getFeature(p), m = f.geometry.coordinates.slice(), x = Ht(f, it), b = Ht(f, O), v = o[h], S = this._getNodeSnapPoint(
2758
+ const f = g.arrow, p = this.store.getState().getFeature(f), m = p.geometry.coordinates.slice(), w = Ht(p, it), b = Ht(p, X), v = o[h], S = this._getNodeSnapPoint(
2759
2759
  v,
2760
- ot(X(x, b), -1),
2760
+ ot(Y(w, b), -1),
2761
2761
  this._isLinkedToCenter(g)
2762
2762
  );
2763
- m[g.side === O ? 0 : 1] = S, l[p] = {
2764
- ...f,
2763
+ m[g.side === X ? 0 : 1] = S, l[f] = {
2764
+ ...p,
2765
2765
  geometry: {
2766
2766
  coordinates: m
2767
2767
  }
2768
- }, this.updatedItems.add(p), g.magnet = {
2768
+ }, this.updatedItems.add(f), g.magnet = {
2769
2769
  x: S[0] - v.x,
2770
2770
  y: S[1] - v.y
2771
- }, kt(l[p]);
2771
+ }, kt(l[f]);
2772
2772
  }
2773
2773
  }
2774
2774
  if (a.applyLiveUpdates(l), s.size > 0) {
@@ -2783,17 +2783,24 @@ class Fs {
2783
2783
  const o = this.ogma.getNodes(n).getAttributes(["x", "y", "radius"]), a = {};
2784
2784
  e.forEach((l, h) => {
2785
2785
  const c = this.links.get(l.start), d = this.links.get(l.end), u = t.getFeature(h);
2786
- let g = u.geometry.coordinates[0], p = u.geometry.coordinates[1];
2787
- const f = c ? c.targetType === T.NODE ? o[s.get(c.target)] : c.targetType === T.EDGE ? this._getEdgeSnapPoint(c.target, c.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(c.target)) : { x: g[0], y: g[1] }, m = d ? d.targetType === T.NODE ? o[s.get(d.target)] : d.targetType === T.EDGE ? this._getEdgeSnapPoint(d.target, d.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(d.target)) : { x: p[0], y: p[1] }, x = X(m, f);
2786
+ let g = u.geometry.coordinates[0], f = u.geometry.coordinates[1];
2787
+ const p = c ? c.targetType === T.NODE ? o[s.get(c.target)] : c.targetType === T.EDGE ? this._getEdgeSnapPoint(
2788
+ c.target,
2789
+ c.magnet.x,
2790
+ !0
2791
+ ) : this._getAnnotationCenter(t.getFeature(c.target)) : { x: g[0], y: g[1] }, m = d ? d.targetType === T.NODE ? o[s.get(d.target)] : d.targetType === T.EDGE ? this._getEdgeSnapPoint(d.target, d.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(d.target)) : { x: f[0], y: f[1] }, w = Y(m, p);
2788
2792
  if (c)
2789
2793
  if (c.targetType === T.NODE)
2790
2794
  g = this._getNodeSnapPoint(
2791
- f,
2792
- x,
2795
+ p,
2796
+ w,
2793
2797
  this._isLinkedToCenter(c)
2794
2798
  );
2795
2799
  else if (c.targetType === T.EDGE)
2796
- g = this._getEdgeSnapPoint(c.target, c.magnet.x);
2800
+ g = this._getEdgeSnapPoint(
2801
+ c.target,
2802
+ c.magnet.x
2803
+ );
2797
2804
  else {
2798
2805
  const b = t.getFeature(c.target);
2799
2806
  g = this._getAnnotationSnapPoint(
@@ -2805,18 +2812,18 @@ class Fs {
2805
2812
  }
2806
2813
  if (d)
2807
2814
  if (d.targetType === T.NODE)
2808
- p = this._getNodeSnapPoint(
2815
+ f = this._getNodeSnapPoint(
2809
2816
  m,
2810
- ot(x, -1),
2817
+ ot(w, -1),
2811
2818
  this._isLinkedToCenter(d)
2812
2819
  );
2813
2820
  else if (d.targetType === T.EDGE)
2814
- p = this._getEdgeSnapPoint(d.target, d.magnet.x);
2821
+ f = this._getEdgeSnapPoint(d.target, d.magnet.x);
2815
2822
  else {
2816
2823
  const b = t.getFeature(d.target);
2817
- p = this._getAnnotationSnapPoint(
2824
+ f = this._getAnnotationSnapPoint(
2818
2825
  b,
2819
- f,
2826
+ p,
2820
2827
  d,
2821
2828
  t.zoom
2822
2829
  );
@@ -2824,23 +2831,23 @@ class Fs {
2824
2831
  a[u.id] = {
2825
2832
  properties: u.properties,
2826
2833
  geometry: {
2827
- coordinates: [g, p]
2834
+ coordinates: [g, f]
2828
2835
  }
2829
2836
  }, kt(a[u.id]), this.updatedItems.add(u.id);
2830
2837
  }), t.applyLiveUpdates(a), this.requestCommit();
2831
2838
  }
2832
2839
  requestCommit() {
2833
- clearTimeout(this.commitTimeout), this.commitTimeout = setTimeout(this.commit, Ts);
2840
+ clearTimeout(this.commitTimeout), this.commitTimeout = setTimeout(this.commit, Fs);
2834
2841
  }
2835
2842
  _isLinkedToCenter(e) {
2836
2843
  return e.magnet.x === 0 && e.magnet.y === 0;
2837
2844
  }
2838
2845
  _getAnnotationCenter(e) {
2839
- return nt(e) ? tn(e) : Q(e);
2846
+ return st(e) ? en(e) : Q(e);
2840
2847
  }
2841
2848
  _getAnnotationSnapPoint(e, t, n, s) {
2842
- if (nt(e)) {
2843
- const r = ye(e), o = r[0] + n.magnet.x * (r[2] - r[0]), a = r[1] + n.magnet.y * (r[3] - r[1]);
2849
+ if (st(e)) {
2850
+ const r = we(e), o = r[0] + n.magnet.x * (r[2] - r[0]), a = r[1] + n.magnet.y * (r[3] - r[1]);
2844
2851
  return [o, a];
2845
2852
  }
2846
2853
  return this._getBoxSnapPoint(e, t, n, s);
@@ -2849,14 +2856,11 @@ class Fs {
2849
2856
  var d;
2850
2857
  const r = Q(e);
2851
2858
  let { width: o, height: a } = q(e);
2852
- (_(e) && ((d = e.properties.style) == null ? void 0 : d.fixedSize) || D(e)) && (o /= s, a /= s);
2859
+ (_(e) && ((d = e.properties.style) == null ? void 0 : d.fixedSize) || P(e)) && (o /= s, a /= s);
2853
2860
  let h = n.magnet.x * o, c = n.magnet.y * a;
2854
2861
  if (_(e) && !W(e)) {
2855
- const { sin: u, cos: g } = this.store.getState(), p = h * g - c * u, f = h * u + c * g;
2856
- h = p, c = f;
2857
- } else if (D(e)) {
2858
- const g = { ...e.properties.style }.iconSize || 32, p = g / 16 * 0.5;
2859
- h = n.magnet.x * g * p, c = n.magnet.y * g * p;
2862
+ const { sin: u, cos: g } = this.store.getState(), f = h * g - c * u, p = h * u + c * g;
2863
+ h = f, c = p;
2860
2864
  }
2861
2865
  return [r.x + h, r.y + c];
2862
2866
  }
@@ -2897,7 +2901,7 @@ class Fs {
2897
2901
  this.ogma.events.off(this.onSetMultipleAttributes);
2898
2902
  }
2899
2903
  }
2900
- function Ps(i, e, t, n, s = 20) {
2904
+ function Ds(i, e, t, n, s = 20) {
2901
2905
  let r = 0, o = 1 / 0, a = null;
2902
2906
  for (let l = 0; l <= s; l++) {
2903
2907
  const h = l / s, c = zt.getPointOnQuadraticCurve(
@@ -2908,18 +2912,18 @@ function Ps(i, e, t, n, s = 20) {
2908
2912
  t.y,
2909
2913
  n.x,
2910
2914
  n.y
2911
- ), d = K(X(c, i));
2915
+ ), d = J(Y(c, i));
2912
2916
  d < o && (o = d, a = c, r = h);
2913
2917
  }
2914
2918
  return a ? { t: r, point: a, distance: o } : null;
2915
2919
  }
2916
- function Ds(i, e, t) {
2920
+ function Ls(i, e, t) {
2917
2921
  const n = t.x - e.x, s = t.y - e.y, r = n * n + s * s;
2918
2922
  if (r === 0)
2919
2923
  return {
2920
2924
  t: 0,
2921
2925
  point: { x: e.x, y: e.y },
2922
- distance: K(X(e, i))
2926
+ distance: J(Y(e, i))
2923
2927
  };
2924
2928
  const o = Math.max(
2925
2929
  0,
@@ -2934,30 +2938,30 @@ function Ds(i, e, t) {
2934
2938
  return {
2935
2939
  t: o,
2936
2940
  point: a,
2937
- distance: K(X(a, i))
2941
+ distance: J(Y(a, i))
2938
2942
  };
2939
2943
  }
2940
- function Ls(i, e, t) {
2944
+ function Hs(i, e, t) {
2941
2945
  let n = null, s = t;
2942
2946
  const r = e.getAttribute("curvature"), a = e.getExtremities().getPosition();
2943
2947
  for (let l = 0; l < e.size; l++) {
2944
2948
  const h = e.get(l), c = r[l], d = a[2 * l], u = a[2 * l + 1];
2945
2949
  let g;
2946
2950
  if (c === 0 || c === void 0)
2947
- g = Ds(i, d, u);
2951
+ g = Ls(i, d, u);
2948
2952
  else {
2949
- const p = zt.getQuadraticCurveControlPoint(
2953
+ const f = zt.getQuadraticCurveControlPoint(
2950
2954
  d.x,
2951
2955
  d.y,
2952
2956
  u.x,
2953
2957
  u.y,
2954
2958
  c
2955
2959
  );
2956
- g = Ps(
2960
+ g = Ds(
2957
2961
  i,
2958
2962
  d,
2959
2963
  u,
2960
- p
2964
+ f
2961
2965
  );
2962
2966
  }
2963
2967
  g && g.distance < s && (s = g.distance, n = {
@@ -2969,10 +2973,10 @@ function Ls(i, e, t) {
2969
2973
  }
2970
2974
  return n;
2971
2975
  }
2972
- function Hs(i, e, t) {
2976
+ function _s(i, e, t) {
2973
2977
  const n = e.getAttributes(["x", "y", "radius"]);
2974
2978
  for (let s = 0; s < n.length; s++) {
2975
- const r = n[s], o = X({ x: r.x, y: r.y }, i), a = K(o);
2979
+ const r = n[s], o = Y({ x: r.x, y: r.y }, i), a = J(o);
2976
2980
  if (a >= Number(r.radius) + Number(t)) continue;
2977
2981
  const l = ot(o, 1 / a), h = a < Number(r.radius) / 2, c = h ? { x: r.x, y: r.y } : dt({ x: r.x, y: r.y }, ot(l, -Number(r.radius))), d = h ? { x: 0, y: 0 } : l;
2978
2982
  return {
@@ -2984,7 +2988,7 @@ function Hs(i, e, t) {
2984
2988
  }
2985
2989
  return null;
2986
2990
  }
2987
- function _s(i, e) {
2991
+ function Is(i, e) {
2988
2992
  let t = !1;
2989
2993
  for (let n = 0, s = e.length - 1; n < e.length; s = n++) {
2990
2994
  const r = e[n][0], o = e[n][1], a = e[s][0], l = e[s][1];
@@ -2992,27 +2996,27 @@ function _s(i, e) {
2992
2996
  }
2993
2997
  return t;
2994
2998
  }
2995
- function Is(i, e, t, n, s) {
2999
+ function zs(i, e, t, n, s) {
2996
3000
  const r = i * i, o = r * i, a = 1 - i, l = a * a, h = l * a;
2997
3001
  return {
2998
3002
  x: h * e.x + 3 * l * i * t.x + 3 * a * r * n.x + o * s.x,
2999
3003
  y: h * e.y + 3 * l * i * t.y + 3 * a * r * n.y + o * s.y
3000
3004
  };
3001
3005
  }
3002
- function zs(i, e, t, n, s) {
3006
+ function Bs(i, e, t, n, s) {
3003
3007
  let r = 1 / 0, o = null;
3004
3008
  const a = 20;
3005
3009
  for (let l = 0; l <= a; l++) {
3006
- const h = l / a, c = Is(h, e, t, n, s), d = K(X(c, i));
3010
+ const h = l / a, c = zs(h, e, t, n, s), d = J(Y(c, i));
3007
3011
  d < r && (r = d, o = c);
3008
3012
  }
3009
3013
  return o ? { point: o, distance: r } : null;
3010
3014
  }
3011
- function Bs(i, e, t) {
3015
+ function Rs(i, e, t) {
3012
3016
  const n = e.geometry.coordinates[0];
3013
3017
  for (let s = 0; s < n.length - 1; s++) {
3014
3018
  const [r, o] = n[s];
3015
- if (K(X({ x: r, y: o }, i)) < t)
3019
+ if (J(Y({ x: r, y: o }, i)) < t)
3016
3020
  return {
3017
3021
  point: { x: r, y: o },
3018
3022
  magnet: { x: r, y: o },
@@ -3021,14 +3025,14 @@ function Bs(i, e, t) {
3021
3025
  };
3022
3026
  }
3023
3027
  for (let s = 0; s < n.length - 1; s++) {
3024
- const [r, o] = n[s], [a, l] = n[s + 1], h = { x: r, y: o }, d = X({ x: a, y: l }, h), u = K(d), g = {
3028
+ const [r, o] = n[s], [a, l] = n[s + 1], h = { x: r, y: o }, d = Y({ x: a, y: l }, h), u = J(d), g = {
3025
3029
  x: d.x / u,
3026
3030
  y: d.y / u
3027
- }, p = { x: -g.y, y: g.x }, f = X(i, h), m = Math.abs(mt(p, f)), x = mt(g, f);
3028
- if (x >= 0 && x <= u && m < t) {
3031
+ }, f = { x: -g.y, y: g.x }, p = Y(i, h), m = Math.abs(mt(f, p)), w = mt(g, p);
3032
+ if (w >= 0 && w <= u && m < t) {
3029
3033
  const b = {
3030
- x: h.x + g.x * x,
3031
- y: h.y + g.y * x
3034
+ x: h.x + g.x * w,
3035
+ y: h.y + g.y * w
3032
3036
  };
3033
3037
  return {
3034
3038
  point: b,
@@ -3040,14 +3044,14 @@ function Bs(i, e, t) {
3040
3044
  }
3041
3045
  return null;
3042
3046
  }
3043
- function Rs(i, e, t) {
3047
+ function $s(i, e, t) {
3044
3048
  for (const s of e) {
3045
3049
  const o = s.geometry.coordinates[0].slice(0, -1);
3046
3050
  if (o.length < 3)
3047
- return Bs(i, s, t);
3051
+ return Rs(i, s, t);
3048
3052
  for (let c = 0; c < o.length; c++) {
3049
3053
  const [d, u] = o[c];
3050
- if (K(X({ x: d, y: u }, i)) < t)
3054
+ if (J(Y({ x: d, y: u }, i)) < t)
3051
3055
  return {
3052
3056
  point: { x: d, y: u },
3053
3057
  magnet: { x: d, y: u },
@@ -3055,14 +3059,14 @@ function Rs(i, e, t) {
3055
3059
  id: s.id
3056
3060
  };
3057
3061
  }
3058
- const a = _s(i, o);
3062
+ const a = Is(i, o);
3059
3063
  let l = null, h = a ? 1 / 0 : t;
3060
3064
  for (let c = 0; c < o.length; c++) {
3061
- const d = o[(c - 1 + o.length) % o.length], u = o[c], g = o[(c + 1) % o.length], p = o[(c + 2) % o.length], f = u[0] + (g[0] - d[0]) / 6 * 0.5, m = u[1] + (g[1] - d[1]) / 6 * 0.5, x = g[0] - (p[0] - u[0]) / 6 * 0.5, b = g[1] - (p[1] - u[1]) / 6 * 0.5, v = zs(
3065
+ const d = o[(c - 1 + o.length) % o.length], u = o[c], g = o[(c + 1) % o.length], f = o[(c + 2) % o.length], p = u[0] + (g[0] - d[0]) / 6 * 0.5, m = u[1] + (g[1] - d[1]) / 6 * 0.5, w = g[0] - (f[0] - u[0]) / 6 * 0.5, b = g[1] - (f[1] - u[1]) / 6 * 0.5, v = Bs(
3062
3066
  i,
3063
3067
  { x: u[0], y: u[1] },
3064
- { x: f, y: m },
3065
- { x, y: b },
3068
+ { x: p, y: m },
3069
+ { x: w, y: b },
3066
3070
  { x: g[0], y: g[1] }
3067
3071
  );
3068
3072
  if (v) {
@@ -3088,7 +3092,7 @@ function Rs(i, e, t) {
3088
3092
  }
3089
3093
  return null;
3090
3094
  }
3091
- const fn = [
3095
+ const pn = [
3092
3096
  { x: -0.5, y: -0.5 },
3093
3097
  { x: 0, y: -0.5 },
3094
3098
  { x: 0.5, y: -0.5 },
@@ -3099,7 +3103,7 @@ const fn = [
3099
3103
  { x: 0.5, y: 0.5 },
3100
3104
  { x: 0, y: 0 }
3101
3105
  // center
3102
- ], $s = [
3106
+ ], Ns = [
3103
3107
  [-0.5, -0.5, 0.5, -0.5],
3104
3108
  // top
3105
3109
  [0.5, -0.5, 0.5, 0.5],
@@ -3109,29 +3113,29 @@ const fn = [
3109
3113
  [-0.5, 0.5, -0.5, -0.5]
3110
3114
  // left
3111
3115
  ];
3112
- function ke(i, e, t, n, s, r, o, a, l) {
3116
+ function Me(i, e, t, n, s, r, o, a, l) {
3113
3117
  const h = i * s, c = e * r;
3114
3118
  return l ? {
3115
3119
  x: t + (h * o - c * a),
3116
3120
  y: n + (h * a + c * o)
3117
3121
  } : { x: t + h, y: n + c };
3118
3122
  }
3119
- function Ns(i, e, t, n, s) {
3123
+ function Ys(i, e, t, n, s) {
3120
3124
  var c;
3121
3125
  const r = Q(e);
3122
3126
  let { width: o, height: a } = q(e);
3123
3127
  const { sin: l, cos: h } = s.getState();
3124
3128
  (c = e.properties.style) != null && c.fixedSize && (o /= t, a /= t);
3125
- for (const d of fn) {
3129
+ for (const d of pn) {
3126
3130
  let u = d.x * o, g = d.y * a;
3127
3131
  if (!W(e)) {
3128
- const m = u * h - g * l, x = u * l + g * h;
3129
- u = m, g = x;
3132
+ const m = u * h - g * l, w = u * l + g * h;
3133
+ u = m, g = w;
3130
3134
  }
3131
- const p = { x: r.x + u, y: r.y + g };
3132
- if (!(K(X(p, i)) >= n))
3135
+ const f = { x: r.x + u, y: r.y + g };
3136
+ if (!(J(Y(f, i)) >= n))
3133
3137
  return {
3134
- point: { x: p.x, y: p.y },
3138
+ point: { x: f.x, y: f.y },
3135
3139
  type: T.TEXT,
3136
3140
  magnet: d,
3137
3141
  id: e.id
@@ -3139,32 +3143,32 @@ function Ns(i, e, t, n, s) {
3139
3143
  }
3140
3144
  return null;
3141
3145
  }
3142
- function Ys(i, e, t, n, s) {
3143
- var p;
3146
+ function Os(i, e, t, n, s) {
3147
+ var f;
3144
3148
  const { x: r, y: o } = Q(e);
3145
3149
  let { width: a, height: l } = q(e);
3146
- (p = e.properties.style) != null && p.fixedSize && (a /= t, l /= t);
3150
+ (f = e.properties.style) != null && f.fixedSize && (a /= t, l /= t);
3147
3151
  const { sin: h, cos: c } = s.getState(), d = !W(e);
3148
3152
  let u = null, g = 1 / 0;
3149
- for (let f = 0; f < 4; f++) {
3150
- const [m, x, b, v] = $s[f], S = ke(m, x, r, o, a, l, c, h, d), w = ke(b, v, r, o, a, l, c, h, d), A = X(w, S), C = K(A), E = { x: A.x / C, y: A.y / C }, k = { x: -E.y, y: E.x }, F = X(i, S), j = mt(k, F), z = mt(E, F);
3151
- if (z >= 0 && z <= C) {
3152
- const R = Math.abs(j);
3153
- if (R < n || R < g) {
3154
- const et = z / C, Y = {
3153
+ for (let p = 0; p < 4; p++) {
3154
+ const [m, w, b, v] = Ns[p], S = Me(m, w, r, o, a, l, c, h, d), x = Me(b, v, r, o, a, l, c, h, d), A = Y(x, S), C = J(A), E = { x: A.x / C, y: A.y / C }, k = { x: -E.y, y: E.x }, F = Y(i, S), O = mt(k, F), N = mt(E, F);
3155
+ if (N >= 0 && N <= C) {
3156
+ const B = Math.abs(O);
3157
+ if (B < n || B < g) {
3158
+ const et = N / C, nt = {
3155
3159
  point: {
3156
- x: S.x + E.x * z,
3157
- y: S.y + E.y * z
3160
+ x: S.x + E.x * N,
3161
+ y: S.y + E.y * N
3158
3162
  },
3159
3163
  magnet: {
3160
3164
  x: m + (b - m) * et,
3161
- y: x + (v - x) * et
3165
+ y: w + (v - w) * et
3162
3166
  },
3163
3167
  type: T.TEXT,
3164
3168
  id: e.id
3165
3169
  };
3166
- if (R < n) return Y;
3167
- R < g && (g = R, u = Y);
3170
+ if (B < n) return nt;
3171
+ B < g && (g = B, u = nt);
3168
3172
  }
3169
3173
  }
3170
3174
  }
@@ -3172,12 +3176,12 @@ function Ys(i, e, t, n, s) {
3172
3176
  }
3173
3177
  function Xs(i, e, t, n, s) {
3174
3178
  for (const r of e) {
3175
- const o = Ns(i, r, t, n, s) || Ys(i, r, t, n, s);
3179
+ const o = Ys(i, r, t, n, s) || Os(i, r, t, n, s);
3176
3180
  if (o) return o;
3177
3181
  }
3178
3182
  return null;
3179
3183
  }
3180
- class Os extends EventTarget {
3184
+ class Us extends EventTarget {
3181
3185
  constructor(t, n, s, r) {
3182
3186
  super();
3183
3187
  y(this, "ogma");
@@ -3197,7 +3201,7 @@ class Os extends EventTarget {
3197
3201
  minY: t.y - n,
3198
3202
  maxX: t.x + n,
3199
3203
  maxY: t.y + n
3200
- }, r = this.spatialIndex.search(s), o = r.filter((p) => _(p) || W(p)), a = r.filter((p) => nt(p)), { nodes: l, edges: h } = this.ogma.view.getElementsInside(
3204
+ }, r = this.spatialIndex.search(s), o = r.filter((f) => _(f) || W(f)), a = r.filter((f) => st(f)), { nodes: l, edges: h } = this.ogma.view.getElementsInside(
3201
3205
  s.minX,
3202
3206
  s.minY,
3203
3207
  s.maxX,
@@ -3216,13 +3220,13 @@ class Os extends EventTarget {
3216
3220
  return Xs(t, n, s, this.options.magnetRadius, this.store);
3217
3221
  }
3218
3222
  snapToPolygon(t, n) {
3219
- return Rs(t, n, this.options.magnetRadius);
3223
+ return $s(t, n, this.options.magnetRadius);
3220
3224
  }
3221
3225
  snapToNodes(t, n) {
3222
- return Hs(t, n, this.options.detectMargin);
3226
+ return _s(t, n, this.options.detectMargin);
3223
3227
  }
3224
3228
  snapToEdges(t, n) {
3225
- return Ls(t, n, this.options.magnetRadius);
3229
+ return Hs(t, n, this.options.magnetRadius);
3226
3230
  }
3227
3231
  getHoveredNode() {
3228
3232
  return this.hoveredNode;
@@ -3232,10 +3236,10 @@ class Os extends EventTarget {
3232
3236
  (t = this.hoveredNode) == null || t.setSelected(!1), this.hoveredNode = null;
3233
3237
  }
3234
3238
  getMagnets() {
3235
- return fn;
3239
+ return pn;
3236
3240
  }
3237
3241
  }
3238
- class Us extends EventTarget {
3242
+ class qs extends EventTarget {
3239
3243
  // pixels
3240
3244
  constructor(t, n, s) {
3241
3245
  super();
@@ -3291,7 +3295,7 @@ class Us extends EventTarget {
3291
3295
  mousePressPoint: null
3292
3296
  }), this.mouseDownState && !this.mouseDownState.hasMoved && !n.isDragging) {
3293
3297
  const s = this.mouseDownState.annotation;
3294
- s ? t.ctrlKey || t.metaKey ? n.toggleSelection(s.id) : n.selectedFeatures.has(s.id) || n.setSelectedFeatures([s.id]) : !t.ctrlKey && !t.metaKey && n.clearSelection(), this.dispatchEvent(new CustomEvent(re, {
3298
+ s ? t.ctrlKey || t.metaKey ? n.toggleSelection(s.id) : n.selectedFeatures.has(s.id) || n.setSelectedFeatures([s.id]) : !t.ctrlKey && !t.metaKey && n.clearSelection(), this.dispatchEvent(new CustomEvent(oe, {
3295
3299
  detail: {
3296
3300
  id: (s == null ? void 0 : s.id) ?? null,
3297
3301
  position: {
@@ -3310,7 +3314,7 @@ class Us extends EventTarget {
3310
3314
  t,
3311
3315
  this.ogma.getContainer()
3312
3316
  ), { x: s, y: r } = this.ogma.view.screenToGraphCoordinates(n), o = this.detect(s, r);
3313
- if (!o || !D(o)) return;
3317
+ if (!o || !P(o)) return;
3314
3318
  const a = (d = o.properties.style) == null ? void 0 : d.maxHeight, l = o.properties.height;
3315
3319
  if (!a || l <= a) return;
3316
3320
  const h = this.ogma.getContainer(), c = h == null ? void 0 : h.querySelector(
@@ -3346,22 +3350,22 @@ class Us extends EventTarget {
3346
3350
  for (const h of l) {
3347
3351
  const c = o.getFeature(h.id);
3348
3352
  if (tt(c)) {
3349
- if (an(c, { x: t, y: n }, a)) {
3353
+ if (cn(c, { x: t, y: n }, a)) {
3350
3354
  r = c;
3351
3355
  break;
3352
3356
  }
3353
3357
  } else if (W(c)) {
3354
- if (ss(c, { x: t, y: n }, 0, 1, a)) {
3358
+ if (is(c, { x: t, y: n }, 0, 1, a)) {
3355
3359
  r = c;
3356
3360
  break;
3357
3361
  }
3358
- } else if (nt(c)) {
3359
- if (hn(c, { x: t, y: n }, a)) {
3362
+ } else if (st(c)) {
3363
+ if (dn(c, { x: t, y: n }, a)) {
3360
3364
  r = c;
3361
3365
  break;
3362
3366
  }
3363
- } else if (D(c)) {
3364
- if (is(
3367
+ } else if (P(c)) {
3368
+ if (rs(
3365
3369
  c,
3366
3370
  { x: t, y: n },
3367
3371
  a,
@@ -3372,7 +3376,7 @@ class Us extends EventTarget {
3372
3376
  r = c;
3373
3377
  break;
3374
3378
  }
3375
- } else if (_(c) && cn(
3379
+ } else if (_(c) && ln(
3376
3380
  c,
3377
3381
  { x: t, y: n },
3378
3382
  a,
@@ -3409,11 +3413,11 @@ class Us extends EventTarget {
3409
3413
  t && (t.removeEventListener("mousemove", this.onMouseMove), t.removeEventListener("click", this.onMouseClick));
3410
3414
  }
3411
3415
  }
3412
- function pn(i, e, t = 0, n = i.length - 1, s = qs) {
3416
+ function mn(i, e, t = 0, n = i.length - 1, s = Ws) {
3413
3417
  for (; n > t; ) {
3414
3418
  if (n - t > 600) {
3415
- const l = n - t + 1, h = e - t + 1, c = Math.log(l), d = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * d * (l - d) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(t, Math.floor(e - h * d / l + u)), p = Math.min(n, Math.floor(e + (l - h) * d / l + u));
3416
- pn(i, e, g, p, s);
3419
+ const l = n - t + 1, h = e - t + 1, c = Math.log(l), d = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * d * (l - d) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(t, Math.floor(e - h * d / l + u)), f = Math.min(n, Math.floor(e + (l - h) * d / l + u));
3420
+ mn(i, e, g, f, s);
3417
3421
  }
3418
3422
  const r = i[e];
3419
3423
  let o = t, a = n;
@@ -3428,10 +3432,10 @@ function wt(i, e, t) {
3428
3432
  const n = i[e];
3429
3433
  i[e] = i[t], i[t] = n;
3430
3434
  }
3431
- function qs(i, e) {
3435
+ function Ws(i, e) {
3432
3436
  return i < e ? -1 : i > e ? 1 : 0;
3433
3437
  }
3434
- class Ws {
3438
+ class js {
3435
3439
  constructor(e = 9) {
3436
3440
  this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
3437
3441
  }
@@ -3446,7 +3450,7 @@ class Ws {
3446
3450
  for (; t; ) {
3447
3451
  for (let o = 0; o < t.children.length; o++) {
3448
3452
  const a = t.children[o], l = t.leaf ? s(a) : a;
3449
- Lt(e, l) && (t.leaf ? n.push(a) : Kt(e, l) ? this._all(a, n) : r.push(a));
3453
+ Lt(e, l) && (t.leaf ? n.push(a) : Jt(e, l) ? this._all(a, n) : r.push(a));
3450
3454
  }
3451
3455
  t = r.pop();
3452
3456
  }
@@ -3460,7 +3464,7 @@ class Ws {
3460
3464
  for (let s = 0; s < t.children.length; s++) {
3461
3465
  const r = t.children[s], o = t.leaf ? this.toBBox(r) : r;
3462
3466
  if (Lt(e, o)) {
3463
- if (t.leaf || Kt(e, o)) return !0;
3467
+ if (t.leaf || Jt(e, o)) return !0;
3464
3468
  n.push(r);
3465
3469
  }
3466
3470
  }
@@ -3502,11 +3506,11 @@ class Ws {
3502
3506
  let a, l, h;
3503
3507
  for (; n || r.length; ) {
3504
3508
  if (n || (n = r.pop(), l = r[r.length - 1], a = o.pop(), h = !0), n.leaf) {
3505
- const c = js(e, n.children, t);
3509
+ const c = Gs(e, n.children, t);
3506
3510
  if (c !== -1)
3507
3511
  return n.children.splice(c, 1), r.push(n), this._condense(r), this;
3508
3512
  }
3509
- !h && !n.leaf && Kt(n, s) ? (r.push(n), o.push(a), a = 0, l = n, n = n.children[0]) : l ? (a++, n = l.children[a], h = !1) : n = null;
3513
+ !h && !n.leaf && Jt(n, s) ? (r.push(n), o.push(a), a = 0, l = n, n = n.children[0]) : l ? (a++, n = l.children[a], h = !1) : n = null;
3510
3514
  }
3511
3515
  return this;
3512
3516
  }
@@ -3538,10 +3542,10 @@ class Ws {
3538
3542
  return a = pt(e.slice(t, n + 1)), gt(a, this.toBBox), a;
3539
3543
  s || (s = Math.ceil(Math.log(r) / Math.log(o)), o = Math.ceil(r / Math.pow(o, s - 1))), a = pt([]), a.leaf = !1, a.height = s;
3540
3544
  const l = Math.ceil(r / o), h = l * Math.ceil(Math.sqrt(o));
3541
- Me(e, t, n, h, this.compareMinX);
3545
+ Te(e, t, n, h, this.compareMinX);
3542
3546
  for (let c = t; c <= n; c += h) {
3543
3547
  const d = Math.min(c + h - 1, n);
3544
- Me(e, c, d, l, this.compareMinY);
3548
+ Te(e, c, d, l, this.compareMinY);
3545
3549
  for (let u = c; u <= d; u += l) {
3546
3550
  const g = Math.min(u + l - 1, d);
3547
3551
  a.children.push(this._build(e, u, g, s - 1));
@@ -3553,7 +3557,7 @@ class Ws {
3553
3557
  for (; s.push(t), !(t.leaf || s.length - 1 === n); ) {
3554
3558
  let r = 1 / 0, o = 1 / 0, a;
3555
3559
  for (let l = 0; l < t.children.length; l++) {
3556
- const h = t.children[l], c = Zt(h), d = Zs(e, h) - c;
3560
+ const h = t.children[l], c = Kt(h), d = Ks(e, h) - c;
3557
3561
  d < o ? (o = d, r = c < r ? c : r, a = h) : d === o && c < r && (r = c, a = h);
3558
3562
  }
3559
3563
  t = a || t.children[0];
@@ -3579,14 +3583,14 @@ class Ws {
3579
3583
  _chooseSplitIndex(e, t, n) {
3580
3584
  let s, r = 1 / 0, o = 1 / 0;
3581
3585
  for (let a = t; a <= n - t; a++) {
3582
- const l = bt(e, 0, a, this.toBBox), h = bt(e, a, n, this.toBBox), c = Ks(l, h), d = Zt(l) + Zt(h);
3586
+ const l = bt(e, 0, a, this.toBBox), h = bt(e, a, n, this.toBBox), c = Js(l, h), d = Kt(l) + Kt(h);
3583
3587
  c < r ? (r = c, s = a, o = d < o ? d : o) : c === r && d < o && (o = d, s = a);
3584
3588
  }
3585
3589
  return s || n - t;
3586
3590
  }
3587
3591
  // sorts node children by the best axis for split
3588
3592
  _chooseSplitAxis(e, t, n) {
3589
- const s = e.leaf ? this.compareMinX : Gs, r = e.leaf ? this.compareMinY : Vs, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, r);
3593
+ const s = e.leaf ? this.compareMinX : Vs, r = e.leaf ? this.compareMinY : Zs, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, r);
3590
3594
  o < a && e.children.sort(s);
3591
3595
  }
3592
3596
  // total margin of all possible split distributions where each node is at least m full
@@ -3613,7 +3617,7 @@ class Ws {
3613
3617
  e[t].children.length === 0 ? t > 0 ? (n = e[t - 1].children, n.splice(n.indexOf(e[t]), 1)) : this.clear() : gt(e[t], this.toBBox);
3614
3618
  }
3615
3619
  }
3616
- function js(i, e, t) {
3620
+ function Gs(i, e, t) {
3617
3621
  if (!t) return e.indexOf(i);
3618
3622
  for (let n = 0; n < e.length; n++)
3619
3623
  if (t(i, e[n])) return n;
@@ -3633,26 +3637,26 @@ function bt(i, e, t, n, s) {
3633
3637
  function vt(i, e) {
3634
3638
  return i.minX = Math.min(i.minX, e.minX), i.minY = Math.min(i.minY, e.minY), i.maxX = Math.max(i.maxX, e.maxX), i.maxY = Math.max(i.maxY, e.maxY), i;
3635
3639
  }
3636
- function Gs(i, e) {
3640
+ function Vs(i, e) {
3637
3641
  return i.minX - e.minX;
3638
3642
  }
3639
- function Vs(i, e) {
3643
+ function Zs(i, e) {
3640
3644
  return i.minY - e.minY;
3641
3645
  }
3642
- function Zt(i) {
3646
+ function Kt(i) {
3643
3647
  return (i.maxX - i.minX) * (i.maxY - i.minY);
3644
3648
  }
3645
3649
  function Dt(i) {
3646
3650
  return i.maxX - i.minX + (i.maxY - i.minY);
3647
3651
  }
3648
- function Zs(i, e) {
3652
+ function Ks(i, e) {
3649
3653
  return (Math.max(e.maxX, i.maxX) - Math.min(e.minX, i.minX)) * (Math.max(e.maxY, i.maxY) - Math.min(e.minY, i.minY));
3650
3654
  }
3651
- function Ks(i, e) {
3655
+ function Js(i, e) {
3652
3656
  const t = Math.max(i.minX, e.minX), n = Math.max(i.minY, e.minY), s = Math.min(i.maxX, e.maxX), r = Math.min(i.maxY, e.maxY);
3653
3657
  return Math.max(0, s - t) * Math.max(0, r - n);
3654
3658
  }
3655
- function Kt(i, e) {
3659
+ function Jt(i, e) {
3656
3660
  return i.minX <= e.minX && i.minY <= e.minY && e.maxX <= i.maxX && e.maxY <= i.maxY;
3657
3661
  }
3658
3662
  function Lt(i, e) {
@@ -3669,28 +3673,28 @@ function pt(i) {
3669
3673
  maxY: -1 / 0
3670
3674
  };
3671
3675
  }
3672
- function Me(i, e, t, n, s) {
3676
+ function Te(i, e, t, n, s) {
3673
3677
  const r = [e, t];
3674
3678
  for (; r.length; ) {
3675
3679
  if (t = r.pop(), e = r.pop(), t - e <= n) continue;
3676
3680
  const o = e + Math.ceil((t - e) / n / 2) * n;
3677
- pn(i, o, e, t, s), r.push(e, o, o, t);
3681
+ mn(i, o, e, t, s), r.push(e, o, o, t);
3678
3682
  }
3679
3683
  }
3680
- const xt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, Te = (i, e) => i.id === e.id;
3681
- class Js extends Ws {
3684
+ const xt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, Fe = (i, e) => i.id === e.id;
3685
+ class Qs extends js {
3682
3686
  constructor(t) {
3683
3687
  super();
3684
3688
  y(this, "store");
3685
3689
  y(this, "onRotationChange", () => {
3686
- const t = this.store.getState().getAllFeatures().filter((n) => _(n) || D(n));
3690
+ const t = this.store.getState().getAllFeatures().filter((n) => _(n) || P(n));
3687
3691
  for (const n of t) this.updateRotatedText(n);
3688
3692
  });
3689
3693
  y(this, "onZoomChange", () => {
3690
3694
  const t = this.store.getState().getAllFeatures().filter(
3691
3695
  (n) => {
3692
3696
  var s;
3693
- return (_(n) || D(n)) && ((s = n.properties.style) == null ? void 0 : s.fixedSize);
3697
+ return (_(n) || P(n)) && ((s = n.properties.style) == null ? void 0 : s.fixedSize);
3694
3698
  }
3695
3699
  );
3696
3700
  for (const n of t) this.updateRotatedText(n);
@@ -3699,7 +3703,7 @@ class Js extends Ws {
3699
3703
  (n) => n.features,
3700
3704
  (n) => {
3701
3705
  this.clear(), Object.values(n).forEach((s) => {
3702
- _(s) || D(s) ? this.updateRotatedText(s) : this.insert(s);
3706
+ _(s) || P(s) ? this.updateRotatedText(s) : this.insert(s);
3703
3707
  });
3704
3708
  }
3705
3709
  ), this.store.subscribe(
@@ -3712,7 +3716,7 @@ class Js extends Ws {
3712
3716
  (n, s) => {
3713
3717
  s && s.isDragging && !n.isDragging && n.lastChangedFeatures.length > 0 && n.lastChangedFeatures.forEach((r) => {
3714
3718
  const o = n.features[r];
3715
- o && (kt(o), _(o) || D(o) ? this.updateRotatedText(o) : (this.remove(o, Te), this.insert(o)));
3719
+ o && (kt(o), _(o) || P(o) ? this.updateRotatedText(o) : (this.remove(o, Fe), this.insert(o)));
3716
3720
  });
3717
3721
  },
3718
3722
  { equalityFn: (n, s) => n.isDragging === s.isDragging }
@@ -3721,7 +3725,7 @@ class Js extends Ws {
3721
3725
  updateRotatedText(t) {
3722
3726
  var d;
3723
3727
  const n = this.store.getState();
3724
- this.remove(t, Te);
3728
+ this.remove(t, Fe);
3725
3729
  const s = Q(t);
3726
3730
  let { width: r, height: o } = q(t);
3727
3731
  if (((d = t.properties.style) == null ? void 0 : d.fixedSize) === !0) {
@@ -3758,7 +3762,7 @@ class Js extends Ws {
3758
3762
  return super.search(t);
3759
3763
  }
3760
3764
  }
3761
- class mn {
3765
+ class yn {
3762
3766
  constructor(e, t) {
3763
3767
  y(this, "layer");
3764
3768
  this.ogma = e, this.store = t;
@@ -3766,11 +3770,11 @@ class mn {
3766
3770
  destroy() {
3767
3771
  }
3768
3772
  }
3769
- function Qs(i, e, t, n, s, r) {
3773
+ function ti(i, e, t, n, s, r) {
3770
3774
  const o = Math.min(n / 2, s / 2), a = Math.min(r, o);
3771
3775
  i.beginPath(), i.moveTo(e + a, t), i.lineTo(e + n - a, t), i.quadraticCurveTo(e + n, t, e + n, t + a), i.lineTo(e + n, t + s - a), i.quadraticCurveTo(e + n, t + s, e + n - a, t + s), i.lineTo(e + a, t + s), i.quadraticCurveTo(e, t + s, e, t + s - a), i.lineTo(e, t + a), i.quadraticCurveTo(e, t, e + a, t), i.closePath();
3772
3776
  }
3773
- const Fe = [
3777
+ const Pe = [
3774
3778
  [-0.5, -0.5],
3775
3779
  // top-left
3776
3780
  [0.5, -0.5],
@@ -3780,7 +3784,7 @@ const Fe = [
3780
3784
  [-0.5, 0.5]
3781
3785
  // bottom-right
3782
3786
  ];
3783
- class ti extends mn {
3787
+ class ei extends yn {
3784
3788
  constructor(t, n) {
3785
3789
  super(t, n);
3786
3790
  // TODO: move it to settings and state
@@ -3809,7 +3813,7 @@ class ti extends mn {
3809
3813
  r,
3810
3814
  n.zoom
3811
3815
  ), this.renderBoxHandles(d, t, h, r, u);
3812
- } else nt(d) && this.renderPolygonHandles(
3816
+ } else st(d) && this.renderPolygonHandles(
3813
3817
  d,
3814
3818
  t,
3815
3819
  h,
@@ -3821,7 +3825,7 @@ class ti extends mn {
3821
3825
  this.layer = t.layers.addCanvasLayer(
3822
3826
  this.render,
3823
3827
  void 0,
3824
- de.HANDLES
3828
+ ue.HANDLES
3825
3829
  ), this.store.subscribe(
3826
3830
  (s) => ({
3827
3831
  selectedFeatures: s.selectedFeatures,
@@ -3831,46 +3835,46 @@ class ti extends mn {
3831
3835
  ), t.events.on("zoom", this.refresh);
3832
3836
  }
3833
3837
  renderOutline(t, n, s, r, o) {
3834
- var m, x;
3838
+ var m, w;
3835
3839
  const a = _(t) && ((m = t.properties.style) == null ? void 0 : m.fixedSize);
3836
3840
  let { width: l, height: h } = q(t);
3837
3841
  a && (l /= o, h /= o);
3838
- const c = St(t, a, o), d = l / 2, u = h / 2, g = c.x + d, p = c.y + u;
3839
- n.save(), n.translate(g, p), n.rotate(s);
3840
- const f = (x = t.properties.style) == null ? void 0 : x.borderRadius;
3841
- if (f && f > 0 ? (Qs(n, -d, -u, l, h, f), n.stroke()) : n.strokeRect(-d, -u, l, h), r >= 4 && r < 8) {
3842
- let b, v, S, w;
3843
- const A = f && f > 0 ? f : this.handleRadius / o;
3842
+ const c = St(t, a, o), d = l / 2, u = h / 2, g = c.x + d, f = c.y + u;
3843
+ n.save(), n.translate(g, f), n.rotate(s);
3844
+ const p = (w = t.properties.style) == null ? void 0 : w.borderRadius;
3845
+ if (p && p > 0 ? (ti(n, -d, -u, l, h, p), n.stroke()) : n.strokeRect(-d, -u, l, h), r >= 4 && r < 8) {
3846
+ let b, v, S, x;
3847
+ const A = p && p > 0 ? p : this.handleRadius / o;
3844
3848
  switch (r) {
3845
3849
  case 4:
3846
- b = -d + A, v = -u, S = d - A, w = -u;
3850
+ b = -d + A, v = -u, S = d - A, x = -u;
3847
3851
  break;
3848
3852
  case 5:
3849
- b = d, v = -u + A, S = d, w = u - A;
3853
+ b = d, v = -u + A, S = d, x = u - A;
3850
3854
  break;
3851
3855
  case 6:
3852
- b = d - A, v = u, S = -d + A, w = u;
3856
+ b = d - A, v = u, S = -d + A, x = u;
3853
3857
  break;
3854
3858
  case 7:
3855
- b = -d, v = u - A, S = -d, w = -u + A;
3859
+ b = -d, v = u - A, S = -d, x = -u + A;
3856
3860
  break;
3857
3861
  }
3858
- n.lineWidth = this.handleStrokeWidth * this.handleMagnifier / o, n.beginPath(), n.moveTo(b, v), n.lineTo(S, w), n.stroke(), n.lineWidth = this.handleStrokeWidth;
3862
+ n.lineWidth = this.handleStrokeWidth * this.handleMagnifier / o, n.beginPath(), n.moveTo(b, v), n.lineTo(S, x), n.stroke(), n.lineWidth = this.handleStrokeWidth;
3859
3863
  }
3860
3864
  n.restore();
3861
3865
  }
3862
3866
  renderArrowHandles(t, n, s, r) {
3863
- var u, g, p, f;
3864
- const o = nn(t), a = sn(t), l = +(r === 0), h = +(r === 1), c = s * (1 + (this.handleMagnifier - 1) * l), d = s * (1 + (this.handleMagnifier - 1) * h);
3865
- n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(a.x, a.y), n.closePath(), n.stroke(), n.beginPath(), ((g = (u = t.properties.link) == null ? void 0 : u.start) == null ? void 0 : g.type) !== "comment" && (n.moveTo(o.x - c, o.y - c), n.rect(o.x - c, o.y - c, c * 2, c * 2)), ((f = (p = t.properties.link) == null ? void 0 : p.end) == null ? void 0 : f.type) !== "comment" && (n.moveTo(a.x - d, a.y - d), n.rect(a.x - d, a.y - d, d * 2, d * 2)), n.closePath(), n.fill(), n.stroke();
3867
+ var u, g, f, p;
3868
+ const o = sn(t), a = rn(t), l = +(r === 0), h = +(r === 1), c = s * (1 + (this.handleMagnifier - 1) * l), d = s * (1 + (this.handleMagnifier - 1) * h);
3869
+ n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(a.x, a.y), n.closePath(), n.stroke(), n.beginPath(), ((g = (u = t.properties.link) == null ? void 0 : u.start) == null ? void 0 : g.type) !== "comment" && (n.moveTo(o.x - c, o.y - c), n.rect(o.x - c, o.y - c, c * 2, c * 2)), ((p = (f = t.properties.link) == null ? void 0 : f.end) == null ? void 0 : p.type) !== "comment" && (n.moveTo(a.x - d, a.y - d), n.rect(a.x - d, a.y - d, d * 2, d * 2)), n.closePath(), n.fill(), n.stroke();
3866
3870
  }
3867
3871
  renderBoxHandles(t, n, s, r, o) {
3868
- var p;
3869
- if (_(t) && ((p = t.properties.style) != null && p.fixedSize)) return;
3872
+ var f;
3873
+ if (_(t) && ((f = t.properties.style) != null && f.fixedSize)) return;
3870
3874
  const { width: a, height: l } = q(t), h = St(t), c = a / 2, d = l / 2, u = h.x + c, g = h.y + d;
3871
3875
  n.save(), n.translate(u, g), n.rotate(o), n.beginPath();
3872
- for (let f = 0; f < Fe.length; f++) {
3873
- const [m, x] = Fe[f], b = a * m, v = l * x, S = r === f ? s * this.handleMagnifier : s;
3876
+ for (let p = 0; p < Pe.length; p++) {
3877
+ const [m, w] = Pe[p], b = a * m, v = l * w, S = r === p ? s * this.handleMagnifier : s;
3874
3878
  n.rect(b - S, v - S, S * 2, S * 2);
3875
3879
  }
3876
3880
  n.closePath(), n.fill(), n.stroke(), n.restore();
@@ -3892,8 +3896,8 @@ class ti extends mn {
3892
3896
  t.beginPath();
3893
3897
  const o = r.length;
3894
3898
  for (let a = 0; a < o; a++) {
3895
- const l = r[(a - 1 + o) % o], h = r[a], c = r[(a + 1) % o], d = r[(a + 2) % o], u = h[0] + (c[0] - l[0]) / 6 * s, g = h[1] + (c[1] - l[1]) / 6 * s, p = c[0] - (d[0] - h[0]) / 6 * s, f = c[1] - (d[1] - h[1]) / 6 * s;
3896
- a === 0 && t.moveTo(h[0], h[1]), t.bezierCurveTo(u, g, p, f, c[0], c[1]);
3899
+ const l = r[(a - 1 + o) % o], h = r[a], c = r[(a + 1) % o], d = r[(a + 2) % o], u = h[0] + (c[0] - l[0]) / 6 * s, g = h[1] + (c[1] - l[1]) / 6 * s, f = c[0] - (d[0] - h[0]) / 6 * s, p = c[1] - (d[1] - h[1]) / 6 * s;
3900
+ a === 0 && t.moveTo(h[0], h[1]), t.bezierCurveTo(u, g, f, p, c[0], c[1]);
3897
3901
  }
3898
3902
  t.closePath();
3899
3903
  }
@@ -3921,15 +3925,15 @@ class ti extends mn {
3921
3925
  this.layer.destroy(), super.destroy();
3922
3926
  }
3923
3927
  }
3924
- const ei = 0.5;
3925
- function ni(i, e, t, n) {
3926
- const { start: s, end: r } = ue(i), o = X(r, s);
3927
- return Math.min(n, Math.max(2 * e, K(o) * 0.01, t));
3928
+ const ni = 0.5;
3929
+ function si(i, e, t, n) {
3930
+ const { start: s, end: r } = ge(i), o = Y(r, s);
3931
+ return Math.min(n, Math.max(2 * e, J(o) * 0.01, t));
3928
3932
  }
3929
- function Pe(i, e) {
3933
+ function De(i, e) {
3930
3934
  return !i || i === "none" ? 0 : i === "dot" ? e * 2 : i === "halo-dot" ? e * 4 : i === "arrow" || i === "arrow-plain" ? e : 0;
3931
3935
  }
3932
- function si(i, e) {
3936
+ function ii(i, e) {
3933
3937
  if (!i) {
3934
3938
  i = M("g");
3935
3939
  const t = M("path");
@@ -3939,43 +3943,43 @@ function si(i, e) {
3939
3943
  }
3940
3944
  return i;
3941
3945
  }
3942
- function ii(i, e, t, n, s, r) {
3943
- const { start: o, end: a } = ue(e), l = e.properties.style || yt, { tail: h, strokeWidth: c = 0, head: d, strokeColor: u, strokeType: g } = l, p = X(a, o), f = ys(e) ? 1 / r.zoom : 1, m = ni(e, c, t, n) * f, x = si(s, e.id), b = x.firstChild, v = u || "none";
3944
- b.setAttribute("stroke", v), b.setAttribute("stroke-width", `${f * c}`), b.setAttribute("fill", "none"), b.setAttribute("stroke-linecap", "round"), b.setAttribute("stroke-linejoin", "round");
3945
- const S = Pe(h, c * f), w = Pe(d, c * f), A = Nt(p), C = dt(o, ot(A, S)), E = dt(a, ot(A, -w)), k = `M ${C.x} ${C.y} L ${E.x} ${E.y}`;
3946
+ function ri(i, e, t, n, s, r) {
3947
+ const { start: o, end: a } = ge(e), l = e.properties.style || yt, { tail: h, strokeWidth: c = 0, head: d, strokeColor: u, strokeType: g } = l, f = Y(a, o), p = ws(e) ? 1 / r.zoom : 1, m = si(e, c, t, n) * p, w = ii(s, e.id), b = w.firstChild, v = u || "none";
3948
+ b.setAttribute("stroke", v), b.setAttribute("stroke-width", `${p * c}`), b.setAttribute("fill", "none"), b.setAttribute("stroke-linecap", "round"), b.setAttribute("stroke-linejoin", "round");
3949
+ const S = De(h, c * p), x = De(d, c * p), A = Nt(f), C = dt(o, ot(A, S)), E = dt(a, ot(A, -x)), k = `M ${C.x} ${C.y} L ${E.x} ${E.y}`;
3946
3950
  b.setAttribute("d", k);
3947
- const F = x.children[1];
3948
- return F.innerHTML = "", g === "dashed" ? b.setAttribute("stroke-dasharray", "5,10") : b.removeAttribute("stroke-dasharray"), De(
3951
+ const F = w.children[1];
3952
+ return F.innerHTML = "", g === "dashed" ? b.setAttribute("stroke-dasharray", "5,10") : b.removeAttribute("stroke-dasharray"), Le(
3949
3953
  F,
3950
3954
  o,
3951
- p,
3955
+ f,
3952
3956
  v,
3953
3957
  h,
3954
3958
  c,
3955
- f,
3959
+ p,
3956
3960
  m
3957
- ), De(
3961
+ ), Le(
3958
3962
  F,
3959
3963
  a,
3960
- es(p),
3964
+ ns(f),
3961
3965
  v,
3962
3966
  d,
3963
3967
  c,
3964
- f,
3968
+ p,
3965
3969
  m
3966
- ), x.setAttribute(
3970
+ ), w.setAttribute(
3967
3971
  "transform",
3968
3972
  `rotate(${-r.rotation * (180 / Math.PI)})`
3969
- ), i.appendChild(x), x;
3973
+ ), i.appendChild(w), w;
3970
3974
  }
3971
- function De(i, e, t, n, s, r, o, a) {
3972
- s === "halo-dot" && Le(
3975
+ function Le(i, e, t, n, s, r, o, a) {
3976
+ s === "halo-dot" && He(
3973
3977
  i,
3974
3978
  e,
3975
- ri(n),
3976
- ei,
3979
+ oi(n),
3980
+ ni,
3977
3981
  r * o * 4
3978
- ), (s === "dot" || s === "halo-dot") && Le(i, e, n, 1, r * o * 2), (s === "arrow" || s === "arrow-plain") && oi(
3982
+ ), (s === "dot" || s === "halo-dot") && He(i, e, n, 1, r * o * 2), (s === "arrow" || s === "arrow-plain") && ai(
3979
3983
  i,
3980
3984
  e,
3981
3985
  t,
@@ -3985,18 +3989,18 @@ function De(i, e, t, n, s, r, o, a) {
3985
3989
  a
3986
3990
  );
3987
3991
  }
3988
- function ri(i) {
3992
+ function oi(i) {
3989
3993
  return i === "none" ? "none" : i;
3990
3994
  }
3991
- function Le(i, e, t, n, s) {
3995
+ function He(i, e, t, n, s) {
3992
3996
  const r = M("circle");
3993
3997
  r.setAttribute("cx", `${e.x}`), r.setAttribute("cy", `${e.y}`), r.setAttribute("r", `${s}`), r.setAttribute("fill-opacity", `${n}`), r.setAttribute("fill", t), i.appendChild(r);
3994
3998
  }
3995
- function oi(i, e, t, n, s, r, o) {
3996
- const a = ot(Nt(t), o), l = dt(e, xe(a, Math.PI / 6)), h = dt(e, xe(a, -Math.PI / 6)), c = M("path"), d = `${e.x} ${e.y}`, u = `M ${l.x} ${l.y} L ${d} L ${h.x} ${h.y}${s ? " Z" : ""}`;
3999
+ function ai(i, e, t, n, s, r, o) {
4000
+ const a = ot(Nt(t), o), l = dt(e, be(a, Math.PI / 6)), h = dt(e, be(a, -Math.PI / 6)), c = M("path"), d = `${e.x} ${e.y}`, u = `M ${l.x} ${l.y} L ${d} L ${h.x} ${h.y}${s ? " Z" : ""}`;
3997
4001
  c.setAttribute("d", u), c.setAttribute("stroke", n), c.setAttribute("stroke-width", `${r}`), c.setAttribute("fill", s ? n : "none"), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), i.appendChild(c);
3998
4002
  }
3999
- function ai(i, e, t = "box") {
4003
+ function ci(i, e, t = "box") {
4000
4004
  if (!i) {
4001
4005
  i = M("g"), i.setAttribute("data-annotation", `${e}`), i.setAttribute("data-annotation-type", t), i.classList.add(`annotation-${t}`);
4002
4006
  const n = M("rect");
@@ -4004,31 +4008,31 @@ function ai(i, e, t = "box") {
4004
4008
  }
4005
4009
  return i;
4006
4010
  }
4007
- function yn(i, e, t, n) {
4008
- const s = e.id, r = `class${s}`, o = q(e), a = ai(t, s, e.properties.type), { strokeColor: l, strokeWidth: h, strokeType: c, background: d, borderRadius: u, boxShadow: g } = e.properties.style || Mt;
4011
+ function wn(i, e, t, n) {
4012
+ const s = e.id, r = `class${s}`, o = q(e), a = ci(t, s, e.properties.type), { strokeColor: l, strokeWidth: h, strokeType: c, background: d, borderRadius: u, boxShadow: g } = e.properties.style || Mt;
4009
4013
  a.classList.add("annotation-box"), a.setAttribute("fill", `${d || "transparent"}`);
4010
- const p = a.firstChild;
4011
- u && (p.setAttribute("rx", `${u}`), p.setAttribute("ry", `${u}`)), c && c !== "none" && (p.setAttribute("stroke", l || "black"), p.setAttribute("stroke-width", `${h}`), c === "dashed" && p.setAttribute("stroke-dasharray", "5,5")), d && d.length && (n.hoveredFeature === e.id ? p.setAttribute("fill", Ft(d)) : p.setAttribute("fill", d));
4012
- const f = St(e);
4013
- return p.setAttribute("width", `${o.width}`), p.setAttribute("height", `${o.height}`), p.setAttribute("x", `${f.x}`), p.setAttribute("y", `${f.y}`), a.appendChild(p), g ? a.style.filter = `drop-shadow(${g})` : a.style.filter = "", a.setAttribute("transform", n.getRotationTransform(0, 0)), a.classList.add(r), a.setAttribute("data-annotation", `${e.id}`), a.setAttribute("data-annotation-type", e.properties.type), i.appendChild(a), a;
4014
+ const f = a.firstChild;
4015
+ u && (f.setAttribute("rx", `${u}`), f.setAttribute("ry", `${u}`)), c && c !== "none" && (f.setAttribute("stroke", l || "black"), f.setAttribute("stroke-width", `${h}`), c === "dashed" && f.setAttribute("stroke-dasharray", "5,5")), d && d.length && (n.hoveredFeature === e.id ? f.setAttribute("fill", Ft(d)) : f.setAttribute("fill", d));
4016
+ const p = St(e);
4017
+ return f.setAttribute("width", `${o.width}`), f.setAttribute("height", `${o.height}`), f.setAttribute("x", `${p.x}`), f.setAttribute("y", `${p.y}`), a.appendChild(f), g ? a.style.filter = `drop-shadow(${g})` : a.style.filter = "", a.setAttribute("transform", n.getRotationTransform(0, 0)), a.classList.add(r), a.setAttribute("data-annotation", `${e.id}`), a.setAttribute("data-annotation-type", e.properties.type), i.appendChild(a), a;
4014
4018
  }
4015
- let Jt = null;
4016
- function wn() {
4017
- return Jt || (Jt = document.createElement("canvas").getContext("2d")), Jt;
4019
+ let Qt = null;
4020
+ function xn() {
4021
+ return Qt || (Qt = document.createElement("canvas").getContext("2d")), Qt;
4018
4022
  }
4019
- function xn(i, e, t, n, s) {
4023
+ function bn(i, e, t, n, s) {
4020
4024
  if (!i || i.length === 0) return !0;
4021
4025
  if (i.includes(`
4022
4026
  `)) return !1;
4023
- const r = wn();
4027
+ const r = xn();
4024
4028
  r.font = `${t}px ${e}`;
4025
4029
  const o = r.measureText(i).width, a = n - s * 2;
4026
4030
  return o <= a;
4027
4031
  }
4028
- function ci(i, e, t, n, s) {
4032
+ function li(i, e, t, n, s) {
4029
4033
  if (!i || i.length === 0)
4030
4034
  return 60;
4031
- const r = wn();
4035
+ const r = xn();
4032
4036
  r.font = `${t}px ${e}`;
4033
4037
  const o = i.split(`
4034
4038
  `);
@@ -4038,8 +4042,8 @@ function ci(i, e, t, n, s) {
4038
4042
  const c = h.split(/\s+/);
4039
4043
  let d = 0;
4040
4044
  const u = r.measureText(" ").width, g = n - s * 2;
4041
- for (let p = 0; p < c.length; p++) {
4042
- const f = c[p], m = r.measureText(f).width;
4045
+ for (let f = 0; f < c.length; f++) {
4046
+ const p = c[f], m = r.measureText(p).width;
4043
4047
  d === 0 ? d = m : d + u + m <= g ? d += u + m : (a = Math.max(a, d), d = m);
4044
4048
  }
4045
4049
  a = Math.max(a, d);
@@ -4047,7 +4051,7 @@ function ci(i, e, t, n, s) {
4047
4051
  const l = a + s * 2 + 4;
4048
4052
  return Math.min(l, n);
4049
4053
  }
4050
- function li() {
4054
+ function hi() {
4051
4055
  const i = M("style");
4052
4056
  return i.textContent = `
4053
4057
  /* Comment Animation Styles */
@@ -4128,20 +4132,20 @@ function li() {
4128
4132
  }
4129
4133
  `, i;
4130
4134
  }
4131
- function hi(i, e, t) {
4132
- const n = { ...J, ...e.properties.style }, s = n.iconSize, {
4133
- iconColor: r = J.iconColor,
4134
- iconSymbol: o = J.iconSymbol,
4135
- iconBorderColor: a = J.iconBorderColor,
4136
- iconBorderWidth: l = J.iconBorderWidth
4135
+ function di(i, e, t) {
4136
+ const n = { ...V, ...e.properties.style }, s = n.iconSize, {
4137
+ iconColor: r = V.iconColor,
4138
+ iconSymbol: o = V.iconSymbol,
4139
+ iconBorderColor: a = V.iconBorderColor,
4140
+ iconBorderWidth: l = V.iconBorderWidth
4137
4141
  } = n;
4138
- let h = i.querySelector("circle");
4139
- h || (h = M("circle"), h.setAttribute("cx", "0"), h.setAttribute("cy", "0"), i.appendChild(h)), h.setAttribute("r", `${s / 2}`), t.hoveredFeature === e.id ? h.setAttribute("fill", Ft(r)) : h.setAttribute("fill", r), l && l > 0 ? (h.setAttribute("stroke", a || "#CCC"), h.setAttribute("stroke-width", `${l}`)) : (h.removeAttribute("stroke"), h.removeAttribute("stroke-width"));
4142
+ let h = i.querySelector("rect");
4143
+ h || (h = M("rect"), h.setAttribute("x", `${-s / 2}`), h.setAttribute("y", `${-s / 2}`), h.setAttribute("rx", `${n.borderRadius}`), h.setAttribute("ry", `${n.borderRadius}`), i.appendChild(h)), h.setAttribute("width", `${s}`), h.setAttribute("height", `${s}`), t.hoveredFeature === e.id ? h.setAttribute("fill", Ft(r)) : h.setAttribute("fill", r), l && l > 0 ? (h.setAttribute("stroke", a || "#CCC"), h.setAttribute("stroke-width", `${l}`)) : (h.removeAttribute("stroke"), h.removeAttribute("stroke-width"));
4140
4144
  let c = i.querySelector("text");
4141
4145
  c || (c = M("text"), c.setAttribute("x", "0"), c.setAttribute("y", "0"), c.setAttribute("text-anchor", "middle"), c.setAttribute("dominant-baseline", "central"), c.setAttribute("pointer-events", "none"), i.appendChild(c)), c.setAttribute("font-size", `${s * 0.5}`), c.textContent = o;
4142
4146
  }
4143
- function di(i, e, t, n = 0, s = !1) {
4144
- const r = { ...J, ...e.properties.style }, {
4147
+ function ui(i, e, t, n = 0, s = !1) {
4148
+ const r = { ...V, ...e.properties.style }, {
4145
4149
  font: o = "Arial, sans-serif",
4146
4150
  fontSize: a = 12,
4147
4151
  padding: l = 8,
@@ -4150,25 +4154,40 @@ function di(i, e, t, n = 0, s = !1) {
4150
4154
  borderRadius: d = 4,
4151
4155
  strokeColor: u = "#DDD",
4152
4156
  strokeWidth: g = 1,
4153
- maxHeight: p
4154
- } = r, f = e.properties.width, m = e.properties.content || "", x = typeof a == "number" ? a : parseFloat(a), b = ci(m, o, x, f, l), S = t.selectedFeatures.has(e.id) ? f : b + n, w = e.properties.height, A = xn(m, o, x, f, l), C = x * $t + l * 2, E = A ? Math.min(w, C) : w, k = p ? Math.min(E, p) : E, F = !A && p ? w > p : !1, z = k + (s ? 28 : 0);
4157
+ maxHeight: f
4158
+ } = r, p = e.properties.width, m = e.properties.content || "", w = typeof a == "number" ? a : parseFloat(a), b = li(
4159
+ m,
4160
+ o,
4161
+ w,
4162
+ p,
4163
+ l
4164
+ ), x = t.selectedFeatures.has(e.id) && r.expandOnSelect === !0 ? p : b + n, A = e.properties.height, C = bn(
4165
+ m,
4166
+ o,
4167
+ w,
4168
+ p,
4169
+ l
4170
+ ), E = w * $t + l * 2, k = C ? Math.min(A, E) : A, F = f ? Math.min(k, f) : k, O = !C && f ? A > f : !1, B = F + (s ? 28 : 0);
4155
4171
  i.innerHTML = "";
4156
- const R = -S / 2, et = -z / 2, Y = M("rect");
4157
- Y.setAttribute("x", `${R}`), Y.setAttribute("y", `${et}`), Y.setAttribute("width", `${S}`), Y.setAttribute("height", `${z}`), Y.setAttribute("rx", `${d}`), Y.setAttribute("ry", `${d}`), Y.setAttribute("fill", t.hoveredFeature === e.id ? Ft(h) : h), g && g > 0 && (Y.setAttribute("stroke", u || "#DDD"), Y.setAttribute("stroke-width", `${g}`)), i.appendChild(Y);
4158
- const G = M("foreignObject");
4159
- G.setAttribute("x", `${R}`), G.setAttribute("y", `${et}`), G.setAttribute("width", `${S}`), G.setAttribute("height", `${z}`), G.style.pointerEvents = "none";
4160
- const P = document.createElement("div");
4161
- P.style.width = "100%", P.style.height = "100%", P.style.padding = `${l}px`, P.style.boxSizing = "border-box", P.style.fontFamily = o, P.style.fontSize = `${a}px`, P.style.lineHeight = `${(typeof a == "number" ? a : parseFloat(a)) * $t}px`, P.style.color = c, P.style.overflowY = F ? "auto" : "hidden", P.style.overflowX = "hidden", P.style.overflowWrap = "break-word", P.style.whiteSpace = "pre-wrap", P.style.pointerEvents = "none", P.style.display = "flex", P.style.flexDirection = "column", P.style.position = "relative";
4162
- const st = document.createElement("div");
4163
- if (st.style.flex = "1", st.style.minHeight = "0", st.style.overflowY = F ? "auto" : "hidden", st.innerHTML = ui(m), P.appendChild(st), s) {
4164
- const L = document.createElement("div");
4165
- L.classList.add("ogma-send-button"), L.style.pointerEvents = "auto";
4166
- const B = document.createElement("span");
4167
- B.classList.add("ogma-send-button-icon"), B.innerHTML = t.options.editButtonIcon, L.appendChild(B), P.appendChild(L);
4168
- }
4169
- G.appendChild(P), i.appendChild(G), i.setAttribute("filter", "url(#softShadow)");
4170
- }
4171
- function ui(i) {
4172
+ const et = -x / 2, nt = -B / 2, U = M("rect");
4173
+ U.setAttribute("x", `${et}`), U.setAttribute("y", `${nt}`), U.setAttribute("width", `${x}`), U.setAttribute("height", `${B}`), U.setAttribute("rx", `${d}`), U.setAttribute("ry", `${d}`), U.setAttribute(
4174
+ "fill",
4175
+ t.hoveredFeature === e.id ? Ft(h) : h
4176
+ ), g && g > 0 && (U.setAttribute("stroke", u || "#DDD"), U.setAttribute("stroke-width", `${g}`)), i.appendChild(U);
4177
+ const j = M("foreignObject");
4178
+ j.setAttribute("x", `${et}`), j.setAttribute("y", `${nt}`), j.setAttribute("width", `${x}`), j.setAttribute("height", `${B}`), j.style.pointerEvents = "none";
4179
+ const L = document.createElement("div");
4180
+ L.style.width = "100%", L.style.height = "100%", L.style.padding = `${l}px`, L.style.boxSizing = "border-box", L.style.fontFamily = o, L.style.fontSize = `${a}px`, L.style.lineHeight = `${(typeof a == "number" ? a : parseFloat(a)) * $t}px`, L.style.color = c, L.style.overflowY = O ? "auto" : "hidden", L.style.overflowX = "hidden", L.style.overflowWrap = "break-word", L.style.whiteSpace = "pre-wrap", L.style.pointerEvents = "none", L.style.display = "flex", L.style.flexDirection = "column", L.style.position = "relative";
4181
+ const D = document.createElement("div");
4182
+ if (D.style.flex = "1", D.style.minHeight = "0", D.style.overflowY = O ? "auto" : "hidden", D.innerHTML = gi(m), L.appendChild(D), s) {
4183
+ const z = document.createElement("div");
4184
+ z.classList.add("ogma-send-button"), z.style.pointerEvents = "auto";
4185
+ const Wt = document.createElement("span");
4186
+ Wt.classList.add("ogma-send-button-icon"), Wt.innerHTML = t.options.editButtonIcon, z.appendChild(Wt), L.appendChild(z);
4187
+ }
4188
+ j.appendChild(L), i.appendChild(j), r.shadow !== !1 ? i.setAttribute("filter", "url(#softShadow)") : i.removeAttribute("filter");
4189
+ }
4190
+ function gi(i) {
4172
4191
  if (!i) return "";
4173
4192
  let e = i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4174
4193
  return e = e.replace(
@@ -4176,7 +4195,7 @@ function ui(i) {
4176
4195
  '<a href="$1" target="_blank" style="color: #38e; text-decoration: none;">$1</a>'
4177
4196
  ), e;
4178
4197
  }
4179
- function gi(i, e, t, n, s) {
4198
+ function fi(i, e, t, n, s) {
4180
4199
  const r = e.properties.mode;
4181
4200
  let o = t;
4182
4201
  o || (o = M("g"), o.setAttribute("data-annotation", `${e.id}`), o.setAttribute("data-annotation-type", "comment"));
@@ -4187,30 +4206,36 @@ function gi(i, e, t, n, s) {
4187
4206
  const h = r !== at && n.selectedFeatures.has(e.id) && n.editingFeature !== e.id && n.options.showEditButton;
4188
4207
  let c = 0;
4189
4208
  if (h) {
4190
- const u = { ...J, ...e.properties.style }, g = e.properties.content || "", p = typeof u.fontSize == "number" ? u.fontSize : parseFloat((u.fontSize || "12").toString());
4191
- xn(g, u.font || "Arial, sans-serif", p, e.properties.width, u.padding || 8) && (c = 32);
4192
- }
4193
- hi(a, e, n), di(l, e, n, c, h), s ? o.classList.remove("comment-no-transition") : o.classList.add("comment-no-transition"), r === at ? (o.classList.add("comment-collapsed"), o.classList.remove("comment-expanded")) : (o.classList.add("comment-expanded"), o.classList.remove("comment-collapsed"));
4209
+ const u = { ...V, ...e.properties.style }, g = e.properties.content || "", f = typeof u.fontSize == "number" ? u.fontSize : parseFloat((u.fontSize || "12").toString());
4210
+ bn(
4211
+ g,
4212
+ u.font || "Arial, sans-serif",
4213
+ f,
4214
+ e.properties.width,
4215
+ u.padding || 8
4216
+ ) && (c = 32);
4217
+ }
4218
+ di(a, e, n), ui(l, e, n, c, h), s ? o.classList.remove("comment-no-transition") : o.classList.add("comment-no-transition"), r === at ? (o.classList.add("comment-collapsed"), o.classList.remove("comment-expanded")) : (o.classList.add("comment-expanded"), o.classList.remove("comment-collapsed"));
4194
4219
  const d = Q(e);
4195
4220
  return o.setAttribute(
4196
4221
  "transform",
4197
4222
  n.getScreenAlignedTransform(d.x, d.y, !1)
4198
4223
  ), o.style.visibility = n.editingFeature === e.id ? "hidden" : "", (!o.parentNode || o.parentNode !== i) && i.appendChild(o), o;
4199
4224
  }
4200
- function fi(i, e = 0.5, t = !1) {
4225
+ function pi(i, e = 0.5, t = !1) {
4201
4226
  if (i.length < 2) return "";
4202
4227
  if (i.length < 3)
4203
4228
  return i.map((o, a) => `${a === 0 ? "M" : "L"}${o[0]},${o[1]}`).join(" ") + " Z";
4204
4229
  const n = i, s = n.length - 1, r = [];
4205
4230
  for (let o = 0; o < s; o++) {
4206
- const a = n[(o - 1 + s) % s], l = n[o], h = n[(o + 1) % s], c = n[(o + 2) % s], d = l[0] + (h[0] - a[0]) / 6 * e, u = l[1] + (h[1] - a[1]) / 6 * e, g = h[0] - (c[0] - l[0]) / 6 * e, p = h[1] - (c[1] - l[1]) / 6 * e;
4207
- o === 0 && r.push(`M${l[0]},${l[1]}`), t && o === s - 1 ? r.push(`L${h[0]},${h[1]}`) : r.push(`C${d},${u} ${g},${p} ${h[0]},${h[1]}`);
4231
+ const a = n[(o - 1 + s) % s], l = n[o], h = n[(o + 1) % s], c = n[(o + 2) % s], d = l[0] + (h[0] - a[0]) / 6 * e, u = l[1] + (h[1] - a[1]) / 6 * e, g = h[0] - (c[0] - l[0]) / 6 * e, f = h[1] - (c[1] - l[1]) / 6 * e;
4232
+ o === 0 && r.push(`M${l[0]},${l[1]}`), t && o === s - 1 ? r.push(`L${h[0]},${h[1]}`) : r.push(`C${d},${u} ${g},${f} ${h[0]},${h[1]}`);
4208
4233
  }
4209
4234
  return r.push("Z"), r.join(" ");
4210
4235
  }
4211
- const pi = (i, e, t = "box") => (i || (i = M("g"), i.setAttribute("data-annotation", `${e}`), i.classList.add(`annotation-${t}`)), i);
4212
- function mi(i, e, t, n) {
4213
- const s = pi(
4236
+ const mi = (i, e, t = "box") => (i || (i = M("g"), i.setAttribute("data-annotation", `${e}`), i.classList.add(`annotation-${t}`)), i);
4237
+ function yi(i, e, t, n) {
4238
+ const s = mi(
4214
4239
  t,
4215
4240
  e.id.toString(),
4216
4241
  e.properties.type
@@ -4225,14 +4250,14 @@ function mi(i, e, t, n) {
4225
4250
  strokeType: h = lt.strokeType
4226
4251
  } = e.properties.style || lt;
4227
4252
  o && r.setAttribute("stroke", o), a !== void 0 && r.setAttribute("stroke-width", String(a)), l && (n.hoveredFeature === e.id ? r.setAttribute("fill", Ft(l)) : r.setAttribute("fill", l)), h === "dashed" ? r.setAttribute("stroke-dasharray", "5,5") : r.removeAttribute("stroke-dasharray");
4228
- const c = e.geometry.coordinates[0], d = fi(
4253
+ const c = e.geometry.coordinates[0], d = pi(
4229
4254
  c,
4230
4255
  0.5,
4231
4256
  n.drawingFeature === e.id
4232
4257
  );
4233
4258
  return r.setAttribute("d", d), s.setAttribute("transform", n.getRotationTransform(0, 0)), i.appendChild(s), s;
4234
4259
  }
4235
- const yi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, wi = /\bsmall-caps\b/, xi = /\b(?:italic|oblique)\b/, bi = /\bbold(?:er)?\b/, bn = 16, He = 13.3333333, vi = 0.01 * bn, Si = {
4260
+ const wi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, xi = /\bsmall-caps\b/, bi = /\b(?:italic|oblique)\b/, vi = /\bbold(?:er)?\b/, vn = 16, _e = 13.3333333, Si = 0.01 * vn, Ai = {
4236
4261
  "xx-small": 9,
4237
4262
  "x-small": 10,
4238
4263
  smaller: 13.3333,
@@ -4242,35 +4267,35 @@ const yi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|med
4242
4267
  larger: 19.2,
4243
4268
  "x-large": 24,
4244
4269
  "xx-large": 32
4245
- }, Qt = /* @__PURE__ */ new Map();
4246
- function Ai(i) {
4247
- if (Qt.has(i))
4248
- return Qt.get(i);
4249
- const e = yi.exec(i);
4270
+ }, te = /* @__PURE__ */ new Map();
4271
+ function Ei(i) {
4272
+ if (te.has(i))
4273
+ return te.get(i);
4274
+ const e = wi.exec(i);
4250
4275
  if (!e)
4251
4276
  return;
4252
4277
  const t = {};
4253
4278
  t.family = (e[6] || "").trim();
4254
- let n = Si[e[2]] || parseFloat(e[2]);
4255
- if (e[3] === "%" ? n *= vi : e[3] === "em" ? n *= bn : e[3] === "pt" && (n *= He), t.size = n, e[4] === "normal" || e[4] === "inherit" || !e[4] ? t.height = Math.round(n * (7 / 6)) : !e[5] || e[5] === "em" ? t.height = parseFloat(e[4] || "") * n : e[5] === "pt" ? t.height = parseFloat(e[4] || "") * He : e[5] === "%" ? t.height = n * 0.01 : t.height = parseFloat(e[4] || ""), t.variant = wi.test(e[1]) ? "small-caps" : "normal", t.style = xi.test(e[1]) ? "italic" : "normal", bi.test(e[1]))
4279
+ let n = Ai[e[2]] || parseFloat(e[2]);
4280
+ if (e[3] === "%" ? n *= Si : e[3] === "em" ? n *= vn : e[3] === "pt" && (n *= _e), t.size = n, e[4] === "normal" || e[4] === "inherit" || !e[4] ? t.height = Math.round(n * (7 / 6)) : !e[5] || e[5] === "em" ? t.height = parseFloat(e[4] || "") * n : e[5] === "pt" ? t.height = parseFloat(e[4] || "") * _e : e[5] === "%" ? t.height = n * 0.01 : t.height = parseFloat(e[4] || ""), t.variant = xi.test(e[1]) ? "small-caps" : "normal", t.style = bi.test(e[1]) ? "italic" : "normal", vi.test(e[1]))
4256
4281
  t.weight = 700;
4257
4282
  else {
4258
4283
  const s = /\b(\d+)\b/.exec(e[1]), r = s ? parseInt(s[1], 10) : 400;
4259
4284
  r >= 100 && r !== 400 ? t.weight = r : t.weight = 400;
4260
4285
  }
4261
- return Qt.set(i, t), t;
4286
+ return te.set(i, t), t;
4262
4287
  }
4263
- const Ei = "12px/14px sans-serif";
4264
- class V {
4288
+ const Ci = "12px/14px sans-serif";
4289
+ class Z {
4265
4290
  /**
4266
4291
  * @param {string | Font} [input]
4267
4292
  */
4268
- constructor(e = Ei) {
4293
+ constructor(e = Ci) {
4269
4294
  let t, n = 14, s = 12, r = 400, o = "normal", a = "normal", l = 0, h;
4270
4295
  if (typeof e == "string") {
4271
- const c = Ai(e);
4296
+ const c = Ei(e);
4272
4297
  c && (t = c.family, s = c.size, n = c.height || 14, a = c.variant, o = c.style, r = c.weight);
4273
- } else e instanceof V && (t = e.family, s = e.size, n = e.height, a = e.variant, r = e.weight, o = e.style, l = e.baseline, h = e.color);
4298
+ } else e instanceof Z && (t = e.family, s = e.size, n = e.height, a = e.variant, r = e.weight, o = e.style, l = e.baseline, h = e.color);
4274
4299
  this.family = t || "sans-serif", this.size = s || s === 0 ? s : 12, this.height = n || n === 0 ? n : this.size * (7 / 6), this.variant = a || "", this.style = o || "", this.weight = r || 400, this.baseline = l || 0, this.color = h || "";
4275
4300
  }
4276
4301
  /**
@@ -4288,7 +4313,7 @@ class V {
4288
4313
  * @return {Font}
4289
4314
  */
4290
4315
  assign(e = {}) {
4291
- const t = new V(this);
4316
+ const t = new Z(this);
4292
4317
  return e.bold && (t.weight = 700), e.weight && (t.weight = e.weight), e.italic && (t.style = "italic"), e.family && (t.family = e.family), e.style && (t.style = e.style), e.color && (t.color = e.color), typeof e.baseline == "number" && (t.baseline = e.baseline), typeof e.size == "number" && (t.size = e.size), t;
4293
4318
  }
4294
4319
  toString(e) {
@@ -4299,7 +4324,7 @@ class V {
4299
4324
  return this.toString(!0);
4300
4325
  }
4301
4326
  }
4302
- const vn = {
4327
+ const Sn = {
4303
4328
  "\n": 0.28,
4304
4329
  //
4305
4330
  "\r": 0.28,
@@ -4344,46 +4369,46 @@ const vn = {
4344
4369
  // IDEOGRAPHIC SPACE
4345
4370
  "\uFEFF": 0
4346
4371
  // ZERO WIDTH NO-BREAK SPACE
4347
- }, Ci = new V(), _e = {
4372
+ }, ki = new Z(), Ie = {
4348
4373
  trim: !0,
4349
4374
  collapse: !0
4350
- }, te = {};
4351
- function ce() {
4375
+ }, ee = {};
4376
+ function le() {
4352
4377
  return (i, e) => {
4353
- const t = new V(e);
4378
+ const t = new Z(e);
4354
4379
  let n = t.size;
4355
4380
  return /\bmonospace\b/.test(t.family) ? n *= 0.6 : (n *= 0.45, t.weight > 400 && (n *= 1.18)), i.length * n;
4356
4381
  };
4357
4382
  }
4358
- function le(i) {
4383
+ function he(i) {
4359
4384
  if (i && i.getContext) {
4360
4385
  const e = i.getContext("2d");
4361
4386
  if (e && typeof e.measureText == "function")
4362
4387
  return (t, n) => (e.font = String(n), e.measureText(t).width);
4363
4388
  }
4364
4389
  }
4365
- function Sn() {
4390
+ function An() {
4366
4391
  const i = typeof document < "u" ? document : null;
4367
4392
  return typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || i && i.createElement && i.createElement("canvas") || null;
4368
4393
  }
4369
- let At = le(Sn()) || ce();
4370
- function ki(i) {
4394
+ let At = he(An()) || le();
4395
+ function Mi(i) {
4371
4396
  if (i == null)
4372
- At = le(Sn()) || ce();
4397
+ At = he(An()) || le();
4373
4398
  else if (i)
4374
- At = le(i) || ce();
4399
+ At = he(i) || le();
4375
4400
  else
4376
4401
  throw new Error("setMeasureCanvas argument is not a canvas or null");
4377
4402
  }
4378
- function ct(i, e, t = _e) {
4379
- typeof e == "string" ? e = new V(e) : e instanceof V ? e = Ci.assign(e) : e = new V().assign(e);
4380
- const n = Object.assign({}, _e, t);
4403
+ function ct(i, e, t = Ie) {
4404
+ typeof e == "string" ? e = new Z(e) : e instanceof Z ? e = ki.assign(e) : e = new Z().assign(e);
4405
+ const n = Object.assign({}, Ie, t);
4381
4406
  let s = String(i);
4382
4407
  if (!s)
4383
4408
  return 0;
4384
- if (s in vn) {
4409
+ if (s in Sn) {
4385
4410
  const o = e.valueOf() + "/" + s;
4386
- return o in te || (te[o] = At(`_${s}_`, e) - At("__", e)), te[o];
4411
+ return o in ee || (ee[o] = At(`_${s}_`, e) - At("__", e)), ee[o];
4387
4412
  }
4388
4413
  !n.trim || !n.collapse ? s = s.replace(/\n/g, " ") : n.trim ? s = s.replace(/\n/g, " ").trim() : n.collapse && (s = s.replace(/\s+/g, " "));
4389
4414
  const r = typeof i == "string" ? 0 : i.tracking || 0;
@@ -4406,23 +4431,23 @@ class H {
4406
4431
  }
4407
4432
  class Tt extends H {
4408
4433
  }
4409
- class Z extends H {
4434
+ class K extends H {
4410
4435
  }
4411
4436
  class ht extends H {
4412
4437
  }
4413
- const Mi = /[\r\n\xA0]+/g, Ie = 0.7;
4414
- function Ti(i, e) {
4415
- i.sup && (i.baseline = 0.45, i.size = Ie), i.sub && (i.baseline = -0.3, i.size = Ie);
4438
+ const Ti = /[\r\n\xA0]+/g, ze = 0.7;
4439
+ function Fi(i, e) {
4440
+ i.sup && (i.baseline = 0.45, i.size = ze), i.sub && (i.baseline = -0.3, i.size = ze);
4416
4441
  let t = e;
4417
4442
  return (i.style || i.weight || i.baseline || i.color || i.size || i.family) && (t = e.assign(i)), t;
4418
4443
  }
4419
- function ze(i, e, t) {
4444
+ function Be(i, e, t) {
4420
4445
  let n = i.width, s, r;
4421
4446
  for (; n + t.width > e && i.length; )
4422
4447
  s = i[i.length - 1], r = s.width, s.width > t.width ? (s.value = s.value.slice(0, -1), s.width = ct(s, s.font), n += s.width) : i.pop(), n -= r;
4423
4448
  i[i.length - 1] instanceof ht && i.pop(), s = i[i.length - 1] || s || {}, t.font = t.font.assign(s), t.href = i.length ? s.href : null, t.rel = i.length ? s.rel : null, t.target = i.length ? s.target : null, i.push(t);
4424
4449
  }
4425
- function Be(i) {
4450
+ function Re(i) {
4426
4451
  return Object.assign([], {
4427
4452
  height: 0,
4428
4453
  font: i,
@@ -4431,26 +4456,26 @@ function Be(i) {
4431
4456
  hasLineOverflow: !1
4432
4457
  });
4433
4458
  }
4434
- function Fi(i, e, t) {
4459
+ function Pi(i, e, t) {
4435
4460
  if (!i.length)
4436
- return Be(t);
4461
+ return Re(t);
4437
4462
  const n = e.height(), s = e.width(), r = e.overflowLine(), o = e.overflowWrap(), a = t.assign({ bold: !0 }), l = isFinite(n()) ? Math.floor(n() / t.height) : 1 / 0;
4438
4463
  if (!n() && !s(0) || !l)
4439
- return Be(t);
4464
+ return Re(t);
4440
4465
  let h = 0, c = 0, d = 0;
4441
4466
  const u = [];
4442
- let g = [], p = !1;
4467
+ let g = [], f = !1;
4443
4468
  for (; h < i.length && c < l; ) {
4444
- const w = i[h], A = Ti(w, t);
4445
- if (w.width = ct(w, A), w.font = A, w.line = c, w.whitespace = w.value in vn, w.value && (w.value = w.value.replace(Mi, " ")), !(!d && w.whitespace || p && w.whitespace)) if (w instanceof Z)
4469
+ const x = i[h], A = Fi(x, t);
4470
+ if (x.width = ct(x, A), x.font = A, x.line = c, x.whitespace = x.value in Sn, x.value && (x.value = x.value.replace(Ti, " ")), !(!d && x.whitespace || f && x.whitespace)) if (x instanceof K)
4446
4471
  d = 0, g = [], u.push(h + 1), c++;
4447
- else if (w instanceof Tt || w instanceof ht)
4472
+ else if (x instanceof Tt || x instanceof ht)
4448
4473
  g.push({
4449
4474
  index: h,
4450
4475
  width: d
4451
4476
  });
4452
- else if (w.whitespace || d + w.width < s(c))
4453
- d += w.width;
4477
+ else if (x.whitespace || d + x.width < s(c))
4478
+ d += x.width;
4454
4479
  else if (g.length) {
4455
4480
  let C, E;
4456
4481
  do {
@@ -4466,54 +4491,54 @@ function Fi(i, e, t) {
4466
4491
  u.push(C.index + 1), d = 0, c++, h = C.index, g = [];
4467
4492
  } else if (o === "break-word") {
4468
4493
  const C = s(c);
4469
- if (d + w.width > C) {
4470
- const E = w.clone();
4494
+ if (d + x.width > C) {
4495
+ const E = x.clone();
4471
4496
  do
4472
- w.value = w.value.slice(0, -1), w.width = ct(w, w.font || t), d += w.width;
4473
- while (w.value && w.width > C);
4474
- E.value = E.value.slice(w.value.length), i.splice(h + 1, 0, new Tt(), E);
4497
+ x.value = x.value.slice(0, -1), x.width = ct(x, x.font || t), d += x.width;
4498
+ while (x.value && x.width > C);
4499
+ E.value = E.value.slice(x.value.length), i.splice(h + 1, 0, new Tt(), E);
4475
4500
  }
4476
4501
  u.push(h + 1), d = 0, c++;
4477
4502
  } else
4478
- d += w.width;
4479
- h++, p = w.whitespace;
4503
+ d += x.width;
4504
+ h++, f = x.whitespace;
4480
4505
  }
4481
4506
  h !== u[u.length - 1] && u.push(h);
4482
- let f = 0, m = 0;
4483
- const x = u.map((w) => {
4484
- let A = f, C;
4507
+ let p = 0, m = 0;
4508
+ const w = u.map((x) => {
4509
+ let A = p, C;
4485
4510
  for (; (C = i[A]) && (C.whitespace || !C.value); )
4486
4511
  A++;
4487
- let E = w, k = null;
4512
+ let E = x, k = null;
4488
4513
  for (; E > A && (C = i[E - 1]) && (C.whitespace || !(C.value || C instanceof ht)); )
4489
- C instanceof Z && (k = C), E--;
4490
- C instanceof ht && (C.value = "-", C.width = ct("-", C.font || t)), f = w;
4514
+ C instanceof K && (k = C), E--;
4515
+ C instanceof ht && (C.value = "-", C.width = ct("-", C.font || t)), p = x;
4491
4516
  const F = Object.assign(
4492
- i.slice(A, E).filter((j) => j.value),
4517
+ i.slice(A, E).filter((O) => O.value),
4493
4518
  { width: 0 }
4494
4519
  );
4495
- return k && F.push(k), F.width = F.reduce((j, z) => j + z.width, 0), F.width > m && (m = F.width), F;
4520
+ return k && F.push(k), F.width = F.reduce((O, N) => O + N.width, 0), F.width > m && (m = F.width), F;
4496
4521
  });
4497
4522
  let b = !1;
4498
4523
  if (r) {
4499
- const w = r === "ellipsis" ? "…" : r;
4500
- x.forEach((A, C) => {
4524
+ const x = r === "ellipsis" ? "…" : r;
4525
+ w.forEach((A, C) => {
4501
4526
  const E = s(C);
4502
4527
  if (A.width > E) {
4503
- const k = new H(w);
4504
- k.font = t, k.width = ct(w, a), ze(A, E, k), b = !0;
4528
+ const k = new H(x);
4529
+ k.font = t, k.width = ct(x, a), Be(A, E, k), b = !0;
4505
4530
  }
4506
4531
  });
4507
4532
  }
4508
4533
  let v = !1;
4509
4534
  const S = e.overflow() === "ellipsis" ? "…" : e.overflow();
4510
4535
  if (S && h !== i.length) {
4511
- const w = s(x.length - 1), A = x[x.length - 1], C = new H(S);
4512
- C.font = t, C.width = ct(S, a), ze(A, w, C), v = !0;
4536
+ const x = s(w.length - 1), A = w[w.length - 1], C = new H(S);
4537
+ C.font = t, C.width = ct(S, a), Be(A, x, C), v = !0;
4513
4538
  } else
4514
4539
  v = !1;
4515
- return Object.assign(x, {
4516
- height: x.length * t.height,
4540
+ return Object.assign(w, {
4541
+ height: w.length * t.height,
4517
4542
  font: t,
4518
4543
  width: m,
4519
4544
  hasOverflow: v,
@@ -4523,80 +4548,80 @@ function Fi(i, e, t) {
4523
4548
  function ft(i) {
4524
4549
  return Math.round(i * 1e6) / 1e6;
4525
4550
  }
4526
- const Pi = {
4551
+ const Di = {
4527
4552
  center: "middle",
4528
4553
  right: "end"
4529
- }, Di = {
4554
+ }, Li = {
4530
4555
  middle: 0.5,
4531
4556
  center: 0.5,
4532
4557
  bottom: 1,
4533
4558
  end: 1
4534
- }, ee = (i, e) => !i && !e || i === e;
4535
- function Li(i, e) {
4559
+ }, ne = (i, e) => !i && !e || i === e;
4560
+ function Hi(i, e) {
4536
4561
  const t = [], n = e.font(), s = n.size, r = n.family, o = e.align(), a = e.createElement();
4537
4562
  if (i.length) {
4538
- const l = n.height, h = e.valign(), c = e.height()(), d = e.width()(0), u = !isFinite(d) && i.length === 1, g = u ? null : e.x(), p = ft(l / s);
4539
- let f = u ? null : ft(l / (s * 1.15 + (l - s) / 2));
4540
- if (Di[h] && isFinite(c)) {
4563
+ const l = n.height, h = e.valign(), c = e.height()(), d = e.width()(0), u = !isFinite(d) && i.length === 1, g = u ? null : e.x(), f = ft(l / s);
4564
+ let p = u ? null : ft(l / (s * 1.15 + (l - s) / 2));
4565
+ if (Li[h] && isFinite(c)) {
4541
4566
  const E = h === "bottom" ? 1 : 0.5;
4542
- f = (f || 0) + (c * E - l * i.length * E) / s;
4567
+ p = (p || 0) + (c * E - l * i.length * E) / s;
4543
4568
  }
4544
- const x = o === "justify";
4569
+ const w = o === "justify";
4545
4570
  let b = 0;
4546
4571
  o === "right" ? b = d : o === "center" && (b = d / 2);
4547
- let v = [], S = "tspan", w = null, A = "";
4572
+ let v = [], S = "tspan", x = null, A = "";
4548
4573
  const C = () => {
4549
4574
  if (A) {
4550
- const E = a(S, w, A);
4575
+ const E = a(S, x, A);
4551
4576
  v.push(E);
4552
4577
  }
4553
- S = "tspan", w = null, A = "";
4578
+ S = "tspan", x = null, A = "";
4554
4579
  };
4555
4580
  for (let E = 0, k = i.length; E < k; E++) {
4556
- let F = "", j = "", z = 0;
4557
- const R = i[E];
4558
- if (!R.length) {
4581
+ let F = "", O = "", N = 0;
4582
+ const B = i[E];
4583
+ if (!B.length) {
4559
4584
  t.push(
4560
4585
  a("tspan", {
4561
4586
  x: g(E),
4562
- dy: ft(E ? p : f) + "em"
4587
+ dy: ft(E ? f : p) + "em"
4563
4588
  }, " ")
4564
4589
  );
4565
4590
  continue;
4566
4591
  }
4567
4592
  v = [];
4568
- let et = 0, Y = 0, G;
4569
- for (let P = 0, st = R.length; P < st; P++) {
4570
- const L = R[P], B = L.font;
4571
- L.whitespace && et++, Y += L.width, P && !L.tracking && !z && ee(B.id, F) && ee(L.class, j) && ee(G, L.href) ? A += L.value : (C(), A = L.value, w = {
4572
- fontFamily: B.family !== r ? B.family : null,
4573
- fontSize: B.size !== s ? B.size : null,
4574
- fontWeight: B.weight !== 400 && B.weight || null,
4575
- fontStyle: B.style !== "normal" && B.style || null,
4576
- fontVariant: B.variant !== "normal" && B.variant || null,
4577
- fill: B.color || null,
4578
- baselineShift: B.baseline ? B.baseline * 100 + "%" : null,
4579
- className: L.class || null,
4593
+ let et = 0, nt = 0, U;
4594
+ for (let j = 0, L = B.length; j < L; j++) {
4595
+ const D = B[j], z = D.font;
4596
+ D.whitespace && et++, nt += D.width, j && !D.tracking && !N && ne(z.id, F) && ne(D.class, O) && ne(U, D.href) ? A += D.value : (C(), A = D.value, x = {
4597
+ fontFamily: z.family !== r ? z.family : null,
4598
+ fontSize: z.size !== s ? z.size : null,
4599
+ fontWeight: z.weight !== 400 && z.weight || null,
4600
+ fontStyle: z.style !== "normal" && z.style || null,
4601
+ fontVariant: z.variant !== "normal" && z.variant || null,
4602
+ fill: z.color || null,
4603
+ baselineShift: z.baseline ? z.baseline * 100 + "%" : null,
4604
+ className: D.class || null,
4580
4605
  dx: 0,
4581
4606
  href: null,
4582
4607
  rel: null,
4583
4608
  target: null
4584
- }, z && (w.dx = ft(z), z = 0), L.tracking && (z = B.size * L.tracking), L.href && !G ? (G = L.href, S = "a", w.href = G, w.rel = L.rel, w.target = L.target) : G = null, F = B.id, j = L.class);
4609
+ }, N && (x.dx = ft(N), N = 0), D.tracking && (N = z.size * D.tracking), D.href && !U ? (U = D.href, S = "a", x.href = U, x.rel = D.rel, x.target = D.target) : U = null, F = z.id, O = D.class);
4585
4610
  }
4586
4611
  if (C(), u)
4587
4612
  t.push(...v);
4588
4613
  else {
4589
- let P = null;
4590
- const st = E === k - 1 || R[R.length - 1] instanceof Z;
4591
- if (x && R.length > 1 && !st) {
4592
- const L = d - Y;
4593
- P = ft(L / et);
4614
+ let j = null;
4615
+ const L = E === k - 1 || B[B.length - 1] instanceof K;
4616
+ if (w && B.length > 1 && !L) {
4617
+ const D = d - nt;
4618
+ j = ft(D / et);
4594
4619
  }
4595
4620
  t.push(
4596
4621
  a("tspan", {
4597
- wordSpacing: P,
4622
+ wordSpacing: j,
4598
4623
  x: g(E) + b,
4599
- dy: ft(E ? p : f) + "em"
4624
+ dy: ft(E ? f : p) + "em"
4600
4625
  }, ...v)
4601
4626
  );
4602
4627
  }
@@ -4605,53 +4630,53 @@ function Li(i, e) {
4605
4630
  return a("text", {
4606
4631
  fontFamily: r,
4607
4632
  fontSize: s,
4608
- textAnchor: Pi[o] || "start"
4633
+ textAnchor: Di[o] || "start"
4609
4634
  }, ...t);
4610
4635
  }
4611
- const Hi = {
4636
+ const _i = {
4612
4637
  middle: 0.5,
4613
4638
  center: 0.5,
4614
4639
  bottom: 1,
4615
4640
  end: 1
4616
4641
  };
4617
- function _i(i, e) {
4642
+ function Ii(i, e) {
4618
4643
  return i.color ? i.color : e.href ? "#00C" : "#000";
4619
4644
  }
4620
- function Ii(i, e, t) {
4645
+ function zi(i, e, t) {
4621
4646
  if (!i.length)
4622
4647
  return;
4623
4648
  t.textBaseline = "middle";
4624
4649
  const n = e.font(), s = n.height, r = n.size, o = e.valign(), a = e.height()(), l = e.width()(0), h = e.align(), c = h === "justify";
4625
4650
  let d = s * 0.5;
4626
- const u = Hi[o];
4651
+ const u = _i[o];
4627
4652
  if (u && isFinite(a)) {
4628
4653
  const g = i.length * s;
4629
4654
  d += a * u - g * u;
4630
4655
  }
4631
- i.forEach((g, p) => {
4632
- let f = e.x()(p);
4633
- const m = p * s + d;
4634
- let x = 0, b = 0;
4635
- g.forEach((w) => {
4636
- w.whitespace && x++, b += w.width;
4656
+ i.forEach((g, f) => {
4657
+ let p = e.x()(f);
4658
+ const m = f * s + d;
4659
+ let w = 0, b = 0;
4660
+ g.forEach((x) => {
4661
+ x.whitespace && w++, b += x.width;
4637
4662
  });
4638
4663
  let v = 0;
4639
- const S = p === i.length - 1 || g[g.length - 1] instanceof Z;
4640
- c && g.length > 1 && !S && (v = (l - b) / x), g.forEach((w) => {
4641
- t.font = w.font;
4642
- const A = w.font, C = A.baseline ? r * -A.baseline + r * 0.15 : 0;
4643
- t.fillStyle = _i(A, w);
4664
+ const S = f === i.length - 1 || g[g.length - 1] instanceof K;
4665
+ c && g.length > 1 && !S && (v = (l - b) / w), g.forEach((x) => {
4666
+ t.font = x.font;
4667
+ const A = x.font, C = A.baseline ? r * -A.baseline + r * 0.15 : 0;
4668
+ t.fillStyle = Ii(A, x);
4644
4669
  let E = 0;
4645
- if (h === "right" ? E += l - b : h === "center" ? E += l / 2 - b / 2 : h === "justify" && (w.whitespace || w instanceof Z) && (f += v), t.fillText(w.value, f + E, m + C), w.href) {
4670
+ if (h === "right" ? E += l - b : h === "center" ? E += l / 2 - b / 2 : h === "justify" && (x.whitespace || x instanceof K) && (p += v), t.fillText(x.value, p + E, m + C), x.href) {
4646
4671
  t.beginPath(), t.strokeStyle = t.fillStyle;
4647
4672
  const k = Math.floor(m + r * 0.45) + 0.5;
4648
- t.moveTo(f + E, k), t.lineTo(f + E + w.width, k), t.stroke();
4673
+ t.moveTo(p + E, k), t.lineTo(p + E + x.width, k), t.stroke();
4649
4674
  }
4650
- f += w.width;
4675
+ p += x.width;
4651
4676
  });
4652
4677
  });
4653
4678
  }
4654
- function An(i) {
4679
+ function En(i) {
4655
4680
  const e = {
4656
4681
  /* text, ctx, d3, fn */
4657
4682
  };
@@ -4661,37 +4686,37 @@ function An(i) {
4661
4686
  }
4662
4687
  return e;
4663
4688
  }
4664
- const zi = Object.prototype.hasOwnProperty, ne = {};
4665
- function Bi(i) {
4666
- return ne[i] || (ne[i] = i.replace(/([a-z])([A-Z])/g, (e, t, n) => t + "-" + n.toLowerCase())), ne[i];
4689
+ const Bi = Object.prototype.hasOwnProperty, se = {};
4690
+ function Ri(i) {
4691
+ return se[i] || (se[i] = i.replace(/([a-z])([A-Z])/g, (e, t, n) => t + "-" + n.toLowerCase())), se[i];
4667
4692
  }
4668
- function En(i, e) {
4693
+ function Cn(i, e) {
4669
4694
  if (Array.isArray(e))
4670
- return e.forEach((t) => En(i, t));
4695
+ return e.forEach((t) => Cn(i, t));
4671
4696
  typeof e == "string" && (e = document.createTextNode(e)), i.appendChild(e);
4672
4697
  }
4673
- function Cn(i, e, ...t) {
4698
+ function kn(i, e, ...t) {
4674
4699
  if (typeof document > "u")
4675
4700
  throw new Error("No document found, cannot create elements");
4676
4701
  const n = typeof i == "string" ? document.createElementNS("http://www.w3.org/2000/svg", i) : i;
4677
4702
  if (e && n.setAttribute)
4678
4703
  for (const s in e)
4679
- zi.call(e, s) && e[s] != null && n.setAttribute(
4680
- s === "className" ? "class" : Bi(s),
4704
+ Bi.call(e, s) && e[s] != null && n.setAttribute(
4705
+ s === "className" ? "class" : Ri(s),
4681
4706
  String(e[s])
4682
4707
  );
4683
4708
  return t != null && t.length && t.forEach((s) => {
4684
- En(n, s);
4709
+ Cn(n, s);
4685
4710
  }), n;
4686
4711
  }
4687
- const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4712
+ const $e = (i) => typeof i == "function" ? i : () => i, $i = {
4688
4713
  top: { vAnchor: -0 },
4689
4714
  middle: { vAnchor: -0.5 },
4690
4715
  bottom: { vAnchor: -1 },
4691
4716
  left: { hAnchor: -0 },
4692
4717
  center: { hAnchor: -0.5 },
4693
4718
  right: { hAnchor: -1 }
4694
- }, Ot = class Ot {
4719
+ }, Xt = class Xt {
4695
4720
  constructor(e) {
4696
4721
  if (this.props = {
4697
4722
  width: () => 1 / 0,
@@ -4722,7 +4747,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4722
4747
  ];
4723
4748
  if (typeof e == "string") {
4724
4749
  const o = this.props;
4725
- e.toLowerCase().trim().split(/\s+/).forEach((a) => Object.assign(o, Ri[a]));
4750
+ e.toLowerCase().trim().split(/\s+/).forEach((a) => Object.assign(o, $i[a]));
4726
4751
  }
4727
4752
  return this;
4728
4753
  }
@@ -4736,7 +4761,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4736
4761
  * @return {this}
4737
4762
  */
4738
4763
  width(e) {
4739
- return arguments.length ? (this.props.width = Re(e), this) : this.props.width;
4764
+ return arguments.length ? (this.props.width = $e(e), this) : this.props.width;
4740
4765
  }
4741
4766
  /**
4742
4767
  * @overload
@@ -4748,7 +4773,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4748
4773
  * @return {this}
4749
4774
  */
4750
4775
  height(e) {
4751
- return arguments.length ? (this.props.height = Re(e), this) : this.props.height;
4776
+ return arguments.length ? (this.props.height = $e(e), this) : this.props.height;
4752
4777
  }
4753
4778
  /**
4754
4779
  * @overload
@@ -4763,14 +4788,14 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4763
4788
  return arguments.length ? (this.props.rotation = e, this) : this.props.rotation;
4764
4789
  }
4765
4790
  createElement(e) {
4766
- return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || Ot.createElement;
4791
+ return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || Xt.createElement;
4767
4792
  }
4768
4793
  canvas(e, t) {
4769
4794
  const n = e.getContext ? e.getContext("2d") : e;
4770
4795
  return n.save(), n.rotate(this.rotate() * Math.PI / 180), n.translate(...this.anchor()), t(n), n.restore(), n;
4771
4796
  }
4772
4797
  render(...e) {
4773
- const t = An(e);
4798
+ const t = En(e);
4774
4799
  if (t.d3)
4775
4800
  return t.d3.attr("transform", `rotate(${this.rotate()}) translate(${this.anchor()})`);
4776
4801
  if (t.ctx)
@@ -4783,24 +4808,24 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4783
4808
  }
4784
4809
  }
4785
4810
  };
4786
- y(Ot, "createElement", Cn);
4787
- let he = Ot;
4788
- const se = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, $i = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, $e = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ni = /^(?:[;\xAD%?…]|,(?!\d))/, Yi = /^[´±°¢£¤$¥\u2212]/, Xi = "'“‘[「【﹝〔<‹«{『((<《".split(""), Oi = "',,,!!??”]」】》>’»﹞〕〗〉}))』。".split(""), Ne = (i) => {
4811
+ y(Xt, "createElement", kn);
4812
+ let de = Xt;
4813
+ const ie = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ni = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, Ne = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Yi = /^(?:[;\xAD%?…]|,(?!\d))/, Oi = /^[´±°¢£¤$¥\u2212]/, Xi = "'“‘[「【﹝〔<‹«{『((<《".split(""), Ui = "',,,!!??”]」】》>’»﹞〕〗〉}))』。".split(""), Ye = (i) => {
4789
4814
  const e = i.charCodeAt(0);
4790
4815
  return e >= 19968 && e <= 40959;
4791
4816
  };
4792
- function Xt(i, e) {
4817
+ function Ot(i, e) {
4793
4818
  e !== !1 && (i = i.trim());
4794
4819
  const t = [];
4795
4820
  let n = i.charAt(0), s, r, o = 0;
4796
4821
  for (let a = 1, l = i.length; a < l; a++) {
4797
4822
  s = i.charAt(a), r = i.charAt(a + 1);
4798
- const h = se.test(n), c = se.test(s);
4799
- let d = c || h || Ne(n) || Ne(s), u;
4800
- if ((Yi.test(s) && !$e.test(n) || Ni.test(n + r) && !$e.test(s)) && (d = !0), d && (Oi.includes(s) || Xi.includes(n)) && (d = !1), (n === "-" || // - ASCII dash
4823
+ const h = ie.test(n), c = ie.test(s);
4824
+ let d = c || h || Ye(n) || Ye(s), u;
4825
+ if ((Oi.test(s) && !Ne.test(n) || Yi.test(n + r) && !Ne.test(s)) && (d = !0), d && (Ui.includes(s) || Xi.includes(n)) && (d = !1), (n === "-" || // - ASCII dash
4801
4826
  n === "‐" || // ‐ Unicode hyphen
4802
4827
  n === "–" || // – En dash
4803
- n === "—") && (u = se.test(i.charAt(a - 2)), u && !c && (d = !1), !u && $i.test(s + r) && (d = !0)), d) {
4828
+ n === "—") && (u = ie.test(i.charAt(a - 2)), u && !c && (d = !1), !u && Ni.test(s + r) && (d = !0)), d) {
4804
4829
  const g = i.slice(o, a);
4805
4830
  /\u00AD$/.test(g) ? (t.push(new H(g.slice(0, -1))), t.push(new ht())) : (t.push(new H(g)), t.push(new Tt())), o = a;
4806
4831
  }
@@ -4808,7 +4833,7 @@ function Xt(i, e) {
4808
4833
  }
4809
4834
  return t.push(new H(i.slice(o))), t;
4810
4835
  }
4811
- const Ye = {
4836
+ const Oe = {
4812
4837
  nbsp: " ",
4813
4838
  iexcl: "¡",
4814
4839
  cent: "¢",
@@ -5060,7 +5085,7 @@ const Ye = {
5060
5085
  permil: "‰",
5061
5086
  lsaquo: "‹",
5062
5087
  rsaquo: "›"
5063
- }, Ui = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, qi = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Wi = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, ji = /^<!--(.+?)-->/, Gi = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, Xe = {
5088
+ }, qi = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Wi = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ji = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Gi = /^<!--(.+?)-->/, Vi = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, Xe = {
5064
5089
  b: (i) => i.weight = 700,
5065
5090
  strong: (i) => i.weight = 700,
5066
5091
  i: (i) => i.style = "italic",
@@ -5074,7 +5099,7 @@ const Ye = {
5074
5099
  tt: (i) => i.family = "monospace",
5075
5100
  sub: (i) => i.sub = !0,
5076
5101
  sup: (i) => i.sup = !0
5077
- }, Vi = {
5102
+ }, Zi = {
5078
5103
  div: 1,
5079
5104
  li: 1,
5080
5105
  blockquote: 2,
@@ -5089,27 +5114,27 @@ const Ye = {
5089
5114
  hr: 2,
5090
5115
  p: 2
5091
5116
  };
5092
- function kn(i) {
5093
- return i.replace(Gi, function(e, t, n, s) {
5117
+ function Mn(i) {
5118
+ return i.replace(Vi, function(e, t, n, s) {
5094
5119
  if (t || n) {
5095
5120
  const r = t ? 10 : 16;
5096
5121
  return String.fromCharCode(parseInt(t || n, r));
5097
- } else if (s in Ye)
5098
- return Ye[s];
5122
+ } else if (s in Oe)
5123
+ return Oe[s];
5099
5124
  return e;
5100
5125
  });
5101
5126
  }
5102
- function Zi(i) {
5127
+ function Ki(i) {
5103
5128
  return i && i.length > 1 && (i[0] === '"' && i[i.length - 1] === '"' || i[0] === "'" && i[i.length - 1] === "'") ? i.slice(1, -1) : i;
5104
5129
  }
5105
- const Ki = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
5106
- function Ji(i) {
5130
+ const Ji = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
5131
+ function Qi(i) {
5107
5132
  let e;
5108
5133
  const t = {};
5109
5134
  if (i) {
5110
5135
  do
5111
- if (e = Ki.exec(i), e) {
5112
- const n = kn(Zi(e[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
5136
+ if (e = Ji.exec(i), e) {
5137
+ const n = Mn(Ki(e[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
5113
5138
  if (t[e[1]] = n, i = i.slice(e[0].length), i.length && /^\S/.test(i[0]))
5114
5139
  throw new Error("Attribute error");
5115
5140
  }
@@ -5119,7 +5144,7 @@ function Ji(i) {
5119
5144
  }
5120
5145
  return t;
5121
5146
  }
5122
- function Qi(i) {
5147
+ function tr(i) {
5123
5148
  i = String(i || "").trim();
5124
5149
  let e = {
5125
5150
  weight: null,
@@ -5143,38 +5168,38 @@ function Qi(i) {
5143
5168
  n.length && (e = n.pop());
5144
5169
  }, h = (d) => {
5145
5170
  const u = t.length;
5146
- let g = Vi[d];
5171
+ let g = Zi[d];
5147
5172
  if (u && g) {
5148
- let p = u - 1;
5149
- for (; t[p] && (t[p] instanceof Tt || Ui.test(t[p].value)); )
5150
- p--;
5151
- for (; g && t[p] && t[p] instanceof Z; )
5152
- p--, g--;
5173
+ let f = u - 1;
5174
+ for (; t[f] && (t[f] instanceof Tt || qi.test(t[f].value)); )
5175
+ f--;
5176
+ for (; g && t[f] && t[f] instanceof K; )
5177
+ f--, g--;
5153
5178
  for (; g-- > 0; )
5154
- t.push(new Z());
5179
+ t.push(new K());
5155
5180
  }
5156
5181
  };
5157
5182
  for (; i.length; ) {
5158
5183
  if (s = /^[^<]+/.exec(i)) {
5159
- const d = kn(s[0]);
5160
- Xt(d, !1).forEach(o);
5161
- } else if (!(s = ji.exec(i))) if (s = qi.exec(i))
5184
+ const d = Mn(s[0]);
5185
+ Ot(d, !1).forEach(o);
5186
+ } else if (!(s = Gi.exec(i))) if (s = Wi.exec(i))
5162
5187
  l(), h(s[1]);
5163
- else if (s = Wi.exec(i)) {
5188
+ else if (s = ji.exec(i)) {
5164
5189
  const d = s[1];
5165
5190
  h(d), a(), Xe[d] && Xe[d](e);
5166
- const u = Ji(s[2]);
5167
- d === "a" && (u.href && (e.href = u.href), u.rel && (e.rel = u.rel), u.target && (e.target = u.target)), u.class && (e.class = e.class ? e.class + " " + u.class : u.class), u.style && (r = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(u.style), r && r[1] && (e.color = r[1])), d === "br" && t.push(new Z());
5191
+ const u = Qi(s[2]);
5192
+ d === "a" && (u.href && (e.href = u.href), u.rel && (e.rel = u.rel), u.target && (e.target = u.target)), u.class && (e.class = e.class ? e.class + " " + u.class : u.class), u.style && (r = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(u.style), r && r[1] && (e.color = r[1])), d === "br" && t.push(new K());
5168
5193
  } else
5169
5194
  s = [i.slice(0, 1)], o(new H(s[0]));
5170
5195
  i = i.slice(s[0].length);
5171
5196
  }
5172
5197
  let c = t[t.length - 1];
5173
- for (; c instanceof Z; )
5198
+ for (; c instanceof K; )
5174
5199
  t.pop(), c = t[t.length - 1];
5175
5200
  return t;
5176
5201
  }
5177
- const Oe = {
5202
+ const Ue = {
5178
5203
  copyright: "©",
5179
5204
  textcopyright: "©",
5180
5205
  dag: "†",
@@ -5376,7 +5401,7 @@ const Oe = {
5376
5401
  SS: "SS",
5377
5402
  th: "þ",
5378
5403
  TH: "Þ"
5379
- }, tr = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, er = /^%[^\n]+(?:\n|$)/, nr = /^[^#$%&~_^\\{}]+/, sr = /^\\([&{}$%#_])/, ir = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, rr = {
5404
+ }, er = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, nr = /^%[^\n]+(?:\n|$)/, sr = /^[^#$%&~_^\\{}]+/, ir = /^\\([&{}$%#_])/, rr = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, or = {
5380
5405
  "---": "—",
5381
5406
  // \textemdash
5382
5407
  "--": "–",
@@ -5416,7 +5441,7 @@ const Oe = {
5416
5441
  // (0 width NBSp) end sentence
5417
5442
  "\\\\": "\\newline{}"
5418
5443
  // newline command shorthand
5419
- }, N = {
5444
+ }, $ = {
5420
5445
  bf: (i) => i.weight = "bold",
5421
5446
  it: (i) => i.style = "italic",
5422
5447
  sl: (i) => i.style = "italic",
@@ -5425,27 +5450,27 @@ const Oe = {
5425
5450
  "^": (i) => i.sup = !0,
5426
5451
  _: (i) => i.sub = !0,
5427
5452
  par: function(i) {
5428
- this.tokens.push(new Z(), new Z());
5453
+ this.tokens.push(new K(), new K());
5429
5454
  },
5430
5455
  newline: function(i) {
5431
- this.tokens.push(new Z());
5456
+ this.tokens.push(new K());
5432
5457
  },
5433
5458
  url: function(i, e) {
5434
5459
  i = this.open_context(), i.href = e, this.add_token(new H(e)), this.close_context();
5435
5460
  }
5436
5461
  };
5437
- N.textsuperscript = N["^"];
5438
- N.textsubscript = N._;
5439
- N.textsl = N.sl;
5440
- N.mathbf = N.bf;
5441
- N.mathit = N.it;
5442
- N.textbf = N.bf;
5443
- N.textit = N.it;
5444
- N.textcolor = N.color;
5445
- function or(i) {
5462
+ $.textsuperscript = $["^"];
5463
+ $.textsubscript = $._;
5464
+ $.textsl = $.sl;
5465
+ $.mathbf = $.bf;
5466
+ $.mathit = $.it;
5467
+ $.textbf = $.bf;
5468
+ $.textit = $.it;
5469
+ $.textcolor = $.color;
5470
+ function ar(i) {
5446
5471
  i = String(i || "").trim();
5447
5472
  const e = [0];
5448
- i = i.replace(/\\verb,(.*?),/, (c, d) => (e.push(d), "\\verb," + (e.length - 1) + ",")).replace(/\\\\\n/g, () => "\\\\").replace(ir, (c, d, u) => u.charAt(d - 1) === "\\" ? c : rr[c]).replace(/\n\s+/g, (c) => /\n/.test(c.slice(1)) ? "\\par " : c).replace(/\\symbol\{(\d+)\}/, (c, d, u, g) => g.charAt(u - 1) === "\\" ? c : String.fromCharCode(1 * d)).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, (c, d, u, g) => d + u + "{" + g + "}").replace(/\\verb,(.*?),/, (c, d) => `\\verb,${e[+d]},`);
5473
+ i = i.replace(/\\verb,(.*?),/, (c, d) => (e.push(d), "\\verb," + (e.length - 1) + ",")).replace(/\\\\\n/g, () => "\\\\").replace(rr, (c, d, u) => u.charAt(d - 1) === "\\" ? c : or[c]).replace(/\n\s+/g, (c) => /\n/.test(c.slice(1)) ? "\\par " : c).replace(/\\symbol\{(\d+)\}/, (c, d, u, g) => g.charAt(u - 1) === "\\" ? c : String.fromCharCode(1 * d)).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, (c, d, u, g) => d + u + "{" + g + "}").replace(/\\verb,(.*?),/, (c, d) => `\\verb,${e[+d]},`);
5449
5474
  let t = {
5450
5475
  weight: null,
5451
5476
  italic: null,
@@ -5473,38 +5498,38 @@ function or(i) {
5473
5498
  add_token: o
5474
5499
  };
5475
5500
  for (; i.length; ) {
5476
- if (r = nr.exec(i))
5477
- Xt(r[0], !1).forEach(o);
5478
- else if (r = sr.exec(i))
5501
+ if (r = sr.exec(i))
5502
+ Ot(r[0], !1).forEach(o);
5503
+ else if (r = ir.exec(i))
5479
5504
  o(new H(r[1]));
5480
- else if (!(r = er.exec(i))) {
5505
+ else if (!(r = nr.exec(i))) {
5481
5506
  if (r = /^\{/.exec(i))
5482
5507
  a();
5483
5508
  else if (r = /^\}/.exec(i))
5484
5509
  l();
5485
5510
  else if (!(r = /^\$/.exec(i))) if (r = /^\\verb,([^,]+),/.exec(i))
5486
5511
  o(new H(r[1]));
5487
- else if (r = tr.exec(i)) {
5512
+ else if (r = er.exec(i)) {
5488
5513
  const c = r[1].slice(1) || r[1];
5489
5514
  let d = !!r[2];
5490
5515
  if (/^(La)?TeX$/i.test(c)) {
5491
5516
  a(), t.family = "serif";
5492
5517
  let u;
5493
5518
  c === "LaTeX" && (u = o(new H("L")), u.tracking = -0.25, u = o(new H("A")), u.size = 0.7, u.baseline = 0.3, u.tracking = -0.1), u = o(new H("T")), u.tracking = -0.17, u = o(new H("E")), u.baseline = -0.22, u.tracking = -0.13, u = o(new H("X")), l();
5494
- } else if (c in Oe)
5495
- o(new H(Oe[c])), d && a();
5496
- else if (c in N) {
5519
+ } else if (c in Ue)
5520
+ o(new H(Ue[c])), d && a();
5521
+ else if (c in $) {
5497
5522
  const u = [];
5498
- let g = N[c].length - 1, p;
5523
+ let g = $[c].length - 1, f;
5499
5524
  if (g) {
5500
5525
  for (d = !1, i = i.slice(r[0].length - 1); g--; )
5501
- if (p = /^\{([^}]+)\}/.exec(i))
5502
- u.push(p[1]), i = i.slice(p[0].length);
5526
+ if (f = /^\{([^}]+)\}/.exec(i))
5527
+ u.push(f[1]), i = i.slice(f[0].length);
5503
5528
  else
5504
5529
  throw new Error(c + " is missing an argument");
5505
5530
  r[0] = /^\{/.exec(i) ? "{" : "", d = !!r[0];
5506
5531
  }
5507
- d && a(), N[c].apply(h, [t, ...u]);
5532
+ d && a(), $[c].apply(h, [t, ...u]);
5508
5533
  } else
5509
5534
  o(new H(r[1])), d && a();
5510
5535
  } else
@@ -5514,7 +5539,7 @@ function or(i) {
5514
5539
  }
5515
5540
  return n;
5516
5541
  }
5517
- const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5542
+ const cr = new Z(), re = (i) => typeof i == "function" ? i : () => i, qe = {
5518
5543
  left: "left",
5519
5544
  start: "left",
5520
5545
  center: "center",
@@ -5522,7 +5547,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5522
5547
  right: "right",
5523
5548
  end: "right",
5524
5549
  justify: "justify"
5525
- }, $ = class $ {
5550
+ }, R = class R {
5526
5551
  /**
5527
5552
  * @param {object} [opts]
5528
5553
  * @param {string | Font} [opts.font = '12px/14px sans-serif']
@@ -5552,8 +5577,8 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5552
5577
  height: () => 1 / 0,
5553
5578
  x: () => 0,
5554
5579
  /** @type {Font} */
5555
- font: ar,
5556
- parser: $.defaultparser
5580
+ font: cr,
5581
+ parser: R.defaultparser
5557
5582
  }, e && (e.font && this.font(e.font), e.overflow && this.overflow(e.overflow), e.overflowLine && this.overflowLine(e.overflowLine), e.overflowWrap && this.overflowWrap(e.overflowWrap), e.valign && this.valign(e.valign), e.align && this.align(e.align), e.width && this.width(e.width), e.height && this.height(e.height), e.x && this.x(e.x), e.parser && this.parser(e.parser), e.createElement && this.createElement(e.createElement));
5558
5583
  }
5559
5584
  /**
@@ -5561,7 +5586,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5561
5586
  * @return {import('./types.js').Lines & import('./types.js').LinesPropsRender}
5562
5587
  */
5563
5588
  linebreak(e) {
5564
- const t = this.props.parser(String(e)), n = Fi(t, this, this.font()), s = (r) => this.render(n, r);
5589
+ const t = this.props.parser(String(e)), n = Pi(t, this, this.font()), s = (r) => this.render(n, r);
5565
5590
  return Object.assign(n, {
5566
5591
  render: s,
5567
5592
  svg: s,
@@ -5578,7 +5603,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5578
5603
  * @return {this}
5579
5604
  */
5580
5605
  font(e) {
5581
- return arguments.length ? (this.props.font = new V(e), this) : this.props.font || new V();
5606
+ return arguments.length ? (this.props.font = new Z(e), this) : this.props.font || new Z();
5582
5607
  }
5583
5608
  /**
5584
5609
  * @overload
@@ -5629,7 +5654,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5629
5654
  if (!arguments.length)
5630
5655
  return this.props.align;
5631
5656
  const t = String(e).toLowerCase();
5632
- return t in Ue && (this.props.align = Ue[t]), this;
5657
+ return t in qe && (this.props.align = qe[t]), this;
5633
5658
  }
5634
5659
  /**
5635
5660
  * @overload
@@ -5657,7 +5682,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5657
5682
  */
5658
5683
  width(e) {
5659
5684
  return arguments.length ? (this.props.width = /** @type {(line?: number) => number} */
5660
- ie(e), this) : this.props.width;
5685
+ re(e), this) : this.props.width;
5661
5686
  }
5662
5687
  /**
5663
5688
  * @overload
@@ -5670,7 +5695,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5670
5695
  */
5671
5696
  height(e) {
5672
5697
  return arguments.length ? (this.props.height = /** @type {() => number} */
5673
- ie(e), this) : this.props.height;
5698
+ re(e), this) : this.props.height;
5674
5699
  }
5675
5700
  /**
5676
5701
  * @overload
@@ -5683,7 +5708,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5683
5708
  */
5684
5709
  x(e) {
5685
5710
  return arguments.length ? (this.props.x = /** @type {(line?: number) => number} */
5686
- ie(e), this) : this.props.x;
5711
+ re(e), this) : this.props.x;
5687
5712
  }
5688
5713
  /**
5689
5714
  * @overload
@@ -5698,7 +5723,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5698
5723
  if (!arguments.length)
5699
5724
  return this.props.parser;
5700
5725
  if (typeof e == "string") {
5701
- const t = $[e] || $[e + "parser"];
5726
+ const t = R[e] || R[e + "parser"];
5702
5727
  typeof t == "function" && (e = t);
5703
5728
  }
5704
5729
  if (typeof e != "function")
@@ -5715,7 +5740,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5715
5740
  * @return {this}
5716
5741
  */
5717
5742
  createElement(e) {
5718
- return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || $.createElement;
5743
+ return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || R.createElement;
5719
5744
  }
5720
5745
  /**
5721
5746
  * @overload
@@ -5729,14 +5754,14 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5729
5754
  * @return {undefined}
5730
5755
  */
5731
5756
  render(e, t) {
5732
- const n = An([e, t]);
5757
+ const n = En([e, t]);
5733
5758
  if (typeof n.text == "string" && (n.text = this.linebreak(n.text)), n.ctx)
5734
- Ii(n.text, this, n.ctx);
5759
+ zi(n.text, this, n.ctx);
5735
5760
  else
5736
- return Li(n.text, this);
5761
+ return Hi(n.text, this);
5737
5762
  }
5738
5763
  };
5739
- y($, "createElement", Cn), y($, "textparser", Xt), y($, "defaultparser", Xt), y($, "htmlparser", Qi), y($, "latexparser", or), y($, "Token", H), y($, "Break", Tt), y($, "LineBreak", Z), y($, "SoftHyphen", ht), y($, "Rotator", he), y($, "Font", V), y($, "setMeasureCanvas", ki), /**
5764
+ y(R, "createElement", kn), y(R, "textparser", Ot), y(R, "defaultparser", Ot), y(R, "htmlparser", tr), y(R, "latexparser", ar), y(R, "Token", H), y(R, "Break", Tt), y(R, "LineBreak", K), y(R, "SoftHyphen", ht), y(R, "Rotator", de), y(R, "Font", Z), y(R, "setMeasureCanvas", Mi), /**
5740
5765
  * Measure a string of text as printed with a specified font and return
5741
5766
  * its width.
5742
5767
  *
@@ -5745,41 +5770,41 @@ y($, "createElement", Cn), y($, "textparser", Xt), y($, "defaultparser", Xt), y(
5745
5770
  * @param {import('./types.js').MeasureOptions} [options]
5746
5771
  * @return {number}
5747
5772
  */
5748
- y($, "measureText", function(e, t, n) {
5749
- return ct(e, new V(t), n);
5773
+ y(R, "measureText", function(e, t, n) {
5774
+ return ct(e, new Z(t), n);
5750
5775
  });
5751
- let Et = $;
5752
- function cr(i, e, t, n) {
5776
+ let Et = R;
5777
+ function lr(i, e, t, n) {
5753
5778
  const { width: s, height: r } = q(e), {
5754
- color: o = U.color,
5755
- strokeColor: a = U.strokeColor,
5756
- strokeWidth: l = U.strokeWidth,
5757
- strokeType: h = U.strokeType,
5758
- background: c = U.background,
5759
- borderRadius: d = U.borderRadius,
5760
- fixedSize: u = U.fixedSize
5761
- } = e.properties.style || U, g = yn(i, e, t, n);
5779
+ color: o = G.color,
5780
+ strokeColor: a = G.strokeColor,
5781
+ strokeWidth: l = G.strokeWidth,
5782
+ strokeType: h = G.strokeType,
5783
+ background: c = G.background,
5784
+ borderRadius: d = G.borderRadius,
5785
+ fixedSize: u = G.fixedSize
5786
+ } = e.properties.style || G, g = wn(i, e, t, n);
5762
5787
  g.setAttribute("data-annotation-type", e.properties.type), g.classList.add("annotation-text"), g.setAttribute("fill", `${o}`);
5763
- let p = g.firstChild;
5764
- for (; p; ) {
5765
- const v = p.nextSibling;
5766
- p.nodeType === 1 && p.tagName !== "rect" && g.removeChild(p), p = v;
5767
- }
5768
5788
  let f = g.firstChild;
5769
- f || (f = M("rect"), g.appendChild(f));
5770
- const m = -s / 2, x = -r / 2;
5771
- d && (f.setAttribute("rx", `${d}`), f.setAttribute("ry", `${d}`)), h && h !== "none" && (f.setAttribute("stroke", a || "black"), f.setAttribute("stroke-width", `${l}`), h === "dashed" && f.setAttribute("stroke-dasharray", "5,5")), c && c.length && (n.hoveredFeature === e.id ? f.setAttribute("fill", Ft(c)) : f.setAttribute("fill", c)), f.setAttribute("width", `${s}`), f.setAttribute("height", `${r}`);
5789
+ for (; f; ) {
5790
+ const v = f.nextSibling;
5791
+ f.nodeType === 1 && f.tagName !== "rect" && g.removeChild(f), f = v;
5792
+ }
5793
+ let p = g.firstChild;
5794
+ p || (p = M("rect"), g.appendChild(p));
5795
+ const m = -s / 2, w = -r / 2;
5796
+ d && (p.setAttribute("rx", `${d}`), p.setAttribute("ry", `${d}`)), h && h !== "none" && (p.setAttribute("stroke", a || "black"), p.setAttribute("stroke-width", `${l}`), h === "dashed" && p.setAttribute("stroke-dasharray", "5,5")), c && c.length && (n.hoveredFeature === e.id ? p.setAttribute("fill", Ft(c)) : p.setAttribute("fill", c)), p.setAttribute("width", `${s}`), p.setAttribute("height", `${r}`);
5772
5797
  const b = Q(e);
5773
- return f.setAttribute("x", `${m}`), f.setAttribute("y", `${x}`), lr(e, g, m, x), g.setAttribute(
5798
+ return p.setAttribute("x", `${m}`), p.setAttribute("y", `${w}`), hr(e, g, m, w), g.setAttribute(
5774
5799
  "transform",
5775
5800
  n.getScreenAlignedTransform(b.x, b.y, !u)
5776
5801
  ), i.appendChild(g), g;
5777
5802
  }
5778
- const qe = (i) => i.replace(/…$/, ""), We = (i) => i.children[0].innerHTML;
5779
- function lr(i, e, t = 0, n = 0) {
5803
+ const We = (i) => i.replace(/…$/, ""), je = (i) => i.children[0].innerHTML;
5804
+ function hr(i, e, t = 0, n = 0) {
5780
5805
  const { width: s, height: r } = q(i), {
5781
- fontSize: o = U.fontSize,
5782
- font: a = U.font,
5806
+ fontSize: o = G.fontSize,
5807
+ font: a = G.font,
5783
5808
  padding: l = 0
5784
5809
  } = i.properties.style || {};
5785
5810
  if (s === r && s === 0) return;
@@ -5798,27 +5823,27 @@ function lr(i, e, t = 0, n = 0) {
5798
5823
  const d = i.properties.content || "";
5799
5824
  if (d.length === 0) return;
5800
5825
  const g = c.linebreak(d.replaceAll(`
5801
- `, "<br>")).svg(), p = [...g.children], f = d.match(/(https?:\/\/.*)/gm);
5802
- (f ? f.map((x) => x.split(" ")[0]) : []).forEach((x) => {
5803
- let b = x;
5826
+ `, "<br>")).svg(), f = [...g.children], p = d.match(/(https?:\/\/.*)/gm);
5827
+ (p ? p.map((w) => w.split(" ")[0]) : []).forEach((w) => {
5828
+ let b = w;
5804
5829
  const v = [];
5805
5830
  for (; b.length > 0; ) {
5806
- const S = p.find(
5807
- (A) => !!A.children[0] && A.children[0].tagName === "tspan" && b.startsWith(qe(We(A)))
5831
+ const S = f.find(
5832
+ (A) => !!A.children[0] && A.children[0].tagName === "tspan" && b.startsWith(We(je(A)))
5808
5833
  );
5809
5834
  if (!S) break;
5810
5835
  v.push(S);
5811
- const w = qe(S.children[0].innerHTML).length;
5812
- if (!w) break;
5813
- b = b.slice(w);
5836
+ const x = We(S.children[0].innerHTML).length;
5837
+ if (!x) break;
5838
+ b = b.slice(x);
5814
5839
  }
5815
5840
  v.forEach((S) => {
5816
- const w = document.createElementNS("http://www.w3.org/2000/svg", "a");
5817
- w.setAttribute("href", x), w.setAttribute("target", "_blank"), w.innerHTML = We(S), S.children[0].innerHTML = "", S.children[0].appendChild(w);
5841
+ const x = document.createElementNS("http://www.w3.org/2000/svg", "a");
5842
+ x.setAttribute("href", w), x.setAttribute("target", "_blank"), x.innerHTML = je(S), S.children[0].innerHTML = "", S.children[0].appendChild(x);
5818
5843
  });
5819
5844
  }), g.setAttribute("transform", `translate(${t + l}, ${n + l})`), e.appendChild(g);
5820
5845
  }
5821
- class hr extends mn {
5846
+ class dr extends yn {
5822
5847
  constructor(t, n) {
5823
5848
  super(t, n);
5824
5849
  y(this, "features", /* @__PURE__ */ new Map());
@@ -5834,44 +5859,45 @@ class hr extends mn {
5834
5859
  (!this.annotationsRoot || !t.contains(this.annotationsRoot)) && (t.innerHTML = "", t.appendChild(this.getDefs()), this.arrowsRoot = M("g"), this.commentsRoot = M("g"), this.annotationsRoot = M("g"), this.shapesRoot = M("g"), this.annotationsRoot.appendChild(this.arrowsRoot), this.annotationsRoot.appendChild(this.shapesRoot), this.annotationsRoot.appendChild(this.commentsRoot), t.appendChild(this.annotationsRoot)), t.removeChild(this.annotationsRoot);
5835
5860
  const a = this.arrowsRoot, l = this.annotationsRoot, h = this.commentsRoot, c = this.shapesRoot, d = this.store.getState(), u = this.getViewportBounds(), g = new Set(Object.keys(n));
5836
5861
  this.removeFeatures(g);
5837
- const p = /* @__PURE__ */ new Set();
5838
- for (let f of Object.values(n)) {
5839
- if (o[f.id] && (f = { ...f, ...o[f.id] }), !this.isExporting && !this.isFeatureVisible(f, u)) continue;
5840
- p.add(f.id);
5841
- let m = this.features.get(f.id);
5842
- W(f) ? m = yn(
5862
+ const f = /* @__PURE__ */ new Set();
5863
+ for (let p of Object.values(n)) {
5864
+ if (o[p.id] && (p = { ...p, ...o[p.id] }), !this.isExporting && !this.isFeatureVisible(p, u))
5865
+ continue;
5866
+ f.add(p.id);
5867
+ let m = this.features.get(p.id);
5868
+ W(p) ? m = wn(
5843
5869
  c,
5844
- f,
5870
+ p,
5845
5871
  m,
5846
5872
  d
5847
- ) : _(f) ? m = cr(
5873
+ ) : _(p) ? m = lr(
5848
5874
  c,
5849
- f,
5875
+ p,
5850
5876
  m,
5851
5877
  d
5852
- ) : D(f) ? m = gi(
5878
+ ) : P(p) ? m = fi(
5853
5879
  h,
5854
- f,
5880
+ p,
5855
5881
  m,
5856
5882
  d,
5857
- this.visibleFeatures.has(f.id)
5858
- ) : nt(f) ? m = mi(
5883
+ this.visibleFeatures.has(p.id)
5884
+ ) : st(p) ? m = yi(
5859
5885
  c,
5860
- f,
5886
+ p,
5861
5887
  m,
5862
5888
  d
5863
- ) : tt(f) && (m = ii(
5889
+ ) : tt(p) && (m = ri(
5864
5890
  a,
5865
- f,
5891
+ p,
5866
5892
  d.options.minArrowHeight,
5867
5893
  d.options.maxArrowHeight,
5868
5894
  m,
5869
5895
  d
5870
- )), m && this.features.set(f.id, m);
5896
+ )), m && this.features.set(p.id, m);
5871
5897
  }
5872
- this.applyStateClasses(l, s, r), t.appendChild(l), this.visibleFeatures.clear(), this.visibleFeatures = p;
5898
+ this.applyStateClasses(l, s, r), t.appendChild(l), this.visibleFeatures.clear(), this.visibleFeatures = f;
5873
5899
  });
5874
- y(this, "throttleRender", rn(
5900
+ y(this, "throttleRender", on(
5875
5901
  () => this.render(this.layer.element),
5876
5902
  16,
5877
5903
  !0
@@ -5889,7 +5915,7 @@ class hr extends mn {
5889
5915
  {
5890
5916
  draw: this.render
5891
5917
  },
5892
- de.SHAPES
5918
+ ue.SHAPES
5893
5919
  ), this.store.subscribe(
5894
5920
  (s) => ({
5895
5921
  features: s.features,
@@ -5908,14 +5934,13 @@ class hr extends mn {
5908
5934
  }
5909
5935
  getViewportBounds() {
5910
5936
  const t = this.ogma;
5911
- let n;
5937
+ let n = null;
5912
5938
  try {
5913
5939
  n = t.view.getSize();
5914
5940
  } catch {
5915
- return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
5941
+ return [0, 0, 0, 0];
5916
5942
  }
5917
- if (!n)
5918
- return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
5943
+ if (!n) return [0, 0, 0, 0];
5919
5944
  const { width: s, height: r } = n, o = 1.5, a = t.view.screenToGraphCoordinates({ x: 0, y: 0 }), l = t.view.screenToGraphCoordinates({ x: s * o, y: 0 }), h = t.view.screenToGraphCoordinates({ x: 0, y: r * o }), c = t.view.screenToGraphCoordinates({
5920
5945
  x: s * o,
5921
5946
  y: r * o
@@ -5938,7 +5963,7 @@ class hr extends mn {
5938
5963
  }
5939
5964
  getDefs() {
5940
5965
  const t = M("defs");
5941
- t.appendChild(li());
5966
+ t.appendChild(hi());
5942
5967
  const n = M("filter");
5943
5968
  n.setAttribute("id", "softShadow"), n.setAttribute("x", "-50%"), n.setAttribute("y", "-50%"), n.setAttribute("width", "200%"), n.setAttribute("height", "200%");
5944
5969
  const s = M("feGaussianBlur");
@@ -5981,7 +6006,7 @@ class hr extends mn {
5981
6006
  this.features.clear(), this.layer.destroy(), this.ogma.events.off(this.onExportStart), this.ogma.events.off(this.onExportEnd), super.destroy();
5982
6007
  }
5983
6008
  }
5984
- const je = (i) => {
6009
+ const Ge = (i) => {
5985
6010
  let e;
5986
6011
  const t = /* @__PURE__ */ new Set(), n = (h, c) => {
5987
6012
  const d = typeof h == "function" ? h(e) : h;
@@ -5991,8 +6016,8 @@ const je = (i) => {
5991
6016
  }
5992
6017
  }, s = () => e, a = { setState: n, getState: s, getInitialState: () => l, subscribe: (h) => (t.add(h), () => t.delete(h)) }, l = e = i(n, s, a);
5993
6018
  return a;
5994
- }, Mn = (i) => i ? je(i) : je;
5995
- var Ge = (i, e, t) => (s, r) => ({
6019
+ }, Tn = (i) => i ? Ge(i) : Ge;
6020
+ var Ve = (i, e, t) => (s, r) => ({
5996
6021
  pastStates: (t == null ? void 0 : t.pastStates) || [],
5997
6022
  futureStates: (t == null ? void 0 : t.futureStates) || [],
5998
6023
  undo: (o = 1) => {
@@ -6035,18 +6060,18 @@ var Ge = (i, e, t) => (s, r) => ({
6035
6060
  futureStates: []
6036
6061
  });
6037
6062
  }
6038
- }), dr = (i, e) => (n, s, r) => {
6063
+ }), ur = (i, e) => (n, s, r) => {
6039
6064
  var h, c;
6040
- r.temporal = Mn(
6041
- ((h = e == null ? void 0 : e.wrapTemporal) == null ? void 0 : h.call(e, Ge(n, s, e))) || Ge(n, s, e)
6065
+ r.temporal = Tn(
6066
+ ((h = e == null ? void 0 : e.wrapTemporal) == null ? void 0 : h.call(e, Ve(n, s, e))) || Ve(n, s, e)
6042
6067
  );
6043
6068
  const o = ((c = e == null ? void 0 : e.handleSet) == null ? void 0 : c.call(
6044
6069
  e,
6045
6070
  r.temporal.getState()._handleSet
6046
6071
  )) || r.temporal.getState()._handleSet, a = (d) => {
6047
- var p, f, m;
6072
+ var f, p, m;
6048
6073
  if (!r.temporal.getState().isTracking) return;
6049
- const u = ((p = e == null ? void 0 : e.partialize) == null ? void 0 : p.call(e, s())) || s(), g = (f = e == null ? void 0 : e.diff) == null ? void 0 : f.call(e, d, u);
6074
+ const u = ((f = e == null ? void 0 : e.partialize) == null ? void 0 : f.call(e, s())) || s(), g = (p = e == null ? void 0 : e.diff) == null ? void 0 : p.call(e, d, u);
6050
6075
  // If the user has provided a diff function but nothing has been changed, deltaState will be null
6051
6076
  g === null || // If the user has provided an equality function, use it
6052
6077
  (m = e == null ? void 0 : e.equality) != null && m.call(e, d, u) || o(
@@ -6071,7 +6096,7 @@ var Ge = (i, e, t) => (s, r) => ({
6071
6096
  r
6072
6097
  );
6073
6098
  };
6074
- const ur = (i) => (e, t, n) => {
6099
+ const gr = (i) => (e, t, n) => {
6075
6100
  const s = n.subscribe;
6076
6101
  return n.subscribe = (o, a, l) => {
6077
6102
  let h = o;
@@ -6081,15 +6106,15 @@ const ur = (i) => (e, t, n) => {
6081
6106
  h = (u) => {
6082
6107
  const g = o(u);
6083
6108
  if (!c(d, g)) {
6084
- const p = d;
6085
- a(d = g, p);
6109
+ const f = d;
6110
+ a(d = g, f);
6086
6111
  }
6087
6112
  }, l != null && l.fireImmediately && a(d, d);
6088
6113
  }
6089
6114
  return s(h);
6090
6115
  }, i(e, t, n);
6091
- }, gr = ur, fr = [0, 0, 0, 0];
6092
- function pr(i, e) {
6116
+ }, fr = gr, pr = [0, 0, 0, 0];
6117
+ function mr(i, e) {
6093
6118
  const t = Object.keys(i.features), n = Object.keys(e.features);
6094
6119
  if (t.length !== n.length) return !1;
6095
6120
  for (const s of t)
@@ -6100,10 +6125,10 @@ function pr(i, e) {
6100
6125
  }
6101
6126
  return i.drawingFeature === e.drawingFeature;
6102
6127
  }
6103
- const mr = (i) => {
6104
- const e = Mn()(
6105
- gr(
6106
- dr(
6128
+ const yr = (i) => {
6129
+ const e = Tn()(
6130
+ fr(
6131
+ ur(
6107
6132
  (t, n) => ({
6108
6133
  features: {},
6109
6134
  liveUpdates: {},
@@ -6128,9 +6153,9 @@ const mr = (i) => {
6128
6153
  invZoom: 1,
6129
6154
  options: {
6130
6155
  showSendButton: (i == null ? void 0 : i.showSendButton) ?? !0,
6131
- sendButtonIcon: (i == null ? void 0 : i.sendButtonIcon) ?? Je,
6156
+ sendButtonIcon: (i == null ? void 0 : i.sendButtonIcon) ?? Qe,
6132
6157
  showEditButton: (i == null ? void 0 : i.showEditButton) ?? !0,
6133
- editButtonIcon: (i == null ? void 0 : i.editButtonIcon) ?? Qe,
6158
+ editButtonIcon: (i == null ? void 0 : i.editButtonIcon) ?? tn,
6134
6159
  minArrowHeight: (i == null ? void 0 : i.minArrowHeight) ?? 20,
6135
6160
  maxArrowHeight: (i == null ? void 0 : i.maxArrowHeight) ?? 30,
6136
6161
  detectMargin: (i == null ? void 0 : i.detectMargin) ?? 2,
@@ -6142,21 +6167,21 @@ const mr = (i) => {
6142
6167
  options: { ...r.options, ...s }
6143
6168
  })),
6144
6169
  removeFeature: (s) => t((r) => {
6145
- var u, g, p, f;
6170
+ var u, g, f, p;
6146
6171
  const o = r.features[s];
6147
6172
  if (!o) return r;
6148
6173
  const { features: a, liveUpdates: l } = r, h = /* @__PURE__ */ new Set([s]);
6149
- if ((D(o) || _(o)) && Object.values(a).forEach((m) => {
6150
- var x, b, v, S;
6151
- tt(m) && (((b = (x = m.properties.link) == null ? void 0 : x.end) == null ? void 0 : b.id) === s || ((S = (v = m.properties.link) == null ? void 0 : v.start) == null ? void 0 : S.id) === s) && h.add(m.id);
6174
+ if ((P(o) || _(o)) && Object.values(a).forEach((m) => {
6175
+ var w, b, v, S;
6176
+ tt(m) && (((b = (w = m.properties.link) == null ? void 0 : w.end) == null ? void 0 : b.id) === s || ((S = (v = m.properties.link) == null ? void 0 : v.start) == null ? void 0 : S.id) === s) && h.add(m.id);
6152
6177
  }), tt(o)) {
6153
- const m = ((g = (u = o.properties.link) == null ? void 0 : u.end) == null ? void 0 : g.type) === "comment" ? o.properties.link.end.id : ((f = (p = o.properties.link) == null ? void 0 : p.start) == null ? void 0 : f.type) === "comment" ? o.properties.link.start.id : null;
6178
+ const m = ((g = (u = o.properties.link) == null ? void 0 : u.end) == null ? void 0 : g.type) === "comment" ? o.properties.link.end.id : ((p = (f = o.properties.link) == null ? void 0 : f.start) == null ? void 0 : p.type) === "comment" ? o.properties.link.start.id : null;
6154
6179
  if (m) {
6155
- let x = 0;
6180
+ let w = 0;
6156
6181
  if (Object.values(r.features).forEach((b) => {
6157
- var v, S, w, A;
6158
- tt(b) && b.id !== s && (((S = (v = b.properties.link) == null ? void 0 : v.end) == null ? void 0 : S.id) === m || ((A = (w = b.properties.link) == null ? void 0 : w.start) == null ? void 0 : A.id) === m) && x++;
6159
- }), x === 0)
6182
+ var v, S, x, A;
6183
+ tt(b) && b.id !== s && (((S = (v = b.properties.link) == null ? void 0 : v.end) == null ? void 0 : S.id) === m || ((A = (x = b.properties.link) == null ? void 0 : x.start) == null ? void 0 : A.id) === m) && w++;
6184
+ }), w === 0)
6160
6185
  return console.error(
6161
6186
  "Cannot delete last arrow attached to comment. Delete the comment instead."
6162
6187
  ), r;
@@ -6313,7 +6338,7 @@ const mr = (i) => {
6313
6338
  return `matrix(${a}, ${o}, ${-o}, ${a}, ${-l}, ${-h})`;
6314
6339
  },
6315
6340
  getRotatedBBox(s, r, o, a) {
6316
- return os(
6341
+ return as(
6317
6342
  s,
6318
6343
  r,
6319
6344
  o - s,
@@ -6322,7 +6347,7 @@ const mr = (i) => {
6322
6347
  this.cos,
6323
6348
  s + (o - s) / 2,
6324
6349
  r + (a - r) / 2,
6325
- fr
6350
+ pr
6326
6351
  );
6327
6352
  },
6328
6353
  setDrawingPoints: (s) => t({ drawingPoints: s })
@@ -6336,7 +6361,7 @@ const mr = (i) => {
6336
6361
  // Only track features, not liveUpdates!
6337
6362
  lastChangedFeatures: t.lastChangedFeatures
6338
6363
  }),
6339
- equality: pr,
6364
+ equality: mr,
6340
6365
  handleSet: (t) => (n) => {
6341
6366
  n.drawingFeature === null && t(n);
6342
6367
  }
@@ -6345,19 +6370,19 @@ const mr = (i) => {
6345
6370
  )
6346
6371
  );
6347
6372
  return e;
6348
- }, yr = {
6373
+ }, wr = {
6349
6374
  detectMargin: 2,
6350
6375
  magnetHandleRadius: 5,
6351
6376
  magnetRadius: 10,
6352
6377
  textPlaceholder: "Type here",
6353
6378
  showSendButton: !0,
6354
- sendButtonIcon: Je,
6379
+ sendButtonIcon: Qe,
6355
6380
  showEditButton: !0,
6356
- editButtonIcon: Qe,
6381
+ editButtonIcon: tn,
6357
6382
  minArrowHeight: 20,
6358
6383
  maxArrowHeight: 30
6359
6384
  };
6360
- class Zr extends _n {
6385
+ class Kr extends In {
6361
6386
  constructor(t, n = {}) {
6362
6387
  super();
6363
6388
  y(this, "ogma");
@@ -6384,23 +6409,23 @@ class Zr extends _n {
6384
6409
  this.links.update();
6385
6410
  });
6386
6411
  this.ogma = t;
6387
- const s = { ...yr, ...n };
6388
- this.store = mr(s), this.index = new Js(this.store), this.snapping = new Os(this.ogma, {
6412
+ const s = { ...wr, ...n };
6413
+ this.store = yr(s), this.index = new Qs(this.store), this.snapping = new Us(this.ogma, {
6389
6414
  detectMargin: n.detectMargin === void 0 ? 10 : n.detectMargin,
6390
6415
  magnetRadius: n.magnetRadius === void 0 ? 10 : n.magnetRadius
6391
- }, this.index, this.store), this.links = new Fs(this.ogma, this.snapping, this.store, (r, o) => {
6392
- this.emit(Nn, { arrow: r, link: o });
6393
- }), this.interactions = new Us(
6416
+ }, this.index, this.store), this.links = new Ps(this.ogma, this.snapping, this.store, (r, o) => {
6417
+ this.emit(Yn, { arrow: r, link: o });
6418
+ }), this.interactions = new qs(
6394
6419
  this.ogma,
6395
6420
  this.store,
6396
6421
  this.index
6397
- ), this.editor = new ks(
6422
+ ), this.editor = new Ms(
6398
6423
  this.ogma,
6399
6424
  this.store,
6400
6425
  this.snapping,
6401
6426
  this.links,
6402
6427
  this.interactions
6403
- ), this.drawing = new gs(
6428
+ ), this.drawing = new fs(
6404
6429
  this.ogma,
6405
6430
  this.store,
6406
6431
  this.editor,
@@ -6408,10 +6433,10 @@ class Zr extends _n {
6408
6433
  this.links,
6409
6434
  this,
6410
6435
  this.index
6411
- ), this.selectionManager = new ps(this.store), this.historyManager = new fs(this.store, this.links), this.updateManager = new ms(this.store), this.commentManager = new hs(this.store), this.initializeRenderers(), this.setupEvents();
6436
+ ), this.selectionManager = new ms(this.store), this.historyManager = new ps(this.store, this.links), this.updateManager = new ys(this.store), this.commentManager = new ds(this.store), this.initializeRenderers(), this.setupEvents();
6412
6437
  }
6413
6438
  initializeRenderers() {
6414
- this.renderers.shapes = new hr(this.ogma, this.store), this.renderers.handles = new ti(this.ogma, this.store);
6439
+ this.renderers.shapes = new dr(this.ogma, this.store), this.renderers.handles = new ei(this.ogma, this.store);
6415
6440
  }
6416
6441
  setupEvents() {
6417
6442
  this.ogma.events.on("rotate", this.onRotate).on("zoom", this.onZoom).on("layoutEnd", this.onLayout), this.editor.addEventListener(
@@ -6423,11 +6448,11 @@ class Zr extends _n {
6423
6448
  ), this.editor.addEventListener(Bt, (t) => this.emit(Bt, {
6424
6449
  id: t.detail.id,
6425
6450
  position: t.detail.position
6426
- })), this.interactions.addEventListener(re, ((t) => this.emit(re, {
6451
+ })), this.interactions.addEventListener(oe, ((t) => this.emit(oe, {
6427
6452
  id: t.detail.id,
6428
6453
  position: t.detail.position
6429
6454
  }))), this.store.temporal.subscribe((t) => {
6430
- this.emit(Yn, {
6455
+ this.emit(On, {
6431
6456
  canUndo: t.pastStates.length > 0,
6432
6457
  canRedo: t.futureStates.length > 0
6433
6458
  });
@@ -6437,23 +6462,23 @@ class Zr extends _n {
6437
6462
  const s = Array.from(t).filter(
6438
6463
  (r) => !(n != null && n.has(r))
6439
6464
  );
6440
- if (s.length > 0 && this.emit(In, { ids: s }), n) {
6465
+ if (s.length > 0 && this.emit(zn, { ids: s }), n) {
6441
6466
  const r = Array.from(n).filter((o) => !t.has(o));
6442
- r.length > 0 && this.emit(zn, { ids: r });
6467
+ r.length > 0 && this.emit(Bn, { ids: r });
6443
6468
  }
6444
6469
  }
6445
6470
  ), this.store.subscribe(
6446
6471
  (t) => t.drawingFeature,
6447
6472
  (t, n) => {
6448
- t === null && n !== null && this.emit(Ve, { id: n });
6473
+ t === null && n !== null && this.emit(Ze, { id: n });
6449
6474
  }
6450
6475
  ), this.store.subscribe(
6451
6476
  (t) => t.features,
6452
6477
  (t, n) => {
6453
6478
  for (const s of Object.keys(t))
6454
- n[s] ? n[s] !== t[s] && this.emit($n, t[s]) : this.emit(oe, { id: s });
6479
+ n[s] ? n[s] !== t[s] && this.emit(Nn, t[s]) : this.emit(ae, { id: s });
6455
6480
  for (const s of Object.keys(n))
6456
- t[s] || this.emit(Bn, { id: s });
6481
+ t[s] || this.emit(Rn, { id: s });
6457
6482
  }
6458
6483
  );
6459
6484
  }
@@ -6542,7 +6567,7 @@ class Zr extends _n {
6542
6567
  */
6543
6568
  cancelDrawing() {
6544
6569
  var t;
6545
- return this.drawing.cancelPendingDrawing(), (t = this.editor.getActiveHandler()) == null || t.cancelDrawing(), this.emit(Rn), this;
6570
+ return this.drawing.cancelPendingDrawing(), (t = this.editor.getActiveHandler()) == null || t.cancelDrawing(), this.emit($n), this;
6546
6571
  }
6547
6572
  /**
6548
6573
  * Enable arrow drawing mode - the recommended way to add arrows.
@@ -6977,120 +7002,120 @@ class Zr extends _n {
6977
7002
  export {
6978
7003
  at as COMMENT_MODE_COLLAPSED,
6979
7004
  Rt as COMMENT_MODE_EXPANDED,
6980
- Zr as Control,
6981
- Ar as DATA_ATTR,
6982
- Qe as DEFAULT_EDIT_ICON,
6983
- Je as DEFAULT_SEND_ICON,
6984
- oe as EVT_ADD,
6985
- Rn as EVT_CANCEL_DRAWING,
6986
- re as EVT_CLICK,
6987
- Ve as EVT_COMPLETE_DRAWING,
7005
+ Kr as Control,
7006
+ Er as DATA_ATTR,
7007
+ tn as DEFAULT_EDIT_ICON,
7008
+ Qe as DEFAULT_SEND_ICON,
7009
+ ae as EVT_ADD,
7010
+ $n as EVT_CANCEL_DRAWING,
7011
+ oe as EVT_CLICK,
7012
+ Ze as EVT_COMPLETE_DRAWING,
6988
7013
  Ut as EVT_DRAG,
6989
7014
  Bt as EVT_DRAG_END,
6990
7015
  Ct as EVT_DRAG_START,
6991
- Yn as EVT_HISTORY,
6992
- vr as EVT_HOVER,
6993
- Nn as EVT_LINK,
6994
- Bn as EVT_REMOVE,
6995
- In as EVT_SELECT,
6996
- Sr as EVT_UNHOVER,
6997
- zn as EVT_UNSELECT,
6998
- $n as EVT_UPDATE,
6999
- Ke as HL_BRIGHTEN,
7000
- de as LAYERS,
7001
- br as NONE,
7016
+ On as EVT_HISTORY,
7017
+ Sr as EVT_HOVER,
7018
+ Yn as EVT_LINK,
7019
+ Rn as EVT_REMOVE,
7020
+ zn as EVT_SELECT,
7021
+ Ar as EVT_UNHOVER,
7022
+ Bn as EVT_UNSELECT,
7023
+ Nn as EVT_UPDATE,
7024
+ Je as HL_BRIGHTEN,
7025
+ ue as LAYERS,
7026
+ vr as NONE,
7002
7027
  it as SIDE_END,
7003
- O as SIDE_START,
7028
+ X as SIDE_START,
7004
7029
  T as TARGET_TYPES,
7005
7030
  $t as TEXT_LINE_HEIGHT,
7006
- on as adjustColorBrightness,
7007
- qr as asColor,
7008
- Wr as asHexColor,
7009
- jr as asRgbColor,
7010
- Gr as asRgbaColor,
7031
+ an as adjustColorBrightness,
7032
+ Wr as asColor,
7033
+ jr as asHexColor,
7034
+ Gr as asRgbColor,
7035
+ Vr as asRgbaColor,
7011
7036
  Ft as brighten,
7012
- rs as calculateCommentZoomThreshold,
7013
- Vr as canDetachArrowEnd,
7014
- ws as canDetachArrowStart,
7037
+ os as calculateCommentZoomThreshold,
7038
+ Zr as canDetachArrowEnd,
7039
+ xs as canDetachArrowStart,
7015
7040
  It as clientToContainerPosition,
7016
- Dr as colorToRgba,
7041
+ Lr as colorToRgba,
7017
7042
  Yt as createArrow,
7018
- be as createBox,
7019
- ln as createComment,
7020
- Or as createCommentWithArrow,
7021
- cs as createPolygon,
7043
+ ve as createBox,
7044
+ hn as createComment,
7045
+ Ur as createCommentWithArrow,
7046
+ ls as createPolygon,
7022
7047
  M as createSVGElement,
7023
- ve as createText,
7048
+ Se as createText,
7024
7049
  I as cursors,
7025
- Ir as darken,
7026
- Hr as debounce,
7027
- _r as debounceTail,
7028
- zr as defaultArrowOptions,
7050
+ zr as darken,
7051
+ _r as debounce,
7052
+ Ir as debounceTail,
7053
+ Br as defaultArrowOptions,
7029
7054
  yt as defaultArrowStyle,
7030
- Br as defaultBoxOptions,
7055
+ Rr as defaultBoxOptions,
7031
7056
  Mt as defaultBoxStyle,
7032
- jt as defaultCommentOptions,
7033
- J as defaultCommentStyle,
7034
- Ur as defaultPolygonProperties,
7057
+ Gt as defaultCommentOptions,
7058
+ V as defaultCommentStyle,
7059
+ qr as defaultPolygonProperties,
7035
7060
  lt as defaultPolygonStyle,
7036
- Rr as defaultTextOptions,
7037
- U as defaultTextStyle,
7038
- an as detectArrow,
7039
- ss as detectBox,
7040
- is as detectComment,
7041
- hn as detectPolygon,
7042
- cn as detectText,
7043
- Tr as getAnnotationsBounds,
7044
- sn as getArrowEnd,
7045
- ue as getArrowEndPoints,
7061
+ $r as defaultTextOptions,
7062
+ G as defaultTextStyle,
7063
+ cn as detectArrow,
7064
+ is as detectBox,
7065
+ rs as detectComment,
7066
+ dn as detectPolygon,
7067
+ ln as detectText,
7068
+ Fr as getAnnotationsBounds,
7069
+ rn as getArrowEnd,
7070
+ ge as getArrowEndPoints,
7046
7071
  Ht as getArrowSide,
7047
- nn as getArrowStart,
7048
- Pr as getAttachmentPointOnNode,
7072
+ sn as getArrowStart,
7073
+ Dr as getAttachmentPointOnNode,
7049
7074
  rt as getBbox,
7050
7075
  Q as getBoxCenter,
7051
7076
  St as getBoxPosition,
7052
7077
  q as getBoxSize,
7053
- we as getBrowserWindow,
7054
- Nr as getCommentPosition,
7055
- Yr as getCommentSize,
7078
+ xe as getBrowserWindow,
7079
+ Yr as getCommentPosition,
7080
+ Or as getCommentSize,
7056
7081
  Xr as getCommentZoomThreshold,
7057
7082
  _t as getCoordinates,
7058
- Mr as getHandleId,
7059
- ye as getPolygonBounds,
7060
- tn as getPolygonCenter,
7083
+ Tr as getHandleId,
7084
+ we as getPolygonBounds,
7085
+ en as getPolygonCenter,
7061
7086
  rt as getTextBbox,
7062
7087
  St as getTextPosition,
7063
7088
  q as getTextSize,
7064
- Ze as handleDetectionThreshold,
7089
+ Ke as handleDetectionThreshold,
7065
7090
  Xn as handleRadius,
7066
- ge as hexShortToLong,
7067
- Jn as hexToRgba,
7068
- Se as isAnnotationCollection,
7091
+ fe as hexShortToLong,
7092
+ Qn as hexToRgba,
7093
+ Ae as isAnnotationCollection,
7069
7094
  tt as isArrow,
7070
7095
  W as isBox,
7071
- ls as isColor,
7072
- D as isComment,
7073
- ys as isCommentArrow,
7074
- dn as isHexColor,
7075
- nt as isPolygon,
7076
- un as isRgbColor,
7077
- gn as isRgbaColor,
7096
+ hs as isColor,
7097
+ P as isComment,
7098
+ ws as isCommentArrow,
7099
+ un as isHexColor,
7100
+ st as isPolygon,
7101
+ gn as isRgbColor,
7102
+ fn as isRgbaColor,
7078
7103
  _ as isText,
7079
- ts as migrateBoxOrTextIfNeeded,
7080
- Lr as parseColor,
7081
- Qn as rgbToRgba,
7082
- Fr as scaleGeometry,
7083
- Cr as scalePolygon,
7084
- Vn as setArrowEnd,
7085
- Zn as setArrowEndPoint,
7086
- Gn as setArrowStart,
7087
- kr as setBbox,
7088
- kr as setTextBbox,
7089
- me as simplifyPolygon,
7090
- rn as throttle,
7091
- $r as toggleCommentMode,
7092
- Er as translatePolygon,
7104
+ es as migrateBoxOrTextIfNeeded,
7105
+ Hr as parseColor,
7106
+ ts as rgbToRgba,
7107
+ Pr as scaleGeometry,
7108
+ kr as scalePolygon,
7109
+ Zn as setArrowEnd,
7110
+ Kn as setArrowEndPoint,
7111
+ Vn as setArrowStart,
7112
+ Mr as setBbox,
7113
+ Mr as setTextBbox,
7114
+ ye as simplifyPolygon,
7115
+ on as throttle,
7116
+ Nr as toggleCommentMode,
7117
+ Cr as translatePolygon,
7093
7118
  kt as updateBbox,
7094
- en as updatePolygonBbox,
7119
+ nn as updatePolygonBbox,
7095
7120
  kt as updateTextBbox
7096
7121
  };