svg-path-commander 2.1.6 → 2.1.8
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/README.md +2 -4
- package/dist/svg-path-commander.cjs +1 -1
- package/dist/svg-path-commander.cjs.map +1 -1
- package/dist/svg-path-commander.d.ts +68 -36
- package/dist/svg-path-commander.js +1 -1
- package/dist/svg-path-commander.js.map +1 -1
- package/dist/svg-path-commander.mjs +275 -269
- package/dist/svg-path-commander.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Qe = Object.defineProperty;
|
|
2
2
|
var Ze = (e, t, s) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
3
|
var b = (e, t, s) => Ze(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
var De = Object.defineProperty, Oe = (e, t, s) => t in e ? De(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s,
|
|
4
|
+
var De = Object.defineProperty, Oe = (e, t, s) => t in e ? De(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, S = (e, t, s) => Oe(e, typeof t != "symbol" ? t + "" : t, s);
|
|
5
5
|
const Be = {
|
|
6
6
|
a: 1,
|
|
7
7
|
b: 0,
|
|
@@ -48,11 +48,11 @@ const Be = {
|
|
|
48
48
|
y,
|
|
49
49
|
m,
|
|
50
50
|
g,
|
|
51
|
-
|
|
51
|
+
A,
|
|
52
52
|
M,
|
|
53
|
-
|
|
53
|
+
N
|
|
54
54
|
] = s;
|
|
55
|
-
t.m11 = r, t.a = r, t.m21 = l, t.c = l, t.m31 = f, t.m41 = g, t.e = g, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = h, t.m42 =
|
|
55
|
+
t.m11 = r, t.a = r, t.m21 = l, t.c = l, t.m31 = f, t.m41 = g, t.e = g, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = h, t.m42 = A, t.f = A, t.m13 = i, t.m23 = a, t.m33 = y, t.m43 = M, t.m14 = o, t.m24 = u, t.m34 = m, t.m44 = N;
|
|
56
56
|
} else if (s.length === 6) {
|
|
57
57
|
const [r, n, i, o, l, c] = s;
|
|
58
58
|
t.m11 = r, t.a = r, t.m12 = n, t.b = n, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = l, t.e = l, t.m42 = c, t.f = c;
|
|
@@ -108,7 +108,11 @@ const Be = {
|
|
|
108
108
|
s = s.rotate(0, 0, c);
|
|
109
109
|
else if (i === "scale3d" && h.every((m) => !Number.isNaN(+m)) && h.some((m) => m !== 1))
|
|
110
110
|
s = s.scale(c, a, u);
|
|
111
|
-
else if (
|
|
111
|
+
else if (
|
|
112
|
+
// prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined
|
|
113
|
+
// prop === "scale" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&
|
|
114
|
+
i === "scale" && !Number.isNaN(c) && (c !== 1 || a !== 1) && u === void 0
|
|
115
|
+
) {
|
|
112
116
|
const m = Number.isNaN(+a) ? c : a;
|
|
113
117
|
s = s.scale(c, m, 1);
|
|
114
118
|
} else if (i === "skew" && (c || !Number.isNaN(c) && a) && u === void 0)
|
|
@@ -119,12 +123,12 @@ const Be = {
|
|
|
119
123
|
if (i === "skewX" || i === "skewY")
|
|
120
124
|
s = s[i](c);
|
|
121
125
|
else {
|
|
122
|
-
const m = i.replace(/[XYZ]/, ""), g = i.replace(m, ""),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
const m = i.replace(/[XYZ]/, ""), g = i.replace(m, ""), A = ["X", "Y", "Z"].indexOf(g), M = m === "scale" ? 1 : 0, N = [
|
|
127
|
+
A === 0 ? c : M,
|
|
128
|
+
A === 1 ? c : M,
|
|
129
|
+
A === 2 ? c : M
|
|
126
130
|
];
|
|
127
|
-
s = s[m](...
|
|
131
|
+
s = s[m](...N);
|
|
128
132
|
}
|
|
129
133
|
else
|
|
130
134
|
throw TypeError(r);
|
|
@@ -152,20 +156,20 @@ const Be = {
|
|
|
152
156
|
}, re = (e, t, s) => {
|
|
153
157
|
const r = new C(), n = Math.PI / 180, i = e * n, o = t * n, l = s * n, c = Math.cos(i), a = -Math.sin(i), u = Math.cos(o), f = -Math.sin(o), h = Math.cos(l), y = -Math.sin(l), m = u * h, g = -u * y;
|
|
154
158
|
r.m11 = m, r.a = m, r.m12 = g, r.b = g, r.m13 = f;
|
|
155
|
-
const
|
|
156
|
-
r.m21 =
|
|
159
|
+
const A = a * f * h + c * y;
|
|
160
|
+
r.m21 = A, r.c = A;
|
|
157
161
|
const M = c * h - a * f * y;
|
|
158
162
|
return r.m22 = M, r.d = M, r.m23 = -a * u, r.m31 = a * y - c * f * h, r.m32 = a * h + c * f * y, r.m33 = c * u, r;
|
|
159
163
|
}, ie = (e, t, s, r) => {
|
|
160
164
|
const n = new C(), i = Math.sqrt(e * e + t * t + s * s);
|
|
161
165
|
if (i === 0)
|
|
162
166
|
return n;
|
|
163
|
-
const o = e / i, l = t / i, c = s / i, a = r * (Math.PI / 360), u = Math.sin(a), f = Math.cos(a), h = u * u, y = o * o, m = l * l, g = c * c,
|
|
164
|
-
n.m11 =
|
|
167
|
+
const o = e / i, l = t / i, c = s / i, a = r * (Math.PI / 360), u = Math.sin(a), f = Math.cos(a), h = u * u, y = o * o, m = l * l, g = c * c, A = 1 - 2 * (m + g) * h;
|
|
168
|
+
n.m11 = A, n.a = A;
|
|
165
169
|
const M = 2 * (o * l * h + c * u * f);
|
|
166
170
|
n.m12 = M, n.b = M, n.m13 = 2 * (o * c * h - l * u * f);
|
|
167
|
-
const
|
|
168
|
-
n.m21 =
|
|
171
|
+
const N = 2 * (l * o * h - c * u * f);
|
|
172
|
+
n.m21 = N, n.c = N;
|
|
169
173
|
const x = 1 - 2 * (g + y) * h;
|
|
170
174
|
return n.m22 = x, n.d = x, n.m23 = 2 * (l * c * h + o * u * f), n.m31 = 2 * (c * o * h + l * u * f), n.m32 = 2 * (c * l * h - o * u * f), n.m33 = 1 - 2 * (y + m) * h, n;
|
|
171
175
|
}, oe = (e, t, s) => {
|
|
@@ -182,8 +186,8 @@ const Be = {
|
|
|
182
186
|
s.m12 = n, s.b = n;
|
|
183
187
|
}
|
|
184
188
|
return s;
|
|
185
|
-
}, ce = (e) => At(e, 0), le = (e) => At(0, e),
|
|
186
|
-
const s = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, n = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, l = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, c = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, a = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, u = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, f = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, h = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, y = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, m = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, g = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42,
|
|
189
|
+
}, ce = (e) => At(e, 0), le = (e) => At(0, e), U = (e, t) => {
|
|
190
|
+
const s = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, n = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, l = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, c = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, a = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, u = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, f = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, h = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, y = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, m = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, g = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, A = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, M = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
|
|
187
191
|
return lt([
|
|
188
192
|
s,
|
|
189
193
|
r,
|
|
@@ -199,7 +203,7 @@ const Be = {
|
|
|
199
203
|
y,
|
|
200
204
|
m,
|
|
201
205
|
g,
|
|
202
|
-
|
|
206
|
+
A,
|
|
203
207
|
M
|
|
204
208
|
]);
|
|
205
209
|
};
|
|
@@ -308,7 +312,7 @@ class C {
|
|
|
308
312
|
* @return The resulted matrix.
|
|
309
313
|
*/
|
|
310
314
|
multiply(t) {
|
|
311
|
-
return
|
|
315
|
+
return U(this, t);
|
|
312
316
|
}
|
|
313
317
|
/**
|
|
314
318
|
* The translate method returns a new matrix which is this matrix post
|
|
@@ -324,7 +328,7 @@ class C {
|
|
|
324
328
|
translate(t, s, r) {
|
|
325
329
|
const n = t;
|
|
326
330
|
let i = s, o = r;
|
|
327
|
-
return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0),
|
|
331
|
+
return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), U(this, se(n, i, o));
|
|
328
332
|
}
|
|
329
333
|
/**
|
|
330
334
|
* The scale method returns a new matrix which is this matrix post multiplied by
|
|
@@ -340,7 +344,7 @@ class C {
|
|
|
340
344
|
scale(t, s, r) {
|
|
341
345
|
const n = t;
|
|
342
346
|
let i = s, o = r;
|
|
343
|
-
return typeof i > "u" && (i = t), typeof o > "u" && (o = 1),
|
|
347
|
+
return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), U(this, oe(n, i, o));
|
|
344
348
|
}
|
|
345
349
|
/**
|
|
346
350
|
* The rotate method returns a new matrix which is this matrix post multiplied
|
|
@@ -356,7 +360,7 @@ class C {
|
|
|
356
360
|
*/
|
|
357
361
|
rotate(t, s, r) {
|
|
358
362
|
let n = t, i = s || 0, o = r || 0;
|
|
359
|
-
return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0),
|
|
363
|
+
return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0), U(this, re(n, i, o));
|
|
360
364
|
}
|
|
361
365
|
/**
|
|
362
366
|
* The rotateAxisAngle method returns a new matrix which is this matrix post
|
|
@@ -373,7 +377,7 @@ class C {
|
|
|
373
377
|
rotateAxisAngle(t, s, r, n) {
|
|
374
378
|
if ([t, s, r, n].some((i) => Number.isNaN(+i)))
|
|
375
379
|
throw new TypeError("CSSMatrix: expecting 4 values");
|
|
376
|
-
return
|
|
380
|
+
return U(this, ie(t, s, r, n));
|
|
377
381
|
}
|
|
378
382
|
/**
|
|
379
383
|
* Specifies a skew transformation along the `x-axis` by the given angle.
|
|
@@ -383,7 +387,7 @@ class C {
|
|
|
383
387
|
* @return The resulted matrix
|
|
384
388
|
*/
|
|
385
389
|
skewX(t) {
|
|
386
|
-
return
|
|
390
|
+
return U(this, ce(t));
|
|
387
391
|
}
|
|
388
392
|
/**
|
|
389
393
|
* Specifies a skew transformation along the `y-axis` by the given angle.
|
|
@@ -393,7 +397,7 @@ class C {
|
|
|
393
397
|
* @return The resulted matrix
|
|
394
398
|
*/
|
|
395
399
|
skewY(t) {
|
|
396
|
-
return
|
|
400
|
+
return U(this, le(t));
|
|
397
401
|
}
|
|
398
402
|
/**
|
|
399
403
|
* Specifies a skew transformation along both the `x-axis` and `y-axis`.
|
|
@@ -404,7 +408,7 @@ class C {
|
|
|
404
408
|
* @return The resulted matrix
|
|
405
409
|
*/
|
|
406
410
|
skew(t, s) {
|
|
407
|
-
return
|
|
411
|
+
return U(this, At(t, s));
|
|
408
412
|
}
|
|
409
413
|
/**
|
|
410
414
|
* Transforms a specified vector using the matrix, returning a new
|
|
@@ -427,7 +431,7 @@ class C {
|
|
|
427
431
|
};
|
|
428
432
|
}
|
|
429
433
|
}
|
|
430
|
-
|
|
434
|
+
S(C, "Translate", se), S(C, "Rotate", re), S(C, "RotateAxisAngle", ie), S(C, "Scale", oe), S(C, "SkewX", ce), S(C, "SkewY", le), S(C, "Skew", At), S(C, "Multiply", U), S(C, "fromArray", lt), S(C, "fromMatrix", ee), S(C, "fromString", ne), S(C, "toArray", zt), S(C, "isCompatibleArray", Gt), S(C, "isCompatibleObject", te);
|
|
431
435
|
const V = {
|
|
432
436
|
origin: [0, 0, 0],
|
|
433
437
|
round: 4
|
|
@@ -456,7 +460,7 @@ const V = {
|
|
|
456
460
|
)
|
|
457
461
|
), !!tt[s]); )
|
|
458
462
|
;
|
|
459
|
-
},
|
|
463
|
+
}, Z = "SVGPathCommander Error", ae = (e) => {
|
|
460
464
|
const { index: t, pathValue: s } = e, r = s.charCodeAt(t);
|
|
461
465
|
if (r === 48) {
|
|
462
466
|
e.param = 0, e.index += 1;
|
|
@@ -466,42 +470,42 @@ const V = {
|
|
|
466
470
|
e.param = 1, e.index += 1;
|
|
467
471
|
return;
|
|
468
472
|
}
|
|
469
|
-
e.err = `${
|
|
470
|
-
},
|
|
473
|
+
e.err = `${Z}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`;
|
|
474
|
+
}, J = (e) => e >= 48 && e <= 57, K = "Invalid path value", ue = (e) => {
|
|
471
475
|
const { max: t, pathValue: s, index: r } = e;
|
|
472
476
|
let n = r, i = !1, o = !1, l = !1, c = !1, a;
|
|
473
477
|
if (n >= t) {
|
|
474
|
-
e.err = `${
|
|
478
|
+
e.err = `${Z}: ${K} at index ${n}, "pathValue" is missing param`;
|
|
475
479
|
return;
|
|
476
480
|
}
|
|
477
|
-
if (a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1, a = s.charCodeAt(n)), !
|
|
478
|
-
e.err = `${
|
|
481
|
+
if (a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1, a = s.charCodeAt(n)), !J(a) && a !== 46) {
|
|
482
|
+
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" is not a number`;
|
|
479
483
|
return;
|
|
480
484
|
}
|
|
481
485
|
if (a !== 46) {
|
|
482
|
-
if (i = a === 48, n += 1, a = s.charCodeAt(n), i && n < t && a &&
|
|
483
|
-
e.err = `${
|
|
486
|
+
if (i = a === 48, n += 1, a = s.charCodeAt(n), i && n < t && a && J(a)) {
|
|
487
|
+
e.err = `${Z}: ${K} at index ${r}, "${s[r]}" illegal number`;
|
|
484
488
|
return;
|
|
485
489
|
}
|
|
486
|
-
for (; n < t &&
|
|
490
|
+
for (; n < t && J(s.charCodeAt(n)); )
|
|
487
491
|
n += 1, o = !0;
|
|
488
492
|
a = s.charCodeAt(n);
|
|
489
493
|
}
|
|
490
494
|
if (a === 46) {
|
|
491
|
-
for (c = !0, n += 1;
|
|
495
|
+
for (c = !0, n += 1; J(s.charCodeAt(n)); )
|
|
492
496
|
n += 1, l = !0;
|
|
493
497
|
a = s.charCodeAt(n);
|
|
494
498
|
}
|
|
495
499
|
if (a === 101 || a === 69) {
|
|
496
500
|
if (c && !o && !l) {
|
|
497
|
-
e.err = `${
|
|
501
|
+
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" invalid float exponent`;
|
|
498
502
|
return;
|
|
499
503
|
}
|
|
500
|
-
if (n += 1, a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1), n < t &&
|
|
501
|
-
for (; n < t &&
|
|
504
|
+
if (n += 1, a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1), n < t && J(s.charCodeAt(n)))
|
|
505
|
+
for (; n < t && J(s.charCodeAt(n)); )
|
|
502
506
|
n += 1;
|
|
503
507
|
else {
|
|
504
|
-
e.err = `${
|
|
508
|
+
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" invalid integer exponent`;
|
|
505
509
|
return;
|
|
506
510
|
}
|
|
507
511
|
}
|
|
@@ -556,7 +560,7 @@ const V = {
|
|
|
556
560
|
default:
|
|
557
561
|
return !1;
|
|
558
562
|
}
|
|
559
|
-
}, he = (e) =>
|
|
563
|
+
}, he = (e) => J(e) || e === 43 || e === 45 || e === 46, ye = (e) => (e | 32) === 97, ge = (e) => {
|
|
560
564
|
switch (e | 32) {
|
|
561
565
|
case 109:
|
|
562
566
|
case 77:
|
|
@@ -568,12 +572,12 @@ const V = {
|
|
|
568
572
|
var c;
|
|
569
573
|
const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o = tt[s[r].toLowerCase()];
|
|
570
574
|
if (e.segmentStart = r, !fe(i)) {
|
|
571
|
-
e.err = `${
|
|
575
|
+
e.err = `${Z}: ${K} "${s[r]}" is not a path command at index ${r}`;
|
|
572
576
|
return;
|
|
573
577
|
}
|
|
574
578
|
const l = n[n.length - 1];
|
|
575
579
|
if (!ge(i) && ((c = l == null ? void 0 : l[0]) == null ? void 0 : c.toLocaleLowerCase()) === "z") {
|
|
576
|
-
e.err = `${
|
|
580
|
+
e.err = `${Z}: ${K} "${s[r]}" is not a MoveTo path command at index ${r}`;
|
|
577
581
|
return;
|
|
578
582
|
}
|
|
579
583
|
if (e.index += 1, et(e), e.data = [], !o) {
|
|
@@ -596,13 +600,15 @@ class Ot {
|
|
|
596
600
|
this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
|
|
597
601
|
}
|
|
598
602
|
}
|
|
599
|
-
const
|
|
603
|
+
const D = (e) => {
|
|
600
604
|
if (typeof e != "string")
|
|
601
605
|
return e.slice(0);
|
|
602
606
|
const t = new Ot(e);
|
|
603
607
|
for (et(t); t.index < t.max && !t.err.length; )
|
|
604
608
|
Dt(t);
|
|
605
|
-
if (t
|
|
609
|
+
if (!t.err.length)
|
|
610
|
+
t.segments.length && (t.segments[0][0] = "M");
|
|
611
|
+
else
|
|
606
612
|
throw TypeError(t.err);
|
|
607
613
|
return t.segments;
|
|
608
614
|
}, at = (e, t, s, r) => {
|
|
@@ -635,7 +641,7 @@ const Q = (e) => {
|
|
|
635
641
|
l.push(e[a] + (a % 2 ? s : r));
|
|
636
642
|
return [i].concat(l);
|
|
637
643
|
}
|
|
638
|
-
},
|
|
644
|
+
}, O = (e, t) => {
|
|
639
645
|
let s = e.length, r, n = "M", i = "M", o = !1, l = 0, c = 0, a = 0, u = 0, f = 0;
|
|
640
646
|
for (let h = 0; h < s; h += 1) {
|
|
641
647
|
r = e[h], [n] = r, f = r.length, i = n.toUpperCase(), o = i !== n;
|
|
@@ -646,8 +652,8 @@ const Q = (e) => {
|
|
|
646
652
|
}
|
|
647
653
|
return e;
|
|
648
654
|
}, ht = (e) => {
|
|
649
|
-
const t =
|
|
650
|
-
return
|
|
655
|
+
const t = D(e);
|
|
656
|
+
return O(t, at);
|
|
651
657
|
}, Bt = (e, t, s, r) => {
|
|
652
658
|
const [n] = e, i = n.toLowerCase();
|
|
653
659
|
if (t === 0 || n === i) return e;
|
|
@@ -679,48 +685,48 @@ const Q = (e) => {
|
|
|
679
685
|
return [i].concat(l);
|
|
680
686
|
}
|
|
681
687
|
}, Kt = (e) => {
|
|
682
|
-
const t =
|
|
683
|
-
return
|
|
688
|
+
const t = D(e);
|
|
689
|
+
return O(t, Bt);
|
|
684
690
|
}, st = (e, t, s) => {
|
|
685
691
|
const { sin: r, cos: n } = Math, i = e * n(s) - t * r(s), o = e * r(s) + t * n(s);
|
|
686
692
|
return { x: i, y: o };
|
|
687
693
|
}, Mt = (e, t, s, r, n, i, o, l, c, a) => {
|
|
688
694
|
let u = e, f = t, h = s, y = r, m = l, g = c;
|
|
689
|
-
const
|
|
690
|
-
let
|
|
695
|
+
const A = Math.PI * 120 / 180, M = Math.PI / 180 * (+n || 0);
|
|
696
|
+
let N = [], x, p, w, T, k;
|
|
691
697
|
if (a)
|
|
692
|
-
[p,
|
|
698
|
+
[p, w, T, k] = a;
|
|
693
699
|
else {
|
|
694
700
|
x = st(u, f, -M), u = x.x, f = x.y, x = st(m, g, -M), m = x.x, g = x.y;
|
|
695
|
-
const
|
|
696
|
-
let
|
|
697
|
-
|
|
698
|
-
const
|
|
701
|
+
const $ = (u - m) / 2, j = (f - g) / 2;
|
|
702
|
+
let q = $ * $ / (h * h) + j * j / (y * y);
|
|
703
|
+
q > 1 && (q = Math.sqrt(q), h *= q, y *= q);
|
|
704
|
+
const vt = h * h, $t = y * y, Jt = (i === o ? -1 : 1) * Math.sqrt(
|
|
699
705
|
Math.abs(
|
|
700
|
-
(
|
|
706
|
+
(vt * $t - vt * j * j - $t * $ * $) / (vt * j * j + $t * $ * $)
|
|
701
707
|
)
|
|
702
708
|
);
|
|
703
|
-
T = Jt * h *
|
|
704
|
-
}
|
|
705
|
-
let
|
|
706
|
-
if (Math.abs(
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
T = Jt * h * j / y + (u + m) / 2, k = Jt * -y * $ / h + (f + g) / 2, p = Math.asin(((f - k) / y * 10 ** 9 >> 0) / 10 ** 9), w = Math.asin(((g - k) / y * 10 ** 9 >> 0) / 10 ** 9), p = u < T ? Math.PI - p : p, w = m < T ? Math.PI - w : w, p < 0 && (p = Math.PI * 2 + p), w < 0 && (w = Math.PI * 2 + w), o && p > w && (p -= Math.PI * 2), !o && w > p && (w -= Math.PI * 2);
|
|
710
|
+
}
|
|
711
|
+
let I = w - p;
|
|
712
|
+
if (Math.abs(I) > A) {
|
|
713
|
+
const $ = w, j = m, q = g;
|
|
714
|
+
w = p + A * (o && w > p ? 1 : -1), m = T + h * Math.cos(w), g = k + y * Math.sin(w), N = Mt(m, g, h, y, n, 0, o, j, q, [
|
|
715
|
+
w,
|
|
716
|
+
$,
|
|
711
717
|
T,
|
|
712
|
-
|
|
718
|
+
k
|
|
713
719
|
]);
|
|
714
720
|
}
|
|
715
|
-
|
|
716
|
-
const
|
|
717
|
-
if (
|
|
718
|
-
return [
|
|
719
|
-
|
|
720
|
-
const
|
|
721
|
-
for (let
|
|
722
|
-
|
|
723
|
-
return
|
|
721
|
+
I = w - p;
|
|
722
|
+
const z = Math.cos(p), v = Math.sin(p), B = Math.cos(w), W = Math.sin(w), E = Math.tan(I / 4), L = 4 / 3 * h * E, R = 4 / 3 * y * E, H = [u, f], Q = [u + L * v, f - R * z], _ = [m + L * W, g - R * B], G = [m, g];
|
|
723
|
+
if (Q[0] = 2 * H[0] - Q[0], Q[1] = 2 * H[1] - Q[1], a)
|
|
724
|
+
return [Q[0], Q[1], _[0], _[1], G[0], G[1]].concat(N);
|
|
725
|
+
N = [Q[0], Q[1], _[0], _[1], G[0], G[1]].concat(N);
|
|
726
|
+
const X = [];
|
|
727
|
+
for (let $ = 0, j = N.length; $ < j; $ += 1)
|
|
728
|
+
X[$] = $ % 2 ? st(N[$ - 1], N[$], M).y : st(N[$], N[$ + 1], M).x;
|
|
729
|
+
return X;
|
|
724
730
|
}, xe = (e, t, s, r, n, i) => {
|
|
725
731
|
const o = 0.3333333333333333, l = 2 / 3;
|
|
726
732
|
return [
|
|
@@ -736,11 +742,11 @@ const Q = (e) => {
|
|
|
736
742
|
i
|
|
737
743
|
// x,y
|
|
738
744
|
];
|
|
739
|
-
},
|
|
745
|
+
}, F = (e, t, s) => {
|
|
740
746
|
const [r, n] = e, [i, o] = t;
|
|
741
747
|
return [r + (i - r) * s, n + (o - n) * s];
|
|
742
748
|
}, Pt = (e, t, s, r) => {
|
|
743
|
-
const n =
|
|
749
|
+
const n = F([e, t], [s, r], 0.3333333333333333), i = F([e, t], [s, r], 2 / 3);
|
|
744
750
|
return [n[0], n[1], i[0], i[1], s, r];
|
|
745
751
|
}, pe = (e, t) => {
|
|
746
752
|
const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1: l, x: c, y: a } = t;
|
|
@@ -825,8 +831,8 @@ const Q = (e) => {
|
|
|
825
831
|
qx: null,
|
|
826
832
|
qy: null
|
|
827
833
|
}, yt = (e) => {
|
|
828
|
-
const t = { ...ut }, s =
|
|
829
|
-
return
|
|
834
|
+
const t = { ...ut }, s = D(e);
|
|
835
|
+
return O(s, (r, n, i, o) => {
|
|
830
836
|
t.x = i, t.y = o;
|
|
831
837
|
const l = Nt(r, t);
|
|
832
838
|
let c = pe(l, t);
|
|
@@ -838,7 +844,7 @@ const Q = (e) => {
|
|
|
838
844
|
const u = c.length;
|
|
839
845
|
return t.x1 = +c[u - 2], t.y1 = +c[u - 1], t.x2 = +c[u - 4] || t.x1, t.y2 = +c[u - 3] || t.y1, c;
|
|
840
846
|
});
|
|
841
|
-
},
|
|
847
|
+
}, P = (e, t) => {
|
|
842
848
|
const s = t >= 1 ? 10 ** t : 1;
|
|
843
849
|
return t > 0 ? Math.round(e * s) / s : Math.round(e);
|
|
844
850
|
}, kt = (e, t) => {
|
|
@@ -857,7 +863,7 @@ const Q = (e) => {
|
|
|
857
863
|
let a = 0;
|
|
858
864
|
const u = c.length;
|
|
859
865
|
for (; a < u; )
|
|
860
|
-
i +=
|
|
866
|
+
i += P(c[a], r), a !== u - 1 && (i += " "), a += 1;
|
|
861
867
|
}
|
|
862
868
|
}
|
|
863
869
|
return i;
|
|
@@ -872,7 +878,7 @@ const Q = (e) => {
|
|
|
872
878
|
else if (n >= o)
|
|
873
879
|
i = { x: s, y: r };
|
|
874
880
|
else {
|
|
875
|
-
const [l, c] =
|
|
881
|
+
const [l, c] = F([e, t], [s, r], n / o);
|
|
876
882
|
i = { x: l, y: c };
|
|
877
883
|
}
|
|
878
884
|
}
|
|
@@ -909,34 +915,34 @@ const Q = (e) => {
|
|
|
909
915
|
endAngle: 0,
|
|
910
916
|
center: { x: (l + e) / 2, y: (c + t) / 2 }
|
|
911
917
|
};
|
|
912
|
-
const
|
|
913
|
-
x: f(M) *
|
|
914
|
-
y: -u(M) *
|
|
915
|
-
},
|
|
916
|
-
|
|
917
|
-
const T = m ** 2 * g ** 2 - m ** 2 * p.y ** 2 - g ** 2 * p.x ** 2,
|
|
918
|
-
let
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
x:
|
|
922
|
-
y:
|
|
923
|
-
},
|
|
924
|
-
x: f(M) *
|
|
925
|
-
y: u(M) *
|
|
926
|
-
},
|
|
927
|
-
x: (p.x -
|
|
928
|
-
y: (p.y -
|
|
929
|
-
},
|
|
930
|
-
x: (-p.x -
|
|
931
|
-
y: (-p.y -
|
|
918
|
+
const N = (e - l) / 2, x = (t - c) / 2, p = {
|
|
919
|
+
x: f(M) * N + u(M) * x,
|
|
920
|
+
y: -u(M) * N + f(M) * x
|
|
921
|
+
}, w = p.x ** 2 / m ** 2 + p.y ** 2 / g ** 2;
|
|
922
|
+
w > 1 && (m *= h(w), g *= h(w));
|
|
923
|
+
const T = m ** 2 * g ** 2 - m ** 2 * p.y ** 2 - g ** 2 * p.x ** 2, k = m ** 2 * p.y ** 2 + g ** 2 * p.x ** 2;
|
|
924
|
+
let I = T / k;
|
|
925
|
+
I = I < 0 ? 0 : I;
|
|
926
|
+
const z = (i !== o ? 1 : -1) * h(I), v = {
|
|
927
|
+
x: z * (m * p.y / g),
|
|
928
|
+
y: z * (-(g * p.x) / m)
|
|
929
|
+
}, B = {
|
|
930
|
+
x: f(M) * v.x - u(M) * v.y + (e + l) / 2,
|
|
931
|
+
y: u(M) * v.x + f(M) * v.y + (t + c) / 2
|
|
932
|
+
}, W = {
|
|
933
|
+
x: (p.x - v.x) / m,
|
|
934
|
+
y: (p.y - v.y) / g
|
|
935
|
+
}, E = Et({ x: 1, y: 0 }, W), L = {
|
|
936
|
+
x: (-p.x - v.x) / m,
|
|
937
|
+
y: (-p.y - v.y) / g
|
|
932
938
|
};
|
|
933
|
-
let
|
|
934
|
-
!o &&
|
|
935
|
-
const
|
|
939
|
+
let R = Et(W, L);
|
|
940
|
+
!o && R > 0 ? R -= 2 * y : o && R < 0 && (R += 2 * y), R %= 2 * y;
|
|
941
|
+
const H = E + R;
|
|
936
942
|
return {
|
|
937
|
-
center:
|
|
938
|
-
startAngle:
|
|
939
|
-
endAngle:
|
|
943
|
+
center: B,
|
|
944
|
+
startAngle: E,
|
|
945
|
+
endAngle: H,
|
|
940
946
|
rx: m,
|
|
941
947
|
ry: g
|
|
942
948
|
};
|
|
@@ -967,20 +973,20 @@ const Q = (e) => {
|
|
|
967
973
|
c
|
|
968
974
|
);
|
|
969
975
|
if (typeof a == "number") {
|
|
970
|
-
const
|
|
976
|
+
const A = Ft(h, y, g - m);
|
|
971
977
|
if (a <= 0)
|
|
972
978
|
u = { x: e, y: t };
|
|
973
|
-
else if (a >=
|
|
979
|
+
else if (a >= A)
|
|
974
980
|
u = { x: l, y: c };
|
|
975
981
|
else {
|
|
976
982
|
if (e === l && t === c)
|
|
977
983
|
return { x: l, y: c };
|
|
978
984
|
if (h === 0 || y === 0)
|
|
979
985
|
return Ht(e, t, l, c, a);
|
|
980
|
-
const { PI: M, cos:
|
|
986
|
+
const { PI: M, cos: N, sin: x } = Math, p = g - m, T = (n % 360 + 360) % 360 * (M / 180), k = m + p * (a / A), I = h * N(k), z = y * x(k);
|
|
981
987
|
u = {
|
|
982
|
-
x:
|
|
983
|
-
y: x(T) *
|
|
988
|
+
x: N(T) * I - x(T) * z + f.x,
|
|
989
|
+
y: x(T) * I + N(T) * z + f.y
|
|
984
990
|
};
|
|
985
991
|
}
|
|
986
992
|
}
|
|
@@ -996,26 +1002,26 @@ const Q = (e) => {
|
|
|
996
1002
|
o,
|
|
997
1003
|
l,
|
|
998
1004
|
c
|
|
999
|
-
), m = y - h, { min: g, max:
|
|
1000
|
-
let
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
if (
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
}
|
|
1010
|
-
if (
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
}
|
|
1014
|
-
if (
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
}
|
|
1018
|
-
return [
|
|
1005
|
+
), m = y - h, { min: g, max: A, tan: M, atan2: N, PI: x } = Math, { x: p, y: w } = a, T = n * x / 180, k = M(T), I = N(-f * k, u), z = I, v = I + x, B = N(f, u * k), W = B + x, E = [l], L = [c];
|
|
1006
|
+
let R = g(e, l), H = A(e, l), Q = g(t, c), _ = A(t, c);
|
|
1007
|
+
const G = y - m * 1e-5, X = Y(p, w, u, f, T, G), $ = y - m * 0.99999, j = Y(p, w, u, f, T, $);
|
|
1008
|
+
if (X[0] > H || j[0] > H) {
|
|
1009
|
+
const q = Y(p, w, u, f, T, z);
|
|
1010
|
+
E.push(q[0]), L.push(q[1]);
|
|
1011
|
+
}
|
|
1012
|
+
if (X[0] < R || j[0] < R) {
|
|
1013
|
+
const q = Y(p, w, u, f, T, v);
|
|
1014
|
+
E.push(q[0]), L.push(q[1]);
|
|
1015
|
+
}
|
|
1016
|
+
if (X[1] < Q || j[1] < Q) {
|
|
1017
|
+
const q = Y(p, w, u, f, T, W);
|
|
1018
|
+
E.push(q[0]), L.push(q[1]);
|
|
1019
|
+
}
|
|
1020
|
+
if (X[1] > _ || j[1] > _) {
|
|
1021
|
+
const q = Y(p, w, u, f, T, B);
|
|
1022
|
+
E.push(q[0]), L.push(q[1]);
|
|
1023
|
+
}
|
|
1024
|
+
return R = g.apply([], E), Q = g.apply([], L), H = A.apply([], E), _ = A.apply([], L), [R, Q, H, _];
|
|
1019
1025
|
}, He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1020
1026
|
__proto__: null,
|
|
1021
1027
|
angleBetween: Et,
|
|
@@ -1129,7 +1135,7 @@ const Q = (e) => {
|
|
|
1129
1135
|
});
|
|
1130
1136
|
const s = Me(t);
|
|
1131
1137
|
return Le((r) => Ne(s[0], r));
|
|
1132
|
-
},
|
|
1138
|
+
}, Te = 1e-8, gt = ([e, t, s]) => {
|
|
1133
1139
|
const r = Math.min(e, s), n = Math.max(e, s);
|
|
1134
1140
|
if (t >= e ? s >= t : s <= t)
|
|
1135
1141
|
return [r, n];
|
|
@@ -1137,7 +1143,7 @@ const Q = (e) => {
|
|
|
1137
1143
|
return i < r ? [i, n] : [r, i];
|
|
1138
1144
|
}, jt = ([e, t, s, r]) => {
|
|
1139
1145
|
const n = e - 3 * t + 3 * s - r;
|
|
1140
|
-
if (Math.abs(n) <
|
|
1146
|
+
if (Math.abs(n) < Te)
|
|
1141
1147
|
return e === r && e === t ? [e, r] : gt([e, -0.5 * e + 1.5 * t, e - 3 * t + 3 * s]);
|
|
1142
1148
|
const i = -e * s + e * r - t * s - t * r + t * t + s * s;
|
|
1143
1149
|
if (i <= 0)
|
|
@@ -1151,18 +1157,18 @@ const Q = (e) => {
|
|
|
1151
1157
|
h < l && (l = h), h > c && (c = h);
|
|
1152
1158
|
}
|
|
1153
1159
|
return [l, c];
|
|
1154
|
-
},
|
|
1160
|
+
}, Ce = ([e, t, s, r, n, i, o, l], c) => {
|
|
1155
1161
|
const a = 1 - c;
|
|
1156
1162
|
return {
|
|
1157
1163
|
x: a ** 3 * e + 3 * a ** 2 * c * s + 3 * a * c ** 2 * n + c ** 3 * o,
|
|
1158
1164
|
y: a ** 3 * t + 3 * a ** 2 * c * r + 3 * a * c ** 2 * i + c ** 3 * l
|
|
1159
1165
|
};
|
|
1160
|
-
}, xt = (e, t, s, r, n, i, o, l) => mt([e, t, s, r, n, i, o, l]),
|
|
1166
|
+
}, xt = (e, t, s, r, n, i, o, l) => mt([e, t, s, r, n, i, o, l]), ve = (e, t, s, r, n, i, o, l, c) => {
|
|
1161
1167
|
const a = typeof c == "number";
|
|
1162
1168
|
let u = { x: e, y: t };
|
|
1163
1169
|
if (a) {
|
|
1164
1170
|
const f = mt([e, t, s, r, n, i, o, l]);
|
|
1165
|
-
c <= 0 || (c >= f ? u = { x: o, y: l } : u =
|
|
1171
|
+
c <= 0 || (c >= f ? u = { x: o, y: l } : u = Ce(
|
|
1166
1172
|
[e, t, s, r, n, i, o, l],
|
|
1167
1173
|
c / f
|
|
1168
1174
|
));
|
|
@@ -1198,8 +1204,8 @@ const Q = (e) => {
|
|
|
1198
1204
|
r = n, n = e[s], i += r[1] * n[0] - r[0] * n[1];
|
|
1199
1205
|
return i / 2;
|
|
1200
1206
|
}, _e = (e) => e.reduce((t, s, r) => r ? t + wt(e[r - 1], s) : 0, 0), bt = 1e-5, ot = (e) => {
|
|
1201
|
-
const t =
|
|
1202
|
-
return
|
|
1207
|
+
const t = D(e), s = { ...ut };
|
|
1208
|
+
return O(t, (r, n, i, o) => {
|
|
1203
1209
|
s.x = i, s.y = o;
|
|
1204
1210
|
const l = Nt(r, s), c = l.length;
|
|
1205
1211
|
return s.x1 = +l[c - 2], s.y1 = +l[c - 1], s.x2 = +l[c - 4] || s.x1, s.y2 = +l[c - 3] || s.y1, l;
|
|
@@ -1209,8 +1215,8 @@ const Q = (e) => {
|
|
|
1209
1215
|
let r = !1, n = [], i = "M", o = 0, l = 0, [c, a] = s[0].slice(1);
|
|
1210
1216
|
const u = typeof t == "number";
|
|
1211
1217
|
let f = { x: c, y: a }, h = 0, y = f, m = 0;
|
|
1212
|
-
return !u || t < bt ? f : (
|
|
1213
|
-
if ([i] = g, r = i === "M", n = r ? n : [M,
|
|
1218
|
+
return !u || t < bt ? f : (O(s, (g, A, M, N) => {
|
|
1219
|
+
if ([i] = g, r = i === "M", n = r ? n : [M, N].concat(g.slice(1)), r ? ([, c, a] = g, f = { x: c, y: a }, h = 0) : i === "L" ? (f = Ht(
|
|
1214
1220
|
n[0],
|
|
1215
1221
|
n[1],
|
|
1216
1222
|
n[2],
|
|
@@ -1237,7 +1243,7 @@ const Q = (e) => {
|
|
|
1237
1243
|
n[6],
|
|
1238
1244
|
n[7],
|
|
1239
1245
|
n[8]
|
|
1240
|
-
)) : i === "C" ? (f =
|
|
1246
|
+
)) : i === "C" ? (f = ve(
|
|
1241
1247
|
n[0],
|
|
1242
1248
|
n[1],
|
|
1243
1249
|
n[2],
|
|
@@ -1271,19 +1277,19 @@ const Q = (e) => {
|
|
|
1271
1277
|
n[3],
|
|
1272
1278
|
n[4],
|
|
1273
1279
|
n[5]
|
|
1274
|
-
)) : i === "Z" && (n = [M,
|
|
1280
|
+
)) : i === "Z" && (n = [M, N, c, a], f = { x: c, y: a }, h = it(n[0], n[1], n[2], n[3])), [o, l] = n.slice(-2), m < t)
|
|
1275
1281
|
y = f;
|
|
1276
1282
|
else
|
|
1277
1283
|
return !1;
|
|
1278
1284
|
m += h;
|
|
1279
1285
|
}), t > m - bt ? { x: o, y: l } : y);
|
|
1280
1286
|
}, nt = (e) => {
|
|
1281
|
-
const t =
|
|
1287
|
+
const t = D(e);
|
|
1282
1288
|
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M", a = 0, u = 0, f = 0;
|
|
1283
|
-
return
|
|
1289
|
+
return O(t, (h, y, m, g) => {
|
|
1284
1290
|
[c] = h;
|
|
1285
|
-
const
|
|
1286
|
-
if ([c] = x, "TQ".includes(
|
|
1291
|
+
const A = c.toUpperCase(), N = A !== c ? at(h, y, m, g) : h.slice(0), x = A === "V" ? ["L", m, N[1]] : A === "H" ? ["L", N[1], g] : N;
|
|
1292
|
+
if ([c] = x, "TQ".includes(A) || (o = 0, l = 0), c === "M")
|
|
1287
1293
|
[, a, u] = x;
|
|
1288
1294
|
else if (c === "L")
|
|
1289
1295
|
f += it(
|
|
@@ -1305,12 +1311,12 @@ const Q = (e) => {
|
|
|
1305
1311
|
x[7]
|
|
1306
1312
|
);
|
|
1307
1313
|
else if (c === "S") {
|
|
1308
|
-
const p = s * 2 - n,
|
|
1314
|
+
const p = s * 2 - n, w = r * 2 - i;
|
|
1309
1315
|
f += xt(
|
|
1310
1316
|
m,
|
|
1311
1317
|
g,
|
|
1312
1318
|
p,
|
|
1313
|
-
|
|
1319
|
+
w,
|
|
1314
1320
|
x[1],
|
|
1315
1321
|
x[2],
|
|
1316
1322
|
x[3],
|
|
@@ -1343,7 +1349,7 @@ const Q = (e) => {
|
|
|
1343
1349
|
[s, r] = c === "Z" ? [a, u] : x.slice(-2), [n, i] = c === "C" ? [x[3], x[4]] : c === "S" ? [x[1], x[2]] : [s, r];
|
|
1344
1350
|
}), f;
|
|
1345
1351
|
}, Ut = (e, t) => {
|
|
1346
|
-
const s =
|
|
1352
|
+
const s = D(e);
|
|
1347
1353
|
let r = s.slice(0), n = nt(r), i = r.length - 1, o = 0, l = 0, c = s[0];
|
|
1348
1354
|
if (i <= 0 || !t || !Number.isFinite(t))
|
|
1349
1355
|
return {
|
|
@@ -1370,21 +1376,21 @@ const Q = (e) => {
|
|
|
1370
1376
|
return a.find(
|
|
1371
1377
|
({ lengthAtSegment: u }) => u <= t
|
|
1372
1378
|
);
|
|
1373
|
-
},
|
|
1374
|
-
const s =
|
|
1375
|
-
const
|
|
1376
|
-
return
|
|
1379
|
+
}, Tt = (e, t) => {
|
|
1380
|
+
const s = D(e), r = ot(s), n = nt(r), i = (p) => {
|
|
1381
|
+
const w = p.x - t.x, T = p.y - t.y;
|
|
1382
|
+
return w * w + T * T;
|
|
1377
1383
|
};
|
|
1378
1384
|
let o = 8, l, c = { x: 0, y: 0 }, a = 0, u = 0, f = 1 / 0;
|
|
1379
1385
|
for (let p = 0; p <= n; p += o)
|
|
1380
1386
|
l = rt(r, p), a = i(l), a < f && (c = l, u = p, f = a);
|
|
1381
1387
|
o /= 2;
|
|
1382
|
-
let h, y, m = 0, g = 0,
|
|
1383
|
-
for (; o > 1e-6 && (m = u - o, h = rt(r, m),
|
|
1388
|
+
let h, y, m = 0, g = 0, A = 0, M = 0;
|
|
1389
|
+
for (; o > 1e-6 && (m = u - o, h = rt(r, m), A = i(h), g = u + o, y = rt(r, g), M = i(y), m >= 0 && A < f ? (c = h, u = m, f = A) : g <= n && M < f ? (c = y, u = g, f = M) : o /= 2, !(o < 1e-5)); )
|
|
1384
1390
|
;
|
|
1385
|
-
const
|
|
1386
|
-
return { closest: c, distance: x, segment:
|
|
1387
|
-
}, Ue = (e, t) =>
|
|
1391
|
+
const N = Ut(s, u), x = Math.sqrt(f);
|
|
1392
|
+
return { closest: c, distance: x, segment: N };
|
|
1393
|
+
}, Ue = (e, t) => Tt(e, t).closest, Je = (e, t, s, r, n, i, o, l) => 3 * ((l - t) * (s + n) - (o - e) * (r + i) + r * (e - n) - s * (t - i) + l * (n + e / 3) - o * (i + t / 3)) / 20, qe = (e) => {
|
|
1388
1394
|
let t = 0, s = 0, r = 0;
|
|
1389
1395
|
return yt(e).map((n) => {
|
|
1390
1396
|
switch (n[0]) {
|
|
@@ -1416,93 +1422,93 @@ const Q = (e) => {
|
|
|
1416
1422
|
cy: 0,
|
|
1417
1423
|
cz: 0
|
|
1418
1424
|
};
|
|
1419
|
-
const t =
|
|
1425
|
+
const t = D(e);
|
|
1420
1426
|
let s = "M", r = 0, n = 0;
|
|
1421
1427
|
const { max: i, min: o } = Math;
|
|
1422
|
-
let l = 1 / 0, c = 1 / 0, a = -1 / 0, u = -1 / 0, f = 0, h = 0, y = 0, m = 0, g = 0,
|
|
1423
|
-
|
|
1424
|
-
[s] =
|
|
1425
|
-
const
|
|
1426
|
-
if ([s] =
|
|
1427
|
-
[, r, n] =
|
|
1428
|
+
let l = 1 / 0, c = 1 / 0, a = -1 / 0, u = -1 / 0, f = 0, h = 0, y = 0, m = 0, g = 0, A = 0, M = 0, N = 0, x = 0, p = 0;
|
|
1429
|
+
O(t, (k, I, z, v) => {
|
|
1430
|
+
[s] = k;
|
|
1431
|
+
const B = s.toUpperCase(), E = B !== s ? at(k, I, z, v) : k.slice(0), L = B === "V" ? ["L", z, E[1]] : B === "H" ? ["L", E[1], v] : E;
|
|
1432
|
+
if ([s] = L, "TQ".includes(B) || (x = 0, p = 0), s === "M")
|
|
1433
|
+
[, r, n] = L, f = r, h = n, y = r, m = n;
|
|
1428
1434
|
else if (s === "L")
|
|
1429
1435
|
[f, h, y, m] = It(
|
|
1430
|
-
P,
|
|
1431
1436
|
z,
|
|
1432
|
-
|
|
1433
|
-
|
|
1437
|
+
v,
|
|
1438
|
+
L[1],
|
|
1439
|
+
L[2]
|
|
1434
1440
|
);
|
|
1435
1441
|
else if (s === "A")
|
|
1436
1442
|
[f, h, y, m] = de(
|
|
1437
|
-
P,
|
|
1438
1443
|
z,
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1444
|
+
v,
|
|
1445
|
+
L[1],
|
|
1446
|
+
L[2],
|
|
1447
|
+
L[3],
|
|
1448
|
+
L[4],
|
|
1449
|
+
L[5],
|
|
1450
|
+
L[6],
|
|
1451
|
+
L[7]
|
|
1446
1452
|
);
|
|
1447
1453
|
else if (s === "S") {
|
|
1448
|
-
const
|
|
1454
|
+
const R = g * 2 - M, H = A * 2 - N;
|
|
1449
1455
|
[f, h, y, m] = St(
|
|
1450
|
-
P,
|
|
1451
1456
|
z,
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1457
|
+
v,
|
|
1458
|
+
R,
|
|
1459
|
+
H,
|
|
1460
|
+
L[1],
|
|
1461
|
+
L[2],
|
|
1462
|
+
L[3],
|
|
1463
|
+
L[4]
|
|
1458
1464
|
);
|
|
1459
1465
|
} else s === "C" ? [f, h, y, m] = St(
|
|
1460
|
-
P,
|
|
1461
1466
|
z,
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1467
|
+
v,
|
|
1468
|
+
L[1],
|
|
1469
|
+
L[2],
|
|
1470
|
+
L[3],
|
|
1471
|
+
L[4],
|
|
1472
|
+
L[5],
|
|
1473
|
+
L[6]
|
|
1474
|
+
) : s === "T" ? (x = g * 2 - x, p = A * 2 - p, [f, h, y, m] = Qt(
|
|
1470
1475
|
z,
|
|
1476
|
+
v,
|
|
1471
1477
|
x,
|
|
1472
1478
|
p,
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
)) : s === "Q" ? (x =
|
|
1476
|
-
P,
|
|
1479
|
+
L[1],
|
|
1480
|
+
L[2]
|
|
1481
|
+
)) : s === "Q" ? (x = L[1], p = L[2], [f, h, y, m] = Qt(
|
|
1477
1482
|
z,
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1483
|
+
v,
|
|
1484
|
+
L[1],
|
|
1485
|
+
L[2],
|
|
1486
|
+
L[3],
|
|
1487
|
+
L[4]
|
|
1488
|
+
)) : s === "Z" && ([f, h, y, m] = It(z, v, r, n));
|
|
1489
|
+
l = o(f, l), c = o(h, c), a = i(y, a), u = i(m, u), [g, A] = s === "Z" ? [r, n] : L.slice(-2), [M, N] = s === "C" ? [L[3], L[4]] : s === "S" ? [L[1], L[2]] : [g, A];
|
|
1484
1490
|
});
|
|
1485
|
-
const
|
|
1491
|
+
const w = a - l, T = u - c;
|
|
1486
1492
|
return {
|
|
1487
|
-
width:
|
|
1493
|
+
width: w,
|
|
1488
1494
|
height: T,
|
|
1489
1495
|
x: l,
|
|
1490
1496
|
y: c,
|
|
1491
1497
|
x2: a,
|
|
1492
1498
|
y2: u,
|
|
1493
|
-
cx: l +
|
|
1499
|
+
cx: l + w / 2,
|
|
1494
1500
|
cy: c + T / 2,
|
|
1495
1501
|
// an estimated guess
|
|
1496
|
-
cz: Math.max(
|
|
1502
|
+
cz: Math.max(w, T) + Math.min(w, T) / 2
|
|
1497
1503
|
};
|
|
1498
|
-
}, We = (e, t) => Ut(e, t).segment, Xe = (e, t) =>
|
|
1504
|
+
}, We = (e, t) => Ut(e, t).segment, Xe = (e, t) => Tt(e, t).segment, Ct = (e) => Array.isArray(e) && e.every((t) => {
|
|
1499
1505
|
const s = t[0].toLowerCase();
|
|
1500
1506
|
return tt[s] === t.length - 1 && "achlmqstvz".includes(s) && t.slice(1).every(Number.isFinite);
|
|
1501
|
-
}) && e.length > 0, Pe = (e) =>
|
|
1507
|
+
}) && e.length > 0, Pe = (e) => Ct(e) && // `isPathArray` also checks if it's `Array`
|
|
1502
1508
|
e.every(([t]) => t === t.toUpperCase()), ke = (e) => Pe(e) && e.every(([t]) => "ACLMQZ".includes(t)), Ye = (e) => ke(e) && e.every(([t]) => "MC".includes(t)), Ve = (e, t) => {
|
|
1503
|
-
const { distance: s } =
|
|
1509
|
+
const { distance: s } = Tt(e, t);
|
|
1504
1510
|
return Math.abs(s) < bt;
|
|
1505
|
-
}, Ge = (e) =>
|
|
1511
|
+
}, Ge = (e) => Ct(e) && // `isPathArray` checks if it's `Array`
|
|
1506
1512
|
e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
1507
1513
|
if (typeof e != "string" || !e.length)
|
|
1508
1514
|
return !1;
|
|
@@ -1561,22 +1567,22 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1561
1567
|
}, Re = (e) => {
|
|
1562
1568
|
const t = Object.keys(ct), s = Ee(e), r = s ? e.tagName : null;
|
|
1563
1569
|
if (r && [...t, "path"].every((c) => r !== c))
|
|
1564
|
-
throw TypeError(`${
|
|
1570
|
+
throw TypeError(`${Z}: "${r}" is not SVGElement`);
|
|
1565
1571
|
const n = s ? r : e.type, i = ct[n], o = { type: n };
|
|
1566
1572
|
s ? i.forEach((c) => {
|
|
1567
1573
|
o[c] = e.getAttribute(c);
|
|
1568
1574
|
}) : Object.assign(o, e);
|
|
1569
1575
|
let l = [];
|
|
1570
|
-
return n === "circle" ? l = nn(o) : n === "ellipse" ? l = sn(o) : ["polyline", "polygon"].includes(n) ? l = en(o) : n === "rect" ? l = rn(o) : n === "line" ? l = tn(o) : ["glyph", "path"].includes(n) && (l =
|
|
1576
|
+
return n === "circle" ? l = nn(o) : n === "ellipse" ? l = sn(o) : ["polyline", "polygon"].includes(n) ? l = en(o) : n === "rect" ? l = rn(o) : n === "line" ? l = tn(o) : ["glyph", "path"].includes(n) && (l = D(
|
|
1571
1577
|
s ? e.getAttribute("d") || /* istanbul ignore next @preserve */
|
|
1572
1578
|
"" : e.d || ""
|
|
1573
|
-
)),
|
|
1579
|
+
)), Ct(l) && l.length ? l : !1;
|
|
1574
1580
|
}, on = (e, t, s) => {
|
|
1575
1581
|
const r = s || document, n = Object.keys(ct), i = Ee(e), o = i ? e.tagName : null;
|
|
1576
1582
|
if (o === "path")
|
|
1577
|
-
throw TypeError(`${
|
|
1583
|
+
throw TypeError(`${Z}: "${o}" is already SVGPathElement`);
|
|
1578
1584
|
if (o && n.every((m) => o !== m))
|
|
1579
|
-
throw TypeError(`${
|
|
1585
|
+
throw TypeError(`${Z}: "${o}" is not SVGElement`);
|
|
1580
1586
|
const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = i ? o : e.type, a = ct[c], u = { type: c }, f = V.round, h = Re(e), y = h && h.length ? kt(h, f) : "";
|
|
1581
1587
|
return i ? (a.forEach((m) => {
|
|
1582
1588
|
u[m] = e.getAttribute(m);
|
|
@@ -1600,15 +1606,15 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1600
1606
|
const [n] = e, { round: i } = V, o = typeof i == "number" ? i : (
|
|
1601
1607
|
/* istanbul ignore next */
|
|
1602
1608
|
4
|
|
1603
|
-
), l = t.slice(1), { x1: c, y1: a, x2: u, y2: f, x: h, y } = s, [m, g] = l.slice(-2),
|
|
1609
|
+
), l = t.slice(1), { x1: c, y1: a, x2: u, y2: f, x: h, y } = s, [m, g] = l.slice(-2), A = e;
|
|
1604
1610
|
if ("TQ".includes(n) || (s.qx = null, s.qy = null), n === "L") {
|
|
1605
|
-
if (
|
|
1611
|
+
if (P(h, o) === P(m, o))
|
|
1606
1612
|
return ["V", g];
|
|
1607
|
-
if (
|
|
1613
|
+
if (P(y, o) === P(g, o))
|
|
1608
1614
|
return ["H", m];
|
|
1609
1615
|
} else if (n === "C") {
|
|
1610
|
-
const [M,
|
|
1611
|
-
if (s.x1 = M, s.y1 =
|
|
1616
|
+
const [M, N] = l;
|
|
1617
|
+
if (s.x1 = M, s.y1 = N, "CS".includes(r) && (P(M, o) === P(c * 2 - u, o) && P(N, o) === P(a * 2 - f, o) || P(c, o) === P(u * 2 - h, o) && P(a, o) === P(f * 2 - y, o)))
|
|
1612
1618
|
return [
|
|
1613
1619
|
"S",
|
|
1614
1620
|
l[2],
|
|
@@ -1617,14 +1623,14 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1617
1623
|
l[5]
|
|
1618
1624
|
];
|
|
1619
1625
|
} else if (n === "Q") {
|
|
1620
|
-
const [M,
|
|
1621
|
-
if (s.qx = M, s.qy =
|
|
1626
|
+
const [M, N] = l;
|
|
1627
|
+
if (s.qx = M, s.qy = N, "QT".includes(r) && P(M, o) === P(c * 2 - u, o) && P(N, o) === P(a * 2 - f, o))
|
|
1622
1628
|
return ["T", l[2], l[3]];
|
|
1623
1629
|
}
|
|
1624
|
-
return
|
|
1630
|
+
return A;
|
|
1625
1631
|
}, dt = (e, t) => {
|
|
1626
1632
|
const s = e.slice(1).map(
|
|
1627
|
-
(r) =>
|
|
1633
|
+
(r) => P(r, t)
|
|
1628
1634
|
);
|
|
1629
1635
|
return [e[0]].concat(s);
|
|
1630
1636
|
}, Xt = (e, t) => {
|
|
@@ -1633,7 +1639,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1633
1639
|
2
|
|
1634
1640
|
), n = { ...ut }, i = [];
|
|
1635
1641
|
let o = "M", l = "Z";
|
|
1636
|
-
return
|
|
1642
|
+
return O(s, (c, a, u, f) => {
|
|
1637
1643
|
n.x = u, n.y = f;
|
|
1638
1644
|
const h = Nt(c, n);
|
|
1639
1645
|
let y = c;
|
|
@@ -1644,8 +1650,8 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1644
1650
|
h,
|
|
1645
1651
|
n,
|
|
1646
1652
|
l
|
|
1647
|
-
),
|
|
1648
|
-
y = M.length < p.length ?
|
|
1653
|
+
), A = dt(g, r), M = A.join(""), N = Bt(g, a, u, f), x = dt(N, r), p = x.join("");
|
|
1654
|
+
y = M.length < p.length ? A : x;
|
|
1649
1655
|
}
|
|
1650
1656
|
const m = h.length;
|
|
1651
1657
|
return n.x1 = +h[m - 2], n.y1 = +h[m - 1], n.x2 = +h[m - 4] || n.x1, n.y2 = +h[m - 3] || n.y1, y;
|
|
@@ -1668,15 +1674,15 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1668
1674
|
t.map((s) => ["C"].concat(s.slice(2)))
|
|
1669
1675
|
);
|
|
1670
1676
|
}, ft = (e) => {
|
|
1671
|
-
const t = ht(e), s = ot(t), r = t.length, n = t[r - 1][0] === "Z", i =
|
|
1677
|
+
const t = ht(e), s = ot(t), r = t.length, n = t[r - 1][0] === "Z", i = O(t, (o, l) => {
|
|
1672
1678
|
const c = s[l], a = l && t[l - 1], u = a && a[0], f = t[l + 1], h = f && f[0], [y] = o, [m, g] = s[l ? l - 1 : r - 1].slice(-2);
|
|
1673
|
-
let
|
|
1679
|
+
let A = o;
|
|
1674
1680
|
switch (y) {
|
|
1675
1681
|
case "M":
|
|
1676
|
-
|
|
1682
|
+
A = n ? ["Z"] : [y, m, g];
|
|
1677
1683
|
break;
|
|
1678
1684
|
case "A":
|
|
1679
|
-
|
|
1685
|
+
A = [
|
|
1680
1686
|
y,
|
|
1681
1687
|
o[1],
|
|
1682
1688
|
o[2],
|
|
@@ -1688,7 +1694,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1688
1694
|
];
|
|
1689
1695
|
break;
|
|
1690
1696
|
case "C":
|
|
1691
|
-
f && h === "S" ?
|
|
1697
|
+
f && h === "S" ? A = ["S", o[1], o[2], m, g] : A = [
|
|
1692
1698
|
y,
|
|
1693
1699
|
o[3],
|
|
1694
1700
|
o[4],
|
|
@@ -1699,7 +1705,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1699
1705
|
];
|
|
1700
1706
|
break;
|
|
1701
1707
|
case "S":
|
|
1702
|
-
u && "CS".includes(u) && (!f || h !== "S") ?
|
|
1708
|
+
u && "CS".includes(u) && (!f || h !== "S") ? A = [
|
|
1703
1709
|
"C",
|
|
1704
1710
|
c[3],
|
|
1705
1711
|
c[4],
|
|
@@ -1707,7 +1713,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1707
1713
|
c[2],
|
|
1708
1714
|
m,
|
|
1709
1715
|
g
|
|
1710
|
-
] :
|
|
1716
|
+
] : A = [
|
|
1711
1717
|
y,
|
|
1712
1718
|
c[1],
|
|
1713
1719
|
c[2],
|
|
@@ -1716,34 +1722,34 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1716
1722
|
];
|
|
1717
1723
|
break;
|
|
1718
1724
|
case "Q":
|
|
1719
|
-
f && h === "T" ?
|
|
1725
|
+
f && h === "T" ? A = ["T", m, g] : A = [y, o[1], o[2], m, g];
|
|
1720
1726
|
break;
|
|
1721
1727
|
case "T":
|
|
1722
|
-
u && "QT".includes(u) && (!f || h !== "T") ?
|
|
1728
|
+
u && "QT".includes(u) && (!f || h !== "T") ? A = [
|
|
1723
1729
|
"Q",
|
|
1724
1730
|
c[1],
|
|
1725
1731
|
c[2],
|
|
1726
1732
|
m,
|
|
1727
1733
|
g
|
|
1728
|
-
] :
|
|
1734
|
+
] : A = [y, m, g];
|
|
1729
1735
|
break;
|
|
1730
1736
|
case "Z":
|
|
1731
|
-
|
|
1737
|
+
A = ["M", m, g];
|
|
1732
1738
|
break;
|
|
1733
1739
|
case "H":
|
|
1734
|
-
|
|
1740
|
+
A = [y, m];
|
|
1735
1741
|
break;
|
|
1736
1742
|
case "V":
|
|
1737
|
-
|
|
1743
|
+
A = [y, g];
|
|
1738
1744
|
break;
|
|
1739
1745
|
default:
|
|
1740
|
-
|
|
1746
|
+
A = [y].concat(
|
|
1741
1747
|
o.slice(1, -2),
|
|
1742
1748
|
m,
|
|
1743
1749
|
g
|
|
1744
1750
|
);
|
|
1745
1751
|
}
|
|
1746
|
-
return
|
|
1752
|
+
return A;
|
|
1747
1753
|
});
|
|
1748
1754
|
return n ? i.reverse() : [i[0]].concat(i.slice(1).reverse());
|
|
1749
1755
|
}, an = (e, t) => {
|
|
@@ -1751,9 +1757,9 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1751
1757
|
return s = t === "off" || typeof t == "number" && t >= 0 ? t : typeof s == "number" && s >= 0 ? s : (
|
|
1752
1758
|
/* istanbul ignore next @preserve */
|
|
1753
1759
|
"off"
|
|
1754
|
-
), s === "off" ? e.slice(0) :
|
|
1760
|
+
), s === "off" ? e.slice(0) : O(e, (r) => dt(r, s));
|
|
1755
1761
|
}, un = (e, t = 0.5) => {
|
|
1756
|
-
const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), l =
|
|
1762
|
+
const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), l = F(r, n, s), c = F(n, i, s), a = F(i, o, s), u = F(l, c, s), f = F(c, a, s), h = F(u, f, s);
|
|
1757
1763
|
return [
|
|
1758
1764
|
["C", l[0], l[1], u[0], u[1], h[0], h[1]],
|
|
1759
1765
|
["C", f[0], f[1], a[0], a[1], o[0], o[1]]
|
|
@@ -1774,18 +1780,18 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1774
1780
|
}), t;
|
|
1775
1781
|
}, Vt = (e, t) => {
|
|
1776
1782
|
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M";
|
|
1777
|
-
const a =
|
|
1783
|
+
const a = D(e), u = t && Object.keys(t);
|
|
1778
1784
|
if (!t || u && !u.length)
|
|
1779
1785
|
return a.slice(0);
|
|
1780
1786
|
t.origin || Object.assign(t, { origin: V.origin });
|
|
1781
1787
|
const f = t.origin, h = je(t);
|
|
1782
|
-
return h.isIdentity ? a.slice(0) :
|
|
1788
|
+
return h.isIdentity ? a.slice(0) : O(a, (y, m, g, A) => {
|
|
1783
1789
|
[c] = y;
|
|
1784
|
-
const M = c.toUpperCase(), x = M !== c ? at(y, m, g,
|
|
1790
|
+
const M = c.toUpperCase(), x = M !== c ? at(y, m, g, A) : y.slice(0);
|
|
1785
1791
|
let p = M === "A" ? ["C"].concat(
|
|
1786
1792
|
Mt(
|
|
1787
1793
|
g,
|
|
1788
|
-
|
|
1794
|
+
A,
|
|
1789
1795
|
x[1],
|
|
1790
1796
|
x[2],
|
|
1791
1797
|
x[3],
|
|
@@ -1794,10 +1800,10 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1794
1800
|
x[6],
|
|
1795
1801
|
x[7]
|
|
1796
1802
|
)
|
|
1797
|
-
) : M === "V" ? ["L", g, x[1]] : M === "H" ? ["L", x[1],
|
|
1803
|
+
) : M === "V" ? ["L", g, x[1]] : M === "H" ? ["L", x[1], A] : x;
|
|
1798
1804
|
c = p[0];
|
|
1799
|
-
const
|
|
1800
|
-
if (
|
|
1805
|
+
const w = c === "C" && p.length > 7, T = w ? p.slice(0, 7) : p.slice(0);
|
|
1806
|
+
if (w && (a.splice(
|
|
1801
1807
|
m + 1,
|
|
1802
1808
|
0,
|
|
1803
1809
|
["C"].concat(
|
|
@@ -1818,7 +1824,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1818
1824
|
return s = n, r = i, p;
|
|
1819
1825
|
});
|
|
1820
1826
|
};
|
|
1821
|
-
class
|
|
1827
|
+
class d {
|
|
1822
1828
|
/**
|
|
1823
1829
|
* @constructor
|
|
1824
1830
|
* @param pathValue the path string
|
|
@@ -1828,9 +1834,9 @@ class A {
|
|
|
1828
1834
|
const r = s || {}, n = typeof t > "u";
|
|
1829
1835
|
if (n || !t.length)
|
|
1830
1836
|
throw TypeError(
|
|
1831
|
-
`${
|
|
1837
|
+
`${Z}: "pathValue" is ${n ? "undefined" : "empty"}`
|
|
1832
1838
|
);
|
|
1833
|
-
this.segments =
|
|
1839
|
+
this.segments = D(t);
|
|
1834
1840
|
const { round: i, origin: o } = r;
|
|
1835
1841
|
let l;
|
|
1836
1842
|
Number.isInteger(i) || i === "off" ? l = i : l = V.round;
|
|
@@ -2009,7 +2015,7 @@ class A {
|
|
|
2009
2015
|
Object.keys(this).forEach((t) => delete this[t]);
|
|
2010
2016
|
}
|
|
2011
2017
|
}
|
|
2012
|
-
b(
|
|
2018
|
+
b(d, "CSSMatrix", C), b(d, "pathToAbsolute", ht), b(d, "pathToRelative", Kt), b(d, "pathToCurve", yt), b(d, "pathToString", kt), b(d, "arcTools", He), b(d, "bezierTools", {
|
|
2013
2019
|
Cvalues: Ae,
|
|
2014
2020
|
Tvalues: Rt,
|
|
2015
2021
|
minmaxC: jt,
|
|
@@ -2019,23 +2025,23 @@ b(A, "CSSMatrix", C), b(A, "pathToAbsolute", ht), b(A, "pathToRelative", Kt), b(
|
|
|
2019
2025
|
calculateBezier: we,
|
|
2020
2026
|
computeBezier: Ne,
|
|
2021
2027
|
deriveBezier: Me,
|
|
2022
|
-
CBEZIER_MINMAX_EPSILON:
|
|
2023
|
-
}), b(
|
|
2028
|
+
CBEZIER_MINMAX_EPSILON: Te
|
|
2029
|
+
}), b(d, "cubicTools", {
|
|
2024
2030
|
getCubicLength: xt,
|
|
2025
2031
|
getCubicBBox: St,
|
|
2026
|
-
getPointAtCubicLength:
|
|
2027
|
-
getPointAtCubicSegmentLength:
|
|
2028
|
-
}), b(
|
|
2032
|
+
getPointAtCubicLength: ve,
|
|
2033
|
+
getPointAtCubicSegmentLength: Ce
|
|
2034
|
+
}), b(d, "lineTools", {
|
|
2029
2035
|
getPointAtLineLength: Ht,
|
|
2030
2036
|
getLineBBox: It,
|
|
2031
2037
|
getLineLength: it
|
|
2032
|
-
}), b(
|
|
2038
|
+
}), b(d, "quadTools", {
|
|
2033
2039
|
getPointAtQuadSegmentLength: $e,
|
|
2034
2040
|
getQuadLength: pt,
|
|
2035
2041
|
getQuadBBox: Qt,
|
|
2036
2042
|
getPointAtQuadLength: ze
|
|
2037
|
-
}), b(
|
|
2043
|
+
}), b(d, "polygonTools", { polygonArea: Fe, polygonLength: _e }), b(d, "distanceSquareRoot", wt), b(d, "distanceEpsilon", bt), b(d, "midPoint", F), b(d, "rotateVector", st), b(d, "roundTo", P), b(d, "finalizeSegment", qt), b(d, "invalidPathValue", K), b(d, "isArcCommand", ye), b(d, "isDigit", J), b(d, "isDigitStart", he), b(d, "isMoveCommand", ge), b(d, "isPathCommand", fe), b(d, "isSpace", me), b(d, "paramsCount", tt), b(d, "paramsParser", ut), b(d, "pathParser", Ot), b(d, "scanFlag", ae), b(d, "scanParam", ue), b(d, "scanSegment", Dt), b(d, "skipSpaces", et), b(d, "getPathBBox", Wt), b(d, "getPathArea", qe), b(d, "getTotalLength", nt), b(d, "getDrawDirection", Ke), b(d, "getPointAtLength", rt), b(d, "getPropertiesAtLength", Ut), b(d, "getPropertiesAtPoint", Tt), b(d, "getClosestPoint", Ue), b(d, "getSegmentOfPoint", Xe), b(d, "getSegmentAtLength", We), b(d, "isPointInStroke", Ve), b(d, "isValidPath", Ie), b(d, "isPathArray", Ct), b(d, "isAbsoluteArray", Pe), b(d, "isRelativeArray", Ge), b(d, "isCurveArray", Ye), b(d, "isNormalizedArray", ke), b(d, "shapeToPath", on), b(d, "shapeToPathArray", Re), b(d, "shapeParams", ct), b(d, "parsePathString", D), b(d, "absolutizeSegment", at), b(d, "arcToCubic", Mt), b(d, "getSVGMatrix", je), b(d, "iterate", O), b(d, "lineToCubic", Pt), b(d, "normalizePath", ot), b(d, "normalizeSegment", Nt), b(d, "optimizePath", Xt), b(d, "projection2d", Zt), b(d, "quadToCubic", xe), b(d, "relativizeSegment", Bt), b(d, "reverseCurve", ln), b(d, "reversePath", ft), b(d, "roundPath", an), b(d, "roundSegment", dt), b(d, "segmentToCubic", pe), b(d, "shortenSegment", Se), b(d, "splitCubic", un), b(d, "splitPath", Yt), b(d, "transformPath", Vt);
|
|
2038
2044
|
export {
|
|
2039
|
-
|
|
2045
|
+
d as default
|
|
2040
2046
|
};
|
|
2041
2047
|
//# sourceMappingURL=svg-path-commander.mjs.map
|