svg-path-commander 2.1.1 → 2.1.2

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.
Files changed (56) hide show
  1. package/README.md +2 -2
  2. package/dist/svg-path-commander.cjs +1 -1
  3. package/dist/svg-path-commander.cjs.map +1 -1
  4. package/dist/svg-path-commander.d.ts +207 -19
  5. package/dist/svg-path-commander.js +1 -1
  6. package/dist/svg-path-commander.js.map +1 -1
  7. package/dist/svg-path-commander.mjs +1052 -969
  8. package/dist/svg-path-commander.mjs.map +1 -1
  9. package/package.json +7 -7
  10. package/src/convert/pathToAbsolute.ts +2 -31
  11. package/src/convert/pathToCurve.ts +13 -27
  12. package/src/convert/pathToRelative.ts +2 -47
  13. package/src/convert/pathToString.ts +40 -7
  14. package/src/index.ts +132 -39
  15. package/src/interface.ts +2 -1
  16. package/src/math/arcTools.ts +53 -51
  17. package/src/math/bezier.ts +41 -33
  18. package/src/math/cubicTools.ts +10 -8
  19. package/src/math/distanceSquareRoot.ts +1 -1
  20. package/src/math/lineTools.ts +6 -4
  21. package/src/math/polygonTools.ts +48 -0
  22. package/src/math/quadTools.ts +8 -6
  23. package/src/math/rotateVector.ts +3 -2
  24. package/src/math/roundTo.ts +7 -0
  25. package/src/parser/finalizeSegment.ts +11 -7
  26. package/src/parser/parsePathString.ts +2 -3
  27. package/src/parser/pathParser.ts +1 -1
  28. package/src/process/absolutizeSegment.ts +35 -30
  29. package/src/process/arcToCubic.ts +2 -2
  30. package/src/process/iterate.ts +41 -16
  31. package/src/process/lineToCubic.ts +1 -1
  32. package/src/process/normalizePath.ts +14 -31
  33. package/src/process/normalizeSegment.ts +53 -15
  34. package/src/process/optimizePath.ts +40 -60
  35. package/src/process/projection2d.ts +2 -2
  36. package/src/process/relativizeSegment.ts +33 -35
  37. package/src/process/reverseCurve.ts +8 -5
  38. package/src/process/reversePath.ts +87 -74
  39. package/src/process/roundPath.ts +14 -8
  40. package/src/process/roundSegment.ts +9 -0
  41. package/src/process/segmentToCubic.ts +9 -7
  42. package/src/process/shortenSegment.ts +24 -32
  43. package/src/process/splitCubic.ts +2 -2
  44. package/src/process/transformPath.ts +35 -40
  45. package/src/types.ts +7 -11
  46. package/src/util/getPathArea.ts +2 -2
  47. package/src/util/getPathBBox.ts +25 -42
  48. package/src/util/getPointAtLength.ts +51 -49
  49. package/src/util/getPropertiesAtLength.ts +4 -5
  50. package/src/util/getPropertiesAtPoint.ts +5 -5
  51. package/src/util/getTotalLength.ts +23 -38
  52. package/test/class.test.ts +2 -0
  53. package/test/fixtures/shapes.js +5 -5
  54. package/test/static.test.ts +18 -12
  55. package/src/math/polygonArea.ts +0 -29
  56. package/src/math/polygonLength.ts +0 -22
@@ -1,184 +1,8 @@
1
- var he = Object.defineProperty;
2
- var fe = (e, t, n) => t in e ? he(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var N = (e, t, n) => fe(e, typeof t != "symbol" ? t + "" : t, n);
4
- const st = {
5
- origin: [0, 0, 0],
6
- round: 4
7
- }, E = "SVGPathCommander Error", tt = {
8
- a: 7,
9
- c: 6,
10
- h: 1,
11
- l: 2,
12
- m: 2,
13
- r: 4,
14
- q: 4,
15
- s: 4,
16
- t: 2,
17
- v: 1,
18
- z: 0
19
- }, $t = (e) => {
20
- let t = e.pathValue[e.segmentStart], n = t.toLowerCase();
21
- const { data: r } = e;
22
- for (; r.length >= tt[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, tt[n])]), !!tt[n]); )
23
- ;
24
- }, ye = (e) => {
25
- const { index: t, pathValue: n } = e, r = n.charCodeAt(t);
26
- if (r === 48) {
27
- e.param = 0, e.index += 1;
28
- return;
29
- }
30
- if (r === 49) {
31
- e.param = 1, e.index += 1;
32
- return;
33
- }
34
- e.err = `${E}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`;
35
- }, F = (e) => e >= 48 && e <= 57, U = "Invalid path value", ge = (e) => {
36
- const { max: t, pathValue: n, index: r } = e;
37
- let s = r, i = !1, o = !1, c = !1, l = !1, a;
38
- if (s >= t) {
39
- e.err = `${E}: ${U} at index ${s}, "pathValue" is missing param`;
40
- return;
41
- }
42
- if (a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1, a = n.charCodeAt(s)), !F(a) && a !== 46) {
43
- e.err = `${E}: ${U} at index ${s}, "${n[s]}" is not a number`;
44
- return;
45
- }
46
- if (a !== 46) {
47
- if (i = a === 48, s += 1, a = n.charCodeAt(s), i && s < t && a && F(a)) {
48
- e.err = `${E}: ${U} at index ${r}, "${n[r]}" illegal number`;
49
- return;
50
- }
51
- for (; s < t && F(n.charCodeAt(s)); )
52
- s += 1, o = !0;
53
- a = n.charCodeAt(s);
54
- }
55
- if (a === 46) {
56
- for (l = !0, s += 1; F(n.charCodeAt(s)); )
57
- s += 1, c = !0;
58
- a = n.charCodeAt(s);
59
- }
60
- if (a === 101 || a === 69) {
61
- if (l && !o && !c) {
62
- e.err = `${E}: ${U} at index ${s}, "${n[s]}" invalid float exponent`;
63
- return;
64
- }
65
- if (s += 1, a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1), s < t && F(n.charCodeAt(s)))
66
- for (; s < t && F(n.charCodeAt(s)); )
67
- s += 1;
68
- else {
69
- e.err = `${E}: ${U} at index ${s}, "${n[s]}" invalid integer exponent`;
70
- return;
71
- }
72
- }
73
- e.index = s, e.param = +e.pathValue.slice(r, s);
74
- }, xe = (e) => [
75
- // Special spaces
76
- 5760,
77
- 6158,
78
- 8192,
79
- 8193,
80
- 8194,
81
- 8195,
82
- 8196,
83
- 8197,
84
- 8198,
85
- 8199,
86
- 8200,
87
- 8201,
88
- 8202,
89
- 8239,
90
- 8287,
91
- 12288,
92
- 65279,
93
- // Line terminators
94
- 10,
95
- 13,
96
- 8232,
97
- 8233,
98
- // White spaces
99
- 32,
100
- 9,
101
- 11,
102
- 12,
103
- 160
104
- ].includes(e), et = (e) => {
105
- const { pathValue: t, max: n } = e;
106
- for (; e.index < n && xe(t.charCodeAt(e.index)); )
107
- e.index += 1;
108
- }, pe = (e) => {
109
- switch (e | 32) {
110
- case 109:
111
- case 122:
112
- case 108:
113
- case 104:
114
- case 118:
115
- case 99:
116
- case 115:
117
- case 113:
118
- case 116:
119
- case 97:
120
- return !0;
121
- default:
122
- return !1;
123
- }
124
- }, de = (e) => F(e) || e === 43 || e === 45 || e === 46, Me = (e) => (e | 32) === 97, be = (e) => {
125
- switch (e | 32) {
126
- case 109:
127
- case 77:
128
- return !0;
129
- default:
130
- return !1;
131
- }
132
- }, Qt = (e) => {
133
- var l;
134
- const { max: t, pathValue: n, index: r, segments: s } = e, i = n.charCodeAt(r), o = tt[n[r].toLowerCase()];
135
- if (e.segmentStart = r, !pe(i)) {
136
- e.err = `${E}: ${U} "${n[r]}" is not a path command at index ${r}`;
137
- return;
138
- }
139
- const c = s[s.length - 1];
140
- if (!be(i) && ((l = c == null ? void 0 : c[0]) == null ? void 0 : l.toLocaleLowerCase()) === "z") {
141
- e.err = `${E}: ${U} "${n[r]}" is not a MoveTo path command at index ${r}`;
142
- return;
143
- }
144
- if (e.index += 1, et(e), e.data = [], !o) {
145
- $t(e);
146
- return;
147
- }
148
- for (; ; ) {
149
- for (let a = o; a > 0; a -= 1) {
150
- if (Me(i) && (a === 3 || a === 4) ? ye(e) : ge(e), e.err.length)
151
- return;
152
- e.data.push(e.param), et(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, et(e));
153
- }
154
- if (e.index >= e.max || !de(n.charCodeAt(e.index)))
155
- break;
156
- }
157
- $t(e);
158
- };
159
- class Xt {
160
- constructor(t) {
161
- this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
162
- }
163
- }
164
- const q = (e) => {
165
- if (typeof e != "string")
166
- return e.slice(0);
167
- const t = new Xt(e);
168
- for (et(t); t.index < t.max && !t.err.length; )
169
- Qt(t);
170
- if (t != null && t.err.length)
171
- throw TypeError(t.err);
172
- return t.segments;
173
- }, we = (e) => {
174
- const t = e.length;
175
- let n = -1, r, s = e[t - 1], i = 0;
176
- for (; ++n < t; )
177
- r = s, s = e[n], i += r[1] * s[0] - r[0] * s[1];
178
- return i / 2;
179
- }, Pt = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), Ne = (e) => e.reduce((t, n, r) => r ? t + Pt(e[r - 1], n) : 0, 0);
180
- var Ae = Object.defineProperty, Ce = (e, t, n) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, k = (e, t, n) => Ce(e, typeof t != "symbol" ? t + "" : t, n);
181
- const ve = {
1
+ var Se = Object.defineProperty;
2
+ var De = (e, t, s) => t in e ? Se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var g = (e, t, s) => De(e, typeof t != "symbol" ? t + "" : t, s);
4
+ var Ze = Object.defineProperty, Oe = (e, t, s) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, q = (e, t, s) => Oe(e, typeof t != "symbol" ? t + "" : t, s);
5
+ const Qe = {
182
6
  a: 1,
183
7
  b: 0,
184
8
  c: 0,
@@ -203,21 +27,21 @@ const ve = {
203
27
  m44: 1,
204
28
  is2D: !0,
205
29
  isIdentity: !0
206
- }, Bt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Yt = (e) => e instanceof DOMMatrix || e instanceof v || typeof e == "object" && Object.keys(ve).every((t) => e && t in e), it = (e) => {
207
- const t = new v(), n = Array.from(e);
208
- if (!Bt(n))
209
- throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);
210
- if (n.length === 16) {
211
- const [r, s, i, o, c, l, a, m, u, g, f, h, y, x, p, d] = n;
212
- t.m11 = r, t.a = r, t.m21 = c, t.c = c, t.m31 = u, t.m41 = y, t.e = y, t.m12 = s, t.b = s, t.m22 = l, t.d = l, t.m32 = g, t.m42 = x, t.f = x, t.m13 = i, t.m23 = a, t.m33 = f, t.m43 = p, t.m14 = o, t.m24 = m, t.m34 = h, t.m44 = d;
213
- } else if (n.length === 6) {
214
- const [r, s, i, o, c, l] = n;
215
- t.m11 = r, t.a = r, t.m12 = s, t.b = s, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = c, t.e = c, t.m42 = l, t.f = l;
30
+ }, Vt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Gt = (e) => e instanceof DOMMatrix || e instanceof C || typeof e == "object" && Object.keys(Qe).every((t) => e && t in e), ht = (e) => {
31
+ const t = new C(), s = Array.from(e);
32
+ if (!Vt(s))
33
+ throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`);
34
+ if (s.length === 16) {
35
+ const [r, n, i, o, a, c, l, u, m, f, y, h, x, b, A, w] = s;
36
+ t.m11 = r, t.a = r, t.m21 = a, t.c = a, t.m31 = m, t.m41 = x, t.e = x, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = f, t.m42 = b, t.f = b, t.m13 = i, t.m23 = l, t.m33 = y, t.m43 = A, t.m14 = o, t.m24 = u, t.m34 = h, t.m44 = w;
37
+ } else if (s.length === 6) {
38
+ const [r, n, i, o, a, c] = s;
39
+ 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 = a, t.e = a, t.m42 = c, t.f = c;
216
40
  }
217
41
  return t;
218
- }, Ht = (e) => {
219
- if (Yt(e))
220
- return it([
42
+ }, te = (e) => {
43
+ if (Gt(e))
44
+ return ht([
221
45
  e.m11,
222
46
  e.m12,
223
47
  e.m13,
@@ -236,47 +60,47 @@ const ve = {
236
60
  e.m44
237
61
  ]);
238
62
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);
239
- }, Ft = (e) => {
63
+ }, ee = (e) => {
240
64
  if (typeof e != "string")
241
65
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);
242
66
  const t = String(e).replace(/\s/g, "");
243
- let n = new v();
67
+ let s = new C();
244
68
  const r = `CSSMatrix: invalid transform string "${e}"`;
245
- return t.split(")").filter((s) => s).forEach((s) => {
246
- const [i, o] = s.split("(");
69
+ return t.split(")").filter((n) => n).forEach((n) => {
70
+ const [i, o] = n.split("(");
247
71
  if (!o) throw TypeError(r);
248
- const c = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [l, a, m, u] = c, g = [l, a, m], f = [l, a, m, u];
249
- if (i === "perspective" && l && [a, m].every((h) => h === void 0))
250
- n.m34 = -1 / l;
251
- else if (i.includes("matrix") && [6, 16].includes(c.length) && c.every((h) => !Number.isNaN(+h))) {
252
- const h = c.map((y) => Math.abs(y) < 1e-6 ? 0 : y);
253
- n = n.multiply(it(h));
254
- } else if (i === "translate3d" && g.every((h) => !Number.isNaN(+h)))
255
- n = n.translate(l, a, m);
256
- else if (i === "translate" && l && m === void 0)
257
- n = n.translate(l, a || 0, 0);
258
- else if (i === "rotate3d" && f.every((h) => !Number.isNaN(+h)) && u)
259
- n = n.rotateAxisAngle(l, a, m, u);
260
- else if (i === "rotate" && l && [a, m].every((h) => h === void 0))
261
- n = n.rotate(0, 0, l);
262
- else if (i === "scale3d" && g.every((h) => !Number.isNaN(+h)) && g.some((h) => h !== 1))
263
- n = n.scale(l, a, m);
264
- else if (i === "scale" && !Number.isNaN(l) && l !== 1 && m === void 0) {
265
- const h = Number.isNaN(+a) ? l : a;
266
- n = n.scale(l, h, 1);
267
- } else if (i === "skew" && (l || !Number.isNaN(l) && a) && m === void 0)
268
- n = n.skew(l, a || 0);
269
- else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && l && [a, m].every((h) => h === void 0))
72
+ const a = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [c, l, u, m] = a, f = [c, l, u], y = [c, l, u, m];
73
+ if (i === "perspective" && c && [l, u].every((h) => h === void 0))
74
+ s.m34 = -1 / c;
75
+ else if (i.includes("matrix") && [6, 16].includes(a.length) && a.every((h) => !Number.isNaN(+h))) {
76
+ const h = a.map((x) => Math.abs(x) < 1e-6 ? 0 : x);
77
+ s = s.multiply(ht(h));
78
+ } else if (i === "translate3d" && f.every((h) => !Number.isNaN(+h)))
79
+ s = s.translate(c, l, u);
80
+ else if (i === "translate" && c && u === void 0)
81
+ s = s.translate(c, l || 0, 0);
82
+ else if (i === "rotate3d" && y.every((h) => !Number.isNaN(+h)) && m)
83
+ s = s.rotateAxisAngle(c, l, u, m);
84
+ else if (i === "rotate" && c && [l, u].every((h) => h === void 0))
85
+ s = s.rotate(0, 0, c);
86
+ else if (i === "scale3d" && f.every((h) => !Number.isNaN(+h)) && f.some((h) => h !== 1))
87
+ s = s.scale(c, l, u);
88
+ else if (i === "scale" && !Number.isNaN(c) && c !== 1 && u === void 0) {
89
+ const h = Number.isNaN(+l) ? c : l;
90
+ s = s.scale(c, h, 1);
91
+ } else if (i === "skew" && (c || !Number.isNaN(c) && l) && u === void 0)
92
+ s = s.skew(c, l || 0);
93
+ else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && c && [l, u].every((h) => h === void 0))
270
94
  if (i === "skewX" || i === "skewY")
271
- n = n[i](l);
95
+ s = s[i](c);
272
96
  else {
273
- const h = i.replace(/[XYZ]/, ""), y = i.replace(h, ""), x = ["X", "Y", "Z"].indexOf(y), p = h === "scale" ? 1 : 0, d = [x === 0 ? l : p, x === 1 ? l : p, x === 2 ? l : p];
274
- n = n[h](...d);
97
+ const h = i.replace(/[XYZ]/, ""), x = i.replace(h, ""), b = ["X", "Y", "Z"].indexOf(x), A = h === "scale" ? 1 : 0, w = [b === 0 ? c : A, b === 1 ? c : A, b === 2 ? c : A];
98
+ s = s[h](...w);
275
99
  }
276
100
  else
277
101
  throw TypeError(r);
278
- }), n;
279
- }, wt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [
102
+ }), s;
103
+ }, vt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [
280
104
  e.m11,
281
105
  e.m12,
282
106
  e.m13,
@@ -293,47 +117,47 @@ const ve = {
293
117
  e.m42,
294
118
  e.m43,
295
119
  e.m44
296
- ], Ut = (e, t, n) => {
297
- const r = new v();
298
- return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = n, r;
299
- }, Vt = (e, t, n) => {
300
- const r = new v(), s = Math.PI / 180, i = e * s, o = t * s, c = n * s, l = Math.cos(i), a = -Math.sin(i), m = Math.cos(o), u = -Math.sin(o), g = Math.cos(c), f = -Math.sin(c), h = m * g, y = -m * f;
301
- r.m11 = h, r.a = h, r.m12 = y, r.b = y, r.m13 = u;
302
- const x = a * u * g + l * f;
303
- r.m21 = x, r.c = x;
304
- const p = l * g - a * u * f;
305
- return r.m22 = p, r.d = p, r.m23 = -a * m, r.m31 = a * f - l * u * g, r.m32 = a * g + l * u * f, r.m33 = l * m, r;
306
- }, _t = (e, t, n, r) => {
307
- const s = new v(), i = Math.sqrt(e * e + t * t + n * n);
120
+ ], ne = (e, t, s) => {
121
+ const r = new C();
122
+ return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = s, r;
123
+ }, se = (e, t, s) => {
124
+ const r = new C(), n = Math.PI / 180, i = e * n, o = t * n, a = s * n, c = Math.cos(i), l = -Math.sin(i), u = Math.cos(o), m = -Math.sin(o), f = Math.cos(a), y = -Math.sin(a), h = u * f, x = -u * y;
125
+ r.m11 = h, r.a = h, r.m12 = x, r.b = x, r.m13 = m;
126
+ const b = l * m * f + c * y;
127
+ r.m21 = b, r.c = b;
128
+ const A = c * f - l * m * y;
129
+ return r.m22 = A, r.d = A, r.m23 = -l * u, r.m31 = l * y - c * m * f, r.m32 = l * f + c * m * y, r.m33 = c * u, r;
130
+ }, re = (e, t, s, r) => {
131
+ const n = new C(), i = Math.sqrt(e * e + t * t + s * s);
308
132
  if (i === 0)
309
- return s;
310
- const o = e / i, c = t / i, l = n / i, a = r * (Math.PI / 360), m = Math.sin(a), u = Math.cos(a), g = m * m, f = o * o, h = c * c, y = l * l, x = 1 - 2 * (h + y) * g;
311
- s.m11 = x, s.a = x;
312
- const p = 2 * (o * c * g + l * m * u);
313
- s.m12 = p, s.b = p, s.m13 = 2 * (o * l * g - c * m * u);
314
- const d = 2 * (c * o * g - l * m * u);
315
- s.m21 = d, s.c = d;
316
- const C = 1 - 2 * (y + f) * g;
317
- return s.m22 = C, s.d = C, s.m23 = 2 * (c * l * g + o * m * u), s.m31 = 2 * (l * o * g + c * m * u), s.m32 = 2 * (l * c * g - o * m * u), s.m33 = 1 - 2 * (f + h) * g, s;
318
- }, Jt = (e, t, n) => {
319
- const r = new v();
320
- return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = n, r;
321
- }, yt = (e, t) => {
322
- const n = new v();
133
+ return n;
134
+ const o = e / i, a = t / i, c = s / i, l = r * (Math.PI / 360), u = Math.sin(l), m = Math.cos(l), f = u * u, y = o * o, h = a * a, x = c * c, b = 1 - 2 * (h + x) * f;
135
+ n.m11 = b, n.a = b;
136
+ const A = 2 * (o * a * f + c * u * m);
137
+ n.m12 = A, n.b = A, n.m13 = 2 * (o * c * f - a * u * m);
138
+ const w = 2 * (a * o * f - c * u * m);
139
+ n.m21 = w, n.c = w;
140
+ const N = 1 - 2 * (x + y) * f;
141
+ return n.m22 = N, n.d = N, n.m23 = 2 * (a * c * f + o * u * m), n.m31 = 2 * (c * o * f + a * u * m), n.m32 = 2 * (c * a * f - o * u * m), n.m33 = 1 - 2 * (y + h) * f, n;
142
+ }, ie = (e, t, s) => {
143
+ const r = new C();
144
+ return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = s, r;
145
+ }, At = (e, t) => {
146
+ const s = new C();
323
147
  if (e) {
324
- const r = e * Math.PI / 180, s = Math.tan(r);
325
- n.m21 = s, n.c = s;
148
+ const r = e * Math.PI / 180, n = Math.tan(r);
149
+ s.m21 = n, s.c = n;
326
150
  }
327
151
  if (t) {
328
- const r = t * Math.PI / 180, s = Math.tan(r);
329
- n.m12 = s, n.b = s;
152
+ const r = t * Math.PI / 180, n = Math.tan(r);
153
+ s.m12 = n, s.b = n;
330
154
  }
331
- return n;
332
- }, Kt = (e) => yt(e, 0), Wt = (e) => yt(0, e), j = (e, t) => {
333
- const n = 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, s = 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, c = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, l = 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, m = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, u = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, g = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, f = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, y = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, p = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
334
- return it([n, r, s, i, o, c, l, a, m, u, g, f, h, y, x, p]);
155
+ return s;
156
+ }, oe = (e) => At(e, 0), ce = (e) => At(0, e), B = (e, t) => {
157
+ 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, a = 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, l = 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, m = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, f = 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, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, x = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, b = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, A = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
158
+ return ht([s, r, n, i, o, a, c, l, u, m, f, y, h, x, b, A]);
335
159
  };
336
- class v {
160
+ class C {
337
161
  /**
338
162
  * @constructor
339
163
  * @param init accepts all parameter configurations:
@@ -378,7 +202,7 @@ class v {
378
202
  * @return the matrix instance
379
203
  */
380
204
  setMatrixValue(t) {
381
- return typeof t == "string" && t.length && t !== "none" ? Ft(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? it(t) : typeof t == "object" ? Ht(t) : this;
205
+ return typeof t == "string" && t.length && t !== "none" ? ee(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? ht(t) : typeof t == "object" ? te(t) : this;
382
206
  }
383
207
  /**
384
208
  * Returns a *Float32Array* containing elements which comprise the matrix.
@@ -389,7 +213,7 @@ class v {
389
213
  * @return an *Array* representation of the matrix
390
214
  */
391
215
  toFloat32Array(t) {
392
- return Float32Array.from(wt(this, t));
216
+ return Float32Array.from(vt(this, t));
393
217
  }
394
218
  /**
395
219
  * Returns a *Float64Array* containing elements which comprise the matrix.
@@ -400,7 +224,7 @@ class v {
400
224
  * @return an *Array* representation of the matrix
401
225
  */
402
226
  toFloat64Array(t) {
403
- return Float64Array.from(wt(this, t));
227
+ return Float64Array.from(vt(this, t));
404
228
  }
405
229
  /**
406
230
  * Creates and returns a string representation of the matrix in `CSS` matrix syntax,
@@ -412,8 +236,8 @@ class v {
412
236
  * @return a string representation of the matrix
413
237
  */
414
238
  toString() {
415
- const { is2D: t } = this, n = this.toFloat64Array(t).join(", ");
416
- return `${t ? "matrix" : "matrix3d"}(${n})`;
239
+ const { is2D: t } = this, s = this.toFloat64Array(t).join(", ");
240
+ return `${t ? "matrix" : "matrix3d"}(${s})`;
417
241
  }
418
242
  /**
419
243
  * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*
@@ -426,8 +250,8 @@ class v {
426
250
  * @return an *Object* with all matrix values.
427
251
  */
428
252
  toJSON() {
429
- const { is2D: t, isIdentity: n } = this;
430
- return { ...this, is2D: t, isIdentity: n };
253
+ const { is2D: t, isIdentity: s } = this;
254
+ return { ...this, is2D: t, isIdentity: s };
431
255
  }
432
256
  /**
433
257
  * The Multiply method returns a new CSSMatrix which is the result of this
@@ -438,7 +262,7 @@ class v {
438
262
  * @return The resulted matrix.
439
263
  */
440
264
  multiply(t) {
441
- return j(this, t);
265
+ return B(this, t);
442
266
  }
443
267
  /**
444
268
  * The translate method returns a new matrix which is this matrix post
@@ -451,10 +275,10 @@ class v {
451
275
  * @param z Z component of the translation value.
452
276
  * @return The resulted matrix
453
277
  */
454
- translate(t, n, r) {
455
- const s = t;
456
- let i = n, o = r;
457
- return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), j(this, Ut(s, i, o));
278
+ translate(t, s, r) {
279
+ const n = t;
280
+ let i = s, o = r;
281
+ return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), B(this, ne(n, i, o));
458
282
  }
459
283
  /**
460
284
  * The scale method returns a new matrix which is this matrix post multiplied by
@@ -467,10 +291,10 @@ class v {
467
291
  * @param z The Z component of the scale value.
468
292
  * @return The resulted matrix
469
293
  */
470
- scale(t, n, r) {
471
- const s = t;
472
- let i = n, o = r;
473
- return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), j(this, Jt(s, i, o));
294
+ scale(t, s, r) {
295
+ const n = t;
296
+ let i = s, o = r;
297
+ return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), B(this, ie(n, i, o));
474
298
  }
475
299
  /**
476
300
  * The rotate method returns a new matrix which is this matrix post multiplied
@@ -484,9 +308,9 @@ class v {
484
308
  * @param rz The (optional) Z component of the rotation value.
485
309
  * @return The resulted matrix
486
310
  */
487
- rotate(t, n, r) {
488
- let s = t, i = n || 0, o = r || 0;
489
- return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), j(this, Vt(s, i, o));
311
+ rotate(t, s, r) {
312
+ let n = t, i = s || 0, o = r || 0;
313
+ return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0), B(this, se(n, i, o));
490
314
  }
491
315
  /**
492
316
  * The rotateAxisAngle method returns a new matrix which is this matrix post
@@ -500,10 +324,10 @@ class v {
500
324
  * @param angle The angle of rotation about the axis vector, in degrees.
501
325
  * @return The resulted matrix
502
326
  */
503
- rotateAxisAngle(t, n, r, s) {
504
- if ([t, n, r, s].some((i) => Number.isNaN(+i)))
327
+ rotateAxisAngle(t, s, r, n) {
328
+ if ([t, s, r, n].some((i) => Number.isNaN(+i)))
505
329
  throw new TypeError("CSSMatrix: expecting 4 values");
506
- return j(this, _t(t, n, r, s));
330
+ return B(this, re(t, s, r, n));
507
331
  }
508
332
  /**
509
333
  * Specifies a skew transformation along the `x-axis` by the given angle.
@@ -513,7 +337,7 @@ class v {
513
337
  * @return The resulted matrix
514
338
  */
515
339
  skewX(t) {
516
- return j(this, Kt(t));
340
+ return B(this, oe(t));
517
341
  }
518
342
  /**
519
343
  * Specifies a skew transformation along the `y-axis` by the given angle.
@@ -523,7 +347,7 @@ class v {
523
347
  * @return The resulted matrix
524
348
  */
525
349
  skewY(t) {
526
- return j(this, Wt(t));
350
+ return B(this, ce(t));
527
351
  }
528
352
  /**
529
353
  * Specifies a skew transformation along both the `x-axis` and `y-axis`.
@@ -533,8 +357,8 @@ class v {
533
357
  * @param angleY The angle amount in degrees to skew.
534
358
  * @return The resulted matrix
535
359
  */
536
- skew(t, n) {
537
- return j(this, yt(t, n));
360
+ skew(t, s) {
361
+ return B(this, At(t, s));
538
362
  }
539
363
  /**
540
364
  * Transforms a specified vector using the matrix, returning a new
@@ -548,210 +372,531 @@ class v {
548
372
  * @return the resulting Tuple
549
373
  */
550
374
  transformPoint(t) {
551
- const n = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, r = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, s = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, i = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;
552
- return t instanceof DOMPoint ? new DOMPoint(n, r, s, i) : {
553
- x: n,
375
+ const s = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, r = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, n = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, i = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;
376
+ return t instanceof DOMPoint ? new DOMPoint(s, r, n, i) : {
377
+ x: s,
554
378
  y: r,
555
- z: s,
379
+ z: n,
556
380
  w: i
557
381
  };
558
382
  }
559
383
  }
560
- k(v, "Translate", Ut), k(v, "Rotate", Vt), k(v, "RotateAxisAngle", _t), k(v, "Scale", Jt), k(v, "SkewX", Kt), k(v, "SkewY", Wt), k(v, "Skew", yt), k(v, "Multiply", j), k(v, "fromArray", it), k(v, "fromMatrix", Ht), k(v, "fromString", Ft), k(v, "toArray", wt), k(v, "isCompatibleArray", Bt), k(v, "isCompatibleObject", Yt);
561
- const gt = {
562
- x1: 0,
563
- y1: 0,
564
- x2: 0,
565
- y2: 0,
566
- x: 0,
567
- y: 0,
568
- qx: null,
569
- qy: null
570
- }, D = (e, t) => {
571
- const n = { ...gt };
572
- let r = e.length, s;
573
- for (let i = 0; i < r; i += 1) {
574
- s = e[i];
575
- const o = t(s, n, i);
576
- e[i] = o, o[0] === "C" && (r = e.length), s = e[i];
577
- const c = s.length;
578
- n.x1 = +s[c - 2], n.y1 = +s[c - 1], n.x2 = +s[c - 4] || n.x1, n.y2 = +s[c - 3] || n.y1;
384
+ q(C, "Translate", ne), q(C, "Rotate", se), q(C, "RotateAxisAngle", re), q(C, "Scale", ie), q(C, "SkewX", oe), q(C, "SkewY", ce), q(C, "Skew", At), q(C, "Multiply", B), q(C, "fromArray", ht), q(C, "fromMatrix", te), q(C, "fromString", ee), q(C, "toArray", vt), q(C, "isCompatibleArray", Vt), q(C, "isCompatibleObject", Gt);
385
+ const V = {
386
+ origin: [0, 0, 0],
387
+ round: 4
388
+ }, nt = {
389
+ a: 7,
390
+ c: 6,
391
+ h: 1,
392
+ l: 2,
393
+ m: 2,
394
+ r: 4,
395
+ q: 4,
396
+ s: 4,
397
+ t: 2,
398
+ v: 1,
399
+ z: 0
400
+ }, Tt = (e) => {
401
+ let t = e.pathValue[e.segmentStart], s = t.toLowerCase();
402
+ const { data: r } = e;
403
+ for (; r.length >= nt[s] && (s === "m" && r.length > 2 ? (e.segments.push([t].concat(r.splice(0, 2))), s = "l", t = t === "m" ? "l" : "L") : e.segments.push(
404
+ [t].concat(
405
+ r.splice(0, nt[s])
406
+ )
407
+ ), !!nt[s]); )
408
+ ;
409
+ }, E = "SVGPathCommander Error", ae = (e) => {
410
+ const { index: t, pathValue: s } = e, r = s.charCodeAt(t);
411
+ if (r === 48) {
412
+ e.param = 0, e.index += 1;
413
+ return;
579
414
  }
580
- return e;
581
- }, V = (e, t) => {
582
- const [n] = e, { x: r, y: s } = t, i = e.slice(1).map(Number), o = n.toUpperCase();
583
- if (!(o === n)) {
584
- if (o === "A")
585
- return [
586
- o,
587
- i[0],
588
- i[1],
589
- i[2],
590
- i[3],
591
- i[4],
592
- i[5] + r,
593
- i[6] + s
594
- ];
595
- if (o === "V")
596
- return [o, i[0] + s];
597
- if (o === "H")
598
- return [o, i[0] + r];
599
- {
600
- const l = i.map((a, m) => a + (m % 2 ? s : r));
601
- return [o, ...l];
415
+ if (r === 49) {
416
+ e.param = 1, e.index += 1;
417
+ return;
418
+ }
419
+ e.err = `${E}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`;
420
+ }, H = (e) => e >= 48 && e <= 57, U = "Invalid path value", le = (e) => {
421
+ const { max: t, pathValue: s, index: r } = e;
422
+ let n = r, i = !1, o = !1, a = !1, c = !1, l;
423
+ if (n >= t) {
424
+ e.err = `${E}: ${U} at index ${n}, "pathValue" is missing param`;
425
+ return;
426
+ }
427
+ if (l = s.charCodeAt(n), (l === 43 || l === 45) && (n += 1, l = s.charCodeAt(n)), !H(l) && l !== 46) {
428
+ e.err = `${E}: ${U} at index ${n}, "${s[n]}" is not a number`;
429
+ return;
430
+ }
431
+ if (l !== 46) {
432
+ if (i = l === 48, n += 1, l = s.charCodeAt(n), i && n < t && l && H(l)) {
433
+ e.err = `${E}: ${U} at index ${r}, "${s[r]}" illegal number`;
434
+ return;
435
+ }
436
+ for (; n < t && H(s.charCodeAt(n)); )
437
+ n += 1, o = !0;
438
+ l = s.charCodeAt(n);
439
+ }
440
+ if (l === 46) {
441
+ for (c = !0, n += 1; H(s.charCodeAt(n)); )
442
+ n += 1, a = !0;
443
+ l = s.charCodeAt(n);
444
+ }
445
+ if (l === 101 || l === 69) {
446
+ if (c && !o && !a) {
447
+ e.err = `${E}: ${U} at index ${n}, "${s[n]}" invalid float exponent`;
448
+ return;
449
+ }
450
+ if (n += 1, l = s.charCodeAt(n), (l === 43 || l === 45) && (n += 1), n < t && H(s.charCodeAt(n)))
451
+ for (; n < t && H(s.charCodeAt(n)); )
452
+ n += 1;
453
+ else {
454
+ e.err = `${E}: ${U} at index ${n}, "${s[n]}" invalid integer exponent`;
455
+ return;
456
+ }
457
+ }
458
+ e.index = n, e.param = +e.pathValue.slice(r, n);
459
+ }, ue = (e) => [
460
+ // Special spaces
461
+ 5760,
462
+ 6158,
463
+ 8192,
464
+ 8193,
465
+ 8194,
466
+ 8195,
467
+ 8196,
468
+ 8197,
469
+ 8198,
470
+ 8199,
471
+ 8200,
472
+ 8201,
473
+ 8202,
474
+ 8239,
475
+ 8287,
476
+ 12288,
477
+ 65279,
478
+ // Line terminators
479
+ 10,
480
+ 13,
481
+ 8232,
482
+ 8233,
483
+ // White spaces
484
+ 32,
485
+ 9,
486
+ 11,
487
+ 12,
488
+ 160
489
+ ].includes(e), st = (e) => {
490
+ const { pathValue: t, max: s } = e;
491
+ for (; e.index < s && ue(t.charCodeAt(e.index)); )
492
+ e.index += 1;
493
+ }, me = (e) => {
494
+ switch (e | 32) {
495
+ case 109:
496
+ case 122:
497
+ case 108:
498
+ case 104:
499
+ case 118:
500
+ case 99:
501
+ case 115:
502
+ case 113:
503
+ case 116:
504
+ case 97:
505
+ return !0;
506
+ default:
507
+ return !1;
508
+ }
509
+ }, he = (e) => H(e) || e === 43 || e === 45 || e === 46, fe = (e) => (e | 32) === 97, ye = (e) => {
510
+ switch (e | 32) {
511
+ case 109:
512
+ case 77:
513
+ return !0;
514
+ default:
515
+ return !1;
516
+ }
517
+ }, Et = (e) => {
518
+ var c;
519
+ const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o = nt[s[r].toLowerCase()];
520
+ if (e.segmentStart = r, !me(i)) {
521
+ e.err = `${E}: ${U} "${s[r]}" is not a path command at index ${r}`;
522
+ return;
523
+ }
524
+ const a = n[n.length - 1];
525
+ if (!ye(i) && ((c = a == null ? void 0 : a[0]) == null ? void 0 : c.toLocaleLowerCase()) === "z") {
526
+ e.err = `${E}: ${U} "${s[r]}" is not a MoveTo path command at index ${r}`;
527
+ return;
528
+ }
529
+ if (e.index += 1, st(e), e.data = [], !o) {
530
+ Tt(e);
531
+ return;
532
+ }
533
+ for (; ; ) {
534
+ for (let l = o; l > 0; l -= 1) {
535
+ if (fe(i) && (l === 3 || l === 4) ? ae(e) : le(e), e.err.length)
536
+ return;
537
+ e.data.push(e.param), st(e), e.index < t && s.charCodeAt(e.index) === 44 && (e.index += 1, st(e));
602
538
  }
539
+ if (e.index >= e.max || !he(s.charCodeAt(e.index)))
540
+ break;
541
+ }
542
+ Tt(e);
543
+ };
544
+ class Rt {
545
+ constructor(t) {
546
+ this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
547
+ }
548
+ }
549
+ const R = (e) => {
550
+ if (typeof e != "string")
551
+ return e.slice(0);
552
+ const t = new Rt(e);
553
+ for (st(t); t.index < t.max && !t.err.length; )
554
+ Et(t);
555
+ if (t != null && t.err.length)
556
+ throw TypeError(t.err);
557
+ return t.segments;
558
+ }, jt = (e, t, s, r) => {
559
+ const [n] = e, i = n.toUpperCase();
560
+ if (t === 0 || i === n) return e;
561
+ if (i === "A")
562
+ return [
563
+ i,
564
+ e[1],
565
+ e[2],
566
+ e[3],
567
+ e[4],
568
+ e[5],
569
+ e[6] + s,
570
+ e[7] + r
571
+ ];
572
+ if (i === "V")
573
+ return [i, e[1] + r];
574
+ if (i === "H")
575
+ return [i, e[1] + s];
576
+ if (i === "L")
577
+ return [i, e[1] + s, e[2] + r];
578
+ {
579
+ const a = e.slice(1).map((c, l) => c + (l % 2 ? r : s));
580
+ return [i].concat(a);
581
+ }
582
+ }, j = (e, t) => {
583
+ let s = e.length, r, n = "M", i = "M", o = !1, a = 0, c = 0, l = 0, u = 0, m = 0;
584
+ for (let f = 0; f < s; f += 1) {
585
+ r = e[f], [n] = r, m = r.length, i = n.toUpperCase(), o = i !== n;
586
+ const y = t(r, f, a, c);
587
+ if (y === !1)
588
+ break;
589
+ i === "Z" ? (a = l, c = u) : i === "H" ? a = r[1] + (o ? a : 0) : i === "V" ? c = r[1] + (o ? c : 0) : (a = r[m - 2] + (o ? a : 0), c = r[m - 1] + (o ? c : 0), i === "M" && (l = a, u = c)), y && (e[f] = y, y[0] === "C" && (s = e.length));
603
590
  }
604
591
  return e;
592
+ }, xt = (e) => {
593
+ const t = R(e);
594
+ return j(t, jt);
595
+ }, St = (e, t, s, r) => {
596
+ const [n] = e, i = n.toLowerCase();
597
+ if (t === 0 || n === i) return e;
598
+ if (i === "a")
599
+ return [
600
+ i,
601
+ e[1],
602
+ e[2],
603
+ e[3],
604
+ e[4],
605
+ e[5],
606
+ e[6] - s,
607
+ e[7] - r
608
+ ];
609
+ if (i === "v")
610
+ return [i, e[1] - r];
611
+ if (i === "h")
612
+ return [i, e[1] - s];
613
+ if (i === "l")
614
+ return [i, e[1] - s, e[2] - r];
615
+ {
616
+ const a = e.slice(1).map((c, l) => c - (l % 2 ? r : s));
617
+ return [i].concat(a);
618
+ }
619
+ }, Xt = (e) => {
620
+ const t = R(e);
621
+ return j(t, St);
622
+ }, ct = (e, t, s) => {
623
+ const { sin: r, cos: n } = Math, i = e * n(s) - t * r(s), o = e * r(s) + t * n(s);
624
+ return { x: i, y: o };
625
+ }, Dt = (e, t, s, r, n, i, o, a, c, l) => {
626
+ let u = e, m = t, f = s, y = r, h = a, x = c;
627
+ const b = Math.PI * 120 / 180, A = Math.PI / 180 * (+n || 0);
628
+ let w = [], N, M, d, v, L;
629
+ if (l)
630
+ [M, d, v, L] = l;
631
+ else {
632
+ N = ct(u, m, -A), u = N.x, m = N.y, N = ct(h, x, -A), h = N.x, x = N.y;
633
+ const $ = (u - h) / 2, P = (m - x) / 2;
634
+ let Q = $ * $ / (f * f) + P * P / (y * y);
635
+ Q > 1 && (Q = Math.sqrt(Q), f *= Q, y *= Q);
636
+ const F = f * f, D = y * y, Ut = (i === o ? -1 : 1) * Math.sqrt(Math.abs((F * D - F * P * P - D * $ * $) / (F * P * P + D * $ * $)));
637
+ v = Ut * f * P / y + (u + h) / 2, L = Ut * -y * $ / f + (m + x) / 2, M = Math.asin(((m - L) / y * 10 ** 9 >> 0) / 10 ** 9), d = Math.asin(((x - L) / y * 10 ** 9 >> 0) / 10 ** 9), M = u < v ? Math.PI - M : M, d = h < v ? Math.PI - d : d, M < 0 && (M = Math.PI * 2 + M), d < 0 && (d = Math.PI * 2 + d), o && M > d && (M -= Math.PI * 2), !o && d > M && (d -= Math.PI * 2);
638
+ }
639
+ let T = d - M;
640
+ if (Math.abs(T) > b) {
641
+ const $ = d, P = h, Q = x;
642
+ d = M + b * (o && d > M ? 1 : -1), h = v + f * Math.cos(d), x = L + y * Math.sin(d), w = Dt(h, x, f, y, n, 0, o, P, Q, [d, $, v, L]);
643
+ }
644
+ T = d - M;
645
+ const Z = Math.cos(M), k = Math.sin(M), it = Math.cos(d), tt = Math.sin(d), _ = Math.tan(T / 4), et = 4 / 3 * f * _, I = 4 / 3 * y * _, J = [u, m], S = [u + et * k, m - I * Z], Y = [h + et * tt, x - I * it], K = [h, x];
646
+ if (S[0] = 2 * J[0] - S[0], S[1] = 2 * J[1] - S[1], l)
647
+ return [S[0], S[1], Y[0], Y[1], K[0], K[1]].concat(w);
648
+ w = [S[0], S[1], Y[0], Y[1], K[0], K[1]].concat(w);
649
+ const ot = [];
650
+ for (let $ = 0, P = w.length; $ < P; $ += 1)
651
+ ot[$] = $ % 2 ? ct(w[$ - 1], w[$], A).y : ct(w[$], w[$ + 1], A).x;
652
+ return ot;
653
+ }, xe = (e, t, s, r, n, i) => {
654
+ const o = 0.3333333333333333, a = 2 / 3;
655
+ return [
656
+ o * e + a * s,
657
+ // cpx1
658
+ o * t + a * r,
659
+ // cpy1
660
+ o * n + a * s,
661
+ // cpx2
662
+ o * i + a * r,
663
+ // cpy2
664
+ n,
665
+ i
666
+ // x,y
667
+ ];
668
+ }, O = (e, t, s) => {
669
+ const [r, n] = e, [i, o] = t;
670
+ return [r + (i - r) * s, n + (o - n) * s];
671
+ }, Ct = (e, t, s, r) => {
672
+ const n = O([e, t], [s, r], 0.3333333333333333), i = O([e, t], [s, r], 2 / 3);
673
+ return [n[0], n[1], i[0], i[1], s, r];
674
+ }, Zt = (e, t) => {
675
+ const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1: a, x: c, y: l } = t;
676
+ return "TQ".includes(s) || (t.qx = null, t.qy = null), s === "M" ? (t.x = n, t.y = i, e) : s === "A" ? ["C"].concat(
677
+ Dt(o, a, r[0], r[1], r[2], r[3], r[4], r[5], r[6])
678
+ ) : s === "Q" ? (t.qx = n, t.qy = i, ["C"].concat(
679
+ xe(o, a, r[0], r[1], r[2], r[3])
680
+ )) : s === "L" ? ["C"].concat(Ct(o, a, n, i)) : s === "Z" ? ["C"].concat(Ct(o, a, c, l)) : e;
605
681
  }, G = (e, t) => {
606
- const [n] = e, { x1: r, y1: s, x2: i, y2: o } = t, c = e.slice(1).map(Number);
607
- if ("TQ".includes(n) || (t.qx = null, t.qy = null), n === "H")
608
- return ["L", e[1], s];
609
- if (n === "V")
610
- return ["L", r, e[1]];
611
- if (n === "S") {
612
- const l = r * 2 - i, a = s * 2 - o;
613
- return t.x1 = l, t.y1 = a, ["C", l, a, ...c];
614
- } else if (n === "T") {
615
- const l = r * 2 - (t.qx ? t.qx : (
682
+ const [s] = e, r = s.toUpperCase(), n = s !== r, { x1: i, y1: o, x2: a, y2: c, x: l, y: u } = t, m = e.slice(1);
683
+ let f = m.map((y, h) => y + (n ? h % 2 ? u : l : 0));
684
+ if ("TQ".includes(r) || (t.qx = null, t.qy = null), r === "A")
685
+ return f = m.slice(0, -2).concat(m[5] + (n ? l : 0), m[6] + (n ? u : 0)), ["A"].concat(f);
686
+ if (r === "H")
687
+ return ["L", e[1] + (n ? l : 0), o];
688
+ if (r === "V")
689
+ return ["L", i, e[1] + (n ? u : 0)];
690
+ if (r === "L")
691
+ return [
692
+ "L",
693
+ e[1] + (n ? l : 0),
694
+ e[2] + (n ? u : 0)
695
+ ];
696
+ if (r === "M")
697
+ return [
698
+ "M",
699
+ e[1] + (n ? l : 0),
700
+ e[2] + (n ? u : 0)
701
+ ];
702
+ if (r === "C")
703
+ return ["C"].concat(f);
704
+ if (r === "S") {
705
+ const y = i * 2 - a, h = o * 2 - c;
706
+ return t.x1 = y, t.y1 = h, ["C", y, h].concat(f);
707
+ } else if (r === "T") {
708
+ const y = i * 2 - (t.qx ? t.qx : (
616
709
  /* istanbul ignore next */
617
710
  0
618
- )), a = s * 2 - (t.qy ? t.qy : (
711
+ )), h = o * 2 - (t.qy ? t.qy : (
619
712
  /* istanbul ignore next */
620
713
  0
621
714
  ));
622
- return t.qx = l, t.qy = a, ["Q", l, a, ...c];
623
- } else if (n === "Q") {
624
- const [l, a] = c;
625
- t.qx = l, t.qy = a;
626
- }
715
+ return t.qx = y, t.qy = h, ["Q", y, h].concat(f);
716
+ } else if (r === "Q") {
717
+ const [y, h] = f;
718
+ return t.qx = y, t.qy = h, ["Q"].concat(f);
719
+ } else if (r === "Z")
720
+ return ["Z"];
627
721
  return e;
628
- }, R = (e, t, n) => {
629
- const [r, s] = e, [i, o] = t;
630
- return [r + (i - r) * n, s + (o - s) * n];
631
- }, at = (e, t, n, r) => Pt([e, t], [n, r]), Gt = (e, t, n, r, s) => {
632
- const i = Pt([e, t], [n, r]);
633
- let o = { x: e, y: t };
634
- if (typeof s == "number")
635
- if (s <= 0)
636
- o = { x: e, y: t };
637
- else if (s >= i)
638
- o = { x: n, y: r };
722
+ }, X = {
723
+ x1: 0,
724
+ y1: 0,
725
+ x2: 0,
726
+ y2: 0,
727
+ x: 0,
728
+ y: 0,
729
+ qx: null,
730
+ qy: null
731
+ }, gt = (e) => {
732
+ const t = { ...X }, s = R(e);
733
+ return j(s, (r, n, i, o) => {
734
+ t.x = i, t.y = o;
735
+ const a = G(r, t);
736
+ let c = Zt(a, t);
737
+ c[0] === "C" && c.length > 7 && (s.splice(n + 1, 0, ["C"].concat(c.slice(7))), c = c.slice(0, 7));
738
+ const u = c.length;
739
+ 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;
740
+ });
741
+ }, z = (e, t) => {
742
+ const s = t >= 1 ? 10 ** t : 1;
743
+ return t > 0 ? Math.round(e * s) / s : Math.round(e);
744
+ }, $t = (e, t) => {
745
+ const s = e.length;
746
+ let { round: r } = V, n = e[0], i = "";
747
+ r = t === "off" || typeof t == "number" && t >= 0 ? t : typeof r == "number" && r >= 0 ? r : (
748
+ /* istanbul ignore next @preserve */
749
+ "off"
750
+ );
751
+ for (let o = 0; o < s; o += 1) {
752
+ n = e[o];
753
+ const [a] = n, c = n.slice(1);
754
+ if (i += a, r === "off")
755
+ i += c.join(" ");
639
756
  else {
640
- const [c, l] = R([e, t], [n, r], s / i);
641
- o = { x: c, y: l };
757
+ let l = 0;
758
+ const u = c.length;
759
+ for (; l < u; )
760
+ i += z(c[l], r), l !== u - 1 && (i += " "), l += 1;
642
761
  }
643
- return o;
644
- }, kt = (e, t, n, r) => {
645
- const { min: s, max: i } = Math;
762
+ }
763
+ return i;
764
+ }, Mt = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), lt = (e, t, s, r) => Mt([e, t], [s, r]), Ot = (e, t, s, r, n) => {
765
+ let i = { x: e, y: t };
766
+ if (typeof n == "number") {
767
+ const o = Mt([e, t], [s, r]);
768
+ if (n <= 0)
769
+ i = { x: e, y: t };
770
+ else if (n >= o)
771
+ i = { x: s, y: r };
772
+ else {
773
+ const [a, c] = O([e, t], [s, r], n / o);
774
+ i = { x: a, y: c };
775
+ }
776
+ }
777
+ return i;
778
+ }, zt = (e, t, s, r) => {
779
+ const { min: n, max: i } = Math;
646
780
  return {
647
781
  min: {
648
- x: s(e, n),
649
- y: s(t, r)
782
+ x: n(e, s),
783
+ y: n(t, r)
650
784
  },
651
785
  max: {
652
- x: i(e, n),
786
+ x: i(e, s),
653
787
  y: i(t, r)
654
788
  }
655
789
  };
656
- }, te = (e, t, n) => {
657
- const r = n / 2, s = Math.sin(r), i = Math.cos(r), o = e ** 2 * s ** 2, c = t ** 2 * i ** 2, l = Math.sqrt(o + c) * n;
658
- return Math.abs(l);
659
- }, K = (e, t, n, r, s, i) => {
660
- const o = Math.cos(i), c = Math.sin(i), l = r * Math.cos(e), a = s * Math.sin(e);
790
+ }, Qt = (e, t, s) => {
791
+ const r = s / 2, n = Math.sin(r), i = Math.cos(r), o = e ** 2 * n ** 2, a = t ** 2 * i ** 2, c = Math.sqrt(o + a) * s;
792
+ return Math.abs(c);
793
+ }, W = (e, t, s, r, n, i) => {
794
+ const { sin: o, cos: a } = Math, c = a(n), l = o(n), u = s * a(i), m = r * o(i);
661
795
  return {
662
- x: t + o * l - c * a,
663
- y: n + c * l + o * a
796
+ x: e + c * u - l * m,
797
+ y: t + l * u + c * m
664
798
  };
665
- }, qt = (e, t) => {
666
- const { x: n, y: r } = e, { x: s, y: i } = t, o = n * s + r * i, c = Math.sqrt((n ** 2 + r ** 2) * (s ** 2 + i ** 2));
667
- return (n * i - r * s < 0 ? -1 : 1) * Math.acos(o / c);
668
- }, Lt = (e, t, n, r, s, i, o, c, l) => {
669
- const { abs: a, sin: m, cos: u, sqrt: g, PI: f } = Math;
670
- let h = a(n), y = a(r);
671
- const p = (s % 360 + 360) % 360 * (f / 180);
672
- if (e === c && t === l)
799
+ }, Pt = (e, t) => {
800
+ const { x: s, y: r } = e, { x: n, y: i } = t, o = s * n + r * i, a = Math.sqrt((s ** 2 + r ** 2) * (n ** 2 + i ** 2));
801
+ return (s * i - r * n < 0 ? -1 : 1) * Math.acos(o / a);
802
+ }, wt = (e, t, s, r, n, i, o, a, c) => {
803
+ const { abs: l, sin: u, cos: m, sqrt: f, PI: y } = Math;
804
+ let h = l(s), x = l(r);
805
+ const A = (n % 360 + 360) % 360 * (y / 180);
806
+ if (e === a && t === c)
673
807
  return {
674
808
  rx: h,
675
- ry: y,
809
+ ry: x,
676
810
  startAngle: 0,
677
811
  endAngle: 0,
678
- center: { x: c, y: l }
812
+ center: { x: a, y: c }
679
813
  };
680
- if (h === 0 || y === 0)
814
+ if (h === 0 || x === 0)
681
815
  return {
682
816
  rx: h,
683
- ry: y,
817
+ ry: x,
684
818
  startAngle: 0,
685
819
  endAngle: 0,
686
- center: { x: c, y: l }
820
+ center: { x: (a + e) / 2, y: (c + t) / 2 }
687
821
  };
688
- const d = (e - c) / 2, C = (t - l) / 2, M = {
689
- x: u(p) * d + m(p) * C,
690
- y: -m(p) * d + u(p) * C
691
- }, b = M.x ** 2 / h ** 2 + M.y ** 2 / y ** 2;
692
- b > 1 && (h *= g(b), y *= g(b));
693
- const w = h ** 2 * y ** 2 - h ** 2 * M.y ** 2 - y ** 2 * M.x ** 2, T = h ** 2 * M.y ** 2 + y ** 2 * M.x ** 2;
694
- let P = w / T;
695
- P = P < 0 ? 0 : P;
696
- const $ = (i !== o ? 1 : -1) * g(P), S = {
697
- x: $ * (h * M.y / y),
698
- y: $ * (-(y * M.x) / h)
699
- }, _ = {
700
- x: u(p) * S.x - m(p) * S.y + (e + c) / 2,
701
- y: m(p) * S.x + u(p) * S.y + (t + l) / 2
702
- }, X = {
703
- x: (M.x - S.x) / h,
704
- y: (M.y - S.y) / y
705
- }, Q = qt({ x: 1, y: 0 }, X), B = {
706
- x: (-M.x - S.x) / h,
707
- y: (-M.y - S.y) / y
822
+ const w = (e - a) / 2, N = (t - c) / 2, M = {
823
+ x: m(A) * w + u(A) * N,
824
+ y: -u(A) * w + m(A) * N
825
+ }, d = M.x ** 2 / h ** 2 + M.y ** 2 / x ** 2;
826
+ d > 1 && (h *= f(d), x *= f(d));
827
+ const v = h ** 2 * x ** 2 - h ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, L = h ** 2 * M.y ** 2 + x ** 2 * M.x ** 2;
828
+ let T = v / L;
829
+ T = T < 0 ? 0 : T;
830
+ const Z = (i !== o ? 1 : -1) * f(T), k = {
831
+ x: Z * (h * M.y / x),
832
+ y: Z * (-(x * M.x) / h)
833
+ }, it = {
834
+ x: m(A) * k.x - u(A) * k.y + (e + a) / 2,
835
+ y: u(A) * k.x + m(A) * k.y + (t + c) / 2
836
+ }, tt = {
837
+ x: (M.x - k.x) / h,
838
+ y: (M.y - k.y) / x
839
+ }, _ = Pt({ x: 1, y: 0 }, tt), et = {
840
+ x: (-M.x - k.x) / h,
841
+ y: (-M.y - k.y) / x
708
842
  };
709
- let I = qt(X, B);
710
- !o && I > 0 ? I -= 2 * f : o && I < 0 && (I += 2 * f), I %= 2 * f;
711
- const J = Q + I;
843
+ let I = Pt(tt, et);
844
+ !o && I > 0 ? I -= 2 * y : o && I < 0 && (I += 2 * y), I %= 2 * y;
845
+ const J = _ + I;
712
846
  return {
713
- center: _,
714
- startAngle: Q,
847
+ center: it,
848
+ startAngle: _,
715
849
  endAngle: J,
716
850
  rx: h,
717
- ry: y
851
+ ry: x
718
852
  };
719
- }, ee = (e, t, n, r, s, i, o, c, l) => {
720
- const { rx: a, ry: m, startAngle: u, endAngle: g } = Lt(e, t, n, r, s, i, o, c, l);
721
- return te(a, m, g - u);
722
- }, Pe = (e, t, n, r, s, i, o, c, l, a) => {
723
- let m = { x: e, y: t };
724
- const { center: u, rx: g, ry: f, startAngle: h, endAngle: y } = Lt(e, t, n, r, s, i, o, c, l), x = te(g, f, y - h);
725
- if (typeof a == "number")
726
- if (a <= 0)
727
- m = { x: e, y: t };
728
- else if (a >= x)
729
- m = { x: c, y: l };
853
+ }, Bt = (e, t, s, r, n, i, o, a, c) => {
854
+ const { rx: l, ry: u, startAngle: m, endAngle: f } = wt(e, t, s, r, n, i, o, a, c);
855
+ return Qt(l, u, f - m);
856
+ }, ge = (e, t, s, r, n, i, o, a, c, l) => {
857
+ let u = { x: e, y: t };
858
+ const { center: m, rx: f, ry: y, startAngle: h, endAngle: x } = wt(e, t, s, r, n, i, o, a, c);
859
+ if (typeof l == "number") {
860
+ const b = Qt(f, y, x - h);
861
+ if (l <= 0)
862
+ u = { x: e, y: t };
863
+ else if (l >= b)
864
+ u = { x: a, y: c };
730
865
  else {
731
- if (e === c && t === l)
732
- return { x: c, y: l };
733
- if (g === 0 || f === 0)
734
- return Gt(e, t, c, l, a);
735
- const { PI: p, cos: d, sin: C } = Math, M = y - h, w = (s % 360 + 360) % 360 * (p / 180), T = h + M * (a / x), P = g * d(T), $ = f * C(T);
736
- m = {
737
- x: d(w) * P - C(w) * $ + u.x,
738
- y: C(w) * P + d(w) * $ + u.y
866
+ if (e === a && t === c)
867
+ return { x: a, y: c };
868
+ if (f === 0 || y === 0)
869
+ return Ot(e, t, a, c, l);
870
+ const { PI: A, cos: w, sin: N } = Math, M = x - h, v = (n % 360 + 360) % 360 * (A / 180), L = h + M * (l / b), T = f * w(L), Z = y * N(L);
871
+ u = {
872
+ x: w(v) * T - N(v) * Z + m.x,
873
+ y: N(v) * T + w(v) * Z + m.y
739
874
  };
740
875
  }
741
- return m;
742
- }, Le = (e, t, n, r, s, i, o, c, l) => {
743
- const { center: a, rx: m, ry: u, startAngle: g, endAngle: f } = Lt(e, t, n, r, s, i, o, c, l), h = f - g, y = { x: c, y: l }, [x, p] = [a.x, a.y], d = [y], C = s * Math.PI / 180, M = Math.tan(C), b = Math.atan2(-u * M, m), w = b, T = b + Math.PI, P = Math.atan2(u, m * M), $ = P + Math.PI, S = [e, c], _ = [t, l], X = Math.min(...S), Q = Math.max(...S), B = Math.min(..._), I = Math.max(..._), J = f - h * 1e-3, z = K(J, x, p, m, u, C), ot = f - h * 0.999, Y = K(ot, x, p, m, u, C);
744
- return (z.x > Q || Y.x > Q) && d.push(K(w, x, p, m, u, C)), (z.x < X || Y.x < X) && d.push(K(T, x, p, m, u, C)), (z.y < B || Y.y < B) && d.push(K($, x, p, m, u, C)), (z.y > I || Y.y > I) && d.push(K(P, x, p, m, u, C)), {
876
+ }
877
+ return u;
878
+ }, pe = (e, t, s, r, n, i, o, a, c) => {
879
+ const { center: l, rx: u, ry: m, startAngle: f, endAngle: y } = wt(e, t, s, r, n, i, o, a, c), h = y - f, { min: x, max: b, tan: A, atan2: w, PI: N } = Math, M = { x: a, y: c }, { x: d, y: v } = l, L = [M], T = n * N / 180, Z = A(T), k = w(-m * Z, u), it = k, tt = k + N, _ = w(m, u * Z), et = _ + N, I = [e, a], J = [t, c], S = x(...I), Y = b(...I), K = x(...J), ot = b(...J), $ = y - h * 1e-3, P = W(d, v, u, m, T, $), Q = y - h * 0.999, F = W(d, v, u, m, T, Q);
880
+ return (P.x > Y || F.x > Y) && L.push(W(d, v, u, m, T, it)), (P.x < S || F.x < S) && L.push(W(d, v, u, m, T, tt)), (P.y < K || F.y < K) && L.push(W(d, v, u, m, T, et)), (P.y > ot || F.y > ot) && L.push(W(d, v, u, m, T, _)), {
745
881
  min: {
746
- x: Math.min(...d.map((O) => O.x)),
747
- y: Math.min(...d.map((O) => O.y))
882
+ x: x(...L.map((D) => D.x)),
883
+ y: x(...L.map((D) => D.y))
748
884
  },
749
885
  max: {
750
- x: Math.max(...d.map((O) => O.x)),
751
- y: Math.max(...d.map((O) => O.y))
886
+ x: b(...L.map((D) => D.x)),
887
+ y: b(...L.map((D) => D.y))
752
888
  }
753
889
  };
754
- }, Te = { x: 0, y: 0 }, It = [
890
+ }, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
891
+ __proto__: null,
892
+ angleBetween: Pt,
893
+ arcLength: Qt,
894
+ arcPoint: W,
895
+ getArcBBox: pe,
896
+ getArcLength: Bt,
897
+ getArcProps: wt,
898
+ getPointAtArcLength: ge
899
+ }, Symbol.toStringTag, { value: "Module" })), qt = [
755
900
  -0.06405689286260563,
756
901
  0.06405689286260563,
757
902
  -0.1911188674736163,
@@ -776,7 +921,7 @@ const gt = {
776
921
  0.9747285559713095,
777
922
  -0.9951872199970213,
778
923
  0.9951872199970213
779
- ], Se = [
924
+ ], be = [
780
925
  0.12793819534675216,
781
926
  0.12793819534675216,
782
927
  0.1258374563468283,
@@ -801,312 +946,284 @@ const gt = {
801
946
  0.028531388628933663,
802
947
  0.0123412297999872,
803
948
  0.0123412297999872
804
- ], $e = (e) => {
949
+ ], de = (e) => {
805
950
  const t = [];
806
- for (let n = e, r = n.length, s = r - 1; r > 1; r -= 1, s -= 1) {
951
+ for (let s = e, r = s.length, n = r - 1; r > 1; r -= 1, n -= 1) {
807
952
  const i = [];
808
- for (let o = 0; o < s; o += 1)
953
+ for (let o = 0; o < n; o += 1)
809
954
  i.push({
810
- x: s * (n[o + 1].x - n[o].x),
811
- y: s * (n[o + 1].y - n[o].y),
955
+ x: n * (s[o + 1].x - s[o].x),
956
+ y: n * (s[o + 1].y - s[o].y),
812
957
  t: 0
813
958
  });
814
- t.push(i), n = i;
959
+ t.push(i), s = i;
815
960
  }
816
961
  return t;
817
- }, ke = (e, t) => {
962
+ }, Ae = (e, t) => {
818
963
  if (t === 0)
819
964
  return e[0].t = 0, e[0];
820
- const n = e.length - 1;
965
+ const s = e.length - 1;
821
966
  if (t === 1)
822
- return e[n].t = 1, e[n];
967
+ return e[s].t = 1, e[s];
823
968
  const r = 1 - t;
824
- let s = e;
825
- if (n === 0)
969
+ let n = e;
970
+ if (s === 0)
826
971
  return e[0].t = t, e[0];
827
- if (n === 1)
972
+ if (s === 1)
828
973
  return {
829
- x: r * s[0].x + t * s[1].x,
830
- y: r * s[0].y + t * s[1].y,
974
+ x: r * n[0].x + t * n[1].x,
975
+ y: r * n[0].y + t * n[1].y,
831
976
  t
832
977
  };
833
978
  const i = r * r, o = t * t;
834
- let c = 0, l = 0, a = 0, m = 0;
835
- return n === 2 ? (s = [s[0], s[1], s[2], Te], c = i, l = r * t * 2, a = o) : n === 3 && (c = i * r, l = i * t * 3, a = r * o * 3, m = t * o), {
836
- x: c * s[0].x + l * s[1].x + a * s[2].x + m * s[3].x,
837
- y: c * s[0].y + l * s[1].y + a * s[2].y + m * s[3].y,
979
+ let a = 0, c = 0, l = 0, u = 0;
980
+ return s === 2 ? (n = [n[0], n[1], n[2], { x: 0, y: 0 }], a = i, c = r * t * 2, l = o) : s === 3 && (a = i * r, c = i * t * 3, l = r * o * 3, u = t * o), {
981
+ x: a * n[0].x + c * n[1].x + l * n[2].x + u * n[3].x,
982
+ y: a * n[0].y + c * n[1].y + l * n[2].y + u * n[3].y,
838
983
  t
839
984
  };
840
- }, qe = (e, t) => {
841
- const n = e(t), r = n.x * n.x + n.y * n.y;
985
+ }, Me = (e, t) => {
986
+ const s = e(t), r = s.x * s.x + s.y * s.y;
842
987
  return Math.sqrt(r);
843
- }, Ie = (e) => {
844
- const n = It.length;
988
+ }, we = (e) => {
989
+ const s = qt.length;
845
990
  let r = 0;
846
- for (let s = 0, i; s < n; s++)
847
- i = 0.5 * It[s] + 0.5, r += Se[s] * qe(e, i);
991
+ for (let n = 0, i; n < s; n++)
992
+ i = 0.5 * qt[n] + 0.5, r += be[n] * Me(e, i);
848
993
  return 0.5 * r;
849
- }, xt = (e) => {
994
+ }, ft = (e) => {
850
995
  const t = [];
851
- for (let r = 0, s = e.length, i = 2; r < s; r += i)
996
+ for (let r = 0, n = e.length, i = 2; r < n; r += i)
852
997
  t.push({
853
998
  x: e[r],
854
999
  y: e[r + 1]
855
1000
  });
856
- const n = $e(t);
857
- return Ie((r) => ke(n[0], r));
858
- }, Ee = 1e-8, Nt = (e) => {
859
- const t = Math.min(e[0], e[2]), n = Math.max(e[0], e[2]);
860
- if (e[1] >= e[0] ? e[2] >= e[1] : e[2] <= e[1])
861
- return [t, n];
862
- const r = (e[0] * e[2] - e[1] * e[1]) / (e[0] - 2 * e[1] + e[2]);
863
- return r < t ? [r, n] : [t, r];
864
- }, Et = (e) => {
865
- const t = e[0] - 3 * e[1] + 3 * e[2] - e[3];
866
- if (Math.abs(t) < Ee)
867
- return e[0] === e[3] && e[0] === e[1] ? [e[0], e[3]] : Nt([e[0], -0.5 * e[0] + 1.5 * e[1], e[0] - 3 * e[1] + 3 * e[2]]);
868
- const n = -e[0] * e[2] + e[0] * e[3] - e[1] * e[2] - e[1] * e[3] + e[1] * e[1] + e[2] * e[2];
869
- if (n <= 0)
870
- return [Math.min(e[0], e[3]), Math.max(e[0], e[3])];
871
- const r = Math.sqrt(n);
872
- let s = Math.min(e[0], e[3]), i = Math.max(e[0], e[3]);
873
- const o = e[0] - 2 * e[1] + e[2];
874
- for (let c = (o + r) / t, l = 1; l <= 2; c = (o - r) / t, l++)
875
- if (c > 0 && c < 1) {
876
- const a = e[0] * (1 - c) * (1 - c) * (1 - c) + e[1] * 3 * (1 - c) * (1 - c) * c + e[2] * 3 * (1 - c) * c * c + e[3] * c * c * c;
877
- a < s && (s = a), a > i && (i = a);
1001
+ const s = de(t);
1002
+ return we((r) => Ae(s[0], r));
1003
+ }, Ne = 1e-8, pt = ([e, t, s]) => {
1004
+ const r = Math.min(e, s), n = Math.max(e, s);
1005
+ if (t >= e ? s >= t : s <= t)
1006
+ return [r, n];
1007
+ const i = (e * s - t * t) / (e - 2 * t + s);
1008
+ return i < r ? [i, n] : [r, i];
1009
+ }, kt = ([e, t, s, r]) => {
1010
+ const n = e - 3 * t + 3 * s - r;
1011
+ if (Math.abs(n) < Ne)
1012
+ return e === r && e === t ? [e, r] : pt([e, -0.5 * e + 1.5 * t, e - 3 * t + 3 * s]);
1013
+ const i = -e * s + e * r - t * s - t * r + t * t + s * s;
1014
+ if (i <= 0)
1015
+ return [Math.min(e, r), Math.max(e, r)];
1016
+ const o = Math.sqrt(i);
1017
+ let a = Math.min(e, r), c = Math.max(e, r);
1018
+ const l = e - 2 * t + s;
1019
+ for (let u = (l + o) / n, m = 1; m <= 2; u = (l - o) / n, m++)
1020
+ if (u > 0 && u < 1) {
1021
+ const f = e * (1 - u) * (1 - u) * (1 - u) + t * 3 * (1 - u) * (1 - u) * u + s * 3 * (1 - u) * u * u + r * u * u * u;
1022
+ f < a && (a = f), f > c && (c = f);
878
1023
  }
879
- return [s, i];
880
- }, ze = ([e, t, n, r, s, i, o, c], l) => {
881
- const a = 1 - l;
1024
+ return [a, c];
1025
+ }, Le = ([e, t, s, r, n, i, o, a], c) => {
1026
+ const l = 1 - c;
882
1027
  return {
883
- x: a ** 3 * e + 3 * a ** 2 * l * n + 3 * a * l ** 2 * s + l ** 3 * o,
884
- y: a ** 3 * t + 3 * a ** 2 * l * r + 3 * a * l ** 2 * i + l ** 3 * c
1028
+ x: l ** 3 * e + 3 * l ** 2 * c * s + 3 * l * c ** 2 * n + c ** 3 * o,
1029
+ y: l ** 3 * t + 3 * l ** 2 * c * r + 3 * l * c ** 2 * i + c ** 3 * a
885
1030
  };
886
- }, ne = (e, t, n, r, s, i, o, c) => xt([e, t, n, r, s, i, o, c]), Ze = (e, t, n, r, s, i, o, c, l) => {
887
- const a = typeof l == "number";
888
- let m = { x: e, y: t };
889
- if (a) {
890
- const u = xt([e, t, n, r, s, i, o, c]);
891
- l <= 0 || (l >= u ? m = { x: o, y: c } : m = ze([e, t, n, r, s, i, o, c], l / u));
1031
+ }, _t = (e, t, s, r, n, i, o, a) => ft([e, t, s, r, n, i, o, a]), ve = (e, t, s, r, n, i, o, a, c) => {
1032
+ const l = typeof c == "number";
1033
+ let u = { x: e, y: t };
1034
+ if (l) {
1035
+ const m = ft([e, t, s, r, n, i, o, a]);
1036
+ c <= 0 || (c >= m ? u = { x: o, y: a } : u = Le([e, t, s, r, n, i, o, a], c / m));
892
1037
  }
893
- return m;
894
- }, Oe = (e, t, n, r, s, i, o, c) => {
895
- const l = Et([e, n, s, o]), a = Et([t, r, i, c]);
1038
+ return u;
1039
+ }, Te = (e, t, s, r, n, i, o, a) => {
1040
+ const c = kt([e, s, n, o]), l = kt([t, r, i, a]);
896
1041
  return {
897
- min: { x: l[0], y: a[0] },
898
- max: { x: l[1], y: a[1] }
1042
+ min: { x: c[0], y: l[0] },
1043
+ max: { x: c[1], y: l[1] }
899
1044
  };
900
- }, je = ([e, t, n, r, s, i], o) => {
901
- const c = 1 - o;
1045
+ }, Ce = ([e, t, s, r, n, i], o) => {
1046
+ const a = 1 - o;
902
1047
  return {
903
- x: c ** 2 * e + 2 * c * o * n + o ** 2 * s,
904
- y: c ** 2 * t + 2 * c * o * r + o ** 2 * i
1048
+ x: a ** 2 * e + 2 * a * o * s + o ** 2 * n,
1049
+ y: a ** 2 * t + 2 * a * o * r + o ** 2 * i
905
1050
  };
906
- }, se = (e, t, n, r, s, i) => xt([e, t, n, r, s, i]), Re = (e, t, n, r, s, i, o) => {
907
- const c = typeof o == "number";
908
- let l = { x: e, y: t };
909
- if (c) {
910
- const a = xt([e, t, n, r, s, i]);
911
- o <= 0 || (o >= a ? l = { x: s, y: i } : l = je([e, t, n, r, s, i], o / a));
1051
+ }, Ft = (e, t, s, r, n, i) => ft([e, t, s, r, n, i]), $e = (e, t, s, r, n, i, o) => {
1052
+ const a = typeof o == "number";
1053
+ let c = { x: e, y: t };
1054
+ if (a) {
1055
+ const l = ft([e, t, s, r, n, i]);
1056
+ o <= 0 || (o >= l ? c = { x: n, y: i } : c = Ce([e, t, s, r, n, i], o / l));
912
1057
  }
913
- return l;
914
- }, De = (e, t, n, r, s, i) => {
915
- const o = Nt([e, n, s]), c = Nt([t, r, i]);
916
- return {
917
- min: { x: o[0], y: c[0] },
918
- max: { x: o[1], y: c[1] }
919
- };
920
- }, zt = (e) => {
921
- if (!e)
922
- return {
923
- x: 0,
924
- y: 0,
925
- width: 0,
926
- height: 0,
927
- x2: 0,
928
- y2: 0,
929
- cx: 0,
930
- cy: 0,
931
- cz: 0
932
- };
933
- const t = q(e);
934
- let n = [], r = "M", s = 0, i = 0, o = 0, c = 0;
935
- const l = [], a = [];
936
- let m = { x: s, y: i }, u = { x: s, y: i };
937
- D(t, (d, C) => {
938
- const M = V(d, C), b = G(M, C);
939
- return [r] = b, n = [s, i, ...b.slice(1)], r === "M" ? ([, o, c] = b, m = { x: o, y: c }, u = { x: o, y: c }) : r === "L" ? { min: m, max: u } = kt(...n) : r === "A" ? { min: m, max: u } = Le(...n) : r === "C" ? { min: m, max: u } = Oe(...n) : r === "Q" ? { min: m, max: u } = De(...n) : r === "Z" && (n = [s, i, o, c], { min: m, max: u } = kt(...n)), l.push(m), a.push(u), r === "Z" ? (s = o, i = c) : ([s, i] = b.slice(-2), r === "M" && (o = s, c = i)), C.x = s, C.y = i, b;
940
- });
941
- const g = Math.min(...l.map((d) => d.x)), f = Math.max(...a.map((d) => d.x)), h = Math.min(...l.map((d) => d.y)), y = Math.max(...a.map((d) => d.y)), x = f - g, p = y - h;
1058
+ return c;
1059
+ }, ze = (e, t, s, r, n, i) => {
1060
+ const o = pt([e, s, n]), a = pt([t, r, i]);
942
1061
  return {
943
- width: x,
944
- height: p,
945
- x: g,
946
- y: h,
947
- x2: f,
948
- y2: y,
949
- cx: g + x / 2,
950
- cy: h + p / 2,
951
- // an estimated guess
952
- cz: Math.max(x, p) + Math.min(x, p) / 2
1062
+ min: { x: o[0], y: a[0] },
1063
+ max: { x: o[1], y: a[1] }
953
1064
  };
954
- }, ct = (e, t, n) => {
955
- const r = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
956
- return { x: r, y: s };
957
- }, re = (e, t, n, r, s, i, o, c, l, a) => {
958
- let m = e, u = t, g = n, f = r, h = c, y = l;
959
- const x = Math.PI * 120 / 180, p = Math.PI / 180 * (+s || 0);
960
- let d = [], C, M, b, w, T;
961
- if (a)
962
- [M, b, w, T] = a;
963
- else {
964
- C = ct(m, u, -p), m = C.x, u = C.y, C = ct(h, y, -p), h = C.x, y = C.y;
965
- const L = (m - h) / 2, Z = (u - y) / 2;
966
- let H = L * L / (g * g) + Z * Z / (f * f);
967
- H > 1 && (H = Math.sqrt(H), g *= H, f *= H);
968
- const Mt = g * g, bt = f * f, St = (i === o ? -1 : 1) * Math.sqrt(Math.abs((Mt * bt - Mt * Z * Z - bt * L * L) / (Mt * Z * Z + bt * L * L)));
969
- w = St * g * Z / f + (m + h) / 2, T = St * -f * L / g + (u + y) / 2, M = Math.asin(((u - T) / f * 10 ** 9 >> 0) / 10 ** 9), b = Math.asin(((y - T) / f * 10 ** 9 >> 0) / 10 ** 9), M = m < w ? Math.PI - M : M, b = h < w ? Math.PI - b : b, M < 0 && (M = Math.PI * 2 + M), b < 0 && (b = Math.PI * 2 + b), o && M > b && (M -= Math.PI * 2), !o && b > M && (b -= Math.PI * 2);
970
- }
971
- let P = b - M;
972
- if (Math.abs(P) > x) {
973
- const L = b, Z = h, H = y;
974
- b = M + x * (o && b > M ? 1 : -1), h = w + g * Math.cos(b), y = T + f * Math.sin(b), d = re(h, y, g, f, s, 0, o, Z, H, [b, L, w, T]);
975
- }
976
- P = b - M;
977
- const $ = Math.cos(M), S = Math.sin(M), _ = Math.cos(b), X = Math.sin(b), Q = Math.tan(P / 4), B = 4 / 3 * g * Q, I = 4 / 3 * f * Q, J = [m, u], z = [m + B * S, u - I * $], ot = [h + B * X, y - I * _], Y = [h, y];
978
- if (z[0] = 2 * J[0] - z[0], z[1] = 2 * J[1] - z[1], a)
979
- return [...z, ...ot, ...Y, ...d];
980
- d = [...z, ...ot, ...Y, ...d];
981
- const O = [];
982
- for (let L = 0, Z = d.length; L < Z; L += 1)
983
- O[L] = L % 2 ? ct(d[L - 1], d[L], p).y : ct(d[L], d[L + 1], p).x;
984
- return O;
985
- }, Qe = (e, t, n, r, s, i) => {
986
- const o = 0.3333333333333333, c = 2 / 3;
987
- return [
988
- o * e + c * n,
989
- // cpx1
990
- o * t + c * r,
991
- // cpy1
992
- o * s + c * n,
993
- // cpx2
994
- o * i + c * r,
995
- // cpy2
996
- s,
997
- i
998
- // x,y
999
- ];
1000
- }, Zt = (e, t, n, r) => {
1001
- const s = R([e, t], [n, r], 0.3333333333333333), i = R([e, t], [n, r], 2 / 3);
1002
- return [...s, ...i, n, r];
1003
- }, ie = (e, t) => {
1004
- const [n] = e, r = e.slice(1).map(Number), [s, i] = r;
1005
- let o;
1006
- const { x1: c, y1: l, x: a, y: m } = t;
1007
- return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [c, l, ...r], ["C", ...re(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [c, l, ...r], ["C", ...Qe(...o)]) : n === "L" ? ["C", ...Zt(c, l, s, i)] : n === "Z" ? ["C", ...Zt(c, l, a, m)] : e;
1008
- }, mt = (e) => {
1009
- let t = 0, n = 0, r = 0, s = 0, i = "M";
1010
- const o = q(e);
1011
- return D(o, (c, l, a) => {
1012
- const m = V(c, l);
1013
- [i] = m;
1014
- const u = i.toUpperCase(), g = G(m, l);
1015
- let f = ie(g, l);
1016
- return f[0] === "C" && f.length > 7 && (o.splice(a + 1, 0, ["C", ...f.slice(7)]), f = f.slice(0, 7)), u === "Z" ? (t = r, n = s) : ([t, n] = f.slice(-2), u === "M" && (r = t, s = n)), l.x = t, l.y = n, f;
1065
+ }, _e = (e) => {
1066
+ const t = e.length;
1067
+ let s = -1, r, n = e[t - 1], i = 0;
1068
+ for (; ++s < t; )
1069
+ r = n, n = e[s], i += r[1] * n[0] - r[0] * n[1];
1070
+ return i / 2;
1071
+ }, Fe = (e) => e.reduce((t, s, r) => r ? t + Mt(e[r - 1], s) : 0, 0), bt = 1e-5, ut = (e) => {
1072
+ const t = R(e), s = { ...X };
1073
+ return j(t, (r, n, i, o) => {
1074
+ s.x = i, s.y = o;
1075
+ const a = G(r, s), c = a.length;
1076
+ return s.x1 = +a[c - 2], s.y1 = +a[c - 1], s.x2 = +a[c - 4] || s.x1, s.y2 = +a[c - 3] || s.y1, a;
1017
1077
  });
1018
- }, Xe = (e, t, n, r, s, i, o, c) => 3 * ((c - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + c * (s + e / 3) - o * (i + t / 3)) / 20, oe = (e) => {
1019
- let t = 0, n = 0, r = 0;
1020
- return mt(e).map((s) => {
1021
- switch (s[0]) {
1022
- case "M":
1023
- return [, t, n] = s, 0;
1024
- default:
1025
- return r = Xe(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r;
1026
- }
1027
- }).reduce((s, i) => s + i, 0);
1028
- }, W = (e) => {
1029
- const t = q(e);
1030
- let n = !1, r = [], s = "M", i = 0, o = 0, c = 0, l = 0, a = 0;
1031
- return D(t, (m, u) => {
1032
- const g = V(m, u), f = G(g, u);
1033
- return [s] = f, n = s === "M", r = n ? r : [i, o, ...f.slice(1)], n ? [, c, l] = m : s === "L" ? a += at(...r) : s === "A" ? a += ee(...r) : s === "C" ? a += ne(...r) : s === "Q" ? a += se(...r) : s === "Z" && (r = [i, o, c, l], a += at(...r)), s === "Z" ? (i = c, o = l) : ([i, o] = f.slice(-2), n && (c = i, l = o)), u.x = i, u.y = o, f;
1034
- }), a;
1035
- }, Be = (e) => oe(mt(e)) >= 0, At = 1e-5, nt = (e, t) => {
1036
- const n = q(e);
1037
- let r = !1, s = [], i = "M", o = 0, c = 0, [l, a] = n[0].slice(1);
1038
- const m = typeof t == "number";
1039
- let u = { x: l, y: a }, g = 0, f = u, h = 0;
1040
- return m ? (t < At && (f = u), D(n, (y, x) => {
1041
- const p = V(y, x), d = G(p, x);
1042
- return [i] = d, r = i === "M", s = r ? s : [o, c, ...d.slice(1)], r ? ([, l, a] = y, u = { x: l, y: a }, g = 0) : i === "L" ? (u = Gt(...s, t - h), g = at(...s)) : i === "A" ? (u = Pe(...s, t - h), g = ee(...s)) : i === "C" ? (u = Ze(...s, t - h), g = ne(...s)) : i === "Q" ? (u = Re(...s, t - h), g = se(...s)) : i === "Z" && (s = [o, c, l, a], u = { x: l, y: a }, g = at(...s)), h < t && h + g >= t && (f = u), h += g, i === "Z" ? (o = l, c = a) : ([o, c] = d.slice(-2), i === "M" && (l = o, a = c)), x.x = o, x.y = c, d;
1043
- }), t > h - At && (f = { x: o, y: c }), f) : u;
1044
- }, Tt = (e, t) => {
1045
- const n = q(e);
1046
- let r = n.slice(0), s = W(r), i = r.length - 1, o = 0, c = 0, l = n[0];
1047
- const [a, m] = l.slice(-2), u = { x: a, y: m };
1078
+ }, at = (e, t) => {
1079
+ const s = ut(e);
1080
+ let r = !1, n = [], i = "M", o = 0, a = 0, [c, l] = s[0].slice(1);
1081
+ const u = typeof t == "number";
1082
+ let m = { x: c, y: l }, f = 0, y = m, h = 0;
1083
+ return !u || t < bt ? m : (j(s, (x, b, A, w) => {
1084
+ if ([i] = x, r = i === "M", n = r ? n : [A, w].concat(x.slice(1)), r ? ([, c, l] = x, m = { x: c, y: l }, f = 0) : i === "L" ? (m = Ot(n[0], n[1], n[2], n[3], t - h), f = lt(n[0], n[1], n[2], n[3])) : i === "A" ? (m = ge(
1085
+ n[0],
1086
+ n[1],
1087
+ n[2],
1088
+ n[3],
1089
+ n[4],
1090
+ n[5],
1091
+ n[6],
1092
+ n[7],
1093
+ n[8],
1094
+ t - h
1095
+ ), f = Bt(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8])) : i === "C" ? (m = ve(
1096
+ n[0],
1097
+ n[1],
1098
+ n[2],
1099
+ n[3],
1100
+ n[4],
1101
+ n[5],
1102
+ n[6],
1103
+ n[7],
1104
+ t - h
1105
+ ), f = _t(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])) : i === "Q" ? (m = $e(n[0], n[1], n[2], n[3], n[4], n[5], t - h), f = Ft(n[0], n[1], n[2], n[3], n[4], n[5])) : i === "Z" && (n = [A, w, c, l], m = { x: c, y: l }, f = lt(n[0], n[1], n[2], n[3])), [o, a] = n.slice(-2), h < t)
1106
+ y = m;
1107
+ else
1108
+ return !1;
1109
+ h += f;
1110
+ }), t > h - bt ? { x: o, y: a } : y);
1111
+ }, rt = (e) => {
1112
+ const t = R(e), s = { ...X };
1113
+ let r = !1, n = [], i = "M", o = 0, a = 0, c = 0;
1114
+ return j(t, (l, u, m, f) => {
1115
+ s.x = m, s.y = f;
1116
+ const y = G(l, s);
1117
+ [i] = y, r = i === "M", n = r ? n : [m, f].concat(y.slice(1)), r ? [, o, a] = y : i === "L" ? c += lt(n[0], n[1], n[2], n[3]) : i === "A" ? c += Bt(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8]) : i === "C" ? c += _t(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7]) : i === "Q" ? c += Ft(n[0], n[1], n[2], n[3], n[4], n[5]) : i === "Z" && (n = [m, f, o, a], c += lt(n[0], n[1], n[2], n[3]));
1118
+ const h = y.length;
1119
+ s.x1 = +y[h - 2], s.y1 = +y[h - 1], s.x2 = +y[h - 4] || s.x1, s.y2 = +y[h - 3] || s.y1;
1120
+ }), c;
1121
+ }, Ht = (e, t) => {
1122
+ const s = R(e);
1123
+ let r = s.slice(0), n = rt(r), i = r.length - 1, o = 0, a = 0, c = s[0];
1048
1124
  if (i <= 0 || !t || !Number.isFinite(t))
1049
1125
  return {
1050
- segment: l,
1126
+ segment: c,
1051
1127
  index: 0,
1052
- length: c,
1053
- point: u,
1128
+ length: a,
1054
1129
  lengthAtSegment: o
1055
1130
  };
1056
- if (t >= s)
1057
- return r = n.slice(0, -1), o = W(r), c = s - o, {
1058
- segment: n[i],
1131
+ if (t >= n)
1132
+ return r = s.slice(0, -1), o = rt(r), a = n - o, c = s[i], {
1133
+ segment: c,
1059
1134
  index: i,
1060
- length: c,
1135
+ length: a,
1061
1136
  lengthAtSegment: o
1062
1137
  };
1063
- const g = [];
1138
+ const l = [];
1064
1139
  for (; i > 0; )
1065
- l = r[i], r = r.slice(0, -1), o = W(r), c = s - o, s = o, g.push({
1066
- segment: l,
1140
+ c = r[i], r = r.slice(0, -1), o = rt(r), a = n - o, n = o, l.push({
1141
+ segment: c,
1067
1142
  index: i,
1068
- length: c,
1143
+ length: a,
1069
1144
  lengthAtSegment: o
1070
1145
  }), i -= 1;
1071
- return g.find(({ lengthAtSegment: f }) => f <= t);
1072
- }, rt = (e) => {
1073
- let t = 0, n = 0, r = 0, s = 0, i = "M";
1074
- return D(q(e), (o, c) => {
1075
- const l = V(o, c), a = G(l, c);
1076
- [i] = a;
1077
- const m = i.toUpperCase();
1078
- return m === "Z" ? (t = r, n = s) : ([t, n] = a.slice(-2), m === "M" && (r = t, s = n)), c.x = t, c.y = n, a;
1079
- });
1080
- }, pt = (e, t) => {
1081
- const n = q(e), r = rt(n), s = W(n), i = (M) => {
1082
- const b = M.x - t.x, w = M.y - t.y;
1083
- return b * b + w * w;
1146
+ return l.find(({ lengthAtSegment: u }) => u <= t);
1147
+ }, Nt = (e, t) => {
1148
+ const s = R(e), r = ut(s), n = rt(r), i = (M) => {
1149
+ const d = M.x - t.x, v = M.y - t.y;
1150
+ return d * d + v * v;
1084
1151
  };
1085
- let o = 8, c, l = { x: 0, y: 0 }, a = 0, m = 0, u = 1 / 0;
1086
- for (let M = 0; M <= s; M += o)
1087
- c = nt(r, M), a = i(c), a < u && (l = c, m = M, u = a);
1152
+ let o = 8, a, c = { x: 0, y: 0 }, l = 0, u = 0, m = 1 / 0;
1153
+ for (let M = 0; M <= n; M += o)
1154
+ a = at(r, M), l = i(a), l < m && (c = a, u = M, m = l);
1088
1155
  o /= 2;
1089
- let g, f, h = 0, y = 0, x = 0, p = 0;
1090
- for (; o > 1e-6 && (h = m - o, g = nt(r, h), x = i(g), y = m + o, f = nt(r, y), p = i(f), h >= 0 && x < u ? (l = g, m = h, u = x) : y <= s && p < u ? (l = f, m = y, u = p) : o /= 2, !(o < 1e-5)); )
1156
+ let f, y, h = 0, x = 0, b = 0, A = 0;
1157
+ for (; o > 1e-6 && (h = u - o, f = at(r, h), b = i(f), x = u + o, y = at(r, x), A = i(y), h >= 0 && b < m ? (c = f, u = h, m = b) : x <= n && A < m ? (c = y, u = x, m = A) : o /= 2, !(o < 1e-5)); )
1091
1158
  ;
1092
- const d = Tt(n, m), C = Math.sqrt(u);
1093
- return { closest: l, distance: C, segment: d };
1094
- }, Ye = (e, t) => pt(e, t).closest, He = (e, t) => pt(e, t).segment, Fe = (e, t) => Tt(e, t).segment, Ue = (e, t) => {
1095
- const { distance: n } = pt(e, t);
1096
- return Math.abs(n) < At;
1097
- }, ce = (e) => {
1159
+ const w = Ht(s, u), N = Math.sqrt(m);
1160
+ return { closest: c, distance: N, segment: w };
1161
+ }, He = (e, t) => Nt(e, t).closest, Ue = (e, t, s, r, n, i, o, a) => 3 * ((a - t) * (s + n) - (o - e) * (r + i) + r * (e - n) - s * (t - i) + a * (n + e / 3) - o * (i + t / 3)) / 20, Pe = (e) => {
1162
+ let t = 0, s = 0, r = 0;
1163
+ return gt(e).map((n) => {
1164
+ switch (n[0]) {
1165
+ case "M":
1166
+ return [, t, s] = n, 0;
1167
+ default:
1168
+ return r = Ue(t, s, n[1], n[2], n[3], n[4], n[5], n[6]), [t, s] = n.slice(-2), r;
1169
+ }
1170
+ }).reduce((n, i) => n + i, 0);
1171
+ }, Xe = (e) => Pe(gt(e)) >= 0, Jt = (e) => {
1172
+ if (!e)
1173
+ return {
1174
+ x: 0,
1175
+ y: 0,
1176
+ width: 0,
1177
+ height: 0,
1178
+ x2: 0,
1179
+ y2: 0,
1180
+ cx: 0,
1181
+ cy: 0,
1182
+ cz: 0
1183
+ };
1184
+ const t = R(e);
1185
+ let s = [], r = "M";
1186
+ const n = 0, i = 0;
1187
+ let o = 0, a = 0;
1188
+ const c = [], l = [];
1189
+ let u = { x: n, y: i }, m = { x: n, y: i };
1190
+ const f = { ...X };
1191
+ j(t, (N, M, d, v) => {
1192
+ f.x = d, f.y = v;
1193
+ const L = G(N, f);
1194
+ [r] = L, s = [d, v].concat(L.slice(1)), r === "M" ? ([, o, a] = L, u = { x: o, y: a }, m = { x: o, y: a }) : r === "L" ? { min: u, max: m } = zt(s[0], s[1], s[2], s[3]) : r === "A" ? { min: u, max: m } = pe(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]) : r === "C" ? { min: u, max: m } = Te(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]) : r === "Q" ? { min: u, max: m } = ze(s[0], s[1], s[2], s[3], s[4], s[5]) : r === "Z" && (s = [d, v, o, a], { min: u, max: m } = zt(s[0], s[1], s[2], s[3])), c.push(u), l.push(m);
1195
+ const T = L.length;
1196
+ f.x1 = +L[T - 2], f.y1 = +L[T - 1], f.x2 = +L[T - 4] || f.x1, f.y2 = +L[T - 3] || f.y1;
1197
+ });
1198
+ const y = Math.min(...c.map((N) => N.x)), h = Math.max(...l.map((N) => N.x)), x = Math.min(...c.map((N) => N.y)), b = Math.max(...l.map((N) => N.y)), A = h - y, w = b - x;
1199
+ return {
1200
+ width: A,
1201
+ height: w,
1202
+ x: y,
1203
+ y: x,
1204
+ x2: h,
1205
+ y2: b,
1206
+ cx: y + A / 2,
1207
+ cy: x + w / 2,
1208
+ // an estimated guess
1209
+ cz: Math.max(A, w) + Math.min(A, w) / 2
1210
+ };
1211
+ }, Je = (e, t) => Ht(e, t).segment, Ye = (e, t) => Nt(e, t).segment, Lt = (e) => Array.isArray(e) && e.every((t) => {
1212
+ const s = t[0].toLowerCase();
1213
+ return nt[s] === t.length - 1 && "achlmqstvz".includes(s) && t.slice(1).every(Number.isFinite);
1214
+ }) && e.length > 0, qe = (e) => Lt(e) && // `isPathArray` also checks if it's `Array`
1215
+ e.every(([t]) => t === t.toUpperCase()), ke = (e) => qe(e) && e.every(([t]) => "ACLMQZ".includes(t)), Ke = (e) => ke(e) && e.every(([t]) => "MC".includes(t)), We = (e, t) => {
1216
+ const { distance: s } = Nt(e, t);
1217
+ return Math.abs(s) < bt;
1218
+ }, Ve = (e) => Lt(e) && // `isPathArray` checks if it's `Array`
1219
+ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
1098
1220
  if (typeof e != "string" || !e.length)
1099
1221
  return !1;
1100
- const t = new Xt(e);
1101
- for (et(t); t.index < t.max && !t.err.length; )
1102
- Qt(t);
1222
+ const t = new Rt(e);
1223
+ for (st(t); t.index < t.max && !t.err.length; )
1224
+ Et(t);
1103
1225
  return !t.err.length && "mM".includes(t.segments[0][0]);
1104
- }, dt = (e) => Array.isArray(e) && e.every((t) => {
1105
- const n = t[0].toLowerCase();
1106
- return tt[n] === t.length - 1 && "achlmqstvz".includes(n) && t.slice(1).every(Number.isFinite);
1107
- }) && e.length > 0, le = (e) => dt(e) && // `isPathArray` also checks if it's `Array`
1108
- e.every(([t]) => t === t.toUpperCase()), Ve = (e) => dt(e) && // `isPathArray` checks if it's `Array`
1109
- e.slice(1).every(([t]) => t === t.toLowerCase()), ae = (e) => le(e) && e.every(([t]) => "ACLMQZ".includes(t)), _e = (e) => ae(e) && e.every(([t]) => "MC".includes(t)), ut = {
1226
+ }, mt = {
1110
1227
  line: ["x1", "y1", "x2", "y2"],
1111
1228
  circle: ["cx", "cy", "r"],
1112
1229
  ellipse: ["cx", "cy", "rx", "ry"],
@@ -1114,316 +1231,271 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ae = (e) => le(e) && e.every((
1114
1231
  polygon: ["points"],
1115
1232
  polyline: ["points"],
1116
1233
  glyph: ["d"]
1117
- }, Je = (e) => {
1118
- let { x1: t, y1: n, x2: r, y2: s } = e;
1119
- return [t, n, r, s] = [t, n, r, s].map((i) => +i), [
1120
- ["M", t, n],
1121
- ["L", r, s]
1234
+ }, Ge = (e) => {
1235
+ let { x1: t, y1: s, x2: r, y2: n } = e;
1236
+ return [t, s, r, n] = [t, s, r, n].map((i) => +i), [
1237
+ ["M", t, s],
1238
+ ["L", r, n]
1122
1239
  ];
1123
- }, Ke = (e) => {
1124
- const t = [], n = (e.points || "").trim().split(/[\s|,]/).map((s) => +s);
1240
+ }, tn = (e) => {
1241
+ const t = [], s = (e.points || "").trim().split(/[\s|,]/).map((n) => +n);
1125
1242
  let r = 0;
1126
- for (; r < n.length; )
1127
- t.push([r ? "L" : "M", n[r], n[r + 1]]), r += 2;
1243
+ for (; r < s.length; )
1244
+ t.push([r ? "L" : "M", s[r], s[r + 1]]), r += 2;
1128
1245
  return e.type === "polygon" ? [...t, ["z"]] : t;
1129
- }, We = (e) => {
1130
- let { cx: t, cy: n, r } = e;
1131
- return [t, n, r] = [t, n, r].map((s) => +s), [
1132
- ["M", t - r, n],
1246
+ }, en = (e) => {
1247
+ let { cx: t, cy: s, r } = e;
1248
+ return [t, s, r] = [t, s, r].map((n) => +n), [
1249
+ ["M", t - r, s],
1133
1250
  ["a", r, r, 0, 1, 0, 2 * r, 0],
1134
1251
  ["a", r, r, 0, 1, 0, -2 * r, 0]
1135
1252
  ];
1136
- }, Ge = (e) => {
1137
- let { cx: t, cy: n } = e, r = e.rx || 0, s = e.ry || r;
1138
- return [t, n, r, s] = [t, n, r, s].map((i) => +i), [
1139
- ["M", t - r, n],
1140
- ["a", r, s, 0, 1, 0, 2 * r, 0],
1141
- ["a", r, s, 0, 1, 0, -2 * r, 0]
1253
+ }, nn = (e) => {
1254
+ let { cx: t, cy: s } = e, r = e.rx || 0, n = e.ry || r;
1255
+ return [t, s, r, n] = [t, s, r, n].map((i) => +i), [
1256
+ ["M", t - r, s],
1257
+ ["a", r, n, 0, 1, 0, 2 * r, 0],
1258
+ ["a", r, n, 0, 1, 0, -2 * r, 0]
1142
1259
  ];
1143
- }, tn = (e) => {
1144
- const t = +e.x || 0, n = +e.y || 0, r = +e.width, s = +e.height;
1260
+ }, sn = (e) => {
1261
+ const t = +e.x || 0, s = +e.y || 0, r = +e.width, n = +e.height;
1145
1262
  let i = +(e.rx || 0), o = +(e.ry || i);
1146
- return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > s && (o -= (o * 2 - s) / 2), [
1147
- ["M", t + i, n],
1263
+ return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > n && (o -= (o * 2 - n) / 2), [
1264
+ ["M", t + i, s],
1148
1265
  ["h", r - i * 2],
1149
1266
  ["s", i, 0, i, o],
1150
- ["v", s - o * 2],
1267
+ ["v", n - o * 2],
1151
1268
  ["s", 0, o, -i, o],
1152
1269
  ["h", -r + i * 2],
1153
1270
  ["s", -i, 0, -i, -o],
1154
- ["v", -s + o * 2],
1271
+ ["v", -n + o * 2],
1155
1272
  ["s", 0, -o, i, -o]
1156
- ]) : [["M", t, n], ["h", r], ["v", s], ["H", t], ["Z"]];
1157
- }, me = (e, t) => {
1273
+ ]) : [["M", t, s], ["h", r], ["v", n], ["H", t], ["Z"]];
1274
+ }, Ee = (e, t) => {
1158
1275
  const r = (t || document).defaultView || /* istanbul ignore next */
1159
- window, s = Object.keys(ut), i = e instanceof r.SVGElement, o = i ? e.tagName : null;
1160
- if (o && [...s, "path"].every((u) => o !== u))
1276
+ window, n = Object.keys(mt), i = e instanceof r.SVGElement, o = i ? e.tagName : null;
1277
+ if (o && [...n, "path"].every((m) => o !== m))
1161
1278
  throw TypeError(`${E}: "${o}" is not SVGElement`);
1162
- const c = i ? o : e.type, l = ut[c], a = { type: c };
1163
- i ? l.forEach((u) => {
1164
- a[u] = e.getAttribute(u);
1165
- }) : Object.assign(a, e);
1166
- let m = [];
1167
- return c === "circle" ? m = We(a) : c === "ellipse" ? m = Ge(a) : ["polyline", "polygon"].includes(c) ? m = Ke(a) : c === "rect" ? m = tn(a) : c === "line" ? m = Je(a) : ["glyph", "path"].includes(c) && (m = q(
1279
+ const a = i ? o : e.type, c = mt[a], l = { type: a };
1280
+ i ? c.forEach((m) => {
1281
+ l[m] = e.getAttribute(m);
1282
+ }) : Object.assign(l, e);
1283
+ let u = [];
1284
+ return a === "circle" ? u = en(l) : a === "ellipse" ? u = nn(l) : ["polyline", "polygon"].includes(a) ? u = tn(l) : a === "rect" ? u = sn(l) : a === "line" ? u = Ge(l) : ["glyph", "path"].includes(a) && (u = R(
1168
1285
  i ? e.getAttribute("d") || /* istanbul ignore next @preserve */
1169
1286
  "" : e.d || ""
1170
- )), dt(m) && m.length ? m : !1;
1171
- }, ht = (e, t) => {
1172
- let { round: n } = st;
1173
- if (t === "off" || n === "off") return e.slice(0);
1174
- n = typeof t == "number" && t >= 0 ? t : n;
1175
- const r = typeof n == "number" && n >= 1 ? 10 ** n : 1;
1176
- return D(e, (s) => {
1177
- const i = s.slice(1).map((o) => n ? Math.round(o * r) / r : Math.round(o));
1178
- return [s[0], ...i];
1179
- });
1180
- }, Ct = (e, t) => ht(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), en = (e, t, n) => {
1181
- const r = n || document, s = r.defaultView || /* istanbul ignore next */
1182
- window, i = Object.keys(ut), o = e instanceof s.SVGElement, c = o ? e.tagName : null;
1183
- if (c === "path") throw TypeError(`${E}: "${c}" is already SVGPathElement`);
1184
- if (c && i.every((y) => c !== y)) throw TypeError(`${E}: "${c}" is not SVGElement`);
1185
- const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), a = o ? c : e.type, m = ut[a], u = { type: a }, g = st.round, f = me(e, r), h = f && f.length ? Ct(f, g) : "";
1186
- return o ? (m.forEach((y) => {
1187
- u[y] = e.getAttribute(y);
1188
- }), Object.values(e.attributes).forEach(({ name: y, value: x }) => {
1189
- m.includes(y) || l.setAttribute(y, x);
1190
- })) : (Object.assign(u, e), Object.keys(u).forEach((y) => {
1191
- !m.includes(y) && y !== "type" && l.setAttribute(
1192
- y.replace(/[A-Z]/g, (x) => `-${x.toLowerCase()}`),
1193
- u[y]
1287
+ )), Lt(u) && u.length ? u : !1;
1288
+ }, rn = (e, t, s) => {
1289
+ const r = s || document, n = r.defaultView || /* istanbul ignore next */
1290
+ window, i = Object.keys(mt), o = e instanceof n.SVGElement, a = o ? e.tagName : null;
1291
+ if (a === "path") throw TypeError(`${E}: "${a}" is already SVGPathElement`);
1292
+ if (a && i.every((x) => a !== x)) throw TypeError(`${E}: "${a}" is not SVGElement`);
1293
+ const c = r.createElementNS("http://www.w3.org/2000/svg", "path"), l = o ? a : e.type, u = mt[l], m = { type: l }, f = V.round, y = Ee(e, r), h = y && y.length ? $t(y, f) : "";
1294
+ return o ? (u.forEach((x) => {
1295
+ m[x] = e.getAttribute(x);
1296
+ }), Object.values(e.attributes).forEach(({ name: x, value: b }) => {
1297
+ u.includes(x) || c.setAttribute(x, b);
1298
+ })) : (Object.assign(m, e), Object.keys(m).forEach((x) => {
1299
+ !u.includes(x) && x !== "type" && c.setAttribute(
1300
+ x.replace(/[A-Z]/g, (b) => `-${b.toLowerCase()}`),
1301
+ m[x]
1194
1302
  );
1195
- })), ce(h) ? (l.setAttribute("d", h), t && o && (e.before(l, e), e.remove()), l) : !1;
1196
- }, Ot = (e) => {
1197
- const t = [];
1198
- let n, r = -1, s = 0, i = 0, o = 0, c = 0;
1199
- const l = { ...gt };
1200
- return e.forEach((a) => {
1201
- const [m] = a, u = m.toUpperCase(), g = m.toLowerCase(), f = m === g, h = a.slice(1);
1202
- u === "M" ? (r += 1, [s, i] = h, s += f ? l.x : 0, i += f ? l.y : 0, o = s, c = i, n = [f ? [u, o, c] : a]) : (u === "Z" ? (s = o, i = c) : u === "H" ? ([, s] = a, s += f ? l.x : (
1203
- /* istanbul ignore next @preserve */
1204
- 0
1205
- )) : u === "V" ? ([, i] = a, i += f ? l.y : (
1206
- /* istanbul ignore next @preserve */
1207
- 0
1208
- )) : ([s, i] = a.slice(-2), s += f ? l.x : 0, i += f ? l.y : 0), n.push(a)), l.x = s, l.y = i, t[r] = n;
1209
- }), t;
1210
- }, ue = (e) => {
1211
- let t = new v();
1212
- const { origin: n } = e, [r, s] = n, { translate: i } = e, { rotate: o } = e, { skew: c } = e, { scale: l } = e;
1213
- return Array.isArray(i) && i.length >= 2 && i.every((a) => !Number.isNaN(+a)) && i.some((a) => a !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || c || l) && (t = t.translate(r, s), Array.isArray(o) && o.length >= 2 && o.every((a) => !Number.isNaN(+a)) && o.some((a) => a !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(c) && c.length === 2 && c.every((a) => !Number.isNaN(+a)) && c.some((a) => a !== 0) ? (t = c[0] ? t.skewX(c[0]) : t, t = c[1] ? t.skewY(c[1]) : t) : typeof c == "number" && !Number.isNaN(c) && (t = t.skewX(c)), Array.isArray(l) && l.length >= 2 && l.every((a) => !Number.isNaN(+a)) && l.some((a) => a !== 1) ? t = t.scale(...l) : typeof l == "number" && !Number.isNaN(l) && (t = t.scale(l)), t = t.translate(-r, -s)), t;
1214
- }, ft = (e) => {
1215
- let t = 0, n = 0, r = 0, s = 0, i = "M";
1216
- const o = q(e);
1217
- return D(o, (c, l) => {
1218
- [i] = c;
1219
- const a = V(c, l), m = i.toUpperCase();
1220
- return m === "Z" ? (t = r, n = s) : m === "H" ? [, t] = a : m === "V" ? [, n] = a : ([t, n] = a.slice(-2), m === "M" && (r = t, s = n)), l.x = t, l.y = n, a;
1221
- });
1222
- }, nn = (e, t, n) => {
1223
- const [r] = e, { x: s, y: i } = t, o = e.slice(1).map(Number), c = r.toLowerCase();
1224
- if (n === 0 && r === "M")
1225
- return e;
1226
- if (r !== c) {
1227
- if (c === "a")
1228
- return [
1229
- c,
1230
- o[0],
1231
- o[1],
1232
- o[2],
1233
- o[3],
1234
- o[4],
1235
- o[5] - s,
1236
- o[6] - i
1237
- ];
1238
- if (c === "v")
1239
- return [c, o[0] - i];
1240
- if (c === "h")
1241
- return [c, o[0] - s];
1242
- {
1243
- const l = o.map((a, m) => a - (m % 2 ? i : s));
1244
- return [c, ...l];
1245
- }
1246
- }
1247
- return e;
1248
- }, vt = (e) => {
1249
- let t = 0, n = 0, r = 0, s = 0, i = "M";
1250
- const o = q(e);
1251
- return D(o, (c, l, a) => {
1252
- [i] = c;
1253
- const m = nn(c, l, a), [u] = m, g = i.toUpperCase(), f = i.toLowerCase(), h = u === f;
1254
- return g === "Z" ? (t = r, n = s) : g === "H" ? ([, t] = m, t += h ? l.x : (
1255
- /* istanbul ignore next @preserve */
1256
- 0
1257
- )) : g === "V" ? ([, n] = m, n += h ? l.y : (
1258
- /* istanbul ignore next @preserve */
1259
- 0
1260
- )) : ([t, n] = m.slice(-2), t += h ? l.x : 0, n += h ? l.y : 0, g === "M" && (r = t, s = n)), l.x = t, l.y = n, m;
1261
- });
1262
- }, sn = (e, t, n, r) => {
1263
- const [s] = e, i = (p) => Math.round(p * 10 ** 4) / 10 ** 4, o = e.slice(1), c = t.slice(1), { x1: l, y1: a, x2: m, y2: u, x: g, y: f } = n;
1264
- let h = e;
1265
- const [y, x] = c.slice(-2);
1266
- if ("TQ".includes(s) || (n.qx = null, n.qy = null), ["V", "H", "S", "T", "Z"].includes(s))
1267
- h = [s, ...o];
1268
- else if (s === "L")
1269
- i(g) === i(y) ? h = ["V", x] : i(f) === i(x) && (h = ["H", y]);
1270
- else if (s === "C") {
1271
- const [p, d] = c;
1272
- "CS".includes(r) && (i(p) === i(l * 2 - m) && i(d) === i(a * 2 - u) || i(l) === i(m * 2 - g) && i(a) === i(u * 2 - f)) && (h = ["S", ...c.slice(-4)]), n.x1 = p, n.y1 = d;
1273
- } else if (s === "Q") {
1274
- const [p, d] = c;
1275
- n.qx = p, n.qy = d, "QT".includes(r) && (i(p) === i(l * 2 - m) && i(d) === i(a * 2 - u) || i(l) === i(m * 2 - g) && i(a) === i(u * 2 - f)) && (h = ["T", ...c.slice(-2)]);
1303
+ })), Ie(h) ? (c.setAttribute("d", h), t && o && (e.before(c, e), e.remove()), c) : !1;
1304
+ }, Re = (e) => {
1305
+ let t = new C();
1306
+ const { origin: s } = e, [r, n] = s, { translate: i } = e, { rotate: o } = e, { skew: a } = e, { scale: c } = e;
1307
+ return Array.isArray(i) && i.length >= 2 && i.every((l) => !Number.isNaN(+l)) && i.some((l) => l !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || a || c) && (t = t.translate(r, n), Array.isArray(o) && o.length >= 2 && o.every((l) => !Number.isNaN(+l)) && o.some((l) => l !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(a) && a.length === 2 && a.every((l) => !Number.isNaN(+l)) && a.some((l) => l !== 0) ? (t = a[0] ? t.skewX(a[0]) : t, t = a[1] ? t.skewY(a[1]) : t) : typeof a == "number" && !Number.isNaN(a) && (t = t.skewX(a)), Array.isArray(c) && c.length >= 2 && c.every((l) => !Number.isNaN(+l)) && c.some((l) => l !== 1) ? t = t.scale(...c) : typeof c == "number" && !Number.isNaN(c) && (t = t.scale(c)), t = t.translate(-r, -n)), t;
1308
+ }, je = (e, t, s, r) => {
1309
+ const [n] = e, { round: i } = V, o = typeof i == "number" ? i : (
1310
+ /* istanbul ignore next */
1311
+ 4
1312
+ ), a = t.slice(1), { x1: c, y1: l, x2: u, y2: m, x: f, y } = s, [h, x] = a.slice(-2), b = e;
1313
+ if ("TQ".includes(n) || (s.qx = null, s.qy = null), n === "L") {
1314
+ if (z(f, o) === z(h, o))
1315
+ return ["V", x];
1316
+ if (z(y, o) === z(x, o))
1317
+ return ["H", h];
1318
+ } else if (n === "C") {
1319
+ const [A, w] = a;
1320
+ if (s.x1 = A, s.y1 = w, "CS".includes(r) && (z(A, o) === z(c * 2 - u, o) && z(w, o) === z(l * 2 - m, o) || z(c, o) === z(u * 2 - f, o) && z(l, o) === z(m * 2 - y, o)))
1321
+ return ["S", a[2], a[3], a[4], a[5]];
1322
+ } else if (n === "Q") {
1323
+ const [A, w] = a;
1324
+ if (s.qx = A, s.qy = w, "QT".includes(r) && z(A, o) === z(c * 2 - u, o) && z(w, o) === z(l * 2 - m, o))
1325
+ return ["T", a[2], a[3]];
1276
1326
  }
1277
- return h;
1278
- }, jt = (e, t) => {
1279
- const n = ft(e), r = rt(n), s = { ...gt }, i = [], o = n.length;
1280
- let c = "", l = "", a = 0, m = 0, u = 0, g = 0;
1281
- for (let y = 0; y < o; y += 1) {
1282
- [c] = n[y], i[y] = c, y && (l = i[y - 1]), n[y] = sn(n[y], r[y], s, l);
1283
- const x = n[y], p = x.length;
1284
- switch (s.x1 = +x[p - 2], s.y1 = +x[p - 1], s.x2 = +x[p - 4] || s.x1, s.y2 = +x[p - 3] || s.y1, c) {
1285
- case "Z":
1286
- a = u, m = g;
1287
- break;
1288
- case "H":
1289
- [, a] = x;
1290
- break;
1291
- case "V":
1292
- [, m] = x;
1293
- break;
1294
- default:
1295
- [a, m] = x.slice(-2).map(Number), c === "M" && (u = a, g = m);
1327
+ return b;
1328
+ }, dt = (e, t) => {
1329
+ const s = e.slice(1).map((r) => z(r, t));
1330
+ return [e[0]].concat(s);
1331
+ }, Yt = (e, t) => {
1332
+ const s = xt(e), r = typeof t == "number" && t >= 0 ? t : (
1333
+ /* istanbul ignore next @preserve */
1334
+ 2
1335
+ ), n = { ...X }, i = [];
1336
+ let o = "M", a = "Z";
1337
+ return j(s, (c, l, u, m) => {
1338
+ n.x = u, n.y = m;
1339
+ const f = G(c, n);
1340
+ let y = c;
1341
+ if ([o] = c, i[l] = o, l) {
1342
+ a = i[l - 1];
1343
+ const x = je(c, f, n, a), b = dt(x, r), A = b.join(""), w = St(x, l, u, m), N = dt(w, r), M = N.join("");
1344
+ y = A.length < M.length ? b : N;
1296
1345
  }
1297
- s.x = a, s.y = m;
1298
- }
1299
- const f = ht(n, t), h = ht(vt(n), t);
1300
- return f.map((y, x) => x ? y.join("").length < h[x].join("").length ? y : h[x] : y);
1301
- }, rn = (e) => {
1346
+ const h = f.length;
1347
+ return n.x1 = +f[h - 2], n.y1 = +f[h - 1], n.x2 = +f[h - 4] || n.x1, n.y2 = +f[h - 3] || n.y1, y;
1348
+ });
1349
+ }, on = (e, t) => {
1350
+ let s = C.Translate(t[0], t[1], t[2]);
1351
+ return [, , , s.m44] = t, s = e.multiply(s), [s.m41, s.m42, s.m43, s.m44];
1352
+ }, It = (e, t, s) => {
1353
+ const [r, n, i] = s, [o, a, c] = on(e, [t[0], t[1], 0, 1]), l = o - r, u = a - n, m = c - i;
1354
+ return [
1355
+ // protect against division by ZERO
1356
+ l * (Math.abs(i) / Math.abs(m) || 1) + r,
1357
+ u * (Math.abs(i) / Math.abs(m) || 1) + n
1358
+ ];
1359
+ }, cn = (e) => {
1302
1360
  const t = e.slice(1).map(
1303
- (n, r, s) => r ? [...s[r - 1].slice(-2), ...n.slice(1)] : [...e[0].slice(1), ...n.slice(1)]
1304
- ).map((n) => n.map((r, s) => n[n.length - s - 2 * (1 - s % 2)])).reverse();
1305
- return [["M", ...t[0].slice(0, 2)], ...t.map((n) => ["C", ...n.slice(2)])];
1306
- }, lt = (e) => {
1307
- const t = ft(e), n = t.slice(-1)[0][0] === "Z", r = rt(t).map((s, i) => {
1308
- const [o, c] = s.slice(-2).map(Number);
1309
- return {
1310
- seg: t[i],
1311
- // absolute
1312
- n: s,
1313
- // normalized
1314
- c: t[i][0],
1315
- // pathCommand
1316
- x: o,
1317
- // x
1318
- y: c
1319
- // y
1320
- };
1321
- }).map((s, i, o) => {
1322
- const c = s.seg, l = s.n, a = i && o[i - 1], m = o[i + 1], u = s.c, g = o.length, f = i ? o[i - 1].x : o[g - 1].x, h = i ? o[i - 1].y : o[g - 1].y;
1323
- let y = [];
1324
- switch (u) {
1361
+ (s, r, n) => r ? n[r - 1].slice(-2).concat(s.slice(1)) : e[0].slice(1).concat(s.slice(1))
1362
+ ).map((s) => s.map((r, n) => s[s.length - n - 2 * (1 - n % 2)])).reverse();
1363
+ return [["M"].concat(t[0].slice(0, 2))].concat(
1364
+ t.map((s) => ["C"].concat(s.slice(2)))
1365
+ );
1366
+ }, yt = (e) => {
1367
+ const t = xt(e), s = ut(t), r = t.length, n = t[r - 1][0] === "Z", i = j(t, (o, a) => {
1368
+ const c = s[a], l = a && t[a - 1], u = l && l[0], m = t[a + 1], f = m && m[0], [y] = o, [h, x] = s[a ? a - 1 : r - 1].slice(-2);
1369
+ let b = o;
1370
+ switch (y) {
1325
1371
  case "M":
1326
- y = n ? ["Z"] : [u, f, h];
1372
+ b = n ? ["Z"] : [y, h, x];
1327
1373
  break;
1328
1374
  case "A":
1329
- y = [u, ...c.slice(1, -3), c[5] === 1 ? 0 : 1, f, h];
1375
+ b = [
1376
+ y,
1377
+ o[1],
1378
+ o[2],
1379
+ o[3],
1380
+ o[4],
1381
+ o[5] === 1 ? 0 : 1,
1382
+ h,
1383
+ x
1384
+ ];
1330
1385
  break;
1331
1386
  case "C":
1332
- m && m.c === "S" ? y = ["S", c[1], c[2], f, h] : y = [u, c[3], c[4], c[1], c[2], f, h];
1387
+ m && f === "S" ? b = ["S", o[1], o[2], h, x] : b = [y, o[3], o[4], o[1], o[2], h, x];
1333
1388
  break;
1334
1389
  case "S":
1335
- a && "CS".includes(a.c) && (!m || m.c !== "S") ? y = ["C", l[3], l[4], l[1], l[2], f, h] : y = [u, l[1], l[2], f, h];
1390
+ u && "CS".includes(u) && (!m || f !== "S") ? b = [
1391
+ "C",
1392
+ c[3],
1393
+ c[4],
1394
+ c[1],
1395
+ c[2],
1396
+ h,
1397
+ x
1398
+ ] : b = [y, c[1], c[2], h, x];
1336
1399
  break;
1337
1400
  case "Q":
1338
- m && m.c === "T" ? y = ["T", f, h] : y = [u, ...c.slice(1, -2), f, h];
1401
+ m && f === "T" ? b = ["T", h, x] : b = [y, o[1], o[2], h, x];
1339
1402
  break;
1340
1403
  case "T":
1341
- a && "QT".includes(a.c) && (!m || m.c !== "T") ? y = ["Q", l[1], l[2], f, h] : y = [u, f, h];
1404
+ u && "QT".includes(u) && (!m || f !== "T") ? b = ["Q", c[1], c[2], h, x] : b = [y, h, x];
1342
1405
  break;
1343
1406
  case "Z":
1344
- y = ["M", f, h];
1407
+ b = ["M", h, x];
1345
1408
  break;
1346
1409
  case "H":
1347
- y = [u, f];
1410
+ b = [y, h];
1348
1411
  break;
1349
1412
  case "V":
1350
- y = [u, h];
1413
+ b = [y, x];
1351
1414
  break;
1352
1415
  default:
1353
- y = [u, ...c.slice(1, -2), f, h];
1416
+ b = [y].concat(o.slice(1, -2), h, x);
1354
1417
  }
1355
- return y;
1418
+ return b;
1356
1419
  });
1357
- return n ? r.reverse() : [r[0], ...r.slice(1).reverse()];
1358
- }, on = (e, t) => {
1359
- let n = v.Translate(...t.slice(0, -1));
1360
- return [, , , n.m44] = t, n = e.multiply(n), [n.m41, n.m42, n.m43, n.m44];
1361
- }, Rt = (e, t, n) => {
1362
- const [r, s, i] = n, [o, c, l] = on(e, [...t, 0, 1]), a = o - r, m = c - s, u = l - i;
1420
+ return n ? i.reverse() : [i[0]].concat(i.slice(1).reverse());
1421
+ }, an = (e, t) => {
1422
+ let { round: s } = V;
1423
+ return s = t === "off" || typeof t == "number" && t >= 0 ? t : typeof s == "number" && s >= 0 ? s : (
1424
+ /* istanbul ignore next @preserve */
1425
+ "off"
1426
+ ), s === "off" ? e.slice(0) : j(e, (r) => dt(r, s));
1427
+ }, ln = (e, t = 0.5) => {
1428
+ const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), a = O(r, n, s), c = O(n, i, s), l = O(i, o, s), u = O(a, c, s), m = O(c, l, s), f = O(u, m, s);
1363
1429
  return [
1364
- // protect against division by ZERO
1365
- a * (Math.abs(i) / Math.abs(u) || 1) + r,
1366
- m * (Math.abs(i) / Math.abs(u) || 1) + s
1430
+ ["C", a[0], a[1], u[0], u[1], f[0], f[1]],
1431
+ ["C", m[0], m[1], l[0], l[1], o[0], o[1]]
1367
1432
  ];
1368
- }, Dt = (e, t) => {
1369
- let n = 0, r = 0, s = 0, i = 0, o = 0, c = 0, l = 0, a = 0, m = 0, u = 0, g = "M";
1370
- const f = { ...gt }, h = q(e), y = t && Object.keys(t);
1371
- if (!t || y && !y.length) return h;
1372
- t.origin || Object.assign(t, { origin: st.origin });
1373
- const x = t.origin, p = ue(t);
1374
- return p.isIdentity ? h : D(h, (d, C, M) => {
1375
- const b = V(d, f);
1376
- [g] = b;
1377
- let w = g === "A" ? ie(b, f) : ["V", "H"].includes(g) ? G(b, f) : b;
1378
- const T = w[0] === "C" && w.length > 7, P = T ? w.slice(0, 7) : w.slice(0);
1379
- if (T && (h.splice(M + 1, 0, ["C", ...w.slice(7)]), w = w.slice(0, 7)), w[0] === "L") {
1380
- const S = w.slice(-2);
1381
- [o, c] = Rt(p, S, x), n !== o && r !== c ? w = ["L", o, c] : r === c ? w = ["H", o] : n === o && (w = ["V", c]);
1382
- } else
1383
- for (l = 1, a = w.length; l < a; l += 2)
1384
- [o, c] = Rt(p, [+w[l], +w[l + 1]], x), w[l] = o, w[l + 1] = c;
1385
- n = o, r = c, g === "Z" ? (m = s, u = i) : ([m, u] = P.slice(-2), g === "M" && (s = m, i = u));
1386
- const $ = P.length;
1387
- return f.x1 = +P[$ - 2], f.y1 = +P[$ - 1], f.x2 = +P[$ - 4] || f.x1, f.y2 = +P[$ - 3] || f.y1, f.x = m, f.y = u, w;
1433
+ }, Kt = (e) => {
1434
+ const t = [];
1435
+ let s, r = -1, n = 0, i = 0, o = 0, a = 0;
1436
+ const c = { ...X };
1437
+ return e.forEach((l) => {
1438
+ const [u] = l, m = u.toUpperCase(), f = u.toLowerCase(), y = u === f, h = l.slice(1);
1439
+ m === "M" ? (r += 1, [n, i] = h, n += y ? c.x : 0, i += y ? c.y : 0, o = n, a = i, s = [y ? [m, o, a] : l]) : (m === "Z" ? (n = o, i = a) : m === "H" ? ([, n] = l, n += y ? c.x : (
1440
+ /* istanbul ignore next @preserve */
1441
+ 0
1442
+ )) : m === "V" ? ([, i] = l, i += y ? c.y : (
1443
+ /* istanbul ignore next @preserve */
1444
+ 0
1445
+ )) : ([n, i] = l.slice(-2), n += y ? c.x : 0, i += y ? c.y : 0), s.push(l)), c.x = n, c.y = i, t[r] = s;
1446
+ }), t;
1447
+ }, Wt = (e, t) => {
1448
+ let s = 0, r = 0, n = 0, i = 0, o = 0, a = 0, c = "M";
1449
+ const l = { ...X }, u = R(e), m = t && Object.keys(t);
1450
+ if (!t || m && !m.length) return u.slice(0);
1451
+ t.origin || Object.assign(t, { origin: V.origin });
1452
+ const f = t.origin, y = Re(t);
1453
+ return y.isIdentity ? u.slice(0) : j(u, (h, x, b, A) => {
1454
+ l.x = b, l.y = A, [c] = h;
1455
+ const w = c.toUpperCase(), M = w !== c ? jt(h, x, b, A) : h.slice(0);
1456
+ let d = w === "A" ? Zt(M, l) : ["V", "H"].includes(w) ? G(M, l) : M;
1457
+ c = d[0];
1458
+ const v = c === "C" && d.length > 7, L = v ? d.slice(0, 7) : d.slice(0);
1459
+ if (v && (u.splice(x + 1, 0, ["C"].concat(d.slice(7))), d = L), c === "L")
1460
+ [n, i] = It(y, [d[1], d[2]], f), s !== n && r !== i ? d = ["L", n, i] : r === i ? d = ["H", n] : s === n && (d = ["V", i]);
1461
+ else
1462
+ for (o = 1, a = d.length; o < a; o += 2)
1463
+ [n, i] = It(y, [+d[o], +d[o + 1]], f), d[o] = n, d[o + 1] = i;
1464
+ s = n, r = i;
1465
+ const T = L.length;
1466
+ return l.x1 = +L[T - 2], l.y1 = +L[T - 1], l.x2 = +L[T - 4] || l.x1, l.y2 = +L[T - 3] || l.y1, d;
1388
1467
  });
1389
- }, cn = (e, t = 0.5) => {
1390
- const n = t, r = e.slice(0, 2), s = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), c = R(r, s, n), l = R(s, i, n), a = R(i, o, n), m = R(c, l, n), u = R(l, a, n), g = R(m, u, n);
1391
- return [
1392
- ["C", ...c, ...m, ...g],
1393
- ["C", ...u, ...a, ...o]
1394
- ];
1395
1468
  };
1396
- class A {
1469
+ class p {
1397
1470
  /**
1398
1471
  * @constructor
1399
1472
  * @param pathValue the path string
1400
1473
  * @param config instance options
1401
1474
  */
1402
- constructor(t, n) {
1403
- const r = n || {}, s = typeof t > "u";
1404
- if (s || !t.length)
1405
- throw TypeError(`${E}: "pathValue" is ${s ? "undefined" : "empty"}`);
1406
- const i = q(t);
1407
- this.segments = i;
1408
- const { round: o, origin: c } = r;
1409
- let l;
1410
- Number.isInteger(o) || o === "off" ? l = o : l = st.round;
1411
- let a = st.origin;
1412
- if (Array.isArray(c) && c.length >= 2) {
1413
- const [m, u, g] = c.map(Number);
1414
- a = [
1415
- Number.isNaN(m) ? 0 : m,
1475
+ constructor(t, s) {
1476
+ const r = s || {}, n = typeof t > "u";
1477
+ if (n || !t.length)
1478
+ throw TypeError(`${E}: "pathValue" is ${n ? "undefined" : "empty"}`);
1479
+ this.segments = R(t);
1480
+ const { round: i, origin: o } = r;
1481
+ let a;
1482
+ Number.isInteger(i) || i === "off" ? a = i : a = V.round;
1483
+ let c = V.origin;
1484
+ if (Array.isArray(o) && o.length >= 2) {
1485
+ const [l, u, m] = o.map(Number);
1486
+ c = [
1487
+ Number.isNaN(l) ? 0 : l,
1416
1488
  Number.isNaN(u) ? 0 : u,
1417
- Number.isNaN(g) ? 0 : g
1489
+ Number.isNaN(m) ? 0 : m
1418
1490
  ];
1419
1491
  }
1420
- return this.round = l, this.origin = a, this;
1492
+ return this.round = a, this.origin = c, this;
1421
1493
  }
1422
1494
  get bbox() {
1423
- return zt(this.segments);
1495
+ return Jt(this.segments);
1424
1496
  }
1425
1497
  get length() {
1426
- return W(this.segments);
1498
+ return rt(this.segments);
1427
1499
  }
1428
1500
  /**
1429
1501
  * Returns the path bounding box, equivalent to native `path.getBBox()`.
@@ -1452,7 +1524,7 @@ class A {
1452
1524
  * @returns the requested point
1453
1525
  */
1454
1526
  getPointAtLength(t) {
1455
- return nt(this.segments, t);
1527
+ return at(this.segments, t);
1456
1528
  }
1457
1529
  /**
1458
1530
  * Convert path to absolute values
@@ -1461,7 +1533,7 @@ class A {
1461
1533
  */
1462
1534
  toAbsolute() {
1463
1535
  const { segments: t } = this;
1464
- return this.segments = ft(t), this;
1536
+ return this.segments = xt(t), this;
1465
1537
  }
1466
1538
  /**
1467
1539
  * Convert path to relative values
@@ -1470,7 +1542,7 @@ class A {
1470
1542
  */
1471
1543
  toRelative() {
1472
1544
  const { segments: t } = this;
1473
- return this.segments = vt(t), this;
1545
+ return this.segments = Xt(t), this;
1474
1546
  }
1475
1547
  /**
1476
1548
  * Convert path to cubic-bezier values. In addition, un-necessary `Z`
@@ -1480,7 +1552,7 @@ class A {
1480
1552
  */
1481
1553
  toCurve() {
1482
1554
  const { segments: t } = this;
1483
- return this.segments = mt(t), this;
1555
+ return this.segments = gt(t), this;
1484
1556
  }
1485
1557
  /**
1486
1558
  * Reverse the order of the segments and their values.
@@ -1490,9 +1562,9 @@ class A {
1490
1562
  */
1491
1563
  reverse(t) {
1492
1564
  this.toAbsolute();
1493
- const { segments: n } = this, r = Ot(n), s = r.length > 1 ? r : !1, i = s ? s.map((c, l) => t ? l ? lt(c) : c.slice(0) : lt(c)) : n.slice(0);
1565
+ const { segments: s } = this, r = Kt(s), n = r.length > 1 ? r : !1, i = n ? n.map((a, c) => t ? c ? yt(a) : a.slice(0) : yt(a)) : s.slice(0);
1494
1566
  let o = [];
1495
- return s ? o = i.flat(1) : o = t ? n : lt(n), this.segments = o.slice(0), this;
1567
+ return n ? o = i.flat(1) : o = t ? s : yt(s), this.segments = o.slice(0), this;
1496
1568
  }
1497
1569
  /**
1498
1570
  * Normalize path in 2 steps:
@@ -1503,7 +1575,7 @@ class A {
1503
1575
  */
1504
1576
  normalize() {
1505
1577
  const { segments: t } = this;
1506
- return this.segments = rt(t), this;
1578
+ return this.segments = ut(t), this;
1507
1579
  }
1508
1580
  /**
1509
1581
  * Optimize `pathArray` values:
@@ -1514,8 +1586,8 @@ class A {
1514
1586
  * @public
1515
1587
  */
1516
1588
  optimize() {
1517
- const { segments: t } = this;
1518
- return this.segments = jt(t, this.round), this;
1589
+ const { segments: t } = this, s = this.round === "off" ? 2 : this.round;
1590
+ return this.segments = Yt(t, s), this;
1519
1591
  }
1520
1592
  /**
1521
1593
  * Transform path using values from an `Object` defined as `transformObject`.
@@ -1526,21 +1598,21 @@ class A {
1526
1598
  * @public
1527
1599
  */
1528
1600
  transform(t) {
1529
- if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((l) => l in t))
1601
+ if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((c) => c in t))
1530
1602
  return this;
1531
1603
  const {
1532
- segments: n,
1533
- origin: [r, s, i]
1604
+ segments: s,
1605
+ origin: [r, n, i]
1534
1606
  } = this, o = {};
1535
- for (const [l, a] of Object.entries(t))
1536
- l === "skew" && Array.isArray(a) || (l === "rotate" || l === "translate" || l === "origin" || l === "scale") && Array.isArray(a) ? o[l] = a.map(Number) : l !== "origin" && typeof Number(a) == "number" && (o[l] = Number(a));
1537
- const { origin: c } = o;
1538
- if (Array.isArray(c) && c.length >= 2) {
1539
- const [l, a, m] = c.map(Number);
1540
- o.origin = [Number.isNaN(l) ? r : l, Number.isNaN(a) ? s : a, m || i];
1607
+ for (const [c, l] of Object.entries(t))
1608
+ c === "skew" && Array.isArray(l) || (c === "rotate" || c === "translate" || c === "origin" || c === "scale") && Array.isArray(l) ? o[c] = l.map(Number) : c !== "origin" && typeof Number(l) == "number" && (o[c] = Number(l));
1609
+ const { origin: a } = o;
1610
+ if (Array.isArray(a) && a.length >= 2) {
1611
+ const [c, l, u] = a.map(Number);
1612
+ o.origin = [Number.isNaN(c) ? r : c, Number.isNaN(l) ? n : l, u || i];
1541
1613
  } else
1542
- o.origin = [r, s, i];
1543
- return this.segments = Dt(n, o), this;
1614
+ o.origin = [r, n, i];
1615
+ return this.segments = Wt(s, o), this;
1544
1616
  }
1545
1617
  /**
1546
1618
  * Rotate path 180deg vertically
@@ -1548,8 +1620,8 @@ class A {
1548
1620
  * @public
1549
1621
  */
1550
1622
  flipX() {
1551
- const { cx: t, cy: n } = this.bbox;
1552
- return this.transform({ rotate: [0, 180, 0], origin: [t, n, 0] }), this;
1623
+ const { cx: t, cy: s } = this.bbox;
1624
+ return this.transform({ rotate: [0, 180, 0], origin: [t, s, 0] }), this;
1553
1625
  }
1554
1626
  /**
1555
1627
  * Rotate path 180deg horizontally
@@ -1557,8 +1629,8 @@ class A {
1557
1629
  * @public
1558
1630
  */
1559
1631
  flipY() {
1560
- const { cx: t, cy: n } = this.bbox;
1561
- return this.transform({ rotate: [180, 0, 0], origin: [t, n, 0] }), this;
1632
+ const { cx: t, cy: s } = this.bbox;
1633
+ return this.transform({ rotate: [180, 0, 0], origin: [t, s, 0] }), this;
1562
1634
  }
1563
1635
  /**
1564
1636
  * Export the current path to be used
@@ -1568,11 +1640,22 @@ class A {
1568
1640
  * @return the path string
1569
1641
  */
1570
1642
  toString() {
1571
- return Ct(this.segments, this.round);
1643
+ return $t(this.segments, this.round);
1572
1644
  }
1573
1645
  }
1574
- N(A, "CSSMatrix", v), N(A, "getSVGMatrix", ue), N(A, "getPathBBox", zt), N(A, "getPathArea", oe), N(A, "getTotalLength", W), N(A, "getDrawDirection", Be), N(A, "getPointAtLength", nt), N(A, "getPropertiesAtLength", Tt), N(A, "getPropertiesAtPoint", pt), N(A, "polygonLength", Ne), N(A, "polygonArea", we), N(A, "getClosestPoint", Ye), N(A, "getSegmentOfPoint", He), N(A, "getSegmentAtLength", Fe), N(A, "isPointInStroke", Ue), N(A, "isValidPath", ce), N(A, "isPathArray", dt), N(A, "isAbsoluteArray", le), N(A, "isRelativeArray", Ve), N(A, "isCurveArray", _e), N(A, "isNormalizedArray", ae), N(A, "shapeToPath", en), N(A, "shapeToPathArray", me), N(A, "parsePathString", q), N(A, "roundPath", ht), N(A, "splitPath", Ot), N(A, "splitCubic", cn), N(A, "optimizePath", jt), N(A, "reverseCurve", rn), N(A, "reversePath", lt), N(A, "normalizePath", rt), N(A, "transformPath", Dt), N(A, "pathToAbsolute", ft), N(A, "pathToRelative", vt), N(A, "pathToCurve", mt), N(A, "pathToString", Ct);
1646
+ g(p, "CSSMatrix", C), g(p, "pathToAbsolute", xt), g(p, "pathToRelative", Xt), g(p, "pathToCurve", gt), g(p, "pathToString", $t), g(p, "arcTools", Be), g(p, "bezierTools", {
1647
+ Cvalues: be,
1648
+ Tvalues: qt,
1649
+ minmaxC: kt,
1650
+ minmaxQ: pt,
1651
+ getBezierLength: ft,
1652
+ bezierLength: we,
1653
+ calculateBezier: Me,
1654
+ computeBezier: Ae,
1655
+ deriveBezier: de,
1656
+ CBEZIER_MINMAX_EPSILON: Ne
1657
+ }), g(p, "cubicTools", { getCubicLength: _t, getCubicBBox: Te, getPointAtCubicLength: ve, getPointAtCubicSegmentLength: Le }), g(p, "lineTools", { getPointAtLineLength: Ot, getLineBBox: zt, getLineLength: lt }), g(p, "quadTools", { getPointAtQuadSegmentLength: Ce, getQuadLength: Ft, getQuadBBox: ze, getPointAtQuadLength: $e }), g(p, "polygonTools", { polygonArea: _e, polygonLength: Fe }), g(p, "distanceSquareRoot", Mt), g(p, "distanceEpsilon", bt), g(p, "midPoint", O), g(p, "rotateVector", ct), g(p, "roundTo", z), g(p, "finalizeSegment", Tt), g(p, "invalidPathValue", U), g(p, "isArcCommand", fe), g(p, "isDigit", H), g(p, "isDigitStart", he), g(p, "isMoveCommand", ye), g(p, "isPathCommand", me), g(p, "isSpace", ue), g(p, "paramsCount", nt), g(p, "paramsParser", X), g(p, "pathParser", Rt), g(p, "scanFlag", ae), g(p, "scanParam", le), g(p, "scanSegment", Et), g(p, "skipSpaces", st), g(p, "getPathBBox", Jt), g(p, "getPathArea", Pe), g(p, "getTotalLength", rt), g(p, "getDrawDirection", Xe), g(p, "getPointAtLength", at), g(p, "getPropertiesAtLength", Ht), g(p, "getPropertiesAtPoint", Nt), g(p, "getClosestPoint", He), g(p, "getSegmentOfPoint", Ye), g(p, "getSegmentAtLength", Je), g(p, "isPointInStroke", We), g(p, "isValidPath", Ie), g(p, "isPathArray", Lt), g(p, "isAbsoluteArray", qe), g(p, "isRelativeArray", Ve), g(p, "isCurveArray", Ke), g(p, "isNormalizedArray", ke), g(p, "shapeToPath", rn), g(p, "shapeToPathArray", Ee), g(p, "shapeParams", mt), g(p, "parsePathString", R), g(p, "absolutizeSegment", jt), g(p, "arcToCubic", Dt), g(p, "getSVGMatrix", Re), g(p, "iterate", j), g(p, "lineToCubic", Ct), g(p, "normalizePath", ut), g(p, "normalizeSegment", G), g(p, "optimizePath", Yt), g(p, "projection2d", It), g(p, "quadToCubic", xe), g(p, "relativizeSegment", St), g(p, "reverseCurve", cn), g(p, "reversePath", yt), g(p, "roundPath", an), g(p, "roundSegment", dt), g(p, "segmentToCubic", Zt), g(p, "shortenSegment", je), g(p, "splitCubic", ln), g(p, "splitPath", Kt), g(p, "transformPath", Wt);
1575
1658
  export {
1576
- A as default
1659
+ p as default
1577
1660
  };
1578
1661
  //# sourceMappingURL=svg-path-commander.mjs.map