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