@linkurious/ogma-annotations-react 1.1.24 → 1.1.26

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,648 +1,20 @@
1
- import $r, { createContext as jr, useContext as Kr, useReducer as Zr, useState as Nt, useEffect as nr } from "react";
2
- import { useOgma as Qr } from "@linkurious/ogma-react";
3
- var Pe = { exports: {} }, he = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.min.js
7
- *
8
- * Copyright (c) Facebook, Inc. and its affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var fr;
14
- function tn() {
15
- if (fr) return he;
16
- fr = 1;
17
- var u = $r, e = Symbol.for("react.element"), o = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, l = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function d(g, f, v) {
19
- var y, A = {}, k = null, S = null;
20
- v !== void 0 && (k = "" + v), f.key !== void 0 && (k = "" + f.key), f.ref !== void 0 && (S = f.ref);
21
- for (y in f) n.call(f, y) && !h.hasOwnProperty(y) && (A[y] = f[y]);
22
- if (g && g.defaultProps) for (y in f = g.defaultProps, f) A[y] === void 0 && (A[y] = f[y]);
23
- return { $$typeof: e, type: g, key: k, ref: S, props: A, _owner: l.current };
24
- }
25
- return he.Fragment = o, he.jsx = d, he.jsxs = d, he;
26
- }
27
- var ce = {};
28
- /**
29
- * @license React
30
- * react-jsx-runtime.development.js
31
- *
32
- * Copyright (c) Facebook, Inc. and its affiliates.
33
- *
34
- * This source code is licensed under the MIT license found in the
35
- * LICENSE file in the root directory of this source tree.
36
- */
37
- var gr;
38
- function en() {
39
- return gr || (gr = 1, process.env.NODE_ENV !== "production" && function() {
40
- var u = $r, e = Symbol.for("react.element"), o = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), d = Symbol.for("react.provider"), g = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), R = Symbol.iterator, C = "@@iterator";
41
- function L(t) {
42
- if (t === null || typeof t != "object")
43
- return null;
44
- var s = R && t[R] || t[C];
45
- return typeof s == "function" ? s : null;
46
- }
47
- var $ = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
48
- function _(t) {
49
- {
50
- for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
51
- c[p - 1] = arguments[p];
52
- z("error", t, c);
53
- }
54
- }
55
- function z(t, s, c) {
56
- {
57
- var p = $.ReactDebugCurrentFrame, m = p.getStackAddendum();
58
- m !== "" && (s += "%s", c = c.concat([m]));
59
- var w = c.map(function(b) {
60
- return String(b);
61
- });
62
- w.unshift("Warning: " + s), Function.prototype.apply.call(console[t], console, w);
63
- }
64
- }
65
- var B = !1, tt = !1, rt = !1, Yt = !1, Vt = !1, ge;
66
- ge = Symbol.for("react.module.reference");
67
- function Dt(t) {
68
- return !!(typeof t == "string" || typeof t == "function" || t === n || t === h || Vt || t === l || t === v || t === y || Yt || t === S || B || tt || rt || typeof t == "object" && t !== null && (t.$$typeof === k || t.$$typeof === A || t.$$typeof === d || t.$$typeof === g || t.$$typeof === f || // This needs to include all possible module reference object
69
- // types supported by any Flight configuration anywhere since
70
- // we don't know which Flight build this will end up being used
71
- // with.
72
- t.$$typeof === ge || t.getModuleId !== void 0));
73
- }
74
- function Pt(t, s, c) {
75
- var p = t.displayName;
76
- if (p)
77
- return p;
78
- var m = s.displayName || s.name || "";
79
- return m !== "" ? c + "(" + m + ")" : c;
80
- }
81
- function pe(t) {
82
- return t.displayName || "Context";
83
- }
84
- function it(t) {
85
- if (t == null)
86
- return null;
87
- if (typeof t.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
88
- return t.displayName || t.name || null;
89
- if (typeof t == "string")
90
- return t;
91
- switch (t) {
92
- case n:
93
- return "Fragment";
94
- case o:
95
- return "Portal";
96
- case h:
97
- return "Profiler";
98
- case l:
99
- return "StrictMode";
100
- case v:
101
- return "Suspense";
102
- case y:
103
- return "SuspenseList";
104
- }
105
- if (typeof t == "object")
106
- switch (t.$$typeof) {
107
- case g:
108
- var s = t;
109
- return pe(s) + ".Consumer";
110
- case d:
111
- var c = t;
112
- return pe(c._context) + ".Provider";
113
- case f:
114
- return Pt(t, t.render, "ForwardRef");
115
- case A:
116
- var p = t.displayName || null;
117
- return p !== null ? p : it(t.type) || "Memo";
118
- case k: {
119
- var m = t, w = m._payload, b = m._init;
120
- try {
121
- return it(b(w));
122
- } catch {
123
- return null;
124
- }
125
- }
126
- }
127
- return null;
128
- }
129
- var M = Object.assign, lt = 0, X, ut, Lt, ye, Xt, ve, me;
130
- function kt() {
131
- }
132
- kt.__reactDisabledLog = !0;
133
- function be() {
134
- {
135
- if (lt === 0) {
136
- X = console.log, ut = console.info, Lt = console.warn, ye = console.error, Xt = console.group, ve = console.groupCollapsed, me = console.groupEnd;
137
- var t = {
138
- configurable: !0,
139
- enumerable: !0,
140
- value: kt,
141
- writable: !0
142
- };
143
- Object.defineProperties(console, {
144
- info: t,
145
- log: t,
146
- warn: t,
147
- error: t,
148
- group: t,
149
- groupCollapsed: t,
150
- groupEnd: t
151
- });
152
- }
153
- lt++;
154
- }
155
- }
156
- function Be() {
157
- {
158
- if (lt--, lt === 0) {
159
- var t = {
160
- configurable: !0,
161
- enumerable: !0,
162
- writable: !0
163
- };
164
- Object.defineProperties(console, {
165
- log: M({}, t, {
166
- value: X
167
- }),
168
- info: M({}, t, {
169
- value: ut
170
- }),
171
- warn: M({}, t, {
172
- value: Lt
173
- }),
174
- error: M({}, t, {
175
- value: ye
176
- }),
177
- group: M({}, t, {
178
- value: Xt
179
- }),
180
- groupCollapsed: M({}, t, {
181
- value: ve
182
- }),
183
- groupEnd: M({}, t, {
184
- value: me
185
- })
186
- });
187
- }
188
- lt < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
- }
190
- }
191
- var Gt = $.ReactCurrentDispatcher, Jt;
192
- function It(t, s, c) {
193
- {
194
- if (Jt === void 0)
195
- try {
196
- throw Error();
197
- } catch (m) {
198
- var p = m.stack.trim().match(/\n( *(at )?)/);
199
- Jt = p && p[1] || "";
200
- }
201
- return `
202
- ` + Jt + t;
203
- }
204
- }
205
- var Kt = !1, _t;
206
- {
207
- var qe = typeof WeakMap == "function" ? WeakMap : Map;
208
- _t = new qe();
209
- }
210
- function Zt(t, s) {
211
- if (!t || Kt)
212
- return "";
213
- {
214
- var c = _t.get(t);
215
- if (c !== void 0)
216
- return c;
217
- }
218
- var p;
219
- Kt = !0;
220
- var m = Error.prepareStackTrace;
221
- Error.prepareStackTrace = void 0;
222
- var w;
223
- w = Gt.current, Gt.current = null, be();
224
- try {
225
- if (s) {
226
- var b = function() {
227
- throw Error();
228
- };
229
- if (Object.defineProperty(b.prototype, "props", {
230
- set: function() {
231
- throw Error();
232
- }
233
- }), typeof Reflect == "object" && Reflect.construct) {
234
- try {
235
- Reflect.construct(b, []);
236
- } catch (P) {
237
- p = P;
238
- }
239
- Reflect.construct(t, [], b);
240
- } else {
241
- try {
242
- b.call();
243
- } catch (P) {
244
- p = P;
245
- }
246
- t.call(b.prototype);
247
- }
248
- } else {
249
- try {
250
- throw Error();
251
- } catch (P) {
252
- p = P;
253
- }
254
- t();
255
- }
256
- } catch (P) {
257
- if (P && p && typeof P.stack == "string") {
258
- for (var E = P.stack.split(`
259
- `), D = p.stack.split(`
260
- `), T = E.length - 1, O = D.length - 1; T >= 1 && O >= 0 && E[T] !== D[O]; )
261
- O--;
262
- for (; T >= 1 && O >= 0; T--, O--)
263
- if (E[T] !== D[O]) {
264
- if (T !== 1 || O !== 1)
265
- do
266
- if (T--, O--, O < 0 || E[T] !== D[O]) {
267
- var j = `
268
- ` + E[T].replace(" at new ", " at ");
269
- return t.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", t.displayName)), typeof t == "function" && _t.set(t, j), j;
270
- }
271
- while (T >= 1 && O >= 0);
272
- break;
273
- }
274
- }
275
- } finally {
276
- Kt = !1, Gt.current = w, Be(), Error.prepareStackTrace = m;
277
- }
278
- var W = t ? t.displayName || t.name : "", F = W ? It(W) : "";
279
- return typeof t == "function" && _t.set(t, F), F;
280
- }
281
- function We(t, s, c) {
282
- return Zt(t, !1);
283
- }
284
- function Ue(t) {
285
- var s = t.prototype;
286
- return !!(s && s.isReactComponent);
287
- }
288
- function $t(t, s, c) {
289
- if (t == null)
290
- return "";
291
- if (typeof t == "function")
292
- return Zt(t, Ue(t));
293
- if (typeof t == "string")
294
- return It(t);
295
- switch (t) {
296
- case v:
297
- return It("Suspense");
298
- case y:
299
- return It("SuspenseList");
300
- }
301
- if (typeof t == "object")
302
- switch (t.$$typeof) {
303
- case f:
304
- return We(t.render);
305
- case A:
306
- return $t(t.type, s, c);
307
- case k: {
308
- var p = t, m = p._payload, w = p._init;
309
- try {
310
- return $t(w(m), s, c);
311
- } catch {
312
- }
313
- }
314
- }
315
- return "";
316
- }
317
- var bt = Object.prototype.hasOwnProperty, we = {}, xe = $.ReactDebugCurrentFrame;
318
- function jt(t) {
319
- if (t) {
320
- var s = t._owner, c = $t(t.type, t._source, s ? s.type : null);
321
- xe.setExtraStackFrame(c);
322
- } else
323
- xe.setExtraStackFrame(null);
324
- }
325
- function Ye(t, s, c, p, m) {
326
- {
327
- var w = Function.call.bind(bt);
328
- for (var b in t)
329
- if (w(t, b)) {
330
- var E = void 0;
331
- try {
332
- if (typeof t[b] != "function") {
333
- var D = Error((p || "React class") + ": " + c + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
- throw D.name = "Invariant Violation", D;
335
- }
336
- E = t[b](s, b, p, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
337
- } catch (T) {
338
- E = T;
339
- }
340
- E && !(E instanceof Error) && (jt(m), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", c, b, typeof E), jt(null)), E instanceof Error && !(E.message in we) && (we[E.message] = !0, jt(m), _("Failed %s type: %s", c, E.message), jt(null));
341
- }
342
- }
343
- }
344
- var Ve = Array.isArray;
345
- function Qt(t) {
346
- return Ve(t);
347
- }
348
- function q(t) {
349
- {
350
- var s = typeof Symbol == "function" && Symbol.toStringTag, c = s && t[Symbol.toStringTag] || t.constructor.name || "Object";
351
- return c;
352
- }
353
- }
354
- function Xe(t) {
355
- try {
356
- return Ee(t), !1;
357
- } catch {
358
- return !0;
359
- }
360
- }
361
- function Ee(t) {
362
- return "" + t;
363
- }
364
- function te(t) {
365
- if (Xe(t))
366
- return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", q(t)), Ee(t);
367
- }
368
- var ct = $.ReactCurrentOwner, Ae = {
369
- key: !0,
370
- ref: !0,
371
- __self: !0,
372
- __source: !0
373
- }, Ft, ke;
374
- function Ge(t) {
375
- if (bt.call(t, "ref")) {
376
- var s = Object.getOwnPropertyDescriptor(t, "ref").get;
377
- if (s && s.isReactWarning)
378
- return !1;
379
- }
380
- return t.ref !== void 0;
381
- }
382
- function ee(t) {
383
- if (bt.call(t, "key")) {
384
- var s = Object.getOwnPropertyDescriptor(t, "key").get;
385
- if (s && s.isReactWarning)
386
- return !1;
387
- }
388
- return t.key !== void 0;
389
- }
390
- function Je(t, s) {
391
- typeof t.ref == "string" && ct.current;
392
- }
393
- function Ke(t, s) {
394
- {
395
- var c = function() {
396
- Ft || (Ft = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
397
- };
398
- c.isReactWarning = !0, Object.defineProperty(t, "key", {
399
- get: c,
400
- configurable: !0
401
- });
402
- }
403
- }
404
- function Ze(t, s) {
405
- {
406
- var c = function() {
407
- ke || (ke = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
408
- };
409
- c.isReactWarning = !0, Object.defineProperty(t, "ref", {
410
- get: c,
411
- configurable: !0
412
- });
413
- }
414
- }
415
- var re = function(t, s, c, p, m, w, b) {
416
- var E = {
417
- // This tag allows us to uniquely identify this as a React Element
418
- $$typeof: e,
419
- // Built-in properties that belong on the element
420
- type: t,
421
- key: s,
422
- ref: c,
423
- props: b,
424
- // Record the component responsible for creating this element.
425
- _owner: w
426
- };
427
- return E._store = {}, Object.defineProperty(E._store, "validated", {
428
- configurable: !1,
429
- enumerable: !1,
430
- writable: !0,
431
- value: !1
432
- }), Object.defineProperty(E, "_self", {
433
- configurable: !1,
434
- enumerable: !1,
435
- writable: !1,
436
- value: p
437
- }), Object.defineProperty(E, "_source", {
438
- configurable: !1,
439
- enumerable: !1,
440
- writable: !1,
441
- value: m
442
- }), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
443
- };
444
- function _e(t, s, c, p, m) {
445
- {
446
- var w, b = {}, E = null, D = null;
447
- c !== void 0 && (te(c), E = "" + c), ee(s) && (te(s.key), E = "" + s.key), Ge(s) && (D = s.ref, Je(s, m));
448
- for (w in s)
449
- bt.call(s, w) && !Ae.hasOwnProperty(w) && (b[w] = s[w]);
450
- if (t && t.defaultProps) {
451
- var T = t.defaultProps;
452
- for (w in T)
453
- b[w] === void 0 && (b[w] = T[w]);
454
- }
455
- if (E || D) {
456
- var O = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
457
- E && Ke(b, O), D && Ze(b, O);
458
- }
459
- return re(t, E, D, m, p, ct.current, b);
460
- }
461
- }
462
- var dt = $.ReactCurrentOwner, Se = $.ReactDebugCurrentFrame;
463
- function wt(t) {
464
- if (t) {
465
- var s = t._owner, c = $t(t.type, t._source, s ? s.type : null);
466
- Se.setExtraStackFrame(c);
467
- } else
468
- Se.setExtraStackFrame(null);
469
- }
470
- var St;
471
- St = !1;
472
- function G(t) {
473
- return typeof t == "object" && t !== null && t.$$typeof === e;
474
- }
475
- function xt() {
476
- {
477
- if (dt.current) {
478
- var t = it(dt.current.type);
479
- if (t)
480
- return `
481
-
482
- Check the render method of \`` + t + "`.";
483
- }
484
- return "";
485
- }
486
- }
487
- function ne(t) {
488
- return "";
489
- }
490
- var Ce = {};
491
- function Te(t) {
492
- {
493
- var s = xt();
494
- if (!s) {
495
- var c = typeof t == "string" ? t : t.displayName || t.name;
496
- c && (s = `
497
-
498
- Check the top-level render call using <` + c + ">.");
499
- }
500
- return s;
501
- }
502
- }
503
- function ie(t, s) {
504
- {
505
- if (!t._store || t._store.validated || t.key != null)
506
- return;
507
- t._store.validated = !0;
508
- var c = Te(s);
509
- if (Ce[c])
510
- return;
511
- Ce[c] = !0;
512
- var p = "";
513
- t && t._owner && t._owner !== dt.current && (p = " It was passed a child from " + it(t._owner.type) + "."), wt(t), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, p), wt(null);
514
- }
515
- }
516
- function Re(t, s) {
517
- {
518
- if (typeof t != "object")
519
- return;
520
- if (Qt(t))
521
- for (var c = 0; c < t.length; c++) {
522
- var p = t[c];
523
- G(p) && ie(p, s);
524
- }
525
- else if (G(t))
526
- t._store && (t._store.validated = !0);
527
- else if (t) {
528
- var m = L(t);
529
- if (typeof m == "function" && m !== t.entries)
530
- for (var w = m.call(t), b; !(b = w.next()).done; )
531
- G(b.value) && ie(b.value, s);
532
- }
533
- }
534
- }
535
- function oe(t) {
536
- {
537
- var s = t.type;
538
- if (s == null || typeof s == "string")
539
- return;
540
- var c;
541
- if (typeof s == "function")
542
- c = s.propTypes;
543
- else if (typeof s == "object" && (s.$$typeof === f || // Note: Memo only checks outer props here.
544
- // Inner props are checked in the reconciler.
545
- s.$$typeof === A))
546
- c = s.propTypes;
547
- else
548
- return;
549
- if (c) {
550
- var p = it(s);
551
- Ye(c, t.props, "prop", p, t);
552
- } else if (s.PropTypes !== void 0 && !St) {
553
- St = !0;
554
- var m = it(s);
555
- _("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
556
- }
557
- typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
558
- }
559
- }
560
- function Qe(t) {
561
- {
562
- for (var s = Object.keys(t.props), c = 0; c < s.length; c++) {
563
- var p = s[c];
564
- if (p !== "children" && p !== "key") {
565
- wt(t), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), wt(null);
566
- break;
567
- }
568
- }
569
- t.ref !== null && (wt(t), _("Invalid attribute `ref` supplied to `React.Fragment`."), wt(null));
570
- }
571
- }
572
- var se = {};
573
- function ae(t, s, c, p, m, w) {
574
- {
575
- var b = Dt(t);
576
- if (!b) {
577
- var E = "";
578
- (t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
579
- var D = ne();
580
- D ? E += D : E += xt();
581
- var T;
582
- t === null ? T = "null" : Qt(t) ? T = "array" : t !== void 0 && t.$$typeof === e ? (T = "<" + (it(t.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : T = typeof t, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, E);
583
- }
584
- var O = _e(t, s, c, m, w);
585
- if (O == null)
586
- return O;
587
- if (b) {
588
- var j = s.children;
589
- if (j !== void 0)
590
- if (p)
591
- if (Qt(j)) {
592
- for (var W = 0; W < j.length; W++)
593
- Re(j[W], t);
594
- Object.freeze && Object.freeze(j);
595
- } else
596
- _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
597
- else
598
- Re(j, t);
599
- }
600
- if (bt.call(s, "key")) {
601
- var F = it(t), P = Object.keys(s).filter(function(J) {
602
- return J !== "key";
603
- }), H = P.length > 0 ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}";
604
- if (!se[F + H]) {
605
- var N = P.length > 0 ? "{" + P.join(": ..., ") + ": ...}" : "{}";
606
- _(`A props object containing a "key" prop is being spread into JSX:
607
- let props = %s;
608
- <%s {...props} />
609
- React keys must be passed directly to JSX without using spread:
610
- let props = %s;
611
- <%s key={someKey} {...props} />`, H, F, N, F), se[F + H] = !0;
612
- }
613
- }
614
- return t === n ? Qe(O) : oe(O), O;
615
- }
616
- }
617
- function tr(t, s, c) {
618
- return ae(t, s, c, !0);
619
- }
620
- function r(t, s, c) {
621
- return ae(t, s, c, !1);
622
- }
623
- var i = r, a = tr;
624
- ce.Fragment = n, ce.jsx = i, ce.jsxs = a;
625
- }()), ce;
626
- }
627
- var pr;
628
- function rn() {
629
- return pr || (pr = 1, process.env.NODE_ENV === "production" ? Pe.exports = tn() : Pe.exports = en()), Pe.exports;
630
- }
631
- var nn = rn(), on = Object.defineProperty, sn = (u, e, o) => e in u ? on(u, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : u[e] = o, x = (u, e, o) => sn(u, typeof e != "symbol" ? e + "" : e, o);
632
- let He = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((e, o) => (o &= 63, o < 36 ? e += o.toString(36) : o < 62 ? e += (o - 26).toString(36).toUpperCase() : o > 62 ? e += "-" : e += "_", e), "");
633
- const fe = {
1
+ import Wr, { createContext as Ye, useContext as Ur, useReducer as Xr, useState as Et, useEffect as he } from "react";
2
+ import { useOgma as Gr } from "@linkurious/ogma-react";
3
+ var Vr = Object.defineProperty, Zr = (l, t, i) => t in l ? Vr(l, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[t] = i, m = (l, t, i) => Zr(l, typeof t != "symbol" ? t + "" : t, i);
4
+ let Jt = (l = 21) => crypto.getRandomValues(new Uint8Array(l)).reduce((t, i) => (i &= 63, i < 36 ? t += i.toString(36) : i < 62 ? t += (i - 26).toString(36).toUpperCase() : i > 62 ? t += "-" : t += "_", t), "");
5
+ const Pt = {
634
6
  strokeType: "plain",
635
7
  strokeColor: "#202020",
636
8
  strokeWidth: 1,
637
9
  head: "none",
638
10
  tail: "none"
639
- }, yr = {
11
+ }, $e = {
640
12
  id: 0,
641
13
  type: "Feature",
642
14
  properties: {
643
15
  type: "arrow",
644
16
  style: {
645
- ...fe
17
+ ...Pt
646
18
  }
647
19
  },
648
20
  geometry: {
@@ -662,310 +34,310 @@ const fe = {
662
34
  // tail: 'arrow-plain',
663
35
  // start: { x: 0, y: 0 },
664
36
  // end: { x: 100, y: 100 }
665
- }, an = (u = 0, e = 0, o = 0, n = 0, l = { ...fe }) => ({
666
- id: He(),
37
+ }, Yr = (l = 0, t = 0, i = 0, r = 0, a = { ...Pt }) => ({
38
+ id: Jt(),
667
39
  type: "Feature",
668
40
  properties: {
669
41
  type: "arrow",
670
42
  style: {
671
- ...fe,
672
- ...l
43
+ ...Pt,
44
+ ...a
673
45
  }
674
46
  },
675
47
  geometry: {
676
48
  type: "LineString",
677
49
  coordinates: [
678
- [u, e],
679
- [o, n]
50
+ [l, t],
51
+ [i, r]
680
52
  ]
681
53
  }
682
- }), ln = "http://www.w3.org/2000/svg";
683
- function Rt(u) {
684
- return document.createElementNS(ln, u);
54
+ }), Jr = "http://www.w3.org/2000/svg";
55
+ function wt(l) {
56
+ return document.createElementNS(Jr, l);
685
57
  }
686
- function Fr(u) {
687
- return u.geometry.bbox || un(u), u.geometry.bbox;
58
+ function Je(l) {
59
+ return l.geometry.bbox || Kr(l), l.geometry.bbox;
688
60
  }
689
- function mt(u) {
690
- const e = Fr(u);
61
+ function ft(l) {
62
+ const t = Je(l);
691
63
  return {
692
- width: e[2] - e[0],
693
- height: e[3] - e[1]
64
+ width: t[2] - t[0],
65
+ height: t[3] - t[1]
694
66
  };
695
67
  }
696
- function vt(u) {
697
- const e = Fr(u);
698
- return { x: e[0], y: e[1] };
68
+ function dt(l) {
69
+ const t = Je(l);
70
+ return { x: t[0], y: t[1] };
699
71
  }
700
- function un(u) {
701
- const [e, o] = u.geometry.coordinates[0][0], [n, l] = u.geometry.coordinates[0][2];
702
- u.geometry.bbox = [e, o, n, l];
72
+ function Kr(l) {
73
+ const [t, i] = l.geometry.coordinates[0][0], [r, a] = l.geometry.coordinates[0][2];
74
+ l.geometry.bbox = [t, i, r, a];
703
75
  }
704
- function hn(u, e, o, n, l) {
705
- u.geometry.bbox = [e, o, e + n, o + l], u.geometry.coordinates = [
76
+ function Qr(l, t, i, r, a) {
77
+ l.geometry.bbox = [t, i, t + r, i + a], l.geometry.coordinates = [
706
78
  [
707
- [e, o],
708
- [e + n, o],
709
- [e + n, o + l],
710
- [e, o + l],
711
- [e, o]
79
+ [t, i],
80
+ [t + r, i],
81
+ [t + r, i + a],
82
+ [t, i + a],
83
+ [t, i]
712
84
  ]
713
85
  ];
714
86
  }
715
- function de(u) {
716
- const [e, o] = u.geometry.coordinates[0];
717
- return { x: e, y: o };
87
+ function zt(l) {
88
+ const [t, i] = l.geometry.coordinates[0];
89
+ return { x: t, y: i };
718
90
  }
719
- function Le(u, e) {
720
- const [o, n] = u.geometry.coordinates[e === "start" ? 0 : 1];
721
- return { x: o, y: n };
91
+ function Rt(l, t) {
92
+ const [i, r] = l.geometry.coordinates[t === "start" ? 0 : 1];
93
+ return { x: i, y: r };
722
94
  }
723
- function je(u) {
724
- const [e, o] = u.geometry.coordinates[1];
725
- return { x: e, y: o };
95
+ function Xt(l) {
96
+ const [t, i] = l.geometry.coordinates[1];
97
+ return { x: t, y: i };
726
98
  }
727
- function Mr(u, e, o) {
728
- u.geometry.coordinates[0] = [e, o];
99
+ function Ke(l, t, i) {
100
+ l.geometry.coordinates[0] = [t, i];
729
101
  }
730
- function zr(u, e, o) {
731
- u.geometry.coordinates[1] = [e, o];
102
+ function Qe(l, t, i) {
103
+ l.geometry.coordinates[1] = [t, i];
732
104
  }
733
- function Fe(u) {
734
- return { start: de(u), end: je(u) };
105
+ function Gt(l) {
106
+ return { start: zt(l), end: Xt(l) };
735
107
  }
736
- function Ht(u, e, o, n) {
737
- e === "start" ? Mr(u, o, n) : zr(u, o, n);
108
+ function St(l, t, i, r) {
109
+ t === "start" ? Ke(l, i, r) : Qe(l, i, r);
738
110
  }
739
- const Nr = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
740
- function cn(u) {
741
- return Array.isArray(u) && u.length === 2 && u.every(isFinite);
111
+ const tr = (l) => parseInt(l.getAttribute("data-handle-id") || "-1");
112
+ function tn(l) {
113
+ return Array.isArray(l) && l.length === 2 && l.every(isFinite);
742
114
  }
743
- function dn(u, e, o, n) {
744
- for (let l = 0; l < u.coordinates.length; l++) {
745
- const h = u.coordinates[l];
746
- if (cn(h))
747
- h[0] = o + (h[0] - o) * e, h[1] = n + (h[1] - n) * e;
115
+ function en(l, t, i, r) {
116
+ for (let a = 0; a < l.coordinates.length; a++) {
117
+ const h = l.coordinates[a];
118
+ if (tn(h))
119
+ h[0] = i + (h[0] - i) * t, h[1] = r + (h[1] - r) * t;
748
120
  else
749
- for (let d = 0; d < h.length; d++) {
750
- const g = h[d];
751
- g[0] = o + (g[0] - o) * e, g[1] = n + (g[1] - n) * e;
121
+ for (let c = 0; c < h.length; c++) {
122
+ const d = h[c];
123
+ d[0] = i + (d[0] - i) * t, d[1] = r + (d[1] - r) * t;
752
124
  }
753
125
  }
754
- return u;
126
+ return l;
755
127
  }
756
- function Ie(u, e, o) {
757
- const n = Math.atan2(u.y - e.y, u.x - e.x);
128
+ function Wt(l, t, i) {
129
+ const r = Math.atan2(l.y - t.y, l.x - t.x);
758
130
  return {
759
- x: e.x + o * Math.cos(n),
760
- y: e.y + o * Math.sin(n)
131
+ x: t.x + i * Math.cos(r),
132
+ y: t.y + i * Math.sin(r)
761
133
  };
762
134
  }
763
- function Me(u, e) {
764
- if (!e) return { x: u.clientX, y: u.clientY };
765
- const o = e.getBoundingClientRect();
135
+ function Vt(l, t) {
136
+ if (!t) return { x: l.clientX, y: l.clientY };
137
+ const i = t.getBoundingClientRect();
766
138
  return {
767
- x: u.clientX - o.left - e.clientLeft,
768
- y: u.clientY - o.top - e.clientTop
139
+ x: l.clientX - i.left - t.clientLeft,
140
+ y: l.clientY - i.top - t.clientTop
769
141
  };
770
142
  }
771
- const Ot = (u, e) => ({
772
- x: u.x - e.x,
773
- y: u.y - e.y
774
- }), qt = (u) => Math.sqrt(u.x * u.x + u.y * u.y), Hr = (u) => ({
775
- x: -u.x,
776
- y: -u.y
777
- }), Br = (u) => {
778
- const e = qt(u);
779
- return e === 0 ? { x: 0, y: 0 } : {
780
- x: u.x / e,
781
- y: u.y / e
143
+ const xt = (l, t) => ({
144
+ x: l.x - t.x,
145
+ y: l.y - t.y
146
+ }), _t = (l) => Math.sqrt(l.x * l.x + l.y * l.y), er = (l) => ({
147
+ x: -l.x,
148
+ y: -l.y
149
+ }), rr = (l) => {
150
+ const t = _t(l);
151
+ return t === 0 ? { x: 0, y: 0 } : {
152
+ x: l.x / t,
153
+ y: l.y / t
782
154
  };
783
- }, Bt = (u, e) => ({
784
- x: u.x + e.x,
785
- y: u.y + e.y
786
- }), qr = (u, e) => ({
787
- x: u.x * e,
788
- y: u.y * e
789
- }), $e = (u, e) => ({
790
- x: u.x * e.x,
791
- y: u.y * e.y
792
- }), st = (u, e) => {
793
- const o = Math.sin(e), n = Math.cos(e);
155
+ }, Ct = (l, t) => ({
156
+ x: l.x + t.x,
157
+ y: l.y + t.y
158
+ }), nr = (l, t) => ({
159
+ x: l.x * t,
160
+ y: l.y * t
161
+ }), Ut = (l, t) => ({
162
+ x: l.x * t.x,
163
+ y: l.y * t.y
164
+ }), nt = (l, t) => {
165
+ const i = Math.sin(t), r = Math.cos(t);
794
166
  return {
795
- x: u.x * n - u.y * o,
796
- y: u.x * o + u.y * n
167
+ x: l.x * r - l.y * i,
168
+ y: l.x * i + l.y * r
797
169
  };
798
- }, fn = (u, e) => ({
799
- x: u.x / e,
800
- y: u.y / e
801
- }), vr = (u, e) => u.x * e.x + u.y * e.y, gn = 0.5;
802
- function Wr(u, e = 5, o = 30) {
803
- var n;
804
- const { start: l, end: h } = Fe(u), d = Ot(h, l), g = u.properties.style && u.properties.style.strokeWidth ? (n = u.properties.style) == null ? void 0 : n.strokeWidth : 0;
805
- return Math.min(o, Math.max(3 * g, qt(d) * 0.01, e));
170
+ }, rn = (l, t) => ({
171
+ x: l.x / t,
172
+ y: l.y / t
173
+ }), Ie = (l, t) => l.x * t.x + l.y * t.y, nn = 0.5;
174
+ function ir(l, t = 5, i = 30) {
175
+ var r;
176
+ const { start: a, end: h } = Gt(l), c = xt(h, a), d = l.properties.style && l.properties.style.strokeWidth ? (r = l.properties.style) == null ? void 0 : r.strokeWidth : 0;
177
+ return Math.min(i, Math.max(3 * d, _t(c) * 0.01, t));
806
178
  }
807
- function mr(u, e, o, n) {
808
- const l = qr(Hr(Br(e)), n);
809
- if (!o || o !== "arrow" && o !== "arrow-plain") return "";
810
- const h = Bt(u, st(l, Math.PI / 10)), d = Bt(u, st(l, -Math.PI / 10)), g = `${u.x} ${u.y}`;
811
- return `M ${h.x} ${h.y} L ${g} ${d.x} ${d.y} ${o === "arrow" ? "" : `${h.x} ${h.y}`}`;
179
+ function Me(l, t, i, r) {
180
+ const a = nr(er(rr(t)), r);
181
+ if (!i || i !== "arrow" && i !== "arrow-plain") return "";
182
+ const h = Ct(l, nt(a, Math.PI / 10)), c = Ct(l, nt(a, -Math.PI / 10)), d = `${l.x} ${l.y}`;
183
+ return `M ${h.x} ${h.y} L ${d} ${c.x} ${c.y} ${i === "arrow" ? "" : `${h.x} ${h.y}`}`;
812
184
  }
813
- function pn(u, e, o, n, l) {
814
- const { start: h, end: d } = Fe(u), {
815
- tail: g,
185
+ function sn(l, t, i, r, a) {
186
+ const { start: h, end: c } = Gt(l), {
187
+ tail: d,
816
188
  head: f,
817
- strokeColor: v,
818
- strokeWidth: y = 0
819
- } = u.properties.style || o, A = Ot(d, h), k = Wr(u, n, l), S = Rt("g"), R = Rt("path");
820
- S.setAttribute("data-annotation", `${u.id}`), S.setAttribute("data-annotation-type", "arrow");
821
- const C = f === "arrow-plain" || g === "arrow", L = v || "none";
822
- R.setAttribute("stroke", L), R.setAttribute("stroke-width", `${y}`), R.setAttribute("fill", C ? v || "" : "none"), R.setAttribute("stroke-linecap", "round"), R.setAttribute("stroke-linejoin", "round");
823
- const $ = mr(h, Hr(A), g, k), _ = mr(d, A, f, k), z = $ + `M ${h.x} ${h.y} ${d.x} ${d.y}` + _;
824
- R.setAttribute("d", z), S.appendChild(R), br(S, h, L, g, y), br(S, d, L, f, y), e.appendChild(S);
189
+ strokeColor: g,
190
+ strokeWidth: p = 0
191
+ } = l.properties.style || i, w = xt(c, h), b = ir(l, r, a), A = wt("g"), E = wt("path");
192
+ A.setAttribute("data-annotation", `${l.id}`), A.setAttribute("data-annotation-type", "arrow");
193
+ const k = f === "arrow-plain" || d === "arrow", L = g || "none";
194
+ E.setAttribute("stroke", L), E.setAttribute("stroke-width", `${p}`), E.setAttribute("fill", k ? g || "" : "none"), E.setAttribute("stroke-linecap", "round"), E.setAttribute("stroke-linejoin", "round");
195
+ const M = Me(h, er(w), d, b), C = Me(c, w, f, b), N = M + `M ${h.x} ${h.y} ${c.x} ${c.y}` + C;
196
+ E.setAttribute("d", N), A.appendChild(E), Oe(A, h, L, d, p), Oe(A, c, L, f, p), t.appendChild(A);
825
197
  }
826
- function br(u, e, o, n, l) {
827
- n === "halo-dot" && wr(
828
- u,
829
- e,
830
- yn(o),
831
- gn,
832
- l * 4
833
- ), (n === "dot" || n === "halo-dot") && wr(u, e, o, 1, l * 2);
198
+ function Oe(l, t, i, r, a) {
199
+ r === "halo-dot" && ze(
200
+ l,
201
+ t,
202
+ on(i),
203
+ nn,
204
+ a * 4
205
+ ), (r === "dot" || r === "halo-dot") && ze(l, t, i, 1, a * 2);
834
206
  }
835
- function yn(u) {
836
- return u === "none" ? "none" : u;
207
+ function on(l) {
208
+ return l === "none" ? "none" : l;
837
209
  }
838
- function wr(u, e, o, n, l) {
839
- const h = Rt("circle");
840
- h.setAttribute("cx", `${e.x}`), h.setAttribute("cy", `${e.y}`), h.setAttribute("r", `${l}`), h.setAttribute("fill-opacity", `${n}`), h.setAttribute("fill", o), u.appendChild(h);
210
+ function ze(l, t, i, r, a) {
211
+ const h = wt("circle");
212
+ h.setAttribute("cx", `${t.x}`), h.setAttribute("cy", `${t.y}`), h.setAttribute("r", `${a}`), h.setAttribute("fill-opacity", `${r}`), h.setAttribute("fill", i), l.appendChild(h);
841
213
  }
842
- const V = -1, ze = "dragging", Ne = "dragstart", Ut = "dragend", ar = "select", lr = "unselect", vn = "hover", mn = "unhover", ur = "remove", hr = "add", bn = "cancelDrawing", cr = "update", wn = "link";
843
- function Ur(u) {
844
- return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
214
+ const U = -1, Zt = "dragging", Yt = "dragstart", Lt = "dragend", fe = "select", ge = "unselect", an = "hover", ln = "unhover", pe = "remove", ye = "add", hn = "cancelDrawing", me = "update", un = "link";
215
+ function sr(l) {
216
+ return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
845
217
  }
846
- var xr = { exports: {} }, Er;
847
- function xn() {
848
- return Er || (Er = 1, function(u) {
849
- var e = Object.prototype.hasOwnProperty, o = "~";
850
- function n() {
218
+ var Pe = { exports: {} }, Fe;
219
+ function cn() {
220
+ return Fe || (Fe = 1, function(l) {
221
+ var t = Object.prototype.hasOwnProperty, i = "~";
222
+ function r() {
851
223
  }
852
- Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (o = !1));
853
- function l(f, v, y) {
854
- this.fn = f, this.context = v, this.once = y || !1;
224
+ Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (i = !1));
225
+ function a(f, g, p) {
226
+ this.fn = f, this.context = g, this.once = p || !1;
855
227
  }
856
- function h(f, v, y, A, k) {
857
- if (typeof y != "function")
228
+ function h(f, g, p, w, b) {
229
+ if (typeof p != "function")
858
230
  throw new TypeError("The listener must be a function");
859
- var S = new l(y, A || f, k), R = o ? o + v : v;
860
- return f._events[R] ? f._events[R].fn ? f._events[R] = [f._events[R], S] : f._events[R].push(S) : (f._events[R] = S, f._eventsCount++), f;
231
+ var A = new a(p, w || f, b), E = i ? i + g : g;
232
+ return f._events[E] ? f._events[E].fn ? f._events[E] = [f._events[E], A] : f._events[E].push(A) : (f._events[E] = A, f._eventsCount++), f;
861
233
  }
862
- function d(f, v) {
863
- --f._eventsCount === 0 ? f._events = new n() : delete f._events[v];
234
+ function c(f, g) {
235
+ --f._eventsCount === 0 ? f._events = new r() : delete f._events[g];
864
236
  }
865
- function g() {
866
- this._events = new n(), this._eventsCount = 0;
237
+ function d() {
238
+ this._events = new r(), this._eventsCount = 0;
867
239
  }
868
- g.prototype.eventNames = function() {
869
- var f = [], v, y;
240
+ d.prototype.eventNames = function() {
241
+ var f = [], g, p;
870
242
  if (this._eventsCount === 0) return f;
871
- for (y in v = this._events)
872
- e.call(v, y) && f.push(o ? y.slice(1) : y);
873
- return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(v)) : f;
874
- }, g.prototype.listeners = function(f) {
875
- var v = o ? o + f : f, y = this._events[v];
876
- if (!y) return [];
877
- if (y.fn) return [y.fn];
878
- for (var A = 0, k = y.length, S = new Array(k); A < k; A++)
879
- S[A] = y[A].fn;
880
- return S;
881
- }, g.prototype.listenerCount = function(f) {
882
- var v = o ? o + f : f, y = this._events[v];
883
- return y ? y.fn ? 1 : y.length : 0;
884
- }, g.prototype.emit = function(f, v, y, A, k, S) {
885
- var R = o ? o + f : f;
886
- if (!this._events[R]) return !1;
887
- var C = this._events[R], L = arguments.length, $, _;
888
- if (C.fn) {
889
- switch (C.once && this.removeListener(f, C.fn, void 0, !0), L) {
243
+ for (p in g = this._events)
244
+ t.call(g, p) && f.push(i ? p.slice(1) : p);
245
+ return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(g)) : f;
246
+ }, d.prototype.listeners = function(f) {
247
+ var g = i ? i + f : f, p = this._events[g];
248
+ if (!p) return [];
249
+ if (p.fn) return [p.fn];
250
+ for (var w = 0, b = p.length, A = new Array(b); w < b; w++)
251
+ A[w] = p[w].fn;
252
+ return A;
253
+ }, d.prototype.listenerCount = function(f) {
254
+ var g = i ? i + f : f, p = this._events[g];
255
+ return p ? p.fn ? 1 : p.length : 0;
256
+ }, d.prototype.emit = function(f, g, p, w, b, A) {
257
+ var E = i ? i + f : f;
258
+ if (!this._events[E]) return !1;
259
+ var k = this._events[E], L = arguments.length, M, C;
260
+ if (k.fn) {
261
+ switch (k.once && this.removeListener(f, k.fn, void 0, !0), L) {
890
262
  case 1:
891
- return C.fn.call(C.context), !0;
263
+ return k.fn.call(k.context), !0;
892
264
  case 2:
893
- return C.fn.call(C.context, v), !0;
265
+ return k.fn.call(k.context, g), !0;
894
266
  case 3:
895
- return C.fn.call(C.context, v, y), !0;
267
+ return k.fn.call(k.context, g, p), !0;
896
268
  case 4:
897
- return C.fn.call(C.context, v, y, A), !0;
269
+ return k.fn.call(k.context, g, p, w), !0;
898
270
  case 5:
899
- return C.fn.call(C.context, v, y, A, k), !0;
271
+ return k.fn.call(k.context, g, p, w, b), !0;
900
272
  case 6:
901
- return C.fn.call(C.context, v, y, A, k, S), !0;
273
+ return k.fn.call(k.context, g, p, w, b, A), !0;
902
274
  }
903
- for (_ = 1, $ = new Array(L - 1); _ < L; _++)
904
- $[_ - 1] = arguments[_];
905
- C.fn.apply(C.context, $);
275
+ for (C = 1, M = new Array(L - 1); C < L; C++)
276
+ M[C - 1] = arguments[C];
277
+ k.fn.apply(k.context, M);
906
278
  } else {
907
- var z = C.length, B;
908
- for (_ = 0; _ < z; _++)
909
- switch (C[_].once && this.removeListener(f, C[_].fn, void 0, !0), L) {
279
+ var N = k.length, P;
280
+ for (C = 0; C < N; C++)
281
+ switch (k[C].once && this.removeListener(f, k[C].fn, void 0, !0), L) {
910
282
  case 1:
911
- C[_].fn.call(C[_].context);
283
+ k[C].fn.call(k[C].context);
912
284
  break;
913
285
  case 2:
914
- C[_].fn.call(C[_].context, v);
286
+ k[C].fn.call(k[C].context, g);
915
287
  break;
916
288
  case 3:
917
- C[_].fn.call(C[_].context, v, y);
289
+ k[C].fn.call(k[C].context, g, p);
918
290
  break;
919
291
  case 4:
920
- C[_].fn.call(C[_].context, v, y, A);
292
+ k[C].fn.call(k[C].context, g, p, w);
921
293
  break;
922
294
  default:
923
- if (!$) for (B = 1, $ = new Array(L - 1); B < L; B++)
924
- $[B - 1] = arguments[B];
925
- C[_].fn.apply(C[_].context, $);
295
+ if (!M) for (P = 1, M = new Array(L - 1); P < L; P++)
296
+ M[P - 1] = arguments[P];
297
+ k[C].fn.apply(k[C].context, M);
926
298
  }
927
299
  }
928
300
  return !0;
929
- }, g.prototype.on = function(f, v, y) {
930
- return h(this, f, v, y, !1);
931
- }, g.prototype.once = function(f, v, y) {
932
- return h(this, f, v, y, !0);
933
- }, g.prototype.removeListener = function(f, v, y, A) {
934
- var k = o ? o + f : f;
935
- if (!this._events[k]) return this;
936
- if (!v)
937
- return d(this, k), this;
938
- var S = this._events[k];
939
- if (S.fn)
940
- S.fn === v && (!A || S.once) && (!y || S.context === y) && d(this, k);
301
+ }, d.prototype.on = function(f, g, p) {
302
+ return h(this, f, g, p, !1);
303
+ }, d.prototype.once = function(f, g, p) {
304
+ return h(this, f, g, p, !0);
305
+ }, d.prototype.removeListener = function(f, g, p, w) {
306
+ var b = i ? i + f : f;
307
+ if (!this._events[b]) return this;
308
+ if (!g)
309
+ return c(this, b), this;
310
+ var A = this._events[b];
311
+ if (A.fn)
312
+ A.fn === g && (!w || A.once) && (!p || A.context === p) && c(this, b);
941
313
  else {
942
- for (var R = 0, C = [], L = S.length; R < L; R++)
943
- (S[R].fn !== v || A && !S[R].once || y && S[R].context !== y) && C.push(S[R]);
944
- C.length ? this._events[k] = C.length === 1 ? C[0] : C : d(this, k);
314
+ for (var E = 0, k = [], L = A.length; E < L; E++)
315
+ (A[E].fn !== g || w && !A[E].once || p && A[E].context !== p) && k.push(A[E]);
316
+ k.length ? this._events[b] = k.length === 1 ? k[0] : k : c(this, b);
945
317
  }
946
318
  return this;
947
- }, g.prototype.removeAllListeners = function(f) {
948
- var v;
949
- return f ? (v = o ? o + f : f, this._events[v] && d(this, v)) : (this._events = new n(), this._eventsCount = 0), this;
950
- }, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = o, g.EventEmitter = g, u.exports = g;
951
- }(xr)), xr.exports;
319
+ }, d.prototype.removeAllListeners = function(f) {
320
+ var g;
321
+ return f ? (g = i ? i + f : f, this._events[g] && c(this, g)) : (this._events = new r(), this._eventsCount = 0), this;
322
+ }, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = i, d.EventEmitter = d, l.exports = d;
323
+ }(Pe)), Pe.exports;
952
324
  }
953
- var En = xn();
954
- const Yr = /* @__PURE__ */ Ur(En);
955
- class Vr extends Yr {
956
- constructor(e, o) {
957
- super(), x(this, "ogma"), x(this, "elements"), x(this, "layer"), x(this, "editor"), x(this, "selectedId", V), x(this, "hoveredId", V), x(this, "ogmaOptions"), x(this, "shouldDetect"), x(this, "isDragging"), x(this, "showeditorOnHover"), x(this, "_onKeyUp", (n) => {
958
- n.code === 27 && this.selectedId !== V ? this.unselect() : (n.code === 46 || n.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
959
- }), x(this, "_onClickMouseMove", (n) => {
960
- if (!n.domEvent || this.isDragging || !this.shouldDetect || n.domEvent.type !== "mousemove" && n.domEvent.target && n.domEvent.target.tagName === "a")
325
+ var dn = cn();
326
+ const or = /* @__PURE__ */ sr(dn);
327
+ class ar extends or {
328
+ constructor(t, i) {
329
+ super(), m(this, "ogma"), m(this, "elements"), m(this, "layer"), m(this, "editor"), m(this, "selectedId", U), m(this, "hoveredId", U), m(this, "ogmaOptions"), m(this, "shouldDetect"), m(this, "isDragging"), m(this, "showeditorOnHover"), m(this, "_onKeyUp", (r) => {
330
+ r.code === 27 && this.selectedId !== U ? this.unselect() : (r.code === 46 || r.code === 8) && this.selectedId !== U && this._canRemove() && this.remove(this.selectedId);
331
+ }), m(this, "_onClickMouseMove", (r) => {
332
+ if (!r.domEvent || this.isDragging || !this.shouldDetect || r.domEvent.type !== "mousemove" && r.domEvent.target && r.domEvent.target.tagName === "a")
961
333
  return;
962
- const l = this.ogma.view.screenToGraphCoordinates(n), h = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(l, 0) : void 0;
963
- n.domEvent.type === "mousemove" ? h ? this.hover(h.id) : this.hoveredId !== V && this.unhover() : h ? this.select(h.id) : this.selectedId !== V && this.unselect();
964
- }), this.ogma = e, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = e.getOptions(), e.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
334
+ const a = this.ogma.view.screenToGraphCoordinates(r), h = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(a, 0) : void 0;
335
+ r.domEvent.type === "mousemove" ? h ? this.hover(h.id) : this.hoveredId !== U && this.unhover() : h ? this.select(h.id) : this.selectedId !== U && this.unselect();
336
+ }), this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
965
337
  this.refreshEditor(), this.refreshDrawing();
966
- }), this.layer = e.layers.addSVGLayer({
967
- draw: (n) => this.draw(n)
968
- }), this.layer.moveToTop(), this.editor = e.layers.addLayer(o), this.editor.hide();
338
+ }), this.layer = t.layers.addSVGLayer({
339
+ draw: (r) => this.draw(r)
340
+ }), this.layer.moveToTop(), this.editor = t.layers.addLayer(i), this.editor.hide();
969
341
  }
970
342
  _canRemove() {
971
343
  return !0;
@@ -975,39 +347,39 @@ class Vr extends Yr {
975
347
  * @param options Params for the annotation (merged with default)
976
348
  * @returns the added annotation
977
349
  */
978
- add(e) {
979
- const o = this.getDefaultOptions(), n = Object.assign(e, {
980
- id: e.id === void 0 ? He() : e.id,
981
- type: e.type,
350
+ add(t) {
351
+ const i = this.getDefaultOptions(), r = Object.assign(t, {
352
+ id: t.id === void 0 ? Jt() : t.id,
353
+ type: t.type,
982
354
  properties: {
983
- ...o.properties,
984
- ...e.properties || {},
355
+ ...i.properties,
356
+ ...t.properties || {},
985
357
  // styles need to be merged
986
- style: { ...o.properties.style, ...e.properties.style || {} }
358
+ style: { ...i.properties.style, ...t.properties.style || {} }
987
359
  },
988
360
  geometry: {
989
- ...o.geometry,
990
- ...e.geometry
361
+ ...i.geometry,
362
+ ...t.geometry
991
363
  }
992
364
  });
993
- return this.elements.push(n), this.layer.refresh(), this.emit(hr, n), n;
365
+ return this.elements.push(r), this.layer.refresh(), this.emit(ye, r), r;
994
366
  }
995
- updateStyle(e, o) {
996
- this.updateAnnotation(e, {
367
+ updateStyle(t, i) {
368
+ this.updateAnnotation(t, {
997
369
  properties: {
998
- style: o
370
+ style: i
999
371
  }
1000
372
  });
1001
373
  }
1002
- updateGeometry(e, o) {
1003
- this.updateAnnotation(e, {
1004
- geometry: o
374
+ updateGeometry(t, i) {
375
+ this.updateAnnotation(t, {
376
+ geometry: i
1005
377
  });
1006
378
  }
1007
- scale(e, o, n, l) {
379
+ scale(t, i, r, a) {
1008
380
  this.updateGeometry(
1009
- e,
1010
- dn(e.geometry, o, n, l)
381
+ t,
382
+ en(t.geometry, i, r, a)
1011
383
  );
1012
384
  }
1013
385
  /**
@@ -1016,37 +388,37 @@ class Vr extends Yr {
1016
388
  * @param id Id of the annotation to update
1017
389
  * @param element params of the annotation
1018
390
  */
1019
- update(e, o) {
1020
- const n = this.getById(e);
1021
- this.updateAnnotation(n, o);
1022
- }
1023
- updateAnnotation(e, o) {
1024
- if (!e) return;
1025
- const n = e.id;
1026
- Object.keys(o).forEach((l) => {
1027
- if (l !== "id")
1028
- if (l === "properties") {
1029
- const h = o.properties || { style: {} };
1030
- e.properties = {
1031
- ...e.properties || {},
391
+ update(t, i) {
392
+ const r = this.getById(t);
393
+ this.updateAnnotation(r, i);
394
+ }
395
+ updateAnnotation(t, i) {
396
+ if (!t) return;
397
+ const r = t.id;
398
+ Object.keys(i).forEach((a) => {
399
+ if (a !== "id")
400
+ if (a === "properties") {
401
+ const h = i.properties || { style: {} };
402
+ t.properties = {
403
+ ...t.properties || {},
1032
404
  ...h || {},
1033
405
  style: {
1034
- ...e.properties.style || {},
406
+ ...t.properties.style || {},
1035
407
  ...h.style || {}
1036
408
  }
1037
409
  };
1038
- } else l === "geometry" ? e.geometry = {
1039
- ...e.geometry,
1040
- ...o.geometry
1041
- } : e[l] = o[l];
1042
- }), n === this.selectedId && this.refreshEditor(), this.layer.refresh();
1043
- }
1044
- getById(e) {
1045
- const o = Number(e);
1046
- for (let n = 0; n < this.elements.length; n++) {
1047
- const l = this.elements[n];
1048
- if (!(l.id !== e && l.id !== o))
1049
- return l;
410
+ } else a === "geometry" ? t.geometry = {
411
+ ...t.geometry,
412
+ ...i.geometry
413
+ } : t[a] = i[a];
414
+ }), r === this.selectedId && this.refreshEditor(), this.layer.refresh();
415
+ }
416
+ getById(t) {
417
+ const i = Number(t);
418
+ for (let r = 0; r < this.elements.length; r++) {
419
+ const a = this.elements[r];
420
+ if (!(a.id !== t && a.id !== i))
421
+ return a;
1050
422
  }
1051
423
  }
1052
424
  /**
@@ -1054,33 +426,33 @@ class Vr extends Yr {
1054
426
  * @param id id of the element to select
1055
427
  * Select element, show editor, disable Ogma dragging and fire event
1056
428
  */
1057
- select(e) {
1058
- const o = this.getById(e);
1059
- o && (this.editor.show(), this.selectedId = e, this.refreshEditor(), this.layer.refresh(), this.emit(ar, o));
429
+ select(t) {
430
+ const i = this.getById(t);
431
+ i && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(fe, i));
1060
432
  }
1061
- hover(e) {
1062
- const o = this.getById(e);
1063
- o && (this.showeditorOnHover && this.editor.show(), this.hoveredId = e, this.refreshEditor(), this.layer.refresh(), this.emit(vn, o));
433
+ hover(t) {
434
+ const i = this.getById(t);
435
+ i && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(an, i));
1064
436
  }
1065
437
  getSelectedFeature() {
1066
- return this.selectedId === V ? null : this.getById(this.selectedId);
438
+ return this.selectedId === U ? null : this.getById(this.selectedId);
1067
439
  }
1068
440
  unselect() {
1069
- const e = this.getById(this.selectedId);
1070
- return e && this.emit(lr, e), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
441
+ const t = this.getById(this.selectedId);
442
+ return t && this.emit(ge, t), this.selectedId = U, this.hoveredId === U && this.editor.hide(), this.layer.refresh(), this;
1071
443
  }
1072
444
  unhover() {
1073
- const e = this.getById(this.hoveredId);
1074
- return this.emit(mn, e), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
445
+ const t = this.getById(this.hoveredId);
446
+ return this.emit(ln, t), this.hoveredId = U, this.selectedId === U && this.editor.hide(), this.layer.refresh(), this;
1075
447
  }
1076
448
  /**
1077
449
  * @method remove
1078
450
  * @param id Id of the annotation to remove
1079
451
  * Removes annotation with the given id
1080
452
  */
1081
- remove(e) {
1082
- const o = this.getById(e);
1083
- e === this.hoveredId && this.unhover(), e === this.selectedId && this.unselect(), this.elements = this.elements.filter((n) => n.id !== e), o && this.emit(ur, o), this.layer.refresh();
453
+ remove(t) {
454
+ const i = this.getById(t);
455
+ t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((r) => r.id !== t), i && this.emit(pe, i), this.layer.refresh();
1084
456
  }
1085
457
  /**
1086
458
  * @method disableDragging
@@ -1130,43 +502,43 @@ class Vr extends Yr {
1130
502
  this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
1131
503
  }
1132
504
  }
1133
- const Ar = "handle-line", kr = "handle-start", _r = "handle-end";
1134
- class An extends Vr {
1135
- constructor(e, o = {}) {
505
+ const He = "handle-line", Ne = "handle-start", je = "handle-end";
506
+ class fn extends ar {
507
+ constructor(t, i = {}) {
1136
508
  super(
1137
- e,
509
+ t,
1138
510
  `
1139
511
  <div class="arrow-handle">
1140
- <div id="${Ar}" data-handle-id="0" class="handle line"></div>
1141
- <div id="${kr}" data-handle-id="1" class="handle point"></div>
1142
- <div id="${_r}" data-handle-id="2" class="handle point"></div>
512
+ <div id="${He}" data-handle-id="0" class="handle line"></div>
513
+ <div id="${Ne}" data-handle-id="1" class="handle point"></div>
514
+ <div id="${je}" data-handle-id="2" class="handle point"></div>
1143
515
  </div>
1144
516
  `
1145
- ), x(this, "draggedHandle", V), x(this, "start", { x: 0, y: 0 }), x(this, "end", { x: 0, y: 0 }), x(this, "arrow", { ...yr }), x(this, "startX", 0), x(this, "startY", 0), x(this, "minArrowHeight", 0), x(this, "maxArrowHeight", 0), x(this, "handles", []), x(this, "onHandleMouseDown", (n) => {
1146
- const l = this.getById(this.selectedId) || this.getById(this.hoveredId);
1147
- if (!l) return;
1148
- const { x: h, y: d } = Me(n, this.ogma.getContainer());
1149
- this.startDragging(l, h, d), this.draggedHandle = Nr(n.target);
1150
- }), x(this, "onMouseUp", () => {
1151
- this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(Ut, this.arrow));
1152
- }), x(this, "onMouseMove", (n) => {
1153
- if (!this.isDragging || this.draggedHandle === V) return;
1154
- const { x: l, y: h } = Me(n, this.ogma.getContainer()), d = this.handles[this.draggedHandle], g = this.ogma.view.getAngle(), { x: f, y: v } = st(
1155
- fn(
1156
- { x: l - this.startX, y: h - this.startY },
517
+ ), m(this, "draggedHandle", U), m(this, "start", { x: 0, y: 0 }), m(this, "end", { x: 0, y: 0 }), m(this, "arrow", { ...$e }), m(this, "startX", 0), m(this, "startY", 0), m(this, "minArrowHeight", 0), m(this, "maxArrowHeight", 0), m(this, "handles", []), m(this, "onHandleMouseDown", (r) => {
518
+ const a = this.getById(this.selectedId) || this.getById(this.hoveredId);
519
+ if (!a) return;
520
+ const { x: h, y: c } = Vt(r, this.ogma.getContainer());
521
+ this.startDragging(a, h, c), this.draggedHandle = tr(r.target);
522
+ }), m(this, "onMouseUp", () => {
523
+ this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = U, this.emit(Lt, this.arrow));
524
+ }), m(this, "onMouseMove", (r) => {
525
+ if (!this.isDragging || this.draggedHandle === U) return;
526
+ const { x: a, y: h } = Vt(r, this.ogma.getContainer()), c = this.handles[this.draggedHandle], d = this.ogma.view.getAngle(), { x: f, y: g } = nt(
527
+ rn(
528
+ { x: a - this.startX, y: h - this.startY },
1157
529
  this.ogma.view.getZoom()
1158
530
  ),
1159
- g
1160
- ), y = d.id === Ar, A = d.id === kr, k = d.id === _r;
1161
- (y || A) && Mr(this.arrow, this.start.x + f, this.start.y + v), (y || k) && zr(this.arrow, this.end.x + f, this.end.y + v), this.emit(
1162
- ze,
531
+ d
532
+ ), p = c.id === He, w = c.id === Ne, b = c.id === je;
533
+ (p || w) && Ke(this.arrow, this.start.x + f, this.start.y + g), (p || b) && Qe(this.arrow, this.end.x + f, this.end.y + g), this.emit(
534
+ Zt,
1163
535
  this.arrow,
1164
- y ? "line" : A ? "start" : "end"
536
+ p ? "line" : w ? "start" : "end"
1165
537
  ), this.refreshEditor(), this.layer.refresh();
1166
- }), this.minArrowHeight = o.minArrowHeight || 0, this.maxArrowHeight = o.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
538
+ }), this.minArrowHeight = i.minArrowHeight || 0, this.maxArrowHeight = i.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
1167
539
  this.editor.element.querySelectorAll(".arrow-handle>.handle")
1168
540
  ), this.handles.forEach(
1169
- (n) => n.addEventListener("mousedown", this.onHandleMouseDown)
541
+ (r) => r.addEventListener("mousedown", this.onHandleMouseDown)
1170
542
  ), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
1171
543
  }
1172
544
  /**
@@ -1175,68 +547,68 @@ class An extends Vr {
1175
547
  * @param y
1176
548
  * @param arrow
1177
549
  */
1178
- startDrawing(e, o, n = an(e, o, e, o, fe)) {
1179
- var l;
1180
- this.disableDragging(), this.add(n), this.hoveredId = n.id;
1181
- const h = this.ogma.view.graphToScreenCoordinates({ x: e, y: o }), d = ((l = this.ogma.getContainer()) == null ? void 0 : l.getBoundingClientRect()) || {
550
+ startDrawing(t, i, r = Yr(t, i, t, i, Pt)) {
551
+ var a;
552
+ this.disableDragging(), this.add(r), this.hoveredId = r.id;
553
+ const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: i }), c = ((a = this.ogma.getContainer()) == null ? void 0 : a.getBoundingClientRect()) || {
1182
554
  left: 0,
1183
555
  top: 0
1184
556
  };
1185
557
  this.startDragging(
1186
- this.getById(n.id),
1187
- h.x + (d == null ? void 0 : d.left),
1188
- h.y + d.top
558
+ this.getById(r.id),
559
+ h.x + (c == null ? void 0 : c.left),
560
+ h.y + c.top
1189
561
  ), this.draggedHandle = 2;
1190
562
  }
1191
563
  cancelDrawing() {
1192
- this.isDragging && (this.remove(this.arrow.id), this.emit(Ut, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
1193
- }
1194
- startDragging(e, o, n) {
1195
- this.selectedId !== e.id && this.select(this.hoveredId), this.arrow = e, this.startX = o, this.startY = n, this.start = de(this.arrow), this.end = je(this.arrow), this.disableDragging(), this.emit(Ne, this.arrow), this.isDragging = !0;
1196
- }
1197
- detect(e, o = 0) {
1198
- return this.elements.find((n) => {
1199
- const { start: l, end: h } = Fe(n), d = Ot(e, {
1200
- x: (l.x + h.x) / 2,
1201
- y: (l.y + h.y) / 2
1202
- }), g = Ot(h, l), f = qt(g), v = Br(g), y = Wr(n);
1203
- return Math.abs(vr(v, d)) < f / 2 + o && Math.abs(vr(st(v, Math.PI / 2), d)) < y / 2 + o;
564
+ this.isDragging && (this.remove(this.arrow.id), this.emit(Lt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = U);
565
+ }
566
+ startDragging(t, i, r) {
567
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = i, this.startY = r, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(Yt, this.arrow), this.isDragging = !0;
568
+ }
569
+ detect(t, i = 0) {
570
+ return this.elements.find((r) => {
571
+ const { start: a, end: h } = Gt(r), c = xt(t, {
572
+ x: (a.x + h.x) / 2,
573
+ y: (a.y + h.y) / 2
574
+ }), d = xt(h, a), f = _t(d), g = rr(d), p = ir(r);
575
+ return Math.abs(Ie(g, c)) < f / 2 + i && Math.abs(Ie(nt(g, Math.PI / 2), c)) < p / 2 + i;
1204
576
  });
1205
577
  }
1206
578
  refreshEditor() {
1207
579
  if (+this.selectedId < 0 && +this.hoveredId < 0) return;
1208
- const e = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), o = Fe(e), n = this.ogma.view.graphToScreenCoordinates(o.start), l = this.ogma.view.graphToScreenCoordinates(o.end), [h, d, g] = Array.prototype.slice.call(
580
+ const t = this.selectedId !== U ? this.getById(this.selectedId) : this.getById(this.hoveredId), i = Gt(t), r = this.ogma.view.graphToScreenCoordinates(i.start), a = this.ogma.view.graphToScreenCoordinates(i.end), [h, c, d] = Array.prototype.slice.call(
1209
581
  this.editor.element.querySelectorAll(".handle")
1210
582
  );
1211
- d.style.transform = `translate(${n.x}px, ${n.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;
583
+ c.style.transform = `translate(${r.x}px, ${r.y}px) translate(-50%, -50%)`, d.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%)`;
1212
584
  const f = {
1213
- x: (l.x + n.x) / 2,
1214
- y: (l.y + n.y) / 2
1215
- }, v = Ot(l, n), y = qr(v, 1 / qt(v)), A = Math.atan2(y.y, y.x);
1216
- h.style.width = `${qt(v)}px`, h.style.left = `${f.x}px`, h.style.top = `${f.y}px`, h.style.transform = `translate(-50%, -50%) rotate(${A}rad)`;
585
+ x: (a.x + r.x) / 2,
586
+ y: (a.y + r.y) / 2
587
+ }, g = xt(a, r), p = nr(g, 1 / _t(g)), w = Math.atan2(p.y, p.x);
588
+ h.style.width = `${_t(g)}px`, h.style.left = `${f.x}px`, h.style.top = `${f.y}px`, h.style.transform = `translate(-50%, -50%) rotate(${w}rad)`;
1217
589
  }
1218
590
  getDefaultOptions() {
1219
- return yr;
591
+ return $e;
1220
592
  }
1221
- draw(e) {
1222
- e.innerHTML = "";
1223
- const o = Rt("g"), n = this.ogma.view.getAngle();
1224
- n !== 0 && o.setAttribute("transform", `rotate(${-n * (180 / Math.PI)})`), this.elements.forEach(
1225
- (l) => pn(l, o, fe, this.minArrowHeight, this.maxArrowHeight)
1226
- ), e.appendChild(o);
593
+ draw(t) {
594
+ t.innerHTML = "";
595
+ const i = wt("g"), r = this.ogma.view.getAngle();
596
+ r !== 0 && i.setAttribute("transform", `rotate(${-r * (180 / Math.PI)})`), this.elements.forEach(
597
+ (a) => sn(a, i, Pt, this.minArrowHeight, this.maxArrowHeight)
598
+ ), t.appendChild(i);
1227
599
  }
1228
600
  refreshDrawing() {
1229
- const e = this.ogma.view.getAngle();
1230
- this.layer.element !== null && e !== 0 && this.layer.element.children[0].setAttribute(
601
+ const t = this.ogma.view.getAngle();
602
+ this.layer.element !== null && t !== 0 && this.layer.element.children[0].setAttribute(
1231
603
  "transform",
1232
- `rotate(${-e * (180 / Math.PI)})`
604
+ `rotate(${-t * (180 / Math.PI)})`
1233
605
  );
1234
606
  }
1235
607
  destroy() {
1236
608
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
1237
609
  }
1238
610
  }
1239
- const Wt = {
611
+ const Dt = {
1240
612
  font: "sans-serif",
1241
613
  fontSize: 18,
1242
614
  color: "#505050",
@@ -1245,13 +617,13 @@ const Wt = {
1245
617
  borderRadius: 8,
1246
618
  padding: 16,
1247
619
  strokeType: "plain"
1248
- }, ir = {
620
+ }, ue = {
1249
621
  id: 0,
1250
622
  type: "Feature",
1251
623
  properties: {
1252
624
  type: "text",
1253
625
  content: "",
1254
- style: { ...Wt }
626
+ style: { ...Dt }
1255
627
  },
1256
628
  geometry: {
1257
629
  type: "Polygon",
@@ -1267,122 +639,122 @@ const Wt = {
1267
639
  }
1268
640
  // position: { x: 0, y: 0 },
1269
641
  // size: { width: 100, height: 50 }
1270
- }, Sr = {
642
+ }, Be = {
1271
643
  handleSize: 3.5,
1272
644
  placeholder: "Your text..."
1273
- }, kn = (u = 0, e = 0, o = 100, n = 50, l = "", h = { ...Wt }) => ({
1274
- id: He(),
645
+ }, gn = (l = 0, t = 0, i = 100, r = 50, a = "", h = { ...Dt }) => ({
646
+ id: Jt(),
1275
647
  type: "Feature",
1276
648
  properties: {
1277
649
  type: "text",
1278
- content: l,
1279
- style: { ...Wt, ...h }
650
+ content: a,
651
+ style: { ...Dt, ...h }
1280
652
  },
1281
653
  geometry: {
1282
654
  type: "Polygon",
1283
655
  coordinates: [
1284
656
  [
1285
- [u, e],
1286
- [u + o, e],
1287
- [u + o, e + n],
1288
- [u, e + n],
1289
- [u, e]
657
+ [l, t],
658
+ [l + i, t],
659
+ [l + i, t + r],
660
+ [l, t + r],
661
+ [l, t]
1290
662
  ]
1291
663
  ]
1292
664
  }
1293
665
  });
1294
- var dr = { exports: {} }, _n = dr.exports, Cr;
1295
- function Sn() {
1296
- return Cr || (Cr = 1, function(u, e) {
1297
- (function(o, n) {
1298
- u.exports = n();
1299
- })(_n, () => (() => {
1300
- var o = { d: (r, i) => {
1301
- for (var a in i) o.o(i, a) && !o.o(r, a) && Object.defineProperty(r, a, { enumerable: !0, get: i[a] });
1302
- }, o: (r, i) => Object.prototype.hasOwnProperty.call(r, i) }, n = {};
1303
- function l(r) {
1304
- return l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1305
- return typeof i;
1306
- } : function(i) {
1307
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1308
- }, l(r);
1309
- }
1310
- o.d(n, { default: () => tr });
1311
- var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, d = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, f = /\bbold(?:er)?\b/, v = 13.3333333, y = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1312
- function A(r) {
1313
- var i = "", a = this;
1314
- return a.style && a.style !== "normal" && (i += a.style), a.variant && a.variant !== "normal" && (i += (i ? " " : "") + a.variant), a.weight && a.weight !== "normal" && (i += (i ? " " : "") + a.weight), a.size && (i += (i ? " " : "") + a.size + "px", a.height !== a.size && (i += "/" + a.height + "px")), a.family && (i += (i ? " " : "") + a.family), r && (i += "::" + a.baseline), r && (i += "::" + a.color), i;
1315
- }
1316
- var k = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: A, valueOf: A };
1317
- function S(r) {
1318
- var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = h.exec(r);
1319
- i.family = (a[6] || "").trim();
1320
- var t = y[a[2]] || parseFloat(a[2]);
1321
- a[3] === "%" ? t *= 0.16 : a[3] === "em" ? t *= 16 : a[3] === "pt" && (t *= v), i.size = t;
1322
- var s = parseFloat(a[4]);
1323
- if (s !== "normal" && s !== "inherit" && s ? a[5] && a[5] !== "em" ? a[5] === "pt" ? i.height = s * v : a[5] === "%" ? i.height = 0.01 * t : i.height = s : i.height = s * t : i.height = Math.round(t * (7 / 6)), d.test(a[1]) && (i.variant = "small-caps"), g.test(a[1]) && (i.style = "italic"), f.test(a[1])) i.weight = "bold";
666
+ var ve = { exports: {} }, pn = ve.exports, qe;
667
+ function yn() {
668
+ return qe || (qe = 1, function(l, t) {
669
+ (function(i, r) {
670
+ l.exports = r();
671
+ })(pn, () => (() => {
672
+ var i = { d: (e, n) => {
673
+ for (var o in n) i.o(n, o) && !i.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
674
+ }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
675
+ function a(e) {
676
+ return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
677
+ return typeof n;
678
+ } : function(n) {
679
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
680
+ }, a(e);
681
+ }
682
+ i.d(r, { default: () => qr });
683
+ var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, c = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/, f = /\bbold(?:er)?\b/, g = 13.3333333, p = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
684
+ function w(e) {
685
+ var n = "", o = this;
686
+ return o.style && o.style !== "normal" && (n += o.style), o.variant && o.variant !== "normal" && (n += (n ? " " : "") + o.variant), o.weight && o.weight !== "normal" && (n += (n ? " " : "") + o.weight), o.size && (n += (n ? " " : "") + o.size + "px", o.height !== o.size && (n += "/" + o.height + "px")), o.family && (n += (n ? " " : "") + o.family), e && (n += "::" + o.baseline), e && (n += "::" + o.color), n;
687
+ }
688
+ var b = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: w, valueOf: w };
689
+ function A(e) {
690
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
691
+ n.family = (o[6] || "").trim();
692
+ var s = p[o[2]] || parseFloat(o[2]);
693
+ o[3] === "%" ? s *= 0.16 : o[3] === "em" ? s *= 16 : o[3] === "pt" && (s *= g), n.size = s;
694
+ var u = parseFloat(o[4]);
695
+ if (u !== "normal" && u !== "inherit" && u ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = u * g : o[5] === "%" ? n.height = 0.01 * s : n.height = u : n.height = u * s : n.height = Math.round(s * (7 / 6)), c.test(o[1]) && (n.variant = "small-caps"), d.test(o[1]) && (n.style = "italic"), f.test(o[1])) n.weight = "bold";
1324
696
  else {
1325
- var c = parseInt(/\b(\d+)\b/.exec(a[1]), 10);
1326
- c >= 100 && c !== 400 && (i.weight = c);
697
+ var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
698
+ y >= 100 && y !== 400 && (n.weight = y);
1327
699
  }
1328
- return i;
1329
- }
1330
- function R() {
1331
- var r, i, a, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = 14, p = 12, m = null, w = null, b = "";
1332
- if (t && t.nodeType) {
1333
- var E = t && (t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView), D = E.getComputedStyle(t, null);
1334
- r = D.getPropertyValue("font-family") || "", p = parseFloat(D.getPropertyValue("font-size")), c = D.getPropertyValue("line-height"), m = D.getPropertyValue("font-weight"), w = D.getPropertyValue("font-style"), b = D.getPropertyValue("font-variant") || "";
1335
- } else if (typeof t == "string") {
1336
- var T = S(t);
1337
- r = T.family, p = T.size, c = T.height, b = T.variant, w = T.style, m = T.weight;
1338
- } else l(t) === "object" && (r = t.family, p = t.size, c = t.height, b = t.variant, m = t.weight, w = t.style, i = t.baseline, a = t.color);
1339
- s.size && s.size < 3 && (p *= s.size), c = c !== "normal" && c ? parseFloat(c) : p * (7 / 6), s.height && s.height < 3 && (c *= s.height);
1340
- var O = Object.create(k);
1341
- return O.family = s.family || r || "sans-serif", O.height = c ?? 14, O.size = p ?? 12, O.variant = s.variant || b || "", O.style = s.style || w || "", O.weight = s.weight || m || "", O.baseline = i || 0, s.baseline != null && (O.baseline = s.baseline), O.color = s.color || a || "", O.id = A.call(O, !0), O;
1342
- }
1343
- const C = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "᠎": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "​": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
1344
- var L, $ = function(r) {
1345
- var i = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || r && r.createElement("canvas");
1346
- if (i && i.getContext) {
1347
- var a = i.getContext("2d");
1348
- if (a && typeof a.measureText == "function") return function(t, s) {
1349
- return a.font = String(s), a.measureText(t).width;
700
+ return n;
701
+ }
702
+ function E() {
703
+ var e, n, o, s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, x = 12, v = null, S = null, _ = "";
704
+ if (s && s.nodeType) {
705
+ var $ = s && (s.ownerDocument && s.ownerDocument.defaultView || s.document && s || s.defaultView), I = $.getComputedStyle(s, null);
706
+ e = I.getPropertyValue("font-family") || "", x = parseFloat(I.getPropertyValue("font-size")), y = I.getPropertyValue("line-height"), v = I.getPropertyValue("font-weight"), S = I.getPropertyValue("font-style"), _ = I.getPropertyValue("font-variant") || "";
707
+ } else if (typeof s == "string") {
708
+ var D = A(s);
709
+ e = D.family, x = D.size, y = D.height, _ = D.variant, S = D.style, v = D.weight;
710
+ } else a(s) === "object" && (e = s.family, x = s.size, y = s.height, _ = s.variant, v = s.weight, S = s.style, n = s.baseline, o = s.color);
711
+ u.size && u.size < 3 && (x *= u.size), y = y !== "normal" && y ? parseFloat(y) : x * (7 / 6), u.height && u.height < 3 && (y *= u.height);
712
+ var O = Object.create(b);
713
+ return O.family = u.family || e || "sans-serif", O.height = y ?? 14, O.size = x ?? 12, O.variant = u.variant || _ || "", O.style = u.style || S || "", O.weight = u.weight || v || "", O.baseline = n || 0, u.baseline != null && (O.baseline = u.baseline), O.color = u.color || o || "", O.id = w.call(O, !0), O;
714
+ }
715
+ const k = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "᠎": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "​": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
716
+ var L, M = function(e) {
717
+ var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
718
+ if (n && n.getContext) {
719
+ var o = n.getContext("2d");
720
+ if (o && typeof o.measureText == "function") return function(s, u) {
721
+ return o.font = String(u), o.measureText(s).width;
1350
722
  };
1351
723
  }
1352
- }(typeof document < "u" ? document : null) || (L = {}, function(r, i) {
1353
- if (!L[i]) {
1354
- var a = R(i);
1355
- L[i] = a, /\bmonospace\b/.test(a.family) ? a.size *= 0.6 : (a.size *= 0.45, a.weight && (a.size *= 1.18));
724
+ }(typeof document < "u" ? document : null) || (L = {}, function(e, n) {
725
+ if (!L[n]) {
726
+ var o = E(n);
727
+ L[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1356
728
  }
1357
- return r.length * L[i].size;
1358
- }), _ = {}, z = { trim: !0, collapse: !0 };
1359
- function B(r, i, a) {
1360
- var t = Object.assign({}, z, a), s = String(r);
1361
- if (!s) return 0;
1362
- if (s in C) {
1363
- var c = i.id + "/" + s;
1364
- return c in _ || (_[c] = $("_".concat(s, "_"), i) - $("__", i)), _[c];
729
+ return e.length * L[n].size;
730
+ }), C = {}, N = { trim: !0, collapse: !0 };
731
+ function P(e, n, o) {
732
+ var s = Object.assign({}, N, o), u = String(e);
733
+ if (!u) return 0;
734
+ if (u in k) {
735
+ var y = n.id + "/" + u;
736
+ return y in C || (C[y] = M("_".concat(u, "_"), n) - M("__", n)), C[y];
1365
737
  }
1366
- return t.trim && t.collapse ? t.trim ? s = s.trim() : t.collapse && (s = s.replace(/\s+/g, " ")) : s = s.replace(/\n/g, " "), $(s, i) + i.size * (r.tracking || 0);
1367
- }
1368
- function tt(r) {
1369
- return tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1370
- return typeof i;
1371
- } : function(i) {
1372
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1373
- }, tt(r);
1374
- }
1375
- function rt(r, i) {
1376
- if (typeof i != "function" && i !== null) throw new TypeError("Super expression must either be null or a function");
1377
- r.prototype = Object.create(i && i.prototype, { constructor: { value: r, writable: !0, configurable: !0 } }), Object.defineProperty(r, "prototype", { writable: !1 }), i && Yt(r, i);
1378
- }
1379
- function Yt(r, i) {
1380
- return Yt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(a, t) {
1381
- return a.__proto__ = t, a;
1382
- }, Yt(r, i);
1383
- }
1384
- function Vt(r) {
1385
- var i = function() {
738
+ return s.trim && s.collapse ? s.trim ? u = u.trim() : s.collapse && (u = u.replace(/\s+/g, " ")) : u = u.replace(/\n/g, " "), M(u, n) + n.size * (e.tracking || 0);
739
+ }
740
+ function tt(e) {
741
+ return tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
742
+ return typeof n;
743
+ } : function(n) {
744
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
745
+ }, tt(e);
746
+ }
747
+ function it(e, n) {
748
+ if (typeof n != "function" && n !== null) throw new TypeError("Super expression must either be null or a function");
749
+ e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Kt(e, n);
750
+ }
751
+ function Kt(e, n) {
752
+ return Kt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, s) {
753
+ return o.__proto__ = s, o;
754
+ }, Kt(e, n);
755
+ }
756
+ function Qt(e) {
757
+ var n = function() {
1386
758
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
1387
759
  if (typeof Proxy == "function") return !0;
1388
760
  try {
@@ -1393,696 +765,696 @@ function Sn() {
1393
765
  }
1394
766
  }();
1395
767
  return function() {
1396
- var a, t = Dt(r);
1397
- if (i) {
1398
- var s = Dt(this).constructor;
1399
- a = Reflect.construct(t, arguments, s);
1400
- } else a = t.apply(this, arguments);
1401
- return ge(this, a);
768
+ var o, s = Ft(e);
769
+ if (n) {
770
+ var u = Ft(this).constructor;
771
+ o = Reflect.construct(s, arguments, u);
772
+ } else o = s.apply(this, arguments);
773
+ return ur(this, o);
1402
774
  };
1403
775
  }
1404
- function ge(r, i) {
1405
- if (i && (tt(i) === "object" || typeof i == "function")) return i;
1406
- if (i !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
1407
- return function(a) {
1408
- if (a === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1409
- return a;
1410
- }(r);
1411
- }
1412
- function Dt(r) {
1413
- return Dt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(i) {
1414
- return i.__proto__ || Object.getPrototypeOf(i);
1415
- }, Dt(r);
1416
- }
1417
- function Pt(r, i) {
1418
- if (!(r instanceof i)) throw new TypeError("Cannot call a class as a function");
1419
- }
1420
- function pe(r, i) {
1421
- for (var a = 0; a < i.length; a++) {
1422
- var t = i[a];
1423
- t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
1424
- if (tt(c) !== "object" || c === null) return c;
1425
- var m = c[Symbol.toPrimitive];
1426
- if (m !== void 0) {
1427
- var w = m.call(c, p);
1428
- if (tt(w) !== "object") return w;
776
+ function ur(e, n) {
777
+ if (n && (tt(n) === "object" || typeof n == "function")) return n;
778
+ if (n !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
779
+ return function(o) {
780
+ if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
781
+ return o;
782
+ }(e);
783
+ }
784
+ function Ft(e) {
785
+ return Ft = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
786
+ return n.__proto__ || Object.getPrototypeOf(n);
787
+ }, Ft(e);
788
+ }
789
+ function Ht(e, n) {
790
+ if (!(e instanceof n)) throw new TypeError("Cannot call a class as a function");
791
+ }
792
+ function cr(e, n) {
793
+ for (var o = 0; o < n.length; o++) {
794
+ var s = n[o];
795
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, (u = function(y, x) {
796
+ if (tt(y) !== "object" || y === null) return y;
797
+ var v = y[Symbol.toPrimitive];
798
+ if (v !== void 0) {
799
+ var S = v.call(y, x);
800
+ if (tt(S) !== "object") return S;
1429
801
  throw new TypeError("@@toPrimitive must return a primitive value.");
1430
802
  }
1431
- return String(c);
1432
- }(t.key, "string"), tt(s) === "symbol" ? s : String(s)), t);
803
+ return String(y);
804
+ }(s.key, "string"), tt(u) === "symbol" ? u : String(u)), s);
1433
805
  }
1434
- var s;
806
+ var u;
1435
807
  }
1436
- function it(r, i, a) {
1437
- return i && pe(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), r;
808
+ function Nt(e, n, o) {
809
+ return n && cr(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1438
810
  }
1439
- var M = function() {
1440
- function r() {
1441
- var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
1442
- Pt(this, r), this.value = i, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
811
+ var j = function() {
812
+ function e() {
813
+ var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
814
+ Ht(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1443
815
  }
1444
- return it(r, [{ key: "clone", value: function() {
1445
- var i = new r(this.value);
1446
- return i.value = this.value, i.weight = this.weight, i.style = this.style, i.font = this.font, i.href = this.href, i.sub = this.sub, i.sup = this.sup, i;
816
+ return Nt(e, [{ key: "clone", value: function() {
817
+ var n = new e(this.value);
818
+ return n.value = this.value, n.weight = this.weight, n.style = this.style, n.font = this.font, n.href = this.href, n.sub = this.sub, n.sup = this.sup, n;
1447
819
  } }, { key: "valueOf", value: function() {
1448
820
  return this.value;
1449
821
  } }, { key: "toString", value: function() {
1450
822
  return this.value;
1451
- } }]), r;
1452
- }(), lt = function(r) {
1453
- rt(a, r);
1454
- var i = Vt(a);
1455
- function a() {
1456
- return Pt(this, a), i.apply(this, arguments);
823
+ } }]), e;
824
+ }(), Tt = function(e) {
825
+ it(o, e);
826
+ var n = Qt(o);
827
+ function o() {
828
+ return Ht(this, o), n.apply(this, arguments);
1457
829
  }
1458
- return it(a);
1459
- }(M), X = function(r) {
1460
- rt(a, r);
1461
- var i = Vt(a);
1462
- function a() {
1463
- return Pt(this, a), i.apply(this, arguments);
830
+ return Nt(o);
831
+ }(j), et = function(e) {
832
+ it(o, e);
833
+ var n = Qt(o);
834
+ function o() {
835
+ return Ht(this, o), n.apply(this, arguments);
1464
836
  }
1465
- return it(a);
1466
- }(M), ut = function(r) {
1467
- rt(a, r);
1468
- var i = Vt(a);
1469
- function a() {
1470
- return Pt(this, a), i.apply(this, arguments);
837
+ return Nt(o);
838
+ }(j), yt = function(e) {
839
+ it(o, e);
840
+ var n = Qt(o);
841
+ function o() {
842
+ return Ht(this, o), n.apply(this, arguments);
1471
843
  }
1472
- return it(a);
1473
- }(M), Lt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, ye = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, Xt = /^[\xA0\u2011\u202F\u2060\uFEFF]/, ve = /^(?:[;\xAD%?…]|,(?!\d))/, me = /^[´±°¢£¤$¥\u2212]/;
1474
- function kt(r, i) {
1475
- i !== !1 && (r = r.trim());
1476
- for (var a, t, s = [], c = r.charAt(0), p = 0, m = 1, w = r.length; m < w; m++) {
1477
- a = r.charAt(m), t = r.charAt(m + 1);
1478
- var b = Lt.test(c), E = Lt.test(a), D = E || b, T = void 0;
1479
- if ((me.test(a) && !Xt.test(c) || ve.test(c + t) && !Xt.test(a)) && (D = !0), c !== "-" && c !== "‐" && c !== "–" && c !== "—" || ((T = Lt.test(r.charAt(m - 2))) && !E && (D = !1), !T && ye.test(a + t) && (D = !0)), D) {
1480
- var O = r.slice(p, m);
1481
- /\u00AD$/.test(O) ? (s.push(new M(O.slice(0, -1))), s.push(new ut())) : (s.push(new M(O)), s.push(new lt())), p = m;
844
+ return Nt(o);
845
+ }(j), te = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, dr = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, we = /^[\xA0\u2011\u202F\u2060\uFEFF]/, fr = /^(?:[;\xAD%?…]|,(?!\d))/, gr = /^[´±°¢£¤$¥\u2212]/;
846
+ function jt(e, n) {
847
+ n !== !1 && (e = e.trim());
848
+ for (var o, s, u = [], y = e.charAt(0), x = 0, v = 1, S = e.length; v < S; v++) {
849
+ o = e.charAt(v), s = e.charAt(v + 1);
850
+ var _ = te.test(y), $ = te.test(o), I = $ || _, D = void 0;
851
+ if ((gr.test(o) && !we.test(y) || fr.test(y + s) && !we.test(o)) && (I = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((D = te.test(e.charAt(v - 2))) && !$ && (I = !1), !D && dr.test(o + s) && (I = !0)), I) {
852
+ var O = e.slice(x, v);
853
+ /\u00AD$/.test(O) ? (u.push(new j(O.slice(0, -1))), u.push(new yt())) : (u.push(new j(O)), u.push(new Tt())), x = v;
1482
854
  }
1483
- c = a;
855
+ y = o;
1484
856
  }
1485
- return s.push(new M(r.slice(p))), s;
1486
- }
1487
- const be = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "­", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "‌", zwj: "‍", lrm: "‎", rlm: "‏", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
1488
- var Be = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Gt = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Jt = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, It = /^<!--(.+?)-->/, Kt = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, _t = { b: function(r) {
1489
- r.weight = "bold";
1490
- }, strong: function(r) {
1491
- r.weight = "bold";
1492
- }, i: function(r) {
1493
- r.style = "italic";
1494
- }, em: function(r) {
1495
- r.style = "italic";
1496
- }, dfn: function(r) {
1497
- r.style = "italic";
1498
- }, cite: function(r) {
1499
- r.style = "italic";
1500
- }, code: function(r) {
1501
- r.family = "monospace";
1502
- }, kbd: function(r) {
1503
- r.family = "monospace";
1504
- }, samp: function(r) {
1505
- r.family = "monospace";
1506
- }, var: function(r) {
1507
- r.family = "monospace";
1508
- }, tt: function(r) {
1509
- r.family = "monospace";
1510
- }, sub: function(r) {
1511
- r.sub = !0;
1512
- }, sup: function(r) {
1513
- r.sup = !0;
1514
- } }, qe = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
1515
- function Zt(r) {
1516
- return r.replace(Kt, function(i, a, t, s) {
1517
- if (a || t) {
1518
- var c = a ? 10 : 16;
1519
- return String.fromCharCode(parseInt(a || t, c));
857
+ return u.push(new j(e.slice(x))), u;
858
+ }
859
+ const xe = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "­", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "‌", zwj: "‍", lrm: "‎", rlm: "‏", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
860
+ var pr = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, yr = /^<\/([a-zA-Z0-9]+)([^>]*)>/, mr = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, vr = /^<!--(.+?)-->/, wr = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, be = { b: function(e) {
861
+ e.weight = "bold";
862
+ }, strong: function(e) {
863
+ e.weight = "bold";
864
+ }, i: function(e) {
865
+ e.style = "italic";
866
+ }, em: function(e) {
867
+ e.style = "italic";
868
+ }, dfn: function(e) {
869
+ e.style = "italic";
870
+ }, cite: function(e) {
871
+ e.style = "italic";
872
+ }, code: function(e) {
873
+ e.family = "monospace";
874
+ }, kbd: function(e) {
875
+ e.family = "monospace";
876
+ }, samp: function(e) {
877
+ e.family = "monospace";
878
+ }, var: function(e) {
879
+ e.family = "monospace";
880
+ }, tt: function(e) {
881
+ e.family = "monospace";
882
+ }, sub: function(e) {
883
+ e.sub = !0;
884
+ }, sup: function(e) {
885
+ e.sup = !0;
886
+ } }, xr = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
887
+ function Ae(e) {
888
+ return e.replace(wr, function(n, o, s, u) {
889
+ if (o || s) {
890
+ var y = o ? 10 : 16;
891
+ return String.fromCharCode(parseInt(o || s, y));
1520
892
  }
1521
- return s in be ? be[s] : i;
893
+ return u in xe ? xe[u] : n;
1522
894
  });
1523
895
  }
1524
- function We(r) {
1525
- return r && r.length > 1 && (r[0] === '"' && r[r.length - 1] === '"' || r[0] === "'" && r[r.length - 1] === "'") ? r.slice(1, -1) : r;
896
+ function br(e) {
897
+ return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
1526
898
  }
1527
- var Ue = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1528
- function $t(r) {
1529
- var i, a = {};
1530
- if (r) {
899
+ var Ar = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
900
+ function kr(e) {
901
+ var n, o = {};
902
+ if (e) {
1531
903
  do
1532
- if (i = Ue.exec(r)) {
1533
- var t = Zt(We(i[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1534
- if (a[i[1]] = t, (r = r.slice(i[0].length)).length && /^\S/.test(r[0])) throw new Error("Attribute error");
904
+ if (n = Ar.exec(e)) {
905
+ var s = Ae(br(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
906
+ if (o[n[1]] = s, (e = e.slice(n[0].length)).length && /^\S/.test(e[0])) throw new Error("Attribute error");
1535
907
  }
1536
- while (i && r.length);
1537
- if (/\S/.test(r)) throw new Error("Attribute error");
908
+ while (n && e.length);
909
+ if (/\S/.test(e)) throw new Error("Attribute error");
1538
910
  }
1539
- return a;
1540
- }
1541
- const bt = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
1542
- var we = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, xe = /^%[^\n]+(?:\n|$)/, jt = /^[^#$%&~_^\\{}]+/, Ye = /^\\([&{}$%#_])/, Ve = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, Qt = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, q = { bf: function(r) {
1543
- r.weight = "bold";
1544
- }, it: function(r) {
1545
- r.style = "italic";
1546
- }, sl: function(r) {
1547
- r.style = "italic";
1548
- }, color: function(r, i) {
1549
- r.color = i;
1550
- }, href: function(r, i) {
1551
- r.href = i;
1552
- }, "^": function(r) {
1553
- r.sup = !0;
1554
- }, _: function(r) {
1555
- r.sub = !0;
1556
- }, par: function(r) {
1557
- this.tokens.push(new X(), new X());
1558
- }, newline: function(r) {
1559
- this.tokens.push(new X());
1560
- }, url: function(r, i) {
1561
- this.open_context().href = i, this.add_token(new M(i)), this.close_context();
911
+ return o;
912
+ }
913
+ const ke = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
914
+ var Er = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, Sr = /^%[^\n]+(?:\n|$)/, Cr = /^[^#$%&~_^\\{}]+/, _r = /^\\([&{}$%#_])/, Dr = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, Lr = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, X = { bf: function(e) {
915
+ e.weight = "bold";
916
+ }, it: function(e) {
917
+ e.style = "italic";
918
+ }, sl: function(e) {
919
+ e.style = "italic";
920
+ }, color: function(e, n) {
921
+ e.color = n;
922
+ }, href: function(e, n) {
923
+ e.href = n;
924
+ }, "^": function(e) {
925
+ e.sup = !0;
926
+ }, _: function(e) {
927
+ e.sub = !0;
928
+ }, par: function(e) {
929
+ this.tokens.push(new et(), new et());
930
+ }, newline: function(e) {
931
+ this.tokens.push(new et());
932
+ }, url: function(e, n) {
933
+ this.open_context().href = n, this.add_token(new j(n)), this.close_context();
1562
934
  } };
1563
- q.textsuperscript = q["^"], q.textsubscript = q._, q.textsl = q.sl, q.mathbf = q.bf, q.mathit = q.it, q.textbf = q.bf, q.textit = q.it, q.textcolor = q.color;
1564
- var Xe = /[\r\n\xA0]+/g;
1565
- function Ee(r, i) {
1566
- r.sup && (r.baseline = 0.45, r.size = 0.7), r.sub && (r.baseline = -0.3, r.size = 0.7);
1567
- var a = i;
1568
- return (r.style || r.weight || r.baseline || r.color || r.size || r.family) && (a = R(i, r)), a;
1569
- }
1570
- function te(r, i, a) {
1571
- for (var t, s, c = r.width; c + a.width > i && r.length; ) s = (t = r[r.length - 1]).width, t.width > a.width ? (t.value = t.value.slice(0, -1), t.width = B(t, t.font), c += t.width) : r.pop(), c -= s;
1572
- r[r.length - 1] instanceof ut && r.pop(), t = r[r.length - 1] || t || {}, a.font = R(a.font, t.bold, t.italic, ""), a.href = r.length ? t.href : null, a.rel = r.length ? t.rel : null, a.target = r.length ? t.target : null, r.push(a);
1573
- }
1574
- function ct(r) {
1575
- return Math.round(1e6 * r) / 1e6;
1576
- }
1577
- function Ae(r) {
1578
- return function(i) {
1579
- if (Array.isArray(i)) return Ft(i);
1580
- }(r) || function(i) {
1581
- if (typeof Symbol < "u" && i[Symbol.iterator] != null || i["@@iterator"] != null) return Array.from(i);
1582
- }(r) || function(i, a) {
1583
- if (i) {
1584
- if (typeof i == "string") return Ft(i, a);
1585
- var t = Object.prototype.toString.call(i).slice(8, -1);
1586
- return t === "Object" && i.constructor && (t = i.constructor.name), t === "Map" || t === "Set" ? Array.from(i) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Ft(i, a) : void 0;
935
+ X.textsuperscript = X["^"], X.textsubscript = X._, X.textsl = X.sl, X.mathbf = X.bf, X.mathit = X.it, X.textbf = X.bf, X.textit = X.it, X.textcolor = X.color;
936
+ var Tr = /[\r\n\xA0]+/g;
937
+ function $r(e, n) {
938
+ e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
939
+ var o = n;
940
+ return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = E(n, e)), o;
941
+ }
942
+ function Ee(e, n, o) {
943
+ for (var s, u, y = e.width; y + o.width > n && e.length; ) u = (s = e[e.length - 1]).width, s.width > o.width ? (s.value = s.value.slice(0, -1), s.width = P(s, s.font), y += s.width) : e.pop(), y -= u;
944
+ e[e.length - 1] instanceof yt && e.pop(), s = e[e.length - 1] || s || {}, o.font = E(o.font, s.bold, s.italic, ""), o.href = e.length ? s.href : null, o.rel = e.length ? s.rel : null, o.target = e.length ? s.target : null, e.push(o);
945
+ }
946
+ function bt(e) {
947
+ return Math.round(1e6 * e) / 1e6;
948
+ }
949
+ function Se(e) {
950
+ return function(n) {
951
+ if (Array.isArray(n)) return ee(n);
952
+ }(e) || function(n) {
953
+ if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
954
+ }(e) || function(n, o) {
955
+ if (n) {
956
+ if (typeof n == "string") return ee(n, o);
957
+ var s = Object.prototype.toString.call(n).slice(8, -1);
958
+ return s === "Object" && n.constructor && (s = n.constructor.name), s === "Map" || s === "Set" ? Array.from(n) : s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? ee(n, o) : void 0;
1587
959
  }
1588
- }(r) || function() {
960
+ }(e) || function() {
1589
961
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1590
962
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1591
963
  }();
1592
964
  }
1593
- function Ft(r, i) {
1594
- (i == null || i > r.length) && (i = r.length);
1595
- for (var a = 0, t = new Array(i); a < i; a++) t[a] = r[a];
1596
- return t;
965
+ function ee(e, n) {
966
+ (n == null || n > e.length) && (n = e.length);
967
+ for (var o = 0, s = new Array(n); o < n; o++) s[o] = e[o];
968
+ return s;
1597
969
  }
1598
- var ke = { center: "middle", right: "end" }, Ge = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ee = function(r, i) {
1599
- return !r && !i || r === i;
970
+ var Ir = { center: "middle", right: "end" }, Mr = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, re = function(e, n) {
971
+ return !e && !n || e === n;
1600
972
  };
1601
- function Je(r, i) {
1602
- var a = [], t = i.font(), s = t.size, c = t.family, p = i.align(), m = i.createElement();
1603
- if (r.length) {
1604
- var w = t.height, b = i.valign(), E = i.height()(), D = i.width()(0), T = !isFinite(D) && r.length === 1, O = T ? null : i.x(), j = ct(w / s), W = T ? null : ct(w / (1.15 * s + (w - s) / 2));
1605
- if (Ge[b] && isFinite(E)) {
1606
- var F = b === "bottom" ? 1 : 0.5;
1607
- W += (E * F - w * r.length * F) / s;
973
+ function Or(e, n) {
974
+ var o = [], s = n.font(), u = s.size, y = s.family, x = n.align(), v = n.createElement();
975
+ if (e.length) {
976
+ var S = s.height, _ = n.valign(), $ = n.height()(), I = n.width()(0), D = !isFinite(I) && e.length === 1, O = D ? null : n.x(), B = bt(S / u), J = D ? null : bt(S / (1.15 * u + (S - u) / 2));
977
+ if (Mr[_] && isFinite($)) {
978
+ var F = _ === "bottom" ? 1 : 0.5;
979
+ J += ($ * F - S * e.length * F) / u;
1608
980
  }
1609
- var P = p === "justify", H = 0;
1610
- p === "right" ? H = D : p === "center" && (H = D / 2);
1611
- for (var N = [], J = "tspan", K = null, U = "", I = function() {
1612
- if (U) {
1613
- var Ct = m(J, K, U);
1614
- N.push(Ct);
981
+ var z = x === "justify", q = 0;
982
+ x === "right" ? q = I : x === "center" && (q = I / 2);
983
+ for (var H = [], K = "tspan", G = null, R = "", T = function() {
984
+ if (R) {
985
+ var mt = v(K, G, R);
986
+ H.push(mt);
1615
987
  }
1616
- J = "tspan", K = null, U = "";
1617
- }, ot = 0, nt = r.length; ot < nt; ot++) {
1618
- var ft = "", Et = "", ht = 0, gt = r[ot];
1619
- if (gt.length) {
1620
- N = [];
1621
- for (var Mt = 0, le = 0, pt = void 0, Z = 0, Oe = gt.length; Z < Oe; Z++) {
1622
- var Y = gt[Z], Q = Y.font;
1623
- Y.whitespace && Mt++, le += Y.width, Z && !Y.tracking && !ht && ee(Q.id, ft) && ee(Y.class, Et) && ee(pt, Y.href) ? U += Y.value : (I(), U = Y.value, K = { fontFamily: Q.family !== c ? Q.family : null, fontSize: Q.size !== s ? Q.size : null, fontWeight: Q.weight || null, fontStyle: Q.style || null, fontVariant: Q.variant !== "normal" && Q.variant || null, fill: Q.color || null, baselineShift: Q.baseline ? 100 * Q.baseline + "%" : null, className: Y.class || null }, ht && (K.dx = ct(ht), ht = 0), Y.tracking && (ht = Q.size * Y.tracking), Y.href && !pt ? (pt = Y.href, J = "a", K.href = pt, K.rel = Y.rel, K.target = Y.target) : pt = null, ft = Q.id, Et = Y.class);
988
+ K = "tspan", G = null, R = "";
989
+ }, rt = 0, Q = e.length; rt < Q; rt++) {
990
+ var lt = "", gt = "", at = 0, ht = e[rt];
991
+ if (ht.length) {
992
+ H = [];
993
+ for (var At = 0, Mt = 0, ut = void 0, V = 0, Bt = ht.length; V < Bt; V++) {
994
+ var W = ht[V], Z = W.font;
995
+ W.whitespace && At++, Mt += W.width, V && !W.tracking && !at && re(Z.id, lt) && re(W.class, gt) && re(ut, W.href) ? R += W.value : (T(), R = W.value, G = { fontFamily: Z.family !== y ? Z.family : null, fontSize: Z.size !== u ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: W.class || null }, at && (G.dx = bt(at), at = 0), W.tracking && (at = Z.size * W.tracking), W.href && !ut ? (ut = W.href, K = "a", G.href = ut, G.rel = W.rel, G.target = W.target) : ut = null, lt = Z.id, gt = W.class);
1624
996
  }
1625
- if (I(), T) a.push.apply(a, Ae(N));
997
+ if (T(), D) o.push.apply(o, Se(H));
1626
998
  else {
1627
- var De = null, ue = ot === nt - 1 || gt[gt.length - 1] instanceof X;
1628
- P && gt.length > 1 && !ue && (De = ct((D - le) / Mt)), a.push(m.apply(void 0, ["tspan", { wordSpacing: De, x: O(ot) + H, dy: ct(ot ? j : W) + "em" }].concat(Ae(N))));
999
+ var qt = null, Ot = rt === Q - 1 || ht[ht.length - 1] instanceof et;
1000
+ z && ht.length > 1 && !Ot && (qt = bt((I - Mt) / At)), o.push(v.apply(void 0, ["tspan", { wordSpacing: qt, x: O(rt) + q, dy: bt(rt ? B : J) + "em" }].concat(Se(H))));
1629
1001
  }
1630
- } else a.push(m("tspan", { x: O(ot), dy: ct(ot ? j : W) + "em" }, " "));
1002
+ } else o.push(v("tspan", { x: O(rt), dy: bt(rt ? B : J) + "em" }, " "));
1631
1003
  }
1632
1004
  }
1633
- return m.apply(void 0, ["text", { fontFamily: c, fontSize: s, textAnchor: ke[p] || "start" }].concat(a));
1634
- }
1635
- var Ke = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1636
- function Ze(r, i, a) {
1637
- if (r.length) {
1638
- a.textBaseline = "middle";
1639
- var t = i.font(), s = t.height, c = t.size, p = i.valign(), m = i.height()(), w = i.width()(0), b = i.align(), E = b === "justify", D = 0.5 * s, T = Ke[p];
1640
- if (T && isFinite(m)) {
1641
- var O = r.length * s;
1642
- D += m * T - O * T;
1005
+ return v.apply(void 0, ["text", { fontFamily: y, fontSize: u, textAnchor: Ir[x] || "start" }].concat(o));
1006
+ }
1007
+ var zr = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1008
+ function Pr(e, n, o) {
1009
+ if (e.length) {
1010
+ o.textBaseline = "middle";
1011
+ var s = n.font(), u = s.height, y = s.size, x = n.valign(), v = n.height()(), S = n.width()(0), _ = n.align(), $ = _ === "justify", I = 0.5 * u, D = zr[x];
1012
+ if (D && isFinite(v)) {
1013
+ var O = e.length * u;
1014
+ I += v * D - O * D;
1643
1015
  }
1644
- r.forEach(function(j, W) {
1645
- var F = i.x()(W), P = W * s + D, H = 0, N = 0;
1646
- j.forEach(function(U) {
1647
- U.whitespace && H++, N += U.width;
1016
+ e.forEach(function(B, J) {
1017
+ var F = n.x()(J), z = J * u + I, q = 0, H = 0;
1018
+ B.forEach(function(R) {
1019
+ R.whitespace && q++, H += R.width;
1648
1020
  });
1649
- var J = 0, K = W === r.length - 1 || j[j.length - 1] instanceof X;
1650
- E && j.length > 1 && !K && (J = (w - N) / H), j.forEach(function(U) {
1651
- a.font = U.font;
1652
- var I = U.font, ot = I.baseline ? c * -I.baseline + 0.15 * c : 0;
1653
- a.fillStyle = function(Et, ht) {
1654
- return Et.color ? Et.color : ht.href ? "#00C" : "#000";
1655
- }(I, U);
1656
- var nt = 0;
1657
- if (b === "right" ? nt += w - N : b === "center" ? nt += w / 2 - N / 2 : b === "justify" && (U.whitespace || U instanceof X) && (F += J), a.fillText(U.value, F + nt, P + ot), U.href) {
1658
- a.beginPath(), a.strokeStyle = a.fillStyle;
1659
- var ft = Math.floor(P + 0.45 * c) + 0.5;
1660
- a.moveTo(F + nt, ft), a.lineTo(F + nt + U.width, ft), a.stroke();
1021
+ var K = 0, G = J === e.length - 1 || B[B.length - 1] instanceof et;
1022
+ $ && B.length > 1 && !G && (K = (S - H) / q), B.forEach(function(R) {
1023
+ o.font = R.font;
1024
+ var T = R.font, rt = T.baseline ? y * -T.baseline + 0.15 * y : 0;
1025
+ o.fillStyle = function(gt, at) {
1026
+ return gt.color ? gt.color : at.href ? "#00C" : "#000";
1027
+ }(T, R);
1028
+ var Q = 0;
1029
+ if (_ === "right" ? Q += S - H : _ === "center" ? Q += S / 2 - H / 2 : _ === "justify" && (R.whitespace || R instanceof et) && (F += K), o.fillText(R.value, F + Q, z + rt), R.href) {
1030
+ o.beginPath(), o.strokeStyle = o.fillStyle;
1031
+ var lt = Math.floor(z + 0.45 * y) + 0.5;
1032
+ o.moveTo(F + Q, lt), o.lineTo(F + Q + R.width, lt), o.stroke();
1661
1033
  }
1662
- F += U.width;
1034
+ F += R.width;
1663
1035
  });
1664
1036
  });
1665
1037
  }
1666
1038
  }
1667
- function re(r) {
1668
- return re = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1669
- return typeof i;
1670
- } : function(i) {
1671
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1672
- }, re(r);
1673
- }
1674
- function _e(r) {
1675
- for (var i = {}, a = 0; a < r.length; a++) {
1676
- var t = r[a];
1677
- typeof t != "number" && t != null && (typeof t == "string" ? i.text = t : typeof t == "function" ? i.fn = t : re(t) === "object" && t._groups ? i.d3 = t : t && t.nodeType && t.getContext ? i.ctx = t.getContext("2d") : t && t.fillText && t.beginPath ? i.ctx = t : t && (i.text = t));
1039
+ function ne(e) {
1040
+ return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1041
+ return typeof n;
1042
+ } : function(n) {
1043
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1044
+ }, ne(e);
1045
+ }
1046
+ function Ce(e) {
1047
+ for (var n = {}, o = 0; o < e.length; o++) {
1048
+ var s = e[o];
1049
+ typeof s != "number" && s != null && (typeof s == "string" ? n.text = s : typeof s == "function" ? n.fn = s : ne(s) === "object" && s._groups ? n.d3 = s : s && s.nodeType && s.getContext ? n.ctx = s.getContext("2d") : s && s.fillText && s.beginPath ? n.ctx = s : s && (n.text = s));
1678
1050
  }
1679
- return i;
1680
- }
1681
- function dt(r) {
1682
- return dt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1683
- return typeof i;
1684
- } : function(i) {
1685
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1686
- }, dt(r);
1687
- }
1688
- function Se(r, i) {
1689
- for (var a = 0; a < i.length; a++) {
1690
- var t = i[a];
1691
- t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
1692
- if (dt(c) !== "object" || c === null) return c;
1693
- var m = c[Symbol.toPrimitive];
1694
- if (m !== void 0) {
1695
- var w = m.call(c, p);
1696
- if (dt(w) !== "object") return w;
1051
+ return n;
1052
+ }
1053
+ function $t(e) {
1054
+ return $t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1055
+ return typeof n;
1056
+ } : function(n) {
1057
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1058
+ }, $t(e);
1059
+ }
1060
+ function Fr(e, n) {
1061
+ for (var o = 0; o < n.length; o++) {
1062
+ var s = n[o];
1063
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, (u = function(y, x) {
1064
+ if ($t(y) !== "object" || y === null) return y;
1065
+ var v = y[Symbol.toPrimitive];
1066
+ if (v !== void 0) {
1067
+ var S = v.call(y, x);
1068
+ if ($t(S) !== "object") return S;
1697
1069
  throw new TypeError("@@toPrimitive must return a primitive value.");
1698
1070
  }
1699
- return String(c);
1700
- }(t.key, "string"), dt(s) === "symbol" ? s : String(s)), t);
1071
+ return String(y);
1072
+ }(s.key, "string"), $t(u) === "symbol" ? u : String(u)), s);
1701
1073
  }
1702
- var s;
1074
+ var u;
1703
1075
  }
1704
- var wt = R(), St = function(r) {
1705
- return typeof r == "function" ? r : function() {
1706
- return r;
1076
+ var Hr = E(), ie = function(e) {
1077
+ return typeof e == "function" ? e : function() {
1078
+ return e;
1707
1079
  };
1708
- }, G = function() {
1709
- function r(t) {
1710
- if (function(c, p) {
1711
- if (!(c instanceof p)) throw new TypeError("Cannot call a class as a function");
1712
- }(this, r), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
1080
+ }, st = function() {
1081
+ function e(s) {
1082
+ if (function(y, x) {
1083
+ if (!(y instanceof x)) throw new TypeError("Cannot call a class as a function");
1084
+ }(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
1713
1085
  return 1 / 0;
1714
1086
  }, height: function() {
1715
1087
  return 1 / 0;
1716
1088
  }, x: function() {
1717
1089
  return 0;
1718
- }, font: null, tAnchor: 0, parser: r.defaultparser }, t) for (var s in t) typeof this[s] == "function" && this[s](t[s]);
1090
+ }, font: null, tAnchor: 0, parser: e.defaultparser }, s) for (var u in s) typeof this[u] == "function" && this[u](s[u]);
1719
1091
  }
1720
- var i, a;
1721
- return i = r, a = [{ key: "linebreak", value: function(t) {
1722
- var s = this, c = this.props.parser(String(t)), p = this.font(), m = function(w, b, E) {
1723
- if (!w.length) return [];
1724
- var D = b.height(), T = b.width(), O = b.overflowLine(), j = b.overflowWrap(), W = R(E, !0, !1), F = isFinite(D()) ? Math.floor(D() / E.height) : 1 / 0;
1725
- if (!D() && !T(0) || !F) return [];
1726
- for (var P = 0, H = 0, N = 0, J = [], K = [], U = !1; P < w.length && H < F; ) {
1727
- var I = w[P], ot = Ee(I, E);
1728
- if (I.width = B(I, ot), I.font = ot, I.line = H, I.whitespace = I.value in C, I.value && (I.value = I.value.replace(Xe, " ")), !(!N && I.whitespace || U && I.whitespace)) if (I instanceof X) N = 0, K = [], J.push(P + 1), H++;
1729
- else if (I instanceof lt || I instanceof ut) K.push({ index: P, width: N });
1730
- else if (I.whitespace || N + I.width < T(H)) N += I.width;
1731
- else if (K.length) {
1732
- var nt = void 0, ft = void 0;
1092
+ var n, o;
1093
+ return n = e, o = [{ key: "linebreak", value: function(s) {
1094
+ var u = this, y = this.props.parser(String(s)), x = this.font(), v = function(S, _, $) {
1095
+ if (!S.length) return [];
1096
+ var I = _.height(), D = _.width(), O = _.overflowLine(), B = _.overflowWrap(), J = E($, !0, !1), F = isFinite(I()) ? Math.floor(I() / $.height) : 1 / 0;
1097
+ if (!I() && !D(0) || !F) return [];
1098
+ for (var z = 0, q = 0, H = 0, K = [], G = [], R = !1; z < S.length && q < F; ) {
1099
+ var T = S[z], rt = $r(T, $);
1100
+ if (T.width = P(T, rt), T.font = rt, T.line = q, T.whitespace = T.value in k, T.value && (T.value = T.value.replace(Tr, " ")), !(!H && T.whitespace || R && T.whitespace)) if (T instanceof et) H = 0, G = [], K.push(z + 1), q++;
1101
+ else if (T instanceof Tt || T instanceof yt) G.push({ index: z, width: H });
1102
+ else if (T.whitespace || H + T.width < D(q)) H += T.width;
1103
+ else if (G.length) {
1104
+ var Q = void 0, lt = void 0;
1733
1105
  do {
1734
- ft = !0, nt = K.pop();
1735
- var Et = w[nt.index], ht = void 0;
1736
- Et instanceof ut && (ht = B("-", Et.font), nt.width + ht > T(H) && (ft = !K.length));
1737
- } while (!ft);
1738
- J.push(nt.index + 1), N = 0, H++, P = nt.index, K = [];
1739
- } else if (j === "break-word") {
1740
- var gt = T(H);
1741
- if (N + I.width > gt) {
1742
- var Mt = I.clone();
1106
+ lt = !0, Q = G.pop();
1107
+ var gt = S[Q.index], at = void 0;
1108
+ gt instanceof yt && (at = P("-", gt.font), Q.width + at > D(q) && (lt = !G.length));
1109
+ } while (!lt);
1110
+ K.push(Q.index + 1), H = 0, q++, z = Q.index, G = [];
1111
+ } else if (B === "break-word") {
1112
+ var ht = D(q);
1113
+ if (H + T.width > ht) {
1114
+ var At = T.clone();
1743
1115
  do
1744
- I.value = I.value.slice(0, -1), I.width = B(I, I.font), N += I.width;
1745
- while (I.value && I.width > gt);
1746
- Mt.value = Mt.value.slice(I.value.length), w.splice(P + 1, 0, new lt(), Mt);
1116
+ T.value = T.value.slice(0, -1), T.width = P(T, T.font), H += T.width;
1117
+ while (T.value && T.width > ht);
1118
+ At.value = At.value.slice(T.value.length), S.splice(z + 1, 0, new Tt(), At);
1747
1119
  }
1748
- J.push(P + 1), N = 0, H++;
1749
- } else N += I.width;
1750
- P++, U = I.whitespace;
1120
+ K.push(z + 1), H = 0, q++;
1121
+ } else H += T.width;
1122
+ z++, R = T.whitespace;
1751
1123
  }
1752
- P !== J[J.length - 1] && J.push(P);
1753
- var le = 0, pt = 0, Z = J.map(function(Ct) {
1754
- for (var et, Tt = le; (et = w[Tt]) && (et.whitespace || !et.value); ) Tt++;
1755
- for (var At = Ct, er = null; At > Tt && (et = w[At - 1]) && (et.whitespace || !(et.value || et instanceof ut)); ) et instanceof X && (er = et), At--;
1756
- et instanceof ut && (et.value = "-", et.width = B("-", et.font)), le = Ct;
1757
- var zt = w.slice(Tt, At).filter(function(rr) {
1758
- return rr.value;
1124
+ z !== K[K.length - 1] && K.push(z);
1125
+ var Mt = 0, ut = 0, V = K.map(function(mt) {
1126
+ for (var Y, vt = Mt; (Y = S[vt]) && (Y.whitespace || !Y.value); ) vt++;
1127
+ for (var pt = mt, ae = null; pt > vt && (Y = S[pt - 1]) && (Y.whitespace || !(Y.value || Y instanceof yt)); ) Y instanceof et && (ae = Y), pt--;
1128
+ Y instanceof yt && (Y.value = "-", Y.width = P("-", Y.font)), Mt = mt;
1129
+ var kt = S.slice(vt, pt).filter(function(le) {
1130
+ return le.value;
1759
1131
  });
1760
- return er && zt.push(er), zt.width = zt.reduce(function(rr, Jr) {
1761
- return rr + Jr.width;
1762
- }, 0), zt.width > pt && (pt = zt.width), zt;
1132
+ return ae && kt.push(ae), kt.width = kt.reduce(function(le, Rr) {
1133
+ return le + Rr.width;
1134
+ }, 0), kt.width > ut && (ut = kt.width), kt;
1763
1135
  });
1764
- if (Z.hasLineOverflow = !1, O) {
1765
- var Oe = O === "ellipsis" ? "…" : O;
1766
- Z.forEach(function(Ct, et) {
1767
- var Tt = T(et);
1768
- if (Ct.width > Tt) {
1769
- var At = new M(Oe);
1770
- At.font = E, At.width = B(Oe, W), te(Ct, Tt, At), Z.hasLineOverflow = !0;
1136
+ if (V.hasLineOverflow = !1, O) {
1137
+ var Bt = O === "ellipsis" ? "…" : O;
1138
+ V.forEach(function(mt, Y) {
1139
+ var vt = D(Y);
1140
+ if (mt.width > vt) {
1141
+ var pt = new j(Bt);
1142
+ pt.font = $, pt.width = P(Bt, J), Ee(mt, vt, pt), V.hasLineOverflow = !0;
1771
1143
  }
1772
1144
  });
1773
1145
  }
1774
- var Y = b.overflow() === "ellipsis" ? "…" : b.overflow();
1775
- if (Y && P !== w.length) {
1776
- var Q = T(Z.length - 1), De = Z[Z.length - 1], ue = new M(Y);
1777
- ue.font = E, ue.width = B(Y, W), te(De, Q, ue), Z.hasOverflow = !0;
1778
- } else Z.hasOverflow = !1;
1779
- return Z.font = E, Z.width = pt, Z;
1780
- }(c, this, p);
1781
- return m.height = m.length * p.height, m.render = function(w) {
1782
- return s.render(m, w);
1783
- }, m.svg = m.render, m.draw = m.render, m;
1784
- } }, { key: "font", value: function(t) {
1785
- return arguments.length ? (this.props.font = R(t), this) : this.props.font || R(wt);
1786
- } }, { key: "overflow", value: function(t) {
1787
- return arguments.length ? (this.props.overflow = String(t), this) : this.props.overflow;
1788
- } }, { key: "overflowLine", value: function(t) {
1789
- return arguments.length ? (this.props.lineclamp = String(t), this) : this.props.lineclamp;
1790
- } }, { key: "valign", value: function(t) {
1791
- return arguments.length ? (this.props.valign = t, this) : this.props.valign;
1792
- } }, { key: "align", value: function(t) {
1146
+ var W = _.overflow() === "ellipsis" ? "…" : _.overflow();
1147
+ if (W && z !== S.length) {
1148
+ var Z = D(V.length - 1), qt = V[V.length - 1], Ot = new j(W);
1149
+ Ot.font = $, Ot.width = P(W, J), Ee(qt, Z, Ot), V.hasOverflow = !0;
1150
+ } else V.hasOverflow = !1;
1151
+ return V.font = $, V.width = ut, V;
1152
+ }(y, this, x);
1153
+ return v.height = v.length * x.height, v.render = function(S) {
1154
+ return u.render(v, S);
1155
+ }, v.svg = v.render, v.draw = v.render, v;
1156
+ } }, { key: "font", value: function(s) {
1157
+ return arguments.length ? (this.props.font = E(s), this) : this.props.font || E(Hr);
1158
+ } }, { key: "overflow", value: function(s) {
1159
+ return arguments.length ? (this.props.overflow = String(s), this) : this.props.overflow;
1160
+ } }, { key: "overflowLine", value: function(s) {
1161
+ return arguments.length ? (this.props.lineclamp = String(s), this) : this.props.lineclamp;
1162
+ } }, { key: "valign", value: function(s) {
1163
+ return arguments.length ? (this.props.valign = s, this) : this.props.valign;
1164
+ } }, { key: "align", value: function(s) {
1793
1165
  if (!arguments.length) return this.props.align;
1794
- var s = String(t).toLowerCase();
1795
- return s === "left" || s === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : s === "center" || s === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : s === "end" || s === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : s === "justify" && (this.props.align = t, this.props.tAnchor = 0), this;
1796
- } }, { key: "overflowWrap", value: function(t) {
1166
+ var u = String(s).toLowerCase();
1167
+ return u === "left" || u === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : u === "center" || u === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : u === "end" || u === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : u === "justify" && (this.props.align = s, this.props.tAnchor = 0), this;
1168
+ } }, { key: "overflowWrap", value: function(s) {
1797
1169
  if (!arguments.length) return this.props.overflowWrap || "normal";
1798
- var s = String(t).toLowerCase();
1799
- return s === "break-word" ? this.props.overflowWrap = "break-word" : s !== "normal" && t != null || (this.props.overflowWrap = null), this;
1800
- } }, { key: "width", value: function(t) {
1801
- return arguments.length ? (this.props.width = St(t), this) : this.props.width;
1802
- } }, { key: "height", value: function(t) {
1803
- return arguments.length ? (this.props.height = St(t), this) : this.props.height;
1804
- } }, { key: "x", value: function(t) {
1805
- return arguments.length ? (this.props.x = St(t), this) : this.props.x;
1806
- } }, { key: "parser", value: function(t) {
1170
+ var u = String(s).toLowerCase();
1171
+ return u === "break-word" ? this.props.overflowWrap = "break-word" : u !== "normal" && s != null || (this.props.overflowWrap = null), this;
1172
+ } }, { key: "width", value: function(s) {
1173
+ return arguments.length ? (this.props.width = ie(s), this) : this.props.width;
1174
+ } }, { key: "height", value: function(s) {
1175
+ return arguments.length ? (this.props.height = ie(s), this) : this.props.height;
1176
+ } }, { key: "x", value: function(s) {
1177
+ return arguments.length ? (this.props.x = ie(s), this) : this.props.x;
1178
+ } }, { key: "parser", value: function(s) {
1807
1179
  if (!arguments.length) return this.props.parser;
1808
- if (typeof t == "string") {
1809
- var s = r[t] || r[t + "parser"];
1810
- typeof s == "function" && (t = s);
1180
+ if (typeof s == "string") {
1181
+ var u = e[s] || e[s + "parser"];
1182
+ typeof u == "function" && (s = u);
1811
1183
  }
1812
- if (typeof t != "function") throw new Error("Unknown parser: " + t);
1813
- return this.props.parser = t, this;
1814
- } }, { key: "createElement", value: function(t) {
1815
- return arguments.length ? (this.props.createElement = t, this) : this.props.createElement || r.createElement;
1184
+ if (typeof s != "function") throw new Error("Unknown parser: " + s);
1185
+ return this.props.parser = s, this;
1186
+ } }, { key: "createElement", value: function(s) {
1187
+ return arguments.length ? (this.props.createElement = s, this) : this.props.createElement || e.createElement;
1816
1188
  } }, { key: "render", value: function() {
1817
- var t = _e(arguments);
1818
- return typeof t.text == "string" && (t.text = this.linebreak(t.text)), t.ctx ? Ze(t.text, this, t.ctx) : Je(t.text, this);
1819
- } }], a && Se(i.prototype, a), Object.defineProperty(i, "prototype", { writable: !1 }), r;
1189
+ var s = Ce(arguments);
1190
+ return typeof s.text == "string" && (s.text = this.linebreak(s.text)), s.ctx ? Pr(s.text, this, s.ctx) : Or(s.text, this);
1191
+ } }], o && Fr(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1820
1192
  }();
1821
- function xt(r) {
1822
- return xt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1823
- return typeof i;
1824
- } : function(i) {
1825
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1826
- }, xt(r);
1827
- }
1828
- function ne(r, i) {
1829
- (i == null || i > r.length) && (i = r.length);
1830
- for (var a = 0, t = new Array(i); a < i; a++) t[a] = r[a];
1831
- return t;
1193
+ function It(e) {
1194
+ return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1195
+ return typeof n;
1196
+ } : function(n) {
1197
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1198
+ }, It(e);
1199
+ }
1200
+ function se(e, n) {
1201
+ (n == null || n > e.length) && (n = e.length);
1202
+ for (var o = 0, s = new Array(n); o < n; o++) s[o] = e[o];
1203
+ return s;
1832
1204
  }
1833
- function Ce(r, i) {
1834
- for (var a = 0; a < i.length; a++) {
1835
- var t = i[a];
1836
- t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
1837
- if (xt(c) !== "object" || c === null) return c;
1838
- var m = c[Symbol.toPrimitive];
1839
- if (m !== void 0) {
1840
- var w = m.call(c, p);
1841
- if (xt(w) !== "object") return w;
1205
+ function Nr(e, n) {
1206
+ for (var o = 0; o < n.length; o++) {
1207
+ var s = n[o];
1208
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, (u = function(y, x) {
1209
+ if (It(y) !== "object" || y === null) return y;
1210
+ var v = y[Symbol.toPrimitive];
1211
+ if (v !== void 0) {
1212
+ var S = v.call(y, x);
1213
+ if (It(S) !== "object") return S;
1842
1214
  throw new TypeError("@@toPrimitive must return a primitive value.");
1843
1215
  }
1844
- return String(c);
1845
- }(t.key, "string"), xt(s) === "symbol" ? s : String(s)), t);
1216
+ return String(y);
1217
+ }(s.key, "string"), It(u) === "symbol" ? u : String(u)), s);
1846
1218
  }
1847
- var s;
1219
+ var u;
1848
1220
  }
1849
- var Te = function(r) {
1850
- return typeof r == "function" ? r : function() {
1851
- return r;
1221
+ var _e = function(e) {
1222
+ return typeof e == "function" ? e : function() {
1223
+ return e;
1852
1224
  };
1853
- }, ie = function() {
1854
- function r(t) {
1855
- if (function(c, p) {
1856
- if (!(c instanceof p)) throw new TypeError("Cannot call a class as a function");
1857
- }(this, r), this.props = { width: function() {
1225
+ }, De = function() {
1226
+ function e(s) {
1227
+ if (function(y, x) {
1228
+ if (!(y instanceof x)) throw new TypeError("Cannot call a class as a function");
1229
+ }(this, e), this.props = { width: function() {
1858
1230
  return 1 / 0;
1859
1231
  }, height: function() {
1860
1232
  return 1 / 0;
1861
- }, rotation: 0, vAnchor: 0, hAnchor: 0 }, t) for (var s in t) typeof this[s] == "function" && this[s](t[s]);
1233
+ }, rotation: 0, vAnchor: 0, hAnchor: 0 }, s) for (var u in s) typeof this[u] == "function" && this[u](s[u]);
1862
1234
  this.render = this.render.bind(this);
1863
1235
  }
1864
- var i, a;
1865
- return i = r, a = [{ key: "anchor", value: function(t) {
1866
- var s = this.props, c = s.hAnchor, p = s.vAnchor, m = s.width, w = s.height;
1867
- if (!arguments.length) return [c * m(0), p * w(0)];
1868
- if (typeof t == "string") {
1869
- var b = this.props;
1870
- t.toLowerCase().trim().split(/\s+/).forEach(function(E) {
1871
- E === "top" && (b.vAnchor = -0), E === "middle" && (b.vAnchor = -0.5), E === "bottom" && (b.vAnchor = -1), E === "left" && (b.hAnchor = -0), E === "center" && (b.hAnchor = -0.5), E === "right" && (b.hAnchor = -1);
1236
+ var n, o;
1237
+ return n = e, o = [{ key: "anchor", value: function(s) {
1238
+ var u = this.props, y = u.hAnchor, x = u.vAnchor, v = u.width, S = u.height;
1239
+ if (!arguments.length) return [y * v(0), x * S(0)];
1240
+ if (typeof s == "string") {
1241
+ var _ = this.props;
1242
+ s.toLowerCase().trim().split(/\s+/).forEach(function($) {
1243
+ $ === "top" && (_.vAnchor = -0), $ === "middle" && (_.vAnchor = -0.5), $ === "bottom" && (_.vAnchor = -1), $ === "left" && (_.hAnchor = -0), $ === "center" && (_.hAnchor = -0.5), $ === "right" && (_.hAnchor = -1);
1872
1244
  });
1873
1245
  }
1874
1246
  return this;
1875
- } }, { key: "width", value: function(t) {
1876
- return arguments.length ? (this.props.width = Te(t), this) : this.props.width;
1877
- } }, { key: "height", value: function(t) {
1878
- return arguments.length ? (this.props.height = Te(t), this) : this.props.height;
1879
- } }, { key: "rotate", value: function(t) {
1880
- return arguments.length ? (this.props.rotation = t, this) : this.props.rotation;
1881
- } }, { key: "createElement", value: function(t) {
1882
- return arguments.length ? (this.props.createElement = t, this) : this.props.createElement || r.createElement;
1883
- } }, { key: "canvas", value: function(t, s) {
1884
- var c, p = t.getContext ? t.getContext("2d") : t;
1885
- return p.save(), p.rotate(this.rotate() * Math.PI / 180), p.translate.apply(p, function(m) {
1886
- if (Array.isArray(m)) return ne(m);
1887
- }(c = this.anchor()) || function(m) {
1888
- if (typeof Symbol < "u" && m[Symbol.iterator] != null || m["@@iterator"] != null) return Array.from(m);
1889
- }(c) || function(m, w) {
1890
- if (m) {
1891
- if (typeof m == "string") return ne(m, w);
1892
- var b = Object.prototype.toString.call(m).slice(8, -1);
1893
- return b === "Object" && m.constructor && (b = m.constructor.name), b === "Map" || b === "Set" ? Array.from(m) : b === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b) ? ne(m, w) : void 0;
1247
+ } }, { key: "width", value: function(s) {
1248
+ return arguments.length ? (this.props.width = _e(s), this) : this.props.width;
1249
+ } }, { key: "height", value: function(s) {
1250
+ return arguments.length ? (this.props.height = _e(s), this) : this.props.height;
1251
+ } }, { key: "rotate", value: function(s) {
1252
+ return arguments.length ? (this.props.rotation = s, this) : this.props.rotation;
1253
+ } }, { key: "createElement", value: function(s) {
1254
+ return arguments.length ? (this.props.createElement = s, this) : this.props.createElement || e.createElement;
1255
+ } }, { key: "canvas", value: function(s, u) {
1256
+ var y, x = s.getContext ? s.getContext("2d") : s;
1257
+ return x.save(), x.rotate(this.rotate() * Math.PI / 180), x.translate.apply(x, function(v) {
1258
+ if (Array.isArray(v)) return se(v);
1259
+ }(y = this.anchor()) || function(v) {
1260
+ if (typeof Symbol < "u" && v[Symbol.iterator] != null || v["@@iterator"] != null) return Array.from(v);
1261
+ }(y) || function(v, S) {
1262
+ if (v) {
1263
+ if (typeof v == "string") return se(v, S);
1264
+ var _ = Object.prototype.toString.call(v).slice(8, -1);
1265
+ return _ === "Object" && v.constructor && (_ = v.constructor.name), _ === "Map" || _ === "Set" ? Array.from(v) : _ === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_) ? se(v, S) : void 0;
1894
1266
  }
1895
- }(c) || function() {
1267
+ }(y) || function() {
1896
1268
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1897
1269
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1898
- }()), s(p), p.restore(), p;
1270
+ }()), u(x), x.restore(), x;
1899
1271
  } }, { key: "render", value: function() {
1900
- var t = _e(arguments);
1901
- if (t.d3) return t.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1902
- if (t.ctx) return this.canvas(t.ctx, t.fn);
1903
- if (t.text) {
1904
- var s = typeof t.text.render == "function" ? t.text.render() : t.text;
1905
- return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, s);
1272
+ var s = Ce(arguments);
1273
+ if (s.d3) return s.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1274
+ if (s.ctx) return this.canvas(s.ctx, s.fn);
1275
+ if (s.text) {
1276
+ var u = typeof s.text.render == "function" ? s.text.render() : s.text;
1277
+ return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, u);
1906
1278
  }
1907
- } }], a && Ce(i.prototype, a), Object.defineProperty(i, "prototype", { writable: !1 }), r;
1908
- }(), Re = Object.prototype.hasOwnProperty, oe = {};
1909
- function Qe(r) {
1910
- return oe[r] || (oe[r] = r.replace(/([a-z])([A-Z])/g, function(i, a, t) {
1911
- return a + "-" + t.toLowerCase();
1912
- })), oe[r];
1913
- }
1914
- function se(r, i) {
1915
- if (Array.isArray(i)) return i.forEach(function(a) {
1916
- return se(r, a);
1279
+ } }], o && Nr(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1280
+ }(), jr = Object.prototype.hasOwnProperty, oe = {};
1281
+ function Br(e) {
1282
+ return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, s) {
1283
+ return o + "-" + s.toLowerCase();
1284
+ })), oe[e];
1285
+ }
1286
+ function Le(e, n) {
1287
+ if (Array.isArray(n)) return n.forEach(function(o) {
1288
+ return Le(e, o);
1917
1289
  });
1918
- typeof i == "string" && (i = document.createTextNode(i)), r.appendChild(i);
1290
+ typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1919
1291
  }
1920
- function ae(r, i) {
1292
+ function Te(e, n) {
1921
1293
  if (typeof document < "u") {
1922
- var a = typeof r == "string" ? document.createElementNS("http://www.w3.org/2000/svg", r) : r;
1923
- if (i && a.setAttribute) for (var t in i) Re.call(i, t) && i[t] != null && a.setAttribute(t === "className" ? "class" : Qe(t), i[t]);
1924
- for (var s = arguments.length, c = new Array(s > 2 ? s - 2 : 0), p = 2; p < s; p++) c[p - 2] = arguments[p];
1925
- return c != null && c.length && c.forEach(function(m) {
1926
- se(a, m);
1927
- }), a;
1294
+ var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1295
+ if (n && o.setAttribute) for (var s in n) jr.call(n, s) && n[s] != null && o.setAttribute(s === "className" ? "class" : Br(s), n[s]);
1296
+ for (var u = arguments.length, y = new Array(u > 2 ? u - 2 : 0), x = 2; x < u; x++) y[x - 2] = arguments[x];
1297
+ return y != null && y.length && y.forEach(function(v) {
1298
+ Le(o, v);
1299
+ }), o;
1928
1300
  }
1929
1301
  }
1930
- G.createElement = ae, G.textparser = kt, G.defaultparser = kt, G.htmlparser = function(r) {
1931
- r = String(r || "").trim();
1932
- for (var i, a, t = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, s = [], c = [], p = function(D) {
1933
- for (var T in t) t[T] && (D[T] = t[T]);
1934
- s.push(D);
1935
- }, m = function(D) {
1936
- var T = s.length, O = qe[D];
1937
- if (T && O) {
1938
- for (var j = T - 1; s[j] && (s[j] instanceof lt || Be.test(s[j].value)); ) j--;
1939
- for (; O && s[j] && s[j] instanceof X; ) j--, O--;
1940
- for (; O-- > 0; ) s.push(new X());
1302
+ st.createElement = Te, st.textparser = jt, st.defaultparser = jt, st.htmlparser = function(e) {
1303
+ e = String(e || "").trim();
1304
+ for (var n, o, s = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, u = [], y = [], x = function(I) {
1305
+ for (var D in s) s[D] && (I[D] = s[D]);
1306
+ u.push(I);
1307
+ }, v = function(I) {
1308
+ var D = u.length, O = xr[I];
1309
+ if (D && O) {
1310
+ for (var B = D - 1; u[B] && (u[B] instanceof Tt || pr.test(u[B].value)); ) B--;
1311
+ for (; O && u[B] && u[B] instanceof et; ) B--, O--;
1312
+ for (; O-- > 0; ) u.push(new et());
1941
1313
  }
1942
- }; r.length; ) {
1943
- if (i = /^[^<]+/.exec(r)) kt(Zt(i[0]), !1).forEach(p);
1944
- else if (!(i = It.exec(r))) if (i = Gt.exec(r)) c.length && (t = c.pop()), m(i[1]);
1945
- else if (i = Jt.exec(r)) {
1946
- var w = i[1];
1947
- m(w), c.push(t), t = Object.create(t), _t[w] && _t[w](t, "");
1948
- var b = $t(i[2]);
1949
- w === "a" && (b.href && (t.href = b.href), b.rel && (t.rel = b.rel), b.target && (t.target = b.target)), b.class && (t.class = t.class ? t.class + " " + b.class : b.class), b.style && (a = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(b.style)) && a[1] && (t.color = a[1]), w === "br" && s.push(new X());
1950
- } else i = [r.slice(0, 1)], p(new M(i[0]));
1951
- r = r.slice(i[0].length);
1314
+ }; e.length; ) {
1315
+ if (n = /^[^<]+/.exec(e)) jt(Ae(n[0]), !1).forEach(x);
1316
+ else if (!(n = vr.exec(e))) if (n = yr.exec(e)) y.length && (s = y.pop()), v(n[1]);
1317
+ else if (n = mr.exec(e)) {
1318
+ var S = n[1];
1319
+ v(S), y.push(s), s = Object.create(s), be[S] && be[S](s, "");
1320
+ var _ = kr(n[2]);
1321
+ S === "a" && (_.href && (s.href = _.href), _.rel && (s.rel = _.rel), _.target && (s.target = _.target)), _.class && (s.class = s.class ? s.class + " " + _.class : _.class), _.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(_.style)) && o[1] && (s.color = o[1]), S === "br" && u.push(new et());
1322
+ } else n = [e.slice(0, 1)], x(new j(n[0]));
1323
+ e = e.slice(n[0].length);
1952
1324
  }
1953
- for (var E = s[s.length - 1]; E instanceof X; ) s.pop(), E = s[s.length - 1];
1954
- return s;
1955
- }, G.latexparser = function(r) {
1956
- r = String(r || "").trim();
1957
- var i = [0];
1958
- r = r.replace(/\\verb,(.*?),/, function(F, P) {
1959
- return i.push(P), "\\verb," + (i.length - 1) + ",";
1325
+ for (var $ = u[u.length - 1]; $ instanceof et; ) u.pop(), $ = u[u.length - 1];
1326
+ return u;
1327
+ }, st.latexparser = function(e) {
1328
+ e = String(e || "").trim();
1329
+ var n = [0];
1330
+ e = e.replace(/\\verb,(.*?),/, function(F, z) {
1331
+ return n.push(z), "\\verb," + (n.length - 1) + ",";
1960
1332
  }).replace(/\\\\\n/g, function() {
1961
1333
  return "\\\\";
1962
- }).replace(Ve, function(F, P, H) {
1963
- return H.charAt(P - 1) === "\\" ? F : Qt[F];
1334
+ }).replace(Dr, function(F, z, q) {
1335
+ return q.charAt(z - 1) === "\\" ? F : Lr[F];
1964
1336
  }).replace(/\n\s+/g, function(F) {
1965
1337
  return /\n/.test(F.slice(1)) ? "\\par " : F;
1966
- }).replace(/\\symbol\{(\d+)\}/, function(F, P, H, N) {
1967
- return N.charAt(H - 1) === "\\" ? F : String.fromCharCode(1 * P);
1968
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(F, P, H, N) {
1969
- return P + H + "{" + N + "}";
1970
- }).replace(/\\verb,(.*?),/, function(F, P) {
1971
- return "\\verb,".concat(i[+P], ",");
1338
+ }).replace(/\\symbol\{(\d+)\}/, function(F, z, q, H) {
1339
+ return H.charAt(q - 1) === "\\" ? F : String.fromCharCode(1 * z);
1340
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(F, z, q, H) {
1341
+ return z + q + "{" + H + "}";
1342
+ }).replace(/\\verb,(.*?),/, function(F, z) {
1343
+ return "\\verb,".concat(n[+z], ",");
1972
1344
  });
1973
- for (var a, t = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, s = [], c = [], p = function(F) {
1974
- for (var P in t) t[P] && (F[P] = t[P]);
1975
- return s.push(F), F;
1976
- }, m = function() {
1977
- c.push(t), t = Object.create(t);
1978
- }, w = function() {
1979
- if (!c.length) throw new Error("Unexpected }");
1980
- t = c.pop();
1981
- }, b = { tokens: s, open_context: m, close_context: w, add_token: p }; r.length; ) {
1982
- if (a = jt.exec(r)) kt(a[0], !1).forEach(p);
1983
- else if (a = Ye.exec(r)) p(new M(a[1]));
1984
- else if (!(a = xe.exec(r))) {
1985
- if (a = /^\{/.exec(r)) m();
1986
- else if (a = /^\}/.exec(r)) w();
1987
- else if (!(a = /^\$/.exec(r))) if (a = /^\\verb,([^,]+),/.exec(r)) p(new M(a[1]));
1988
- else if (a = we.exec(r)) {
1989
- var E = a[1].slice(1) || a[1], D = !!a[2];
1990
- if (/^(La)?TeX$/i.test(E)) {
1991
- m(), t.family = "serif";
1992
- var T = void 0;
1993
- E === "LaTeX" && ((T = p(new M("L"))).tracking = -0.25, (T = p(new M("A"))).size = 0.7, T.baseline = 0.3, T.tracking = -0.1), (T = p(new M("T"))).tracking = -0.17, (T = p(new M("E"))).baseline = -0.22, T.tracking = -0.13, T = p(new M("X")), w();
1994
- } else if (E in bt) p(new M(bt[E])), D && m();
1995
- else if (E in q) {
1996
- var O = [], j = q[E].length - 1, W = void 0;
1997
- if (j) {
1998
- for (D = !1, r = r.slice(a[0].length - 1); j--; ) {
1999
- if (!(W = /^\{([^}]+)\}/.exec(r))) throw new Error(E + " is missing an argument");
2000
- O.push(W[1]), r = r.slice(W[0].length);
1345
+ for (var o, s = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, u = [], y = [], x = function(F) {
1346
+ for (var z in s) s[z] && (F[z] = s[z]);
1347
+ return u.push(F), F;
1348
+ }, v = function() {
1349
+ y.push(s), s = Object.create(s);
1350
+ }, S = function() {
1351
+ if (!y.length) throw new Error("Unexpected }");
1352
+ s = y.pop();
1353
+ }, _ = { tokens: u, open_context: v, close_context: S, add_token: x }; e.length; ) {
1354
+ if (o = Cr.exec(e)) jt(o[0], !1).forEach(x);
1355
+ else if (o = _r.exec(e)) x(new j(o[1]));
1356
+ else if (!(o = Sr.exec(e))) {
1357
+ if (o = /^\{/.exec(e)) v();
1358
+ else if (o = /^\}/.exec(e)) S();
1359
+ else if (!(o = /^\$/.exec(e))) if (o = /^\\verb,([^,]+),/.exec(e)) x(new j(o[1]));
1360
+ else if (o = Er.exec(e)) {
1361
+ var $ = o[1].slice(1) || o[1], I = !!o[2];
1362
+ if (/^(La)?TeX$/i.test($)) {
1363
+ v(), s.family = "serif";
1364
+ var D = void 0;
1365
+ $ === "LaTeX" && ((D = x(new j("L"))).tracking = -0.25, (D = x(new j("A"))).size = 0.7, D.baseline = 0.3, D.tracking = -0.1), (D = x(new j("T"))).tracking = -0.17, (D = x(new j("E"))).baseline = -0.22, D.tracking = -0.13, D = x(new j("X")), S();
1366
+ } else if ($ in ke) x(new j(ke[$])), I && v();
1367
+ else if ($ in X) {
1368
+ var O = [], B = X[$].length - 1, J = void 0;
1369
+ if (B) {
1370
+ for (I = !1, e = e.slice(o[0].length - 1); B--; ) {
1371
+ if (!(J = /^\{([^}]+)\}/.exec(e))) throw new Error($ + " is missing an argument");
1372
+ O.push(J[1]), e = e.slice(J[0].length);
2001
1373
  }
2002
- a[0] = /^\{/.exec(r) ? "{" : "", D = !!a[0];
1374
+ o[0] = /^\{/.exec(e) ? "{" : "", I = !!o[0];
2003
1375
  }
2004
- D && m(), q[E].apply(b, [t].concat(O));
2005
- } else console.warn("unknown latex command", E), p(new M(a[1])), D && m();
2006
- } else a = [r.slice(0, 1)], p(new M(a[0]));
1376
+ I && v(), X[$].apply(_, [s].concat(O));
1377
+ } else console.warn("unknown latex command", $), x(new j(o[1])), I && v();
1378
+ } else o = [e.slice(0, 1)], x(new j(o[0]));
2007
1379
  }
2008
- r = r.slice(a[0].length);
1380
+ e = e.slice(o[0].length);
2009
1381
  }
2010
- return s;
2011
- }, G.measureText = function(r, i, a) {
2012
- return B(r, R(i), a);
2013
- }, G.Token = M, G.Break = lt, G.LineBreak = X, G.SoftHyphen = ut, G.Rotator = ie, ie.createElement = ae;
2014
- const tr = G;
2015
- return n.default;
1382
+ return u;
1383
+ }, st.measureText = function(e, n, o) {
1384
+ return P(e, E(n), o);
1385
+ }, st.Token = j, st.Break = Tt, st.LineBreak = et, st.SoftHyphen = yt, st.Rotator = De, De.createElement = Te;
1386
+ const qr = st;
1387
+ return r.default;
2016
1388
  })());
2017
- }(dr)), dr.exports;
1389
+ }(ve)), ve.exports;
2018
1390
  }
2019
- var Cn = Sn();
2020
- const Tr = /* @__PURE__ */ Ur(Cn);
2021
- function or(u) {
2022
- return u.replace(/…$/, "");
1391
+ var mn = yn();
1392
+ const Re = /* @__PURE__ */ sr(mn);
1393
+ function ce(l) {
1394
+ return l.replace(/…$/, "");
2023
1395
  }
2024
- function sr(u) {
2025
- return u.children[0].innerHTML;
1396
+ function de(l) {
1397
+ return l.children[0].innerHTML;
2026
1398
  }
2027
- function Tn(u, e) {
2028
- const o = mt(u), { fontSize: n, font: l, padding: h = 0 } = u.properties.style || {};
2029
- if (o.width === o.height && o.width === 0) return;
2030
- const d = new Tr({
2031
- font: `${n}px/${n}px ${l}`.replace(/(px)+/g, "px"),
2032
- width: o.width - h * 2,
2033
- height: o.height - h * 2,
1399
+ function vn(l, t) {
1400
+ const i = ft(l), { fontSize: r, font: a, padding: h = 0 } = l.properties.style || {};
1401
+ if (i.width === i.height && i.width === 0) return;
1402
+ const c = new Re({
1403
+ font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
1404
+ width: i.width - h * 2,
1405
+ height: i.height - h * 2,
2034
1406
  align: "left",
2035
1407
  valign: "top",
2036
1408
  x: 0,
2037
1409
  overflow: "ellipsis",
2038
1410
  parser: "html",
2039
- createElement: Tr.createElement
1411
+ createElement: Re.createElement
2040
1412
  });
2041
- d.overflowWrap("break-word");
2042
- const g = d.linebreak(
2043
- u.properties.content.replaceAll(`
1413
+ c.overflowWrap("break-word");
1414
+ const d = c.linebreak(
1415
+ l.properties.content.replaceAll(`
2044
1416
  `, "<br>")
2045
- ).render(), f = [...g.children];
2046
- let v = 0;
2047
- const y = [];
2048
- u.properties.content.split(`
2049
- `).forEach((S) => {
2050
- let R = S;
2051
- for (; R.length && v < f.length; ) {
2052
- if (f[v].innerHTML === "&nbsp;") {
2053
- R.startsWith(`
2054
- `) || y.push(v), v++;
1417
+ ).render(), f = [...d.children];
1418
+ let g = 0;
1419
+ const p = [];
1420
+ l.properties.content.split(`
1421
+ `).forEach((A) => {
1422
+ let E = A;
1423
+ for (; E.length && g < f.length; ) {
1424
+ if (f[g].innerHTML === "&nbsp;") {
1425
+ E.startsWith(`
1426
+ `) || p.push(g), g++;
2055
1427
  break;
2056
1428
  }
2057
- const C = or(sr(f[v]));
2058
- R.startsWith(C) && (R = R.slice(C.length).trim()), v++;
1429
+ const k = ce(de(f[g]));
1430
+ E.startsWith(k) && (E = E.slice(k.length).trim()), g++;
2059
1431
  }
2060
- }), y.forEach((S) => g.removeChild(f[S]));
2061
- const A = u.properties.content.match(/(https?:\/\/.*)/gm), k = A ? A.map((S) => S.split(" ")[0]) : [];
2062
- g.setAttribute("transform", `translate(${h}, ${h})`), k.forEach((S) => {
2063
- let R = S;
2064
- const C = [];
2065
- for (; R.length > 0; ) {
1432
+ }), p.forEach((A) => d.removeChild(f[A]));
1433
+ const w = l.properties.content.match(/(https?:\/\/.*)/gm), b = w ? w.map((A) => A.split(" ")[0]) : [];
1434
+ d.setAttribute("transform", `translate(${h}, ${h})`), b.forEach((A) => {
1435
+ let E = A;
1436
+ const k = [];
1437
+ for (; E.length > 0; ) {
2066
1438
  const L = f.find(
2067
- (_) => !!_.children[0] && _.children[0].tagName === "tspan" && R.startsWith(or(sr(_)))
1439
+ (C) => !!C.children[0] && C.children[0].tagName === "tspan" && E.startsWith(ce(de(C)))
2068
1440
  );
2069
1441
  if (!L) break;
2070
- C.push(L);
2071
- const $ = or(L.children[0].innerHTML).length;
2072
- if (!$) break;
2073
- R = R.slice($);
1442
+ k.push(L);
1443
+ const M = ce(L.children[0].innerHTML).length;
1444
+ if (!M) break;
1445
+ E = E.slice(M);
2074
1446
  }
2075
- C.forEach((L) => {
2076
- const $ = document.createElementNS("http://www.w3.org/2000/svg", "a");
2077
- $.setAttribute("href", S), $.setAttribute("target", "_blank"), $.innerHTML = sr(L), L.children[0].innerHTML = "", L.children[0].appendChild($);
1447
+ k.forEach((L) => {
1448
+ const M = document.createElementNS("http://www.w3.org/2000/svg", "a");
1449
+ M.setAttribute("href", A), M.setAttribute("target", "_blank"), M.innerHTML = de(L), L.children[0].innerHTML = "", L.children[0].appendChild(M);
2078
1450
  });
2079
- }), e.appendChild(g);
1451
+ }), t.appendChild(d);
2080
1452
  }
2081
- const Rr = 20;
2082
- class Rn extends Vr {
2083
- constructor(e, o = {}) {
1453
+ const We = 20;
1454
+ class wn extends ar {
1455
+ constructor(t, i = {}) {
2084
1456
  super(
2085
- e,
1457
+ t,
2086
1458
  `
2087
1459
  <div class="annotation-text-handle" data-handle-id="8">
2088
1460
  <span class="handle line-handle top" data-handle-id="0"></span>
@@ -2096,187 +1468,187 @@ class Rn extends Vr {
2096
1468
  <textarea wrap="on"></textarea>
2097
1469
  </div>
2098
1470
  `
2099
- ), x(this, "textArea"), x(this, "handleSize"), x(this, "rect", { x: 0, y: 0, width: 0, height: 0 }), x(this, "annotation", { ...ir }), x(this, "startX", 0), x(this, "startY", 0), x(this, "handles", []), x(this, "draggedHandle", V), x(this, "isFocused", !1), x(this, "placeholder", "Type your text here..."), x(this, "_onFocus", () => {
1471
+ ), m(this, "textArea"), m(this, "handleSize"), m(this, "rect", { x: 0, y: 0, width: 0, height: 0 }), m(this, "annotation", { ...ue }), m(this, "startX", 0), m(this, "startY", 0), m(this, "handles", []), m(this, "draggedHandle", U), m(this, "isFocused", !1), m(this, "placeholder", "Type your text here..."), m(this, "_onFocus", () => {
2100
1472
  this.textArea.value === this.placeholder && (this.textArea.value = ""), this.isFocused = !0;
2101
- }), x(this, "_onBlur", () => {
1473
+ }), m(this, "_onBlur", () => {
2102
1474
  this.isFocused = !1;
2103
- }), x(this, "startDrawing", (l, h, d = kn(l, h, 0, 0, "", Wt)) => {
2104
- this.add(d);
2105
- const g = this.ogma.view.graphToScreenCoordinates({ x: l, y: h });
2106
- this.select(d.id), this.startDragging(this.getById(d.id), g.x, g.y), this.draggedHandle = 6;
2107
- }), x(this, "cancelDrawing", () => {
2108
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ir }, this.draggedHandle = V, this.isDragging = !1, this.emit(Ut, this.annotation));
2109
- }), x(this, "startDragging", (l, h, d) => {
2110
- this.annotation = l;
2111
- const g = vt(this.annotation), f = mt(this.annotation);
2112
- this.rect.x = g.x, this.rect.y = g.y, this.rect.width = f.width, this.rect.height = f.height, this.startX = h, this.startY = d, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Ne, this.annotation), this.isDragging = !0;
2113
- }), x(this, "onHandleMouseDown", (l) => {
1475
+ }), m(this, "startDrawing", (a, h, c = gn(a, h, 0, 0, "", Dt)) => {
1476
+ this.add(c);
1477
+ const d = this.ogma.view.graphToScreenCoordinates({ x: a, y: h });
1478
+ this.select(c.id), this.startDragging(this.getById(c.id), d.x, d.y), this.draggedHandle = 6;
1479
+ }), m(this, "cancelDrawing", () => {
1480
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ue }, this.draggedHandle = U, this.isDragging = !1, this.emit(Lt, this.annotation));
1481
+ }), m(this, "startDragging", (a, h, c) => {
1482
+ this.annotation = a;
1483
+ const d = dt(this.annotation), f = ft(this.annotation);
1484
+ this.rect.x = d.x, this.rect.y = d.y, this.rect.width = f.width, this.rect.height = f.height, this.startX = h, this.startY = c, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Yt, this.annotation), this.isDragging = !0;
1485
+ }), m(this, "onHandleMouseDown", (a) => {
2114
1486
  const h = this.getById(this.selectedId) || this.getById(this.hoveredId);
2115
1487
  if (!h) return;
2116
1488
  this.selectedId !== h.id && this.select(this.hoveredId);
2117
- const { x: d, y: g } = Me(l, this.ogma.getContainer());
2118
- this.startDragging(h, d, g), this.draggedHandle = Nr(l.target);
2119
- }), x(this, "onMouseMove", (l) => {
2120
- requestAnimationFrame(() => this._onMouseMove(l));
2121
- }), x(this, "_onMouseMove", (l) => {
1489
+ const { x: c, y: d } = Vt(a, this.ogma.getContainer());
1490
+ this.startDragging(h, c, d), this.draggedHandle = tr(a.target);
1491
+ }), m(this, "onMouseMove", (a) => {
1492
+ requestAnimationFrame(() => this._onMouseMove(a));
1493
+ }), m(this, "_onMouseMove", (a) => {
2122
1494
  if (!this.isDragging) return;
2123
- l.stopPropagation(), l.preventDefault();
1495
+ a.stopPropagation(), a.preventDefault();
2124
1496
  const h = this.handles[this.draggedHandle];
2125
- let d = h.classList.contains("top");
2126
- const g = h.classList.contains("left"), f = h.classList.contains("right"), v = h.classList.contains("bottom");
2127
- let y = h.classList.contains("line-handle");
2128
- !y && !d && !v && !g && !f && (d = !0, y = !0);
2129
- const { x: A, y: k } = Me(
2130
- l,
1497
+ let c = h.classList.contains("top");
1498
+ const d = h.classList.contains("left"), f = h.classList.contains("right"), g = h.classList.contains("bottom");
1499
+ let p = h.classList.contains("line-handle");
1500
+ !p && !c && !g && !d && !f && (c = !0, p = !0);
1501
+ const { x: w, y: b } = Vt(
1502
+ a,
2131
1503
  this.ogma.getContainer()
2132
1504
  );
2133
- let S = this.rect.x, R = this.rect.y, C = Math.max(this.rect.width, Rr), L = Math.max(this.rect.height, Rr);
2134
- const $ = this.ogma.view.getZoom(), _ = (A - this.startX) / $, z = (k - this.startY) / $, B = this.ogma.view.getAngle(), tt = st({ x: _, y: z }, B), rt = st({ x: _, y: z }, -B);
2135
- y ? (S = this.rect.x + tt.x, R = this.rect.y + tt.y) : g && d ? (S += tt.x, R += tt.y, C -= _, L -= z) : f && v ? (C += _, L += z) : g && v ? (S += rt.x, C -= rt.x, L += rt.y) : f && d && (R += rt.y, C += rt.x, L -= rt.y), hn(this.annotation, S, R, C, L), this.emit(ze, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2136
- }), x(this, "onMouseUp", () => {
2137
- !this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Ut, this.annotation), this.isDragging = !1, this.draggedHandle = V);
2138
- }), x(this, "_onMousedown", (l) => {
2139
- l.stopPropagation();
2140
- }), x(this, "onViewChanged", () => {
2141
- const l = Math.max(2, this.handleSize / this.ogma.view.getZoom());
2142
- document.documentElement.style.setProperty("--handle-scale", `${1 / l}`), this.ogma.view.getAngle() === 0 ? this.editor.element.classList.remove("rotated") : this.editor.element.classList.add("rotated");
2143
- }), x(this, "_onInput", () => {
2144
- const l = this.getById(this.selectedId);
2145
- l && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), l.properties.content = this.textArea.value, this.emit(cr, l), this.layer.refresh());
2146
- }), this.showeditorOnHover = !1, this.handleSize = Sr.handleSize, this.placeholder = Sr.placeholder;
2147
- const n = this.textArea = this.editor.element.querySelector("textarea");
2148
- n.addEventListener("input", this._onInput), n.addEventListener("focus", this._onFocus), n.addEventListener("blur", this._onBlur), n.addEventListener("mousedown", this._onMousedown), n.spellcheck = !1, this.handles = Array.prototype.slice.call(
1505
+ let A = this.rect.x, E = this.rect.y, k = Math.max(this.rect.width, We), L = Math.max(this.rect.height, We);
1506
+ const M = this.ogma.view.getZoom(), C = (w - this.startX) / M, N = (b - this.startY) / M, P = this.ogma.view.getAngle(), tt = nt({ x: C, y: N }, P), it = nt({ x: C, y: N }, -P);
1507
+ p ? (A = this.rect.x + tt.x, E = this.rect.y + tt.y) : d && c ? (A += tt.x, E += tt.y, k -= C, L -= N) : f && g ? (k += C, L += N) : d && g ? (A += it.x, k -= it.x, L += it.y) : f && c && (E += it.y, k += it.x, L -= it.y), Qr(this.annotation, A, E, k, L), this.emit(Zt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1508
+ }), m(this, "onMouseUp", () => {
1509
+ !this.isDragging || this.draggedHandle === U || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Lt, this.annotation), this.isDragging = !1, this.draggedHandle = U);
1510
+ }), m(this, "_onMousedown", (a) => {
1511
+ a.stopPropagation();
1512
+ }), m(this, "onViewChanged", () => {
1513
+ const a = Math.max(2, this.handleSize / this.ogma.view.getZoom());
1514
+ document.documentElement.style.setProperty("--handle-scale", `${1 / a}`), this.ogma.view.getAngle() === 0 ? this.editor.element.classList.remove("rotated") : this.editor.element.classList.add("rotated");
1515
+ }), m(this, "_onInput", () => {
1516
+ const a = this.getById(this.selectedId);
1517
+ a && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), a.properties.content = this.textArea.value, this.emit(me, a), this.layer.refresh());
1518
+ }), this.showeditorOnHover = !1, this.handleSize = Be.handleSize, this.placeholder = Be.placeholder;
1519
+ const r = this.textArea = this.editor.element.querySelector("textarea");
1520
+ r.addEventListener("input", this._onInput), r.addEventListener("focus", this._onFocus), r.addEventListener("blur", this._onBlur), r.addEventListener("mousedown", this._onMousedown), r.spellcheck = !1, this.handles = Array.prototype.slice.call(
2149
1521
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
2150
1522
  ), this.handles.push(this.editor.element), this.handles.forEach(
2151
- (l) => l.addEventListener("mousedown", this.onHandleMouseDown)
2152
- ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), e.events.on(["viewChanged", "zoom"], this.onViewChanged);
1523
+ (a) => a.addEventListener("mousedown", this.onHandleMouseDown)
1524
+ ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
2153
1525
  }
2154
1526
  _canRemove() {
2155
1527
  return !this.isFocused;
2156
1528
  }
2157
- detect({ x: e, y: o }, n = 0) {
2158
- const l = { x: e, y: o }, h = this.ogma.view.getAngle();
2159
- return this.elements.find((d) => {
2160
- const { x: g, y: f } = vt(d), { width: v, height: y } = mt(d), A = { x: g, y: f }, { x: k, y: S } = st(Ot(l, A), -h);
2161
- return k > -n && k < v + n && S > -n && S < y + n;
1529
+ detect({ x: t, y: i }, r = 0) {
1530
+ const a = { x: t, y: i }, h = this.ogma.view.getAngle();
1531
+ return this.elements.find((c) => {
1532
+ const { x: d, y: f } = dt(c), { width: g, height: p } = ft(c), w = { x: d, y: f }, { x: b, y: A } = nt(xt(a, w), -h);
1533
+ return b > -r && b < g + r && A > -r && A < p + r;
2162
1534
  });
2163
1535
  }
2164
- draw(e) {
2165
- e.innerHTML = "";
2166
- const o = "", n = this.ogma.view.getAngle();
1536
+ draw(t) {
1537
+ t.innerHTML = "";
1538
+ const i = "", r = this.ogma.view.getAngle();
2167
1539
  for (let h = 0; h < this.elements.length; h++) {
2168
- const d = this.elements[h], g = `class${h}`, f = mt(d), v = vt(d);
2169
- if (d.id === this.selectedId) continue;
1540
+ const c = this.elements[h], d = `class${h}`, f = ft(c), g = dt(c);
1541
+ if (c.id === this.selectedId) continue;
2170
1542
  const {
2171
- color: y,
2172
- fontSize: A,
2173
- font: k,
2174
- strokeColor: S,
2175
- strokeWidth: R,
2176
- strokeType: C,
1543
+ color: p,
1544
+ fontSize: w,
1545
+ font: b,
1546
+ strokeColor: A,
1547
+ strokeWidth: E,
1548
+ strokeType: k,
2177
1549
  background: L,
2178
- borderRadius: $
2179
- } = d.properties.style || Wt, _ = Rt("g");
2180
- _.classList.add("annotation-text"), _.setAttribute("fill", `${y}`), _.setAttribute("font-size", `${A}px`), _.setAttribute("font-family", `${k}`);
2181
- const z = Rt("rect");
2182
- $ && (z.setAttribute("rx", `${$}`), z.setAttribute("ry", `${$}`));
2183
- let B = !1;
2184
- C && C !== "none" && (B = !0, z.setAttribute("stroke", S || "black"), z.setAttribute("stroke-width", `${R}`), C === "dashed" && z.setAttribute("stroke-dasharray", "5,5")), (L && L.length || B) && (B = !0, z.setAttribute("fill", L || "transparent")), B && (z.setAttribute("width", `${f.width}`), z.setAttribute("height", `${f.height}`)), _.appendChild(z), Tn(d, _);
2185
- const { x: tt, y: rt } = st(v, -n);
2186
- _.setAttribute("transform", `translate(${tt},${rt})`), _.classList.add(g), _.setAttribute("data-annotation", `${d.id}`), _.setAttribute("data-annotation-type", "text"), e.appendChild(_);
1550
+ borderRadius: M
1551
+ } = c.properties.style || Dt, C = wt("g");
1552
+ C.classList.add("annotation-text"), C.setAttribute("fill", `${p}`), C.setAttribute("font-size", `${w}px`), C.setAttribute("font-family", `${b}`);
1553
+ const N = wt("rect");
1554
+ M && (N.setAttribute("rx", `${M}`), N.setAttribute("ry", `${M}`));
1555
+ let P = !1;
1556
+ k && k !== "none" && (P = !0, N.setAttribute("stroke", A || "black"), N.setAttribute("stroke-width", `${E}`), k === "dashed" && N.setAttribute("stroke-dasharray", "5,5")), (L && L.length || P) && (P = !0, N.setAttribute("fill", L || "transparent")), P && (N.setAttribute("width", `${f.width}`), N.setAttribute("height", `${f.height}`)), C.appendChild(N), vn(c, C);
1557
+ const { x: tt, y: it } = nt(g, -r);
1558
+ C.setAttribute("transform", `translate(${tt},${it})`), C.classList.add(d), C.setAttribute("data-annotation", `${c.id}`), C.setAttribute("data-annotation-type", "text"), t.appendChild(C);
2187
1559
  }
2188
- const l = Rt("style");
2189
- l.innerHTML = o, e.firstChild && e.insertBefore(l, e.firstChild);
1560
+ const a = wt("style");
1561
+ a.innerHTML = i, t.firstChild && t.insertBefore(a, t.firstChild);
2190
1562
  }
2191
1563
  refreshDrawing() {
2192
- const e = this.ogma.view.getAngle(), o = this.layer.element.children;
2193
- for (let n = 0; n < o.length; n++) {
2194
- const l = o[n];
2195
- if (!l.hasAttribute("data-annotation")) continue;
2196
- const h = l.getAttribute("data-annotation"), d = vt(this.getById(h)), { x: g, y: f } = st(d, -e);
2197
- l.setAttribute("transform", `translate(${g},${f})`);
1564
+ const t = this.ogma.view.getAngle(), i = this.layer.element.children;
1565
+ for (let r = 0; r < i.length; r++) {
1566
+ const a = i[r];
1567
+ if (!a.hasAttribute("data-annotation")) continue;
1568
+ const h = a.getAttribute("data-annotation"), c = dt(this.getById(h)), { x: d, y: f } = nt(c, -t);
1569
+ a.setAttribute("transform", `translate(${d},${f})`);
2198
1570
  }
2199
1571
  }
2200
1572
  getDefaultOptions() {
2201
- return ir;
1573
+ return ue;
2202
1574
  }
2203
1575
  refreshEditor() {
2204
1576
  if (+this.selectedId < 0 && +this.hoveredId < 0) return;
2205
- const e = this.getById(this.selectedId) || this.getById(this.hoveredId), o = mt(e), n = this.ogma.view.graphToScreenCoordinates(
2206
- vt(e)
2207
- ), l = this.ogma.view.getZoom(), {
1577
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), i = ft(t), r = this.ogma.view.graphToScreenCoordinates(
1578
+ dt(t)
1579
+ ), a = this.ogma.view.getZoom(), {
2208
1580
  font: h,
2209
- fontSize: d,
2210
- color: g,
1581
+ fontSize: c,
1582
+ color: d,
2211
1583
  background: f,
2212
- padding: v = 0
2213
- } = e.properties.style || Wt, y = (d || 1) * l;
2214
- this.textArea.value = e.properties.content;
2215
- const A = this.editor.element.style;
2216
- A.transform = `translate(${n.x}px, ${n.y}px)translate(-50%, -50%)translate(${o.width / 2 * l}px, ${o.height / 2 * l}px)`, A.width = `${o.width * l}px`, A.height = `${o.height * l}px`;
2217
- const k = this.textArea.style;
2218
- k.font = `${y} ${h}`, k.fontFamily = h || "sans-serif", k.fontSize = `${y}px`, k.padding = `${l * v}px`, k.lineHeight = `${y}px`, k.boxSizing = "border-box", k.color = g || "black", k.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
1584
+ padding: g = 0
1585
+ } = t.properties.style || Dt, p = (c || 1) * a;
1586
+ this.textArea.value = t.properties.content;
1587
+ const w = this.editor.element.style;
1588
+ w.transform = `translate(${r.x}px, ${r.y}px)translate(-50%, -50%)translate(${i.width / 2 * a}px, ${i.height / 2 * a}px)`, w.width = `${i.width * a}px`, w.height = `${i.height * a}px`;
1589
+ const b = this.textArea.style;
1590
+ b.font = `${p} ${h}`, b.fontFamily = h || "sans-serif", b.fontSize = `${p}px`, b.padding = `${a * g}px`, b.lineHeight = `${p}px`, b.boxSizing = "border-box", b.color = d || "black", b.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2219
1591
  }
2220
- select(e) {
2221
- super.select(e), this.textArea.classList.add("noevents");
1592
+ select(t) {
1593
+ super.select(t), this.textArea.classList.add("noevents");
2222
1594
  }
2223
1595
  destroy() {
2224
1596
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
2225
1597
  }
2226
1598
  }
2227
- class On {
1599
+ class xn {
2228
1600
  constructor() {
2229
- x(this, "links", {}), x(this, "linksByTargetId", {}), x(this, "linksByArrowId", {});
2230
- }
2231
- add(e, o, n, l, h) {
2232
- const d = He(), g = e.id, f = {
2233
- id: d,
2234
- arrow: g,
2235
- target: n,
2236
- targetType: l,
1601
+ m(this, "links", {}), m(this, "linksByTargetId", {}), m(this, "linksByArrowId", {});
1602
+ }
1603
+ add(t, i, r, a, h) {
1604
+ const c = Jt(), d = t.id, f = {
1605
+ id: c,
1606
+ arrow: d,
1607
+ target: r,
1608
+ targetType: a,
2237
1609
  connectionPoint: h,
2238
- side: o
1610
+ side: i
2239
1611
  };
2240
- return this.links[d] = f, this.linksByTargetId[n] || (this.linksByTargetId[n] = []), this.linksByTargetId[n].push(d), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][o] = d, e.properties.link = e.properties.link || {}, e.properties.link[o] = {
2241
- id: n,
2242
- side: o,
2243
- type: l,
1612
+ return this.links[c] = f, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(c), this.linksByArrowId[d] || (this.linksByArrowId[d] = {}), this.linksByArrowId[d][i] = c, t.properties.link = t.properties.link || {}, t.properties.link[i] = {
1613
+ id: r,
1614
+ side: i,
1615
+ type: a,
2244
1616
  magnet: h
2245
1617
  }, this;
2246
1618
  }
2247
- arrowIsLinked(e, o) {
2248
- var n;
2249
- return !!((n = this.linksByArrowId[e]) != null && n[o]);
1619
+ arrowIsLinked(t, i) {
1620
+ var r;
1621
+ return !!((r = this.linksByArrowId[t]) != null && r[i]);
2250
1622
  }
2251
1623
  // remove the link between the arrow and the target by arrow id and side
2252
- remove(e, o) {
2253
- var n, l;
2254
- const h = e.id, d = (n = this.linksByArrowId[h]) == null ? void 0 : n[o];
2255
- if ((l = e.properties.link) == null || delete l[o], !d) return this;
2256
- const g = this.links[d];
2257
- delete this.links[d];
2258
- const f = this.linksByTargetId[g.target];
2259
- for (let v = 0; v < f.length; v++)
2260
- if (f[v] === d) {
2261
- f.splice(v, 1);
1624
+ remove(t, i) {
1625
+ var r, a;
1626
+ const h = t.id, c = (r = this.linksByArrowId[h]) == null ? void 0 : r[i];
1627
+ if ((a = t.properties.link) == null || delete a[i], !c) return this;
1628
+ const d = this.links[c];
1629
+ delete this.links[c];
1630
+ const f = this.linksByTargetId[d.target];
1631
+ for (let g = 0; g < f.length; g++)
1632
+ if (f[g] === c) {
1633
+ f.splice(g, 1);
2262
1634
  break;
2263
1635
  }
2264
- return delete this.linksByArrowId[h][o], this;
1636
+ return delete this.linksByArrowId[h][i], this;
2265
1637
  }
2266
- getArrowLink(e, o) {
2267
- var n;
2268
- const l = (n = this.linksByArrowId[e]) == null ? void 0 : n[o];
2269
- return l ? this.links[l] : null;
1638
+ getArrowLink(t, i) {
1639
+ var r;
1640
+ const a = (r = this.linksByArrowId[t]) == null ? void 0 : r[i];
1641
+ return a ? this.links[a] : null;
2270
1642
  }
2271
- getTargetLinks(e, o) {
2272
- var n;
2273
- return ((n = this.linksByTargetId[e]) == null ? void 0 : n.map((l) => this.links[l]).filter((l) => l.targetType === o)) ?? [];
1643
+ getTargetLinks(t, i) {
1644
+ var r;
1645
+ return ((r = this.linksByTargetId[t]) == null ? void 0 : r.map((a) => this.links[a]).filter((a) => a.targetType === i)) ?? [];
2274
1646
  }
2275
- forEach(e) {
2276
- Object.values(this.links).forEach(e);
1647
+ forEach(t) {
1648
+ Object.values(this.links).forEach(t);
2277
1649
  }
2278
1650
  }
2279
- const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type === "text", Or = (u) => u.type === "FeatureCollection", Dn = {
1651
+ const ot = (l) => l.properties.type === "arrow", ct = (l) => l.properties.type === "text", Ue = (l) => l.type === "FeatureCollection", bn = {
2280
1652
  magnetColor: "#3e8",
2281
1653
  detectMargin: 20,
2282
1654
  magnetHandleRadius: 5,
@@ -2286,7 +1658,7 @@ const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type =
2286
1658
  textHandleSize: 3.5,
2287
1659
  minArrowHeight: 20,
2288
1660
  maxArrowHeight: 30
2289
- }, Dr = ["start", "end"], Pr = [
1661
+ }, Xe = ["start", "end"], Ge = [
2290
1662
  { x: 0, y: 0 },
2291
1663
  { x: 0.5, y: 0 },
2292
1664
  { x: 1, y: 0 },
@@ -2296,126 +1668,126 @@ const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type =
2296
1668
  { x: 0.5, y: 1 },
2297
1669
  { x: 1, y: 1 }
2298
1670
  ];
2299
- class Pn extends Yr {
2300
- constructor(e, o = {}) {
2301
- super(), x(this, "arrows"), x(this, "texts"), x(this, "links", new On()), x(this, "layer"), x(this, "annotations"), x(this, "ogma"), x(this, "options"), x(this, "selected", null), x(this, "updateTimeout", 0), x(this, "hoveredNode", null), x(this, "dragged", null), x(this, "textToMagnet"), x(this, "activeLinks", []), x(this, "_render", (n) => {
1671
+ class An extends or {
1672
+ constructor(t, i = {}) {
1673
+ super(), m(this, "arrows"), m(this, "texts"), m(this, "links", new xn()), m(this, "layer"), m(this, "annotations"), m(this, "ogma"), m(this, "options"), m(this, "selected", null), m(this, "updateTimeout", 0), m(this, "hoveredNode", null), m(this, "dragged", null), m(this, "textToMagnet"), m(this, "activeLinks", []), m(this, "_render", (r) => {
2302
1674
  if (!this.dragged || this.textToMagnet === void 0) return;
2303
- n.beginPath(), n.fillStyle = "green";
2304
- const l = this.ogma.view.getZoom();
2305
- Pr.forEach((h) => {
1675
+ r.beginPath(), r.fillStyle = "green";
1676
+ const a = this.ogma.view.getZoom();
1677
+ Ge.forEach((h) => {
2306
1678
  if (!this.textToMagnet) return;
2307
- const d = mt(this.textToMagnet), g = vt(this.textToMagnet), f = $e(h, { x: d.width, y: d.height }), v = st(f, this.ogma.view.getAngle()), { x: y, y: A } = Bt(v, g);
2308
- n.moveTo(y, A), n.arc(y, A, this.options.magnetHandleRadius / l, 0, Math.PI * 2);
2309
- }), n.fill(), n.closePath();
2310
- }), x(this, "_onFeatureDrag", (n, l) => {
2311
- const h = l;
2312
- if (at(n) && h === "line")
2313
- ["start", "end"].find((d) => {
2314
- const g = d === "start" ? de(n) : je(n);
2315
- return this._snapToText(n, h, g) || this._findAndSnapToNode(n, d, g);
1679
+ const c = ft(this.textToMagnet), d = dt(this.textToMagnet), f = Ut(h, { x: c.width, y: c.height }), g = nt(f, this.ogma.view.getAngle()), { x: p, y: w } = Ct(g, d);
1680
+ r.moveTo(p, w), r.arc(p, w, this.options.magnetHandleRadius / a, 0, Math.PI * 2);
1681
+ }), r.fill(), r.closePath();
1682
+ }), m(this, "_onFeatureDrag", (r, a) => {
1683
+ const h = a;
1684
+ if (ot(r) && h === "line")
1685
+ ["start", "end"].find((c) => {
1686
+ const d = c === "start" ? zt(r) : Xt(r);
1687
+ return this._snapToText(r, h, d) || this._findAndSnapToNode(r, c, d);
2316
1688
  });
2317
- else if (at(n) && h !== "line") {
2318
- const d = h === "start" ? de(n) : je(n);
2319
- this._snapToText(n, h, d) || this._findAndSnapToNode(n, h, d);
2320
- } else yt(n) && (this.activeLinks.forEach(({ arrow: d, side: g, connectionPoint: f }) => {
2321
- const v = this.getAnnotation(d), y = mt(n), A = vt(n), k = $e(f, { x: y.width, y: y.height }), S = st(k, this.ogma.view.getAngle()), R = Bt(S, A);
2322
- v.geometry.coordinates[g === "start" ? 0 : 1] = [R.x, R.y];
1689
+ else if (ot(r) && h !== "line") {
1690
+ const c = h === "start" ? zt(r) : Xt(r);
1691
+ this._snapToText(r, h, c) || this._findAndSnapToNode(r, h, c);
1692
+ } else ct(r) && (this.activeLinks.forEach(({ arrow: c, side: d, connectionPoint: f }) => {
1693
+ const g = this.getAnnotation(c), p = ft(r), w = dt(r), b = Ut(f, { x: p.width, y: p.height }), A = nt(b, this.ogma.view.getAngle()), E = Ct(A, w);
1694
+ g.geometry.coordinates[d === "start" ? 0 : 1] = [E.x, E.y];
2323
1695
  }), this.activeLinks.length && this.arrows.refreshLayer());
2324
- this.layer.refresh(), this.emit(ze, n, l);
2325
- }), x(this, "_onFeatureDragEnd", (n) => {
2326
- this.dragged !== null && at(n) && de(this.dragged) && Dr.forEach((l) => {
2327
- this.links.getArrowLink(n.id, l) && this.emit(wn, {
2328
- arrow: n,
2329
- link: this.links.getArrowLink(n.id, l)
1696
+ this.layer.refresh(), this.emit(Zt, r, a);
1697
+ }), m(this, "_onFeatureDragEnd", (r) => {
1698
+ this.dragged !== null && ot(r) && zt(this.dragged) && Xe.forEach((a) => {
1699
+ this.links.getArrowLink(r.id, a) && this.emit(un, {
1700
+ arrow: r,
1701
+ link: this.links.getArrowLink(r.id, a)
2330
1702
  });
2331
- }), (yt(n) || at(n)) && this.onUpdate(n), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((l) => l.enableDetection()), this.layer.refresh(), this.emit(Ut, n);
2332
- }), x(this, "_onFeatureDragStart", (n) => {
2333
- this.textToMagnet = void 0, at(n) ? this.dragged = n : yt(n) && this.activeLinks.push(...this.links.getTargetLinks(n.id, "text")), this.annotations.forEach((l) => {
2334
- const h = l.getSelectedFeature();
2335
- h && h !== n && l.unhover().unselect(), l.disableDetection();
2336
- }), this.emit(Ne, n);
2337
- }), x(this, "_onNodesDragStart", () => {
1703
+ }), (ct(r) || ot(r)) && this.onUpdate(r), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((a) => a.enableDetection()), this.layer.refresh(), this.emit(Lt, r);
1704
+ }), m(this, "_onFeatureDragStart", (r) => {
1705
+ this.textToMagnet = void 0, ot(r) ? this.dragged = r : ct(r) && this.activeLinks.push(...this.links.getTargetLinks(r.id, "text")), this.annotations.forEach((a) => {
1706
+ const h = a.getSelectedFeature();
1707
+ h && h !== r && a.unhover().unselect(), a.disableDetection();
1708
+ }), this.emit(Yt, r);
1709
+ }), m(this, "_onNodesDragStart", () => {
2338
1710
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
2339
- }), x(this, "_onNodesDrag", (n) => {
2340
- const { dx: l, dy: h } = n;
2341
- this._moveNodes(n.nodes, l, h);
2342
- }), x(this, "_onLayoutEnd", (n) => {
2343
- n.ids.forEach((l, h) => {
2344
- this.links.getTargetLinks(l, "node").forEach((d) => {
2345
- const g = this.getAnnotation(d.arrow), f = d.side, v = Le(
2346
- g,
1711
+ }), m(this, "_onNodesDrag", (r) => {
1712
+ const { dx: a, dy: h } = r;
1713
+ this._moveNodes(r.nodes, a, h);
1714
+ }), m(this, "_onLayoutEnd", (r) => {
1715
+ r.ids.forEach((a, h) => {
1716
+ this.links.getTargetLinks(a, "node").forEach((c) => {
1717
+ const d = this.getAnnotation(c.arrow), f = c.side, g = Rt(
1718
+ d,
2347
1719
  f === "start" ? "end" : "start"
2348
- ), y = n.positions.current[h], A = this.ogma.getNode(l).getAttribute("radius"), k = Ie(v, y, +A);
2349
- Ht(g, f, k.x, k.y);
1720
+ ), p = r.positions.current[h], w = this.ogma.getNode(a).getAttribute("radius"), b = Wt(g, p, +w);
1721
+ St(d, f, b.x, b.y);
2350
1722
  });
2351
1723
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
2352
- }), x(this, "_onAdded", (n) => {
2353
- this.emit(hr, n);
2354
- }), x(this, "_onRemoved", (n) => {
2355
- this.emit(ur, n);
2356
- }), x(this, "_onUnselect", (n) => {
2357
- this.selected = null, this.emit(lr, n);
2358
- }), x(this, "_onSelect", (n) => {
2359
- this.selected !== n && (this.selected = n, this.emit(ar, this.selected));
2360
- }), x(this, "onUpdate", (n) => {
1724
+ }), m(this, "_onAdded", (r) => {
1725
+ this.emit(ye, r);
1726
+ }), m(this, "_onRemoved", (r) => {
1727
+ this.emit(pe, r);
1728
+ }), m(this, "_onUnselect", (r) => {
1729
+ this.selected = null, this.emit(ge, r);
1730
+ }), m(this, "_onSelect", (r) => {
1731
+ this.selected !== r && (this.selected = r, this.emit(fe, this.selected));
1732
+ }), m(this, "onUpdate", (r) => {
2361
1733
  cancelAnimationFrame(this.updateTimeout), this.updateTimeout = requestAnimationFrame(
2362
- () => this._onUpdate(n)
1734
+ () => this._onUpdate(r)
2363
1735
  );
2364
- }), x(this, "_onUpdate", (n) => {
2365
- this.emit(cr, n);
2366
- }), this.options = this.setOptions({ ...Dn, ...o }), this.ogma = e, this.arrows = new An(e, this.options), this.texts = new Rn(e, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((n) => {
2367
- n.on(Ne, this._onFeatureDragStart).on(ze, this._onFeatureDrag).on(Ut, this._onFeatureDragEnd).on(cr, this.onUpdate).on(lr, this._onUnselect).on(ar, this._onSelect).on(hr, this._onAdded).on(ur, this._onRemoved);
1736
+ }), m(this, "_onUpdate", (r) => {
1737
+ this.emit(me, r);
1738
+ }), this.options = this.setOptions({ ...bn, ...i }), this.ogma = t, this.arrows = new fn(t, this.options), this.texts = new wn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((r) => {
1739
+ r.on(Yt, this._onFeatureDragStart).on(Zt, this._onFeatureDrag).on(Lt, this._onFeatureDragEnd).on(me, this.onUpdate).on(ge, this._onUnselect).on(fe, this._onSelect).on(ye, this._onAdded).on(pe, this._onRemoved);
2368
1740
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
2369
1741
  this.refreshTextLinks();
2370
- }), this.layer = e.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
1742
+ }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2371
1743
  }
2372
- _moveNodes(e, o, n) {
2373
- e.forEach((l) => {
2374
- const h = this.links.getTargetLinks(l.getId(), "node"), d = l.getPosition();
2375
- h.forEach((g) => {
2376
- const f = this.getAnnotation(g.arrow), v = g.side, y = Le(
1744
+ _moveNodes(t, i, r) {
1745
+ t.forEach((a) => {
1746
+ const h = this.links.getTargetLinks(a.getId(), "node"), c = a.getPosition();
1747
+ h.forEach((d) => {
1748
+ const f = this.getAnnotation(d.arrow), g = d.side, p = Rt(
2377
1749
  f,
2378
- v === "start" ? "end" : "start"
1750
+ g === "start" ? "end" : "start"
2379
1751
  );
2380
- let A = d;
2381
- const k = +l.getAttribute("radius"), S = 1e-6;
2382
- (g.connectionPoint.x - (d.x - o) > S || g.connectionPoint.y - (d.y - n) > S) && (A = Ie(y, d, k)), Ht(f, v, A.x, A.y);
1752
+ let w = c;
1753
+ const b = +a.getAttribute("radius"), A = 1e-6;
1754
+ (d.connectionPoint.x - (c.x - i) > A || d.connectionPoint.y - (c.y - r) > A) && (w = Wt(p, c, b)), St(f, g, w.x, w.y);
2383
1755
  });
2384
1756
  }), this.arrows.refreshLayer();
2385
1757
  }
2386
- _snapToText(e, o, n) {
2387
- const l = this.texts.detect(n, this.options.detectMargin);
2388
- if (this.links.remove(e, o), !l) return !1;
2389
- this.textToMagnet = l;
2390
- const h = this.findMagnetPoint(Pr, l, n);
2391
- return h ? (Ht(e, o, h.point.x, h.point.y), this.links.add(e, o, l.id, "text", h.magnet), !0) : !1;
2392
- }
2393
- _findAndSnapToNode(e, o, n) {
2394
- var l, h;
2395
- const d = this.ogma.view.graphToScreenCoordinates(n), g = this.ogma.view.getElementAt(d);
2396
- this.links.remove(e, o), g && g.isNode ? ((l = this.hoveredNode) == null || l.setSelected(!1), this.hoveredNode = g, g.setSelected(!0), this._snapToNode(e, o, g, d)) : ((h = this.hoveredNode) == null || h.setSelected(!1), this.hoveredNode = null);
2397
- }
2398
- _snapToNode(e, o, n, l) {
2399
- const h = n.getPositionOnScreen(), d = +n.getAttribute("radius"), g = d * this.ogma.view.getZoom(), f = l.x - h.x, v = l.y - h.y, y = Math.sqrt(f * f + v * v), A = n.getPosition();
2400
- if (y < g + this.options.detectMargin) {
2401
- let k = A;
2402
- if (y > g / 2) {
2403
- const S = Le(e, o === "end" ? "start" : "end");
2404
- k = Ie(S, k, d);
2405
- }
2406
- Ht(e, o, k.x, k.y), this.links.add(e, o, n.getId(), "node", k);
1758
+ _snapToText(t, i, r) {
1759
+ const a = this.texts.detect(r, this.options.detectMargin);
1760
+ if (this.links.remove(t, i), !a) return !1;
1761
+ this.textToMagnet = a;
1762
+ const h = this.findMagnetPoint(Ge, a, r);
1763
+ return h ? (St(t, i, h.point.x, h.point.y), this.links.add(t, i, a.id, "text", h.magnet), !0) : !1;
1764
+ }
1765
+ _findAndSnapToNode(t, i, r) {
1766
+ var a, h;
1767
+ const c = this.ogma.view.graphToScreenCoordinates(r), d = this.ogma.view.getElementAt(c);
1768
+ this.links.remove(t, i), d && d.isNode ? ((a = this.hoveredNode) == null || a.setSelected(!1), this.hoveredNode = d, d.setSelected(!0), this._snapToNode(t, i, d, c)) : ((h = this.hoveredNode) == null || h.setSelected(!1), this.hoveredNode = null);
1769
+ }
1770
+ _snapToNode(t, i, r, a) {
1771
+ const h = r.getPositionOnScreen(), c = +r.getAttribute("radius"), d = c * this.ogma.view.getZoom(), f = a.x - h.x, g = a.y - h.y, p = Math.sqrt(f * f + g * g), w = r.getPosition();
1772
+ if (p < d + this.options.detectMargin) {
1773
+ let b = w;
1774
+ if (p > d / 2) {
1775
+ const A = Rt(t, i === "end" ? "start" : "end");
1776
+ b = Wt(A, b, c);
1777
+ }
1778
+ St(t, i, b.x, b.y), this.links.add(t, i, r.getId(), "node", b);
2407
1779
  }
2408
1780
  }
2409
1781
  refreshTextLinks() {
2410
- let e = !1;
1782
+ let t = !1;
2411
1783
  this.links.forEach(
2412
- ({ connectionPoint: o, targetType: n, target: l, arrow: h, side: d }) => {
2413
- if (n !== "text") return;
2414
- e = !0;
2415
- const g = this.getAnnotation(l), f = this.getAnnotation(h), v = mt(g), y = vt(g), A = $e(o, { x: v.width, y: v.height }), k = st(A, this.ogma.view.getAngle()), S = Bt(k, y);
2416
- Ht(f, d, S.x, S.y);
1784
+ ({ connectionPoint: i, targetType: r, target: a, arrow: h, side: c }) => {
1785
+ if (r !== "text") return;
1786
+ t = !0;
1787
+ const d = this.getAnnotation(a), f = this.getAnnotation(h), g = ft(d), p = dt(d), w = Ut(i, { x: g.width, y: g.height }), b = nt(w, this.ogma.view.getAngle()), A = Ct(b, p);
1788
+ St(f, c, A.x, A.y);
2417
1789
  }
2418
- ), e && this.arrows.refreshLayer();
1790
+ ), t && this.arrows.refreshLayer();
2419
1791
  }
2420
1792
  /**
2421
1793
  * @returns the currently selected annotation
@@ -2423,69 +1795,69 @@ class Pn extends Yr {
2423
1795
  getSelected() {
2424
1796
  return this.selected;
2425
1797
  }
2426
- findMagnetPoint(e, o, n) {
2427
- let l;
2428
- for (const h of e) {
2429
- const d = mt(o), g = vt(o), f = $e(h, { x: d.width, y: d.height }), v = st(f, this.ogma.view.getAngle()), y = Bt(v, g), A = qt(Ot(y, n)), k = Math.min(
1798
+ findMagnetPoint(t, i, r) {
1799
+ let a;
1800
+ for (const h of t) {
1801
+ const c = ft(i), d = dt(i), f = Ut(h, { x: c.width, y: c.height }), g = nt(f, this.ogma.view.getAngle()), p = Ct(g, d), w = _t(xt(p, r)), b = Math.min(
2430
1802
  this.options.magnetRadius * this.ogma.view.getZoom(),
2431
1803
  // when really zoomed in: avoid to snap on too far away magnets
2432
- d.width / 2,
2433
- d.height / 2
1804
+ c.width / 2,
1805
+ c.height / 2
2434
1806
  );
2435
- if (A < Math.max(k, this.options.magnetHandleRadius)) {
2436
- l = {
2437
- point: y,
1807
+ if (w < Math.max(b, this.options.magnetHandleRadius)) {
1808
+ a = {
1809
+ point: p,
2438
1810
  magnet: h
2439
1811
  };
2440
1812
  break;
2441
1813
  }
2442
1814
  }
2443
- return l;
1815
+ return a;
2444
1816
  }
2445
1817
  /**
2446
1818
  * Set the options for the controller
2447
1819
  * @param options new Options
2448
1820
  * @returns the updated options
2449
1821
  */
2450
- setOptions(e = {}) {
1822
+ setOptions(t = {}) {
2451
1823
  return this.options = {
2452
1824
  ...this.options || {},
2453
- ...e
1825
+ ...t
2454
1826
  }, this.options;
2455
1827
  }
2456
1828
  /**
2457
1829
  * Selects the annotation with the given id
2458
1830
  * @param id the id of the annotation to select
2459
1831
  */
2460
- select(e) {
2461
- const o = this.getAnnotations().features.find((n) => n.id === e);
2462
- return o ? (at(o) ? this.arrows.select(o.id) : yt(o) && this.texts.select(o.id), this) : this;
1832
+ select(t) {
1833
+ const i = this.getAnnotations().features.find((r) => r.id === t);
1834
+ return i ? (ot(i) ? this.arrows.select(i.id) : ct(i) && this.texts.select(i.id), this) : this;
2463
1835
  }
2464
1836
  /**
2465
1837
  * Unselects the currently selected annotation
2466
1838
  */
2467
1839
  unselect() {
2468
- return this.selected ? (at(this.selected) ? this.arrows.unselect() : yt(this.selected) && this.texts.unselect(), this) : this;
1840
+ return this.selected ? (ot(this.selected) ? this.arrows.unselect() : ct(this.selected) && this.texts.unselect(), this) : this;
2469
1841
  }
2470
1842
  /**
2471
1843
  * Add an annotation to the controller
2472
1844
  * @param annotation The annotation to add
2473
1845
  */
2474
- add(e) {
2475
- if (Or(e)) {
2476
- const [o, n] = e.features.reduce(
2477
- (l, h) => (at(h) ? l[1].push(h) : yt(h) && l[0].push(h), l),
1846
+ add(t) {
1847
+ if (Ue(t)) {
1848
+ const [i, r] = t.features.reduce(
1849
+ (a, h) => (ot(h) ? a[1].push(h) : ct(h) && a[0].push(h), a),
2478
1850
  [[], []]
2479
1851
  );
2480
- return o.forEach((l) => this.add(l)), n.forEach((l) => this.add(l)), this.arrows.refreshLayer(), this;
1852
+ return i.forEach((a) => this.add(a)), r.forEach((a) => this.add(a)), this.arrows.refreshLayer(), this;
2481
1853
  }
2482
- switch (e.properties.type) {
1854
+ switch (t.properties.type) {
2483
1855
  case "text":
2484
- this.texts.add(e);
1856
+ this.texts.add(t);
2485
1857
  break;
2486
1858
  // more to follow
2487
1859
  default:
2488
- this.arrows.add(e), this.loadLink(e);
1860
+ this.arrows.add(t), this.loadLink(t);
2489
1861
  break;
2490
1862
  }
2491
1863
  return this;
@@ -2494,28 +1866,28 @@ class Pn extends Yr {
2494
1866
  * Remove an annotation or an array of annotations from the controller
2495
1867
  * @param annotation The annotation(s) to remove
2496
1868
  */
2497
- remove(e) {
2498
- return Or(e) ? (e.features.forEach(
2499
- (o) => this.remove(o)
2500
- ), this) : (at(e) ? (this.links.remove(e, "start"), this.links.remove(e, "end"), this.arrows.remove(e.id)) : this.texts.remove(e.id), this);
2501
- }
2502
- loadLink(e) {
2503
- if (e.properties.link)
2504
- for (const o of Dr) {
2505
- const n = e.properties.link[o];
2506
- if (!n) continue;
2507
- const l = this.getAnnotation(n.id);
2508
- if (n.type === "text" && l)
2509
- this.links.add(e, o, n.id, n.type, n.magnet);
2510
- else if (n.type === "node") {
2511
- const h = this.ogma.getNode(n.id);
1869
+ remove(t) {
1870
+ return Ue(t) ? (t.features.forEach(
1871
+ (i) => this.remove(i)
1872
+ ), this) : (ot(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
1873
+ }
1874
+ loadLink(t) {
1875
+ if (t.properties.link)
1876
+ for (const i of Xe) {
1877
+ const r = t.properties.link[i];
1878
+ if (!r) continue;
1879
+ const a = this.getAnnotation(r.id);
1880
+ if (r.type === "text" && a)
1881
+ this.links.add(t, i, r.id, r.type, r.magnet);
1882
+ else if (r.type === "node") {
1883
+ const h = this.ogma.getNode(r.id);
2512
1884
  if (!h) continue;
2513
- this.links.add(e, o, n.id, n.type, n.magnet);
2514
- const d = h.getPosition(), g = h.getAttribute("radius") || 0, f = Le(
2515
- e,
2516
- o === "start" ? "end" : "start"
2517
- ), v = Ie(f, d, +g);
2518
- Ht(e, o, v.x, v.y);
1885
+ this.links.add(t, i, r.id, r.type, r.magnet);
1886
+ const c = h.getPosition(), d = h.getAttribute("radius") || 0, f = Rt(
1887
+ t,
1888
+ i === "start" ? "end" : "start"
1889
+ ), g = Wt(f, c, +d);
1890
+ St(t, i, g.x, g.y);
2519
1891
  }
2520
1892
  }
2521
1893
  }
@@ -2525,8 +1897,8 @@ class Pn extends Yr {
2525
1897
  * @param y coord of the first point
2526
1898
  * @param arrow The arrow to add
2527
1899
  */
2528
- startArrow(e, o, n) {
2529
- this.cancelDrawing(), this.arrows.startDrawing(e, o, n);
1900
+ startArrow(t, i, r) {
1901
+ this.cancelDrawing(), this.arrows.startDrawing(t, i, r);
2530
1902
  }
2531
1903
  /**
2532
1904
  * Start adding a text (add it, and give control to the user)
@@ -2534,56 +1906,56 @@ class Pn extends Yr {
2534
1906
  * @param y coord of the top left point
2535
1907
  * @param text The text to add
2536
1908
  */
2537
- startText(e, o, n) {
2538
- this.cancelDrawing(), this.texts.startDrawing(e, o, n);
1909
+ startText(t, i, r) {
1910
+ this.cancelDrawing(), this.texts.startDrawing(t, i, r);
2539
1911
  }
2540
1912
  /**
2541
1913
  * Cancel drawing on the current frame
2542
1914
  */
2543
1915
  cancelDrawing() {
2544
- this.annotations.forEach((e) => e.cancelDrawing()), this.emit(bn);
1916
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(hn);
2545
1917
  }
2546
1918
  /**
2547
1919
  * Update the style of the annotation with the given id
2548
1920
  * @param id The id of the annotation to update
2549
1921
  * @param style The new style
2550
1922
  */
2551
- updateStyle(e, o) {
2552
- const n = this.getAnnotations().features.find((l) => l.id === e);
2553
- return n ? (at(n) ? this.arrows.updateStyle(n, o) : yt(n) && this.texts.updateStyle(n, o), this.onUpdate(n), this) : this;
1923
+ updateStyle(t, i) {
1924
+ const r = this.getAnnotations().features.find((a) => a.id === t);
1925
+ return r ? (ot(r) ? this.arrows.updateStyle(r, i) : ct(r) && this.texts.updateStyle(r, i), this.onUpdate(r), this) : this;
2554
1926
  }
2555
- setScale(e, o, n, l) {
2556
- const h = this.getAnnotations().features.find((d) => d.id === e);
2557
- return h ? (at(h) ? this.arrows.scale(h, o, n, l) : yt(h) && this.texts.scale(h, o, n, l), this.onUpdate(h), this) : this;
1927
+ setScale(t, i, r, a) {
1928
+ const h = this.getAnnotations().features.find((c) => c.id === t);
1929
+ return h ? (ot(h) ? this.arrows.scale(h, i, r, a) : ct(h) && this.texts.scale(h, i, r, a), this.onUpdate(h), this) : this;
2558
1930
  }
2559
1931
  /**
2560
1932
  * @returns the annotations in the controller
2561
1933
  */
2562
1934
  getAnnotations() {
2563
- const e = {
1935
+ const t = {
2564
1936
  type: "FeatureCollection",
2565
1937
  features: []
2566
1938
  };
2567
- return this.annotations.forEach((o) => {
2568
- e.features = [...e.features, ...o.getElements()];
2569
- }), e;
1939
+ return this.annotations.forEach((i) => {
1940
+ t.features = [...t.features, ...i.getElements()];
1941
+ }), t;
2570
1942
  }
2571
1943
  /**
2572
1944
  * Retrieve the annotation with the given id
2573
1945
  * @param id the id of the annotation to get
2574
1946
  * @returns The annotation with the given id
2575
1947
  */
2576
- getAnnotation(e) {
2577
- return this.getAnnotations().features.find((o) => o.id === e);
1948
+ getAnnotation(t) {
1949
+ return this.getAnnotations().features.find((i) => i.id === t);
2578
1950
  }
2579
1951
  /**
2580
1952
  * Destroy the controller and its elements
2581
1953
  */
2582
1954
  destroy() {
2583
- this.annotations.forEach((e) => e.destroy()), this.layer.destroy();
1955
+ this.annotations.forEach((t) => t.destroy()), this.layer.destroy();
2584
1956
  }
2585
1957
  }
2586
- const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], Ir = "none", Xr = "#333333", Nn = [
1958
+ const Ve = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], Ze = "none", lr = "#333333", Tn = [
2587
1959
  "#FFFFFF",
2588
1960
  "#F44E3B",
2589
1961
  "#FE9200",
@@ -2596,7 +1968,7 @@ const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], Ir = "none", Xr = "#333333",
2596
1968
  "#333333",
2597
1969
  "#808080",
2598
1970
  "#cccccc"
2599
- ], Hn = [
1971
+ ], $n = [
2600
1972
  "Roboto",
2601
1973
  "Helvetica Neue",
2602
1974
  "Helvetica",
@@ -2608,119 +1980,125 @@ const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], Ir = "none", Xr = "#333333",
2608
1980
  "Consolas",
2609
1981
  "Courier New",
2610
1982
  "monospace"
2611
- ].sort((u, e) => u.toLocaleLowerCase().localeCompare(e.toLocaleLowerCase())), Ln = {
1983
+ ].sort((l, t) => l.toLocaleLowerCase().localeCompare(t.toLocaleLowerCase())), kn = {
2612
1984
  head: "arrow",
2613
- strokeColor: Xr,
1985
+ strokeColor: lr,
2614
1986
  strokeWidth: 5
2615
- }, In = 0.25, $n = {
1987
+ }, En = 0.25, Sn = {
2616
1988
  font: "Roboto",
2617
- fontSize: Lr[2],
2618
- padding: Lr[2] * In,
2619
- color: Xr,
2620
- strokeType: Ir,
2621
- background: Ir
1989
+ fontSize: Ve[2],
1990
+ padding: Ve[2] * En,
1991
+ color: lr,
1992
+ strokeType: Ze,
1993
+ background: Ze
2622
1994
  };
2623
- function jn(u) {
2624
- return u.reduce((e, o) => e + o, 0) / u.length;
1995
+ function Cn(l) {
1996
+ return l.reduce((t, i) => t + i, 0) / l.length;
2625
1997
  }
2626
- function Bn(u, e = 0, o = 1) {
2627
- return e + (o - e) * u;
1998
+ function In(l, t = 0, i = 1) {
1999
+ return t + (i - t) * l;
2628
2000
  }
2629
- function qn(u, e = 0, o = 1) {
2630
- return (u - e) / (o - e);
2001
+ function Mn(l, t = 0, i = 1) {
2002
+ return (l - t) / (i - t);
2631
2003
  }
2632
- function Wn() {
2633
- return jr(null);
2004
+ function On() {
2005
+ return Ye(null);
2634
2006
  }
2635
- const Gr = jr(
2007
+ const hr = Ye(
2636
2008
  void 0
2637
- ), Un = () => Kr(Gr), Fn = (u, e) => {
2638
- switch (e.type) {
2009
+ ), zn = () => Ur(hr), _n = (l, t) => {
2010
+ switch (t.type) {
2639
2011
  case "add":
2640
2012
  return {
2641
- ...u,
2642
- features: [...u.features, e.payload]
2013
+ ...l,
2014
+ features: [...l.features, t.payload]
2643
2015
  };
2644
2016
  case "remove":
2645
2017
  return {
2646
- ...u,
2647
- features: u.features.filter((o) => o.id !== e.payload.id)
2018
+ ...l,
2019
+ features: l.features.filter((i) => i.id !== t.payload.id)
2648
2020
  };
2649
2021
  case "update":
2650
2022
  return {
2651
- ...u,
2652
- features: u.features.map(
2653
- (o) => o.id === e.payload.id ? e.payload : o
2023
+ ...l,
2024
+ features: l.features.map(
2025
+ (i) => i.id === t.payload.id ? t.payload : i
2654
2026
  )
2655
2027
  };
2656
2028
  default:
2657
- return u;
2658
- }
2659
- }, Yn = ({ children: u }) => {
2660
- const e = Qr(), [o, n] = Zr(Fn, {
2661
- type: "FeatureCollection",
2662
- features: []
2663
- }), [l, h] = Nt(null), [d, g] = Nt(Ln), [f, v] = Nt($n), [y, A] = Nt(), [k, S] = Nt(1), [R, C] = Nt(1);
2664
- return nr(() => {
2665
- if (!e) return;
2666
- const L = new Pn(e, {
2029
+ return l;
2030
+ }
2031
+ }, Pn = ({
2032
+ children: l,
2033
+ annotations: t
2034
+ }) => {
2035
+ const i = Gr(), [r, a] = Xr(
2036
+ _n,
2037
+ t || {
2038
+ type: "FeatureCollection",
2039
+ features: []
2040
+ }
2041
+ ), [h, c] = Et(null), [d, f] = Et(kn), [g, p] = Et(Sn), [w, b] = Et(), [A, E] = Et(1), [k, L] = Et(1);
2042
+ return he(() => {
2043
+ if (!i) return;
2044
+ const M = new An(i, {
2667
2045
  minArrowHeight: 1
2668
- }), $ = jn(e.getNodes().getAttribute("radius")) / 5, _ = k;
2669
- return g({
2046
+ }), C = Cn(i.getNodes().getAttribute("radius")) / 5, N = A;
2047
+ return f({
2670
2048
  ...d,
2671
- strokeWidth: (d.strokeWidth || 1) * _
2672
- }), S(_), C($), L.on("select", (z) => {
2673
- at(z) ? g({
2674
- ...z.properties.style || {}
2675
- }) : yt(z) && v({
2676
- ...z.properties.style || {}
2677
- }), h(z);
2049
+ strokeWidth: (d.strokeWidth || 1) * N
2050
+ }), E(N), L(C), M.on("select", (P) => {
2051
+ ot(P) ? f({
2052
+ ...P.properties.style || {}
2053
+ }) : ct(P) && p({
2054
+ ...P.properties.style || {}
2055
+ }), c(P);
2678
2056
  }).on("unselect", () => {
2679
- h(null);
2680
- }), A(L), () => {
2681
- L.destroy();
2057
+ c(null);
2058
+ }), b(M), t && M.add(t), () => {
2059
+ M.destroy();
2682
2060
  };
2683
- }, [e]), nr(() => {
2684
- y && l && (l == null ? void 0 : l.properties.type) === "arrow" && y.updateStyle(l.id, d);
2685
- }, [y, d, l]), nr(() => {
2686
- y && l && (l == null ? void 0 : l.properties.type) === "text" && y.updateStyle(l.id, f);
2687
- }, [y, f, l]), /* @__PURE__ */ nn.jsx(
2688
- Gr.Provider,
2061
+ }, [i]), he(() => {
2062
+ w && h && (h == null ? void 0 : h.properties.type) === "arrow" && w.updateStyle(h.id, d);
2063
+ }, [w, d, h]), he(() => {
2064
+ w && h && (h == null ? void 0 : h.properties.type) === "text" && w.updateStyle(h.id, g);
2065
+ }, [w, g, h]), /* @__PURE__ */ Wr.createElement(
2066
+ hr.Provider,
2689
2067
  {
2690
2068
  value: {
2691
- annotations: o,
2692
- updateAnnotations: n,
2693
- currentAnnotation: l,
2694
- setCurrentAnnotation: h,
2695
- textStyle: f,
2696
- setTextStyle: v,
2069
+ annotations: r,
2070
+ updateAnnotations: a,
2071
+ currentAnnotation: h,
2072
+ setCurrentAnnotation: c,
2073
+ textStyle: g,
2074
+ setTextStyle: p,
2697
2075
  arrowStyle: d,
2698
- setArrowStyle: g,
2699
- arrowWidthFactor: k,
2700
- setArrowWidthFactor: S,
2701
- textSizeFactor: R,
2702
- setTextSizeFactor: C,
2703
- editor: y,
2704
- setEditor: A
2705
- },
2706
- children: u
2707
- }
2076
+ setArrowStyle: f,
2077
+ arrowWidthFactor: A,
2078
+ setArrowWidthFactor: E,
2079
+ textSizeFactor: k,
2080
+ setTextSizeFactor: L,
2081
+ editor: w,
2082
+ setEditor: b
2083
+ }
2084
+ },
2085
+ l
2708
2086
  );
2709
2087
  };
2710
2088
  export {
2711
- Gr as AnnotationsContext,
2712
- Yn as AnnotationsContextProvider,
2713
- Xr as BLACK,
2714
- In as RELATIVE_PADDING,
2715
- Ir as TRANSPARENT,
2716
- Wn as createAnnotationsContext,
2717
- Ln as defaultArrowStyle,
2718
- Nn as defaultColors,
2719
- $n as defaultTextStyle,
2720
- Lr as fontSizes,
2721
- Hn as fonts,
2722
- Bn as interpolate,
2723
- jn as mean,
2724
- qn as normalize,
2725
- Un as useAnnotationsContext
2089
+ hr as AnnotationsContext,
2090
+ Pn as AnnotationsContextProvider,
2091
+ lr as BLACK,
2092
+ En as RELATIVE_PADDING,
2093
+ Ze as TRANSPARENT,
2094
+ On as createAnnotationsContext,
2095
+ kn as defaultArrowStyle,
2096
+ Tn as defaultColors,
2097
+ Sn as defaultTextStyle,
2098
+ Ve as fontSizes,
2099
+ $n as fonts,
2100
+ In as interpolate,
2101
+ Cn as mean,
2102
+ Mn as normalize,
2103
+ zn as useAnnotationsContext
2726
2104
  };