@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.js +11 -40
- package/dist/index.mjs +1389 -2011
- package/dist/types/index.d.ts +6 -6
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,648 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useOgma as
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
},
|
|
11
|
+
}, $e = {
|
|
640
12
|
id: 0,
|
|
641
13
|
type: "Feature",
|
|
642
14
|
properties: {
|
|
643
15
|
type: "arrow",
|
|
644
16
|
style: {
|
|
645
|
-
...
|
|
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
|
-
},
|
|
666
|
-
id:
|
|
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
|
-
...
|
|
672
|
-
...
|
|
43
|
+
...Pt,
|
|
44
|
+
...a
|
|
673
45
|
}
|
|
674
46
|
},
|
|
675
47
|
geometry: {
|
|
676
48
|
type: "LineString",
|
|
677
49
|
coordinates: [
|
|
678
|
-
[
|
|
679
|
-
[
|
|
50
|
+
[l, t],
|
|
51
|
+
[i, r]
|
|
680
52
|
]
|
|
681
53
|
}
|
|
682
|
-
}),
|
|
683
|
-
function
|
|
684
|
-
return document.createElementNS(
|
|
54
|
+
}), Jr = "http://www.w3.org/2000/svg";
|
|
55
|
+
function wt(l) {
|
|
56
|
+
return document.createElementNS(Jr, l);
|
|
685
57
|
}
|
|
686
|
-
function
|
|
687
|
-
return
|
|
58
|
+
function Je(l) {
|
|
59
|
+
return l.geometry.bbox || Kr(l), l.geometry.bbox;
|
|
688
60
|
}
|
|
689
|
-
function
|
|
690
|
-
const
|
|
61
|
+
function ft(l) {
|
|
62
|
+
const t = Je(l);
|
|
691
63
|
return {
|
|
692
|
-
width:
|
|
693
|
-
height:
|
|
64
|
+
width: t[2] - t[0],
|
|
65
|
+
height: t[3] - t[1]
|
|
694
66
|
};
|
|
695
67
|
}
|
|
696
|
-
function
|
|
697
|
-
const
|
|
698
|
-
return { x:
|
|
68
|
+
function dt(l) {
|
|
69
|
+
const t = Je(l);
|
|
70
|
+
return { x: t[0], y: t[1] };
|
|
699
71
|
}
|
|
700
|
-
function
|
|
701
|
-
const [
|
|
702
|
-
|
|
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
|
|
705
|
-
|
|
76
|
+
function Qr(l, t, i, r, a) {
|
|
77
|
+
l.geometry.bbox = [t, i, t + r, i + a], l.geometry.coordinates = [
|
|
706
78
|
[
|
|
707
|
-
[
|
|
708
|
-
[
|
|
709
|
-
[
|
|
710
|
-
[
|
|
711
|
-
[
|
|
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
|
|
716
|
-
const [
|
|
717
|
-
return { x:
|
|
87
|
+
function zt(l) {
|
|
88
|
+
const [t, i] = l.geometry.coordinates[0];
|
|
89
|
+
return { x: t, y: i };
|
|
718
90
|
}
|
|
719
|
-
function
|
|
720
|
-
const [
|
|
721
|
-
return { x:
|
|
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
|
|
724
|
-
const [
|
|
725
|
-
return { x:
|
|
95
|
+
function Xt(l) {
|
|
96
|
+
const [t, i] = l.geometry.coordinates[1];
|
|
97
|
+
return { x: t, y: i };
|
|
726
98
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
99
|
+
function Ke(l, t, i) {
|
|
100
|
+
l.geometry.coordinates[0] = [t, i];
|
|
729
101
|
}
|
|
730
|
-
function
|
|
731
|
-
|
|
102
|
+
function Qe(l, t, i) {
|
|
103
|
+
l.geometry.coordinates[1] = [t, i];
|
|
732
104
|
}
|
|
733
|
-
function
|
|
734
|
-
return { start:
|
|
105
|
+
function Gt(l) {
|
|
106
|
+
return { start: zt(l), end: Xt(l) };
|
|
735
107
|
}
|
|
736
|
-
function
|
|
737
|
-
|
|
108
|
+
function St(l, t, i, r) {
|
|
109
|
+
t === "start" ? Ke(l, i, r) : Qe(l, i, r);
|
|
738
110
|
}
|
|
739
|
-
const
|
|
740
|
-
function
|
|
741
|
-
return Array.isArray(
|
|
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
|
|
744
|
-
for (let
|
|
745
|
-
const h =
|
|
746
|
-
if (
|
|
747
|
-
h[0] =
|
|
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
|
|
750
|
-
const
|
|
751
|
-
|
|
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
|
|
126
|
+
return l;
|
|
755
127
|
}
|
|
756
|
-
function
|
|
757
|
-
const
|
|
128
|
+
function Wt(l, t, i) {
|
|
129
|
+
const r = Math.atan2(l.y - t.y, l.x - t.x);
|
|
758
130
|
return {
|
|
759
|
-
x:
|
|
760
|
-
y:
|
|
131
|
+
x: t.x + i * Math.cos(r),
|
|
132
|
+
y: t.y + i * Math.sin(r)
|
|
761
133
|
};
|
|
762
134
|
}
|
|
763
|
-
function
|
|
764
|
-
if (!
|
|
765
|
-
const
|
|
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:
|
|
768
|
-
y:
|
|
139
|
+
x: l.clientX - i.left - t.clientLeft,
|
|
140
|
+
y: l.clientY - i.top - t.clientTop
|
|
769
141
|
};
|
|
770
142
|
}
|
|
771
|
-
const
|
|
772
|
-
x:
|
|
773
|
-
y:
|
|
774
|
-
}),
|
|
775
|
-
x: -
|
|
776
|
-
y: -
|
|
777
|
-
}),
|
|
778
|
-
const
|
|
779
|
-
return
|
|
780
|
-
x:
|
|
781
|
-
y:
|
|
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
|
-
},
|
|
784
|
-
x:
|
|
785
|
-
y:
|
|
786
|
-
}),
|
|
787
|
-
x:
|
|
788
|
-
y:
|
|
789
|
-
}),
|
|
790
|
-
x:
|
|
791
|
-
y:
|
|
792
|
-
}),
|
|
793
|
-
const
|
|
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:
|
|
796
|
-
y:
|
|
167
|
+
x: l.x * r - l.y * i,
|
|
168
|
+
y: l.x * i + l.y * r
|
|
797
169
|
};
|
|
798
|
-
},
|
|
799
|
-
x:
|
|
800
|
-
y:
|
|
801
|
-
}),
|
|
802
|
-
function
|
|
803
|
-
var
|
|
804
|
-
const { start:
|
|
805
|
-
return Math.min(
|
|
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
|
|
808
|
-
const
|
|
809
|
-
if (!
|
|
810
|
-
const h =
|
|
811
|
-
return `M ${h.x} ${h.y} L ${
|
|
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
|
|
814
|
-
const { start: h, end:
|
|
815
|
-
tail:
|
|
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:
|
|
818
|
-
strokeWidth:
|
|
819
|
-
} =
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
|
|
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
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
), (
|
|
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
|
|
836
|
-
return
|
|
207
|
+
function on(l) {
|
|
208
|
+
return l === "none" ? "none" : l;
|
|
837
209
|
}
|
|
838
|
-
function
|
|
839
|
-
const h =
|
|
840
|
-
h.setAttribute("cx", `${
|
|
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
|
|
843
|
-
function
|
|
844
|
-
return
|
|
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
|
|
847
|
-
function
|
|
848
|
-
return
|
|
849
|
-
var
|
|
850
|
-
function
|
|
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 && (
|
|
853
|
-
function
|
|
854
|
-
this.fn = f, this.context =
|
|
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,
|
|
857
|
-
if (typeof
|
|
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
|
|
860
|
-
return f._events[
|
|
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
|
|
863
|
-
--f._eventsCount === 0 ? f._events = new
|
|
234
|
+
function c(f, g) {
|
|
235
|
+
--f._eventsCount === 0 ? f._events = new r() : delete f._events[g];
|
|
864
236
|
}
|
|
865
|
-
function
|
|
866
|
-
this._events = new
|
|
237
|
+
function d() {
|
|
238
|
+
this._events = new r(), this._eventsCount = 0;
|
|
867
239
|
}
|
|
868
|
-
|
|
869
|
-
var f = [],
|
|
240
|
+
d.prototype.eventNames = function() {
|
|
241
|
+
var f = [], g, p;
|
|
870
242
|
if (this._eventsCount === 0) return f;
|
|
871
|
-
for (
|
|
872
|
-
|
|
873
|
-
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(
|
|
874
|
-
},
|
|
875
|
-
var
|
|
876
|
-
if (!
|
|
877
|
-
if (
|
|
878
|
-
for (var
|
|
879
|
-
|
|
880
|
-
return
|
|
881
|
-
},
|
|
882
|
-
var
|
|
883
|
-
return
|
|
884
|
-
},
|
|
885
|
-
var
|
|
886
|
-
if (!this._events[
|
|
887
|
-
var
|
|
888
|
-
if (
|
|
889
|
-
switch (
|
|
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
|
|
263
|
+
return k.fn.call(k.context), !0;
|
|
892
264
|
case 2:
|
|
893
|
-
return
|
|
265
|
+
return k.fn.call(k.context, g), !0;
|
|
894
266
|
case 3:
|
|
895
|
-
return
|
|
267
|
+
return k.fn.call(k.context, g, p), !0;
|
|
896
268
|
case 4:
|
|
897
|
-
return
|
|
269
|
+
return k.fn.call(k.context, g, p, w), !0;
|
|
898
270
|
case 5:
|
|
899
|
-
return
|
|
271
|
+
return k.fn.call(k.context, g, p, w, b), !0;
|
|
900
272
|
case 6:
|
|
901
|
-
return
|
|
273
|
+
return k.fn.call(k.context, g, p, w, b, A), !0;
|
|
902
274
|
}
|
|
903
|
-
for (
|
|
904
|
-
|
|
905
|
-
|
|
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
|
|
908
|
-
for (
|
|
909
|
-
switch (C
|
|
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
|
|
283
|
+
k[C].fn.call(k[C].context);
|
|
912
284
|
break;
|
|
913
285
|
case 2:
|
|
914
|
-
C
|
|
286
|
+
k[C].fn.call(k[C].context, g);
|
|
915
287
|
break;
|
|
916
288
|
case 3:
|
|
917
|
-
C
|
|
289
|
+
k[C].fn.call(k[C].context, g, p);
|
|
918
290
|
break;
|
|
919
291
|
case 4:
|
|
920
|
-
C
|
|
292
|
+
k[C].fn.call(k[C].context, g, p, w);
|
|
921
293
|
break;
|
|
922
294
|
default:
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
C
|
|
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
|
-
},
|
|
930
|
-
return h(this, f,
|
|
931
|
-
},
|
|
932
|
-
return h(this, f,
|
|
933
|
-
},
|
|
934
|
-
var
|
|
935
|
-
if (!this._events[
|
|
936
|
-
if (!
|
|
937
|
-
return
|
|
938
|
-
var
|
|
939
|
-
if (
|
|
940
|
-
|
|
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
|
|
943
|
-
(
|
|
944
|
-
|
|
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
|
-
},
|
|
948
|
-
var
|
|
949
|
-
return f ? (
|
|
950
|
-
},
|
|
951
|
-
}(
|
|
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
|
|
954
|
-
const
|
|
955
|
-
class
|
|
956
|
-
constructor(
|
|
957
|
-
super(),
|
|
958
|
-
|
|
959
|
-
}),
|
|
960
|
-
if (!
|
|
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
|
|
963
|
-
|
|
964
|
-
}), this.ogma =
|
|
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 =
|
|
967
|
-
draw: (
|
|
968
|
-
}), this.layer.moveToTop(), this.editor =
|
|
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(
|
|
979
|
-
const
|
|
980
|
-
id:
|
|
981
|
-
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
|
-
...
|
|
984
|
-
...
|
|
355
|
+
...i.properties,
|
|
356
|
+
...t.properties || {},
|
|
985
357
|
// styles need to be merged
|
|
986
|
-
style: { ...
|
|
358
|
+
style: { ...i.properties.style, ...t.properties.style || {} }
|
|
987
359
|
},
|
|
988
360
|
geometry: {
|
|
989
|
-
...
|
|
990
|
-
...
|
|
361
|
+
...i.geometry,
|
|
362
|
+
...t.geometry
|
|
991
363
|
}
|
|
992
364
|
});
|
|
993
|
-
return this.elements.push(
|
|
365
|
+
return this.elements.push(r), this.layer.refresh(), this.emit(ye, r), r;
|
|
994
366
|
}
|
|
995
|
-
updateStyle(
|
|
996
|
-
this.updateAnnotation(
|
|
367
|
+
updateStyle(t, i) {
|
|
368
|
+
this.updateAnnotation(t, {
|
|
997
369
|
properties: {
|
|
998
|
-
style:
|
|
370
|
+
style: i
|
|
999
371
|
}
|
|
1000
372
|
});
|
|
1001
373
|
}
|
|
1002
|
-
updateGeometry(
|
|
1003
|
-
this.updateAnnotation(
|
|
1004
|
-
geometry:
|
|
374
|
+
updateGeometry(t, i) {
|
|
375
|
+
this.updateAnnotation(t, {
|
|
376
|
+
geometry: i
|
|
1005
377
|
});
|
|
1006
378
|
}
|
|
1007
|
-
scale(
|
|
379
|
+
scale(t, i, r, a) {
|
|
1008
380
|
this.updateGeometry(
|
|
1009
|
-
|
|
1010
|
-
|
|
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(
|
|
1020
|
-
const
|
|
1021
|
-
this.updateAnnotation(
|
|
1022
|
-
}
|
|
1023
|
-
updateAnnotation(
|
|
1024
|
-
if (!
|
|
1025
|
-
const
|
|
1026
|
-
Object.keys(
|
|
1027
|
-
if (
|
|
1028
|
-
if (
|
|
1029
|
-
const h =
|
|
1030
|
-
|
|
1031
|
-
...
|
|
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
|
-
...
|
|
406
|
+
...t.properties.style || {},
|
|
1035
407
|
...h.style || {}
|
|
1036
408
|
}
|
|
1037
409
|
};
|
|
1038
|
-
} else
|
|
1039
|
-
...
|
|
1040
|
-
...
|
|
1041
|
-
} :
|
|
1042
|
-
}),
|
|
1043
|
-
}
|
|
1044
|
-
getById(
|
|
1045
|
-
const
|
|
1046
|
-
for (let
|
|
1047
|
-
const
|
|
1048
|
-
if (!(
|
|
1049
|
-
return
|
|
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(
|
|
1058
|
-
const
|
|
1059
|
-
|
|
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(
|
|
1062
|
-
const
|
|
1063
|
-
|
|
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 ===
|
|
438
|
+
return this.selectedId === U ? null : this.getById(this.selectedId);
|
|
1067
439
|
}
|
|
1068
440
|
unselect() {
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
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
|
|
1074
|
-
return this.emit(
|
|
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(
|
|
1082
|
-
const
|
|
1083
|
-
|
|
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
|
|
1134
|
-
class
|
|
1135
|
-
constructor(
|
|
505
|
+
const He = "handle-line", Ne = "handle-start", je = "handle-end";
|
|
506
|
+
class fn extends ar {
|
|
507
|
+
constructor(t, i = {}) {
|
|
1136
508
|
super(
|
|
1137
|
-
|
|
509
|
+
t,
|
|
1138
510
|
`
|
|
1139
511
|
<div class="arrow-handle">
|
|
1140
|
-
<div id="${
|
|
1141
|
-
<div id="${
|
|
1142
|
-
<div id="${
|
|
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
|
-
),
|
|
1146
|
-
const
|
|
1147
|
-
if (!
|
|
1148
|
-
const { x: h, y:
|
|
1149
|
-
this.startDragging(
|
|
1150
|
-
}),
|
|
1151
|
-
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle =
|
|
1152
|
-
}),
|
|
1153
|
-
if (!this.isDragging || this.draggedHandle ===
|
|
1154
|
-
const { x:
|
|
1155
|
-
|
|
1156
|
-
{ x:
|
|
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
|
-
|
|
1160
|
-
),
|
|
1161
|
-
(
|
|
1162
|
-
|
|
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
|
-
|
|
536
|
+
p ? "line" : w ? "start" : "end"
|
|
1165
537
|
), this.refreshEditor(), this.layer.refresh();
|
|
1166
|
-
}), this.minArrowHeight =
|
|
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
|
-
(
|
|
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(
|
|
1179
|
-
var
|
|
1180
|
-
this.disableDragging(), this.add(
|
|
1181
|
-
const h = this.ogma.view.graphToScreenCoordinates({ x:
|
|
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(
|
|
1187
|
-
h.x + (
|
|
1188
|
-
h.y +
|
|
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(
|
|
1193
|
-
}
|
|
1194
|
-
startDragging(
|
|
1195
|
-
this.selectedId !==
|
|
1196
|
-
}
|
|
1197
|
-
detect(
|
|
1198
|
-
return this.elements.find((
|
|
1199
|
-
const { start:
|
|
1200
|
-
x: (
|
|
1201
|
-
y: (
|
|
1202
|
-
}),
|
|
1203
|
-
return Math.abs(
|
|
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
|
|
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
|
-
|
|
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: (
|
|
1214
|
-
y: (
|
|
1215
|
-
},
|
|
1216
|
-
h.style.width = `${
|
|
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
|
|
591
|
+
return $e;
|
|
1220
592
|
}
|
|
1221
|
-
draw(
|
|
1222
|
-
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
(
|
|
1226
|
-
),
|
|
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
|
|
1230
|
-
this.layer.element !== null &&
|
|
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(${-
|
|
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
|
|
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
|
-
},
|
|
620
|
+
}, ue = {
|
|
1249
621
|
id: 0,
|
|
1250
622
|
type: "Feature",
|
|
1251
623
|
properties: {
|
|
1252
624
|
type: "text",
|
|
1253
625
|
content: "",
|
|
1254
|
-
style: { ...
|
|
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
|
-
},
|
|
642
|
+
}, Be = {
|
|
1271
643
|
handleSize: 3.5,
|
|
1272
644
|
placeholder: "Your text..."
|
|
1273
|
-
},
|
|
1274
|
-
id:
|
|
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:
|
|
1279
|
-
style: { ...
|
|
650
|
+
content: a,
|
|
651
|
+
style: { ...Dt, ...h }
|
|
1280
652
|
},
|
|
1281
653
|
geometry: {
|
|
1282
654
|
type: "Polygon",
|
|
1283
655
|
coordinates: [
|
|
1284
656
|
[
|
|
1285
|
-
[
|
|
1286
|
-
[
|
|
1287
|
-
[
|
|
1288
|
-
[
|
|
1289
|
-
[
|
|
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
|
|
1295
|
-
function
|
|
1296
|
-
return
|
|
1297
|
-
(function(
|
|
1298
|
-
|
|
1299
|
-
})(
|
|
1300
|
-
var
|
|
1301
|
-
for (var
|
|
1302
|
-
}, o: (
|
|
1303
|
-
function
|
|
1304
|
-
return
|
|
1305
|
-
return typeof
|
|
1306
|
-
} : function(
|
|
1307
|
-
return
|
|
1308
|
-
},
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/,
|
|
1312
|
-
function
|
|
1313
|
-
var
|
|
1314
|
-
return
|
|
1315
|
-
}
|
|
1316
|
-
var
|
|
1317
|
-
function
|
|
1318
|
-
var
|
|
1319
|
-
|
|
1320
|
-
var
|
|
1321
|
-
|
|
1322
|
-
var
|
|
1323
|
-
if (
|
|
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
|
|
1326
|
-
|
|
697
|
+
var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
|
|
698
|
+
y >= 100 && y !== 400 && (n.weight = y);
|
|
1327
699
|
}
|
|
1328
|
-
return
|
|
1329
|
-
}
|
|
1330
|
-
function
|
|
1331
|
-
var
|
|
1332
|
-
if (
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1335
|
-
} else if (typeof
|
|
1336
|
-
var
|
|
1337
|
-
|
|
1338
|
-
} else
|
|
1339
|
-
|
|
1340
|
-
var O = Object.create(
|
|
1341
|
-
return O.family =
|
|
1342
|
-
}
|
|
1343
|
-
const
|
|
1344
|
-
var L,
|
|
1345
|
-
var
|
|
1346
|
-
if (
|
|
1347
|
-
var
|
|
1348
|
-
if (
|
|
1349
|
-
return
|
|
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(
|
|
1353
|
-
if (!L[
|
|
1354
|
-
var
|
|
1355
|
-
L[
|
|
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
|
|
1358
|
-
}),
|
|
1359
|
-
function
|
|
1360
|
-
var
|
|
1361
|
-
if (!
|
|
1362
|
-
if (
|
|
1363
|
-
var
|
|
1364
|
-
return
|
|
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
|
|
1367
|
-
}
|
|
1368
|
-
function tt(
|
|
1369
|
-
return tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(
|
|
1370
|
-
return typeof
|
|
1371
|
-
} : function(
|
|
1372
|
-
return
|
|
1373
|
-
}, tt(
|
|
1374
|
-
}
|
|
1375
|
-
function
|
|
1376
|
-
if (typeof
|
|
1377
|
-
|
|
1378
|
-
}
|
|
1379
|
-
function
|
|
1380
|
-
return
|
|
1381
|
-
return
|
|
1382
|
-
},
|
|
1383
|
-
}
|
|
1384
|
-
function
|
|
1385
|
-
var
|
|
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
|
|
1397
|
-
if (
|
|
1398
|
-
var
|
|
1399
|
-
|
|
1400
|
-
} else
|
|
1401
|
-
return
|
|
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
|
|
1405
|
-
if (
|
|
1406
|
-
if (
|
|
1407
|
-
return function(
|
|
1408
|
-
if (
|
|
1409
|
-
return
|
|
1410
|
-
}(
|
|
1411
|
-
}
|
|
1412
|
-
function
|
|
1413
|
-
return
|
|
1414
|
-
return
|
|
1415
|
-
},
|
|
1416
|
-
}
|
|
1417
|
-
function
|
|
1418
|
-
if (!(
|
|
1419
|
-
}
|
|
1420
|
-
function
|
|
1421
|
-
for (var
|
|
1422
|
-
var
|
|
1423
|
-
|
|
1424
|
-
if (tt(
|
|
1425
|
-
var
|
|
1426
|
-
if (
|
|
1427
|
-
var
|
|
1428
|
-
if (tt(
|
|
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(
|
|
1432
|
-
}(
|
|
803
|
+
return String(y);
|
|
804
|
+
}(s.key, "string"), tt(u) === "symbol" ? u : String(u)), s);
|
|
1433
805
|
}
|
|
1434
|
-
var
|
|
806
|
+
var u;
|
|
1435
807
|
}
|
|
1436
|
-
function
|
|
1437
|
-
return
|
|
808
|
+
function Nt(e, n, o) {
|
|
809
|
+
return n && cr(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1438
810
|
}
|
|
1439
|
-
var
|
|
1440
|
-
function
|
|
1441
|
-
var
|
|
1442
|
-
|
|
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
|
|
1445
|
-
var
|
|
1446
|
-
return
|
|
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
|
-
} }]),
|
|
1452
|
-
}(),
|
|
1453
|
-
|
|
1454
|
-
var
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
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
|
|
1459
|
-
}(
|
|
1460
|
-
|
|
1461
|
-
var
|
|
1462
|
-
function
|
|
1463
|
-
return
|
|
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
|
|
1466
|
-
}(
|
|
1467
|
-
|
|
1468
|
-
var
|
|
1469
|
-
function
|
|
1470
|
-
return
|
|
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
|
|
1473
|
-
}(
|
|
1474
|
-
function
|
|
1475
|
-
|
|
1476
|
-
for (var
|
|
1477
|
-
|
|
1478
|
-
var
|
|
1479
|
-
if ((
|
|
1480
|
-
var O =
|
|
1481
|
-
/\u00AD$/.test(O) ? (
|
|
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
|
-
|
|
855
|
+
y = o;
|
|
1484
856
|
}
|
|
1485
|
-
return
|
|
1486
|
-
}
|
|
1487
|
-
const
|
|
1488
|
-
var
|
|
1489
|
-
|
|
1490
|
-
}, strong: function(
|
|
1491
|
-
|
|
1492
|
-
}, i: function(
|
|
1493
|
-
|
|
1494
|
-
}, em: function(
|
|
1495
|
-
|
|
1496
|
-
}, dfn: function(
|
|
1497
|
-
|
|
1498
|
-
}, cite: function(
|
|
1499
|
-
|
|
1500
|
-
}, code: function(
|
|
1501
|
-
|
|
1502
|
-
}, kbd: function(
|
|
1503
|
-
|
|
1504
|
-
}, samp: function(
|
|
1505
|
-
|
|
1506
|
-
}, var: function(
|
|
1507
|
-
|
|
1508
|
-
}, tt: function(
|
|
1509
|
-
|
|
1510
|
-
}, sub: function(
|
|
1511
|
-
|
|
1512
|
-
}, sup: function(
|
|
1513
|
-
|
|
1514
|
-
} },
|
|
1515
|
-
function
|
|
1516
|
-
return
|
|
1517
|
-
if (
|
|
1518
|
-
var
|
|
1519
|
-
return String.fromCharCode(parseInt(
|
|
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
|
|
893
|
+
return u in xe ? xe[u] : n;
|
|
1522
894
|
});
|
|
1523
895
|
}
|
|
1524
|
-
function
|
|
1525
|
-
return
|
|
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
|
|
1528
|
-
function
|
|
1529
|
-
var
|
|
1530
|
-
if (
|
|
899
|
+
var Ar = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
|
|
900
|
+
function kr(e) {
|
|
901
|
+
var n, o = {};
|
|
902
|
+
if (e) {
|
|
1531
903
|
do
|
|
1532
|
-
if (
|
|
1533
|
-
var
|
|
1534
|
-
if (
|
|
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 (
|
|
1537
|
-
if (/\S/.test(
|
|
908
|
+
while (n && e.length);
|
|
909
|
+
if (/\S/.test(e)) throw new Error("Attribute error");
|
|
1538
910
|
}
|
|
1539
|
-
return
|
|
1540
|
-
}
|
|
1541
|
-
const
|
|
1542
|
-
var
|
|
1543
|
-
|
|
1544
|
-
}, it: function(
|
|
1545
|
-
|
|
1546
|
-
}, sl: function(
|
|
1547
|
-
|
|
1548
|
-
}, color: function(
|
|
1549
|
-
|
|
1550
|
-
}, href: function(
|
|
1551
|
-
|
|
1552
|
-
}, "^": function(
|
|
1553
|
-
|
|
1554
|
-
}, _: function(
|
|
1555
|
-
|
|
1556
|
-
}, par: function(
|
|
1557
|
-
this.tokens.push(new
|
|
1558
|
-
}, newline: function(
|
|
1559
|
-
this.tokens.push(new
|
|
1560
|
-
}, url: function(
|
|
1561
|
-
this.open_context().href =
|
|
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
|
-
|
|
1564
|
-
var
|
|
1565
|
-
function
|
|
1566
|
-
|
|
1567
|
-
var
|
|
1568
|
-
return (
|
|
1569
|
-
}
|
|
1570
|
-
function
|
|
1571
|
-
for (var
|
|
1572
|
-
|
|
1573
|
-
}
|
|
1574
|
-
function
|
|
1575
|
-
return Math.round(1e6 *
|
|
1576
|
-
}
|
|
1577
|
-
function
|
|
1578
|
-
return function(
|
|
1579
|
-
if (Array.isArray(
|
|
1580
|
-
}(
|
|
1581
|
-
if (typeof Symbol < "u" &&
|
|
1582
|
-
}(
|
|
1583
|
-
if (
|
|
1584
|
-
if (typeof
|
|
1585
|
-
var
|
|
1586
|
-
return
|
|
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
|
-
}(
|
|
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
|
|
1594
|
-
(
|
|
1595
|
-
for (var
|
|
1596
|
-
return
|
|
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
|
|
1599
|
-
return !
|
|
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
|
|
1602
|
-
var
|
|
1603
|
-
if (
|
|
1604
|
-
var
|
|
1605
|
-
if (
|
|
1606
|
-
var F =
|
|
1607
|
-
|
|
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
|
|
1610
|
-
|
|
1611
|
-
for (var
|
|
1612
|
-
if (
|
|
1613
|
-
var
|
|
1614
|
-
|
|
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
|
-
|
|
1617
|
-
},
|
|
1618
|
-
var
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1621
|
-
for (var
|
|
1622
|
-
var
|
|
1623
|
-
|
|
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 (
|
|
997
|
+
if (T(), D) o.push.apply(o, Se(H));
|
|
1626
998
|
else {
|
|
1627
|
-
var
|
|
1628
|
-
|
|
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
|
|
1002
|
+
} else o.push(v("tspan", { x: O(rt), dy: bt(rt ? B : J) + "em" }, " "));
|
|
1631
1003
|
}
|
|
1632
1004
|
}
|
|
1633
|
-
return
|
|
1634
|
-
}
|
|
1635
|
-
var
|
|
1636
|
-
function
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1639
|
-
var
|
|
1640
|
-
if (
|
|
1641
|
-
var O =
|
|
1642
|
-
|
|
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
|
-
|
|
1645
|
-
var F =
|
|
1646
|
-
|
|
1647
|
-
|
|
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
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
var
|
|
1653
|
-
|
|
1654
|
-
return
|
|
1655
|
-
}(
|
|
1656
|
-
var
|
|
1657
|
-
if (
|
|
1658
|
-
|
|
1659
|
-
var
|
|
1660
|
-
|
|
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 +=
|
|
1034
|
+
F += R.width;
|
|
1663
1035
|
});
|
|
1664
1036
|
});
|
|
1665
1037
|
}
|
|
1666
1038
|
}
|
|
1667
|
-
function
|
|
1668
|
-
return
|
|
1669
|
-
return typeof
|
|
1670
|
-
} : function(
|
|
1671
|
-
return
|
|
1672
|
-
},
|
|
1673
|
-
}
|
|
1674
|
-
function
|
|
1675
|
-
for (var
|
|
1676
|
-
var
|
|
1677
|
-
typeof
|
|
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
|
|
1680
|
-
}
|
|
1681
|
-
function
|
|
1682
|
-
return
|
|
1683
|
-
return typeof
|
|
1684
|
-
} : function(
|
|
1685
|
-
return
|
|
1686
|
-
},
|
|
1687
|
-
}
|
|
1688
|
-
function
|
|
1689
|
-
for (var
|
|
1690
|
-
var
|
|
1691
|
-
|
|
1692
|
-
if (
|
|
1693
|
-
var
|
|
1694
|
-
if (
|
|
1695
|
-
var
|
|
1696
|
-
if (
|
|
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(
|
|
1700
|
-
}(
|
|
1071
|
+
return String(y);
|
|
1072
|
+
}(s.key, "string"), $t(u) === "symbol" ? u : String(u)), s);
|
|
1701
1073
|
}
|
|
1702
|
-
var
|
|
1074
|
+
var u;
|
|
1703
1075
|
}
|
|
1704
|
-
var
|
|
1705
|
-
return typeof
|
|
1706
|
-
return
|
|
1076
|
+
var Hr = E(), ie = function(e) {
|
|
1077
|
+
return typeof e == "function" ? e : function() {
|
|
1078
|
+
return e;
|
|
1707
1079
|
};
|
|
1708
|
-
},
|
|
1709
|
-
function
|
|
1710
|
-
if (function(
|
|
1711
|
-
if (!(
|
|
1712
|
-
}(this,
|
|
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:
|
|
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
|
|
1721
|
-
return
|
|
1722
|
-
var
|
|
1723
|
-
if (!
|
|
1724
|
-
var
|
|
1725
|
-
if (!
|
|
1726
|
-
for (var
|
|
1727
|
-
var
|
|
1728
|
-
if (
|
|
1729
|
-
else if (
|
|
1730
|
-
else if (
|
|
1731
|
-
else if (
|
|
1732
|
-
var
|
|
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
|
-
|
|
1735
|
-
var
|
|
1736
|
-
|
|
1737
|
-
} while (!
|
|
1738
|
-
|
|
1739
|
-
} else if (
|
|
1740
|
-
var
|
|
1741
|
-
if (
|
|
1742
|
-
var
|
|
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
|
-
|
|
1745
|
-
while (
|
|
1746
|
-
|
|
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
|
-
|
|
1749
|
-
} else
|
|
1750
|
-
|
|
1120
|
+
K.push(z + 1), H = 0, q++;
|
|
1121
|
+
} else H += T.width;
|
|
1122
|
+
z++, R = T.whitespace;
|
|
1751
1123
|
}
|
|
1752
|
-
|
|
1753
|
-
var
|
|
1754
|
-
for (var
|
|
1755
|
-
for (var
|
|
1756
|
-
|
|
1757
|
-
var
|
|
1758
|
-
return
|
|
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
|
|
1761
|
-
return
|
|
1762
|
-
}, 0),
|
|
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 (
|
|
1765
|
-
var
|
|
1766
|
-
|
|
1767
|
-
var
|
|
1768
|
-
if (
|
|
1769
|
-
var
|
|
1770
|
-
|
|
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
|
|
1775
|
-
if (
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1778
|
-
} else
|
|
1779
|
-
return
|
|
1780
|
-
}(
|
|
1781
|
-
return
|
|
1782
|
-
return
|
|
1783
|
-
},
|
|
1784
|
-
} }, { key: "font", value: function(
|
|
1785
|
-
return arguments.length ? (this.props.font =
|
|
1786
|
-
} }, { key: "overflow", value: function(
|
|
1787
|
-
return arguments.length ? (this.props.overflow = String(
|
|
1788
|
-
} }, { key: "overflowLine", value: function(
|
|
1789
|
-
return arguments.length ? (this.props.lineclamp = String(
|
|
1790
|
-
} }, { key: "valign", value: function(
|
|
1791
|
-
return arguments.length ? (this.props.valign =
|
|
1792
|
-
} }, { key: "align", value: function(
|
|
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
|
|
1795
|
-
return
|
|
1796
|
-
} }, { key: "overflowWrap", value: function(
|
|
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
|
|
1799
|
-
return
|
|
1800
|
-
} }, { key: "width", value: function(
|
|
1801
|
-
return arguments.length ? (this.props.width =
|
|
1802
|
-
} }, { key: "height", value: function(
|
|
1803
|
-
return arguments.length ? (this.props.height =
|
|
1804
|
-
} }, { key: "x", value: function(
|
|
1805
|
-
return arguments.length ? (this.props.x =
|
|
1806
|
-
} }, { key: "parser", value: function(
|
|
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
|
|
1809
|
-
var
|
|
1810
|
-
typeof
|
|
1180
|
+
if (typeof s == "string") {
|
|
1181
|
+
var u = e[s] || e[s + "parser"];
|
|
1182
|
+
typeof u == "function" && (s = u);
|
|
1811
1183
|
}
|
|
1812
|
-
if (typeof
|
|
1813
|
-
return this.props.parser =
|
|
1814
|
-
} }, { key: "createElement", value: function(
|
|
1815
|
-
return arguments.length ? (this.props.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
|
|
1818
|
-
return typeof
|
|
1819
|
-
} }],
|
|
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
|
|
1822
|
-
return
|
|
1823
|
-
return typeof
|
|
1824
|
-
} : function(
|
|
1825
|
-
return
|
|
1826
|
-
},
|
|
1827
|
-
}
|
|
1828
|
-
function
|
|
1829
|
-
(
|
|
1830
|
-
for (var
|
|
1831
|
-
return
|
|
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
|
|
1834
|
-
for (var
|
|
1835
|
-
var
|
|
1836
|
-
|
|
1837
|
-
if (
|
|
1838
|
-
var
|
|
1839
|
-
if (
|
|
1840
|
-
var
|
|
1841
|
-
if (
|
|
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(
|
|
1845
|
-
}(
|
|
1216
|
+
return String(y);
|
|
1217
|
+
}(s.key, "string"), It(u) === "symbol" ? u : String(u)), s);
|
|
1846
1218
|
}
|
|
1847
|
-
var
|
|
1219
|
+
var u;
|
|
1848
1220
|
}
|
|
1849
|
-
var
|
|
1850
|
-
return typeof
|
|
1851
|
-
return
|
|
1221
|
+
var _e = function(e) {
|
|
1222
|
+
return typeof e == "function" ? e : function() {
|
|
1223
|
+
return e;
|
|
1852
1224
|
};
|
|
1853
|
-
},
|
|
1854
|
-
function
|
|
1855
|
-
if (function(
|
|
1856
|
-
if (!(
|
|
1857
|
-
}(this,
|
|
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 },
|
|
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
|
|
1865
|
-
return
|
|
1866
|
-
var
|
|
1867
|
-
if (!arguments.length) return [
|
|
1868
|
-
if (typeof
|
|
1869
|
-
var
|
|
1870
|
-
|
|
1871
|
-
|
|
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(
|
|
1876
|
-
return arguments.length ? (this.props.width =
|
|
1877
|
-
} }, { key: "height", value: function(
|
|
1878
|
-
return arguments.length ? (this.props.height =
|
|
1879
|
-
} }, { key: "rotate", value: function(
|
|
1880
|
-
return arguments.length ? (this.props.rotation =
|
|
1881
|
-
} }, { key: "createElement", value: function(
|
|
1882
|
-
return arguments.length ? (this.props.createElement =
|
|
1883
|
-
} }, { key: "canvas", value: function(
|
|
1884
|
-
var
|
|
1885
|
-
return
|
|
1886
|
-
if (Array.isArray(
|
|
1887
|
-
}(
|
|
1888
|
-
if (typeof Symbol < "u" &&
|
|
1889
|
-
}(
|
|
1890
|
-
if (
|
|
1891
|
-
if (typeof
|
|
1892
|
-
var
|
|
1893
|
-
return
|
|
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
|
-
}(
|
|
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
|
-
}()),
|
|
1270
|
+
}()), u(x), x.restore(), x;
|
|
1899
1271
|
} }, { key: "render", value: function() {
|
|
1900
|
-
var
|
|
1901
|
-
if (
|
|
1902
|
-
if (
|
|
1903
|
-
if (
|
|
1904
|
-
var
|
|
1905
|
-
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") },
|
|
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
|
-
} }],
|
|
1908
|
-
}(),
|
|
1909
|
-
function
|
|
1910
|
-
return oe[
|
|
1911
|
-
return
|
|
1912
|
-
})), oe[
|
|
1913
|
-
}
|
|
1914
|
-
function
|
|
1915
|
-
if (Array.isArray(
|
|
1916
|
-
return
|
|
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
|
|
1290
|
+
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1919
1291
|
}
|
|
1920
|
-
function
|
|
1292
|
+
function Te(e, n) {
|
|
1921
1293
|
if (typeof document < "u") {
|
|
1922
|
-
var
|
|
1923
|
-
if (
|
|
1924
|
-
for (var
|
|
1925
|
-
return
|
|
1926
|
-
|
|
1927
|
-
}),
|
|
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
|
-
|
|
1931
|
-
|
|
1932
|
-
for (var
|
|
1933
|
-
for (var
|
|
1934
|
-
|
|
1935
|
-
},
|
|
1936
|
-
var
|
|
1937
|
-
if (
|
|
1938
|
-
for (var
|
|
1939
|
-
for (; O &&
|
|
1940
|
-
for (; O-- > 0; )
|
|
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
|
-
};
|
|
1943
|
-
if (
|
|
1944
|
-
else if (!(
|
|
1945
|
-
else if (
|
|
1946
|
-
var
|
|
1947
|
-
|
|
1948
|
-
var
|
|
1949
|
-
|
|
1950
|
-
} else
|
|
1951
|
-
|
|
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
|
|
1954
|
-
return
|
|
1955
|
-
},
|
|
1956
|
-
|
|
1957
|
-
var
|
|
1958
|
-
|
|
1959
|
-
return
|
|
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(
|
|
1963
|
-
return
|
|
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,
|
|
1967
|
-
return
|
|
1968
|
-
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(F,
|
|
1969
|
-
return
|
|
1970
|
-
}).replace(/\\verb,(.*?),/, function(F,
|
|
1971
|
-
return "\\verb,".concat(
|
|
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
|
|
1974
|
-
for (var
|
|
1975
|
-
return
|
|
1976
|
-
},
|
|
1977
|
-
|
|
1978
|
-
},
|
|
1979
|
-
if (!
|
|
1980
|
-
|
|
1981
|
-
},
|
|
1982
|
-
if (
|
|
1983
|
-
else if (
|
|
1984
|
-
else if (!(
|
|
1985
|
-
if (
|
|
1986
|
-
else if (
|
|
1987
|
-
else if (!(
|
|
1988
|
-
else if (
|
|
1989
|
-
var
|
|
1990
|
-
if (/^(La)?TeX$/i.test(
|
|
1991
|
-
|
|
1992
|
-
var
|
|
1993
|
-
|
|
1994
|
-
} else if (
|
|
1995
|
-
else if (
|
|
1996
|
-
var O = [],
|
|
1997
|
-
if (
|
|
1998
|
-
for (
|
|
1999
|
-
if (!(
|
|
2000
|
-
O.push(
|
|
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
|
-
|
|
1374
|
+
o[0] = /^\{/.exec(e) ? "{" : "", I = !!o[0];
|
|
2003
1375
|
}
|
|
2004
|
-
|
|
2005
|
-
} else console.warn("unknown latex command",
|
|
2006
|
-
} else
|
|
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
|
-
|
|
1380
|
+
e = e.slice(o[0].length);
|
|
2009
1381
|
}
|
|
2010
|
-
return
|
|
2011
|
-
},
|
|
2012
|
-
return
|
|
2013
|
-
},
|
|
2014
|
-
const
|
|
2015
|
-
return
|
|
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
|
-
}(
|
|
1389
|
+
}(ve)), ve.exports;
|
|
2018
1390
|
}
|
|
2019
|
-
var
|
|
2020
|
-
const
|
|
2021
|
-
function
|
|
2022
|
-
return
|
|
1391
|
+
var mn = yn();
|
|
1392
|
+
const Re = /* @__PURE__ */ sr(mn);
|
|
1393
|
+
function ce(l) {
|
|
1394
|
+
return l.replace(/…$/, "");
|
|
2023
1395
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return
|
|
1396
|
+
function de(l) {
|
|
1397
|
+
return l.children[0].innerHTML;
|
|
2026
1398
|
}
|
|
2027
|
-
function
|
|
2028
|
-
const
|
|
2029
|
-
if (
|
|
2030
|
-
const
|
|
2031
|
-
font: `${
|
|
2032
|
-
width:
|
|
2033
|
-
height:
|
|
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:
|
|
1411
|
+
createElement: Re.createElement
|
|
2040
1412
|
});
|
|
2041
|
-
|
|
2042
|
-
const
|
|
2043
|
-
|
|
1413
|
+
c.overflowWrap("break-word");
|
|
1414
|
+
const d = c.linebreak(
|
|
1415
|
+
l.properties.content.replaceAll(`
|
|
2044
1416
|
`, "<br>")
|
|
2045
|
-
).render(), f = [...
|
|
2046
|
-
let
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
`).forEach((
|
|
2050
|
-
let
|
|
2051
|
-
for (;
|
|
2052
|
-
if (f[
|
|
2053
|
-
|
|
2054
|
-
`) ||
|
|
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 === " ") {
|
|
1425
|
+
E.startsWith(`
|
|
1426
|
+
`) || p.push(g), g++;
|
|
2055
1427
|
break;
|
|
2056
1428
|
}
|
|
2057
|
-
const
|
|
2058
|
-
|
|
1429
|
+
const k = ce(de(f[g]));
|
|
1430
|
+
E.startsWith(k) && (E = E.slice(k.length).trim()), g++;
|
|
2059
1431
|
}
|
|
2060
|
-
}),
|
|
2061
|
-
const
|
|
2062
|
-
|
|
2063
|
-
let
|
|
2064
|
-
const
|
|
2065
|
-
for (;
|
|
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
|
-
(
|
|
1439
|
+
(C) => !!C.children[0] && C.children[0].tagName === "tspan" && E.startsWith(ce(de(C)))
|
|
2068
1440
|
);
|
|
2069
1441
|
if (!L) break;
|
|
2070
|
-
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2073
|
-
|
|
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
|
-
|
|
2076
|
-
const
|
|
2077
|
-
|
|
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
|
-
}),
|
|
1451
|
+
}), t.appendChild(d);
|
|
2080
1452
|
}
|
|
2081
|
-
const
|
|
2082
|
-
class
|
|
2083
|
-
constructor(
|
|
1453
|
+
const We = 20;
|
|
1454
|
+
class wn extends ar {
|
|
1455
|
+
constructor(t, i = {}) {
|
|
2084
1456
|
super(
|
|
2085
|
-
|
|
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
|
-
),
|
|
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
|
-
}),
|
|
1473
|
+
}), m(this, "_onBlur", () => {
|
|
2102
1474
|
this.isFocused = !1;
|
|
2103
|
-
}),
|
|
2104
|
-
this.add(
|
|
2105
|
-
const
|
|
2106
|
-
this.select(
|
|
2107
|
-
}),
|
|
2108
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
2109
|
-
}),
|
|
2110
|
-
this.annotation =
|
|
2111
|
-
const
|
|
2112
|
-
this.rect.x =
|
|
2113
|
-
}),
|
|
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:
|
|
2118
|
-
this.startDragging(h,
|
|
2119
|
-
}),
|
|
2120
|
-
requestAnimationFrame(() => this._onMouseMove(
|
|
2121
|
-
}),
|
|
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
|
-
|
|
1495
|
+
a.stopPropagation(), a.preventDefault();
|
|
2124
1496
|
const h = this.handles[this.draggedHandle];
|
|
2125
|
-
let
|
|
2126
|
-
const
|
|
2127
|
-
let
|
|
2128
|
-
!
|
|
2129
|
-
const { x:
|
|
2130
|
-
|
|
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
|
|
2134
|
-
const
|
|
2135
|
-
|
|
2136
|
-
}),
|
|
2137
|
-
!this.isDragging || this.draggedHandle ===
|
|
2138
|
-
}),
|
|
2139
|
-
|
|
2140
|
-
}),
|
|
2141
|
-
const
|
|
2142
|
-
document.documentElement.style.setProperty("--handle-scale", `${1 /
|
|
2143
|
-
}),
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2146
|
-
}), this.showeditorOnHover = !1, this.handleSize =
|
|
2147
|
-
const
|
|
2148
|
-
|
|
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
|
-
(
|
|
2152
|
-
), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0),
|
|
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:
|
|
2158
|
-
const
|
|
2159
|
-
return this.elements.find((
|
|
2160
|
-
const { x:
|
|
2161
|
-
return
|
|
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(
|
|
2165
|
-
|
|
2166
|
-
const
|
|
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
|
|
2169
|
-
if (
|
|
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:
|
|
2172
|
-
fontSize:
|
|
2173
|
-
font:
|
|
2174
|
-
strokeColor:
|
|
2175
|
-
strokeWidth:
|
|
2176
|
-
strokeType:
|
|
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
|
-
} =
|
|
2180
|
-
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
let
|
|
2184
|
-
|
|
2185
|
-
const { x: tt, y:
|
|
2186
|
-
|
|
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
|
|
2189
|
-
|
|
1560
|
+
const a = wt("style");
|
|
1561
|
+
a.innerHTML = i, t.firstChild && t.insertBefore(a, t.firstChild);
|
|
2190
1562
|
}
|
|
2191
1563
|
refreshDrawing() {
|
|
2192
|
-
const
|
|
2193
|
-
for (let
|
|
2194
|
-
const
|
|
2195
|
-
if (!
|
|
2196
|
-
const h =
|
|
2197
|
-
|
|
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
|
|
1573
|
+
return ue;
|
|
2202
1574
|
}
|
|
2203
1575
|
refreshEditor() {
|
|
2204
1576
|
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2207
|
-
),
|
|
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:
|
|
2210
|
-
color:
|
|
1581
|
+
fontSize: c,
|
|
1582
|
+
color: d,
|
|
2211
1583
|
background: f,
|
|
2212
|
-
padding:
|
|
2213
|
-
} =
|
|
2214
|
-
this.textArea.value =
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2217
|
-
const
|
|
2218
|
-
|
|
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(
|
|
2221
|
-
super.select(
|
|
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
|
|
1599
|
+
class xn {
|
|
2228
1600
|
constructor() {
|
|
2229
|
-
|
|
2230
|
-
}
|
|
2231
|
-
add(
|
|
2232
|
-
const
|
|
2233
|
-
id:
|
|
2234
|
-
arrow:
|
|
2235
|
-
target:
|
|
2236
|
-
targetType:
|
|
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:
|
|
1610
|
+
side: i
|
|
2239
1611
|
};
|
|
2240
|
-
return this.links[
|
|
2241
|
-
id:
|
|
2242
|
-
side:
|
|
2243
|
-
type:
|
|
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(
|
|
2248
|
-
var
|
|
2249
|
-
return !!((
|
|
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(
|
|
2253
|
-
var
|
|
2254
|
-
const h =
|
|
2255
|
-
if ((
|
|
2256
|
-
const
|
|
2257
|
-
delete this.links[
|
|
2258
|
-
const f = this.linksByTargetId[
|
|
2259
|
-
for (let
|
|
2260
|
-
if (f[
|
|
2261
|
-
f.splice(
|
|
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][
|
|
1636
|
+
return delete this.linksByArrowId[h][i], this;
|
|
2265
1637
|
}
|
|
2266
|
-
getArrowLink(
|
|
2267
|
-
var
|
|
2268
|
-
const
|
|
2269
|
-
return
|
|
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(
|
|
2272
|
-
var
|
|
2273
|
-
return ((
|
|
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(
|
|
2276
|
-
Object.values(this.links).forEach(
|
|
1647
|
+
forEach(t) {
|
|
1648
|
+
Object.values(this.links).forEach(t);
|
|
2277
1649
|
}
|
|
2278
1650
|
}
|
|
2279
|
-
const
|
|
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
|
-
},
|
|
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
|
|
2300
|
-
constructor(
|
|
2301
|
-
super(),
|
|
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
|
-
|
|
2304
|
-
const
|
|
2305
|
-
|
|
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
|
|
2308
|
-
|
|
2309
|
-
}),
|
|
2310
|
-
}),
|
|
2311
|
-
const h =
|
|
2312
|
-
if (
|
|
2313
|
-
["start", "end"].find((
|
|
2314
|
-
const
|
|
2315
|
-
return this._snapToText(
|
|
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 (
|
|
2318
|
-
const
|
|
2319
|
-
this._snapToText(
|
|
2320
|
-
} else
|
|
2321
|
-
const
|
|
2322
|
-
|
|
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(
|
|
2325
|
-
}),
|
|
2326
|
-
this.dragged !== null &&
|
|
2327
|
-
this.links.getArrowLink(
|
|
2328
|
-
arrow:
|
|
2329
|
-
link: this.links.getArrowLink(
|
|
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
|
-
}), (
|
|
2332
|
-
}),
|
|
2333
|
-
this.textToMagnet = void 0,
|
|
2334
|
-
const h =
|
|
2335
|
-
h && h !==
|
|
2336
|
-
}), this.emit(
|
|
2337
|
-
}),
|
|
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
|
-
}),
|
|
2340
|
-
const { dx:
|
|
2341
|
-
this._moveNodes(
|
|
2342
|
-
}),
|
|
2343
|
-
|
|
2344
|
-
this.links.getTargetLinks(
|
|
2345
|
-
const
|
|
2346
|
-
|
|
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
|
-
),
|
|
2349
|
-
|
|
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
|
-
}),
|
|
2353
|
-
this.emit(
|
|
2354
|
-
}),
|
|
2355
|
-
this.emit(
|
|
2356
|
-
}),
|
|
2357
|
-
this.selected = null, this.emit(
|
|
2358
|
-
}),
|
|
2359
|
-
this.selected !==
|
|
2360
|
-
}),
|
|
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(
|
|
1734
|
+
() => this._onUpdate(r)
|
|
2363
1735
|
);
|
|
2364
|
-
}),
|
|
2365
|
-
this.emit(
|
|
2366
|
-
}), this.options = this.setOptions({ ...
|
|
2367
|
-
|
|
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 =
|
|
1742
|
+
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
2371
1743
|
}
|
|
2372
|
-
_moveNodes(
|
|
2373
|
-
|
|
2374
|
-
const h = this.links.getTargetLinks(
|
|
2375
|
-
h.forEach((
|
|
2376
|
-
const f = this.getAnnotation(
|
|
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
|
-
|
|
1750
|
+
g === "start" ? "end" : "start"
|
|
2379
1751
|
);
|
|
2380
|
-
let
|
|
2381
|
-
const
|
|
2382
|
-
(
|
|
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(
|
|
2387
|
-
const
|
|
2388
|
-
if (this.links.remove(
|
|
2389
|
-
this.textToMagnet =
|
|
2390
|
-
const h = this.findMagnetPoint(
|
|
2391
|
-
return h ? (
|
|
2392
|
-
}
|
|
2393
|
-
_findAndSnapToNode(
|
|
2394
|
-
var
|
|
2395
|
-
const
|
|
2396
|
-
this.links.remove(
|
|
2397
|
-
}
|
|
2398
|
-
_snapToNode(
|
|
2399
|
-
const h =
|
|
2400
|
-
if (
|
|
2401
|
-
let
|
|
2402
|
-
if (
|
|
2403
|
-
const
|
|
2404
|
-
|
|
2405
|
-
}
|
|
2406
|
-
|
|
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
|
|
1782
|
+
let t = !1;
|
|
2411
1783
|
this.links.forEach(
|
|
2412
|
-
({ connectionPoint:
|
|
2413
|
-
if (
|
|
2414
|
-
|
|
2415
|
-
const
|
|
2416
|
-
|
|
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
|
-
),
|
|
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(
|
|
2427
|
-
let
|
|
2428
|
-
for (const h of
|
|
2429
|
-
const
|
|
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
|
-
|
|
2433
|
-
|
|
1804
|
+
c.width / 2,
|
|
1805
|
+
c.height / 2
|
|
2434
1806
|
);
|
|
2435
|
-
if (
|
|
2436
|
-
|
|
2437
|
-
point:
|
|
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
|
|
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(
|
|
1822
|
+
setOptions(t = {}) {
|
|
2451
1823
|
return this.options = {
|
|
2452
1824
|
...this.options || {},
|
|
2453
|
-
...
|
|
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(
|
|
2461
|
-
const
|
|
2462
|
-
return
|
|
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 ? (
|
|
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(
|
|
2475
|
-
if (
|
|
2476
|
-
const [
|
|
2477
|
-
(
|
|
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
|
|
1852
|
+
return i.forEach((a) => this.add(a)), r.forEach((a) => this.add(a)), this.arrows.refreshLayer(), this;
|
|
2481
1853
|
}
|
|
2482
|
-
switch (
|
|
1854
|
+
switch (t.properties.type) {
|
|
2483
1855
|
case "text":
|
|
2484
|
-
this.texts.add(
|
|
1856
|
+
this.texts.add(t);
|
|
2485
1857
|
break;
|
|
2486
1858
|
// more to follow
|
|
2487
1859
|
default:
|
|
2488
|
-
this.arrows.add(
|
|
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(
|
|
2498
|
-
return
|
|
2499
|
-
(
|
|
2500
|
-
), this) : (
|
|
2501
|
-
}
|
|
2502
|
-
loadLink(
|
|
2503
|
-
if (
|
|
2504
|
-
for (const
|
|
2505
|
-
const
|
|
2506
|
-
if (!
|
|
2507
|
-
const
|
|
2508
|
-
if (
|
|
2509
|
-
this.links.add(
|
|
2510
|
-
else if (
|
|
2511
|
-
const h = this.ogma.getNode(
|
|
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(
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
),
|
|
2518
|
-
|
|
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(
|
|
2529
|
-
this.cancelDrawing(), this.arrows.startDrawing(
|
|
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(
|
|
2538
|
-
this.cancelDrawing(), this.texts.startDrawing(
|
|
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((
|
|
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(
|
|
2552
|
-
const
|
|
2553
|
-
return
|
|
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(
|
|
2556
|
-
const h = this.getAnnotations().features.find((
|
|
2557
|
-
return h ? (
|
|
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
|
|
1935
|
+
const t = {
|
|
2564
1936
|
type: "FeatureCollection",
|
|
2565
1937
|
features: []
|
|
2566
1938
|
};
|
|
2567
|
-
return this.annotations.forEach((
|
|
2568
|
-
|
|
2569
|
-
}),
|
|
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(
|
|
2577
|
-
return this.getAnnotations().features.find((
|
|
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((
|
|
1955
|
+
this.annotations.forEach((t) => t.destroy()), this.layer.destroy();
|
|
2584
1956
|
}
|
|
2585
1957
|
}
|
|
2586
|
-
const
|
|
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
|
-
],
|
|
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((
|
|
1983
|
+
].sort((l, t) => l.toLocaleLowerCase().localeCompare(t.toLocaleLowerCase())), kn = {
|
|
2612
1984
|
head: "arrow",
|
|
2613
|
-
strokeColor:
|
|
1985
|
+
strokeColor: lr,
|
|
2614
1986
|
strokeWidth: 5
|
|
2615
|
-
},
|
|
1987
|
+
}, En = 0.25, Sn = {
|
|
2616
1988
|
font: "Roboto",
|
|
2617
|
-
fontSize:
|
|
2618
|
-
padding:
|
|
2619
|
-
color:
|
|
2620
|
-
strokeType:
|
|
2621
|
-
background:
|
|
1989
|
+
fontSize: Ve[2],
|
|
1990
|
+
padding: Ve[2] * En,
|
|
1991
|
+
color: lr,
|
|
1992
|
+
strokeType: Ze,
|
|
1993
|
+
background: Ze
|
|
2622
1994
|
};
|
|
2623
|
-
function
|
|
2624
|
-
return
|
|
1995
|
+
function Cn(l) {
|
|
1996
|
+
return l.reduce((t, i) => t + i, 0) / l.length;
|
|
2625
1997
|
}
|
|
2626
|
-
function
|
|
2627
|
-
return
|
|
1998
|
+
function In(l, t = 0, i = 1) {
|
|
1999
|
+
return t + (i - t) * l;
|
|
2628
2000
|
}
|
|
2629
|
-
function
|
|
2630
|
-
return (
|
|
2001
|
+
function Mn(l, t = 0, i = 1) {
|
|
2002
|
+
return (l - t) / (i - t);
|
|
2631
2003
|
}
|
|
2632
|
-
function
|
|
2633
|
-
return
|
|
2004
|
+
function On() {
|
|
2005
|
+
return Ye(null);
|
|
2634
2006
|
}
|
|
2635
|
-
const
|
|
2007
|
+
const hr = Ye(
|
|
2636
2008
|
void 0
|
|
2637
|
-
),
|
|
2638
|
-
switch (
|
|
2009
|
+
), zn = () => Ur(hr), _n = (l, t) => {
|
|
2010
|
+
switch (t.type) {
|
|
2639
2011
|
case "add":
|
|
2640
2012
|
return {
|
|
2641
|
-
...
|
|
2642
|
-
features: [...
|
|
2013
|
+
...l,
|
|
2014
|
+
features: [...l.features, t.payload]
|
|
2643
2015
|
};
|
|
2644
2016
|
case "remove":
|
|
2645
2017
|
return {
|
|
2646
|
-
...
|
|
2647
|
-
features:
|
|
2018
|
+
...l,
|
|
2019
|
+
features: l.features.filter((i) => i.id !== t.payload.id)
|
|
2648
2020
|
};
|
|
2649
2021
|
case "update":
|
|
2650
2022
|
return {
|
|
2651
|
-
...
|
|
2652
|
-
features:
|
|
2653
|
-
(
|
|
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
|
|
2658
|
-
}
|
|
2659
|
-
},
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
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
|
-
}),
|
|
2669
|
-
return
|
|
2046
|
+
}), C = Cn(i.getNodes().getAttribute("radius")) / 5, N = A;
|
|
2047
|
+
return f({
|
|
2670
2048
|
...d,
|
|
2671
|
-
strokeWidth: (d.strokeWidth || 1) *
|
|
2672
|
-
}),
|
|
2673
|
-
|
|
2674
|
-
...
|
|
2675
|
-
}) :
|
|
2676
|
-
...
|
|
2677
|
-
}),
|
|
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
|
-
|
|
2680
|
-
}),
|
|
2681
|
-
|
|
2057
|
+
c(null);
|
|
2058
|
+
}), b(M), t && M.add(t), () => {
|
|
2059
|
+
M.destroy();
|
|
2682
2060
|
};
|
|
2683
|
-
}, [
|
|
2684
|
-
|
|
2685
|
-
}, [
|
|
2686
|
-
|
|
2687
|
-
}, [
|
|
2688
|
-
|
|
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:
|
|
2692
|
-
updateAnnotations:
|
|
2693
|
-
currentAnnotation:
|
|
2694
|
-
setCurrentAnnotation:
|
|
2695
|
-
textStyle:
|
|
2696
|
-
setTextStyle:
|
|
2069
|
+
annotations: r,
|
|
2070
|
+
updateAnnotations: a,
|
|
2071
|
+
currentAnnotation: h,
|
|
2072
|
+
setCurrentAnnotation: c,
|
|
2073
|
+
textStyle: g,
|
|
2074
|
+
setTextStyle: p,
|
|
2697
2075
|
arrowStyle: d,
|
|
2698
|
-
setArrowStyle:
|
|
2699
|
-
arrowWidthFactor:
|
|
2700
|
-
setArrowWidthFactor:
|
|
2701
|
-
textSizeFactor:
|
|
2702
|
-
setTextSizeFactor:
|
|
2703
|
-
editor:
|
|
2704
|
-
setEditor:
|
|
2705
|
-
}
|
|
2706
|
-
|
|
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
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
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
|
};
|