pantograph2d 0.8.1 → 0.9.0

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 (49) hide show
  1. package/dist/QuadraticBezier-BKElJOgn.cjs +9 -0
  2. package/dist/QuadraticBezier-BKElJOgn.cjs.map +1 -0
  3. package/dist/{QuadraticBezier-BzVqiExF.js → QuadraticBezier-PcRS9HZK.js} +1809 -1772
  4. package/dist/QuadraticBezier-PcRS9HZK.js.map +1 -0
  5. package/dist/draw-L71G180-.cjs +2 -0
  6. package/dist/draw-L71G180-.cjs.map +1 -0
  7. package/dist/draw-N2ntigsw.js +417 -0
  8. package/dist/draw-N2ntigsw.js.map +1 -0
  9. package/dist/{models-Dxwusy3i.cjs → models-BXU-Gx3U.cjs} +2 -2
  10. package/dist/{models-Dxwusy3i.cjs.map → models-BXU-Gx3U.cjs.map} +1 -1
  11. package/dist/{models-WQ-B7GSL.js → models-BjaFYsN2.js} +18 -18
  12. package/dist/{models-WQ-B7GSL.js.map → models-BjaFYsN2.js.map} +1 -1
  13. package/dist/pantograph/drawShape.cjs +1 -1
  14. package/dist/pantograph/drawShape.cjs.map +1 -1
  15. package/dist/pantograph/drawShape.js +1 -1
  16. package/dist/pantograph/drawShape.js.map +1 -1
  17. package/dist/pantograph/models.cjs +1 -1
  18. package/dist/pantograph/models.js +2 -2
  19. package/dist/pantograph/svg.cjs +1 -1
  20. package/dist/pantograph/svg.js +1 -1
  21. package/dist/pantograph.cjs +2 -2
  22. package/dist/pantograph.cjs.map +1 -1
  23. package/dist/pantograph.js +428 -385
  24. package/dist/pantograph.js.map +1 -1
  25. package/dist/{svg-D0nYyMk7.cjs → svg-ZTvNxsWu.cjs} +2 -2
  26. package/dist/{svg-D0nYyMk7.cjs.map → svg-ZTvNxsWu.cjs.map} +1 -1
  27. package/dist/{svg-BylQQgsL.js → svg-hNHYuj_r.js} +2 -2
  28. package/dist/{svg-BylQQgsL.js.map → svg-hNHYuj_r.js.map} +1 -1
  29. package/dist/types/src/algorithms/conversions/bezierToArcs.d.ts +7 -0
  30. package/dist/types/src/algorithms/conversions/bezierToSafeBezier.d.ts +12 -0
  31. package/dist/types/src/algorithms/conversions/ellipseToArcs.d.ts +0 -0
  32. package/dist/types/src/algorithms/conversions/ellipseToBezier.d.ts +3 -0
  33. package/dist/types/src/algorithms/conversions/helpers.d.ts +13 -0
  34. package/dist/types/src/algorithms/intersections/fullLinesIntersection.d.ts +18 -0
  35. package/dist/types/src/algorithms/offsets/offsetSegment.d.ts +4 -1
  36. package/dist/types/src/algorithms/offsets/offsetStroke.d.ts +3 -1
  37. package/dist/types/src/conversionOperations.d.ts +8 -0
  38. package/dist/types/src/models/segments/Arc.d.ts +1 -0
  39. package/dist/types/src/models/segments/CubicBezier.d.ts +7 -0
  40. package/dist/types/src/models/segments/QuadraticBezier.d.ts +5 -0
  41. package/package.json +2 -2
  42. package/dist/QuadraticBezier-BAVasVfu.cjs +0 -9
  43. package/dist/QuadraticBezier-BAVasVfu.cjs.map +0 -1
  44. package/dist/QuadraticBezier-BzVqiExF.js.map +0 -1
  45. package/dist/draw-DqsKIWJD.js +0 -337
  46. package/dist/draw-DqsKIWJD.js.map +0 -1
  47. package/dist/draw-NcYfDZjT.cjs +0 -2
  48. package/dist/draw-NcYfDZjT.cjs.map +0 -1
  49. package/dist/types/src/algorithms/solvers/zeroViaNewton.d.ts +0 -1
@@ -1,209 +1,209 @@
1
- var lt = Object.defineProperty;
2
- var ut = (t, e, n) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var p = (t, e, n) => ut(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { o as gt, D } from "./draw-DqsKIWJD.js";
5
- import { d as Pe } from "./draw-DqsKIWJD.js";
6
- import { F as d, L as P, D as g, a as B, s as ht, b as pt, c as dt, i as mt, S as C, l as Pt, p as wt, d as Mt, e as X, g as It } from "./models-WQ-B7GSL.js";
7
- import { h as Me } from "./models-WQ-B7GSL.js";
8
- import { r as St, z as bt, l as Lt, f as w, n as Y, i as E, a as vt, s as kt, k as At, m as j, L as S, A as b, d as M, t as Et, c as yt, B as Ft, E as Ct, Q as xt, C as Dt } from "./QuadraticBezier-BzVqiExF.js";
9
- import { s as Rt, a as Ot, b as Bt, c as $t, d as Gt, w as z } from "./svg-BylQQgsL.js";
10
- function I(t) {
11
- if (t instanceof d)
1
+ var bt = Object.defineProperty;
2
+ var Lt = (t, n, e) => n in t ? bt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var P = (t, n, e) => Lt(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { o as At, D as T } from "./draw-N2ntigsw.js";
5
+ import { d as Cn } from "./draw-N2ntigsw.js";
6
+ import { F as w, L as S, D as g, a as _, s as vt, b as kt, c as Et, i as yt, S as R, l as Ft, p as Ct, d as xt, e as rt, g as Dt } from "./models-BjaFYsN2.js";
7
+ import { h as Dn } from "./models-BjaFYsN2.js";
8
+ import { r as Ot, z as Rt, l as Bt, e as L, n as ot, b as y, a as zt, s as Tt, m as $t, o as at, L as I, A as E, C as B, p as J, q as Q, d as Gt, T as Ut, g as A, E as ct, Q as ft, t as _t, c as Vt, B as qt } from "./QuadraticBezier-PcRS9HZK.js";
9
+ import { s as Nt, a as Jt, b as Qt, c as Zt, d as Ht, w as Z } from "./svg-hNHYuj_r.js";
10
+ function v(t) {
11
+ if (t instanceof w)
12
12
  return [t];
13
- if (t instanceof P)
14
- return [new d(t)];
13
+ if (t instanceof S)
14
+ return [new w(t)];
15
15
  if (t instanceof g)
16
16
  return t.figures;
17
17
  throw new Error("Unknown shape");
18
18
  }
19
- function tt(t, e, n = 1e-9) {
19
+ function lt(t, n, e = 1e-9) {
20
20
  let s = [];
21
- const r = [], i = new Array(e.segments.length).fill(0).map(() => []);
22
- e.segments.forEach((c, f) => {
21
+ const r = [], i = new Array(n.segments.length).fill(0).map(() => []);
22
+ n.segments.forEach((f, c) => {
23
23
  t.segments.forEach((a) => {
24
- const { intersections: u, overlaps: m } = B(
25
- c,
24
+ const { intersections: l, overlaps: p } = _(
25
+ f,
26
26
  a,
27
- n
27
+ e
28
28
  );
29
- s.push(...u), i[f].push(...u), r.push(...m);
30
- const h = m.flatMap((l) => [
31
- l.firstPoint,
32
- l.lastPoint
29
+ s.push(...l), i[c].push(...l), r.push(...p);
30
+ const h = p.flatMap((d) => [
31
+ d.firstPoint,
32
+ d.lastPoint
33
33
  ]);
34
- s.push(...h), i[f].push(...h);
34
+ s.push(...h), i[c].push(...h);
35
35
  });
36
- }), s = St(s, n);
37
- const o = bt([e.segments, i]).flatMap(([c, f]) => f.length ? c.splitAt(f) : [c]);
36
+ }), s = Ot(s, e);
37
+ const o = Rt([n.segments, i]).flatMap(([f, c]) => c.length ? f.splitAt(c) : [f]);
38
38
  return Array.from(
39
- ht(
39
+ vt(
40
40
  o,
41
41
  s,
42
42
  r
43
43
  )
44
44
  );
45
45
  }
46
- function $(t, e, n = !1) {
47
- return tt(e, t).filter((r) => {
46
+ function V(t, n, e = !1) {
47
+ return lt(n, t).filter((r) => {
48
48
  const i = r.segments[0].midPoint;
49
- return e.onStroke(i) ? !n : !e.contains(i);
49
+ return n.onStroke(i) ? !e : !n.contains(i);
50
50
  });
51
51
  }
52
- function G(t, e, n = !1) {
53
- return tt(e, t).filter((r) => {
52
+ function q(t, n, e = !1) {
53
+ return lt(n, t).filter((r) => {
54
54
  const i = r.segments[0].midPoint;
55
- return e.onStroke(i) ? !n : e.contains(i);
55
+ return n.onStroke(i) ? !e : n.contains(i);
56
56
  });
57
57
  }
58
- function V(t, e, n = !1) {
59
- const s = $(
58
+ function H(t, n, e = !1) {
59
+ const s = V(
60
60
  t,
61
- e.contour,
62
- n
63
- ), r = e.holes.flatMap(
64
- (i) => G(t, i, n)
61
+ n.contour,
62
+ e
63
+ ), r = n.holes.flatMap(
64
+ (i) => q(t, i, e)
65
65
  );
66
66
  return [...s, ...r];
67
67
  }
68
- function _(t, e, n = !1) {
69
- let s = G(
68
+ function W(t, n, e = !1) {
69
+ let s = q(
70
70
  t,
71
- e.contour,
72
- n
71
+ n.contour,
72
+ e
73
73
  );
74
- return e.holes.forEach((r) => {
74
+ return n.holes.forEach((r) => {
75
75
  s = s.flatMap(
76
- (i) => $(i, r, n)
76
+ (i) => V(i, r, e)
77
77
  );
78
78
  }), s;
79
79
  }
80
- function Tt(t, e) {
80
+ function Wt(t, n) {
81
81
  return new g(
82
- pt(I(t), I(e))
82
+ kt(v(t), v(n))
83
83
  );
84
84
  }
85
- function y(t) {
85
+ function D(t) {
86
86
  return t.reduce(
87
- (e, n) => Tt(e, n),
87
+ (n, e) => Wt(n, e),
88
88
  new g()
89
89
  );
90
90
  }
91
- function et(t, e) {
91
+ function ut(t, n) {
92
92
  return new g(
93
- dt(I(t), I(e))
93
+ Et(v(t), v(n))
94
94
  );
95
95
  }
96
- function oe(t, e) {
96
+ function Mn(t, n) {
97
97
  return new g(
98
- mt(I(t), I(e))
98
+ yt(v(t), v(n))
99
99
  );
100
100
  }
101
- function ae(t, e, n = !0) {
102
- if (e instanceof P)
103
- return $(t, e, n);
104
- if (e instanceof d)
105
- return V(t, e, n);
106
- let s = [new C([...t.segments])];
107
- return e.figures.forEach((r) => {
108
- s = s.flatMap((i) => V(i, r, n));
101
+ function In(t, n, e = !0) {
102
+ if (n instanceof S)
103
+ return V(t, n, e);
104
+ if (n instanceof w)
105
+ return H(t, n, e);
106
+ let s = [new R([...t.segments])];
107
+ return n.figures.forEach((r) => {
108
+ s = s.flatMap((i) => H(i, r, e));
109
109
  }), s;
110
110
  }
111
- function ce(t, e, n = !1) {
112
- if (e instanceof P)
113
- return G(t, e, n);
114
- if (e instanceof d)
115
- return _(t, e, n);
116
- let s = [new C([...t.segments])];
117
- return e.figures.forEach((r) => {
118
- s = s.flatMap((i) => _(i, r, n));
111
+ function Sn(t, n, e = !1) {
112
+ if (n instanceof S)
113
+ return q(t, n, e);
114
+ if (n instanceof w)
115
+ return W(t, n, e);
116
+ let s = [new R([...t.segments])];
117
+ return n.figures.forEach((r) => {
118
+ s = s.flatMap((i) => W(i, r, e));
119
119
  }), s;
120
120
  }
121
- function N(t) {
121
+ function X(t) {
122
122
  return t < 0 ? "before" : t > 1 ? "after" : "between";
123
123
  }
124
- const q = (t, e, n) => {
125
- if (n === "before")
126
- return t.distanceFrom(e.firstPoint);
127
- if (n === "after")
128
- return t.distanceFrom(e.lastPoint);
124
+ const Y = (t, n, e) => {
125
+ if (e === "before")
126
+ return t.distanceFrom(n.firstPoint);
127
+ if (e === "after")
128
+ return t.distanceFrom(n.lastPoint);
129
129
  throw new Error("Invalid position");
130
130
  };
131
- function Ut(t, e) {
132
- const n = Lt(t, e);
133
- if (n === "parallel")
131
+ function Xt(t, n) {
132
+ const e = Bt(t, n);
133
+ if (e === "parallel")
134
134
  return Math.min(
135
- t.distanceFrom(e.firstPoint),
136
- t.distanceFrom(e.lastPoint)
135
+ t.distanceFrom(n.firstPoint),
136
+ t.distanceFrom(n.lastPoint)
137
137
  );
138
- const { intersectionParam1: s, intersectionParam2: r } = n, i = N(s), o = N(r);
138
+ const { intersectionParam1: s, intersectionParam2: r } = e, i = X(s), o = X(r);
139
139
  if (i === "between" && o === "between")
140
140
  return 0;
141
141
  if (i === "between" && o !== "between")
142
- return q(t, e, o);
142
+ return Y(t, n, o);
143
143
  if (o === "between" && i !== "between")
144
- return q(e, t, i);
144
+ return Y(n, t, i);
145
145
  if (i === "before" && o === "before")
146
- return w(t.firstPoint, e.firstPoint);
146
+ return L(t.firstPoint, n.firstPoint);
147
147
  if (i === "after" && o === "after")
148
- return w(t.lastPoint, e.lastPoint);
148
+ return L(t.lastPoint, n.lastPoint);
149
149
  if (i === "before" && o === "after")
150
- return w(t.firstPoint, e.lastPoint);
150
+ return L(t.firstPoint, n.lastPoint);
151
151
  if (i === "after" && o === "before")
152
- return w(t.lastPoint, e.firstPoint);
152
+ return L(t.lastPoint, n.firstPoint);
153
153
  throw new Error("Invalid position");
154
154
  }
155
- function J(t, e) {
156
- if (Pt(t, e).length > 0)
155
+ function K(t, n) {
156
+ if (Ft(t, n).length > 0)
157
157
  return 0;
158
- const n = wt(t, e.center);
159
- if (t.isOnSegment(n)) {
160
- const s = w(n, e.center);
161
- if (Math.abs(s - e.radius) < t.precision && e.isOnSegment(n))
158
+ const e = Ct(t, n.center);
159
+ if (t.isOnSegment(e)) {
160
+ const s = L(e, n.center);
161
+ if (Math.abs(s - n.radius) < t.precision && n.isOnSegment(e))
162
162
  return 0;
163
- if (s - e.radius > t.precision) {
164
- const r = Y(
165
- E(n, e.center)
166
- ), i = vt(
167
- e.center,
168
- kt(r, e.radius)
163
+ if (s - n.radius > t.precision) {
164
+ const r = ot(
165
+ y(e, n.center)
166
+ ), i = zt(
167
+ n.center,
168
+ Tt(r, n.radius)
169
169
  );
170
- if (e.isOnSegment(i))
171
- return w(i, n);
170
+ if (n.isOnSegment(i))
171
+ return L(i, e);
172
172
  }
173
173
  }
174
174
  return Math.min(
175
- e.distanceFrom(t.firstPoint),
176
- e.distanceFrom(t.lastPoint),
177
- t.distanceFrom(e.firstPoint),
178
- t.distanceFrom(e.lastPoint)
175
+ n.distanceFrom(t.firstPoint),
176
+ n.distanceFrom(t.lastPoint),
177
+ t.distanceFrom(n.firstPoint),
178
+ t.distanceFrom(n.lastPoint)
179
179
  );
180
180
  }
181
- const zt = (t, e) => {
182
- const n = t.angleToParam(e.firstAngle);
183
- if (t.isValidParameter(n)) return !0;
184
- const s = t.angleToParam(e.lastAngle);
181
+ const Yt = (t, n) => {
182
+ const e = t.angleToParam(n.firstAngle);
183
+ if (t.isValidParameter(e)) return !0;
184
+ const s = t.angleToParam(n.lastAngle);
185
185
  return !!t.isValidParameter(s);
186
186
  };
187
- function Vt(t, e) {
188
- if (Mt(t, e, !0).length > 0) return 0;
189
- const n = w(t.center, e.center);
190
- if (n < t.precision && zt(t, e))
191
- return Math.abs(t.radius - e.radius);
192
- const s = Y(E(e.center, t.center)), r = n - Math.abs(t.radius - e.radius) < t.precision;
193
- let i = At(s);
194
- r && e.radius > t.radius && (i += Math.PI);
195
- const o = r ? i : i + Math.PI, c = t.angleToParam(i), f = e.angleToParam(o);
196
- return t.isValidParameter(c) && e.isValidParameter(f) ? w(t.paramPoint(c), e.paramPoint(f)) : Math.min(
197
- t.distanceFrom(e.firstPoint),
198
- t.distanceFrom(e.lastPoint),
199
- e.distanceFrom(t.firstPoint),
200
- e.distanceFrom(t.lastPoint)
187
+ function Kt(t, n) {
188
+ if (xt(t, n, !0).length > 0) return 0;
189
+ const e = L(t.center, n.center);
190
+ if (e < t.precision && Yt(t, n))
191
+ return Math.abs(t.radius - n.radius);
192
+ const s = ot(y(n.center, t.center)), r = e - Math.abs(t.radius - n.radius) < t.precision;
193
+ let i = $t(s);
194
+ r && n.radius > t.radius && (i += Math.PI);
195
+ const o = r ? i : i + Math.PI, f = t.angleToParam(i), c = n.angleToParam(o);
196
+ return t.isValidParameter(f) && n.isValidParameter(c) ? L(t.paramPoint(f), n.paramPoint(c)) : Math.min(
197
+ t.distanceFrom(n.firstPoint),
198
+ t.distanceFrom(n.lastPoint),
199
+ n.distanceFrom(t.firstPoint),
200
+ n.distanceFrom(t.lastPoint)
201
201
  );
202
202
  }
203
- function _t(t, e, n) {
203
+ function jt(t, n, e) {
204
204
  let s = 0, r = t.length - 1;
205
205
  for (; s <= r; ) {
206
- const i = Math.floor((s + r) / 2), o = n(t[i], e);
206
+ const i = Math.floor((s + r) / 2), o = e(t[i], n);
207
207
  if (o < 0)
208
208
  s = i + 1;
209
209
  else if (o > 0)
@@ -213,358 +213,401 @@ function _t(t, e, n) {
213
213
  }
214
214
  return -(s + 1);
215
215
  }
216
- function Nt(t, e, n) {
217
- const s = _t(t, e, n);
218
- s < 0 ? t.splice(-(s + 1), 0, e) : t.splice(s, 0, e);
216
+ function tn(t, n, e) {
217
+ const s = jt(t, n, e);
218
+ s < 0 ? t.splice(-(s + 1), 0, n) : t.splice(s, 0, n);
219
219
  }
220
- class qt {
220
+ class nn {
221
221
  constructor() {
222
- p(this, "buckets");
222
+ P(this, "buckets");
223
223
  this.buckets = [];
224
224
  }
225
- addInterval(e) {
226
- const n = this.buckets[e.rectangle.diagonalBucketIndex];
227
- n === void 0 ? this.buckets[e.rectangle.diagonalBucketIndex] = [e] : Nt(n, e, (s, r) => s.value - r.value);
225
+ addInterval(n) {
226
+ const e = this.buckets[n.rectangle.diagonalBucketIndex];
227
+ e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] : tn(e, n, (s, r) => s.value - r.value);
228
228
  }
229
- removeInterval(e) {
230
- const n = this.buckets[e.rectangle.diagonalBucketIndex];
231
- if (n === void 0)
229
+ removeInterval(n) {
230
+ const e = this.buckets[n.rectangle.diagonalBucketIndex];
231
+ if (e === void 0)
232
232
  throw new Error("Interval not found");
233
- n.shift();
233
+ e.shift();
234
234
  }
235
235
  getBottomRightHullIntervals() {
236
- const e = [];
237
- for (let n = this.buckets.length - 1; n >= 0; n--) {
238
- const s = this.buckets[n];
236
+ const n = [];
237
+ for (let e = this.buckets.length - 1; e >= 0; e--) {
238
+ const s = this.buckets[e];
239
239
  if (!s === void 0) continue;
240
240
  const r = s[0];
241
241
  if (r !== void 0) {
242
- if (!e.length) {
243
- e.push(r);
242
+ if (!n.length) {
243
+ n.push(r);
244
244
  continue;
245
245
  }
246
- for (; e.length && e[e.length - 1].value >= r.value; )
247
- e.pop();
248
- for (; e.length >= 2; ) {
249
- const i = e[e.length - 1], o = e[e.length - 2], c = (r.value - o.value) / ((r.rectangle.diagonal - o.rectangle.diagonal) * 2);
250
- if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * c < i.value)
251
- e.pop();
246
+ for (; n.length && n[n.length - 1].value >= r.value; )
247
+ n.pop();
248
+ for (; n.length >= 2; ) {
249
+ const i = n[n.length - 1], o = n[n.length - 2], f = (r.value - o.value) / ((r.rectangle.diagonal - o.rectangle.diagonal) * 2);
250
+ if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * f < i.value)
251
+ n.pop();
252
252
  else
253
253
  break;
254
254
  }
255
- e.push(r);
255
+ n.push(r);
256
256
  }
257
257
  }
258
- return e;
258
+ return n;
259
259
  }
260
260
  }
261
- class Jt {
262
- constructor(e, n) {
263
- p(this, "diagonal");
264
- p(this, "diagonalBucketIndex");
265
- p(this, "xLength");
266
- p(this, "yLength");
267
- p(this, "index");
268
- this.x = e, this.y = n, this.xLength = Math.pow(3, -e), this.yLength = Math.pow(3, -n), this.diagonal = Math.sqrt(
261
+ class en {
262
+ constructor(n, e) {
263
+ P(this, "diagonal");
264
+ P(this, "diagonalBucketIndex");
265
+ P(this, "xLength");
266
+ P(this, "yLength");
267
+ P(this, "index");
268
+ this.x = n, this.y = e, this.xLength = Math.pow(3, -n), this.yLength = Math.pow(3, -e), this.diagonal = Math.sqrt(
269
269
  this.xLength * this.xLength + this.yLength * this.yLength
270
- ), this.diagonalBucketIndex = e + n, this.index = `${e},${n}`;
270
+ ), this.diagonalBucketIndex = n + e, this.index = `${n},${e}`;
271
271
  }
272
272
  }
273
- class Qt {
274
- constructor(e, n = 1e-8, s = 1e3, r = 1e-6) {
275
- p(this, "rectangles");
276
- p(this, "buckets");
277
- p(this, "fMin");
278
- p(this, "argMin");
279
- p(this, "tol");
280
- this.fcn = e, this.endTolerance = n, this.maxIterations = s, this.epsilon = r, this.fcn = e, this.epsilon = r, this.endTolerance = n, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new qt();
281
- const i = [0.5, 0.5], o = this.rect(0, 0), c = this.fcn(i);
282
- this.buckets.addInterval(new A(i, c, o)), this.fMin = c, this.argMin = i, this.tol = o.diagonal;
273
+ class sn {
274
+ constructor(n, e = 1e-8, s = 1e3, r = 1e-6) {
275
+ P(this, "rectangles");
276
+ P(this, "buckets");
277
+ P(this, "fMin");
278
+ P(this, "argMin");
279
+ P(this, "tol");
280
+ this.fcn = n, this.endTolerance = e, this.maxIterations = s, this.epsilon = r, this.fcn = n, this.epsilon = r, this.endTolerance = e, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new nn();
281
+ const i = [0.5, 0.5], o = this.rect(0, 0), f = this.fcn(i);
282
+ this.buckets.addInterval(new x(i, f, o)), this.fMin = f, this.argMin = i, this.tol = o.diagonal;
283
283
  }
284
- registerInterval(e) {
285
- this.buckets.addInterval(e), e.value <= this.fMin && (this.fMin = e.value, this.argMin = e.center, this.tol = e.rectangle.diagonal);
284
+ registerInterval(n) {
285
+ this.buckets.addInterval(n), n.value <= this.fMin && (this.fMin = n.value, this.argMin = n.center, this.tol = n.rectangle.diagonal);
286
286
  }
287
- rect(e, n) {
288
- const s = `${e},${n}`;
289
- return this.rectangles.has(s) || this.rectangles.set(s, new Jt(e, n)), this.rectangles.get(s);
287
+ rect(n, e) {
288
+ const s = `${n},${e}`;
289
+ return this.rectangles.has(s) || this.rectangles.set(s, new en(n, e)), this.rectangles.get(s);
290
290
  }
291
- splitInterval(e) {
292
- let n, s, r;
293
- const [i, o] = e.center;
294
- return e.rectangle.x <= e.rectangle.y ? (n = this.rect(e.rectangle.x + 1, e.rectangle.y), s = [i - n.xLength, o], r = [i + n.xLength, o]) : (n = this.rect(e.rectangle.x, e.rectangle.y + 1), s = [i, o - n.yLength], r = [i, o + n.yLength]), [
295
- new A(s, this.fcn(s), n),
296
- new A(e.center, e.value, n),
297
- new A(r, this.fcn(r), n)
291
+ splitInterval(n) {
292
+ let e, s, r;
293
+ const [i, o] = n.center;
294
+ return n.rectangle.x <= n.rectangle.y ? (e = this.rect(n.rectangle.x + 1, n.rectangle.y), s = [i - e.xLength, o], r = [i + e.xLength, o]) : (e = this.rect(n.rectangle.x, n.rectangle.y + 1), s = [i, o - e.yLength], r = [i, o + e.yLength]), [
295
+ new x(s, this.fcn(s), e),
296
+ new x(n.center, n.value, e),
297
+ new x(r, this.fcn(r), e)
298
298
  ];
299
299
  }
300
300
  single_iteration() {
301
- const e = this.buckets.getBottomRightHullIntervals();
302
- for (; e.length >= 2; ) {
303
- const n = e[0], s = e[1], r = (s.value - n.value) / ((s.rectangle.diagonal - n.rectangle.diagonal) / 2), i = n.value - r * s.value / 2;
301
+ const n = this.buckets.getBottomRightHullIntervals();
302
+ for (; n.length >= 2; ) {
303
+ const e = n[0], s = n[1], r = (s.value - e.value) / ((s.rectangle.diagonal - e.rectangle.diagonal) / 2), i = e.value - r * s.value / 2;
304
304
  if ((this.fMin - i) / Math.abs(this.fMin) < this.epsilon)
305
- e.shift();
305
+ n.shift();
306
306
  else
307
307
  break;
308
308
  }
309
- e.forEach((n) => {
310
- this.buckets.removeInterval(n);
309
+ n.forEach((e) => {
310
+ this.buckets.removeInterval(e);
311
311
  });
312
- for (const n of e) {
313
- const [s, r, i] = this.splitInterval(n);
312
+ for (const e of n) {
313
+ const [s, r, i] = this.splitInterval(e);
314
314
  this.registerInterval(s), this.registerInterval(r), this.registerInterval(i);
315
315
  }
316
316
  }
317
317
  run() {
318
- let e = 0;
319
- for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), e++, !(e > this.maxIterations)); )
318
+ let n = 0;
319
+ for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), n++, !(n > this.maxIterations)); )
320
320
  ;
321
321
  return {
322
322
  fMin: this.fMin,
323
323
  argMin: this.argMin,
324
324
  tol: this.tol,
325
- iterations: e
325
+ iterations: n
326
326
  };
327
327
  }
328
328
  }
329
- class A {
330
- constructor(e, n, s) {
331
- this.center = e, this.value = n, this.rectangle = s;
329
+ class x {
330
+ constructor(n, e, s) {
331
+ this.center = n, this.value = e, this.rectangle = s;
332
332
  }
333
333
  }
334
- function Zt(t, e = 1e-8, n = 1e3, s = 1e-6) {
335
- return new Qt(
334
+ function rn(t, n = 1e-8, e = 1e3, s = 1e-6) {
335
+ return new sn(
336
336
  t,
337
- e,
338
337
  n,
338
+ e,
339
339
  s
340
340
  ).run();
341
341
  }
342
- function Ht(t, e, n = 1e-9) {
343
- const s = Zt((r) => {
344
- const i = t.paramPoint(r[0]), o = e.paramPoint(r[1]);
345
- return j(i, o);
346
- }, n);
342
+ function on(t, n, e = 1e-9) {
343
+ const s = rn((r) => {
344
+ const i = t.paramPoint(r[0]), o = n.paramPoint(r[1]);
345
+ return at(i, o);
346
+ }, e);
347
347
  return Math.sqrt(s.fMin);
348
348
  }
349
- function Wt(t, e) {
350
- return t instanceof S && e instanceof S ? Ut(t, e) : t instanceof S && e instanceof b ? J(t, e) : t instanceof b && e instanceof S ? J(e, t) : t instanceof b && e instanceof b ? Vt(t, e) : Ht(t, e);
349
+ function an(t, n) {
350
+ return t instanceof I && n instanceof I ? Xt(t, n) : t instanceof I && n instanceof E ? K(t, n) : t instanceof E && n instanceof I ? K(n, t) : t instanceof E && n instanceof E ? Kt(t, n) : on(t, n);
351
+ }
352
+ function ht(t) {
353
+ if (t instanceof B) {
354
+ const r = y(t.lastPoint, t.firstPoint), i = y(t.firstControlPoint, t.firstPoint), o = y(t.lastControlPoint, t.firstPoint), f = Q(r, i), c = Q(r, o);
355
+ if (f > 0 && c < 0 || f < 0 && c > 0) return !1;
356
+ }
357
+ const n = J(t.tangentAtFirstPoint), e = J(t.tangentAtLastPoint);
358
+ let s = Gt(n, e);
359
+ return Math.abs(Math.acos(s)) < Math.PI / 3;
360
+ }
361
+ function $(t) {
362
+ if (ht(t)) return [t];
363
+ const [n, e] = t.splitAtParameters([0.5]);
364
+ return [
365
+ ...$(n),
366
+ ...$(e)
367
+ ];
368
+ }
369
+ function j(t) {
370
+ return ht(t) ? [t] : t.splitAtParameters(t.getParametersOfExtrema()).flatMap($);
371
+ }
372
+ function cn(t) {
373
+ const n = t.deltaAngle, e = Math.ceil(Math.abs(n) / (Math.PI / 2)), s = n / e, r = 4 * Math.tan(s / 4) / 3, i = t.clockwise ? -1 : 1, o = Array.from(
374
+ { length: e + 1 },
375
+ (c, a) => t.firstAngle + a * s * i
376
+ );
377
+ return o.slice(0, -1).map((c, a) => [c, o[a + 1]]).map(([c, a]) => {
378
+ const l = Math.cos(c), p = Math.sin(c), h = Math.cos(a), d = Math.sin(a), [u, M] = t.center, m = t.minorRadius, b = t.majorRadius, k = new Ut().rotate(
379
+ t.tiltAngle,
380
+ t.center
381
+ ), F = (St) => k.transform(St), C = F([u + b * l, M + m * p]), z = F([
382
+ u + b * (l - r * p * i),
383
+ M + m * (p + r * l * i)
384
+ ]), Mt = F([
385
+ u + b * (h + r * d * i),
386
+ M + m * (d - r * h * i)
387
+ ]), It = F([u + b * h, M + m * d]);
388
+ return new B(C, It, z, Mt);
389
+ });
351
390
  }
352
- const T = 1e-8;
353
- function R(t, e, n = !0) {
391
+ const N = 1e-8, gt = (t) => t.flatMap((n) => n instanceof I ? [n] : n instanceof E ? [n] : n instanceof ct ? cn(n).flatMap(
392
+ (e) => j(e)
393
+ ) : n instanceof ft || n instanceof B ? j(n) : [new I(n.firstPoint, n.lastPoint)]);
394
+ function G(t, n, e = !0) {
354
395
  const s = t.map((a) => ({
355
- offset: gt(a, e),
396
+ offset: At(a, n),
356
397
  original: a
357
398
  })), r = [];
358
- let i = n ? null : s.at(-1), o = n ? s.at(-1) : null;
399
+ let i = e ? null : s.at(-1), o = e ? s.at(-1) : null;
359
400
  if (r.length === 1) return r;
360
- const c = (a) => {
361
- i ? a.offset instanceof D ? M(a.offset.firstPoint, a.offset.lastPoint) || r.push(
362
- new S(a.offset.firstPoint, a.offset.lastPoint)
401
+ const f = (a) => {
402
+ i ? a.offset instanceof T ? A(a.offset.firstPoint, a.offset.lastPoint) || r.push(
403
+ new I(a.offset.firstPoint, a.offset.lastPoint)
363
404
  ) : r.push(a.offset) : i = a;
364
- }, f = function* () {
405
+ }, c = function* () {
365
406
  for (const a of s.slice(0, -1))
366
407
  yield a;
367
408
  if (!i) throw new Error("Bug in the offset algorithm");
368
409
  yield i;
369
410
  };
370
- for (const a of f()) {
411
+ for (const a of c()) {
371
412
  if (!o) {
372
413
  o = a;
373
414
  continue;
374
415
  }
375
- const u = o.offset.lastPoint, m = a.offset.firstPoint;
376
- if (M(u, m)) {
377
- c(o), o = a;
416
+ const l = o.offset.lastPoint, p = a.offset.firstPoint;
417
+ if (A(l, p)) {
418
+ f(o), o = a;
378
419
  continue;
379
420
  }
380
421
  let h = [];
381
- if (!(o.offset instanceof D) && !(a.offset instanceof D)) {
382
- const { intersections: L, overlaps: x } = B(
422
+ if (!(o.offset instanceof T) && !(a.offset instanceof T)) {
423
+ const { intersections: m, overlaps: b } = _(
383
424
  o.offset,
384
425
  a.offset,
385
- T / 100
426
+ N / 100
386
427
  );
387
428
  h = [
388
- ...L,
389
- ...x.flatMap((v) => [v.firstPoint, v.lastPoint])
429
+ ...m,
430
+ ...b.flatMap((k) => [k.firstPoint, k.lastPoint])
390
431
  ];
391
432
  }
392
433
  if (h.length > 0) {
393
- let L = h[0];
434
+ let m = h[0];
394
435
  if (h.length > 1) {
395
- const ct = o == null ? void 0 : o.original.lastPoint, U = h.map(
396
- (ft) => j(ft, ct)
436
+ const F = o == null ? void 0 : o.original.lastPoint, C = h.map(
437
+ (z) => at(z, F)
397
438
  );
398
- L = h[U.indexOf(Math.min(...U))];
439
+ m = h[C.indexOf(Math.min(...C))];
399
440
  }
400
- const x = o.offset.splitAt([
401
- L
402
- ])[0], v = a.offset.splitAt([L]).at(-1);
403
- if (!v) throw new Error("Bug in the splitting algo in offset");
404
- c({
405
- offset: x,
441
+ const b = o.offset.splitAt([
442
+ m
443
+ ])[0], k = a.offset.splitAt([m]).at(-1);
444
+ if (!k) throw new Error("Bug in the splitting algo in offset");
445
+ f({
446
+ offset: b,
406
447
  original: o.original
407
- }), o = { offset: v, original: a.original };
448
+ }), o = { offset: k, original: a.original };
408
449
  continue;
409
450
  }
410
- const l = o.original.lastPoint, k = yt(
411
- E(m, l),
412
- E(u, l)
413
- ) > 0, at = new b(u, m, l, k);
414
- c(o), r.push(at), o = a;
451
+ const d = o.original.lastPoint, u = Vt(
452
+ y(p, d),
453
+ y(l, d)
454
+ ) > 0, M = new E(l, p, d, u);
455
+ f(o), r.push(M), o = a;
415
456
  }
416
- return o && c(o), r;
457
+ return o && f(o), r;
417
458
  }
418
- function nt(t) {
419
- const e = /* @__PURE__ */ new Map(), n = (s, r) => {
420
- const i = e.get(s) || [];
421
- e.set(s, [...i, ...r]);
459
+ function pt(t) {
460
+ const n = /* @__PURE__ */ new Map(), e = (s, r) => {
461
+ const i = n.get(s) || [];
462
+ n.set(s, [...i, ...r]);
422
463
  };
423
464
  return t.forEach((s, r) => {
424
465
  t.slice(r + 1).forEach((i, o) => {
425
- const { intersections: c, overlaps: f } = B(s, i, T), a = [
426
- ...c,
427
- ...f.flatMap((u) => [u.firstPoint, u.lastPoint])
428
- ].filter((u) => {
429
- const m = M(u, s.firstPoint) || M(u, s.lastPoint), h = M(u, i.firstPoint) || M(u, i.lastPoint);
430
- return !(m && h);
466
+ const { intersections: f, overlaps: c } = _(s, i, N), a = [
467
+ ...f,
468
+ ...c.flatMap((l) => [l.firstPoint, l.lastPoint])
469
+ ].filter((l) => {
470
+ const p = A(l, s.firstPoint) || A(l, s.lastPoint), h = A(l, i.firstPoint) || A(l, i.lastPoint);
471
+ return !(p && h);
431
472
  });
432
- a.length && (n(r, a), n(o + r + 1, a));
473
+ a.length && (e(r, a), e(o + r + 1, a));
433
474
  });
434
- }), e;
475
+ }), n;
435
476
  }
436
- function st(t, e) {
437
- return e.flatMap((n, s) => {
438
- if (!t.has(s)) return n;
477
+ function dt(t, n) {
478
+ return n.flatMap((e, s) => {
479
+ if (!t.has(s)) return e;
439
480
  const r = t.get(s);
440
- return r ? n.splitAt(r) : n;
481
+ return r ? e.splitAt(r) : e;
441
482
  });
442
483
  }
443
- function it(t, e, n) {
444
- return t.filter((s) => !e.segments.some((i) => Wt(i, s) < Math.abs(n) - T));
484
+ function Pt(t, n, e) {
485
+ return t.filter((s) => !n.segments.some((i) => an(i, s) < Math.abs(e) - N));
445
486
  }
446
- function F(t, e) {
447
- const n = t.clockwise ? e : -e, s = R(t.segments, n);
448
- if (s.length < 2) return new g();
449
- const r = nt(s);
450
- if (!r.size) {
451
- const a = new P(s);
452
- return new g([new d(a)]);
487
+ function O(t, n) {
488
+ const e = t.clockwise ? n : -n, s = gt(t.segments), r = G(s, e);
489
+ if (r.length < 2) return new g();
490
+ const i = pt(r);
491
+ if (!i.size) {
492
+ const l = new S(r);
493
+ return new g([new w(l)]);
453
494
  }
454
- const i = st(
495
+ const o = dt(
496
+ i,
497
+ r
498
+ ), f = Pt(o, t, n);
499
+ if (!f.length) return new g();
500
+ const a = rt(f).filter((l) => l.length > 1).filter((l) => A(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new S(l));
501
+ return a.length ? new g(a.map((l) => new w(l))) : new g();
502
+ }
503
+ function fn(t, n, e = "round") {
504
+ const s = n / 2, r = gt(t.segments), i = G(r, s, !1), o = G(
455
505
  r,
456
- s
457
- ), o = it(i, t, e);
458
- if (!o.length) return new g();
459
- const f = X(o).filter((a) => a.length > 1).filter((a) => M(a[0].firstPoint, a.at(-1).lastPoint)).map((a) => new P(a));
460
- return f.length ? new g(f.map((a) => new d(a))) : new g();
461
- }
462
- function Kt(t, e, n = "round") {
463
- const s = e / 2, r = R(t.segments, s, !1), i = R(t.segments, -s, !1).map(
464
- (l) => l.reverse()
465
- );
466
- i.reverse();
467
- const o = (l, k) => n === "round" ? Et(
468
- l.lastPoint,
469
- k.firstPoint,
470
- l.tangentAtLastPoint
471
- ) : new S(l.lastPoint, k.firstPoint), c = [
472
- ...r,
473
- o(
474
- r[r.length - 1],
475
- i[0]
476
- ),
506
+ -s,
507
+ !1
508
+ ).map((u) => u.reverse());
509
+ o.reverse();
510
+ const f = (u, M) => e === "round" ? _t(
511
+ u.lastPoint,
512
+ M.firstPoint,
513
+ u.tangentAtLastPoint
514
+ ) : new I(u.lastPoint, M.firstPoint), c = [
477
515
  ...i,
478
- o(
516
+ f(
479
517
  i[i.length - 1],
480
- r[0]
518
+ o[0]
519
+ ),
520
+ ...o,
521
+ f(
522
+ o[o.length - 1],
523
+ i[0]
481
524
  )
482
- ], f = nt(c);
483
- if (!f.size) {
484
- const l = new P(c);
485
- return new g([new d(l)]);
525
+ ], a = pt(c);
526
+ if (!a.size) {
527
+ const u = new S(c);
528
+ return new g([new w(u)]);
486
529
  }
487
- const a = st(
488
- f,
530
+ const l = dt(
531
+ a,
489
532
  c
490
- ), u = it(a, t, s);
491
- if (!u.length) return new g();
492
- const h = X(u).filter((l) => l.length > 1).filter((l) => M(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new P(l));
493
- return h.length ? new g(h.map((l) => new d(l))) : new g();
494
- }
495
- function Xt(t, e) {
496
- const n = t.map((s) => {
497
- const r = y(
498
- s.holes.map((i) => F(i, e))
533
+ ), p = Pt(l, t, s);
534
+ if (!p.length) return new g();
535
+ const d = rt(p).filter((u) => u.length > 1).filter((u) => A(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new S(u));
536
+ return d.length ? new g(d.map((u) => new w(u))) : new g();
537
+ }
538
+ function ln(t, n) {
539
+ const e = t.map((s) => {
540
+ const r = D(
541
+ s.holes.map((i) => O(i, n))
499
542
  );
500
- return et(F(s.contour, e), r);
543
+ return ut(O(s.contour, n), r);
501
544
  });
502
- return y(n);
545
+ return D(e);
503
546
  }
504
- function Yt(t, e) {
505
- const n = Math.abs(e / 2), s = t.map(
506
- (r) => y(
507
- r.allLoops.map((i) => et(F(i, n), F(i, -n)))
547
+ function un(t, n) {
548
+ const e = Math.abs(n / 2), s = t.map(
549
+ (r) => D(
550
+ r.allLoops.map((i) => ut(O(i, e), O(i, -e)))
508
551
  )
509
552
  );
510
- return y(s);
553
+ return D(s);
511
554
  }
512
- function fe(t, e) {
513
- return Xt(I(t), e);
555
+ function bn(t, n) {
556
+ return ln(v(t), n);
514
557
  }
515
- function le(t, e, { endCap: n = "round" } = {}) {
516
- return t instanceof C ? Kt(t, e, n) : Yt(I(t), e);
558
+ function Ln(t, n, { endCap: e = "round" } = {}) {
559
+ return t instanceof R ? fn(t, n, e) : un(v(t), n);
517
560
  }
518
- function Q(t) {
561
+ function tt(t) {
519
562
  if (t instanceof g)
520
- return Rt(t);
521
- if (t instanceof d)
522
- return Ot(t);
523
- if (t instanceof P)
524
- return `<path d="${Bt(t)}" />`;
525
- if (t instanceof C)
526
- return `<path d="${$t(t)}" />`;
527
- if (It(t))
528
- return `<path d="${`M ${t.firstPoint.join(" ")}`} ${Gt(
563
+ return Nt(t);
564
+ if (t instanceof w)
565
+ return Jt(t);
566
+ if (t instanceof S)
567
+ return `<path d="${Qt(t)}" />`;
568
+ if (t instanceof R)
569
+ return `<path d="${Zt(t)}" />`;
570
+ if (Dt(t))
571
+ return `<path d="${`M ${t.firstPoint.join(" ")}`} ${Ht(
529
572
  t
530
573
  )}" />`;
531
574
  throw new Error("Unknown shape type");
532
575
  }
533
- const Z = (t) => "shape" in t ? t.shape : t, H = (t, e) => {
534
- if (!("shape" in t)) return e;
535
- const { color: n } = t;
536
- return n ? `<g stroke="${n}">${e}</g>` : e;
537
- }, W = (t) => new Ft(t.xMin, -t.yMax, t.xMax, -t.yMin);
538
- function ue(t, {
539
- margin: e = 1,
540
- unit: n = null,
576
+ const nt = (t) => "shape" in t ? t.shape : t, et = (t, n) => {
577
+ if (!("shape" in t)) return n;
578
+ const { color: e } = t;
579
+ return e ? `<g stroke="${e}">${n}</g>` : n;
580
+ }, st = (t) => new qt(t.xMin, -t.yMax, t.xMax, -t.yMin);
581
+ function An(t, {
582
+ margin: n = 1,
583
+ unit: e = null,
541
584
  viewBox: s
542
585
  } = {}) {
543
586
  if (Array.isArray(t)) {
544
- const i = t.map((f) => Z(f).mirror()), o = i.map((f, a) => H(t[a], Q(f))).join(`
545
- `), c = i.slice(1).reduce((f, a) => f.merge(a.boundingBox), i[0].boundingBox);
546
- return z(o, s ? W(s) : c, e, n);
587
+ const i = t.map((c) => nt(c).mirror()), o = i.map((c, a) => et(t[a], tt(c))).join(`
588
+ `), f = i.slice(1).reduce((c, a) => c.merge(a.boundingBox), i[0].boundingBox);
589
+ return Z(o, s ? st(s) : f, n, e);
547
590
  }
548
- const r = Z(t).mirror();
549
- return z(
550
- H(t, Q(r)),
551
- s ? W(s) : r.boundingBox,
552
- e,
553
- n
591
+ const r = nt(t).mirror();
592
+ return Z(
593
+ et(t, tt(r)),
594
+ s ? st(s) : r.boundingBox,
595
+ n,
596
+ e
554
597
  );
555
598
  }
556
- const rt = (t) => {
599
+ const mt = (t) => {
557
600
  if (t.type === "LINE")
558
- return new S(t.firstPoint, t.lastPoint);
601
+ return new I(t.firstPoint, t.lastPoint);
559
602
  if (t.type === "ARC")
560
- return new b(
603
+ return new E(
561
604
  t.firstPoint,
562
605
  t.lastPoint,
563
606
  t.center,
564
607
  t.clockwise
565
608
  );
566
609
  if (t.type === "ELLIPSE_ARC")
567
- return new Ct(
610
+ return new ct(
568
611
  t.firstPoint,
569
612
  t.lastPoint,
570
613
  t.center,
@@ -575,66 +618,66 @@ const rt = (t) => {
575
618
  { angleUnits: "rad" }
576
619
  );
577
620
  if (t.type === "QUADRATIC_BEZIER")
578
- return new xt(
621
+ return new ft(
579
622
  t.firstPoint,
580
623
  t.lastPoint,
581
624
  t.controlPoint
582
625
  );
583
626
  if (t.type === "CUBIC_BEZIER")
584
- return new Dt(
627
+ return new B(
585
628
  t.firstPoint,
586
629
  t.lastPoint,
587
630
  t.firstControlPoint,
588
631
  t.lastControlPoint
589
632
  );
590
633
  throw new Error("Unknown segment type");
591
- }, O = (t) => {
592
- const e = t.segments.map(rt);
593
- return new P(e);
594
- }, ot = (t) => {
595
- const e = O(t.contour), n = t.holes.map(O);
596
- return new d(e, n);
597
- }, jt = (t) => {
598
- const e = t.figures.map(ot);
599
- return new g(e);
634
+ }, U = (t) => {
635
+ const n = t.segments.map(mt);
636
+ return new S(n);
637
+ }, wt = (t) => {
638
+ const n = U(t.contour), e = t.holes.map(U);
639
+ return new w(n, e);
640
+ }, hn = (t) => {
641
+ const n = t.figures.map(wt);
642
+ return new g(n);
600
643
  };
601
- function ge(t) {
644
+ function vn(t) {
602
645
  if (t.type === "DIAGRAM")
603
- return jt(t);
646
+ return hn(t);
604
647
  if (t.type === "FIGURE")
605
- return ot(t);
648
+ return wt(t);
606
649
  if (t.type === "LOOP")
607
- return O(t);
650
+ return U(t);
608
651
  if (t.type === "LINE" || t.type === "ARC" || t.type === "ELLIPSE_ARC" || t.type === "CUBIC_BEZIER")
609
- return rt(t);
652
+ return mt(t);
610
653
  throw new Error("Unknown shape type");
611
654
  }
612
- const K = Math.PI / 180, te = 180 / Math.PI;
613
- function he(t, e) {
614
- const n = Math.cos(e * K) * t, s = Math.sin(e * K) * t;
615
- return [n, s];
655
+ const it = Math.PI / 180, gn = 180 / Math.PI;
656
+ function kn(t, n) {
657
+ const e = Math.cos(n * it) * t, s = Math.sin(n * it) * t;
658
+ return [e, s];
616
659
  }
617
- function pe([t, e]) {
618
- const n = Math.sqrt(t * t + e * e), s = Math.atan2(e, t) * te;
619
- return [n, s];
660
+ function En([t, n]) {
661
+ const e = Math.sqrt(t * t + n * n), s = Math.atan2(n, t) * gn;
662
+ return [e, s];
620
663
  }
621
664
  export {
622
- K as DEG2RAD,
623
- te as RAD2DEG,
624
- pe as cartesianToPolar,
625
- ce as confineStrand,
626
- et as cut,
627
- Pe as draw,
628
- ae as eraseStrand,
629
- Me as exportJSON,
630
- ue as exportSVG,
631
- Tt as fuse,
632
- y as fuseAll,
633
- ge as importJSON,
634
- oe as intersect,
635
- fe as offset,
636
- le as outlineStroke,
637
- he as polarToCartesian,
638
- Q as svgBody
665
+ it as DEG2RAD,
666
+ gn as RAD2DEG,
667
+ En as cartesianToPolar,
668
+ Sn as confineStrand,
669
+ ut as cut,
670
+ Cn as draw,
671
+ In as eraseStrand,
672
+ Dn as exportJSON,
673
+ An as exportSVG,
674
+ Wt as fuse,
675
+ D as fuseAll,
676
+ vn as importJSON,
677
+ Mn as intersect,
678
+ bn as offset,
679
+ Ln as outlineStroke,
680
+ kn as polarToCartesian,
681
+ tt as svgBody
639
682
  };
640
683
  //# sourceMappingURL=pantograph.js.map