svg-path-commander 2.0.4 → 2.0.5

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.
@@ -1,10 +1,10 @@
1
- var Vt = Object.defineProperty;
2
- var Gt = (e, t, n) => t in e ? Vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var N = (e, t, n) => (Gt(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- const at = {
1
+ var Gt = Object.defineProperty;
2
+ var te = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var N = (e, t, n) => (te(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ const mt = {
5
5
  origin: [0, 0, 0],
6
6
  round: 4
7
- }, O = "SVGPathCommander Error", K = {
7
+ }, k = "SVGPathCommander Error", U = {
8
8
  a: 7,
9
9
  c: 6,
10
10
  h: 1,
@@ -16,12 +16,12 @@ const at = {
16
16
  t: 2,
17
17
  v: 1,
18
18
  z: 0
19
- }, Ct = (e) => {
19
+ }, Tt = (e) => {
20
20
  let t = e.pathValue[e.segmentStart], n = t.toLowerCase();
21
21
  const { data: r } = e;
22
- for (; r.length >= K[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, K[n])]), !!K[n]); )
22
+ for (; r.length >= U[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, U[n])]), !!U[n]); )
23
23
  ;
24
- }, te = (e) => {
24
+ }, ee = (e) => {
25
25
  const { index: t, pathValue: n } = e, r = n.charCodeAt(t);
26
26
  if (r === 48) {
27
27
  e.param = 0, e.index += 1;
@@ -31,21 +31,21 @@ const at = {
31
31
  e.param = 1, e.index += 1;
32
32
  return;
33
33
  }
34
- e.err = `${O}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`;
35
- }, D = (e) => e >= 48 && e <= 57, X = "Invalid path value", ee = (e) => {
34
+ e.err = `${k}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`;
35
+ }, D = (e) => e >= 48 && e <= 57, R = "Invalid path value", ne = (e) => {
36
36
  const { max: t, pathValue: n, index: r } = e;
37
37
  let s = r, i = !1, o = !1, a = !1, l = !1, c;
38
38
  if (s >= t) {
39
- e.err = `${O}: ${X} at index ${s}, "pathValue" is missing param`;
39
+ e.err = `${k}: ${R} at index ${s}, "pathValue" is missing param`;
40
40
  return;
41
41
  }
42
42
  if (c = n.charCodeAt(s), (c === 43 || c === 45) && (s += 1, c = n.charCodeAt(s)), !D(c) && c !== 46) {
43
- e.err = `${O}: ${X} at index ${s}, "${n[s]}" is not a number`;
43
+ e.err = `${k}: ${R} at index ${s}, "${n[s]}" is not a number`;
44
44
  return;
45
45
  }
46
46
  if (c !== 46) {
47
47
  if (i = c === 48, s += 1, c = n.charCodeAt(s), i && s < t && c && D(c)) {
48
- e.err = `${O}: ${X} at index ${r}, "${n[r]}" illegal number`;
48
+ e.err = `${k}: ${R} at index ${r}, "${n[r]}" illegal number`;
49
49
  return;
50
50
  }
51
51
  for (; s < t && D(n.charCodeAt(s)); )
@@ -59,19 +59,19 @@ const at = {
59
59
  }
60
60
  if (c === 101 || c === 69) {
61
61
  if (l && !o && !a) {
62
- e.err = `${O}: ${X} at index ${s}, "${n[s]}" invalid float exponent`;
62
+ e.err = `${k}: ${R} at index ${s}, "${n[s]}" invalid float exponent`;
63
63
  return;
64
64
  }
65
65
  if (s += 1, c = n.charCodeAt(s), (c === 43 || c === 45) && (s += 1), s < t && D(n.charCodeAt(s)))
66
66
  for (; s < t && D(n.charCodeAt(s)); )
67
67
  s += 1;
68
68
  else {
69
- e.err = `${O}: ${X} at index ${s}, "${n[s]}" invalid integer exponent`;
69
+ e.err = `${k}: ${R} at index ${s}, "${n[s]}" invalid integer exponent`;
70
70
  return;
71
71
  }
72
72
  }
73
73
  e.index = s, e.param = +e.pathValue.slice(r, s);
74
- }, ne = (e) => [
74
+ }, se = (e) => [
75
75
  // Special spaces
76
76
  5760,
77
77
  6158,
@@ -101,11 +101,11 @@ const at = {
101
101
  11,
102
102
  12,
103
103
  160
104
- ].includes(e), _ = (e) => {
104
+ ].includes(e), V = (e) => {
105
105
  const { pathValue: t, max: n } = e;
106
- for (; e.index < n && ne(t.charCodeAt(e.index)); )
106
+ for (; e.index < n && se(t.charCodeAt(e.index)); )
107
107
  e.index += 1;
108
- }, se = (e) => {
108
+ }, re = (e) => {
109
109
  switch (e | 32) {
110
110
  case 109:
111
111
  case 122:
@@ -121,53 +121,53 @@ const at = {
121
121
  default:
122
122
  return !1;
123
123
  }
124
- }, re = (e) => D(e) || e === 43 || e === 45 || e === 46, ie = (e) => (e | 32) === 97, It = (e) => {
125
- const { max: t, pathValue: n, index: r } = e, s = n.charCodeAt(r), i = K[n[r].toLowerCase()];
126
- if (e.segmentStart = r, !se(s)) {
127
- e.err = `${O}: ${X} "${n[r]}" is not a path command`;
124
+ }, ie = (e) => D(e) || e === 43 || e === 45 || e === 46, oe = (e) => (e | 32) === 97, jt = (e) => {
125
+ const { max: t, pathValue: n, index: r } = e, s = n.charCodeAt(r), i = U[n[r].toLowerCase()];
126
+ if (e.segmentStart = r, !re(s)) {
127
+ e.err = `${k}: ${R} "${n[r]}" is not a path command`;
128
128
  return;
129
129
  }
130
- if (e.index += 1, _(e), e.data = [], !i) {
131
- Ct(e);
130
+ if (e.index += 1, V(e), e.data = [], !i) {
131
+ Tt(e);
132
132
  return;
133
133
  }
134
134
  for (; ; ) {
135
135
  for (let o = i; o > 0; o -= 1) {
136
- if (ie(s) && (o === 3 || o === 4) ? te(e) : ee(e), e.err.length)
136
+ if (oe(s) && (o === 3 || o === 4) ? ee(e) : ne(e), e.err.length)
137
137
  return;
138
- e.data.push(e.param), _(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, _(e));
138
+ e.data.push(e.param), V(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, V(e));
139
139
  }
140
- if (e.index >= e.max || !re(n.charCodeAt(e.index)))
140
+ if (e.index >= e.max || !ie(n.charCodeAt(e.index)))
141
141
  break;
142
142
  }
143
- Ct(e);
143
+ Tt(e);
144
144
  };
145
- class jt {
145
+ class zt {
146
146
  constructor(t) {
147
147
  this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
148
148
  }
149
149
  }
150
- const mt = (e) => Array.isArray(e) && e.every((t) => {
150
+ const _ = (e) => Array.isArray(e) && e.every((t) => {
151
151
  const n = t[0].toLowerCase();
152
- return K[n] === t.length - 1 && "achlmqstvz".includes(n);
153
- }), Q = (e) => {
154
- if (mt(e))
152
+ return U[n] === t.length - 1 && "achlmqstvz".includes(n) && t.slice(1).every(Number.isFinite);
153
+ }) && e.length > 0, Z = (e) => {
154
+ if (_(e))
155
155
  return [...e];
156
- const t = new jt(e);
157
- for (_(t); t.index < t.max && !t.err.length; )
158
- It(t);
156
+ const t = new zt(e);
157
+ for (V(t); t.index < t.max && !t.err.length; )
158
+ jt(t);
159
159
  if (t.err && t.err.length)
160
160
  throw TypeError(t.err);
161
161
  return t.segments;
162
- }, oe = (e) => {
162
+ }, ce = (e) => {
163
163
  const t = e.length;
164
164
  let n = -1, r, s = e[t - 1], i = 0;
165
165
  for (; ++n < t; )
166
166
  r = s, s = e[n], i += r[1] * s[0] - r[0] * s[1];
167
167
  return i / 2;
168
- }, V = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), ce = (e) => e.reduce((t, n, r) => r ? t + V(e[r - 1], n) : 0, 0);
169
- var le = Object.defineProperty, ae = (e, t, n) => t in e ? le(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (ae(e, typeof t != "symbol" ? t + "" : t, n), n);
170
- const me = {
168
+ }, W = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), le = (e) => e.reduce((t, n, r) => r ? t + W(e[r - 1], n) : 0, 0);
169
+ var ae = Object.defineProperty, me = (e, t, n) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (me(e, typeof t != "symbol" ? t + "" : t, n), n);
170
+ const he = {
171
171
  a: 1,
172
172
  b: 0,
173
173
  c: 0,
@@ -192,13 +192,13 @@ const me = {
192
192
  m44: 1,
193
193
  is2D: !0,
194
194
  isIdentity: !0
195
- }, Et = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Dt = (e) => e instanceof DOMMatrix || e instanceof v || typeof e == "object" && Object.keys(me).every((t) => e && t in e), G = (e) => {
195
+ }, It = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Dt = (e) => e instanceof DOMMatrix || e instanceof v || typeof e == "object" && Object.keys(he).every((t) => e && t in e), G = (e) => {
196
196
  const t = new v(), n = Array.from(e);
197
- if (!Et(n))
197
+ if (!It(n))
198
198
  throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);
199
199
  if (n.length === 16) {
200
- const [r, s, i, o, a, l, c, m, f, y, g, h, u, x, p, b] = n;
201
- t.m11 = r, t.a = r, t.m21 = a, t.c = a, t.m31 = f, t.m41 = u, t.e = u, t.m12 = s, t.b = s, t.m22 = l, t.d = l, t.m32 = y, t.m42 = x, t.f = x, t.m13 = i, t.m23 = c, t.m33 = g, t.m43 = p, t.m14 = o, t.m24 = m, t.m34 = h, t.m44 = b;
200
+ const [r, s, i, o, a, l, c, m, u, y, g, f, h, x, p, b] = n;
201
+ t.m11 = r, t.a = r, t.m21 = a, t.c = a, t.m31 = u, t.m41 = h, t.e = h, t.m12 = s, t.b = s, t.m22 = l, t.d = l, t.m32 = y, t.m42 = x, t.f = x, t.m13 = i, t.m23 = c, t.m33 = g, t.m43 = p, t.m14 = o, t.m24 = m, t.m34 = f, t.m44 = b;
202
202
  } else if (n.length === 6) {
203
203
  const [r, s, i, o, a, l] = n;
204
204
  t.m11 = r, t.a = r, t.m12 = s, t.b = s, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = a, t.e = a, t.m42 = l, t.f = l;
@@ -225,7 +225,7 @@ const me = {
225
225
  e.m44
226
226
  ]);
227
227
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);
228
- }, Rt = (e) => {
228
+ }, Ft = (e) => {
229
229
  if (typeof e != "string")
230
230
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);
231
231
  const t = String(e).replace(/\s/g, "");
@@ -235,33 +235,33 @@ const me = {
235
235
  const [i, o] = s.split("(");
236
236
  if (!o)
237
237
  throw TypeError(r);
238
- const a = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [l, c, m, f] = a, y = [l, c, m], g = [l, c, m, f];
239
- if (i === "perspective" && l && [c, m].every((h) => h === void 0))
238
+ const a = o.split(",").map((f) => f.includes("rad") ? parseFloat(f) * (180 / Math.PI) : parseFloat(f)), [l, c, m, u] = a, y = [l, c, m], g = [l, c, m, u];
239
+ if (i === "perspective" && l && [c, m].every((f) => f === void 0))
240
240
  n.m34 = -1 / l;
241
- else if (i.includes("matrix") && [6, 16].includes(a.length) && a.every((h) => !Number.isNaN(+h))) {
242
- const h = a.map((u) => Math.abs(u) < 1e-6 ? 0 : u);
243
- n = n.multiply(G(h));
244
- } else if (i === "translate3d" && y.every((h) => !Number.isNaN(+h)))
241
+ else if (i.includes("matrix") && [6, 16].includes(a.length) && a.every((f) => !Number.isNaN(+f))) {
242
+ const f = a.map((h) => Math.abs(h) < 1e-6 ? 0 : h);
243
+ n = n.multiply(G(f));
244
+ } else if (i === "translate3d" && y.every((f) => !Number.isNaN(+f)))
245
245
  n = n.translate(l, c, m);
246
246
  else if (i === "translate" && l && m === void 0)
247
247
  n = n.translate(l, c || 0, 0);
248
- else if (i === "rotate3d" && g.every((h) => !Number.isNaN(+h)) && f)
249
- n = n.rotateAxisAngle(l, c, m, f);
250
- else if (i === "rotate" && l && [c, m].every((h) => h === void 0))
248
+ else if (i === "rotate3d" && g.every((f) => !Number.isNaN(+f)) && u)
249
+ n = n.rotateAxisAngle(l, c, m, u);
250
+ else if (i === "rotate" && l && [c, m].every((f) => f === void 0))
251
251
  n = n.rotate(0, 0, l);
252
- else if (i === "scale3d" && y.every((h) => !Number.isNaN(+h)) && y.some((h) => h !== 1))
252
+ else if (i === "scale3d" && y.every((f) => !Number.isNaN(+f)) && y.some((f) => f !== 1))
253
253
  n = n.scale(l, c, m);
254
254
  else if (i === "scale" && !Number.isNaN(l) && l !== 1 && m === void 0) {
255
- const h = Number.isNaN(+c) ? l : c;
256
- n = n.scale(l, h, 1);
255
+ const f = Number.isNaN(+c) ? l : c;
256
+ n = n.scale(l, f, 1);
257
257
  } else if (i === "skew" && (l || !Number.isNaN(l) && c) && m === void 0)
258
258
  n = n.skew(l, c || 0);
259
- else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && l && [c, m].every((h) => h === void 0))
259
+ else if (["translate", "rotate", "scale", "skew"].some((f) => i.includes(f)) && /[XYZ]/.test(i) && l && [c, m].every((f) => f === void 0))
260
260
  if (i === "skewX" || i === "skewY")
261
261
  n = n[i](l);
262
262
  else {
263
- const h = i.replace(/[XYZ]/, ""), u = i.replace(h, ""), x = ["X", "Y", "Z"].indexOf(u), p = h === "scale" ? 1 : 0, b = [x === 0 ? l : p, x === 1 ? l : p, x === 2 ? l : p];
264
- n = n[h](...b);
263
+ const f = i.replace(/[XYZ]/, ""), h = i.replace(f, ""), x = ["X", "Y", "Z"].indexOf(h), p = f === "scale" ? 1 : 0, b = [x === 0 ? l : p, x === 1 ? l : p, x === 2 ? l : p];
264
+ n = n[f](...b);
265
265
  }
266
266
  else
267
267
  throw TypeError(r);
@@ -283,28 +283,28 @@ const me = {
283
283
  e.m42,
284
284
  e.m43,
285
285
  e.m44
286
- ], Xt = (e, t, n) => {
286
+ ], Rt = (e, t, n) => {
287
287
  const r = new v();
288
288
  return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = n, r;
289
- }, Ft = (e, t, n) => {
290
- const r = new v(), s = Math.PI / 180, i = e * s, o = t * s, a = n * s, l = Math.cos(i), c = -Math.sin(i), m = Math.cos(o), f = -Math.sin(o), y = Math.cos(a), g = -Math.sin(a), h = m * y, u = -m * g;
291
- r.m11 = h, r.a = h, r.m12 = u, r.b = u, r.m13 = f;
292
- const x = c * f * y + l * g;
289
+ }, Xt = (e, t, n) => {
290
+ const r = new v(), s = Math.PI / 180, i = e * s, o = t * s, a = n * s, l = Math.cos(i), c = -Math.sin(i), m = Math.cos(o), u = -Math.sin(o), y = Math.cos(a), g = -Math.sin(a), f = m * y, h = -m * g;
291
+ r.m11 = f, r.a = f, r.m12 = h, r.b = h, r.m13 = u;
292
+ const x = c * u * y + l * g;
293
293
  r.m21 = x, r.c = x;
294
- const p = l * y - c * f * g;
295
- return r.m22 = p, r.d = p, r.m23 = -c * m, r.m31 = c * g - l * f * y, r.m32 = c * y + l * f * g, r.m33 = l * m, r;
294
+ const p = l * y - c * u * g;
295
+ return r.m22 = p, r.d = p, r.m23 = -c * m, r.m31 = c * g - l * u * y, r.m32 = c * y + l * u * g, r.m33 = l * m, r;
296
296
  }, Qt = (e, t, n, r) => {
297
297
  const s = new v(), i = Math.sqrt(e * e + t * t + n * n);
298
298
  if (i === 0)
299
299
  return s;
300
- const o = e / i, a = t / i, l = n / i, c = r * (Math.PI / 360), m = Math.sin(c), f = Math.cos(c), y = m * m, g = o * o, h = a * a, u = l * l, x = 1 - 2 * (h + u) * y;
300
+ const o = e / i, a = t / i, l = n / i, c = r * (Math.PI / 360), m = Math.sin(c), u = Math.cos(c), y = m * m, g = o * o, f = a * a, h = l * l, x = 1 - 2 * (f + h) * y;
301
301
  s.m11 = x, s.a = x;
302
- const p = 2 * (o * a * y + l * m * f);
303
- s.m12 = p, s.b = p, s.m13 = 2 * (o * l * y - a * m * f);
304
- const b = 2 * (a * o * y - l * m * f);
302
+ const p = 2 * (o * a * y + l * m * u);
303
+ s.m12 = p, s.b = p, s.m13 = 2 * (o * l * y - a * m * u);
304
+ const b = 2 * (a * o * y - l * m * u);
305
305
  s.m21 = b, s.c = b;
306
- const A = 1 - 2 * (u + g) * y;
307
- return s.m22 = A, s.d = A, s.m23 = 2 * (a * l * y + o * m * f), s.m31 = 2 * (l * o * y + a * m * f), s.m32 = 2 * (l * a * y - o * m * f), s.m33 = 1 - 2 * (g + h) * y, s;
306
+ const A = 1 - 2 * (h + g) * y;
307
+ return s.m22 = A, s.d = A, s.m23 = 2 * (a * l * y + o * m * u), s.m31 = 2 * (l * o * y + a * m * u), s.m32 = 2 * (l * a * y - o * m * u), s.m33 = 1 - 2 * (g + f) * y, s;
308
308
  }, Ht = (e, t, n) => {
309
309
  const r = new v();
310
310
  return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = n, r;
@@ -319,9 +319,9 @@ const me = {
319
319
  n.m12 = s, n.b = s;
320
320
  }
321
321
  return n;
322
- }, Yt = (e) => ht(e, 0), Bt = (e) => ht(0, e), $ = (e, t) => {
323
- const n = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, s = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, a = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, l = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, c = 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, f = 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, g = 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, u = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, p = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
324
- return G([n, r, s, i, o, a, l, c, m, f, y, g, h, u, x, p]);
322
+ }, Yt = (e) => ht(e, 0), Bt = (e) => ht(0, e), O = (e, t) => {
323
+ const n = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, s = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, a = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, l = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, c = 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, g = 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, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, p = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
324
+ return G([n, r, s, i, o, a, l, c, m, u, y, g, f, h, x, p]);
325
325
  };
326
326
  class v {
327
327
  /**
@@ -368,7 +368,7 @@ class v {
368
368
  * @return the matrix instance
369
369
  */
370
370
  setMatrixValue(t) {
371
- return typeof t == "string" && t.length && t !== "none" ? Rt(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? G(t) : typeof t == "object" ? Zt(t) : this;
371
+ return typeof t == "string" && t.length && t !== "none" ? Ft(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? G(t) : typeof t == "object" ? Zt(t) : this;
372
372
  }
373
373
  /**
374
374
  * Returns a *Float32Array* containing elements which comprise the matrix.
@@ -428,7 +428,7 @@ class v {
428
428
  * @return The resulted matrix.
429
429
  */
430
430
  multiply(t) {
431
- return $(this, t);
431
+ return O(this, t);
432
432
  }
433
433
  /**
434
434
  * The translate method returns a new matrix which is this matrix post
@@ -444,7 +444,7 @@ class v {
444
444
  translate(t, n, r) {
445
445
  const s = t;
446
446
  let i = n, o = r;
447
- return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), $(this, Xt(s, i, o));
447
+ return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), O(this, Rt(s, i, o));
448
448
  }
449
449
  /**
450
450
  * The scale method returns a new matrix which is this matrix post multiplied by
@@ -460,7 +460,7 @@ class v {
460
460
  scale(t, n, r) {
461
461
  const s = t;
462
462
  let i = n, o = r;
463
- return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), $(this, Ht(s, i, o));
463
+ return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), O(this, Ht(s, i, o));
464
464
  }
465
465
  /**
466
466
  * The rotate method returns a new matrix which is this matrix post multiplied
@@ -476,7 +476,7 @@ class v {
476
476
  */
477
477
  rotate(t, n, r) {
478
478
  let s = t, i = n || 0, o = r || 0;
479
- return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), $(this, Ft(s, i, o));
479
+ return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), O(this, Xt(s, i, o));
480
480
  }
481
481
  /**
482
482
  * The rotateAxisAngle method returns a new matrix which is this matrix post
@@ -493,7 +493,7 @@ class v {
493
493
  rotateAxisAngle(t, n, r, s) {
494
494
  if ([t, n, r, s].some((i) => Number.isNaN(+i)))
495
495
  throw new TypeError("CSSMatrix: expecting 4 values");
496
- return $(this, Qt(t, n, r, s));
496
+ return O(this, Qt(t, n, r, s));
497
497
  }
498
498
  /**
499
499
  * Specifies a skew transformation along the `x-axis` by the given angle.
@@ -503,7 +503,7 @@ class v {
503
503
  * @return The resulted matrix
504
504
  */
505
505
  skewX(t) {
506
- return $(this, Yt(t));
506
+ return O(this, Yt(t));
507
507
  }
508
508
  /**
509
509
  * Specifies a skew transformation along the `y-axis` by the given angle.
@@ -513,7 +513,7 @@ class v {
513
513
  * @return The resulted matrix
514
514
  */
515
515
  skewY(t) {
516
- return $(this, Bt(t));
516
+ return O(this, Bt(t));
517
517
  }
518
518
  /**
519
519
  * Specifies a skew transformation along both the `x-axis` and `y-axis`.
@@ -524,7 +524,7 @@ class v {
524
524
  * @return The resulted matrix
525
525
  */
526
526
  skew(t, n) {
527
- return $(this, ht(t, n));
527
+ return O(this, ht(t, n));
528
528
  }
529
529
  /**
530
530
  * Transforms a specified vector using the matrix, returning a new
@@ -547,12 +547,12 @@ class v {
547
547
  };
548
548
  }
549
549
  }
550
- C(v, "Translate", Xt), C(v, "Rotate", Ft), C(v, "RotateAxisAngle", Qt), C(v, "Scale", Ht), C(v, "SkewX", Yt), C(v, "SkewY", Bt), C(v, "Skew", ht), C(v, "Multiply", $), C(v, "fromArray", G), C(v, "fromMatrix", Zt), C(v, "fromString", Rt), C(v, "toArray", bt), C(v, "isCompatibleArray", Et), C(v, "isCompatibleObject", Dt);
551
- const Nt = (e) => mt(e) && // `isPathArray` also checks if it's `Array`
552
- e.every(([t]) => t === t.toUpperCase()), H = (e) => {
553
- if (Nt(e))
550
+ C(v, "Translate", Rt), C(v, "Rotate", Xt), C(v, "RotateAxisAngle", Qt), C(v, "Scale", Ht), C(v, "SkewX", Yt), C(v, "SkewY", Bt), C(v, "Skew", ht), C(v, "Multiply", O), C(v, "fromArray", G), C(v, "fromMatrix", Zt), C(v, "fromString", Ft), C(v, "toArray", bt), C(v, "isCompatibleArray", It), C(v, "isCompatibleObject", Dt);
551
+ const wt = (e) => _(e) && // `isPathArray` also checks if it's `Array`
552
+ e.every(([t]) => t === t.toUpperCase()), Q = (e) => {
553
+ if (wt(e))
554
554
  return [...e];
555
- const t = Q(e);
555
+ const t = Z(e);
556
556
  let n = 0, r = 0, s = 0, i = 0;
557
557
  return t.map((o) => {
558
558
  const a = o.slice(1).map(Number), [l] = o, c = l.toUpperCase();
@@ -576,14 +576,14 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
576
576
  else if (c === "H")
577
577
  m = [c, a[0] + n];
578
578
  else {
579
- const f = a.map((y, g) => y + (g % 2 ? r : n));
580
- m = [c, ...f];
579
+ const u = a.map((y, g) => y + (g % 2 ? r : n));
580
+ m = [c, ...u];
581
581
  }
582
582
  else
583
583
  m = [c, ...a];
584
584
  return c === "Z" ? (n = s, r = i) : c === "H" ? [, n] = m : c === "V" ? [, r] = m : ([n, r] = m.slice(-2), c === "M" && (s = n, i = r)), m;
585
585
  });
586
- }, he = (e, t) => {
586
+ }, ue = (e, t) => {
587
587
  const [n] = e, { x1: r, y1: s, x2: i, y2: o } = t, a = e.slice(1).map(Number);
588
588
  let l = e;
589
589
  if ("TQ".includes(n) || (t.qx = null, t.qy = null), n === "H")
@@ -607,7 +607,7 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
607
607
  t.qx = c, t.qy = m;
608
608
  }
609
609
  return l;
610
- }, wt = (e) => Nt(e) && e.every(([t]) => "ACLMQZ".includes(t)), ut = {
610
+ }, vt = (e) => wt(e) && e.every(([t]) => "ACLMQZ".includes(t)), ut = {
611
611
  x1: 0,
612
612
  y1: 0,
613
613
  x2: 0,
@@ -616,21 +616,21 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
616
616
  y: 0,
617
617
  qx: null,
618
618
  qy: null
619
- }, j = (e) => {
620
- if (wt(e))
619
+ }, z = (e) => {
620
+ if (vt(e))
621
621
  return [...e];
622
- const t = H(e), n = { ...ut }, r = t.length;
622
+ const t = Q(e), n = { ...ut }, r = t.length;
623
623
  for (let s = 0; s < r; s += 1) {
624
- t[s], t[s] = he(t[s], n);
624
+ t[s], t[s] = ue(t[s], n);
625
625
  const i = t[s], o = i.length;
626
626
  n.x1 = +i[o - 2], n.y1 = +i[o - 1], n.x2 = +i[o - 4] || n.x1, n.y2 = +i[o - 3] || n.y1;
627
627
  }
628
628
  return t;
629
- }, I = (e, t, n) => {
629
+ }, j = (e, t, n) => {
630
630
  const [r, s] = e, [i, o] = t;
631
631
  return [r + (i - r) * n, s + (o - s) * n];
632
632
  }, dt = (e, t, n, r, s) => {
633
- const i = V([e, t], [n, r]);
633
+ const i = W([e, t], [n, r]);
634
634
  let o = { x: 0, y: 0 };
635
635
  if (typeof s == "number")
636
636
  if (s <= 0)
@@ -638,7 +638,7 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
638
638
  else if (s >= i)
639
639
  o = { x: n, y: r };
640
640
  else {
641
- const [a, l] = I([e, t], [n, r], s / i);
641
+ const [a, l] = j([e, t], [n, r], s / i);
642
642
  o = { x: a, y: l };
643
643
  }
644
644
  return {
@@ -653,59 +653,59 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
653
653
  y: Math.max(t, r)
654
654
  }
655
655
  };
656
- }, Tt = (e, t) => {
656
+ }, Lt = (e, t) => {
657
657
  const { x: n, y: r } = e, { x: s, y: i } = t, o = n * s + r * i, a = Math.sqrt((n ** 2 + r ** 2) * (s ** 2 + i ** 2));
658
658
  return (n * i - r * s < 0 ? -1 : 1) * Math.acos(o / a);
659
- }, ue = (e, t, n, r, s, i, o, a, l, c) => {
660
- const { abs: m, sin: f, cos: y, sqrt: g, PI: h } = Math;
661
- let u = m(n), x = m(r);
662
- const b = (s % 360 + 360) % 360 * (h / 180);
659
+ }, fe = (e, t, n, r, s, i, o, a, l, c) => {
660
+ const { abs: m, sin: u, cos: y, sqrt: g, PI: f } = Math;
661
+ let h = m(n), x = m(r);
662
+ const b = (s % 360 + 360) % 360 * (f / 180);
663
663
  if (e === a && t === l)
664
664
  return { x: e, y: t };
665
- if (u === 0 || x === 0)
665
+ if (h === 0 || x === 0)
666
666
  return dt(e, t, a, l, c).point;
667
667
  const A = (e - a) / 2, d = (t - l) / 2, M = {
668
- x: y(b) * A + f(b) * d,
669
- y: -f(b) * A + y(b) * d
670
- }, T = M.x ** 2 / u ** 2 + M.y ** 2 / x ** 2;
671
- T > 1 && (u *= g(T), x *= g(T));
672
- const z = u ** 2 * x ** 2 - u ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, Y = u ** 2 * M.y ** 2 + x ** 2 * M.x ** 2;
673
- let R = z / Y;
674
- R = R < 0 ? 0 : R;
675
- const tt = (i !== o ? 1 : -1) * g(R), k = {
676
- x: tt * (u * M.y / x),
677
- y: tt * (-(x * M.x) / u)
668
+ x: y(b) * A + u(b) * d,
669
+ y: -u(b) * A + y(b) * d
670
+ }, T = M.x ** 2 / h ** 2 + M.y ** 2 / x ** 2;
671
+ T > 1 && (h *= g(T), x *= g(T));
672
+ const E = h ** 2 * x ** 2 - h ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, H = h ** 2 * M.y ** 2 + x ** 2 * M.x ** 2;
673
+ let F = E / H;
674
+ F = F < 0 ? 0 : F;
675
+ const tt = (i !== o ? 1 : -1) * g(F), S = {
676
+ x: tt * (h * M.y / x),
677
+ y: tt * (-(x * M.x) / h)
678
678
  }, et = {
679
- x: y(b) * k.x - f(b) * k.y + (e + a) / 2,
680
- y: f(b) * k.x + y(b) * k.y + (t + l) / 2
681
- }, B = {
682
- x: (M.x - k.x) / u,
683
- y: (M.y - k.y) / x
684
- }, nt = Tt({ x: 1, y: 0 }, B), st = {
685
- x: (-M.x - k.x) / u,
686
- y: (-M.y - k.y) / x
679
+ x: y(b) * S.x - u(b) * S.y + (e + a) / 2,
680
+ y: u(b) * S.x + y(b) * S.y + (t + l) / 2
681
+ }, Y = {
682
+ x: (M.x - S.x) / h,
683
+ y: (M.y - S.y) / x
684
+ }, nt = Lt({ x: 1, y: 0 }, Y), st = {
685
+ x: (-M.x - S.x) / h,
686
+ y: (-M.y - S.y) / x
687
687
  };
688
- let S = Tt(B, st);
689
- !o && S > 0 ? S -= 2 * h : o && S < 0 && (S += 2 * h), S %= 2 * h;
690
- const q = nt + S * c, J = u * y(q), U = x * f(q);
688
+ let $ = Lt(Y, st);
689
+ !o && $ > 0 ? $ -= 2 * f : o && $ < 0 && ($ += 2 * f), $ %= 2 * f;
690
+ const q = nt + $ * c, B = h * y(q), J = x * u(q);
691
691
  return {
692
- x: y(b) * J - f(b) * U + et.x,
693
- y: f(b) * J + y(b) * U + et.y
692
+ x: y(b) * B - u(b) * J + et.x,
693
+ y: u(b) * B + y(b) * J + et.y
694
694
  };
695
- }, fe = (e, t, n, r, s, i, o, a, l, c) => {
695
+ }, ye = (e, t, n, r, s, i, o, a, l, c) => {
696
696
  const m = typeof c == "number";
697
- let f = e, y = t, g = 0, h = [f, y, g], u = [f, y], x = 0, p = { x: 0, y: 0 }, b = [{ x: f, y }];
698
- m && c <= 0 && (p = { x: f, y });
697
+ let u = e, y = t, g = 0, f = [u, y, g], h = [u, y], x = 0, p = { x: 0, y: 0 }, b = [{ x: u, y }];
698
+ m && c <= 0 && (p = { x: u, y });
699
699
  const A = 300;
700
700
  for (let d = 0; d <= A; d += 1) {
701
- if (x = d / A, { x: f, y } = ue(e, t, n, r, s, i, o, a, l, x), b = [...b, { x: f, y }], g += V(u, [f, y]), u = [f, y], m && g > c && c > h[2]) {
702
- const M = (g - c) / (g - h[2]);
701
+ if (x = d / A, { x: u, y } = fe(e, t, n, r, s, i, o, a, l, x), b = [...b, { x: u, y }], g += W(h, [u, y]), h = [u, y], m && g > c && c > f[2]) {
702
+ const M = (g - c) / (g - f[2]);
703
703
  p = {
704
- x: u[0] * (1 - M) + h[0] * M,
705
- y: u[1] * (1 - M) + h[1] * M
704
+ x: h[0] * (1 - M) + f[0] * M,
705
+ y: h[1] * (1 - M) + f[1] * M
706
706
  };
707
707
  }
708
- h = [f, y, g];
708
+ f = [u, y, g];
709
709
  }
710
710
  return m && c >= g && (p = { x: a, y: l }), {
711
711
  length: g,
@@ -719,26 +719,26 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
719
719
  y: Math.max(...b.map((d) => d.y))
720
720
  }
721
721
  };
722
- }, ye = (e, t, n, r, s, i, o, a, l) => {
722
+ }, ge = (e, t, n, r, s, i, o, a, l) => {
723
723
  const c = 1 - l;
724
724
  return {
725
725
  x: c ** 3 * e + 3 * c ** 2 * l * n + 3 * c * l ** 2 * s + l ** 3 * o,
726
726
  y: c ** 3 * t + 3 * c ** 2 * l * r + 3 * c * l ** 2 * i + l ** 3 * a
727
727
  };
728
- }, ge = (e, t, n, r, s, i, o, a, l) => {
728
+ }, xe = (e, t, n, r, s, i, o, a, l) => {
729
729
  const c = typeof l == "number";
730
- let m = e, f = t, y = 0, g = [m, f, y], h = [m, f], u = 0, x = { x: 0, y: 0 }, p = [{ x: m, y: f }];
731
- c && l <= 0 && (x = { x: m, y: f });
730
+ let m = e, u = t, y = 0, g = [m, u, y], f = [m, u], h = 0, x = { x: 0, y: 0 }, p = [{ x: m, y: u }];
731
+ c && l <= 0 && (x = { x: m, y: u });
732
732
  const b = 300;
733
733
  for (let A = 0; A <= b; A += 1) {
734
- if (u = A / b, { x: m, y: f } = ye(e, t, n, r, s, i, o, a, u), p = [...p, { x: m, y: f }], y += V(h, [m, f]), h = [m, f], c && y > l && l > g[2]) {
734
+ if (h = A / b, { x: m, y: u } = ge(e, t, n, r, s, i, o, a, h), p = [...p, { x: m, y: u }], y += W(f, [m, u]), f = [m, u], c && y > l && l > g[2]) {
735
735
  const d = (y - l) / (y - g[2]);
736
736
  x = {
737
- x: h[0] * (1 - d) + g[0] * d,
738
- y: h[1] * (1 - d) + g[1] * d
737
+ x: f[0] * (1 - d) + g[0] * d,
738
+ y: f[1] * (1 - d) + g[1] * d
739
739
  };
740
740
  }
741
- g = [m, f, y];
741
+ g = [m, u, y];
742
742
  }
743
743
  return c && l >= y && (x = { x: o, y: a }), {
744
744
  length: y,
@@ -752,59 +752,59 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
752
752
  y: Math.max(...p.map((A) => A.y))
753
753
  }
754
754
  };
755
- }, xe = (e, t, n, r, s, i, o) => {
755
+ }, pe = (e, t, n, r, s, i, o) => {
756
756
  const a = 1 - o;
757
757
  return {
758
758
  x: a ** 2 * e + 2 * a * o * n + o ** 2 * s,
759
759
  y: a ** 2 * t + 2 * a * o * r + o ** 2 * i
760
760
  };
761
- }, pe = (e, t, n, r, s, i, o) => {
761
+ }, be = (e, t, n, r, s, i, o) => {
762
762
  const a = typeof o == "number";
763
- let l = e, c = t, m = 0, f = [l, c, m], y = [l, c], g = 0, h = { x: 0, y: 0 }, u = [{ x: l, y: c }];
764
- a && o <= 0 && (h = { x: l, y: c });
763
+ let l = e, c = t, m = 0, u = [l, c, m], y = [l, c], g = 0, f = { x: 0, y: 0 }, h = [{ x: l, y: c }];
764
+ a && o <= 0 && (f = { x: l, y: c });
765
765
  const x = 300;
766
766
  for (let p = 0; p <= x; p += 1) {
767
- if (g = p / x, { x: l, y: c } = xe(e, t, n, r, s, i, g), u = [...u, { x: l, y: c }], m += V(y, [l, c]), y = [l, c], a && m > o && o > f[2]) {
768
- const b = (m - o) / (m - f[2]);
769
- h = {
770
- x: y[0] * (1 - b) + f[0] * b,
771
- y: y[1] * (1 - b) + f[1] * b
767
+ if (g = p / x, { x: l, y: c } = pe(e, t, n, r, s, i, g), h = [...h, { x: l, y: c }], m += W(y, [l, c]), y = [l, c], a && m > o && o > u[2]) {
768
+ const b = (m - o) / (m - u[2]);
769
+ f = {
770
+ x: y[0] * (1 - b) + u[0] * b,
771
+ y: y[1] * (1 - b) + u[1] * b
772
772
  };
773
773
  }
774
- f = [l, c, m];
774
+ u = [l, c, m];
775
775
  }
776
- return a && o >= m && (h = { x: s, y: i }), {
776
+ return a && o >= m && (f = { x: s, y: i }), {
777
777
  length: m,
778
- point: h,
778
+ point: f,
779
779
  min: {
780
- x: Math.min(...u.map((p) => p.x)),
781
- y: Math.min(...u.map((p) => p.y))
780
+ x: Math.min(...h.map((p) => p.x)),
781
+ y: Math.min(...h.map((p) => p.y))
782
782
  },
783
783
  max: {
784
- x: Math.max(...u.map((p) => p.x)),
785
- y: Math.max(...u.map((p) => p.y))
784
+ x: Math.max(...h.map((p) => p.x)),
785
+ y: Math.max(...h.map((p) => p.y))
786
786
  }
787
787
  };
788
788
  }, ft = (e, t) => {
789
- const n = j(e), r = typeof t == "number";
790
- let s, i = [], o, a = 0, l = 0, c = 0, m = 0, f, y = [], g = [], h = 0, u = { x: 0, y: 0 }, x = u, p = u, b = u, A = 0;
789
+ const n = z(e), r = typeof t == "number";
790
+ let s, i = [], o, a = 0, l = 0, c = 0, m = 0, u, y = [], g = [], f = 0, h = { x: 0, y: 0 }, x = h, p = h, b = h, A = 0;
791
791
  for (let d = 0, M = n.length; d < M; d += 1)
792
- f = n[d], [o] = f, s = o === "M", i = s ? i : [a, l, ...f.slice(1)], s ? ([, c, m] = f, u = { x: c, y: m }, x = u, h = 0, r && t < 1e-3 && (b = u)) : o === "L" ? { length: h, min: u, max: x, point: p } = dt(
792
+ u = n[d], [o] = u, s = o === "M", i = s ? i : [a, l, ...u.slice(1)], s ? ([, c, m] = u, h = { x: c, y: m }, x = h, f = 0, r && t < 1e-3 && (b = h)) : o === "L" ? { length: f, min: h, max: x, point: p } = dt(
793
793
  ...i,
794
794
  (t || 0) - A
795
- ) : o === "A" ? { length: h, min: u, max: x, point: p } = fe(
795
+ ) : o === "A" ? { length: f, min: h, max: x, point: p } = ye(
796
796
  ...i,
797
797
  (t || 0) - A
798
- ) : o === "C" ? { length: h, min: u, max: x, point: p } = ge(
798
+ ) : o === "C" ? { length: f, min: h, max: x, point: p } = xe(
799
799
  ...i,
800
800
  (t || 0) - A
801
- ) : o === "Q" ? { length: h, min: u, max: x, point: p } = pe(
801
+ ) : o === "Q" ? { length: f, min: h, max: x, point: p } = be(
802
802
  ...i,
803
803
  (t || 0) - A
804
- ) : o === "Z" && (i = [a, l, c, m], { length: h, min: u, max: x, point: p } = dt(
804
+ ) : o === "Z" && (i = [a, l, c, m], { length: f, min: h, max: x, point: p } = dt(
805
805
  ...i,
806
806
  (t || 0) - A
807
- )), r && A < t && A + h >= t && (b = p), g = [...g, x], y = [...y, u], A += h, [a, l] = o !== "Z" ? f.slice(-2) : [c, m];
807
+ )), r && A < t && A + f >= t && (b = p), g = [...g, x], y = [...y, h], A += f, [a, l] = o !== "Z" ? u.slice(-2) : [c, m];
808
808
  return r && t >= A && (b = { x: a, y: l }), {
809
809
  length: A,
810
810
  point: b,
@@ -817,7 +817,7 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
817
817
  y: Math.max(...g.map((d) => d.y))
818
818
  }
819
819
  };
820
- }, Lt = (e) => {
820
+ }, kt = (e) => {
821
821
  if (!e)
822
822
  return {
823
823
  x: 0,
@@ -855,38 +855,38 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
855
855
  t[n] = "A", e.splice(s += 1, 0, ["C", ...r.splice(0, 6)]);
856
856
  e.splice(n, 1);
857
857
  }
858
- }, Jt = (e) => wt(e) && e.every(([t]) => "MC".includes(t)), rt = (e, t, n) => {
858
+ }, Jt = (e) => vt(e) && e.every(([t]) => "MC".includes(t)), rt = (e, t, n) => {
859
859
  const r = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
860
860
  return { x: r, y: s };
861
861
  }, Ut = (e, t, n, r, s, i, o, a, l, c) => {
862
- let m = e, f = t, y = n, g = r, h = a, u = l;
862
+ let m = e, u = t, y = n, g = r, f = a, h = l;
863
863
  const x = Math.PI * 120 / 180, p = Math.PI / 180 * (+s || 0);
864
- let b = [], A, d, M, T, z;
864
+ let b = [], A, d, M, T, E;
865
865
  if (c)
866
- [d, M, T, z] = c;
866
+ [d, M, T, E] = c;
867
867
  else {
868
- A = rt(m, f, -p), m = A.x, f = A.y, A = rt(h, u, -p), h = A.x, u = A.y;
869
- const P = (m - h) / 2, L = (f - u) / 2;
870
- let E = P * P / (y * y) + L * L / (g * g);
871
- E > 1 && (E = Math.sqrt(E), y *= E, g *= E);
872
- const xt = y * y, pt = g * g, Pt = (i === o ? -1 : 1) * Math.sqrt(Math.abs((xt * pt - xt * L * L - pt * P * P) / (xt * L * L + pt * P * P)));
873
- T = Pt * y * L / g + (m + h) / 2, z = Pt * -g * P / y + (f + u) / 2, d = Math.asin(((f - z) / g * 10 ** 9 >> 0) / 10 ** 9), M = Math.asin(((u - z) / g * 10 ** 9 >> 0) / 10 ** 9), d = m < T ? Math.PI - d : d, M = h < T ? Math.PI - M : M, d < 0 && (d = Math.PI * 2 + d), M < 0 && (M = Math.PI * 2 + M), o && d > M && (d -= Math.PI * 2), !o && M > d && (M -= Math.PI * 2);
868
+ A = rt(m, u, -p), m = A.x, u = A.y, A = rt(f, h, -p), f = A.x, h = A.y;
869
+ const P = (m - f) / 2, L = (u - h) / 2;
870
+ let I = P * P / (y * y) + L * L / (g * g);
871
+ I > 1 && (I = Math.sqrt(I), y *= I, g *= I);
872
+ const xt = y * y, pt = g * g, Ct = (i === o ? -1 : 1) * Math.sqrt(Math.abs((xt * pt - xt * L * L - pt * P * P) / (xt * L * L + pt * P * P)));
873
+ T = Ct * y * L / g + (m + f) / 2, E = Ct * -g * P / y + (u + h) / 2, d = Math.asin(((u - E) / g * 10 ** 9 >> 0) / 10 ** 9), M = Math.asin(((h - E) / g * 10 ** 9 >> 0) / 10 ** 9), d = m < T ? Math.PI - d : d, M = f < T ? Math.PI - M : M, d < 0 && (d = Math.PI * 2 + d), M < 0 && (M = Math.PI * 2 + M), o && d > M && (d -= Math.PI * 2), !o && M > d && (M -= Math.PI * 2);
874
874
  }
875
- let Y = M - d;
876
- if (Math.abs(Y) > x) {
877
- const P = M, L = h, E = u;
878
- M = d + x * (o && M > d ? 1 : -1), h = T + y * Math.cos(M), u = z + g * Math.sin(M), b = Ut(h, u, y, g, s, 0, o, L, E, [M, P, T, z]);
875
+ let H = M - d;
876
+ if (Math.abs(H) > x) {
877
+ const P = M, L = f, I = h;
878
+ M = d + x * (o && M > d ? 1 : -1), f = T + y * Math.cos(M), h = E + g * Math.sin(M), b = Ut(f, h, y, g, s, 0, o, L, I, [M, P, T, E]);
879
879
  }
880
- Y = M - d;
881
- const R = Math.cos(d), tt = Math.sin(d), k = Math.cos(M), et = Math.sin(M), B = Math.tan(Y / 4), nt = 4 / 3 * y * B, st = 4 / 3 * g * B, S = [m, f], q = [m + nt * tt, f - st * R], J = [h + nt * et, u - st * k], U = [h, u];
882
- if (q[0] = 2 * S[0] - q[0], q[1] = 2 * S[1] - q[1], c)
883
- return [...q, ...J, ...U, ...b];
884
- b = [...q, ...J, ...U, ...b];
880
+ H = M - d;
881
+ const F = Math.cos(d), tt = Math.sin(d), S = Math.cos(M), et = Math.sin(M), Y = Math.tan(H / 4), nt = 4 / 3 * y * Y, st = 4 / 3 * g * Y, $ = [m, u], q = [m + nt * tt, u - st * F], B = [f + nt * et, h - st * S], J = [f, h];
882
+ if (q[0] = 2 * $[0] - q[0], q[1] = 2 * $[1] - q[1], c)
883
+ return [...q, ...B, ...J, ...b];
884
+ b = [...q, ...B, ...J, ...b];
885
885
  const gt = [];
886
886
  for (let P = 0, L = b.length; P < L; P += 1)
887
887
  gt[P] = P % 2 ? rt(b[P - 1], b[P], p).y : rt(b[P], b[P + 1], p).x;
888
888
  return gt;
889
- }, be = (e, t, n, r, s, i) => {
889
+ }, de = (e, t, n, r, s, i) => {
890
890
  const o = 0.3333333333333333, a = 2 / 3;
891
891
  return [
892
892
  o * e + a * n,
@@ -901,15 +901,15 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
901
901
  i
902
902
  // x,y
903
903
  ];
904
- }, kt = (e, t, n, r) => [...I([e, t], [n, r], 0.5), n, r, n, r], ot = (e, t) => {
904
+ }, St = (e, t, n, r) => [...j([e, t], [n, r], 0.5), n, r, n, r], ot = (e, t) => {
905
905
  const [n] = e, r = e.slice(1).map(Number), [s, i] = r;
906
906
  let o;
907
907
  const { x1: a, y1: l, x: c, y: m } = t;
908
- return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [a, l, ...r], ["C", ...Ut(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [a, l, ...r], ["C", ...be(...o)]) : n === "L" ? ["C", ...kt(a, l, s, i)] : n === "Z" ? ["C", ...kt(a, l, c, m)] : e;
908
+ return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [a, l, ...r], ["C", ...Ut(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [a, l, ...r], ["C", ...de(...o)]) : n === "L" ? ["C", ...St(a, l, s, i)] : n === "Z" ? ["C", ...St(a, l, c, m)] : e;
909
909
  }, ct = (e) => {
910
910
  if (Jt(e))
911
911
  return [...e];
912
- const t = j(e), n = { ...ut }, r = [];
912
+ const t = z(e), n = { ...ut }, r = [];
913
913
  let s = "", i = t.length;
914
914
  for (let o = 0; o < i; o += 1) {
915
915
  [s] = t[o], r[o] = s, t[o] = ot(t[o], n), Mt(t, r, o), i = t.length;
@@ -917,30 +917,30 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
917
917
  n.x1 = +a[l - 2], n.y1 = +a[l - 1], n.x2 = +a[l - 4] || n.x1, n.y2 = +a[l - 3] || n.y1;
918
918
  }
919
919
  return t;
920
- }, de = (e, t, n, r, s, i, o, a) => 3 * ((a - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + a * (s + e / 3) - o * (i + t / 3)) / 20, Kt = (e) => {
920
+ }, Me = (e, t, n, r, s, i, o, a) => 3 * ((a - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + a * (s + e / 3) - o * (i + t / 3)) / 20, Vt = (e) => {
921
921
  let t = 0, n = 0, r = 0;
922
922
  return ct(e).map((s) => {
923
923
  switch (s[0]) {
924
924
  case "M":
925
925
  return [, t, n] = s, 0;
926
926
  default:
927
- return r = de(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r;
927
+ return r = Me(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r;
928
928
  }
929
929
  }).reduce((s, i) => s + i, 0);
930
- }, F = (e) => ft(e).length, Me = (e) => Kt(ct(e)) >= 0, W = (e, t) => ft(e, t).point, vt = (e, t) => {
931
- const n = Q(e);
932
- let r = [...n], s = F(r), i = r.length - 1, o = 0, a = 0, l = n[0];
933
- const [c, m] = l.slice(-2), f = { x: c, y: m };
930
+ }, X = (e) => ft(e).length, Ae = (e) => Vt(ct(e)) >= 0, K = (e, t) => ft(e, t).point, Pt = (e, t) => {
931
+ const n = Z(e);
932
+ let r = [...n], s = X(r), i = r.length - 1, o = 0, a = 0, l = n[0];
933
+ const [c, m] = l.slice(-2), u = { x: c, y: m };
934
934
  if (i <= 0 || !t || !Number.isFinite(t))
935
935
  return {
936
936
  segment: l,
937
937
  index: 0,
938
938
  length: a,
939
- point: f,
939
+ point: u,
940
940
  lengthAtSegment: o
941
941
  };
942
942
  if (t >= s)
943
- return r = n.slice(0, -1), o = F(r), a = s - o, {
943
+ return r = n.slice(0, -1), o = X(r), a = s - o, {
944
944
  segment: n[i],
945
945
  index: i,
946
946
  length: a,
@@ -948,7 +948,7 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
948
948
  };
949
949
  const y = [];
950
950
  for (; i > 0; )
951
- l = r[i], r = r.slice(0, -1), o = F(r), a = s - o, s = o, y.push({
951
+ l = r[i], r = r.slice(0, -1), o = X(r), a = s - o, s = o, y.push({
952
952
  segment: l,
953
953
  index: i,
954
954
  length: a,
@@ -956,41 +956,31 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
956
956
  }), i -= 1;
957
957
  return y.find(({ lengthAtSegment: g }) => g <= t);
958
958
  }, yt = (e, t) => {
959
- const n = Q(e), r = j(n), s = F(n), i = (d) => {
959
+ const n = Z(e), r = z(n), s = X(n), i = (d) => {
960
960
  const M = d.x - t.x, T = d.y - t.y;
961
961
  return M * M + T * T;
962
962
  };
963
- let o = 8, a, l = { x: 0, y: 0 }, c = 0, m = 0, f = 1 / 0;
963
+ let o = 8, a, l = { x: 0, y: 0 }, c = 0, m = 0, u = 1 / 0;
964
964
  for (let d = 0; d <= s; d += o)
965
- a = W(r, d), c = i(a), c < f && (l = a, m = d, f = c);
965
+ a = K(r, d), c = i(a), c < u && (l = a, m = d, u = c);
966
966
  o /= 2;
967
- let y, g, h = 0, u = 0, x = 0, p = 0;
967
+ let y, g, f = 0, h = 0, x = 0, p = 0;
968
968
  for (; o > 0.5; )
969
- h = m - o, y = W(r, h), x = i(y), u = m + o, g = W(r, u), p = i(g), h >= 0 && x < f ? (l = y, m = h, f = x) : u <= s && p < f ? (l = g, m = u, f = p) : o /= 2;
970
- const b = vt(n, m), A = Math.sqrt(f);
969
+ f = m - o, y = K(r, f), x = i(y), h = m + o, g = K(r, h), p = i(g), f >= 0 && x < u ? (l = y, m = f, u = x) : h <= s && p < u ? (l = g, m = h, u = p) : o /= 2;
970
+ const b = Pt(n, m), A = Math.sqrt(u);
971
971
  return { closest: l, distance: A, segment: b };
972
- }, Ae = (e, t) => yt(e, t).closest, Ne = (e, t) => yt(e, t).segment, we = (e, t) => vt(e, t).segment, ve = (e, t) => {
972
+ }, Ne = (e, t) => yt(e, t).closest, we = (e, t) => yt(e, t).segment, ve = (e, t) => Pt(e, t).segment, Pe = (e, t) => {
973
973
  const { distance: n } = yt(e, t);
974
974
  return Math.abs(n) < 1e-3;
975
- }, _t = (e) => {
976
- if (typeof e != "string")
975
+ }, Kt = (e) => {
976
+ if (typeof e != "string" || !e.length)
977
977
  return !1;
978
- const t = new jt(e);
979
- for (_(t); t.index < t.max && !t.err.length; )
980
- It(t);
978
+ const t = new zt(e);
979
+ for (V(t); t.index < t.max && !t.err.length; )
980
+ jt(t);
981
981
  return !t.err.length && "mM".includes(t.segments[0][0]);
982
- }, Wt = (e) => mt(e) && // `isPathArray` checks if it's `Array`
983
- e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
984
- let { round: n } = at;
985
- if (t === "off" || n === "off")
986
- return [...e];
987
- n = typeof t == "number" && t >= 0 ? t : n;
988
- const r = typeof n == "number" && n >= 1 ? 10 ** n : 1;
989
- return e.map((s) => {
990
- const i = s.slice(1).map(Number).map((o) => n ? Math.round(o * r) / r : Math.round(o));
991
- return [s[0], ...i];
992
- });
993
- }, Z = (e, t) => lt(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), St = {
982
+ }, _t = (e) => _(e) && // `isPathArray` checks if it's `Array`
983
+ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = {
994
984
  line: ["x1", "y1", "x2", "y2"],
995
985
  circle: ["cx", "cy", "r"],
996
986
  ellipse: ["cx", "cy", "rx", "ry"],
@@ -998,36 +988,36 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
998
988
  polygon: ["points"],
999
989
  polyline: ["points"],
1000
990
  glyph: ["d"]
1001
- }, Pe = (e) => {
1002
- const { x1: t, y1: n, x2: r, y2: s } = e;
1003
- return [
991
+ }, Ce = (e) => {
992
+ let { x1: t, y1: n, x2: r, y2: s } = e;
993
+ return [t, n, r, s] = [t, n, r, s].map((i) => +i), [
1004
994
  ["M", t, n],
1005
995
  ["L", r, s]
1006
996
  ];
1007
- }, Ce = (e) => {
1008
- const t = [], n = (e.points || "").trim().split(/[\s|,]/).map(Number);
997
+ }, Te = (e) => {
998
+ const t = [], n = (e.points || "").trim().split(/[\s|,]/).map((s) => +s);
1009
999
  let r = 0;
1010
1000
  for (; r < n.length; )
1011
1001
  t.push([r ? "L" : "M", n[r], n[r + 1]]), r += 2;
1012
1002
  return e.type === "polygon" ? [...t, ["z"]] : t;
1013
- }, Te = (e) => {
1014
- const { cx: t, cy: n, r } = e;
1015
- return [
1003
+ }, Le = (e) => {
1004
+ let { cx: t, cy: n, r } = e;
1005
+ return [t, n, r] = [t, n, r].map((s) => +s), [
1016
1006
  ["M", t - r, n],
1017
1007
  ["a", r, r, 0, 1, 0, 2 * r, 0],
1018
1008
  ["a", r, r, 0, 1, 0, -2 * r, 0]
1019
1009
  ];
1020
- }, Le = (e) => {
1021
- const { cx: t, cy: n, rx: r, ry: s } = e;
1022
- return [
1010
+ }, ke = (e) => {
1011
+ let { cx: t, cy: n } = e, r = e.rx || 0, s = e.ry || r;
1012
+ return [t, n, r, s] = [t, n, r, s].map((i) => +i), [
1023
1013
  ["M", t - r, n],
1024
1014
  ["a", r, s, 0, 1, 0, 2 * r, 0],
1025
1015
  ["a", r, s, 0, 1, 0, -2 * r, 0]
1026
1016
  ];
1027
- }, ke = (e) => {
1017
+ }, Se = (e) => {
1028
1018
  const t = +e.x || 0, n = +e.y || 0, r = +e.width, s = +e.height;
1029
- let i = +e.rx, o = +e.ry;
1030
- return i || o ? (i = i || o, o = o || i, i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > s && (o -= (o * 2 - s) / 2), [
1019
+ let i = +(e.rx || 0), o = +(e.ry || i);
1020
+ return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > s && (o -= (o * 2 - s) / 2), [
1031
1021
  ["M", t + i, n],
1032
1022
  ["h", r - i * 2],
1033
1023
  ["s", i, 0, i, o],
@@ -1038,35 +1028,55 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
1038
1028
  ["v", -s + o * 2],
1039
1029
  ["s", 0, -o, i, -o]
1040
1030
  ]) : [["M", t, n], ["h", r], ["v", s], ["H", t], ["Z"]];
1041
- }, Se = (e, t, n) => {
1031
+ }, Wt = (e, t) => {
1032
+ const r = (t || document).defaultView || /* istanbul ignore next */
1033
+ window, s = Object.keys(lt), i = e instanceof r.SVGElement, o = i ? e.tagName : null;
1034
+ if (o && [...s, "path"].every((u) => o !== u))
1035
+ throw TypeError(`${k}: "${o}" is not SVGElement`);
1036
+ const a = i ? o : e.type, l = lt[a], c = { type: a };
1037
+ i ? l.forEach((u) => {
1038
+ c[u] = e.getAttribute(u);
1039
+ }) : Object.assign(c, e);
1040
+ let m = [];
1041
+ return a === "circle" ? m = Le(c) : a === "ellipse" ? m = ke(c) : ["polyline", "polygon"].includes(a) ? m = Te(c) : a === "rect" ? m = Se(c) : a === "line" ? m = Ce(c) : ["glyph", "path"].includes(a) && (m = Z(i ? e.getAttribute("d") || "" : e.d || "")), _(m) && m.length ? m : !1;
1042
+ }, at = (e, t) => {
1043
+ let { round: n } = mt;
1044
+ if (t === "off" || n === "off")
1045
+ return [...e];
1046
+ n = typeof t == "number" && t >= 0 ? t : n;
1047
+ const r = typeof n == "number" && n >= 1 ? 10 ** n : 1;
1048
+ return e.map((s) => {
1049
+ const i = s.slice(1).map(Number).map((o) => n ? Math.round(o * r) / r : Math.round(o));
1050
+ return [s[0], ...i];
1051
+ });
1052
+ }, At = (e, t) => at(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), $e = (e, t, n) => {
1042
1053
  const r = n || document, s = r.defaultView || /* istanbul ignore next */
1043
- window, i = Object.keys(St), o = e instanceof s.SVGElement, a = o ? e.tagName : null;
1054
+ window, i = Object.keys(lt), o = e instanceof s.SVGElement, a = o ? e.tagName : null;
1055
+ if (a === "path")
1056
+ throw TypeError(`${k}: "${a}" is already SVGPathElement`);
1044
1057
  if (a && i.every((h) => a !== h))
1045
- throw TypeError(`${O}: "${a}" is not SVGElement`);
1046
- const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = o ? a : e.type, m = St[c], f = { type: c };
1047
- o ? (m.forEach((h) => {
1048
- m.includes(h) && (f[h] = e.getAttribute(h));
1049
- }), Object.values(e.attributes).forEach(({ name: h, value: u }) => {
1050
- m.includes(h) || l.setAttribute(h, u);
1051
- })) : (Object.assign(f, e), Object.keys(f).forEach((h) => {
1058
+ throw TypeError(`${k}: "${a}" is not SVGElement`);
1059
+ const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = o ? a : e.type, m = lt[c], u = { type: c }, y = mt.round, g = Wt(e, r), f = g && g.length ? At(g, y) : "";
1060
+ return o ? (m.forEach((h) => {
1061
+ u[h] = e.getAttribute(h);
1062
+ }), Object.values(e.attributes).forEach(({ name: h, value: x }) => {
1063
+ m.includes(h) || l.setAttribute(h, x);
1064
+ })) : (Object.assign(u, e), Object.keys(u).forEach((h) => {
1052
1065
  !m.includes(h) && h !== "type" && l.setAttribute(
1053
- h.replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`),
1054
- f[h]
1066
+ h.replace(/[A-Z]/g, (x) => `-${x.toLowerCase()}`),
1067
+ u[h]
1055
1068
  );
1056
- }));
1057
- let y = "";
1058
- const g = at.round;
1059
- return c === "circle" ? y = Z(Te(f), g) : c === "ellipse" ? y = Z(Le(f), g) : ["polyline", "polygon"].includes(c) ? y = Z(Ce(f), g) : c === "rect" ? y = Z(ke(f), g) : c === "line" ? y = Z(Pe(f), g) : c === "glyph" && (y = o ? e.getAttribute("d") : e.d), _t(y) ? (l.setAttribute("d", y), t && o && (e.before(l, e), e.remove()), l) : !1;
1060
- }, qt = (e) => {
1069
+ })), Kt(f) ? (l.setAttribute("d", f), t && o && (e.before(l, e), e.remove()), l) : !1;
1070
+ }, $t = (e) => {
1061
1071
  const t = [];
1062
1072
  let n, r = -1;
1063
1073
  return e.forEach((s) => {
1064
1074
  s[0] === "M" ? (n = [s], r += 1) : n = [...n, s], t[r] = n;
1065
1075
  }), t;
1066
- }, At = (e) => {
1067
- if (Wt(e))
1076
+ }, Nt = (e) => {
1077
+ if (_t(e))
1068
1078
  return [...e];
1069
- const t = Q(e);
1079
+ const t = Z(e);
1070
1080
  let n = 0, r = 0, s = 0, i = 0;
1071
1081
  return t.map((o) => {
1072
1082
  const a = o.slice(1).map(Number), [l] = o, c = l.toLowerCase();
@@ -1090,39 +1100,39 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
1090
1100
  else if (c === "h")
1091
1101
  m = [c, a[0] - n];
1092
1102
  else {
1093
- const y = a.map((g, h) => g - (h % 2 ? r : n));
1103
+ const y = a.map((g, f) => g - (f % 2 ? r : n));
1094
1104
  m = [c, ...y];
1095
1105
  }
1096
1106
  else
1097
1107
  l === "m" && (s = a[0] + n, i = a[1] + r), m = [c, ...a];
1098
- const f = m.length;
1099
- return c === "z" ? (n = s, r = i) : c === "h" ? n += m[1] : c === "v" ? r += m[1] : (n += m[f - 2], r += m[f - 1]), m;
1108
+ const u = m.length;
1109
+ return c === "z" ? (n = s, r = i) : c === "h" ? n += m[1] : c === "v" ? r += m[1] : (n += m[u - 2], r += m[u - 1]), m;
1100
1110
  });
1101
1111
  }, qe = (e, t, n, r) => {
1102
- const [s] = e, i = (p) => Math.round(p * 10 ** 4) / 10 ** 4, o = e.slice(1).map((p) => +p), a = t.slice(1).map((p) => +p), { x1: l, y1: c, x2: m, y2: f, x: y, y: g } = n;
1103
- let h = e;
1104
- const [u, x] = a.slice(-2);
1112
+ const [s] = e, i = (p) => Math.round(p * 10 ** 4) / 10 ** 4, o = e.slice(1).map((p) => +p), a = t.slice(1).map((p) => +p), { x1: l, y1: c, x2: m, y2: u, x: y, y: g } = n;
1113
+ let f = e;
1114
+ const [h, x] = a.slice(-2);
1105
1115
  if ("TQ".includes(s) || (n.qx = null, n.qy = null), ["V", "H", "S", "T", "Z"].includes(s))
1106
- h = [s, ...o];
1116
+ f = [s, ...o];
1107
1117
  else if (s === "L")
1108
- i(y) === i(u) ? h = ["V", x] : i(g) === i(x) && (h = ["H", u]);
1118
+ i(y) === i(h) ? f = ["V", x] : i(g) === i(x) && (f = ["H", h]);
1109
1119
  else if (s === "C") {
1110
1120
  const [p, b] = a;
1111
- "CS".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - f) || i(l) === i(m * 2 - y) && i(c) === i(f * 2 - g)) && (h = ["S", ...a.slice(-4)]), n.x1 = p, n.y1 = b;
1121
+ "CS".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - u) || i(l) === i(m * 2 - y) && i(c) === i(u * 2 - g)) && (f = ["S", ...a.slice(-4)]), n.x1 = p, n.y1 = b;
1112
1122
  } else if (s === "Q") {
1113
1123
  const [p, b] = a;
1114
- n.qx = p, n.qy = b, "QT".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - f) || i(l) === i(m * 2 - y) && i(c) === i(f * 2 - g)) && (h = ["T", ...a.slice(-2)]);
1124
+ n.qx = p, n.qy = b, "QT".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - u) || i(l) === i(m * 2 - y) && i(c) === i(u * 2 - g)) && (f = ["T", ...a.slice(-2)]);
1115
1125
  }
1116
- return h;
1117
- }, $t = (e, t) => {
1118
- const n = H(e), r = j(n), s = { ...ut }, i = [], o = n.length;
1119
- let a = "", l = "", c = 0, m = 0, f = 0, y = 0;
1120
- for (let u = 0; u < o; u += 1) {
1121
- [a] = n[u], i[u] = a, u && (l = i[u - 1]), n[u] = qe(n[u], r[u], s, l);
1122
- const x = n[u], p = x.length;
1126
+ return f;
1127
+ }, qt = (e, t) => {
1128
+ const n = Q(e), r = z(n), s = { ...ut }, i = [], o = n.length;
1129
+ let a = "", l = "", c = 0, m = 0, u = 0, y = 0;
1130
+ for (let h = 0; h < o; h += 1) {
1131
+ [a] = n[h], i[h] = a, h && (l = i[h - 1]), n[h] = qe(n[h], r[h], s, l);
1132
+ const x = n[h], p = x.length;
1123
1133
  switch (s.x1 = +x[p - 2], s.y1 = +x[p - 1], s.x2 = +x[p - 4] || s.x1, s.y2 = +x[p - 3] || s.y1, a) {
1124
1134
  case "Z":
1125
- c = f, m = y;
1135
+ c = u, m = y;
1126
1136
  break;
1127
1137
  case "H":
1128
1138
  [, c] = x;
@@ -1131,19 +1141,19 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
1131
1141
  [, m] = x;
1132
1142
  break;
1133
1143
  default:
1134
- [c, m] = x.slice(-2).map(Number), a === "M" && (f = c, y = m);
1144
+ [c, m] = x.slice(-2).map(Number), a === "M" && (u = c, y = m);
1135
1145
  }
1136
1146
  s.x = c, s.y = m;
1137
1147
  }
1138
- const g = lt(n, t), h = lt(At(n), t);
1139
- return g.map((u, x) => x ? u.join("").length < h[x].join("").length ? u : h[x] : u);
1140
- }, $e = (e) => {
1148
+ const g = at(n, t), f = at(Nt(n), t);
1149
+ return g.map((h, x) => x ? h.join("").length < f[x].join("").length ? h : f[x] : h);
1150
+ }, Oe = (e) => {
1141
1151
  const t = e.slice(1).map(
1142
1152
  (n, r, s) => r ? [...s[r - 1].slice(-2), ...n.slice(1)] : [...e[0].slice(1), ...n.slice(1)]
1143
1153
  ).map((n) => n.map((r, s) => n[n.length - s - 2 * (1 - s % 2)])).reverse();
1144
1154
  return [["M", ...t[0].slice(0, 2)], ...t.map((n) => ["C", ...n.slice(2)])];
1145
1155
  }, it = (e) => {
1146
- const t = H(e), n = t.slice(-1)[0][0] === "Z", r = j(t).map((s, i) => {
1156
+ const t = Q(e), n = t.slice(-1)[0][0] === "Z", r = z(t).map((s, i) => {
1147
1157
  const [o, a] = s.slice(-2).map(Number);
1148
1158
  return {
1149
1159
  seg: t[i],
@@ -1158,93 +1168,93 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
1158
1168
  // y
1159
1169
  };
1160
1170
  }).map((s, i, o) => {
1161
- const a = s.seg, l = s.n, c = i && o[i - 1], m = o[i + 1], f = s.c, y = o.length, g = i ? o[i - 1].x : o[y - 1].x, h = i ? o[i - 1].y : o[y - 1].y;
1162
- let u = [];
1163
- switch (f) {
1171
+ const a = s.seg, l = s.n, c = i && o[i - 1], m = o[i + 1], u = s.c, y = o.length, g = i ? o[i - 1].x : o[y - 1].x, f = i ? o[i - 1].y : o[y - 1].y;
1172
+ let h = [];
1173
+ switch (u) {
1164
1174
  case "M":
1165
- u = n ? ["Z"] : [f, g, h];
1175
+ h = n ? ["Z"] : [u, g, f];
1166
1176
  break;
1167
1177
  case "A":
1168
- u = [f, ...a.slice(1, -3), a[5] === 1 ? 0 : 1, g, h];
1178
+ h = [u, ...a.slice(1, -3), a[5] === 1 ? 0 : 1, g, f];
1169
1179
  break;
1170
1180
  case "C":
1171
- m && m.c === "S" ? u = ["S", a[1], a[2], g, h] : u = [f, a[3], a[4], a[1], a[2], g, h];
1181
+ m && m.c === "S" ? h = ["S", a[1], a[2], g, f] : h = [u, a[3], a[4], a[1], a[2], g, f];
1172
1182
  break;
1173
1183
  case "S":
1174
- c && "CS".includes(c.c) && (!m || m.c !== "S") ? u = ["C", l[3], l[4], l[1], l[2], g, h] : u = [f, l[1], l[2], g, h];
1184
+ c && "CS".includes(c.c) && (!m || m.c !== "S") ? h = ["C", l[3], l[4], l[1], l[2], g, f] : h = [u, l[1], l[2], g, f];
1175
1185
  break;
1176
1186
  case "Q":
1177
- m && m.c === "T" ? u = ["T", g, h] : u = [f, ...a.slice(1, -2), g, h];
1187
+ m && m.c === "T" ? h = ["T", g, f] : h = [u, ...a.slice(1, -2), g, f];
1178
1188
  break;
1179
1189
  case "T":
1180
- c && "QT".includes(c.c) && (!m || m.c !== "T") ? u = ["Q", l[1], l[2], g, h] : u = [f, g, h];
1190
+ c && "QT".includes(c.c) && (!m || m.c !== "T") ? h = ["Q", l[1], l[2], g, f] : h = [u, g, f];
1181
1191
  break;
1182
1192
  case "Z":
1183
- u = ["M", g, h];
1193
+ h = ["M", g, f];
1184
1194
  break;
1185
1195
  case "H":
1186
- u = [f, g];
1196
+ h = [u, g];
1187
1197
  break;
1188
1198
  case "V":
1189
- u = [f, h];
1199
+ h = [u, f];
1190
1200
  break;
1191
1201
  default:
1192
- u = [f, ...a.slice(1, -2), g, h];
1202
+ h = [u, ...a.slice(1, -2), g, f];
1193
1203
  }
1194
- return u;
1204
+ return h;
1195
1205
  });
1196
1206
  return n ? r.reverse() : [r[0], ...r.slice(1).reverse()];
1197
- }, Oe = (e) => {
1207
+ }, Ee = (e) => {
1198
1208
  let t = new v();
1199
1209
  const { origin: n } = e, [r, s] = n, { translate: i } = e, { rotate: o } = e, { skew: a } = e, { scale: l } = e;
1200
1210
  return Array.isArray(i) && i.length >= 2 && i.every((c) => !Number.isNaN(+c)) && i.some((c) => c !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || a || l) && (t = t.translate(r, s), Array.isArray(o) && o.length >= 2 && o.every((c) => !Number.isNaN(+c)) && o.some((c) => c !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(a) && a.length === 2 && a.every((c) => !Number.isNaN(+c)) && a.some((c) => c !== 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(l) && l.length >= 2 && l.every((c) => !Number.isNaN(+c)) && l.some((c) => c !== 1) ? t = t.scale(...l) : typeof l == "number" && !Number.isNaN(l) && (t = t.scale(l)), t = t.translate(-r, -s)), t;
1201
- }, ze = (e, t) => {
1211
+ }, je = (e, t) => {
1202
1212
  let n = v.Translate(...t.slice(0, -1));
1203
1213
  return [, , , n.m44] = t, n = e.multiply(n), [n.m41, n.m42, n.m43, n.m44];
1204
1214
  }, Ot = (e, t, n) => {
1205
- const [r, s, i] = n, [o, a, l] = ze(e, [...t, 0, 1]), c = o - r, m = a - s, f = l - i;
1215
+ const [r, s, i] = n, [o, a, l] = je(e, [...t, 0, 1]), c = o - r, m = a - s, u = l - i;
1206
1216
  return [
1207
1217
  // protect against division by ZERO
1208
- c * (Math.abs(i) / Math.abs(f) || 1) + r,
1209
- m * (Math.abs(i) / Math.abs(f) || 1) + s
1218
+ c * (Math.abs(i) / Math.abs(u) || 1) + r,
1219
+ m * (Math.abs(i) / Math.abs(u) || 1) + s
1210
1220
  ];
1211
- }, zt = (e, t) => {
1221
+ }, Et = (e, t) => {
1212
1222
  let n = 0, r = 0, s, i, o, a, l, c;
1213
- const m = H(e), f = t && Object.keys(t);
1214
- if (!t || f && !f.length)
1223
+ const m = Q(e), u = t && Object.keys(t);
1224
+ if (!t || u && !u.length)
1215
1225
  return [...m];
1216
- const y = j(m);
1226
+ const y = z(m);
1217
1227
  if (!t.origin) {
1218
- const { origin: M } = at;
1228
+ const { origin: M } = mt;
1219
1229
  Object.assign(t, { origin: M });
1220
1230
  }
1221
- const g = Oe(t), { origin: h } = t, u = { ...ut };
1231
+ const g = Ee(t), { origin: f } = t, h = { ...ut };
1222
1232
  let x = [], p = 0, b = "", A = [];
1223
1233
  const d = [];
1224
1234
  if (!g.isIdentity) {
1225
1235
  for (s = 0, o = m.length; s < o; s += 1) {
1226
- x = m[s], m[s] && ([b] = x), d[s] = b, b === "A" && (x = ot(y[s], u), m[s] = ot(y[s], u), Mt(m, d, s), y[s] = ot(y[s], u), Mt(y, d, s), o = Math.max(m.length, y.length)), x = y[s], p = x.length, u.x1 = +x[p - 2], u.y1 = +x[p - 1], u.x2 = +x[p - 4] || u.x1, u.y2 = +x[p - 3] || u.y1;
1236
+ x = m[s], m[s] && ([b] = x), d[s] = b, b === "A" && (x = ot(y[s], h), m[s] = ot(y[s], h), Mt(m, d, s), y[s] = ot(y[s], h), Mt(y, d, s), o = Math.max(m.length, y.length)), x = y[s], p = x.length, h.x1 = +x[p - 2], h.y1 = +x[p - 1], h.x2 = +x[p - 4] || h.x1, h.y2 = +x[p - 3] || h.y1;
1227
1237
  const M = {
1228
1238
  s: m[s],
1229
1239
  c: m[s][0],
1230
- x: u.x1,
1231
- y: u.y1
1240
+ x: h.x1,
1241
+ y: h.y1
1232
1242
  };
1233
1243
  A = [...A, M];
1234
1244
  }
1235
1245
  return A.map((M) => {
1236
1246
  if (b = M.c, x = M.s, b === "L" || b === "H" || b === "V")
1237
- return [l, c] = Ot(g, [M.x, M.y], h), n !== l && r !== c ? x = ["L", l, c] : r === c ? x = ["H", l] : n === l && (x = ["V", c]), n = l, r = c, x;
1247
+ return [l, c] = Ot(g, [M.x, M.y], f), n !== l && r !== c ? x = ["L", l, c] : r === c ? x = ["H", l] : n === l && (x = ["V", c]), n = l, r = c, x;
1238
1248
  for (i = 1, a = x.length; i < a; i += 2)
1239
- [n, r] = Ot(g, [+x[i], +x[i + 1]], h), x[i] = n, x[i + 1] = r;
1249
+ [n, r] = Ot(g, [+x[i], +x[i + 1]], f), x[i] = n, x[i + 1] = r;
1240
1250
  return x;
1241
1251
  });
1242
1252
  }
1243
1253
  return [...m];
1244
- }, Ie = (e) => {
1245
- const n = e.slice(0, 2), r = e.slice(2, 4), s = e.slice(4, 6), i = e.slice(6, 8), o = I(n, r, 0.5), a = I(r, s, 0.5), l = I(s, i, 0.5), c = I(o, a, 0.5), m = I(a, l, 0.5), f = I(c, m, 0.5);
1254
+ }, ze = (e) => {
1255
+ const n = e.slice(0, 2), r = e.slice(2, 4), s = e.slice(4, 6), i = e.slice(6, 8), o = j(n, r, 0.5), a = j(r, s, 0.5), l = j(s, i, 0.5), c = j(o, a, 0.5), m = j(a, l, 0.5), u = j(c, m, 0.5);
1246
1256
  return [
1247
- ["C", ...o, ...c, ...f],
1257
+ ["C", ...o, ...c, ...u],
1248
1258
  ["C", ...m, ...l, ...i]
1249
1259
  ];
1250
1260
  };
@@ -1257,27 +1267,27 @@ class w {
1257
1267
  constructor(t, n) {
1258
1268
  const r = n || {}, s = typeof t > "u";
1259
1269
  if (s || !t.length)
1260
- throw TypeError(`${O}: "pathValue" is ${s ? "undefined" : "empty"}`);
1261
- const i = Q(t);
1270
+ throw TypeError(`${k}: "pathValue" is ${s ? "undefined" : "empty"}`);
1271
+ const i = Z(t);
1262
1272
  this.segments = i;
1263
- const { width: o, height: a, cx: l, cy: c, cz: m } = this.getBBox(), { round: f, origin: y } = r;
1273
+ const { width: o, height: a, cx: l, cy: c, cz: m } = this.getBBox(), { round: u, origin: y } = r;
1264
1274
  let g;
1265
- if (f === "auto") {
1266
- const u = `${Math.floor(Math.max(o, a))}`.length;
1267
- g = u >= 4 ? 0 : 4 - u;
1275
+ if (u === "auto") {
1276
+ const h = `${Math.floor(Math.max(o, a))}`.length;
1277
+ g = h >= 4 ? 0 : 4 - h;
1268
1278
  } else
1269
- Number.isInteger(f) || f === "off" ? g = f : g = at.round;
1270
- let h;
1279
+ Number.isInteger(u) || u === "off" ? g = u : g = mt.round;
1280
+ let f;
1271
1281
  if (Array.isArray(y) && y.length >= 2) {
1272
- const [u, x, p] = y.map(Number);
1273
- h = [
1274
- Number.isNaN(u) ? l : u,
1282
+ const [h, x, p] = y.map(Number);
1283
+ f = [
1284
+ Number.isNaN(h) ? l : h,
1275
1285
  Number.isNaN(x) ? c : x,
1276
1286
  Number.isNaN(p) ? m : p
1277
1287
  ];
1278
1288
  } else
1279
- h = [l, c, m];
1280
- return this.round = g, this.origin = h, this;
1289
+ f = [l, c, m];
1290
+ return this.round = g, this.origin = f, this;
1281
1291
  }
1282
1292
  /**
1283
1293
  * Returns the path bounding box, equivalent to native `path.getBBox()`.
@@ -1286,7 +1296,7 @@ class w {
1286
1296
  * @returns the pathBBox
1287
1297
  */
1288
1298
  getBBox() {
1289
- return Lt(this.segments);
1299
+ return kt(this.segments);
1290
1300
  }
1291
1301
  /**
1292
1302
  * Returns the total path length, equivalent to native `path.getTotalLength()`.
@@ -1295,7 +1305,7 @@ class w {
1295
1305
  * @returns the path total length
1296
1306
  */
1297
1307
  getTotalLength() {
1298
- return F(this.segments);
1308
+ return X(this.segments);
1299
1309
  }
1300
1310
  /**
1301
1311
  * Returns an `{x,y}` point in the path stroke at a given length,
@@ -1306,7 +1316,7 @@ class w {
1306
1316
  * @returns the requested point
1307
1317
  */
1308
1318
  getPointAtLength(t) {
1309
- return W(this.segments, t);
1319
+ return K(this.segments, t);
1310
1320
  }
1311
1321
  /**
1312
1322
  * Convert path to absolute values
@@ -1315,7 +1325,7 @@ class w {
1315
1325
  */
1316
1326
  toAbsolute() {
1317
1327
  const { segments: t } = this;
1318
- return this.segments = H(t), this;
1328
+ return this.segments = Q(t), this;
1319
1329
  }
1320
1330
  /**
1321
1331
  * Convert path to relative values
@@ -1324,7 +1334,7 @@ class w {
1324
1334
  */
1325
1335
  toRelative() {
1326
1336
  const { segments: t } = this;
1327
- return this.segments = At(t), this;
1337
+ return this.segments = Nt(t), this;
1328
1338
  }
1329
1339
  /**
1330
1340
  * Convert path to cubic-bezier values. In addition, un-necessary `Z`
@@ -1344,7 +1354,7 @@ class w {
1344
1354
  */
1345
1355
  reverse(t) {
1346
1356
  this.toAbsolute();
1347
- const { segments: n } = this, r = qt(n), s = r.length > 1 ? r : !1, i = s ? [...s].map((a, l) => t ? l ? it(a) : [...a] : it(a)) : [...n];
1357
+ const { segments: n } = this, r = $t(n), s = r.length > 1 ? r : !1, i = s ? [...s].map((a, l) => t ? l ? it(a) : [...a] : it(a)) : [...n];
1348
1358
  let o = [];
1349
1359
  return s ? o = i.flat(1) : o = t ? n : it(n), this.segments = [...o], this;
1350
1360
  }
@@ -1357,7 +1367,7 @@ class w {
1357
1367
  */
1358
1368
  normalize() {
1359
1369
  const { segments: t } = this;
1360
- return this.segments = j(t), this;
1370
+ return this.segments = z(t), this;
1361
1371
  }
1362
1372
  /**
1363
1373
  * Optimize `pathArray` values:
@@ -1369,7 +1379,7 @@ class w {
1369
1379
  */
1370
1380
  optimize() {
1371
1381
  const { segments: t } = this;
1372
- return this.segments = $t(t, this.round), this;
1382
+ return this.segments = qt(t, this.round), this;
1373
1383
  }
1374
1384
  /**
1375
1385
  * Transform path using values from an `Object` defined as `transformObject`.
@@ -1394,7 +1404,7 @@ class w {
1394
1404
  o.origin = [Number.isNaN(l) ? r : l, Number.isNaN(c) ? s : c, m || i];
1395
1405
  } else
1396
1406
  o.origin = [r, s, i];
1397
- return this.segments = zt(n, o), this;
1407
+ return this.segments = Et(n, o), this;
1398
1408
  }
1399
1409
  /**
1400
1410
  * Rotate path 180deg vertically
@@ -1420,11 +1430,11 @@ class w {
1420
1430
  * @return the path string
1421
1431
  */
1422
1432
  toString() {
1423
- return Z(this.segments, this.round);
1433
+ return At(this.segments, this.round);
1424
1434
  }
1425
1435
  }
1426
1436
  // bring main utilities to front
1427
- N(w, "CSSMatrix", v), N(w, "getPathBBox", Lt), N(w, "getPathArea", Kt), N(w, "getTotalLength", F), N(w, "getDrawDirection", Me), N(w, "getPointAtLength", W), N(w, "pathLengthFactory", ft), N(w, "getPropertiesAtLength", vt), N(w, "getPropertiesAtPoint", yt), N(w, "polygonLength", ce), N(w, "polygonArea", oe), N(w, "getClosestPoint", Ae), N(w, "getSegmentOfPoint", Ne), N(w, "getSegmentAtLength", we), N(w, "isPointInStroke", ve), N(w, "isValidPath", _t), N(w, "isPathArray", mt), N(w, "isAbsoluteArray", Nt), N(w, "isRelativeArray", Wt), N(w, "isCurveArray", Jt), N(w, "isNormalizedArray", wt), N(w, "shapeToPath", Se), N(w, "parsePathString", Q), N(w, "roundPath", lt), N(w, "splitPath", qt), N(w, "splitCubic", Ie), N(w, "optimizePath", $t), N(w, "reverseCurve", $e), N(w, "reversePath", it), N(w, "normalizePath", j), N(w, "transformPath", zt), N(w, "pathToAbsolute", H), N(w, "pathToRelative", At), N(w, "pathToCurve", ct), N(w, "pathToString", Z);
1437
+ N(w, "CSSMatrix", v), N(w, "getPathBBox", kt), N(w, "getPathArea", Vt), N(w, "getTotalLength", X), N(w, "getDrawDirection", Ae), N(w, "getPointAtLength", K), N(w, "pathLengthFactory", ft), N(w, "getPropertiesAtLength", Pt), N(w, "getPropertiesAtPoint", yt), N(w, "polygonLength", le), N(w, "polygonArea", ce), N(w, "getClosestPoint", Ne), N(w, "getSegmentOfPoint", we), N(w, "getSegmentAtLength", ve), N(w, "isPointInStroke", Pe), N(w, "isValidPath", Kt), N(w, "isPathArray", _), N(w, "isAbsoluteArray", wt), N(w, "isRelativeArray", _t), N(w, "isCurveArray", Jt), N(w, "isNormalizedArray", vt), N(w, "shapeToPath", $e), N(w, "shapeToPathArray", Wt), N(w, "parsePathString", Z), N(w, "roundPath", at), N(w, "splitPath", $t), N(w, "splitCubic", ze), N(w, "optimizePath", qt), N(w, "reverseCurve", Oe), N(w, "reversePath", it), N(w, "normalizePath", z), N(w, "transformPath", Et), N(w, "pathToAbsolute", Q), N(w, "pathToRelative", Nt), N(w, "pathToCurve", ct), N(w, "pathToString", At);
1428
1438
  export {
1429
1439
  w as default
1430
1440
  };