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