replicad-pantograph 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.d.ts +45 -4
- package/dist/es/replicad-pantograph.js +1496 -971
- package/dist/es/replicad-pantograph.js.map +1 -1
- package/dist/studio/replicad-pantograph.js +1496 -971
- package/package.json +3 -3
|
@@ -6,11 +6,11 @@ var Me = (r) => {
|
|
|
6
6
|
};
|
|
7
7
|
var Be = (r, s, t) => s in r ? Oe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
8
8
|
var q$2 = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe$1 = (r, s, t) => s.has(r) || Me("Cannot " + t);
|
|
9
|
-
var ht$
|
|
9
|
+
var ht$2 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$1 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
|
|
10
10
|
function zt(r, s, t, e) {
|
|
11
11
|
return r <= e && s >= t;
|
|
12
12
|
}
|
|
13
|
-
let mt$
|
|
13
|
+
let mt$1 = class mt {
|
|
14
14
|
constructor(s = 1 / 0, t = 1 / 0, e = -1 / 0, n = -1 / 0) {
|
|
15
15
|
q$2(this, "xMin");
|
|
16
16
|
q$2(this, "yMin");
|
|
@@ -68,8 +68,8 @@ let mt$2 = class mt {
|
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
function ce(r) {
|
|
72
|
-
return r.reduce((s, t) => s.addPoint(t), new mt$
|
|
71
|
+
function ce$1(r) {
|
|
72
|
+
return r.reduce((s, t) => s.addPoint(t), new mt$1());
|
|
73
73
|
}
|
|
74
74
|
const ye = (r, s = 1e-9) => {
|
|
75
75
|
let t = r;
|
|
@@ -85,7 +85,7 @@ function Te(r, s = 1e-9) {
|
|
|
85
85
|
).values()
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
const fe = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$
|
|
88
|
+
const fe$1 = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$2 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$3 = ([r, s], [t, e]) => [r + t, s + e], Q$2 = ([r, s], [t, e]) => [r - t, s - e], It$2 = ([r, s]) => r * r + s * s, an$1 = ([r, s]) => Math.sqrt(It$2([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$1 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$3 = (r, s = [0, 0]) => Math.sqrt(Rt$1(r, s));
|
|
89
89
|
function St$2([r, s], [t, e]) {
|
|
90
90
|
return r * e - s * t;
|
|
91
91
|
}
|
|
@@ -96,7 +96,7 @@ function un$1([r, s], [t, e] = [0, 0]) {
|
|
|
96
96
|
return Math.atan2(e * r - s * t, r * t + s * e);
|
|
97
97
|
}
|
|
98
98
|
function H$1([r, s]) {
|
|
99
|
-
const t = J$
|
|
99
|
+
const t = J$3([r, s]);
|
|
100
100
|
return [r / t, s / t];
|
|
101
101
|
}
|
|
102
102
|
function Tt(r, s) {
|
|
@@ -107,21 +107,21 @@ function Ye([r, s]) {
|
|
|
107
107
|
return Math.atan2(s, r);
|
|
108
108
|
}
|
|
109
109
|
function We(r) {
|
|
110
|
-
const s = J$
|
|
110
|
+
const s = J$3(r), t = Ye(r);
|
|
111
111
|
return [s, t];
|
|
112
112
|
}
|
|
113
113
|
function Ie(r, s, t = 1e-9) {
|
|
114
114
|
const e = St$2(r, s), n = It$2(r), i = It$2(s);
|
|
115
115
|
return e * e < n * i * t * t;
|
|
116
116
|
}
|
|
117
|
-
function tt$
|
|
117
|
+
function tt$3(r) {
|
|
118
118
|
return [-r[1], r[0]];
|
|
119
119
|
}
|
|
120
|
-
function Qt(r) {
|
|
120
|
+
function Qt$1(r) {
|
|
121
121
|
return [r[1], -r[0]];
|
|
122
122
|
}
|
|
123
123
|
function Qe(r, s, t) {
|
|
124
|
-
return Y$
|
|
124
|
+
return Y$2(t, r) || Ie(Q$2(t, r), s);
|
|
125
125
|
}
|
|
126
126
|
const Mt$2 = (r, s) => {
|
|
127
127
|
const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, M, E] = s;
|
|
@@ -153,7 +153,7 @@ const Mt$2 = (r, s) => {
|
|
|
153
153
|
const [s, t, e, n, i, o, l, h, a] = r;
|
|
154
154
|
return [s, n, l, t, i, h, e, o, a];
|
|
155
155
|
};
|
|
156
|
-
let et$
|
|
156
|
+
let et$4 = class et {
|
|
157
157
|
constructor(s) {
|
|
158
158
|
q$2(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
159
159
|
s && (this._matrix = [...s]);
|
|
@@ -209,38 +209,38 @@ let et$3 = class et {
|
|
|
209
209
|
};
|
|
210
210
|
class Ze {
|
|
211
211
|
translateX(s) {
|
|
212
|
-
const t = new et$
|
|
212
|
+
const t = new et$4().translate(s, 0);
|
|
213
213
|
return this.transform(t);
|
|
214
214
|
}
|
|
215
215
|
translateY(s) {
|
|
216
|
-
const t = new et$
|
|
216
|
+
const t = new et$4().translate(0, s);
|
|
217
217
|
return this.transform(t);
|
|
218
218
|
}
|
|
219
219
|
translate(s, t) {
|
|
220
|
-
const e = new et$
|
|
220
|
+
const e = new et$4().translate(s, t);
|
|
221
221
|
return this.transform(e);
|
|
222
222
|
}
|
|
223
223
|
translateTo([s, t]) {
|
|
224
|
-
const e = new et$
|
|
224
|
+
const e = new et$4().translate(s, t);
|
|
225
225
|
return this.transform(e);
|
|
226
226
|
}
|
|
227
227
|
rotate(s, t) {
|
|
228
|
-
const e = new et$
|
|
229
|
-
s * fe,
|
|
228
|
+
const e = new et$4().rotate(
|
|
229
|
+
s * fe$1,
|
|
230
230
|
t
|
|
231
231
|
);
|
|
232
232
|
return this.transform(e);
|
|
233
233
|
}
|
|
234
234
|
scale(s, t) {
|
|
235
|
-
const e = new et$
|
|
235
|
+
const e = new et$4().scale(s, t);
|
|
236
236
|
return this.transform(e);
|
|
237
237
|
}
|
|
238
238
|
mirrorCenter(s) {
|
|
239
|
-
const t = new et$
|
|
239
|
+
const t = new et$4().mirrorCenter(s);
|
|
240
240
|
return this.transform(t);
|
|
241
241
|
}
|
|
242
242
|
mirror(s = "x", t) {
|
|
243
|
-
const e = new et$
|
|
243
|
+
const e = new et$4();
|
|
244
244
|
return s === "x" ? e.mirrorX() : s === "y" ? e.mirrorY() : e.mirrorLine(s, t), this.transform(e);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -262,7 +262,7 @@ let xt$1 = class xt extends Ze {
|
|
|
262
262
|
return this.repr;
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
|
-
let at$
|
|
265
|
+
let at$3 = class at extends xt$1 {
|
|
266
266
|
constructor() {
|
|
267
267
|
super(...arguments);
|
|
268
268
|
q$2(this, "segmentType", "LINE");
|
|
@@ -279,7 +279,7 @@ let at$2 = class at extends xt$1 {
|
|
|
279
279
|
return it$3(this.firstPoint, nt$2(this.V, t));
|
|
280
280
|
}
|
|
281
281
|
get length() {
|
|
282
|
-
return J$
|
|
282
|
+
return J$3(this.firstPoint, this.lastPoint);
|
|
283
283
|
}
|
|
284
284
|
get squareLength() {
|
|
285
285
|
return Rt$1(this.firstPoint, this.lastPoint);
|
|
@@ -301,7 +301,7 @@ let at$2 = class at extends xt$1 {
|
|
|
301
301
|
return it$3(this.firstPoint, nt$2(this.V, 0.5));
|
|
302
302
|
}
|
|
303
303
|
isSame(t) {
|
|
304
|
-
return t instanceof at ? Y$
|
|
304
|
+
return t instanceof at ? Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) : !1;
|
|
305
305
|
}
|
|
306
306
|
clone() {
|
|
307
307
|
return new at(this.firstPoint, this.lastPoint);
|
|
@@ -310,7 +310,7 @@ let at$2 = class at extends xt$1 {
|
|
|
310
310
|
return new at(this.lastPoint, this.firstPoint);
|
|
311
311
|
}
|
|
312
312
|
get boundingBox() {
|
|
313
|
-
return this._boundingBox === null && (this._boundingBox = new mt$
|
|
313
|
+
return this._boundingBox === null && (this._boundingBox = new mt$1(
|
|
314
314
|
Math.min(this.firstPoint[0], this.lastPoint[0]) - this.precision,
|
|
315
315
|
Math.min(this.firstPoint[1], this.lastPoint[1]) - this.precision,
|
|
316
316
|
Math.max(this.firstPoint[0], this.lastPoint[0]) + this.precision,
|
|
@@ -320,14 +320,14 @@ let at$2 = class at extends xt$1 {
|
|
|
320
320
|
distanceFrom(t) {
|
|
321
321
|
const e = Q$2(t, this.firstPoint), n = Pe(e, this.V) / this.squareLength;
|
|
322
322
|
if (n < 0)
|
|
323
|
-
return J$
|
|
323
|
+
return J$3(t, this.firstPoint);
|
|
324
324
|
if (n > 1)
|
|
325
|
-
return J$
|
|
325
|
+
return J$3(t, this.lastPoint);
|
|
326
326
|
const i = this.paramPoint(n);
|
|
327
|
-
return J$
|
|
327
|
+
return J$3(t, i);
|
|
328
328
|
}
|
|
329
329
|
isOnSegment(t) {
|
|
330
|
-
if (Y$
|
|
330
|
+
if (Y$2(t, this.firstPoint, this.precision)) return !0;
|
|
331
331
|
const e = Q$2(t, this.firstPoint);
|
|
332
332
|
if (!Ie(this.V, e)) return !1;
|
|
333
333
|
const n = Pe(e, this.V) / this.squareLength;
|
|
@@ -341,7 +341,7 @@ let at$2 = class at extends xt$1 {
|
|
|
341
341
|
return H$1(this.V);
|
|
342
342
|
}
|
|
343
343
|
get normalVector() {
|
|
344
|
-
return tt$
|
|
344
|
+
return tt$3(H$1(this.V));
|
|
345
345
|
}
|
|
346
346
|
get tangentAtFirstPoint() {
|
|
347
347
|
return H$1(this.V);
|
|
@@ -411,7 +411,7 @@ function cn$1(r, s, t = !1, e) {
|
|
|
411
411
|
).sort((h, a) => h[0] - a[0]);
|
|
412
412
|
if (l.length === 0) return null;
|
|
413
413
|
if (l.length === 1) return null;
|
|
414
|
-
if (l.length === 2) return new at$
|
|
414
|
+
if (l.length === 2) return new at$3(l[0], l[1]);
|
|
415
415
|
throw console.error(l), new Error(
|
|
416
416
|
"Unexpected number of points while intersecting parallel lines"
|
|
417
417
|
);
|
|
@@ -419,11 +419,11 @@ function cn$1(r, s, t = !1, e) {
|
|
|
419
419
|
const { intersectionParam1: i, intersectionParam2: o } = n;
|
|
420
420
|
return !r.isValidParameter(i) || !s.isValidParameter(o) ? null : r.paramPoint(i);
|
|
421
421
|
}
|
|
422
|
-
const Ot = (r, s) => {
|
|
422
|
+
const Ot$1 = (r, s) => {
|
|
423
423
|
const t = Q$2(r, s);
|
|
424
424
|
return We(t);
|
|
425
425
|
};
|
|
426
|
-
let ct$
|
|
426
|
+
let ct$3 = class ct extends xt$1 {
|
|
427
427
|
constructor(t, e, n, i = !1, { ignoreChecks: o = !1 } = {}) {
|
|
428
428
|
super(t, e);
|
|
429
429
|
q$2(this, "segmentType", "ARC");
|
|
@@ -436,9 +436,9 @@ let ct$2 = class ct extends xt$1 {
|
|
|
436
436
|
q$2(this, "_lastAngle", null);
|
|
437
437
|
q$2(this, "_boundingBox", null);
|
|
438
438
|
if (this.center = n, this.clockwise = i, !o) {
|
|
439
|
-
if (Y$
|
|
439
|
+
if (Y$2(t, e))
|
|
440
440
|
throw new Error("Invalid arc, cannot be a full circle");
|
|
441
|
-
if (Math.abs(this.radius - J$
|
|
441
|
+
if (Math.abs(this.radius - J$3(this.lastPoint, this.center)) > this.precision)
|
|
442
442
|
throw new Error(
|
|
443
443
|
`Invalid arc, radius does not match between ${Z$1(
|
|
444
444
|
t
|
|
@@ -488,7 +488,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
488
488
|
);
|
|
489
489
|
}
|
|
490
490
|
pointToParam(t) {
|
|
491
|
-
const [e, n] = Ot(t, this.center);
|
|
491
|
+
const [e, n] = Ot$1(t, this.center);
|
|
492
492
|
if (Math.abs(e - this.radius) > this.precision)
|
|
493
493
|
throw new Error(
|
|
494
494
|
`Point ${Z$1(t)} is not on segment ${this.repr}`
|
|
@@ -501,7 +501,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
501
501
|
return i;
|
|
502
502
|
}
|
|
503
503
|
get radius() {
|
|
504
|
-
return this._radius === null && (this._radius = J$
|
|
504
|
+
return this._radius === null && (this._radius = J$3(this.firstPoint, this.center)), this._radius;
|
|
505
505
|
}
|
|
506
506
|
get firstAngle() {
|
|
507
507
|
if (this._firstAngle === null) {
|
|
@@ -527,7 +527,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
527
527
|
return this.paramPoint(0.5);
|
|
528
528
|
}
|
|
529
529
|
isSame(t) {
|
|
530
|
-
return !(t instanceof ct) || !Y$
|
|
530
|
+
return !(t instanceof ct) || !Y$2(this.center, t.center) ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
|
|
531
531
|
}
|
|
532
532
|
clone() {
|
|
533
533
|
return new ct(
|
|
@@ -548,7 +548,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
548
548
|
get boundingBox() {
|
|
549
549
|
if (this._boundingBox === null) {
|
|
550
550
|
const t = this.radius + this.precision, e = (n) => this.isValidParameter(this.angleToParam(n));
|
|
551
|
-
this._boundingBox = new mt$
|
|
551
|
+
this._boundingBox = new mt$1(
|
|
552
552
|
e(Math.PI) ? this.center[0] - t : Math.min(this.firstPoint[0], this.lastPoint[0]) - this.precision,
|
|
553
553
|
e(Math.PI * 1.5) ? this.center[1] - t : Math.min(this.firstPoint[1], this.lastPoint[1]) - this.precision,
|
|
554
554
|
e(0) ? this.center[0] + t : Math.max(this.firstPoint[0], this.lastPoint[0]) + this.precision,
|
|
@@ -558,7 +558,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
558
558
|
return this._boundingBox;
|
|
559
559
|
}
|
|
560
560
|
distanceFrom(t) {
|
|
561
|
-
const [e, n] = Ot(t, this.center);
|
|
561
|
+
const [e, n] = Ot$1(t, this.center);
|
|
562
562
|
return this.isValidParameter(this.angleToParam(n)) ? Math.abs(e - this.radius) : Math.sqrt(
|
|
563
563
|
Math.min(
|
|
564
564
|
Rt$1(t, this.firstPoint),
|
|
@@ -567,9 +567,9 @@ let ct$2 = class ct extends xt$1 {
|
|
|
567
567
|
);
|
|
568
568
|
}
|
|
569
569
|
isOnSegment(t) {
|
|
570
|
-
if (Y$
|
|
570
|
+
if (Y$2(t, this.firstPoint) || Y$2(t, this.lastPoint))
|
|
571
571
|
return !0;
|
|
572
|
-
const [e, n] = Ot(t, this.center);
|
|
572
|
+
const [e, n] = Ot$1(t, this.center);
|
|
573
573
|
if (Math.abs(e - this.radius) > this.precision) return !1;
|
|
574
574
|
const i = this.angleToParam(n);
|
|
575
575
|
return this.isValidParameter(i);
|
|
@@ -579,22 +579,22 @@ let ct$2 = class ct extends xt$1 {
|
|
|
579
579
|
return this.clockwise ? [-i, -o] : [i, o];
|
|
580
580
|
}
|
|
581
581
|
tangentAt(t) {
|
|
582
|
-
const [e, n] = Ot(t, this.center);
|
|
582
|
+
const [e, n] = Ot$1(t, this.center);
|
|
583
583
|
if (Math.abs(e - this.radius) > this.precision)
|
|
584
584
|
throw new Error("Point is not on the arc");
|
|
585
585
|
const i = this.angleToParam(n);
|
|
586
586
|
if (!this.isValidParameter(i))
|
|
587
587
|
throw new Error("Point is not on the arc");
|
|
588
588
|
const o = Tt(1, n);
|
|
589
|
-
return (this.clockwise ? Qt : tt$
|
|
589
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(o));
|
|
590
590
|
}
|
|
591
591
|
get tangentAtFirstPoint() {
|
|
592
592
|
const t = Tt(1, this.firstAngle);
|
|
593
|
-
return (this.clockwise ? Qt : tt$
|
|
593
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
|
|
594
594
|
}
|
|
595
595
|
get tangentAtLastPoint() {
|
|
596
596
|
const t = Tt(1, this.lastAngle);
|
|
597
|
-
return (this.clockwise ? Qt : tt$
|
|
597
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
|
|
598
598
|
}
|
|
599
599
|
splitAt(t) {
|
|
600
600
|
let e;
|
|
@@ -630,7 +630,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
632
|
function fn$1(r, s, t) {
|
|
633
|
-
const e = new at$
|
|
633
|
+
const e = new at$3(s, r), n = new at$3(s, t), i = tt$3(e.tangentAtFirstPoint), o = tt$3(n.tangentAtLastPoint), l = me(
|
|
634
634
|
{ firstPoint: e.midPoint, V: i, precision: 1e-9 },
|
|
635
635
|
{ firstPoint: n.midPoint, V: o, precision: 1e-9 }
|
|
636
636
|
);
|
|
@@ -640,7 +640,7 @@ function fn$1(r, s, t) {
|
|
|
640
640
|
Q$2(r, s),
|
|
641
641
|
Q$2(t, s)
|
|
642
642
|
) > 0;
|
|
643
|
-
return new ct$
|
|
643
|
+
return new ct$3(
|
|
644
644
|
r,
|
|
645
645
|
t,
|
|
646
646
|
it$3(e.midPoint, nt$2(i, l.intersectionParam1)),
|
|
@@ -649,11 +649,11 @@ function fn$1(r, s, t) {
|
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
651
|
function mn$2(r, s, t) {
|
|
652
|
-
const e = new at$
|
|
652
|
+
const e = new at$3(r, s), n = tt$3(e.tangentAtFirstPoint), i = me(
|
|
653
653
|
{ firstPoint: e.midPoint, V: n, precision: 1e-9 },
|
|
654
654
|
{
|
|
655
655
|
firstPoint: r,
|
|
656
|
-
V: tt$
|
|
656
|
+
V: tt$3(t),
|
|
657
657
|
precision: 1e-9
|
|
658
658
|
}
|
|
659
659
|
);
|
|
@@ -666,7 +666,7 @@ function mn$2(r, s, t) {
|
|
|
666
666
|
Q$2(o, r),
|
|
667
667
|
Q$2(o, it$3(r, t))
|
|
668
668
|
) < 0;
|
|
669
|
-
return new ct$
|
|
669
|
+
return new ct$3(r, s, o, l, {
|
|
670
670
|
ignoreChecks: !0
|
|
671
671
|
});
|
|
672
672
|
}
|
|
@@ -781,7 +781,7 @@ function qe(r) {
|
|
|
781
781
|
});
|
|
782
782
|
}), t;
|
|
783
783
|
}
|
|
784
|
-
var
|
|
784
|
+
var $$1 = {};
|
|
785
785
|
const ts = Object.prototype.toString;
|
|
786
786
|
function Ct$2(r) {
|
|
787
787
|
const s = ts.call(r);
|
|
@@ -848,7 +848,7 @@ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
848
848
|
__proto__: null,
|
|
849
849
|
default: rs
|
|
850
850
|
}, Symbol.toStringTag, { value: "Module" })), ls = /* @__PURE__ */ qe(os);
|
|
851
|
-
Object.defineProperty(
|
|
851
|
+
Object.defineProperty($$1, "__esModule", { value: !0 });
|
|
852
852
|
var st$3 = ss, je = ls;
|
|
853
853
|
const Ut$1 = " ".repeat(2), Fe = " ".repeat(4);
|
|
854
854
|
function hs() {
|
|
@@ -1299,12 +1299,12 @@ function cs(r, s) {
|
|
|
1299
1299
|
return this;
|
|
1300
1300
|
};
|
|
1301
1301
|
}
|
|
1302
|
-
function ot$
|
|
1302
|
+
function ot$4(r, s, t) {
|
|
1303
1303
|
let e = t ? r.rows : r.rows - 1;
|
|
1304
1304
|
if (s < 0 || s > e)
|
|
1305
1305
|
throw new RangeError("Row index out of range");
|
|
1306
1306
|
}
|
|
1307
|
-
function lt$
|
|
1307
|
+
function lt$3(r, s, t) {
|
|
1308
1308
|
let e = t ? r.columns : r.columns - 1;
|
|
1309
1309
|
if (s < 0 || s > e)
|
|
1310
1310
|
throw new RangeError("Column index out of range");
|
|
@@ -1728,7 +1728,7 @@ let V$1 = class V {
|
|
|
1728
1728
|
return this.mulS(-1);
|
|
1729
1729
|
}
|
|
1730
1730
|
getRow(s) {
|
|
1731
|
-
ot$
|
|
1731
|
+
ot$4(this, s);
|
|
1732
1732
|
let t = [];
|
|
1733
1733
|
for (let e = 0; e < this.columns; e++)
|
|
1734
1734
|
t.push(this.get(s, e));
|
|
@@ -1738,13 +1738,13 @@ let V$1 = class V {
|
|
|
1738
1738
|
return _$3.rowVector(this.getRow(s));
|
|
1739
1739
|
}
|
|
1740
1740
|
setRow(s, t) {
|
|
1741
|
-
ot$
|
|
1741
|
+
ot$4(this, s), t = Pt$2(this, t);
|
|
1742
1742
|
for (let e = 0; e < this.columns; e++)
|
|
1743
1743
|
this.set(s, e, t[e]);
|
|
1744
1744
|
return this;
|
|
1745
1745
|
}
|
|
1746
1746
|
swapRows(s, t) {
|
|
1747
|
-
ot$
|
|
1747
|
+
ot$4(this, s), ot$4(this, t);
|
|
1748
1748
|
for (let e = 0; e < this.columns; e++) {
|
|
1749
1749
|
let n = this.get(s, e);
|
|
1750
1750
|
this.set(s, e, this.get(t, e)), this.set(t, e, n);
|
|
@@ -1752,7 +1752,7 @@ let V$1 = class V {
|
|
|
1752
1752
|
return this;
|
|
1753
1753
|
}
|
|
1754
1754
|
getColumn(s) {
|
|
1755
|
-
lt$
|
|
1755
|
+
lt$3(this, s);
|
|
1756
1756
|
let t = [];
|
|
1757
1757
|
for (let e = 0; e < this.rows; e++)
|
|
1758
1758
|
t.push(this.get(e, s));
|
|
@@ -1762,13 +1762,13 @@ let V$1 = class V {
|
|
|
1762
1762
|
return _$3.columnVector(this.getColumn(s));
|
|
1763
1763
|
}
|
|
1764
1764
|
setColumn(s, t) {
|
|
1765
|
-
lt$
|
|
1765
|
+
lt$3(this, s), t = bt$2(this, t);
|
|
1766
1766
|
for (let e = 0; e < this.rows; e++)
|
|
1767
1767
|
this.set(e, s, t[e]);
|
|
1768
1768
|
return this;
|
|
1769
1769
|
}
|
|
1770
1770
|
swapColumns(s, t) {
|
|
1771
|
-
lt$
|
|
1771
|
+
lt$3(this, s), lt$3(this, t);
|
|
1772
1772
|
for (let e = 0; e < this.rows; e++) {
|
|
1773
1773
|
let n = this.get(e, s);
|
|
1774
1774
|
this.set(e, s, this.get(e, t)), this.set(e, t, n);
|
|
@@ -1832,13 +1832,13 @@ let V$1 = class V {
|
|
|
1832
1832
|
return this;
|
|
1833
1833
|
}
|
|
1834
1834
|
mulRow(s, t) {
|
|
1835
|
-
ot$
|
|
1835
|
+
ot$4(this, s);
|
|
1836
1836
|
for (let e = 0; e < this.columns; e++)
|
|
1837
1837
|
this.set(s, e, this.get(s, e) * t);
|
|
1838
1838
|
return this;
|
|
1839
1839
|
}
|
|
1840
1840
|
mulColumn(s, t) {
|
|
1841
|
-
lt$
|
|
1841
|
+
lt$3(this, s);
|
|
1842
1842
|
for (let e = 0; e < this.rows; e++)
|
|
1843
1843
|
this.set(e, s, this.get(e, s) * t);
|
|
1844
1844
|
return this;
|
|
@@ -1918,7 +1918,7 @@ let V$1 = class V {
|
|
|
1918
1918
|
return t;
|
|
1919
1919
|
}
|
|
1920
1920
|
maxRow(s) {
|
|
1921
|
-
if (ot$
|
|
1921
|
+
if (ot$4(this, s), this.isEmpty())
|
|
1922
1922
|
return NaN;
|
|
1923
1923
|
let t = this.get(s, 0);
|
|
1924
1924
|
for (let e = 1; e < this.columns; e++)
|
|
@@ -1926,14 +1926,14 @@ let V$1 = class V {
|
|
|
1926
1926
|
return t;
|
|
1927
1927
|
}
|
|
1928
1928
|
maxRowIndex(s) {
|
|
1929
|
-
ot$
|
|
1929
|
+
ot$4(this, s), yt$2(this);
|
|
1930
1930
|
let t = this.get(s, 0), e = [s, 0];
|
|
1931
1931
|
for (let n = 1; n < this.columns; n++)
|
|
1932
1932
|
this.get(s, n) > t && (t = this.get(s, n), e[1] = n);
|
|
1933
1933
|
return e;
|
|
1934
1934
|
}
|
|
1935
1935
|
minRow(s) {
|
|
1936
|
-
if (ot$
|
|
1936
|
+
if (ot$4(this, s), this.isEmpty())
|
|
1937
1937
|
return NaN;
|
|
1938
1938
|
let t = this.get(s, 0);
|
|
1939
1939
|
for (let e = 1; e < this.columns; e++)
|
|
@@ -1941,14 +1941,14 @@ let V$1 = class V {
|
|
|
1941
1941
|
return t;
|
|
1942
1942
|
}
|
|
1943
1943
|
minRowIndex(s) {
|
|
1944
|
-
ot$
|
|
1944
|
+
ot$4(this, s), yt$2(this);
|
|
1945
1945
|
let t = this.get(s, 0), e = [s, 0];
|
|
1946
1946
|
for (let n = 1; n < this.columns; n++)
|
|
1947
1947
|
this.get(s, n) < t && (t = this.get(s, n), e[1] = n);
|
|
1948
1948
|
return e;
|
|
1949
1949
|
}
|
|
1950
1950
|
maxColumn(s) {
|
|
1951
|
-
if (lt$
|
|
1951
|
+
if (lt$3(this, s), this.isEmpty())
|
|
1952
1952
|
return NaN;
|
|
1953
1953
|
let t = this.get(0, s);
|
|
1954
1954
|
for (let e = 1; e < this.rows; e++)
|
|
@@ -1956,14 +1956,14 @@ let V$1 = class V {
|
|
|
1956
1956
|
return t;
|
|
1957
1957
|
}
|
|
1958
1958
|
maxColumnIndex(s) {
|
|
1959
|
-
lt$
|
|
1959
|
+
lt$3(this, s), yt$2(this);
|
|
1960
1960
|
let t = this.get(0, s), e = [0, s];
|
|
1961
1961
|
for (let n = 1; n < this.rows; n++)
|
|
1962
1962
|
this.get(n, s) > t && (t = this.get(n, s), e[0] = n);
|
|
1963
1963
|
return e;
|
|
1964
1964
|
}
|
|
1965
1965
|
minColumn(s) {
|
|
1966
|
-
if (lt$
|
|
1966
|
+
if (lt$3(this, s), this.isEmpty())
|
|
1967
1967
|
return NaN;
|
|
1968
1968
|
let t = this.get(0, s);
|
|
1969
1969
|
for (let e = 1; e < this.rows; e++)
|
|
@@ -1971,7 +1971,7 @@ let V$1 = class V {
|
|
|
1971
1971
|
return t;
|
|
1972
1972
|
}
|
|
1973
1973
|
minColumnIndex(s) {
|
|
1974
|
-
lt$
|
|
1974
|
+
lt$3(this, s), yt$2(this);
|
|
1975
1975
|
let t = this.get(0, s), e = [0, s];
|
|
1976
1976
|
for (let n = 1; n < this.rows; n++)
|
|
1977
1977
|
this.get(n, s) < t && (t = this.get(n, s), e[0] = n);
|
|
@@ -2426,8 +2426,8 @@ V$1.prototype.diagonal = V$1.prototype.diag;
|
|
|
2426
2426
|
V$1.identity = V$1.eye;
|
|
2427
2427
|
V$1.prototype.negate = V$1.prototype.neg;
|
|
2428
2428
|
V$1.prototype.tensorProduct = V$1.prototype.kroneckerProduct;
|
|
2429
|
-
var Ft$1, ue, dt;
|
|
2430
|
-
let _$3 = (dt = class extends V$1 {
|
|
2429
|
+
var Ft$1, ue$1, dt$1;
|
|
2430
|
+
let _$3 = (dt$1 = class extends V$1 {
|
|
2431
2431
|
constructor(t, e) {
|
|
2432
2432
|
super();
|
|
2433
2433
|
le$1(this, Ft$1);
|
|
@@ -2435,10 +2435,10 @@ let _$3 = (dt = class extends V$1 {
|
|
|
2435
2435
|
* @type {Float64Array[]}
|
|
2436
2436
|
*/
|
|
2437
2437
|
q$2(this, "data");
|
|
2438
|
-
if (dt.isMatrix(t))
|
|
2439
|
-
he(this, Ft$1, ue).call(this, t.rows, t.columns), dt.copy(t, this);
|
|
2438
|
+
if (dt$1.isMatrix(t))
|
|
2439
|
+
he(this, Ft$1, ue$1).call(this, t.rows, t.columns), dt$1.copy(t, this);
|
|
2440
2440
|
else if (Number.isInteger(t) && t >= 0)
|
|
2441
|
-
he(this, Ft$1, ue).call(this, t, e);
|
|
2441
|
+
he(this, Ft$1, ue$1).call(this, t, e);
|
|
2442
2442
|
else if (st$3.isAnyArray(t)) {
|
|
2443
2443
|
const n = t;
|
|
2444
2444
|
if (t = n.length, e = t ? n[0].length : 0, typeof e != "number")
|
|
@@ -2466,13 +2466,13 @@ let _$3 = (dt = class extends V$1 {
|
|
|
2466
2466
|
return this.data[t][e];
|
|
2467
2467
|
}
|
|
2468
2468
|
removeRow(t) {
|
|
2469
|
-
return ot$
|
|
2469
|
+
return ot$4(this, t), this.data.splice(t, 1), this.rows -= 1, this;
|
|
2470
2470
|
}
|
|
2471
2471
|
addRow(t, e) {
|
|
2472
|
-
return e === void 0 && (e = t, t = this.rows), ot$
|
|
2472
|
+
return e === void 0 && (e = t, t = this.rows), ot$4(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
|
|
2473
2473
|
}
|
|
2474
2474
|
removeColumn(t) {
|
|
2475
|
-
lt$
|
|
2475
|
+
lt$3(this, t);
|
|
2476
2476
|
for (let e = 0; e < this.rows; e++) {
|
|
2477
2477
|
const n = new Float64Array(this.columns - 1);
|
|
2478
2478
|
for (let i = 0; i < t; i++)
|
|
@@ -2484,7 +2484,7 @@ let _$3 = (dt = class extends V$1 {
|
|
|
2484
2484
|
return this.columns -= 1, this;
|
|
2485
2485
|
}
|
|
2486
2486
|
addColumn(t, e) {
|
|
2487
|
-
typeof e > "u" && (e = t, t = this.columns), lt$
|
|
2487
|
+
typeof e > "u" && (e = t, t = this.columns), lt$3(this, t, !0), e = bt$2(this, e);
|
|
2488
2488
|
for (let n = 0; n < this.rows; n++) {
|
|
2489
2489
|
const i = new Float64Array(this.columns + 1);
|
|
2490
2490
|
let o = 0;
|
|
@@ -2501,16 +2501,16 @@ let _$3 = (dt = class extends V$1 {
|
|
|
2501
2501
|
* @param {number} nRows
|
|
2502
2502
|
* @param {number} nColumns
|
|
2503
2503
|
*/
|
|
2504
|
-
ue = function(t, e) {
|
|
2504
|
+
ue$1 = function(t, e) {
|
|
2505
2505
|
if (this.data = [], Number.isInteger(e) && e >= 0)
|
|
2506
2506
|
for (let n = 0; n < t; n++)
|
|
2507
2507
|
this.data.push(new Float64Array(e));
|
|
2508
2508
|
else
|
|
2509
2509
|
throw new TypeError("nColumns must be a positive integer");
|
|
2510
2510
|
this.rows = t, this.columns = e;
|
|
2511
|
-
}, dt);
|
|
2511
|
+
}, dt$1);
|
|
2512
2512
|
cs(V$1, _$3);
|
|
2513
|
-
var K$
|
|
2513
|
+
var K$3;
|
|
2514
2514
|
const Jt = class Jt extends V$1 {
|
|
2515
2515
|
/**
|
|
2516
2516
|
* @param {number | AbstractMatrix | ArrayLike<ArrayLike<number>>} diagonalSize
|
|
@@ -2519,27 +2519,27 @@ const Jt = class Jt extends V$1 {
|
|
|
2519
2519
|
constructor(t) {
|
|
2520
2520
|
super();
|
|
2521
2521
|
/** @type {Matrix} */
|
|
2522
|
-
le$1(this, K$
|
|
2522
|
+
le$1(this, K$3);
|
|
2523
2523
|
if (_$3.isMatrix(t)) {
|
|
2524
2524
|
if (!t.isSymmetric())
|
|
2525
2525
|
throw new TypeError("not symmetric data");
|
|
2526
|
-
Dt$1(this, K$
|
|
2526
|
+
Dt$1(this, K$3, _$3.copy(
|
|
2527
2527
|
t,
|
|
2528
2528
|
new _$3(t.rows, t.rows)
|
|
2529
2529
|
));
|
|
2530
2530
|
} else if (Number.isInteger(t) && t >= 0)
|
|
2531
|
-
Dt$1(this, K$
|
|
2532
|
-
else if (Dt$1(this, K$
|
|
2531
|
+
Dt$1(this, K$3, new _$3(t, t));
|
|
2532
|
+
else if (Dt$1(this, K$3, new _$3(t)), !this.isSymmetric())
|
|
2533
2533
|
throw new TypeError("not symmetric data");
|
|
2534
2534
|
}
|
|
2535
2535
|
get size() {
|
|
2536
|
-
return ht$
|
|
2536
|
+
return ht$2(this, K$3).size;
|
|
2537
2537
|
}
|
|
2538
2538
|
get rows() {
|
|
2539
|
-
return ht$
|
|
2539
|
+
return ht$2(this, K$3).rows;
|
|
2540
2540
|
}
|
|
2541
2541
|
get columns() {
|
|
2542
|
-
return ht$
|
|
2542
|
+
return ht$2(this, K$3).columns;
|
|
2543
2543
|
}
|
|
2544
2544
|
get diagonalSize() {
|
|
2545
2545
|
return this.rows;
|
|
@@ -2578,18 +2578,18 @@ const Jt = class Jt extends V$1 {
|
|
|
2578
2578
|
return new _$3(this);
|
|
2579
2579
|
}
|
|
2580
2580
|
get(t, e) {
|
|
2581
|
-
return ht$
|
|
2581
|
+
return ht$2(this, K$3).get(t, e);
|
|
2582
2582
|
}
|
|
2583
2583
|
set(t, e, n) {
|
|
2584
|
-
return ht$
|
|
2584
|
+
return ht$2(this, K$3).set(t, e, n), ht$2(this, K$3).set(e, t, n), this;
|
|
2585
2585
|
}
|
|
2586
2586
|
removeCross(t) {
|
|
2587
|
-
return ht$
|
|
2587
|
+
return ht$2(this, K$3).removeRow(t), ht$2(this, K$3).removeColumn(t), this;
|
|
2588
2588
|
}
|
|
2589
2589
|
addCross(t, e) {
|
|
2590
2590
|
e === void 0 && (e = t, t = this.diagonalSize);
|
|
2591
2591
|
const n = e.slice();
|
|
2592
|
-
return n.splice(t, 1), ht$
|
|
2592
|
+
return n.splice(t, 1), ht$2(this, K$3).addRow(t, n), ht$2(this, K$3).addColumn(t, e), this;
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
2595
2595
|
* @param {Mask[]} mask
|
|
@@ -2669,7 +2669,7 @@ const Jt = class Jt extends V$1 {
|
|
|
2669
2669
|
yield this.get(t, e), ++e >= this.diagonalSize && (e = ++t);
|
|
2670
2670
|
}
|
|
2671
2671
|
};
|
|
2672
|
-
K$
|
|
2672
|
+
K$3 = new WeakMap();
|
|
2673
2673
|
let pt$1 = Jt;
|
|
2674
2674
|
pt$1.prototype.klassType = "SymmetricMatrix";
|
|
2675
2675
|
let te$1 = class te extends pt$1 {
|
|
@@ -2755,7 +2755,7 @@ let ft$2 = class ft extends V$1 {
|
|
|
2755
2755
|
};
|
|
2756
2756
|
class Cs extends ft$2 {
|
|
2757
2757
|
constructor(s, t) {
|
|
2758
|
-
lt$
|
|
2758
|
+
lt$3(s, t), super(s, s.rows, 1), this.column = t;
|
|
2759
2759
|
}
|
|
2760
2760
|
set(s, t, e) {
|
|
2761
2761
|
return this.matrix.set(s, this.column, e), this;
|
|
@@ -2799,7 +2799,7 @@ class xs extends ft$2 {
|
|
|
2799
2799
|
}
|
|
2800
2800
|
class As extends ft$2 {
|
|
2801
2801
|
constructor(s, t) {
|
|
2802
|
-
ot$
|
|
2802
|
+
ot$4(s, t), super(s, 1, s.columns), this.row = t;
|
|
2803
2803
|
}
|
|
2804
2804
|
set(s, t, e) {
|
|
2805
2805
|
return this.matrix.set(this.row, t, e), this;
|
|
@@ -2885,7 +2885,7 @@ class Ae extends V$1 {
|
|
|
2885
2885
|
return s * this.columns + t;
|
|
2886
2886
|
}
|
|
2887
2887
|
}
|
|
2888
|
-
let rt$
|
|
2888
|
+
let rt$4 = class rt extends V$1 {
|
|
2889
2889
|
constructor(s) {
|
|
2890
2890
|
super(), this.data = s, this.rows = s.length, this.columns = s[0].length;
|
|
2891
2891
|
}
|
|
@@ -2898,12 +2898,12 @@ let rt$3 = class rt extends V$1 {
|
|
|
2898
2898
|
};
|
|
2899
2899
|
function Ls(r, s) {
|
|
2900
2900
|
if (st$3.isAnyArray(r))
|
|
2901
|
-
return r[0] && st$3.isAnyArray(r[0]) ? new rt$
|
|
2901
|
+
return r[0] && st$3.isAnyArray(r[0]) ? new rt$4(r) : new Ae(r, s);
|
|
2902
2902
|
throw new Error("the argument is not an array");
|
|
2903
2903
|
}
|
|
2904
2904
|
let ee$1 = class ee {
|
|
2905
2905
|
constructor(s) {
|
|
2906
|
-
s = rt$
|
|
2906
|
+
s = rt$4.checkMatrix(s);
|
|
2907
2907
|
let t = s.clone(), e = t.rows, n = t.columns, i = new Float64Array(e), o = 1, l, h, a, u, c, g, d, w, p;
|
|
2908
2908
|
for (l = 0; l < e; l++)
|
|
2909
2909
|
i[l] = l;
|
|
@@ -2983,18 +2983,18 @@ let ee$1 = class ee {
|
|
|
2983
2983
|
return Array.from(this.pivotVector);
|
|
2984
2984
|
}
|
|
2985
2985
|
};
|
|
2986
|
-
function ut
|
|
2986
|
+
function ut(r, s) {
|
|
2987
2987
|
let t = 0;
|
|
2988
2988
|
return Math.abs(r) > Math.abs(s) ? (t = s / r, Math.abs(r) * Math.sqrt(1 + t * t)) : s !== 0 ? (t = r / s, Math.abs(s) * Math.sqrt(1 + t * t)) : 0;
|
|
2989
2989
|
}
|
|
2990
2990
|
class pe {
|
|
2991
2991
|
constructor(s) {
|
|
2992
|
-
s = rt$
|
|
2992
|
+
s = rt$4.checkMatrix(s);
|
|
2993
2993
|
let t = s.clone(), e = s.rows, n = s.columns, i = new Float64Array(n), o, l, h, a;
|
|
2994
2994
|
for (h = 0; h < n; h++) {
|
|
2995
2995
|
let u = 0;
|
|
2996
2996
|
for (o = h; o < e; o++)
|
|
2997
|
-
u = ut
|
|
2997
|
+
u = ut(u, t.get(o, h));
|
|
2998
2998
|
if (u !== 0) {
|
|
2999
2999
|
for (t.get(h, h) < 0 && (u = -u), o = h; o < e; o++)
|
|
3000
3000
|
t.set(o, h, t.get(o, h) / u);
|
|
@@ -3065,7 +3065,7 @@ class pe {
|
|
|
3065
3065
|
}
|
|
3066
3066
|
let vt$2 = class vt {
|
|
3067
3067
|
constructor(s, t = {}) {
|
|
3068
|
-
if (s = rt$
|
|
3068
|
+
if (s = rt$4.checkMatrix(s), s.isEmpty())
|
|
3069
3069
|
throw new Error("Matrix must be non-empty");
|
|
3070
3070
|
let e = s.rows, n = s.columns;
|
|
3071
3071
|
const {
|
|
@@ -3093,7 +3093,7 @@ let vt$2 = class vt {
|
|
|
3093
3093
|
if (m < R) {
|
|
3094
3094
|
w[m] = 0;
|
|
3095
3095
|
for (let b = m; b < e; b++)
|
|
3096
|
-
w[m] = ut
|
|
3096
|
+
w[m] = ut(w[m], c.get(b, m));
|
|
3097
3097
|
if (w[m] !== 0) {
|
|
3098
3098
|
c.get(m, m) < 0 && (w[m] = -w[m]);
|
|
3099
3099
|
for (let b = m; b < e; b++)
|
|
@@ -3119,7 +3119,7 @@ let vt$2 = class vt {
|
|
|
3119
3119
|
if (m < v) {
|
|
3120
3120
|
f[m] = 0;
|
|
3121
3121
|
for (let b = m + 1; b < n; b++)
|
|
3122
|
-
f[m] = ut
|
|
3122
|
+
f[m] = ut(f[m], f[b]);
|
|
3123
3123
|
if (f[m] !== 0) {
|
|
3124
3124
|
f[m + 1] < 0 && (f[m] = 0 - f[m]);
|
|
3125
3125
|
for (let b = m + 1; b < n; b++)
|
|
@@ -3214,7 +3214,7 @@ let vt$2 = class vt {
|
|
|
3214
3214
|
let j = f[S - 2];
|
|
3215
3215
|
f[S - 2] = 0;
|
|
3216
3216
|
for (let y = S - 2; y >= m; y--) {
|
|
3217
|
-
let C = ut
|
|
3217
|
+
let C = ut(w[y], j), F = w[y] / C, I = j / C;
|
|
3218
3218
|
if (w[y] = C, y !== m && (j = -I * f[y - 1], f[y - 1] = F * f[y - 1]), a)
|
|
3219
3219
|
for (let B = 0; B < n; B++)
|
|
3220
3220
|
C = F * P.get(B, y) + I * P.get(B, S - 1), P.set(B, S - 1, -I * P.get(B, y) + F * P.get(B, S - 1)), P.set(B, y, C);
|
|
@@ -3225,7 +3225,7 @@ let vt$2 = class vt {
|
|
|
3225
3225
|
let j = f[m - 1];
|
|
3226
3226
|
f[m - 1] = 0;
|
|
3227
3227
|
for (let y = m; y < S; y++) {
|
|
3228
|
-
let C = ut
|
|
3228
|
+
let C = ut(w[y], j), F = w[y] / C, I = j / C;
|
|
3229
3229
|
if (w[y] = C, j = -I * f[y], f[y] = F * f[y], h)
|
|
3230
3230
|
for (let B = 0; B < e; B++)
|
|
3231
3231
|
C = F * p.get(B, y) + I * p.get(B, m - 1), p.set(B, m - 1, -I * p.get(B, y) + F * p.get(B, m - 1)), p.set(B, y, C);
|
|
@@ -3244,13 +3244,13 @@ let vt$2 = class vt {
|
|
|
3244
3244
|
(x !== 0 || N !== 0) && (x < 0 ? A = 0 - Math.sqrt(x * x + N) : A = Math.sqrt(x * x + N), A = N / (x + A));
|
|
3245
3245
|
let O = (I + y) * (I - y) + A, U = I * B;
|
|
3246
3246
|
for (let T = m; T < S - 1; T++) {
|
|
3247
|
-
let z = ut
|
|
3247
|
+
let z = ut(O, U);
|
|
3248
3248
|
z === 0 && (z = Number.MIN_VALUE);
|
|
3249
3249
|
let X = O / z, G = U / z;
|
|
3250
3250
|
if (T !== m && (f[T - 1] = z), O = X * w[T] + G * f[T], f[T] = X * f[T] - G * w[T], U = G * w[T + 1], w[T + 1] = X * w[T + 1], a)
|
|
3251
3251
|
for (let W = 0; W < n; W++)
|
|
3252
3252
|
z = X * P.get(W, T) + G * P.get(W, T + 1), P.set(W, T + 1, -G * P.get(W, T) + X * P.get(W, T + 1)), P.set(W, T, z);
|
|
3253
|
-
if (z = ut
|
|
3253
|
+
if (z = ut(O, U), z === 0 && (z = Number.MIN_VALUE), X = O / z, G = U / z, w[T] = z, O = X * f[T] + G * w[T + 1], w[T + 1] = -G * f[T] + X * w[T + 1], U = G * f[T + 1], f[T + 1] = X * f[T + 1], h && T < e - 1)
|
|
3254
3254
|
for (let W = 0; W < e; W++)
|
|
3255
3255
|
z = X * p.get(W, T) + G * p.get(W, T + 1), p.set(W, T + 1, -G * p.get(W, T) + X * p.get(W, T + 1)), p.set(W, T, z);
|
|
3256
3256
|
}
|
|
@@ -3343,10 +3343,10 @@ let vt$2 = class vt {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
};
|
|
3345
3345
|
function Ds(r, s = !1) {
|
|
3346
|
-
return r = rt$
|
|
3346
|
+
return r = rt$4.checkMatrix(r), s ? new vt$2(r).inverse() : Ve(r, _$3.eye(r.rows));
|
|
3347
3347
|
}
|
|
3348
3348
|
function Ve(r, s, t = !1) {
|
|
3349
|
-
return r = rt$
|
|
3349
|
+
return r = rt$4.checkMatrix(r), s = rt$4.checkMatrix(s), t ? new vt$2(r).solve(s) : r.isSquare() ? new ee$1(r).solve(s) : new pe(r).solve(s);
|
|
3350
3350
|
}
|
|
3351
3351
|
function Xt$1(r) {
|
|
3352
3352
|
if (r = _$3.checkMatrix(r), r.isSquare()) {
|
|
@@ -3433,7 +3433,7 @@ function Ws(r, s = r, t = {}) {
|
|
|
3433
3433
|
let Ne = class {
|
|
3434
3434
|
constructor(s, t = {}) {
|
|
3435
3435
|
const { assumeSymmetric: e = !1 } = t;
|
|
3436
|
-
if (s = rt$
|
|
3436
|
+
if (s = rt$4.checkMatrix(s), !s.isSquare())
|
|
3437
3437
|
throw new Error("Matrix is not a square matrix");
|
|
3438
3438
|
if (s.isEmpty())
|
|
3439
3439
|
throw new Error("Matrix must be non-empty");
|
|
@@ -3532,10 +3532,10 @@ function Gs(r, s, t, e) {
|
|
|
3532
3532
|
u++;
|
|
3533
3533
|
if (u > a)
|
|
3534
3534
|
do {
|
|
3535
|
-
for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut
|
|
3535
|
+
for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut(c, 1), c < 0 && (g = -g), t[a] = s[a] / (c + g), t[a + 1] = s[a] * (c + g), d = t[a + 1], i = n - t[a], o = a + 2; o < r; o++)
|
|
3536
3536
|
t[o] -= i;
|
|
3537
3537
|
for (R = R + i, c = t[u], w = 1, p = w, P = w, f = s[a + 1], M = 0, E = 0, o = u - 1; o >= a; o--)
|
|
3538
|
-
for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut
|
|
3538
|
+
for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut(c, s[o]), s[o + 1] = M * g, M = s[o] / g, w = c / g, c = w * t[o] - M * n, t[o + 1] = i + M * (w * n + M * t[o]), h = 0; h < r; h++)
|
|
3539
3539
|
i = e.get(h, o + 1), e.set(h, o + 1, M * e.get(h, o) + w * i), e.set(h, o, w * e.get(h, o) - M * i);
|
|
3540
3540
|
c = -M * E * P * f * s[a] / d, s[a] = M * c, t[a] = w * c;
|
|
3541
3541
|
} while (Math.abs(s[a]) > L * v);
|
|
@@ -3696,7 +3696,7 @@ function Wt(r, s, t, e) {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
class $e {
|
|
3698
3698
|
constructor(s) {
|
|
3699
|
-
if (s = rt$
|
|
3699
|
+
if (s = rt$4.checkMatrix(s), !s.isSymmetric())
|
|
3700
3700
|
throw new Error("Matrix is not symmetric");
|
|
3701
3701
|
let t = s, e = t.rows, n = new _$3(e, e), i = !0, o, l, h;
|
|
3702
3702
|
for (l = 0; l < e; l++) {
|
|
@@ -3716,7 +3716,7 @@ class $e {
|
|
|
3716
3716
|
return this.positiveDefinite;
|
|
3717
3717
|
}
|
|
3718
3718
|
solve(s) {
|
|
3719
|
-
s = rt$
|
|
3719
|
+
s = rt$4.checkMatrix(s);
|
|
3720
3720
|
let t = this.L, e = t.rows;
|
|
3721
3721
|
if (s.rows !== e)
|
|
3722
3722
|
throw new Error("Matrix dimensions do not match");
|
|
@@ -3743,7 +3743,7 @@ class $e {
|
|
|
3743
3743
|
}
|
|
3744
3744
|
class Le {
|
|
3745
3745
|
constructor(s, t = {}) {
|
|
3746
|
-
s = rt$
|
|
3746
|
+
s = rt$4.checkMatrix(s);
|
|
3747
3747
|
let { Y: e } = t;
|
|
3748
3748
|
const {
|
|
3749
3749
|
scaleScores: n = !1,
|
|
@@ -3752,7 +3752,7 @@ class Le {
|
|
|
3752
3752
|
} = t;
|
|
3753
3753
|
let l;
|
|
3754
3754
|
if (e) {
|
|
3755
|
-
if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$
|
|
3755
|
+
if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$4.checkMatrix(e), e.rows !== s.rows)
|
|
3756
3756
|
throw new Error("Y should have the same number of rows as X");
|
|
3757
3757
|
l = e.getColumnVector(0);
|
|
3758
3758
|
} else
|
|
@@ -3771,45 +3771,45 @@ class Le {
|
|
|
3771
3771
|
this.w = c.transpose(), this.s = a.transpose().mmul(a).sqrt(), n ? this.t = a.clone().div(this.s.get(0, 0)) : this.t = a, this.xResidual = s.sub(a.mmul(c.transpose()));
|
|
3772
3772
|
}
|
|
3773
3773
|
}
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
var Js =
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
var De =
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
var Re =
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3774
|
+
$$1.AbstractMatrix = V$1;
|
|
3775
|
+
$$1.CHO = $e;
|
|
3776
|
+
$$1.CholeskyDecomposition = $e;
|
|
3777
|
+
$$1.DistanceMatrix = te$1;
|
|
3778
|
+
$$1.EVD = Ne;
|
|
3779
|
+
var Js = $$1.EigenvalueDecomposition = Ne;
|
|
3780
|
+
$$1.LU = ee$1;
|
|
3781
|
+
$$1.LuDecomposition = ee$1;
|
|
3782
|
+
var De = $$1.Matrix = _$3;
|
|
3783
|
+
$$1.MatrixColumnSelectionView = qs;
|
|
3784
|
+
$$1.MatrixColumnView = Cs;
|
|
3785
|
+
$$1.MatrixFlipColumnView = Fs;
|
|
3786
|
+
$$1.MatrixFlipRowView = xs;
|
|
3787
|
+
$$1.MatrixRowSelectionView = Vs;
|
|
3788
|
+
$$1.MatrixRowView = As;
|
|
3789
|
+
$$1.MatrixSelectionView = Gt$1;
|
|
3790
|
+
$$1.MatrixSubView = Ns;
|
|
3791
|
+
$$1.MatrixTransposeView = $s;
|
|
3792
|
+
$$1.NIPALS = Le;
|
|
3793
|
+
$$1.Nipals = Le;
|
|
3794
|
+
$$1.QR = pe;
|
|
3795
|
+
$$1.QrDecomposition = pe;
|
|
3796
|
+
$$1.SVD = vt$2;
|
|
3797
|
+
$$1.SingularValueDecomposition = vt$2;
|
|
3798
|
+
$$1.SymmetricMatrix = pt$1;
|
|
3799
|
+
$$1.WrapperMatrix1D = Ae;
|
|
3800
|
+
$$1.WrapperMatrix2D = rt$4;
|
|
3801
|
+
$$1.correlation = Ws;
|
|
3802
|
+
$$1.covariance = Ys;
|
|
3803
|
+
var Re = $$1.default = _$3;
|
|
3804
|
+
$$1.determinant = Xt$1;
|
|
3805
|
+
$$1.inverse = Ds;
|
|
3806
|
+
$$1.linearDependencies = Bs;
|
|
3807
|
+
$$1.pseudoInverse = Us;
|
|
3808
|
+
$$1.solve = Ve;
|
|
3809
|
+
$$1.wrap = Ls;
|
|
3810
3810
|
const Ks = Js, Hs = De;
|
|
3811
3811
|
Re.Matrix && Re.Matrix;
|
|
3812
|
-
function qt
|
|
3812
|
+
function qt(r, s, t) {
|
|
3813
3813
|
const e = r / t, n = s / t;
|
|
3814
3814
|
if (!(isFinite(e) && isFinite(n))) {
|
|
3815
3815
|
const h = -r / s;
|
|
@@ -3831,7 +3831,7 @@ function qt$1(r, s, t) {
|
|
|
3831
3831
|
function ze(r, s, t, e) {
|
|
3832
3832
|
const n = t / (3 * e), i = s / (3 * e), o = r / e;
|
|
3833
3833
|
if (!(isFinite(o) && isFinite(i) && isFinite(n)))
|
|
3834
|
-
return qt
|
|
3834
|
+
return qt(r, s, t);
|
|
3835
3835
|
const l = -n * n + i, h = -i * n + o, a = n * o - i * i, u = 4 * l * a - h * h, c = -2 * n * l + h;
|
|
3836
3836
|
if (u < 0) {
|
|
3837
3837
|
const g = Math.sqrt(-0.25 * u), d = -0.5 * c;
|
|
@@ -3870,18 +3870,18 @@ function gt$1(r, s) {
|
|
|
3870
3870
|
return s == 0 ? Math.abs(r) : Math.abs((r - s) / s);
|
|
3871
3871
|
}
|
|
3872
3872
|
function ve(r, s, t, e, n) {
|
|
3873
|
-
const i = tn
|
|
3873
|
+
const i = tn(r, s, t, e, n);
|
|
3874
3874
|
if (i !== null && i.length == 4) {
|
|
3875
3875
|
let o = [];
|
|
3876
3876
|
for (let l = 0; l < 2; l++) {
|
|
3877
3877
|
const h = i[l * 2], a = i[l * 2 + 1];
|
|
3878
|
-
o = o.concat(qt
|
|
3878
|
+
o = o.concat(qt(a, h, 1));
|
|
3879
3879
|
}
|
|
3880
3880
|
return o;
|
|
3881
3881
|
}
|
|
3882
3882
|
return null;
|
|
3883
3883
|
}
|
|
3884
|
-
function tn
|
|
3884
|
+
function tn(r, s, t, e, n) {
|
|
3885
3885
|
function i(x, N, A, O) {
|
|
3886
3886
|
const U = gt$1(x + A, r), T = gt$1(N + x * A + O, s), z = gt$1(N * A + x * O, t);
|
|
3887
3887
|
return U + T + z;
|
|
@@ -3899,7 +3899,7 @@ function tn$1(r, s, t, e, n) {
|
|
|
3899
3899
|
d = a * c - 4 * g - 1 / 3 * u * u, w = (a * c + 8 * g - 2 / 9 * u * u) * (1 / 3) * u - c * c - a * a * g;
|
|
3900
3900
|
if (!isFinite(d) && isFinite(w))
|
|
3901
3901
|
return null;
|
|
3902
|
-
let P = en(d, w);
|
|
3902
|
+
let P = en$1(d, w);
|
|
3903
3903
|
n && (P *= p);
|
|
3904
3904
|
const f = r * 0.5, M = 1 / 6 * s + 0.5 * P, E = t - r * M, R = 2 / 3 * s - P - f * f, v = 0.5 * E / R, L = 2 * (e - M * M) / E, S = 0.5 * E / L;
|
|
3905
3905
|
let k = 0, D = 0, m = 0;
|
|
@@ -3947,7 +3947,7 @@ function tn$1(r, s, t, e, n) {
|
|
|
3947
3947
|
}
|
|
3948
3948
|
return [y, C, F, I];
|
|
3949
3949
|
}
|
|
3950
|
-
function en(r, s) {
|
|
3950
|
+
function en$1(r, s) {
|
|
3951
3951
|
const t = -0.3333333333333333 * r, e = 0.5 * s;
|
|
3952
3952
|
let n, i = null;
|
|
3953
3953
|
if ((Math.abs(t) >= 1e102 || Math.abs(e) >= 1e164) && (Math.abs(t) < Math.abs(e) ? i = 1 - t * (t / e) * (t / e) : i = Math.sign(t) * (e / t * (e / t) / t - 1)), i !== null && e == 0)
|
|
@@ -4002,9 +4002,9 @@ function rn$1(r) {
|
|
|
4002
4002
|
s.push([r[t], r[t + 1]]);
|
|
4003
4003
|
return s;
|
|
4004
4004
|
}
|
|
4005
|
-
function de(r, s) {
|
|
4005
|
+
function de$1(r, s) {
|
|
4006
4006
|
const t = rn$1(r).map(([e, n]) => nn$1(e, n, s));
|
|
4007
|
-
return r.length === 2 ? [t] : [...de(t, s), t];
|
|
4007
|
+
return r.length === 2 ? [t] : [...de$1(t, s), t];
|
|
4008
4008
|
}
|
|
4009
4009
|
let Et$1 = class Et extends xt$1 {
|
|
4010
4010
|
constructor(t, e, n, i) {
|
|
@@ -4026,7 +4026,7 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4026
4026
|
this.lastControlPoint[t],
|
|
4027
4027
|
this.lastPoint[t]
|
|
4028
4028
|
], l = -e + 3 * n - 3 * i + o, h = 2 * e - 4 * n + 2 * i, a = -e + n;
|
|
4029
|
-
return qt
|
|
4029
|
+
return qt(a, h, l).filter(
|
|
4030
4030
|
(u) => u >= -this.precision && u <= 1 + this.precision
|
|
4031
4031
|
);
|
|
4032
4032
|
}
|
|
@@ -4036,15 +4036,15 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4036
4036
|
);
|
|
4037
4037
|
}
|
|
4038
4038
|
get alignedCurve() {
|
|
4039
|
-
const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$2(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$
|
|
4039
|
+
const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$2(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$4();
|
|
4040
4040
|
return i.translate(t[0], t[1]), i.rotate(-n), this.transform(i);
|
|
4041
4041
|
}
|
|
4042
4042
|
getInflexionParameters() {
|
|
4043
4043
|
const t = this.alignedCurve, [e, n] = t.firstControlPoint, [i, o] = t.lastControlPoint, [l, h] = t.lastPoint, a = i * n, u = l * n, c = e * o, g = l * o, d = -3 * a + 2 * u + 3 * c - g, w = 3 * a - u - 3 * c, p = c - a;
|
|
4044
|
-
return qt
|
|
4044
|
+
return qt(p, w, d).filter((P) => P >= 0 && P <= 1);
|
|
4045
4045
|
}
|
|
4046
4046
|
get boundingBox() {
|
|
4047
|
-
return this._boundingBox === null && (this._boundingBox = ce([
|
|
4047
|
+
return this._boundingBox === null && (this._boundingBox = ce$1([
|
|
4048
4048
|
this.firstPoint,
|
|
4049
4049
|
...this.getParametersOfExtrema().map((t) => this.paramPoint(t)),
|
|
4050
4050
|
this.lastPoint
|
|
@@ -4067,13 +4067,13 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4067
4067
|
);
|
|
4068
4068
|
}
|
|
4069
4069
|
isSame(t) {
|
|
4070
|
-
return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$
|
|
4070
|
+
return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.firstControlPoint, t.firstControlPoint) && Y$2(this.lastControlPoint, t.lastControlPoint);
|
|
4071
4071
|
}
|
|
4072
4072
|
distanceFrom(t) {
|
|
4073
4073
|
const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
|
|
4074
4074
|
return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
|
|
4075
|
-
J$
|
|
4076
|
-
J$
|
|
4075
|
+
J$3(this.firstPoint, t),
|
|
4076
|
+
J$3(this.lastPoint, t)
|
|
4077
4077
|
) : Math.sqrt(n.fMin);
|
|
4078
4078
|
}
|
|
4079
4079
|
isOnSegment(t) {
|
|
@@ -4109,13 +4109,13 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4109
4109
|
}
|
|
4110
4110
|
normalAt(t) {
|
|
4111
4111
|
const e = this.tangentAt(t);
|
|
4112
|
-
return tt$
|
|
4112
|
+
return tt$3(e);
|
|
4113
4113
|
}
|
|
4114
4114
|
get normalAtFirstPoint() {
|
|
4115
|
-
return tt$
|
|
4115
|
+
return tt$3(this.tangentAtFirstPoint);
|
|
4116
4116
|
}
|
|
4117
4117
|
get normalAtLastPoint() {
|
|
4118
|
-
return tt$
|
|
4118
|
+
return tt$3(this.tangentAtLastPoint);
|
|
4119
4119
|
}
|
|
4120
4120
|
splitAtParameters(t, e = null) {
|
|
4121
4121
|
const n = [...t];
|
|
@@ -4132,7 +4132,7 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4132
4132
|
return [];
|
|
4133
4133
|
let h = !1;
|
|
4134
4134
|
o > 1 - this.precision && (h = !0);
|
|
4135
|
-
const a = (o - i.originalParam) / (1 - i.originalParam), u = de(
|
|
4135
|
+
const a = (o - i.originalParam) / (1 - i.originalParam), u = de$1(
|
|
4136
4136
|
[
|
|
4137
4137
|
i.p0,
|
|
4138
4138
|
i.p1,
|
|
@@ -4203,8 +4203,8 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4203
4203
|
return ze(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
|
|
4204
4204
|
}
|
|
4205
4205
|
pointToParam(t) {
|
|
4206
|
-
if (Y$
|
|
4207
|
-
if (Y$
|
|
4206
|
+
if (Y$2(t, this.firstPoint, this.precision)) return 0;
|
|
4207
|
+
if (Y$2(t, this.lastPoint, this.precision)) return 1;
|
|
4208
4208
|
const e = this.paramsAtY(t[1]);
|
|
4209
4209
|
if (e.length === 0)
|
|
4210
4210
|
throw new Error("Point is not on the curve");
|
|
@@ -4243,11 +4243,11 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4243
4243
|
this.center = n;
|
|
4244
4244
|
const c = i >= o;
|
|
4245
4245
|
this.majorRadius = c ? i : o, this.minorRadius = c ? o : i;
|
|
4246
|
-
const g = u === "deg" ? l * fe : l;
|
|
4246
|
+
const g = u === "deg" ? l * fe$1 : l;
|
|
4247
4247
|
if (this.tiltAngle = wt$2(
|
|
4248
4248
|
c ? g : g + Math.PI / 2
|
|
4249
4249
|
), this.clockwise = h, !a) {
|
|
4250
|
-
if (Y$
|
|
4250
|
+
if (Y$2(t, e))
|
|
4251
4251
|
throw new Error("Invalid arc, cannot be a full circle");
|
|
4252
4252
|
if (!this.isPointOnEllipse(t))
|
|
4253
4253
|
throw new Error(
|
|
@@ -4319,7 +4319,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4319
4319
|
this.lastPoint,
|
|
4320
4320
|
...t
|
|
4321
4321
|
];
|
|
4322
|
-
this._boundingBox = ce(e).grow(this.precision);
|
|
4322
|
+
this._boundingBox = ce$1(e).grow(this.precision);
|
|
4323
4323
|
}
|
|
4324
4324
|
return this._boundingBox;
|
|
4325
4325
|
}
|
|
@@ -4370,7 +4370,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4370
4370
|
return 1 - t >= -this.precision && t >= -this.precision;
|
|
4371
4371
|
}
|
|
4372
4372
|
isSame(t) {
|
|
4373
|
-
return Y$
|
|
4373
|
+
return Y$2(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$2(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$2(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
|
|
4374
4374
|
}
|
|
4375
4375
|
pointTheta(t) {
|
|
4376
4376
|
const e = this.ellipseReferenceFrameTransform.transform(t), n = Math.atan2(
|
|
@@ -4383,7 +4383,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4383
4383
|
return Zt(this.firstAngle, wt$2(t), this.clockwise) / this.deltaAngle;
|
|
4384
4384
|
}
|
|
4385
4385
|
isPointOnEllipse(t) {
|
|
4386
|
-
const [e, n] = this.focals, i = J$
|
|
4386
|
+
const [e, n] = this.focals, i = J$3(t, e), o = J$3(t, n);
|
|
4387
4387
|
return Math.abs(2 * this.majorRadius - i - o) < this.precision;
|
|
4388
4388
|
}
|
|
4389
4389
|
isOnSegment(t) {
|
|
@@ -4391,9 +4391,9 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4391
4391
|
}
|
|
4392
4392
|
distanceFrom(t) {
|
|
4393
4393
|
let e;
|
|
4394
|
-
if (Y$
|
|
4394
|
+
if (Y$2(t, this.center) ? e = it$3(
|
|
4395
4395
|
this.center,
|
|
4396
|
-
nt$2(tt$
|
|
4396
|
+
nt$2(tt$3(this.majorAxis), this.minorRadius)
|
|
4397
4397
|
) : e = this.reverseEllipseReferenceFrameTransform.transform(
|
|
4398
4398
|
ln$1(
|
|
4399
4399
|
this.majorRadius,
|
|
@@ -4401,27 +4401,27 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4401
4401
|
this.ellipseReferenceFrameTransform.transform(t)
|
|
4402
4402
|
)
|
|
4403
4403
|
), this.isValidParameter(this.thetaToParam(this.pointTheta(t))))
|
|
4404
|
-
return J$
|
|
4404
|
+
return J$3(t, e);
|
|
4405
4405
|
if (Qe(t, this.majorAxis, this.center)) {
|
|
4406
4406
|
const n = wt$2(
|
|
4407
4407
|
2 * Math.PI - this.pointTheta(t)
|
|
4408
4408
|
), i = this.thetaToParam(n);
|
|
4409
4409
|
if (this.isValidParameter(i))
|
|
4410
|
-
return J$
|
|
4410
|
+
return J$3(t, this.paramPoint(i));
|
|
4411
4411
|
}
|
|
4412
4412
|
return Math.min(
|
|
4413
|
-
J$
|
|
4414
|
-
J$
|
|
4413
|
+
J$3(t, this.firstPoint),
|
|
4414
|
+
J$3(t, this.lastPoint)
|
|
4415
4415
|
);
|
|
4416
4416
|
}
|
|
4417
4417
|
get ellipseReferenceFrameTransform() {
|
|
4418
|
-
return this._ellipseReferenceFrameTransform === void 0 && (this._ellipseReferenceFrameTransform = new et$
|
|
4418
|
+
return this._ellipseReferenceFrameTransform === void 0 && (this._ellipseReferenceFrameTransform = new et$4().translate(-this.center[0], -this.center[1]).rotate(-this.tiltAngle)), this._ellipseReferenceFrameTransform;
|
|
4419
4419
|
}
|
|
4420
4420
|
get reverseEllipseReferenceFrameTransform() {
|
|
4421
|
-
return this._reverseEllipseReferenceFrameTransform === void 0 && (this._reverseEllipseReferenceFrameTransform = new et$
|
|
4421
|
+
return this._reverseEllipseReferenceFrameTransform === void 0 && (this._reverseEllipseReferenceFrameTransform = new et$4().rotate(this.tiltAngle).translate(this.center[0], this.center[1])), this._reverseEllipseReferenceFrameTransform;
|
|
4422
4422
|
}
|
|
4423
4423
|
get rotateFromEllipseReferenceFrame() {
|
|
4424
|
-
return this._rotateFromEllipseReferenceFrame === void 0 && (this._rotateFromEllipseReferenceFrame = new et$
|
|
4424
|
+
return this._rotateFromEllipseReferenceFrame === void 0 && (this._rotateFromEllipseReferenceFrame = new et$4().rotate(
|
|
4425
4425
|
this.tiltAngle
|
|
4426
4426
|
)), this._rotateFromEllipseReferenceFrame;
|
|
4427
4427
|
}
|
|
@@ -4440,7 +4440,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
normalAt(t) {
|
|
4442
4442
|
const e = this.tangentAt(t);
|
|
4443
|
-
return this.clockwise ? tt$
|
|
4443
|
+
return this.clockwise ? tt$3(e) : Qt$1(e);
|
|
4444
4444
|
}
|
|
4445
4445
|
gradientAt(t) {
|
|
4446
4446
|
const e = this.firstAngle + t * this.deltaAngle * (this.clockwise ? -1 : 1), n = -this.majorRadius * this.deltaAngle * Math.sin(e), i = this.minorRadius * this.deltaAngle * Math.cos(e), o = this.clockwise ? [-n, -i] : [n, i];
|
|
@@ -4500,17 +4500,17 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4500
4500
|
});
|
|
4501
4501
|
}
|
|
4502
4502
|
};
|
|
4503
|
-
function pn$
|
|
4503
|
+
function pn$1(r, s, t, e, n, i, o) {
|
|
4504
4504
|
const { center: l, rx: h, ry: a } = on$1(
|
|
4505
4505
|
r,
|
|
4506
4506
|
s,
|
|
4507
4507
|
t,
|
|
4508
4508
|
e,
|
|
4509
|
-
n * fe,
|
|
4509
|
+
n * fe$1,
|
|
4510
4510
|
!i,
|
|
4511
4511
|
o
|
|
4512
4512
|
);
|
|
4513
|
-
return Math.abs(h - a) < 1e-9 ? new ct$
|
|
4513
|
+
return Math.abs(h - a) < 1e-9 ? new ct$3(r, s, l, o) : new jt$1(r, s, l, h, a, n, o);
|
|
4514
4514
|
}
|
|
4515
4515
|
function on$1([r, s], [t, e], n, i, o, l, h) {
|
|
4516
4516
|
if (n < 0 && (n = -n), i < 0 && (i = -i), n == 0 || i == 0)
|
|
@@ -4570,7 +4570,7 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4570
4570
|
);
|
|
4571
4571
|
}
|
|
4572
4572
|
get boundingBox() {
|
|
4573
|
-
return this._boundingBox === null && (this._boundingBox = ce([
|
|
4573
|
+
return this._boundingBox === null && (this._boundingBox = ce$1([
|
|
4574
4574
|
this.firstPoint,
|
|
4575
4575
|
// There is either one or zero extrema in each direction
|
|
4576
4576
|
...this.getParametersOfExtrema().map((t) => this.paramPoint(t)),
|
|
@@ -4592,13 +4592,13 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4592
4592
|
);
|
|
4593
4593
|
}
|
|
4594
4594
|
isSame(t) {
|
|
4595
|
-
return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$
|
|
4595
|
+
return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.controlPoint, t.controlPoint);
|
|
4596
4596
|
}
|
|
4597
4597
|
distanceFrom(t) {
|
|
4598
4598
|
const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
|
|
4599
4599
|
return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
|
|
4600
|
-
J$
|
|
4601
|
-
J$
|
|
4600
|
+
J$3(this.firstPoint, t),
|
|
4601
|
+
J$3(this.lastPoint, t)
|
|
4602
4602
|
) : Math.sqrt(n.fMin);
|
|
4603
4603
|
}
|
|
4604
4604
|
isOnSegment(t) {
|
|
@@ -4639,13 +4639,13 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4639
4639
|
}
|
|
4640
4640
|
normalAt(t) {
|
|
4641
4641
|
const e = this.tangentAt(t);
|
|
4642
|
-
return tt$
|
|
4642
|
+
return tt$3(e);
|
|
4643
4643
|
}
|
|
4644
4644
|
get normalAtFirstPoint() {
|
|
4645
|
-
return tt$
|
|
4645
|
+
return tt$3(this.tangentAtFirstPoint);
|
|
4646
4646
|
}
|
|
4647
4647
|
get normalAtLastPoint() {
|
|
4648
|
-
return tt$
|
|
4648
|
+
return tt$3(this.tangentAtLastPoint);
|
|
4649
4649
|
}
|
|
4650
4650
|
splitAtParameters(t, e = null) {
|
|
4651
4651
|
const n = [...t];
|
|
@@ -4661,7 +4661,7 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4661
4661
|
return [];
|
|
4662
4662
|
let h = !1;
|
|
4663
4663
|
o > 1 - this.precision && (h = !0);
|
|
4664
|
-
const a = (o - i.originalParam) / (1 - i.originalParam), u = de(
|
|
4664
|
+
const a = (o - i.originalParam) / (1 - i.originalParam), u = de$1(
|
|
4665
4665
|
[i.p0, i.p1, this.lastPoint],
|
|
4666
4666
|
h ? 1 : a
|
|
4667
4667
|
), c = h ? this.lastPoint : (e == null ? void 0 : e.get(o)) ?? u[0][0], g = u[1][0], d = u[1][1], w = new _t(
|
|
@@ -4720,7 +4720,7 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4720
4720
|
}
|
|
4721
4721
|
paramsAtY(t) {
|
|
4722
4722
|
const [e, n, i] = this.polynomialCoefficients[1];
|
|
4723
|
-
return qt
|
|
4723
|
+
return qt(e - t, n, i).filter(
|
|
4724
4724
|
(o) => o >= -this.precision && o <= 1 + this.precision
|
|
4725
4725
|
);
|
|
4726
4726
|
}
|
|
@@ -4735,33 +4735,33 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4735
4735
|
}
|
|
4736
4736
|
};
|
|
4737
4737
|
|
|
4738
|
-
var
|
|
4739
|
-
var
|
|
4740
|
-
var C = (t, n, e) =>
|
|
4741
|
-
function
|
|
4738
|
+
var nn = Object.defineProperty;
|
|
4739
|
+
var en = (t, n, e) => n in t ? nn(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
4740
|
+
var C = (t, n, e) => en(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4741
|
+
function dn$1(t, n) {
|
|
4742
4742
|
const e = Q$2(n, t.firstPoint), s = Pe(e, t.V) / t.squareLength;
|
|
4743
4743
|
return t.paramPoint(s);
|
|
4744
4744
|
}
|
|
4745
|
-
function
|
|
4746
|
-
const s = e || t.precision, i =
|
|
4745
|
+
function K$2(t, n, e) {
|
|
4746
|
+
const s = e || t.precision, i = dn$1(t, n.center), o = J$3(i, n.center);
|
|
4747
4747
|
if (o > n.radius + s) return [];
|
|
4748
4748
|
if (Math.abs(o - n.radius) < s) {
|
|
4749
|
-
const
|
|
4750
|
-
return t.isOnSegment(
|
|
4749
|
+
const c = i;
|
|
4750
|
+
return t.isOnSegment(c) && n.isOnSegment(c) ? [c] : [];
|
|
4751
4751
|
}
|
|
4752
|
-
const
|
|
4752
|
+
const l = [], r = Math.sqrt(
|
|
4753
4753
|
n.radius * n.radius - o * o
|
|
4754
|
-
),
|
|
4755
|
-
t.isOnSegment(a) && n.isOnSegment(a) &&
|
|
4756
|
-
const f = it$3(i, nt$2(
|
|
4757
|
-
return t.isOnSegment(f) && n.isOnSegment(f) &&
|
|
4754
|
+
), u = t.tangentAtFirstPoint, a = it$3(i, nt$2(u, r));
|
|
4755
|
+
t.isOnSegment(a) && n.isOnSegment(a) && l.push(a);
|
|
4756
|
+
const f = it$3(i, nt$2(u, -r));
|
|
4757
|
+
return t.isOnSegment(f) && n.isOnSegment(f) && l.push(f), l;
|
|
4758
4758
|
}
|
|
4759
|
-
const
|
|
4759
|
+
const mn$1 = (t) => {
|
|
4760
4760
|
const { firstPoint: n, lastPoint: e, center: s, clockwise: i } = t;
|
|
4761
|
-
return new ct$
|
|
4761
|
+
return new ct$3(e, n, s, i, {
|
|
4762
4762
|
ignoreChecks: !0
|
|
4763
4763
|
});
|
|
4764
|
-
},
|
|
4764
|
+
}, gn$1 = (t, n) => {
|
|
4765
4765
|
if (t.isSame(n))
|
|
4766
4766
|
return [t];
|
|
4767
4767
|
const e = Te(
|
|
@@ -4777,11 +4777,11 @@ const dn$1 = (t) => {
|
|
|
4777
4777
|
if (e.length === 0) return [];
|
|
4778
4778
|
if (e.length === 1) return [];
|
|
4779
4779
|
if (e.length === 2)
|
|
4780
|
-
return t.isSame(
|
|
4780
|
+
return t.isSame(mn$1(n)) ? [] : [new ct$3(e[0], e[1], t.center, t.clockwise)];
|
|
4781
4781
|
if (e.length === 3) {
|
|
4782
|
-
const s = Y$
|
|
4782
|
+
const s = Y$2(e[0], n.lastPoint) || Y$2(e[0], n.firstPoint) ? 1 : 0;
|
|
4783
4783
|
return [
|
|
4784
|
-
new ct$
|
|
4784
|
+
new ct$3(
|
|
4785
4785
|
e[0 + s],
|
|
4786
4786
|
e[1 + s],
|
|
4787
4787
|
t.center,
|
|
@@ -4790,106 +4790,106 @@ const dn$1 = (t) => {
|
|
|
4790
4790
|
];
|
|
4791
4791
|
} else if (e.length === 4)
|
|
4792
4792
|
return [
|
|
4793
|
-
new ct$
|
|
4794
|
-
new ct$
|
|
4793
|
+
new ct$3(e[0], e[1], t.center, t.clockwise),
|
|
4794
|
+
new ct$3(e[2], e[3], t.center, t.clockwise)
|
|
4795
4795
|
];
|
|
4796
4796
|
throw new Error("Bug in the arc arc overlap algorithm");
|
|
4797
4797
|
};
|
|
4798
|
-
function
|
|
4799
|
-
const i = s || t.precision, o = J$
|
|
4800
|
-
if (o >
|
|
4798
|
+
function Dt(t, n, e = !1, s) {
|
|
4799
|
+
const i = s || t.precision, o = J$3(t.center, n.center), l = t.radius + n.radius;
|
|
4800
|
+
if (o > l + i)
|
|
4801
4801
|
return [];
|
|
4802
|
-
const
|
|
4803
|
-
if (o <
|
|
4802
|
+
const r = Math.abs(t.radius - n.radius);
|
|
4803
|
+
if (o < r - i)
|
|
4804
4804
|
return [];
|
|
4805
4805
|
if (o < i)
|
|
4806
|
-
return
|
|
4807
|
-
const
|
|
4806
|
+
return r > i ? [] : e ? gn$1(t, n) : [];
|
|
4807
|
+
const u = H$1(Q$2(n.center, t.center)), a = o > l - i;
|
|
4808
4808
|
if (
|
|
4809
4809
|
// circles are outside each other
|
|
4810
4810
|
a || // circles are inside each other
|
|
4811
|
-
Math.abs(o -
|
|
4811
|
+
Math.abs(o - r) < i
|
|
4812
4812
|
) {
|
|
4813
|
-
const
|
|
4813
|
+
const g = a || t.radius > n.radius ? 1 : -1, w = it$3(
|
|
4814
4814
|
t.center,
|
|
4815
|
-
nt$2(
|
|
4815
|
+
nt$2(u, g * t.radius)
|
|
4816
4816
|
);
|
|
4817
|
-
return t.isOnSegment(
|
|
4817
|
+
return t.isOnSegment(w) && n.isOnSegment(w) ? [w] : [];
|
|
4818
4818
|
}
|
|
4819
|
-
const f = t.radius * t.radius / (2 * o) - n.radius * n.radius / (2 * o) + o / 2,
|
|
4819
|
+
const f = t.radius * t.radius / (2 * o) - n.radius * n.radius / (2 * o) + o / 2, c = it$3(
|
|
4820
4820
|
t.center,
|
|
4821
|
-
nt$2(
|
|
4821
|
+
nt$2(u, f)
|
|
4822
4822
|
), h = Math.sqrt(
|
|
4823
4823
|
t.radius * t.radius - f * f
|
|
4824
|
-
), p = tt$
|
|
4825
|
-
return t.isOnSegment(d) && n.isOnSegment(d) &&
|
|
4824
|
+
), p = tt$3(u), d = it$3(c, nt$2(p, h)), m = it$3(c, nt$2(p, -h)), x = [];
|
|
4825
|
+
return t.isOnSegment(d) && n.isOnSegment(d) && x.push(d), t.isOnSegment(m) && n.isOnSegment(m) && x.push(m), x;
|
|
4826
4826
|
}
|
|
4827
|
-
function
|
|
4828
|
-
const s = t.transform(n.ellipseReferenceFrameTransform), i = s.slope, o = s.yIntercept,
|
|
4829
|
-
(
|
|
4830
|
-
).filter((
|
|
4827
|
+
function st$2(t, n, e = 1e-9) {
|
|
4828
|
+
const s = t.transform(n.ellipseReferenceFrameTransform), i = s.slope, o = s.yIntercept, l = n.majorRadius * n.majorRadius, r = n.minorRadius * n.minorRadius, u = n.majorRadius * n.minorRadius, a = s.slope * s.slope, f = s.yIntercept * s.yIntercept, c = (g) => g.map(
|
|
4829
|
+
(w) => n.reverseEllipseReferenceFrameTransform.transform(w)
|
|
4830
|
+
).filter((w) => t.isOnSegment(w) && n.isOnSegment(w));
|
|
4831
4831
|
if (!Number.isFinite(i)) {
|
|
4832
|
-
const
|
|
4833
|
-
if (Math.abs(
|
|
4834
|
-
if (Math.abs(Math.abs(
|
|
4835
|
-
return
|
|
4836
|
-
const
|
|
4837
|
-
return
|
|
4838
|
-
}
|
|
4839
|
-
const h =
|
|
4832
|
+
const g = s.firstPoint[0];
|
|
4833
|
+
if (Math.abs(g) - n.majorRadius > e) return [];
|
|
4834
|
+
if (Math.abs(Math.abs(g) - n.majorRadius) < e)
|
|
4835
|
+
return c([[g, 0]]);
|
|
4836
|
+
const w = n.minorRadius * Math.sqrt(1 - g * g / l), F = [g, w], y = [g, -w];
|
|
4837
|
+
return c([F, y]);
|
|
4838
|
+
}
|
|
4839
|
+
const h = l * a + r - f;
|
|
4840
4840
|
if (h < -e)
|
|
4841
4841
|
return [];
|
|
4842
|
-
const p =
|
|
4842
|
+
const p = l * a + r;
|
|
4843
4843
|
if (Math.abs(h) < e) {
|
|
4844
|
-
const
|
|
4845
|
-
return
|
|
4844
|
+
const g = -(l * i * o) / p, w = r * o / p;
|
|
4845
|
+
return c([[g, w]]);
|
|
4846
4846
|
}
|
|
4847
4847
|
const d = Math.sqrt(h), m = [
|
|
4848
|
-
-(
|
|
4849
|
-
(
|
|
4850
|
-
],
|
|
4851
|
-
-(
|
|
4852
|
-
(
|
|
4848
|
+
-(l * i * o + u * d) / p,
|
|
4849
|
+
(r * o - u * i * d) / p
|
|
4850
|
+
], x = [
|
|
4851
|
+
-(l * i * o - u * d) / p,
|
|
4852
|
+
(r * o + u * i * d) / p
|
|
4853
4853
|
];
|
|
4854
|
-
return
|
|
4855
|
-
}
|
|
4856
|
-
function
|
|
4857
|
-
const e = Math.max(t.precision, n.precision), s = t.coefficients, i = s.x2, o = s.xy,
|
|
4858
|
-
z0: a * i * d * d + i * i *
|
|
4859
|
-
z1: m *
|
|
4860
|
-
z2: m * m * i * i + 2 * p *
|
|
4861
|
-
z3: -2 * i *
|
|
4862
|
-
z4: i * i * p * p - 2 * i * p *
|
|
4854
|
+
return c([m, x]);
|
|
4855
|
+
}
|
|
4856
|
+
function Rt(t, n) {
|
|
4857
|
+
const e = Math.max(t.precision, n.precision), s = t.coefficients, i = s.x2, o = s.xy, l = s.y2, r = s.x, u = s.y, a = s.c, f = n.coefficients, c = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, x = f.c, g = {
|
|
4858
|
+
z0: a * i * d * d + i * i * x * x - r * i * d * x + c * c * a * a - 2 * i * x * c * a - r * d * c * a + c * r * r * x,
|
|
4859
|
+
z1: m * r * r * c - x * d * i * o - 2 * i * x * c * u - a * c * h * r + 2 * d * h * i * a + 2 * m * x * i * i + d * d * i * u - m * d * i * r - 2 * i * m * c * a - a * c * d * o + 2 * a * u * c * c - x * h * i * r - u * c * d * r + 2 * x * o * c * r,
|
|
4860
|
+
z2: m * m * i * i + 2 * p * x * i * i - u * c * d * o + x * c * o * o - u * c * h * r - x * h * i * o - 2 * i * m * c * u + 2 * d * h * i * u - p * d * i * r - 2 * i * p * c * a + h * h * i * a + 2 * m * o * c * r + u * u * c * c - l * c * d * r - m * h * i * r + 2 * a * l * c * c - a * c * h * o + p * r * r * c + d * d * i * l - m * d * i * o - 2 * i * x * c * l,
|
|
4861
|
+
z3: -2 * i * c * l * m + m * c * o * o + 2 * p * o * c * r - l * c * h * r + h * h * i * u - m * h * i * o - 2 * i * p * c * u - u * c * h * o - p * h * i * r + 2 * m * p * i * i + 2 * u * l * c * c - l * c * d * o + 2 * d * h * i * l - p * d * i * o,
|
|
4862
|
+
z4: i * i * p * p - 2 * i * p * c * l + c * c * l * l - o * i * h * p - o * h * c * l + o * o * c * p + l * i * h * h
|
|
4863
4863
|
}, F = sn$1(
|
|
4864
|
-
[
|
|
4864
|
+
[g.z0, g.z1, g.z2, g.z3, g.z4],
|
|
4865
4865
|
e
|
|
4866
|
-
).flatMap((
|
|
4867
|
-
const R = i * h *
|
|
4866
|
+
).flatMap((y) => {
|
|
4867
|
+
const R = i * h * y + i * d - c * o * y - c * r;
|
|
4868
4868
|
if (R)
|
|
4869
|
-
return [[-(i *
|
|
4870
|
-
const T = o *
|
|
4871
|
-
if (Math.abs(
|
|
4872
|
-
return [[L,
|
|
4873
|
-
if (
|
|
4874
|
-
const H = Math.sqrt(
|
|
4875
|
-
return [[L + H,
|
|
4869
|
+
return [[-(i * x + i * p * y * y - c * l * y * y + i * m * y - c * u * y - c * a) / R, y]];
|
|
4870
|
+
const T = o * y + r, L = -T / (2 * i), j = l * y * y + u * y + a, q = T * T / (4 * i * i) - j / i;
|
|
4871
|
+
if (Math.abs(q) < e)
|
|
4872
|
+
return [[L, y]];
|
|
4873
|
+
if (q > 0) {
|
|
4874
|
+
const H = Math.sqrt(q);
|
|
4875
|
+
return [[L + H, y], [L - H, y]];
|
|
4876
4876
|
}
|
|
4877
4877
|
return [];
|
|
4878
4878
|
});
|
|
4879
4879
|
return Te(F, e);
|
|
4880
4880
|
}
|
|
4881
|
-
function
|
|
4882
|
-
return
|
|
4881
|
+
function gt(t, n) {
|
|
4882
|
+
return Rt(t, n).filter((s) => t.isOnSegment(s) && n.isOnSegment(s));
|
|
4883
4883
|
}
|
|
4884
|
-
const
|
|
4884
|
+
const Pn$1 = (t) => {
|
|
4885
4885
|
const {
|
|
4886
4886
|
firstPoint: n,
|
|
4887
4887
|
lastPoint: e,
|
|
4888
4888
|
center: s,
|
|
4889
4889
|
majorRadius: i,
|
|
4890
4890
|
minorRadius: o,
|
|
4891
|
-
tiltAngle:
|
|
4892
|
-
clockwise:
|
|
4891
|
+
tiltAngle: l,
|
|
4892
|
+
clockwise: r
|
|
4893
4893
|
} = t;
|
|
4894
4894
|
return new jt$1(
|
|
4895
4895
|
e,
|
|
@@ -4897,14 +4897,14 @@ const gn$1 = (t) => {
|
|
|
4897
4897
|
s,
|
|
4898
4898
|
i,
|
|
4899
4899
|
o,
|
|
4900
|
-
r,
|
|
4901
4900
|
l,
|
|
4901
|
+
r,
|
|
4902
4902
|
{
|
|
4903
4903
|
ignoreChecks: !0,
|
|
4904
4904
|
angleUnits: "rad"
|
|
4905
4905
|
}
|
|
4906
4906
|
);
|
|
4907
|
-
},
|
|
4907
|
+
}, wn$1 = (t, n) => {
|
|
4908
4908
|
if (t.isSame(n))
|
|
4909
4909
|
return [t];
|
|
4910
4910
|
const e = (i, o) => new jt$1(
|
|
@@ -4929,52 +4929,52 @@ const gn$1 = (t) => {
|
|
|
4929
4929
|
if (s.length === 0) return [];
|
|
4930
4930
|
if (s.length === 1) return [];
|
|
4931
4931
|
if (s.length === 2)
|
|
4932
|
-
return t.isSame(
|
|
4932
|
+
return t.isSame(Pn$1(n)) ? [] : [e(s[0], s[1])];
|
|
4933
4933
|
if (s.length === 3) {
|
|
4934
|
-
const i = Y$
|
|
4934
|
+
const i = Y$2(s[0], n.lastPoint) || Y$2(s[0], n.firstPoint) ? 1 : 0;
|
|
4935
4935
|
return [e(s[0 + i], s[1 + i])];
|
|
4936
4936
|
} else if (s.length === 4)
|
|
4937
4937
|
return [e(s[0], s[1]), e(s[2], s[3])];
|
|
4938
4938
|
throw new Error("Bug in the ellipse arc ellipse arc overlap algorithm");
|
|
4939
4939
|
};
|
|
4940
|
-
function
|
|
4940
|
+
function xn$1(t, n, e = !1) {
|
|
4941
4941
|
const s = Math.max(t.precision, n.precision);
|
|
4942
|
-
return Y$
|
|
4942
|
+
return Y$2(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? wn$1(t, n) : [] : Rt(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
|
|
4943
4943
|
}
|
|
4944
|
-
function
|
|
4945
|
-
const [e, s] = t.firstPoint, [i, o] = t.lastPoint,
|
|
4946
|
-
return
|
|
4944
|
+
function Pt$1(t, n) {
|
|
4945
|
+
const [e, s] = t.firstPoint, [i, o] = t.lastPoint, l = new et$4().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), r = l.clone().inverse(), u = n.transform(l);
|
|
4946
|
+
return u.paramsAtY(0).map((a) => u.paramPoint(a)).map((a) => r.transform(a)).filter((a) => t.isOnSegment(a));
|
|
4947
4947
|
}
|
|
4948
|
-
const
|
|
4948
|
+
const Sn$1 = (t, n = 1e-9) => {
|
|
4949
4949
|
let e = t;
|
|
4950
4950
|
return Math.abs(t) < n && (e = 0), e.toFixed(-Math.log10(n));
|
|
4951
4951
|
};
|
|
4952
|
-
function
|
|
4952
|
+
function Vt(t, n = 1e-9) {
|
|
4953
4953
|
return Array.from(
|
|
4954
|
-
new Map(t.map((e) => [
|
|
4954
|
+
new Map(t.map((e) => [Sn$1(e, n), e])).values()
|
|
4955
4955
|
);
|
|
4956
4956
|
}
|
|
4957
|
-
const Sn$1 = (t, n) => {
|
|
4958
|
-
const [[e, s, i, o], [r, l, c, a]] = n.polynomialCoefficients, f = t.coefficients, u = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, P = f.c, w = e * e, x = s * s, F = i * i, b = o * o, R = r * r, T = l * l, L = c * c, j = a * a, z = P + d * e + u * w + m * r + h * e * r + p * R, H = d * s + 2 * u * e * s + h * s * r + m * l + h * e * l + 2 * p * r * l, Qt = u * x + d * i + 2 * u * e * i + h * i * r + h * s * l + p * T + m * c + h * e * c + 2 * p * r * c, Wt = 2 * u * s * i + d * o + 2 * u * e * o + h * o * r + h * i * l + h * s * c + 2 * p * l * c + m * a + h * e * a + 2 * p * r * a, Jt = u * F + 2 * u * s * o + h * o * l + h * i * c + p * L + h * s * a + 2 * p * l * a, Kt = 2 * u * i * o + h * o * c + h * i * a + 2 * p * c * a, Zt = u * b + h * o * a + p * j;
|
|
4959
|
-
return [z, H, Qt, Wt, Jt, Kt, Zt];
|
|
4960
|
-
};
|
|
4961
|
-
function Pt$1(t, n) {
|
|
4962
|
-
const e = Math.max(t.precision, n.precision), s = Sn$1(t, n), i = sn$1(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
|
|
4963
|
-
return Rt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
|
|
4964
|
-
}
|
|
4965
4957
|
const yn$1 = (t, n) => {
|
|
4966
|
-
const [[e, s, i], [
|
|
4967
|
-
return [
|
|
4958
|
+
const [[e, s, i, o], [l, r, u, a]] = n.polynomialCoefficients, f = t.coefficients, c = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, x = f.c, g = e * e, w = s * s, F = i * i, y = o * o, R = l * l, T = r * r, L = u * u, j = a * a, q = x + d * e + c * g + m * l + h * e * l + p * R, H = d * s + 2 * c * e * s + h * s * l + m * r + h * e * r + 2 * p * l * r, Wt = c * w + d * i + 2 * c * e * i + h * i * l + h * s * r + p * T + m * u + h * e * u + 2 * p * l * u, Jt = 2 * c * s * i + d * o + 2 * c * e * o + h * o * l + h * i * r + h * s * u + 2 * p * r * u + m * a + h * e * a + 2 * p * l * a, Kt = c * F + 2 * c * s * o + h * o * r + h * i * u + p * L + h * s * a + 2 * p * r * a, Zt = 2 * c * i * o + h * o * u + h * i * a + 2 * p * u * a, tn = c * y + h * o * a + p * j;
|
|
4959
|
+
return [q, H, Wt, Jt, Kt, Zt, tn];
|
|
4968
4960
|
};
|
|
4969
4961
|
function wt$1(t, n) {
|
|
4970
|
-
const e = Math.max(t.precision, n.precision), s = yn$1(t, n), i =
|
|
4971
|
-
return
|
|
4962
|
+
const e = Math.max(t.precision, n.precision), s = yn$1(t, n), i = sn$1(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
|
|
4963
|
+
return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
|
|
4964
|
+
}
|
|
4965
|
+
const bn$1 = (t, n) => {
|
|
4966
|
+
const [[e, s, i], [o, l, r]] = n.polynomialCoefficients, u = t.coefficients, a = u.x2, f = u.xy, c = u.y2, h = u.x, p = u.y, d = u.c, m = e * e, x = s * s, g = i * i, w = o * o, F = l * l, y = r * r, R = a * m + f * e * o + c * w + h * e + p * o + d, T = 2 * a * e * s + f * e * l + f * s * o + 2 * c * o * l + h * s + p * l, L = 2 * a * e * i + a * x + f * e * r + f * s * l + f * i * o + 2 * c * o * r + c * F + h * i + p * r, j = 2 * a * s * i + f * s * r + f * i * l + 2 * c * l * r, q = a * g + f * i * r + c * y;
|
|
4967
|
+
return [R, T, L, j, q];
|
|
4968
|
+
};
|
|
4969
|
+
function xt(t, n) {
|
|
4970
|
+
const e = Math.max(t.precision, n.precision), s = bn$1(t, n), i = wn$2(...s).filter((o) => o >= -n.precision && o <= 1 + n.precision);
|
|
4971
|
+
return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
|
|
4972
4972
|
}
|
|
4973
4973
|
function E(t, { firstPoint: n, lastPoint: e }, s = 1e-9) {
|
|
4974
4974
|
const i = Q$2(e, n);
|
|
4975
4975
|
return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$2(i, Q$2(t, n)) / an$1(i);
|
|
4976
4976
|
}
|
|
4977
|
-
let ct$
|
|
4977
|
+
let ct$2 = class ct {
|
|
4978
4978
|
constructor(n, e, s, i) {
|
|
4979
4979
|
this.firstPoint = n, this.lastPoint = e, this.negativeThickness = s, this.positiveThickness = i;
|
|
4980
4980
|
}
|
|
@@ -4982,10 +4982,10 @@ let ct$1 = class ct {
|
|
|
4982
4982
|
return this.positiveThickness - this.negativeThickness;
|
|
4983
4983
|
}
|
|
4984
4984
|
};
|
|
4985
|
-
const
|
|
4986
|
-
function
|
|
4987
|
-
const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ?
|
|
4988
|
-
return new ct$
|
|
4985
|
+
const Cn$1 = 3 / 4, Mn$1 = 4 / 9;
|
|
4986
|
+
function In$1(t) {
|
|
4987
|
+
const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? Cn$1 : Mn$1;
|
|
4988
|
+
return new ct$2(
|
|
4989
4989
|
t.firstPoint,
|
|
4990
4990
|
t.lastPoint,
|
|
4991
4991
|
s * Math.min(0, n, e),
|
|
@@ -4994,22 +4994,22 @@ function Mn$1(t) {
|
|
|
4994
4994
|
}
|
|
4995
4995
|
function An$1(t) {
|
|
4996
4996
|
const n = E(t.controlPoint, t);
|
|
4997
|
-
return new ct$
|
|
4997
|
+
return new ct$2(
|
|
4998
4998
|
t.firstPoint,
|
|
4999
4999
|
t.lastPoint,
|
|
5000
5000
|
Math.min(0, n / 2),
|
|
5001
5001
|
Math.max(0, n / 2)
|
|
5002
5002
|
);
|
|
5003
5003
|
}
|
|
5004
|
-
function
|
|
5004
|
+
function En(t) {
|
|
5005
5005
|
if (t instanceof Et$1)
|
|
5006
|
-
return
|
|
5006
|
+
return In$1(t);
|
|
5007
5007
|
if (t instanceof _t$1)
|
|
5008
5008
|
return An$1(t);
|
|
5009
5009
|
throw new Error("Not implemented");
|
|
5010
5010
|
}
|
|
5011
|
-
function
|
|
5012
|
-
const n = t.paramPoint(0.5), e = tt$
|
|
5011
|
+
function Fn(t) {
|
|
5012
|
+
const n = t.paramPoint(0.5), e = tt$3(Q$2(n, t.firstPoint)), s = it$3(n, e), i = {
|
|
5013
5013
|
firstPoint: n,
|
|
5014
5014
|
lastPoint: s
|
|
5015
5015
|
}, o = [
|
|
@@ -5019,14 +5019,14 @@ function En(t) {
|
|
|
5019
5019
|
return t instanceof Et$1 ? o.push(
|
|
5020
5020
|
E(t.firstControlPoint, i),
|
|
5021
5021
|
E(t.lastControlPoint, i)
|
|
5022
|
-
) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct$
|
|
5022
|
+
) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct$2(
|
|
5023
5023
|
n,
|
|
5024
5024
|
s,
|
|
5025
5025
|
Math.min(...o),
|
|
5026
5026
|
Math.max(...o)
|
|
5027
5027
|
);
|
|
5028
5028
|
}
|
|
5029
|
-
function
|
|
5029
|
+
function St$1(t, n) {
|
|
5030
5030
|
const e = [];
|
|
5031
5031
|
for (let s = 1; s < t.length; s++) {
|
|
5032
5032
|
const i = t[s];
|
|
@@ -5034,8 +5034,8 @@ function xt(t, n) {
|
|
|
5034
5034
|
e.push(i[0]);
|
|
5035
5035
|
continue;
|
|
5036
5036
|
}
|
|
5037
|
-
const o = t[s - 1],
|
|
5038
|
-
if (
|
|
5037
|
+
const o = t[s - 1], l = n - o[1], r = n - i[1];
|
|
5038
|
+
if (l * r < 0) {
|
|
5039
5039
|
e.push(
|
|
5040
5040
|
o[0] + (n - o[1]) * (i[0] - o[0]) / (i[1] - o[1])
|
|
5041
5041
|
);
|
|
@@ -5044,7 +5044,7 @@ function xt(t, n) {
|
|
|
5044
5044
|
}
|
|
5045
5045
|
return e;
|
|
5046
5046
|
}
|
|
5047
|
-
class Y {
|
|
5047
|
+
let Y$1 = class Y {
|
|
5048
5048
|
constructor(n, e) {
|
|
5049
5049
|
this.from = n, this.to = e;
|
|
5050
5050
|
}
|
|
@@ -5054,30 +5054,30 @@ class Y {
|
|
|
5054
5054
|
clipCurve(n) {
|
|
5055
5055
|
return this.from === "start" ? this.to === "end" ? n : n.splitAtParameters([this.to])[0] : this.to === "end" ? n.splitAtParameters([this.from])[1] : n.splitAtParameters([this.from, this.to])[1];
|
|
5056
5056
|
}
|
|
5057
|
-
}
|
|
5058
|
-
function
|
|
5057
|
+
};
|
|
5058
|
+
function vn(t, n) {
|
|
5059
5059
|
if (t instanceof Et$1)
|
|
5060
|
-
return new
|
|
5060
|
+
return new kn([
|
|
5061
5061
|
E(t.firstPoint, n),
|
|
5062
5062
|
E(t.firstControlPoint, n),
|
|
5063
5063
|
E(t.lastControlPoint, n),
|
|
5064
5064
|
E(t.lastPoint, n)
|
|
5065
5065
|
]);
|
|
5066
5066
|
if (t instanceof _t$1)
|
|
5067
|
-
return new
|
|
5067
|
+
return new Bn$1([
|
|
5068
5068
|
E(t.firstPoint, n),
|
|
5069
5069
|
E(t.controlPoint, n),
|
|
5070
5070
|
E(t.lastPoint, n)
|
|
5071
5071
|
]);
|
|
5072
5072
|
throw new Error("Not implemented");
|
|
5073
5073
|
}
|
|
5074
|
-
class
|
|
5074
|
+
let Bn$1 = class Bn {
|
|
5075
5075
|
constructor(n) {
|
|
5076
5076
|
C(this, "topHull", []);
|
|
5077
5077
|
C(this, "bottomHull", []);
|
|
5078
5078
|
this.distances = n;
|
|
5079
|
-
const [e, s, i] = n, o = [0, e],
|
|
5080
|
-
s - (
|
|
5079
|
+
const [e, s, i] = n, o = [0, e], l = [1 / 2, s], r = [1, i], u = i - e, a = e;
|
|
5080
|
+
s - (u * (1 / 2) + a) > 0 ? (this.topHull = [o, l, r], this.bottomHull = [o, r]) : (this.topHull = [o, r], this.bottomHull = [o, l, r]);
|
|
5081
5081
|
}
|
|
5082
5082
|
get startDistance() {
|
|
5083
5083
|
return this.distances[0];
|
|
@@ -5085,19 +5085,19 @@ class vn {
|
|
|
5085
5085
|
get endDistance() {
|
|
5086
5086
|
return this.distances[2];
|
|
5087
5087
|
}
|
|
5088
|
-
}
|
|
5089
|
-
|
|
5088
|
+
};
|
|
5089
|
+
class kn {
|
|
5090
5090
|
constructor(n) {
|
|
5091
5091
|
C(this, "topHull", []);
|
|
5092
5092
|
C(this, "bottomHull", []);
|
|
5093
5093
|
this.distances = n;
|
|
5094
|
-
const [e, s, i, o] = n,
|
|
5094
|
+
const [e, s, i, o] = n, l = [0, e], r = [1 / 3, s], u = [2 / 3, i], a = [1, o], f = o - e, c = e, h = s - (f * (1 / 3) + c), p = i - (f * (2 / 3) + c);
|
|
5095
5095
|
let d = null, m = null;
|
|
5096
5096
|
if (h * p < 0)
|
|
5097
|
-
d = [
|
|
5097
|
+
d = [l, r, a], m = [l, u, a];
|
|
5098
5098
|
else {
|
|
5099
|
-
const
|
|
5100
|
-
|
|
5099
|
+
const g = h / p;
|
|
5100
|
+
g >= 2 ? (d = [l, r, a], m = [l, a]) : g <= 0.5 ? (d = [l, u, a], m = [l, a]) : (d = [l, r, u, a], m = [l, a]);
|
|
5101
5101
|
}
|
|
5102
5102
|
h < 0 && ([d, m] = [m, d]), this.topHull = d, this.bottomHull = m;
|
|
5103
5103
|
}
|
|
@@ -5107,65 +5107,65 @@ let Bn$1 = class Bn {
|
|
|
5107
5107
|
get endDistance() {
|
|
5108
5108
|
return this.distances[3];
|
|
5109
5109
|
}
|
|
5110
|
-
}
|
|
5111
|
-
function
|
|
5112
|
-
const e =
|
|
5110
|
+
}
|
|
5111
|
+
function yt$1(t, n) {
|
|
5112
|
+
const e = vn(n, t), s = St$1(
|
|
5113
5113
|
e.topHull,
|
|
5114
5114
|
t.negativeThickness
|
|
5115
|
-
), i =
|
|
5115
|
+
), i = St$1(
|
|
5116
5116
|
e.bottomHull,
|
|
5117
5117
|
t.positiveThickness
|
|
5118
5118
|
), o = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
|
|
5119
5119
|
if (!s.length && !i.length)
|
|
5120
|
-
return o ? new Y("start", "end") : null;
|
|
5120
|
+
return o ? new Y$1("start", "end") : null;
|
|
5121
5121
|
if (s.length === 1 && i.length === 1)
|
|
5122
|
-
return new Y(s[0], i[0]);
|
|
5122
|
+
return new Y$1(s[0], i[0]);
|
|
5123
5123
|
if (s.length === 2 && i.length === 2)
|
|
5124
5124
|
throw new Error(
|
|
5125
5125
|
"Bug in the clipping algorithm, unexpected number of crossing points"
|
|
5126
5126
|
);
|
|
5127
|
-
const
|
|
5128
|
-
return
|
|
5127
|
+
const l = s.length ? s : i;
|
|
5128
|
+
return l.length === 2 ? new Y$1(l[0], l[1]) : o ? new Y$1(l[0], "end") : new Y$1("start", l[0]);
|
|
5129
5129
|
}
|
|
5130
|
-
function
|
|
5131
|
-
const e =
|
|
5130
|
+
function bt$1(t, n) {
|
|
5131
|
+
const e = En(t), s = yt$1(e, n);
|
|
5132
5132
|
if (!s)
|
|
5133
5133
|
return null;
|
|
5134
|
-
const i =
|
|
5134
|
+
const i = Fn(t), o = yt$1(
|
|
5135
5135
|
i,
|
|
5136
5136
|
n
|
|
5137
5137
|
);
|
|
5138
5138
|
return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
|
|
5139
5139
|
}
|
|
5140
|
-
const W$
|
|
5141
|
-
function D
|
|
5140
|
+
const W$3 = (t) => t instanceof _t$1 ? It$2(Q$2(t.controlPoint, t.firstPoint)) + It$2(Q$2(t.controlPoint, t.lastPoint)) : It$2(Q$2(t.firstControlPoint, t.firstPoint)) + It$2(Q$2(t.lastControlPoint, t.firstControlPoint)) + It$2(Q$2(t.lastControlPoint, t.lastPoint));
|
|
5141
|
+
function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
|
|
5142
5142
|
const i = Math.max(e * e, Number.EPSILON * 10);
|
|
5143
|
-
let o = t,
|
|
5143
|
+
let o = t, l = n, r = W$3(o), u = W$3(l);
|
|
5144
5144
|
for (let a = 0; a < s; a++) {
|
|
5145
|
-
const f =
|
|
5145
|
+
const f = r > i ? bt$1(l, o) : o;
|
|
5146
5146
|
if (!f) return [];
|
|
5147
|
-
const
|
|
5147
|
+
const c = W$3(f), h = u > i ? bt$1(f, l) : l;
|
|
5148
5148
|
if (!h) return [];
|
|
5149
|
-
const p = W$
|
|
5150
|
-
if (
|
|
5149
|
+
const p = W$3(h);
|
|
5150
|
+
if (c <= i && p <= i)
|
|
5151
5151
|
return [
|
|
5152
5152
|
f.boundingBox.intersection(h.boundingBox).center
|
|
5153
5153
|
];
|
|
5154
|
-
if (Y$
|
|
5154
|
+
if (Y$2(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
|
|
5155
5155
|
return [f.firstPoint];
|
|
5156
|
-
if (Y$
|
|
5156
|
+
if (Y$2(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
|
|
5157
5157
|
return [h.firstPoint];
|
|
5158
|
-
if (
|
|
5159
|
-
if (
|
|
5158
|
+
if (c > 0.8 * r && p > 0.8 * u)
|
|
5159
|
+
if (c / r > p / u) {
|
|
5160
5160
|
const [d, m] = f.splitAtParameters([
|
|
5161
5161
|
0.5
|
|
5162
5162
|
]);
|
|
5163
5163
|
return Te(
|
|
5164
5164
|
[
|
|
5165
|
-
...D
|
|
5165
|
+
...D(d, h, e, {
|
|
5166
5166
|
maxIterations: s - a
|
|
5167
5167
|
}),
|
|
5168
|
-
...D
|
|
5168
|
+
...D(m, h, e, {
|
|
5169
5169
|
maxIterations: s - a
|
|
5170
5170
|
})
|
|
5171
5171
|
],
|
|
@@ -5177,21 +5177,21 @@ function D$1(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
|
|
|
5177
5177
|
]);
|
|
5178
5178
|
return Te(
|
|
5179
5179
|
[
|
|
5180
|
-
...D
|
|
5180
|
+
...D(f, d, e, {
|
|
5181
5181
|
maxIterations: s - a
|
|
5182
5182
|
}),
|
|
5183
|
-
...D
|
|
5183
|
+
...D(f, m, e, {
|
|
5184
5184
|
maxIterations: s - a
|
|
5185
5185
|
})
|
|
5186
5186
|
],
|
|
5187
5187
|
e
|
|
5188
5188
|
);
|
|
5189
5189
|
}
|
|
5190
|
-
o = f,
|
|
5190
|
+
o = f, l = h, r = c, u = p;
|
|
5191
5191
|
}
|
|
5192
5192
|
throw new Error("Bézier clip: Maximum number of iterations reached");
|
|
5193
5193
|
}
|
|
5194
|
-
function
|
|
5194
|
+
function On$1(t, n) {
|
|
5195
5195
|
const e = [];
|
|
5196
5196
|
if ([
|
|
5197
5197
|
[t.firstPoint, n],
|
|
@@ -5205,20 +5205,20 @@ function kn(t, n) {
|
|
|
5205
5205
|
if (e.length === 2)
|
|
5206
5206
|
return [t.splitAt(e)[1]];
|
|
5207
5207
|
if (e.length === 3)
|
|
5208
|
-
return Y$
|
|
5208
|
+
return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
|
|
5209
5209
|
if (e.length === 4)
|
|
5210
5210
|
return [t];
|
|
5211
5211
|
}
|
|
5212
5212
|
function _n(t, n, e = !1) {
|
|
5213
5213
|
const s = Math.max(t.precision, n.precision);
|
|
5214
5214
|
if (e) {
|
|
5215
|
-
const i =
|
|
5215
|
+
const i = On$1(t, n);
|
|
5216
5216
|
if (i)
|
|
5217
5217
|
return i;
|
|
5218
5218
|
}
|
|
5219
|
-
return D
|
|
5219
|
+
return D(t, n, s);
|
|
5220
5220
|
}
|
|
5221
|
-
function
|
|
5221
|
+
function Tn$1(t, n) {
|
|
5222
5222
|
const e = [];
|
|
5223
5223
|
if ([
|
|
5224
5224
|
[t.firstPoint, n],
|
|
@@ -5232,21 +5232,21 @@ function On$1(t, n) {
|
|
|
5232
5232
|
if (e.length === 2)
|
|
5233
5233
|
return [t.splitAt(e)[1]];
|
|
5234
5234
|
if (e.length === 3)
|
|
5235
|
-
return Y$
|
|
5235
|
+
return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
|
|
5236
5236
|
if (e.length === 4)
|
|
5237
5237
|
return [t];
|
|
5238
5238
|
}
|
|
5239
|
-
function
|
|
5239
|
+
function Ln(t, n, e = !1) {
|
|
5240
5240
|
const s = Math.max(t.precision, n.precision);
|
|
5241
5241
|
if (e) {
|
|
5242
|
-
const i =
|
|
5242
|
+
const i = Tn$1(t, n);
|
|
5243
5243
|
if (i)
|
|
5244
5244
|
return i;
|
|
5245
5245
|
}
|
|
5246
|
-
return D
|
|
5246
|
+
return D(t, n, s);
|
|
5247
5247
|
}
|
|
5248
|
-
function
|
|
5249
|
-
if (t instanceof at$
|
|
5248
|
+
function de(t, n, e) {
|
|
5249
|
+
if (t instanceof at$3 && n instanceof at$3) {
|
|
5250
5250
|
const s = cn$1(
|
|
5251
5251
|
t,
|
|
5252
5252
|
n,
|
|
@@ -5255,42 +5255,42 @@ function ae(t, n, e) {
|
|
|
5255
5255
|
);
|
|
5256
5256
|
return s === null ? [] : [s];
|
|
5257
5257
|
}
|
|
5258
|
-
if (t instanceof at$
|
|
5259
|
-
return
|
|
5260
|
-
if (t instanceof ct$
|
|
5261
|
-
return
|
|
5262
|
-
if (t instanceof ct$
|
|
5263
|
-
return
|
|
5258
|
+
if (t instanceof at$3 && n instanceof ct$3)
|
|
5259
|
+
return K$2(t, n, e);
|
|
5260
|
+
if (t instanceof ct$3 && n instanceof at$3)
|
|
5261
|
+
return K$2(n, t, e);
|
|
5262
|
+
if (t instanceof ct$3 && n instanceof ct$3)
|
|
5263
|
+
return Dt(t, n, !1, e);
|
|
5264
5264
|
throw new Error("Not implemented");
|
|
5265
5265
|
}
|
|
5266
|
-
function
|
|
5267
|
-
if (t instanceof at$
|
|
5266
|
+
function Z(t, n, e) {
|
|
5267
|
+
if (t instanceof at$3 && n instanceof at$3) {
|
|
5268
5268
|
const s = cn$1(
|
|
5269
5269
|
t,
|
|
5270
5270
|
n,
|
|
5271
5271
|
!0,
|
|
5272
5272
|
e
|
|
5273
5273
|
);
|
|
5274
|
-
return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$
|
|
5274
|
+
return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$3 ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
|
|
5275
5275
|
}
|
|
5276
5276
|
if (!t.boundingBox.overlaps(n.boundingBox))
|
|
5277
5277
|
return { intersections: [], overlaps: [], count: 0 };
|
|
5278
|
-
if (t instanceof at$
|
|
5279
|
-
const s =
|
|
5278
|
+
if (t instanceof at$3 && n instanceof ct$3) {
|
|
5279
|
+
const s = K$2(t, n, e);
|
|
5280
5280
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5281
5281
|
}
|
|
5282
|
-
if (t instanceof ct$
|
|
5283
|
-
const s =
|
|
5282
|
+
if (t instanceof ct$3 && n instanceof at$3) {
|
|
5283
|
+
const s = K$2(n, t, e);
|
|
5284
5284
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5285
5285
|
}
|
|
5286
|
-
if (t instanceof ct$
|
|
5287
|
-
const s =
|
|
5286
|
+
if (t instanceof ct$3 && n instanceof ct$3) {
|
|
5287
|
+
const s = Dt(
|
|
5288
5288
|
t,
|
|
5289
5289
|
n,
|
|
5290
5290
|
!0,
|
|
5291
5291
|
e
|
|
5292
5292
|
);
|
|
5293
|
-
return s.length ? s[0] instanceof ct$
|
|
5293
|
+
return s.length ? s[0] instanceof ct$3 ? {
|
|
5294
5294
|
intersections: [],
|
|
5295
5295
|
overlaps: s,
|
|
5296
5296
|
count: s.length
|
|
@@ -5300,32 +5300,32 @@ function K$1(t, n, e) {
|
|
|
5300
5300
|
count: s.length
|
|
5301
5301
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5302
5302
|
}
|
|
5303
|
-
if (t instanceof at$
|
|
5304
|
-
const s =
|
|
5303
|
+
if (t instanceof at$3 && n instanceof jt$1) {
|
|
5304
|
+
const s = st$2(
|
|
5305
5305
|
t,
|
|
5306
5306
|
n,
|
|
5307
5307
|
e
|
|
5308
5308
|
);
|
|
5309
5309
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5310
5310
|
}
|
|
5311
|
-
if (n instanceof at$
|
|
5312
|
-
const s =
|
|
5311
|
+
if (n instanceof at$3 && t instanceof jt$1) {
|
|
5312
|
+
const s = st$2(
|
|
5313
5313
|
n,
|
|
5314
5314
|
t,
|
|
5315
5315
|
e
|
|
5316
5316
|
);
|
|
5317
5317
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5318
5318
|
}
|
|
5319
|
-
if (t instanceof ct$
|
|
5320
|
-
const s =
|
|
5319
|
+
if (t instanceof ct$3 && n instanceof jt$1) {
|
|
5320
|
+
const s = gt(t, n);
|
|
5321
5321
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5322
5322
|
}
|
|
5323
|
-
if (n instanceof ct$
|
|
5324
|
-
const s =
|
|
5323
|
+
if (n instanceof ct$3 && t instanceof jt$1) {
|
|
5324
|
+
const s = gt(n, t);
|
|
5325
5325
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5326
5326
|
}
|
|
5327
5327
|
if (t instanceof jt$1 && n instanceof jt$1) {
|
|
5328
|
-
const s =
|
|
5328
|
+
const s = xn$1(
|
|
5329
5329
|
t,
|
|
5330
5330
|
n,
|
|
5331
5331
|
!0
|
|
@@ -5340,32 +5340,32 @@ function K$1(t, n, e) {
|
|
|
5340
5340
|
count: s.length
|
|
5341
5341
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5342
5342
|
}
|
|
5343
|
-
if (t instanceof at$
|
|
5344
|
-
const s =
|
|
5343
|
+
if (t instanceof at$3 && (n instanceof Et$1 || n instanceof _t$1)) {
|
|
5344
|
+
const s = Pt$1(t, n);
|
|
5345
5345
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5346
5346
|
}
|
|
5347
|
-
if (n instanceof at$
|
|
5348
|
-
const s =
|
|
5347
|
+
if (n instanceof at$3 && (t instanceof Et$1 || t instanceof _t$1)) {
|
|
5348
|
+
const s = Pt$1(n, t);
|
|
5349
5349
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5350
5350
|
}
|
|
5351
|
-
if ((t instanceof ct$
|
|
5352
|
-
const s =
|
|
5351
|
+
if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof _t$1) {
|
|
5352
|
+
const s = xt(t, n);
|
|
5353
5353
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5354
5354
|
}
|
|
5355
|
-
if ((n instanceof ct$
|
|
5356
|
-
const s =
|
|
5355
|
+
if ((n instanceof ct$3 || n instanceof jt$1) && t instanceof _t$1) {
|
|
5356
|
+
const s = xt(n, t);
|
|
5357
5357
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5358
5358
|
}
|
|
5359
|
-
if ((t instanceof ct$
|
|
5360
|
-
const s =
|
|
5359
|
+
if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof Et$1) {
|
|
5360
|
+
const s = wt$1(t, n);
|
|
5361
5361
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5362
5362
|
}
|
|
5363
|
-
if ((n instanceof ct$
|
|
5364
|
-
const s =
|
|
5363
|
+
if ((n instanceof ct$3 || n instanceof jt$1) && t instanceof Et$1) {
|
|
5364
|
+
const s = wt$1(n, t);
|
|
5365
5365
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5366
5366
|
}
|
|
5367
5367
|
if (t instanceof _t$1 && n instanceof _t$1) {
|
|
5368
|
-
const s =
|
|
5368
|
+
const s = Ln(
|
|
5369
5369
|
t,
|
|
5370
5370
|
n
|
|
5371
5371
|
);
|
|
@@ -5380,7 +5380,7 @@ function K$1(t, n, e) {
|
|
|
5380
5380
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5381
5381
|
}
|
|
5382
5382
|
if (t instanceof _t$1 && n instanceof Et$1 || n instanceof _t$1 && t instanceof Et$1) {
|
|
5383
|
-
const s = D
|
|
5383
|
+
const s = D(t, n);
|
|
5384
5384
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5385
5385
|
}
|
|
5386
5386
|
if (t instanceof Et$1 && n instanceof Et$1) {
|
|
@@ -5400,23 +5400,23 @@ function K$1(t, n, e) {
|
|
|
5400
5400
|
}
|
|
5401
5401
|
throw new Error("Not implemented");
|
|
5402
5402
|
}
|
|
5403
|
-
function
|
|
5403
|
+
function Nt(t) {
|
|
5404
5404
|
const n = [];
|
|
5405
5405
|
for (let e = 0; e < t; e++)
|
|
5406
5406
|
for (let s = 0; s <= e; s++)
|
|
5407
5407
|
n.push([e, s]);
|
|
5408
5408
|
return n;
|
|
5409
5409
|
}
|
|
5410
|
-
function*
|
|
5411
|
-
for (const [n, e] of
|
|
5410
|
+
function* it$2(t) {
|
|
5411
|
+
for (const [n, e] of Nt(t.length))
|
|
5412
5412
|
n !== e && (yield [t[n], t[e]]);
|
|
5413
5413
|
}
|
|
5414
|
-
class
|
|
5414
|
+
class Ut extends Ze {
|
|
5415
5415
|
constructor(e, { ignoreChecks: s = !1 } = {}) {
|
|
5416
5416
|
super();
|
|
5417
5417
|
C(this, "segments");
|
|
5418
5418
|
C(this, "_boundingBox", null);
|
|
5419
|
-
s ||
|
|
5419
|
+
s || jt(e), this.segments = e;
|
|
5420
5420
|
}
|
|
5421
5421
|
get repr() {
|
|
5422
5422
|
return this.segments.map((e) => e.repr).join(`
|
|
@@ -5441,12 +5441,12 @@ class Nt extends Ze {
|
|
|
5441
5441
|
intersects(e) {
|
|
5442
5442
|
return this.boundingBox.overlaps(e.boundingBox) ? this.segments.some(
|
|
5443
5443
|
(s) => e.segments.some(
|
|
5444
|
-
(i) =>
|
|
5444
|
+
(i) => Z(s, i).count > 0
|
|
5445
5445
|
)
|
|
5446
5446
|
) : !1;
|
|
5447
5447
|
}
|
|
5448
5448
|
overlappingSegments(e) {
|
|
5449
|
-
return this.segments.flatMap((s) => e.segments.flatMap((i) => s.boundingBox.overlaps(i.boundingBox) ?
|
|
5449
|
+
return this.segments.flatMap((s) => e.segments.flatMap((i) => s.boundingBox.overlaps(i.boundingBox) ? Z(s, i).overlaps : []));
|
|
5450
5450
|
}
|
|
5451
5451
|
get boundingBox() {
|
|
5452
5452
|
if (this._boundingBox === null) {
|
|
@@ -5461,63 +5461,63 @@ class Nt extends Ze {
|
|
|
5461
5461
|
return this.repr;
|
|
5462
5462
|
}
|
|
5463
5463
|
}
|
|
5464
|
-
function
|
|
5465
|
-
|
|
5464
|
+
function qn(t, n = "Stroke") {
|
|
5465
|
+
Nt(t.length).forEach(
|
|
5466
5466
|
([e, s]) => {
|
|
5467
5467
|
if (e === s) return;
|
|
5468
|
-
const i = t[e], o = t[s],
|
|
5469
|
-
if (
|
|
5470
|
-
if (
|
|
5471
|
-
const
|
|
5472
|
-
if (
|
|
5468
|
+
const i = t[e], o = t[s], l = Z(i, o), r = Math.max(i.precision, o.precision);
|
|
5469
|
+
if (l.count !== 0) {
|
|
5470
|
+
if (l.count === 1 && !l.overlaps.length) {
|
|
5471
|
+
const u = e - s, a = l.intersections[0];
|
|
5472
|
+
if (u === 1 && Y$2(i.firstPoint, a, r) || u === -1 && Y$2(i.lastPoint, a, r) || u === t.length - 1 && Y$2(i.lastPoint, a, r) && Y$2(o.firstPoint, a, r) || -u === t.length - 1 && Y$2(i.firstPoint, a, r) && Y$2(o.lastPoint, a, r))
|
|
5473
5473
|
return;
|
|
5474
5474
|
}
|
|
5475
|
-
if (!(
|
|
5475
|
+
if (!(l.count === 2 && t.length === 2 && (Y$2(
|
|
5476
5476
|
i.firstPoint,
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
) && Y$
|
|
5477
|
+
l.intersections[0],
|
|
5478
|
+
r
|
|
5479
|
+
) && Y$2(
|
|
5480
5480
|
i.lastPoint,
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
) || Y$
|
|
5481
|
+
l.intersections[1],
|
|
5482
|
+
r
|
|
5483
|
+
) || Y$2(
|
|
5484
5484
|
i.firstPoint,
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
) && Y$
|
|
5485
|
+
l.intersections[1],
|
|
5486
|
+
r
|
|
5487
|
+
) && Y$2(
|
|
5488
5488
|
i.lastPoint,
|
|
5489
|
-
|
|
5490
|
-
|
|
5489
|
+
l.intersections[0],
|
|
5490
|
+
r
|
|
5491
5491
|
))))
|
|
5492
5492
|
throw new Error(
|
|
5493
5493
|
`${n} segments must not intersect, but segments ${i.info} and ${o.info} do at ${JSON.stringify(
|
|
5494
|
-
|
|
5494
|
+
l.intersections
|
|
5495
5495
|
)}`
|
|
5496
5496
|
);
|
|
5497
5497
|
}
|
|
5498
5498
|
}
|
|
5499
5499
|
);
|
|
5500
5500
|
}
|
|
5501
|
-
function
|
|
5501
|
+
function jt(t, n = "Stroke") {
|
|
5502
5502
|
if (t.length === 0)
|
|
5503
5503
|
throw new Error(`${n} must have at least one segment`);
|
|
5504
5504
|
Kt([t.slice(0, -1), t.slice(1)]).forEach(
|
|
5505
5505
|
([e, s]) => {
|
|
5506
|
-
if (!Y$
|
|
5506
|
+
if (!Y$2(e.lastPoint, s.firstPoint))
|
|
5507
5507
|
throw new Error(
|
|
5508
5508
|
`${n} segments must be connected, but ${e.info} and ${s.info} are not`
|
|
5509
5509
|
);
|
|
5510
5510
|
}
|
|
5511
|
-
),
|
|
5512
|
-
}
|
|
5513
|
-
function bt$1(t, n) {
|
|
5514
|
-
return !!(t instanceof at$2 && n instanceof at$2 && Ie(t.V, n.V) || t instanceof ct$2 && n instanceof ct$2 && Y$1(t.center, n.center) && t.radius - n.radius < t.precision);
|
|
5511
|
+
), qn(t, n);
|
|
5515
5512
|
}
|
|
5516
5513
|
function Ct$1(t, n) {
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5514
|
+
return !!(t instanceof at$3 && n instanceof at$3 && Ie(t.V, n.V) || t instanceof ct$3 && n instanceof ct$3 && Y$2(t.center, n.center) && t.radius - n.radius < t.precision);
|
|
5515
|
+
}
|
|
5516
|
+
function Mt$1(t, n) {
|
|
5517
|
+
if (t instanceof at$3 && n instanceof at$3)
|
|
5518
|
+
return new at$3(t.firstPoint, n.lastPoint);
|
|
5519
|
+
if (t instanceof ct$3 && n instanceof ct$3)
|
|
5520
|
+
return new ct$3(
|
|
5521
5521
|
t.firstPoint,
|
|
5522
5522
|
n.lastPoint,
|
|
5523
5523
|
t.center,
|
|
@@ -5525,7 +5525,7 @@ function Ct$1(t, n) {
|
|
|
5525
5525
|
);
|
|
5526
5526
|
throw new Error("Not implemented");
|
|
5527
5527
|
}
|
|
5528
|
-
function
|
|
5528
|
+
function Ht(t) {
|
|
5529
5529
|
let n = !1;
|
|
5530
5530
|
const e = [];
|
|
5531
5531
|
for (const s of t.segments) {
|
|
@@ -5534,19 +5534,19 @@ function jt(t) {
|
|
|
5534
5534
|
continue;
|
|
5535
5535
|
}
|
|
5536
5536
|
const i = e[e.length - 1];
|
|
5537
|
-
|
|
5537
|
+
Ct$1(i, s) ? (n = !0, e.pop(), e.push(Mt$1(i, s))) : e.push(s);
|
|
5538
5538
|
}
|
|
5539
|
-
if (Y$
|
|
5539
|
+
if (Y$2(t.firstPoint, t.lastPoint) && Ct$1(
|
|
5540
5540
|
e[0],
|
|
5541
5541
|
e[e.length - 1]
|
|
5542
5542
|
)) {
|
|
5543
5543
|
n = !0;
|
|
5544
5544
|
const s = e.pop();
|
|
5545
|
-
e[0] =
|
|
5545
|
+
e[0] = Mt$1(s, e[0]);
|
|
5546
5546
|
}
|
|
5547
5547
|
return n ? e : null;
|
|
5548
5548
|
}
|
|
5549
|
-
let B$
|
|
5549
|
+
let B$3 = class B extends Ut {
|
|
5550
5550
|
constructor() {
|
|
5551
5551
|
super(...arguments);
|
|
5552
5552
|
C(this, "strokeType", "STRAND");
|
|
@@ -5562,12 +5562,12 @@ let B$2 = class B extends Nt {
|
|
|
5562
5562
|
);
|
|
5563
5563
|
}
|
|
5564
5564
|
extend(e) {
|
|
5565
|
-
if (!Y$
|
|
5565
|
+
if (!Y$2(this.lastPoint, e.firstPoint))
|
|
5566
5566
|
throw console.error(this.repr, e.repr), new Error("Cannot extend strand: connection point is not the same");
|
|
5567
5567
|
return new B([...this.segments, ...e.segments]);
|
|
5568
5568
|
}
|
|
5569
5569
|
simplify() {
|
|
5570
|
-
const e =
|
|
5570
|
+
const e = Ht(this);
|
|
5571
5571
|
return e ? new B(e, { ignoreChecks: !0 }) : this;
|
|
5572
5572
|
}
|
|
5573
5573
|
transform(e) {
|
|
@@ -5593,38 +5593,38 @@ const zn$1 = (t, n) => {
|
|
|
5593
5593
|
}
|
|
5594
5594
|
return 1;
|
|
5595
5595
|
};
|
|
5596
|
-
class
|
|
5596
|
+
let at$2 = class at {
|
|
5597
5597
|
constructor(n) {
|
|
5598
5598
|
C(this, "_count", 0);
|
|
5599
5599
|
C(this, "segment");
|
|
5600
5600
|
this.segment = n;
|
|
5601
5601
|
}
|
|
5602
5602
|
update(n, e = !1) {
|
|
5603
|
-
!e && !this.segment.isOnSegment(n) || (Y$
|
|
5603
|
+
!e && !this.segment.isOnSegment(n) || (Y$2(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$2(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
|
|
5604
5604
|
}
|
|
5605
5605
|
get count() {
|
|
5606
5606
|
return this._count;
|
|
5607
5607
|
}
|
|
5608
|
-
}
|
|
5609
|
-
const
|
|
5608
|
+
};
|
|
5609
|
+
const Dn$1 = (t, n) => {
|
|
5610
5610
|
const e = n.precision, s = Math.abs(t[1] - n.center[1]);
|
|
5611
5611
|
if (s > n.radius + e) return 0;
|
|
5612
|
-
const i = Rt$1(t, n.center), o = n.radius * n.radius,
|
|
5613
|
-
if (Math.abs(i - o) <
|
|
5612
|
+
const i = Rt$1(t, n.center), o = n.radius * n.radius, l = e * e;
|
|
5613
|
+
if (Math.abs(i - o) < l && n.isOnSegment(t))
|
|
5614
5614
|
return 0;
|
|
5615
|
-
const
|
|
5616
|
-
if (
|
|
5617
|
-
const
|
|
5615
|
+
const r = i - o > l;
|
|
5616
|
+
if (r && n.center[0] < t[0]) return 0;
|
|
5617
|
+
const u = Math.sqrt(
|
|
5618
5618
|
n.radius * n.radius - s * s
|
|
5619
|
-
), a = new
|
|
5620
|
-
return a.update([n.center[0] +
|
|
5621
|
-
},
|
|
5622
|
-
const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$
|
|
5623
|
-
return
|
|
5619
|
+
), a = new at$2(n);
|
|
5620
|
+
return a.update([n.center[0] + u, t[1]]), r && a.update([n.center[0] - u, t[1]]), a.count;
|
|
5621
|
+
}, Rn$1 = (t, n) => {
|
|
5622
|
+
const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$3(t, [e, t[1]]), i = new at$2(n);
|
|
5623
|
+
return st$2(s, n).forEach((o) => {
|
|
5624
5624
|
i.update(o, !0);
|
|
5625
5625
|
}), i.count;
|
|
5626
|
-
},
|
|
5627
|
-
const e = new
|
|
5626
|
+
}, Vn = (t, n) => {
|
|
5627
|
+
const e = new at$2(n);
|
|
5628
5628
|
return n.paramsAtY(t[1]).map((s) => {
|
|
5629
5629
|
try {
|
|
5630
5630
|
return n.paramPoint(s);
|
|
@@ -5638,80 +5638,80 @@ const qn = (t, n) => {
|
|
|
5638
5638
|
e.update(s, !0);
|
|
5639
5639
|
}), e.count;
|
|
5640
5640
|
};
|
|
5641
|
-
function
|
|
5642
|
-
if (n instanceof at$
|
|
5641
|
+
function Nn(t, n) {
|
|
5642
|
+
if (n instanceof at$3)
|
|
5643
5643
|
return zn$1(t, n);
|
|
5644
|
-
if (n instanceof ct$
|
|
5645
|
-
return qn(t, n);
|
|
5646
|
-
if (n instanceof jt$1)
|
|
5644
|
+
if (n instanceof ct$3)
|
|
5647
5645
|
return Dn$1(t, n);
|
|
5648
|
-
if (n instanceof
|
|
5646
|
+
if (n instanceof jt$1)
|
|
5649
5647
|
return Rn$1(t, n);
|
|
5648
|
+
if (n instanceof Et$1 || n instanceof _t$1)
|
|
5649
|
+
return Vn(t, n);
|
|
5650
5650
|
throw new Error("Not implemented");
|
|
5651
5651
|
}
|
|
5652
|
-
class
|
|
5652
|
+
let _$2 = class _ extends Ut {
|
|
5653
5653
|
constructor(e, { ignoreChecks: s = !1 } = {}) {
|
|
5654
5654
|
super(e, { ignoreChecks: !0 });
|
|
5655
5655
|
C(this, "strokeType", "LOOP");
|
|
5656
5656
|
C(this, "_clockwise", null);
|
|
5657
|
-
s ||
|
|
5657
|
+
s || Un(e);
|
|
5658
5658
|
}
|
|
5659
5659
|
get clockwise() {
|
|
5660
5660
|
if (this._clockwise === null) {
|
|
5661
|
-
const e = this.segments.flatMap((i) => i instanceof at$
|
|
5662
|
-
const
|
|
5663
|
-
return (
|
|
5661
|
+
const e = this.segments.flatMap((i) => i instanceof at$3 ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, o) => {
|
|
5662
|
+
const l = e[(o + 1) % e.length];
|
|
5663
|
+
return (l[0] - i[0]) * (l[1] + i[1]);
|
|
5664
5664
|
}).reduce((i, o) => i + o, 0);
|
|
5665
5665
|
this._clockwise = s > 0;
|
|
5666
5666
|
}
|
|
5667
5667
|
return this._clockwise;
|
|
5668
5668
|
}
|
|
5669
5669
|
clone() {
|
|
5670
|
-
return new
|
|
5670
|
+
return new _(
|
|
5671
5671
|
this.segments.map((e) => e.clone()),
|
|
5672
5672
|
{ ignoreChecks: !0 }
|
|
5673
5673
|
);
|
|
5674
5674
|
}
|
|
5675
5675
|
reverse() {
|
|
5676
5676
|
const e = this.segments.map((s) => s.reverse());
|
|
5677
|
-
return e.reverse(), new
|
|
5677
|
+
return e.reverse(), new _(e, { ignoreChecks: !0 });
|
|
5678
5678
|
}
|
|
5679
5679
|
transform(e) {
|
|
5680
|
-
return new
|
|
5680
|
+
return new _(
|
|
5681
5681
|
this.segments.map((s) => s.transform(e)),
|
|
5682
5682
|
{ ignoreChecks: !0 }
|
|
5683
5683
|
);
|
|
5684
5684
|
}
|
|
5685
|
-
contains(e) {
|
|
5686
|
-
return this.onStroke(e)
|
|
5685
|
+
contains(e, { strokeIsInside: s = !1 } = {}) {
|
|
5686
|
+
return this.onStroke(e) ? s : this.boundingBox.contains(e) ? this.segments.reduce((o, l) => o + Nn(e, l), 0) % 2 === 1 : !1;
|
|
5687
5687
|
}
|
|
5688
5688
|
simplify() {
|
|
5689
|
-
const e =
|
|
5690
|
-
return e ? new
|
|
5689
|
+
const e = Ht(this);
|
|
5690
|
+
return e ? new _(e, { ignoreChecks: !0 }) : this;
|
|
5691
5691
|
}
|
|
5692
|
-
}
|
|
5693
|
-
function
|
|
5694
|
-
if (
|
|
5692
|
+
};
|
|
5693
|
+
function Un(t) {
|
|
5694
|
+
if (jt(t, "Loop"), !Y$2(t[0].firstPoint, t[t.length - 1].lastPoint))
|
|
5695
5695
|
throw new Error("Loop segment must be closed");
|
|
5696
5696
|
}
|
|
5697
|
-
const
|
|
5698
|
-
at$
|
|
5699
|
-
ct$
|
|
5697
|
+
const jn = [
|
|
5698
|
+
at$3,
|
|
5699
|
+
ct$3,
|
|
5700
5700
|
jt$1,
|
|
5701
5701
|
_t$1,
|
|
5702
5702
|
Et$1
|
|
5703
5703
|
];
|
|
5704
|
-
function
|
|
5705
|
-
return
|
|
5704
|
+
function Hn(t) {
|
|
5705
|
+
return jn.some((n) => t instanceof n);
|
|
5706
5706
|
}
|
|
5707
|
-
function
|
|
5708
|
-
if (t instanceof at$
|
|
5707
|
+
function $t(t) {
|
|
5708
|
+
if (t instanceof at$3)
|
|
5709
5709
|
return {
|
|
5710
5710
|
type: t.segmentType,
|
|
5711
5711
|
firstPoint: t.firstPoint,
|
|
5712
5712
|
lastPoint: t.lastPoint
|
|
5713
5713
|
};
|
|
5714
|
-
if (t instanceof ct$
|
|
5714
|
+
if (t instanceof ct$3)
|
|
5715
5715
|
return {
|
|
5716
5716
|
type: t.segmentType,
|
|
5717
5717
|
firstPoint: t.firstPoint,
|
|
@@ -5747,37 +5747,37 @@ function Ht(t) {
|
|
|
5747
5747
|
};
|
|
5748
5748
|
throw new Error("Unknown segment type");
|
|
5749
5749
|
}
|
|
5750
|
-
function
|
|
5750
|
+
function ot$3(t) {
|
|
5751
5751
|
return {
|
|
5752
5752
|
type: "LOOP",
|
|
5753
|
-
segments: t.segments.map(
|
|
5753
|
+
segments: t.segments.map($t)
|
|
5754
5754
|
};
|
|
5755
5755
|
}
|
|
5756
|
-
function
|
|
5756
|
+
function Yt(t) {
|
|
5757
5757
|
return {
|
|
5758
5758
|
type: "FIGURE",
|
|
5759
|
-
contour:
|
|
5760
|
-
holes: t.holes.map(
|
|
5759
|
+
contour: ot$3(t.contour),
|
|
5760
|
+
holes: t.holes.map(ot$3)
|
|
5761
5761
|
};
|
|
5762
5762
|
}
|
|
5763
|
-
function
|
|
5763
|
+
function $n$1(t) {
|
|
5764
5764
|
return {
|
|
5765
5765
|
type: "DIAGRAM",
|
|
5766
|
-
figures: t.figures.map(
|
|
5766
|
+
figures: t.figures.map(Yt)
|
|
5767
5767
|
};
|
|
5768
5768
|
}
|
|
5769
|
-
function
|
|
5769
|
+
function It$1(t) {
|
|
5770
|
+
if (t instanceof O$2)
|
|
5771
|
+
return $n$1(t);
|
|
5772
|
+
if (t instanceof v$2)
|
|
5773
|
+
return Yt(t);
|
|
5770
5774
|
if (t instanceof _$2)
|
|
5771
|
-
return
|
|
5772
|
-
if (t
|
|
5775
|
+
return ot$3(t);
|
|
5776
|
+
if (Hn(t))
|
|
5773
5777
|
return $t(t);
|
|
5774
|
-
if (t instanceof O)
|
|
5775
|
-
return it$2(t);
|
|
5776
|
-
if (jn(t))
|
|
5777
|
-
return Ht(t);
|
|
5778
5778
|
throw new Error("Unknown shape type");
|
|
5779
5779
|
}
|
|
5780
|
-
|
|
5780
|
+
class Yn {
|
|
5781
5781
|
constructor() {
|
|
5782
5782
|
this.ids = [], this.values = [], this.length = 0;
|
|
5783
5783
|
}
|
|
@@ -5800,12 +5800,12 @@ let $n$1 = class $n {
|
|
|
5800
5800
|
const e = this.ids[0] = this.ids[this.length], s = this.values[0] = this.values[this.length], i = this.length >> 1;
|
|
5801
5801
|
let o = 0;
|
|
5802
5802
|
for (; o < i; ) {
|
|
5803
|
-
let
|
|
5804
|
-
const
|
|
5805
|
-
let
|
|
5806
|
-
const f = this.values[
|
|
5807
|
-
if (
|
|
5808
|
-
this.ids[o] =
|
|
5803
|
+
let l = (o << 1) + 1;
|
|
5804
|
+
const r = l + 1;
|
|
5805
|
+
let u = this.ids[l], a = this.values[l];
|
|
5806
|
+
const f = this.values[r];
|
|
5807
|
+
if (r < this.length && f < a && (l = r, u = this.ids[r], a = f), a >= s) break;
|
|
5808
|
+
this.ids[o] = u, this.values[o] = a, o = l;
|
|
5809
5809
|
}
|
|
5810
5810
|
this.ids[o] = e, this.values[o] = s;
|
|
5811
5811
|
}
|
|
@@ -5822,9 +5822,9 @@ let $n$1 = class $n {
|
|
|
5822
5822
|
shrink() {
|
|
5823
5823
|
this.ids.length = this.values.length = this.length;
|
|
5824
5824
|
}
|
|
5825
|
-
}
|
|
5826
|
-
const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array],
|
|
5827
|
-
let
|
|
5825
|
+
}
|
|
5826
|
+
const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et$3 = 3;
|
|
5827
|
+
let ft$1 = class ft {
|
|
5828
5828
|
/**
|
|
5829
5829
|
* Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
|
|
5830
5830
|
* @param {ArrayBuffer | SharedArrayBuffer} data
|
|
@@ -5840,13 +5840,13 @@ let at$1 = class at {
|
|
|
5840
5840
|
if (s !== 251)
|
|
5841
5841
|
throw new Error("Data does not appear to be in a Flatbush format.");
|
|
5842
5842
|
const o = i >> 4;
|
|
5843
|
-
if (o !==
|
|
5844
|
-
throw new Error(`Got v${o} data when expected v${
|
|
5845
|
-
const
|
|
5846
|
-
if (!
|
|
5843
|
+
if (o !== et$3)
|
|
5844
|
+
throw new Error(`Got v${o} data when expected v${et$3}.`);
|
|
5845
|
+
const l = At$1[i & 15];
|
|
5846
|
+
if (!l)
|
|
5847
5847
|
throw new Error("Unrecognized array type.");
|
|
5848
|
-
const [
|
|
5849
|
-
return new
|
|
5848
|
+
const [r] = new Uint16Array(n, e + 2, 1), [u] = new Uint32Array(n, e + 4, 1);
|
|
5849
|
+
return new ft(u, r, l, void 0, n, e);
|
|
5850
5850
|
}
|
|
5851
5851
|
/**
|
|
5852
5852
|
* Create a Flatbush index that will hold a given number of items.
|
|
@@ -5857,20 +5857,20 @@ let at$1 = class at {
|
|
|
5857
5857
|
* @param {ArrayBuffer | SharedArrayBuffer} [data] (Only used internally)
|
|
5858
5858
|
* @param {number} [byteOffset=0] (Only used internally)
|
|
5859
5859
|
*/
|
|
5860
|
-
constructor(n, e = 16, s = Float64Array, i = ArrayBuffer, o,
|
|
5860
|
+
constructor(n, e = 16, s = Float64Array, i = ArrayBuffer, o, l = 0) {
|
|
5861
5861
|
if (n === void 0) throw new Error("Missing required argument: numItems.");
|
|
5862
5862
|
if (isNaN(n) || n <= 0) throw new Error(`Unexpected numItems value: ${n}.`);
|
|
5863
|
-
this.numItems = +n, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.byteOffset =
|
|
5864
|
-
let
|
|
5865
|
-
this._levelBounds = [
|
|
5863
|
+
this.numItems = +n, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.byteOffset = l;
|
|
5864
|
+
let r = n, u = r;
|
|
5865
|
+
this._levelBounds = [r * 4];
|
|
5866
5866
|
do
|
|
5867
|
-
|
|
5868
|
-
while (
|
|
5869
|
-
this.ArrayType = s, this.IndexArrayType =
|
|
5870
|
-
const a = At$1.indexOf(this.ArrayType), f =
|
|
5867
|
+
r = Math.ceil(r / this.nodeSize), u += r, this._levelBounds.push(u * 4);
|
|
5868
|
+
while (r !== 1);
|
|
5869
|
+
this.ArrayType = s, this.IndexArrayType = u < 16384 ? Uint16Array : Uint32Array;
|
|
5870
|
+
const a = At$1.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
|
|
5871
5871
|
if (a < 0)
|
|
5872
5872
|
throw new Error(`Unexpected typed array class: ${s}.`);
|
|
5873
|
-
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data,
|
|
5873
|
+
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, l + 8, u * 4), this._indices = new this.IndexArrayType(this.data, l + 8 + f, u), this._pos = u * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + u * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, u * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, u), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (et$3 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Yn();
|
|
5874
5874
|
}
|
|
5875
5875
|
/**
|
|
5876
5876
|
* Add a given rectangle to the index.
|
|
@@ -5881,8 +5881,8 @@ let at$1 = class at {
|
|
|
5881
5881
|
* @returns {number} A zero-based, incremental number that represents the newly added rectangle.
|
|
5882
5882
|
*/
|
|
5883
5883
|
add(n, e, s = n, i = e) {
|
|
5884
|
-
const o = this._pos >> 2,
|
|
5885
|
-
return this._indices[o] = o,
|
|
5884
|
+
const o = this._pos >> 2, l = this._boxes;
|
|
5885
|
+
return this._indices[o] = o, l[this._pos++] = n, l[this._pos++] = e, l[this._pos++] = s, l[this._pos++] = i, n < this.minX && (this.minX = n), e < this.minY && (this.minY = e), s > this.maxX && (this.maxX = s), i > this.maxY && (this.maxY = i), o;
|
|
5886
5886
|
}
|
|
5887
5887
|
/** Perform indexing of the added rectangles. */
|
|
5888
5888
|
finish() {
|
|
@@ -5894,19 +5894,19 @@ let at$1 = class at {
|
|
|
5894
5894
|
return;
|
|
5895
5895
|
}
|
|
5896
5896
|
const e = this.maxX - this.minX || 1, s = this.maxY - this.minY || 1, i = new Uint32Array(this.numItems), o = 65535;
|
|
5897
|
-
for (let
|
|
5898
|
-
const
|
|
5899
|
-
i[
|
|
5900
|
-
}
|
|
5901
|
-
|
|
5902
|
-
for (let
|
|
5903
|
-
const
|
|
5904
|
-
for (;
|
|
5905
|
-
const a =
|
|
5906
|
-
let f = n[
|
|
5907
|
-
for (let d = 1; d < this.nodeSize &&
|
|
5908
|
-
f = Math.min(f, n[
|
|
5909
|
-
this._indices[this._pos >> 2] = a, n[this._pos++] = f, n[this._pos++] =
|
|
5897
|
+
for (let l = 0, r = 0; l < this.numItems; l++) {
|
|
5898
|
+
const u = n[r++], a = n[r++], f = n[r++], c = n[r++], h = Math.floor(o * ((u + f) / 2 - this.minX) / e), p = Math.floor(o * ((a + c) / 2 - this.minY) / s);
|
|
5899
|
+
i[l] = Gn(h, p);
|
|
5900
|
+
}
|
|
5901
|
+
rt$3(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
|
|
5902
|
+
for (let l = 0, r = 0; l < this._levelBounds.length - 1; l++) {
|
|
5903
|
+
const u = this._levelBounds[l];
|
|
5904
|
+
for (; r < u; ) {
|
|
5905
|
+
const a = r;
|
|
5906
|
+
let f = n[r++], c = n[r++], h = n[r++], p = n[r++];
|
|
5907
|
+
for (let d = 1; d < this.nodeSize && r < u; d++)
|
|
5908
|
+
f = Math.min(f, n[r++]), c = Math.min(c, n[r++]), h = Math.max(h, n[r++]), p = Math.max(p, n[r++]);
|
|
5909
|
+
this._indices[this._pos >> 2] = a, n[this._pos++] = f, n[this._pos++] = c, n[this._pos++] = h, n[this._pos++] = p;
|
|
5910
5910
|
}
|
|
5911
5911
|
}
|
|
5912
5912
|
}
|
|
@@ -5922,18 +5922,18 @@ let at$1 = class at {
|
|
|
5922
5922
|
search(n, e, s, i, o) {
|
|
5923
5923
|
if (this._pos !== this._boxes.length)
|
|
5924
5924
|
throw new Error("Data not yet indexed - call index.finish().");
|
|
5925
|
-
let
|
|
5926
|
-
const
|
|
5927
|
-
for (;
|
|
5928
|
-
const a = Math.min(
|
|
5929
|
-
for (let f =
|
|
5925
|
+
let l = this._boxes.length - 4;
|
|
5926
|
+
const r = [], u = [];
|
|
5927
|
+
for (; l !== void 0; ) {
|
|
5928
|
+
const a = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
|
|
5929
|
+
for (let f = l; f < a; f += 4) {
|
|
5930
5930
|
if (s < this._boxes[f] || i < this._boxes[f + 1] || n > this._boxes[f + 2] || e > this._boxes[f + 3]) continue;
|
|
5931
|
-
const
|
|
5932
|
-
|
|
5931
|
+
const c = this._indices[f >> 2] | 0;
|
|
5932
|
+
l >= this.numItems * 4 ? r.push(c) : (o === void 0 || o(c)) && u.push(c);
|
|
5933
5933
|
}
|
|
5934
|
-
|
|
5934
|
+
l = r.pop();
|
|
5935
5935
|
}
|
|
5936
|
-
return
|
|
5936
|
+
return u;
|
|
5937
5937
|
}
|
|
5938
5938
|
/**
|
|
5939
5939
|
* Search items in order of distance from the given point.
|
|
@@ -5947,25 +5947,25 @@ let at$1 = class at {
|
|
|
5947
5947
|
neighbors(n, e, s = 1 / 0, i = 1 / 0, o) {
|
|
5948
5948
|
if (this._pos !== this._boxes.length)
|
|
5949
5949
|
throw new Error("Data not yet indexed - call index.finish().");
|
|
5950
|
-
let
|
|
5951
|
-
const
|
|
5952
|
-
t: for (;
|
|
5953
|
-
const f = Math.min(
|
|
5954
|
-
for (let
|
|
5955
|
-
const h = this._indices[
|
|
5956
|
-
m > a || (
|
|
5950
|
+
let l = this._boxes.length - 4;
|
|
5951
|
+
const r = this._queue, u = [], a = i * i;
|
|
5952
|
+
t: for (; l !== void 0; ) {
|
|
5953
|
+
const f = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
|
|
5954
|
+
for (let c = l; c < f; c += 4) {
|
|
5955
|
+
const h = this._indices[c >> 2] | 0, p = Et(n, this._boxes[c], this._boxes[c + 2]), d = Et(e, this._boxes[c + 1], this._boxes[c + 3]), m = p * p + d * d;
|
|
5956
|
+
m > a || (l >= this.numItems * 4 ? r.push(h << 1, m) : (o === void 0 || o(h)) && r.push((h << 1) + 1, m));
|
|
5957
5957
|
}
|
|
5958
|
-
for (;
|
|
5959
|
-
if (
|
|
5960
|
-
|
|
5958
|
+
for (; r.length && r.peek() & 1; )
|
|
5959
|
+
if (r.peekValue() > a || (u.push(r.pop() >> 1), u.length === s)) break t;
|
|
5960
|
+
l = r.length ? r.pop() >> 1 : void 0;
|
|
5961
5961
|
}
|
|
5962
|
-
return
|
|
5962
|
+
return r.clear(), u;
|
|
5963
5963
|
}
|
|
5964
5964
|
};
|
|
5965
|
-
function
|
|
5965
|
+
function Et(t, n, e) {
|
|
5966
5966
|
return t < n ? n - t : t <= e ? 0 : t - e;
|
|
5967
5967
|
}
|
|
5968
|
-
function
|
|
5968
|
+
function Ft(t, n) {
|
|
5969
5969
|
let e = 0, s = n.length - 1;
|
|
5970
5970
|
for (; e < s; ) {
|
|
5971
5971
|
const i = e + s >> 1;
|
|
@@ -5973,79 +5973,79 @@ function Et(t, n) {
|
|
|
5973
5973
|
}
|
|
5974
5974
|
return n[e];
|
|
5975
5975
|
}
|
|
5976
|
-
function
|
|
5976
|
+
function rt$3(t, n, e, s, i, o) {
|
|
5977
5977
|
if (Math.floor(s / o) >= Math.floor(i / o)) return;
|
|
5978
|
-
const
|
|
5979
|
-
let
|
|
5978
|
+
const l = t[s + i >> 1];
|
|
5979
|
+
let r = s - 1, u = i + 1;
|
|
5980
5980
|
for (; ; ) {
|
|
5981
5981
|
do
|
|
5982
|
-
|
|
5983
|
-
while (t[
|
|
5982
|
+
r++;
|
|
5983
|
+
while (t[r] < l);
|
|
5984
5984
|
do
|
|
5985
|
-
|
|
5986
|
-
while (t[
|
|
5987
|
-
if (
|
|
5988
|
-
|
|
5985
|
+
u--;
|
|
5986
|
+
while (t[u] > l);
|
|
5987
|
+
if (r >= u) break;
|
|
5988
|
+
Xn(t, n, e, r, u);
|
|
5989
5989
|
}
|
|
5990
|
-
|
|
5990
|
+
rt$3(t, n, e, s, u, o), rt$3(t, n, e, u + 1, i, o);
|
|
5991
5991
|
}
|
|
5992
|
-
function
|
|
5992
|
+
function Xn(t, n, e, s, i) {
|
|
5993
5993
|
const o = t[s];
|
|
5994
5994
|
t[s] = t[i], t[i] = o;
|
|
5995
|
-
const
|
|
5996
|
-
n[
|
|
5995
|
+
const l = 4 * s, r = 4 * i, u = n[l], a = n[l + 1], f = n[l + 2], c = n[l + 3];
|
|
5996
|
+
n[l] = n[r], n[l + 1] = n[r + 1], n[l + 2] = n[r + 2], n[l + 3] = n[r + 3], n[r] = u, n[r + 1] = a, n[r + 2] = f, n[r + 3] = c;
|
|
5997
5997
|
const h = e[s];
|
|
5998
5998
|
e[s] = e[i], e[i] = h;
|
|
5999
5999
|
}
|
|
6000
|
-
function
|
|
6001
|
-
let e = t ^ n, s = 65535 ^ e, i = 65535 ^ (t | n), o = t & (n ^ 65535),
|
|
6002
|
-
e =
|
|
6003
|
-
let f = t ^ n,
|
|
6004
|
-
return f = (f | f << 8) & 16711935, f = (f | f << 4) & 252645135, f = (f | f << 2) & 858993459, f = (f | f << 1) & 1431655765,
|
|
6000
|
+
function Gn(t, n) {
|
|
6001
|
+
let e = t ^ n, s = 65535 ^ e, i = 65535 ^ (t | n), o = t & (n ^ 65535), l = e | s >> 1, r = e >> 1 ^ e, u = i >> 1 ^ s & o >> 1 ^ i, a = e & i >> 1 ^ o >> 1 ^ o;
|
|
6002
|
+
e = l, s = r, i = u, o = a, l = e & e >> 2 ^ s & s >> 2, r = e & s >> 2 ^ s & (e ^ s) >> 2, u ^= e & i >> 2 ^ s & o >> 2, a ^= s & i >> 2 ^ (e ^ s) & o >> 2, e = l, s = r, i = u, o = a, l = e & e >> 4 ^ s & s >> 4, r = e & s >> 4 ^ s & (e ^ s) >> 4, u ^= e & i >> 4 ^ s & o >> 4, a ^= s & i >> 4 ^ (e ^ s) & o >> 4, e = l, s = r, i = u, o = a, u ^= e & i >> 8 ^ s & o >> 8, a ^= s & i >> 8 ^ (e ^ s) & o >> 8, e = u ^ u >> 1, s = a ^ a >> 1;
|
|
6003
|
+
let f = t ^ n, c = s | 65535 ^ (f | e);
|
|
6004
|
+
return f = (f | f << 8) & 16711935, f = (f | f << 4) & 252645135, f = (f | f << 2) & 858993459, f = (f | f << 1) & 1431655765, c = (c | c << 8) & 16711935, c = (c | c << 4) & 252645135, c = (c | c << 2) & 858993459, c = (c | c << 1) & 1431655765, (c << 1 | f) >>> 0;
|
|
6005
6005
|
}
|
|
6006
|
-
function
|
|
6006
|
+
function Xt(t, n = 1e-7) {
|
|
6007
6007
|
if (t.length === 0) return [];
|
|
6008
6008
|
if (t.length === 1) return [t];
|
|
6009
|
-
const e = new
|
|
6009
|
+
const e = new ft$1(t.length);
|
|
6010
6010
|
t.forEach((o) => {
|
|
6011
|
-
const [
|
|
6012
|
-
e.add(
|
|
6011
|
+
const [l, r] = o.firstPoint;
|
|
6012
|
+
e.add(l - n, r - n, l + n, r + n);
|
|
6013
6013
|
}), e.finish();
|
|
6014
6014
|
const s = [], i = /* @__PURE__ */ new Set();
|
|
6015
|
-
return t.forEach((o,
|
|
6016
|
-
if (i.has(
|
|
6017
|
-
const
|
|
6018
|
-
let
|
|
6019
|
-
i.add(
|
|
6015
|
+
return t.forEach((o, l) => {
|
|
6016
|
+
if (i.has(l)) return;
|
|
6017
|
+
const r = [o];
|
|
6018
|
+
let u = l;
|
|
6019
|
+
i.add(l);
|
|
6020
6020
|
let a = t.length;
|
|
6021
6021
|
for (; ; ) {
|
|
6022
6022
|
if (a-- < 0)
|
|
6023
6023
|
throw new Error("Infinite loop detected");
|
|
6024
|
-
const f =
|
|
6025
|
-
|
|
6024
|
+
const f = r[r.length - 1].lastPoint, [c, h] = f, p = e.search(
|
|
6025
|
+
c - n,
|
|
6026
6026
|
h - n,
|
|
6027
|
-
|
|
6027
|
+
c + n,
|
|
6028
6028
|
h + n
|
|
6029
|
-
), d = (
|
|
6030
|
-
t[
|
|
6031
|
-
|
|
6032
|
-
d(
|
|
6033
|
-
]).sort(([, ,
|
|
6029
|
+
), d = (w) => Math.abs((u - w) % t.length), m = p.filter((w) => !i.has(w)).map((w) => [
|
|
6030
|
+
t[w],
|
|
6031
|
+
w,
|
|
6032
|
+
d(w)
|
|
6033
|
+
]).sort(([, , w], [, , F]) => d(w) - d(F));
|
|
6034
6034
|
if (m.length === 0) {
|
|
6035
|
-
s.push(
|
|
6035
|
+
s.push(r);
|
|
6036
6036
|
break;
|
|
6037
6037
|
}
|
|
6038
|
-
const [
|
|
6039
|
-
|
|
6038
|
+
const [x, g] = m[0];
|
|
6039
|
+
r.push(x), i.add(g), u = g;
|
|
6040
6040
|
}
|
|
6041
6041
|
}), s;
|
|
6042
6042
|
}
|
|
6043
|
-
let v$
|
|
6043
|
+
let v$2 = class v extends Ze {
|
|
6044
6044
|
constructor(e, s = [], { ignoreChecks: i = !1 } = {}) {
|
|
6045
6045
|
super();
|
|
6046
6046
|
C(this, "contour");
|
|
6047
6047
|
C(this, "holes");
|
|
6048
|
-
i ||
|
|
6048
|
+
i || Qn(e, s), this.contour = e, this.holes = s;
|
|
6049
6049
|
}
|
|
6050
6050
|
get boundingBox() {
|
|
6051
6051
|
return this.contour.boundingBox;
|
|
@@ -6068,8 +6068,8 @@ let v$1 = class v extends Ze {
|
|
|
6068
6068
|
this.holes.map((s) => s.transform(e))
|
|
6069
6069
|
);
|
|
6070
6070
|
}
|
|
6071
|
-
contains(e) {
|
|
6072
|
-
return this.contour.contains(e) && !this.holes.some((
|
|
6071
|
+
contains(e, { strokeIsInside: s = !1 } = {}) {
|
|
6072
|
+
return this.contour.contains(e, { strokeIsInside: s }) && !this.holes.some((i) => i.contains(e, { strokeIsInside: s }));
|
|
6073
6073
|
}
|
|
6074
6074
|
intersects(e) {
|
|
6075
6075
|
return this.allLoops.some(
|
|
@@ -6077,351 +6077,411 @@ let v$1 = class v extends Ze {
|
|
|
6077
6077
|
);
|
|
6078
6078
|
}
|
|
6079
6079
|
overlappingStrands(e) {
|
|
6080
|
-
const s = e instanceof v ? e.allLoops : [e], i = this.allLoops.flatMap((o) => s.flatMap((
|
|
6081
|
-
return
|
|
6080
|
+
const s = e instanceof v ? e.allLoops : [e], i = this.allLoops.flatMap((o) => s.flatMap((l) => o.overlappingSegments(l)));
|
|
6081
|
+
return Xt(i).map((o) => new B$3(o));
|
|
6082
6082
|
}
|
|
6083
6083
|
};
|
|
6084
|
-
function
|
|
6084
|
+
function Qn(t, n = []) {
|
|
6085
6085
|
if (!t) throw new Error("Figure must have a contour");
|
|
6086
|
-
for (const [e, s] of
|
|
6086
|
+
for (const [e, s] of it$2([t, ...n]))
|
|
6087
6087
|
if (e.intersects(s))
|
|
6088
6088
|
throw new Error("Loops in a figure must not intersect");
|
|
6089
6089
|
if (n.some(
|
|
6090
6090
|
(e) => !t.contains(e.firstPoint) && !t.onStroke(e.firstPoint)
|
|
6091
6091
|
))
|
|
6092
6092
|
throw new Error("Holes must be inside the contour");
|
|
6093
|
-
for (const [e, s] of
|
|
6093
|
+
for (const [e, s] of it$2(n))
|
|
6094
6094
|
if (e.contains(s.firstPoint))
|
|
6095
|
-
throw console.error(
|
|
6096
|
-
}
|
|
6097
|
-
const
|
|
6098
|
-
const
|
|
6095
|
+
throw console.error(It$1(e), It$1(s)), new Error("Holes must not be inside other holes");
|
|
6096
|
+
}
|
|
6097
|
+
const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
|
|
6098
|
+
const e = t.boundingBox, s = n.boundingBox;
|
|
6099
|
+
return J$2(e.xMin, s.xMin) && J$2(e.yMin, s.yMin) && J$2(e.xMax, s.xMax) && J$2(e.yMax, s.yMax);
|
|
6100
|
+
}, Jn = (t, n) => {
|
|
6101
|
+
if (t.segmentsCount !== n.segmentsCount || !Wn(t, n)) return !1;
|
|
6102
|
+
const e = t.segments, s = n.segments, i = e.length, o = (l, r) => {
|
|
6103
|
+
for (let u = 0; u < i; u += 1) {
|
|
6104
|
+
const a = (l + r * u + i) % i;
|
|
6105
|
+
if (!e[u].isSame(s[a])) return !1;
|
|
6106
|
+
}
|
|
6107
|
+
return !0;
|
|
6108
|
+
};
|
|
6109
|
+
for (let l = 0; l < i; l += 1)
|
|
6110
|
+
if (e[0].isSame(s[l]) && (o(l, 1) || o(l, -1)))
|
|
6111
|
+
return !0;
|
|
6112
|
+
return !1;
|
|
6113
|
+
}, Kn = (t) => {
|
|
6114
|
+
const n = [];
|
|
6115
|
+
return t.forEach((e) => {
|
|
6116
|
+
n.some((s) => Jn(e, s)) || n.push(e);
|
|
6117
|
+
}), n;
|
|
6118
|
+
}, Zn = (t) => {
|
|
6119
|
+
const n = t.map((i, o) => t.slice(o + 1).map((l, r) => [r + o + 1, l]).filter(([, l]) => i.boundingBox.overlaps(l.boundingBox)).map(([l]) => l)), e = [], s = Array(n.length);
|
|
6099
6120
|
return n.forEach((i, o) => {
|
|
6100
|
-
let
|
|
6101
|
-
|
|
6102
|
-
s[
|
|
6121
|
+
let l = s[o];
|
|
6122
|
+
l || (l = [], e.push(l)), l.push(t[o]), i.length && i.forEach((r) => {
|
|
6123
|
+
s[r] = l;
|
|
6103
6124
|
});
|
|
6104
6125
|
}), e;
|
|
6105
|
-
},
|
|
6106
|
-
const i = n.segments[0].midPoint, o = t.filter((
|
|
6126
|
+
}, Gt = (t) => t.map((n, e) => {
|
|
6127
|
+
const i = n.segments[0].midPoint, o = t.filter((l, r) => e === r ? !1 : l.contains(i));
|
|
6107
6128
|
return {
|
|
6108
6129
|
loop: n,
|
|
6109
6130
|
isIn: o
|
|
6110
6131
|
};
|
|
6111
|
-
}),
|
|
6132
|
+
}), te = (t, n) => t.flatMap(({ loop: e }) => ht$1(
|
|
6112
6133
|
n.filter(
|
|
6113
6134
|
({ loop: s, isIn: i }) => s === e || i.indexOf(e) !== -1
|
|
6114
6135
|
)
|
|
6115
|
-
)),
|
|
6116
|
-
const e = n.filter(({ isIn: i }) => i.length <= 1), s =
|
|
6117
|
-
|
|
6136
|
+
)), ne = (t, n) => {
|
|
6137
|
+
const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht$1(
|
|
6138
|
+
Gt(t.map(({ loop: i }) => i))
|
|
6118
6139
|
);
|
|
6119
6140
|
return [e, ...s];
|
|
6120
|
-
},
|
|
6141
|
+
}, ht$1 = (t) => {
|
|
6121
6142
|
if (!t.length) return [];
|
|
6122
6143
|
const n = t.filter(({ isIn: s }) => !s.length), e = t.filter(({ isIn: s }) => s.length > 1);
|
|
6123
|
-
return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ?
|
|
6144
|
+
return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? te(n, t) : ne(e, t);
|
|
6124
6145
|
};
|
|
6125
|
-
function X$
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6146
|
+
function X$2(t) {
|
|
6147
|
+
const n = Kn(t);
|
|
6148
|
+
return Zn(n).map(Gt).flatMap(ht$1).map((s) => {
|
|
6149
|
+
if (s.length === 1) return new v$2(s[0].loop);
|
|
6150
|
+
s.sort((l, r) => l.isIn.length - r.isIn.length);
|
|
6151
|
+
const [i, ...o] = s.map(({ loop: l }) => l);
|
|
6152
|
+
return new v$2(i, o);
|
|
6131
6153
|
});
|
|
6132
6154
|
}
|
|
6133
|
-
function
|
|
6155
|
+
function ee(t, n) {
|
|
6134
6156
|
const e = [];
|
|
6135
6157
|
for (const s of t)
|
|
6136
6158
|
for (const i of n)
|
|
6137
6159
|
e.push([s, i]);
|
|
6138
6160
|
return e;
|
|
6139
6161
|
}
|
|
6140
|
-
function*
|
|
6141
|
-
const s = (r) => n.some((
|
|
6142
|
-
let
|
|
6162
|
+
function* vt$1(t, n, e) {
|
|
6163
|
+
const s = (r) => n.some((u) => Y$2(u, r.lastPoint)), i = (r, u) => r.segmentType !== u.segmentType || !u.isOnSegment(r.firstPoint) || !u.isOnSegment(r.lastPoint) ? !1 : r.segmentType !== "LINE" ? u.isOnSegment(r.midPoint) : !0, o = (r) => e.some((u) => r.isSame(u) || i(r, u));
|
|
6164
|
+
let l = [];
|
|
6143
6165
|
for (const r of t)
|
|
6144
|
-
s(r) ? (
|
|
6145
|
-
|
|
6166
|
+
s(r) ? (l.push(r), yield new B$3(l, { ignoreChecks: !0 }), l = []) : o(r) ? (l.length && (yield new B$3(l, { ignoreChecks: !0 }), l = []), yield new B$3([r], { ignoreChecks: !0 })) : l.push(r);
|
|
6167
|
+
l.length && (yield new B$3(l, { ignoreChecks: !0 }));
|
|
6146
6168
|
}
|
|
6147
|
-
const
|
|
6148
|
-
const e = t.findIndex((o) => Y$
|
|
6169
|
+
const Bt = (t, n) => {
|
|
6170
|
+
const e = t.findIndex((o) => Y$2(n, o.firstPoint)), s = t.slice(0, e);
|
|
6149
6171
|
return t.slice(e).concat(s);
|
|
6150
|
-
},
|
|
6172
|
+
}, kt = (t, n) => {
|
|
6151
6173
|
let e = t;
|
|
6152
|
-
const s = (
|
|
6174
|
+
const s = (r) => Y$2(r.firstPoint, n.firstPoint) && Y$2(r.lastPoint, n.lastPoint);
|
|
6153
6175
|
let i = t.findIndex(s);
|
|
6154
6176
|
if (i === -1) {
|
|
6155
|
-
const
|
|
6156
|
-
if (
|
|
6177
|
+
const r = t.map((u) => u.reverse());
|
|
6178
|
+
if (r.reverse(), i = r.findIndex(s), i === -1)
|
|
6157
6179
|
throw console.error(
|
|
6158
|
-
|
|
6180
|
+
r.map((u) => u.repr),
|
|
6159
6181
|
n.repr
|
|
6160
6182
|
), new Error("Failed to rotate to segment start");
|
|
6161
|
-
e =
|
|
6183
|
+
e = r;
|
|
6162
6184
|
}
|
|
6163
6185
|
const o = e.slice(0, i);
|
|
6164
6186
|
return e.slice(i).concat(o);
|
|
6165
6187
|
};
|
|
6166
|
-
function
|
|
6188
|
+
function se(t, n, e) {
|
|
6167
6189
|
return t.filter((s) => {
|
|
6168
|
-
const i = n.filter((
|
|
6190
|
+
const i = n.filter((r) => Y$2(r.firstPoint, s) || Y$2(r.lastPoint, s));
|
|
6169
6191
|
if (i.length % 2)
|
|
6170
6192
|
throw new Error("Bug in the intersection algo on non crossing point");
|
|
6171
|
-
const o = i.map((
|
|
6172
|
-
return !(o.every((
|
|
6193
|
+
const o = i.map((r) => e.contains(r.midPoint));
|
|
6194
|
+
return !(o.every((r) => r) || !o.some((r) => r));
|
|
6173
6195
|
});
|
|
6174
6196
|
}
|
|
6175
|
-
function
|
|
6176
|
-
let
|
|
6177
|
-
const
|
|
6178
|
-
if (t.segments.forEach((
|
|
6179
|
-
n.segments.forEach((
|
|
6180
|
-
const { intersections:
|
|
6181
|
-
|
|
6182
|
-
|
|
6197
|
+
function ie(t, n, e, s = !1) {
|
|
6198
|
+
let i = [];
|
|
6199
|
+
const o = [], l = new Array(t.segments.length).fill(0).map(() => []), r = new Array(n.segments.length).fill(0).map(() => []);
|
|
6200
|
+
if (t.segments.forEach((p, d) => {
|
|
6201
|
+
n.segments.forEach((m, x) => {
|
|
6202
|
+
const { intersections: g, overlaps: w } = Z(
|
|
6203
|
+
p,
|
|
6204
|
+
m,
|
|
6183
6205
|
e
|
|
6184
6206
|
);
|
|
6185
|
-
|
|
6186
|
-
const
|
|
6187
|
-
|
|
6188
|
-
|
|
6207
|
+
i.push(...g), l[d].push(...g), r[x].push(...g), o.push(...w);
|
|
6208
|
+
const F = w.flatMap((y) => [
|
|
6209
|
+
y.firstPoint,
|
|
6210
|
+
y.lastPoint
|
|
6189
6211
|
]);
|
|
6190
|
-
|
|
6212
|
+
i.push(...F), l[d].push(...F), r[x].push(...F);
|
|
6191
6213
|
});
|
|
6192
|
-
}),
|
|
6193
|
-
const
|
|
6194
|
-
let
|
|
6195
|
-
if (
|
|
6196
|
-
|
|
6197
|
-
|
|
6214
|
+
}), i = Te(i, e), !i.length || i.length === 1) return null;
|
|
6215
|
+
const u = ([p, d]) => d.length ? p.splitAt(d) : [p];
|
|
6216
|
+
let a = Kt([t.segments, l]).flatMap(u), f = Kt([n.segments, r]).flatMap(u);
|
|
6217
|
+
if (i = se(
|
|
6218
|
+
i,
|
|
6219
|
+
a,
|
|
6198
6220
|
n
|
|
6199
|
-
), !
|
|
6200
|
-
if (
|
|
6201
|
-
const
|
|
6202
|
-
|
|
6203
|
-
c,
|
|
6204
|
-
h
|
|
6205
|
-
), a = Bt(
|
|
6221
|
+
), !i.length && !o.length) return null;
|
|
6222
|
+
if (o.length) {
|
|
6223
|
+
const p = o[0];
|
|
6224
|
+
a = kt(
|
|
6206
6225
|
a,
|
|
6207
|
-
|
|
6226
|
+
p
|
|
6227
|
+
), f = kt(
|
|
6228
|
+
f,
|
|
6229
|
+
p
|
|
6208
6230
|
);
|
|
6209
6231
|
} else {
|
|
6210
|
-
const
|
|
6211
|
-
|
|
6232
|
+
const p = i[0];
|
|
6233
|
+
a = Bt(a, p), f = Bt(f, p);
|
|
6212
6234
|
}
|
|
6213
|
-
let
|
|
6214
|
-
|
|
6215
|
-
c,
|
|
6216
|
-
s,
|
|
6217
|
-
i
|
|
6218
|
-
)
|
|
6219
|
-
), u = Array.from(
|
|
6220
|
-
Ft(
|
|
6235
|
+
let c = Array.from(
|
|
6236
|
+
vt$1(
|
|
6221
6237
|
a,
|
|
6222
|
-
|
|
6223
|
-
|
|
6238
|
+
i,
|
|
6239
|
+
o
|
|
6240
|
+
)
|
|
6241
|
+
), h = Array.from(
|
|
6242
|
+
vt$1(
|
|
6243
|
+
f,
|
|
6244
|
+
i,
|
|
6245
|
+
o
|
|
6224
6246
|
)
|
|
6225
6247
|
);
|
|
6226
|
-
return (!Y$
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
) ||
|
|
6248
|
+
return (!Y$2(
|
|
6249
|
+
h[0].lastPoint,
|
|
6250
|
+
c[0].lastPoint
|
|
6251
|
+
) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), Y$2(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), Kt([c, h]).map(([p, d]) => {
|
|
6252
|
+
if (s) {
|
|
6253
|
+
if (((x) => x.segments.every(
|
|
6254
|
+
(g) => o.some(
|
|
6255
|
+
(w) => g.isSame(w) || g.segmentType === w.segmentType && w.isOnSegment(g.firstPoint) && w.isOnSegment(g.lastPoint) && (g.segmentType === "LINE" || w.isOnSegment(g.midPoint))
|
|
6256
|
+
)
|
|
6257
|
+
))(p))
|
|
6258
|
+
return [p, "same"];
|
|
6259
|
+
} else if (p.segmentsCount === 1 && o.some((m) => p.segments[0].isSame(m)))
|
|
6260
|
+
return [p, "same"];
|
|
6261
|
+
return [p, d];
|
|
6262
|
+
});
|
|
6230
6263
|
}
|
|
6231
|
-
function
|
|
6264
|
+
function Ot(t) {
|
|
6232
6265
|
let n = t[0];
|
|
6233
6266
|
for (const e of t.slice(1))
|
|
6234
6267
|
n = n.extend(e);
|
|
6235
|
-
if (!Y$
|
|
6268
|
+
if (!Y$2(n.firstPoint, n.lastPoint))
|
|
6236
6269
|
throw console.error(
|
|
6237
6270
|
Z$1(n.firstPoint),
|
|
6238
6271
|
Z$1(n.lastPoint)
|
|
6239
6272
|
), new Error("Bug in the intersection algo on non closing strand");
|
|
6240
|
-
return new
|
|
6273
|
+
return new _$2(n.segments);
|
|
6241
6274
|
}
|
|
6242
|
-
function
|
|
6275
|
+
function oe(t, n) {
|
|
6243
6276
|
const e = Kt([
|
|
6244
6277
|
n.slice(0, -1),
|
|
6245
6278
|
n.slice(1)
|
|
6246
|
-
]).map(([i, o]) =>
|
|
6279
|
+
]).map(([i, o]) => Ot(t.slice(i, o)));
|
|
6247
6280
|
let s = t.slice(
|
|
6248
6281
|
n[n.length - 1]
|
|
6249
6282
|
);
|
|
6250
|
-
return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(
|
|
6283
|
+
return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(Ot(s)), e;
|
|
6251
6284
|
}
|
|
6252
|
-
function
|
|
6285
|
+
function re(t) {
|
|
6253
6286
|
if (!t.length) return [];
|
|
6254
6287
|
const n = t.map((i) => i.firstPoint);
|
|
6255
6288
|
let e = t.map((i) => i.lastPoint);
|
|
6256
6289
|
e = e.slice(-1).concat(e.slice(0, -1));
|
|
6257
6290
|
const s = Kt([n, e]).flatMap(
|
|
6258
|
-
([i, o],
|
|
6291
|
+
([i, o], l) => Y$2(i, o) ? [] : l
|
|
6259
6292
|
);
|
|
6260
6293
|
try {
|
|
6261
|
-
return
|
|
6294
|
+
return oe(t, s);
|
|
6262
6295
|
} catch {
|
|
6263
|
-
return
|
|
6296
|
+
return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$2(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new _$2(o));
|
|
6264
6297
|
}
|
|
6265
6298
|
}
|
|
6266
6299
|
const _t = (t, n) => {
|
|
6267
6300
|
if (t.length === 0) return [n];
|
|
6268
6301
|
const e = t.at(-1);
|
|
6269
|
-
return Y$
|
|
6270
|
-
},
|
|
6271
|
-
function
|
|
6302
|
+
return Y$2(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$2(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
|
|
6303
|
+
}, le = (t, n) => t.length === 0 ? [n] : Y$2(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
|
|
6304
|
+
function pt(t, n, {
|
|
6272
6305
|
firstInside: e,
|
|
6273
|
-
secondInside: s
|
|
6306
|
+
secondInside: s,
|
|
6307
|
+
firstBoundaryInside: i = !1,
|
|
6308
|
+
secondBoundaryInside: o = !1
|
|
6274
6309
|
}) {
|
|
6275
|
-
const
|
|
6276
|
-
|
|
6277
|
-
|
|
6310
|
+
const l = ie(
|
|
6311
|
+
t,
|
|
6312
|
+
n,
|
|
6313
|
+
void 0,
|
|
6314
|
+
i || o
|
|
6315
|
+
);
|
|
6316
|
+
if (!l) {
|
|
6317
|
+
const f = t.segments[0].midPoint, c = n.contains(f, {
|
|
6318
|
+
strokeIsInside: o
|
|
6319
|
+
}), h = n.segments[0].midPoint, p = t.contains(h, {
|
|
6320
|
+
strokeIsInside: i
|
|
6321
|
+
});
|
|
6278
6322
|
return {
|
|
6279
6323
|
identical: !1,
|
|
6280
|
-
firstCurveInSecond:
|
|
6281
|
-
secondCurveInFirst:
|
|
6324
|
+
firstCurveInSecond: c,
|
|
6325
|
+
secondCurveInFirst: p
|
|
6282
6326
|
};
|
|
6283
6327
|
}
|
|
6284
|
-
if (
|
|
6328
|
+
if (l.every(([, f]) => f === "same"))
|
|
6285
6329
|
return { identical: !0 };
|
|
6286
|
-
let
|
|
6287
|
-
const
|
|
6288
|
-
let
|
|
6289
|
-
if (
|
|
6290
|
-
return
|
|
6291
|
-
const
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
}
|
|
6298
|
-
|
|
6330
|
+
let r = null, u = null;
|
|
6331
|
+
const a = l.flatMap(([f, c]) => {
|
|
6332
|
+
let h = [], p = 0;
|
|
6333
|
+
if (c === "same")
|
|
6334
|
+
return u === 1 ? (u = 1, f) : u === 2 || u === 0 ? (u = null, []) : u === null ? (r ? r = r.extend(f) : r = f, []) : (console.error("weird situation"), []);
|
|
6335
|
+
const d = f.segments[0].midPoint, m = n.contains(d, {
|
|
6336
|
+
strokeIsInside: o
|
|
6337
|
+
});
|
|
6338
|
+
(e === "keep" && m || e === "remove" && !m) && (p += 1, h = _t(h, f));
|
|
6339
|
+
const x = c.segments[0].midPoint, g = t.contains(x, {
|
|
6340
|
+
strokeIsInside: i
|
|
6341
|
+
});
|
|
6342
|
+
if (s === "keep" && g || s === "remove" && !g) {
|
|
6343
|
+
const w = c;
|
|
6344
|
+
p += 1, p === 2 && h.length ? (h = _t(h, w), r = null) : h = [w];
|
|
6345
|
+
}
|
|
6346
|
+
return u === null && p === 1 && r && (h = le(h, r)), p === 1 && (u = p, r = null), h.length ? h : (r = null, []);
|
|
6299
6347
|
});
|
|
6300
|
-
return
|
|
6348
|
+
return re(a);
|
|
6301
6349
|
}
|
|
6302
|
-
const
|
|
6303
|
-
const
|
|
6350
|
+
const ue = (t, n, e) => {
|
|
6351
|
+
const s = pt(t, n, {
|
|
6304
6352
|
firstInside: "remove",
|
|
6305
|
-
secondInside: "remove"
|
|
6353
|
+
secondInside: "remove",
|
|
6354
|
+
...e
|
|
6306
6355
|
});
|
|
6307
|
-
return Array.isArray(
|
|
6308
|
-
},
|
|
6309
|
-
const
|
|
6356
|
+
return Array.isArray(s) ? s : s.identical ? [t] : s.firstCurveInSecond ? [n] : s.secondCurveInFirst ? [t] : [t, n];
|
|
6357
|
+
}, tt$2 = (t, n, e) => {
|
|
6358
|
+
const s = pt(t, n, {
|
|
6310
6359
|
firstInside: "remove",
|
|
6311
|
-
secondInside: "keep"
|
|
6360
|
+
secondInside: "keep",
|
|
6361
|
+
...e
|
|
6312
6362
|
});
|
|
6313
|
-
return Array.isArray(
|
|
6314
|
-
},
|
|
6315
|
-
const e =
|
|
6363
|
+
return Array.isArray(s) ? s : s.identical ? [] : s.firstCurveInSecond ? [] : s.secondCurveInFirst ? [t, n] : [t];
|
|
6364
|
+
}, dt = (t, n, e) => {
|
|
6365
|
+
const s = (e == null ? void 0 : e.firstBoundaryInside) ?? !1, i = (e == null ? void 0 : e.secondBoundaryInside) ?? !1, o = s || i, l = (u, a, f) => u.segments.every(
|
|
6366
|
+
(c) => a.contains(c.midPoint, { strokeIsInside: f })
|
|
6367
|
+
);
|
|
6368
|
+
if (o) {
|
|
6369
|
+
if (l(t, n, i))
|
|
6370
|
+
return [t];
|
|
6371
|
+
if (l(n, t, s))
|
|
6372
|
+
return [n];
|
|
6373
|
+
}
|
|
6374
|
+
const r = pt(t, n, {
|
|
6316
6375
|
firstInside: "keep",
|
|
6317
|
-
secondInside: "keep"
|
|
6376
|
+
secondInside: "keep",
|
|
6377
|
+
...e
|
|
6318
6378
|
});
|
|
6319
|
-
return Array.isArray(
|
|
6379
|
+
return Array.isArray(r) ? r : r.identical ? [t] : r.firstCurveInSecond ? [t] : r.secondCurveInFirst ? [n] : [];
|
|
6320
6380
|
};
|
|
6321
|
-
function
|
|
6381
|
+
function ce(t) {
|
|
6322
6382
|
const n = /* @__PURE__ */ new Map(), e = [];
|
|
6323
6383
|
return t.forEach((s, i) => {
|
|
6324
6384
|
let o;
|
|
6325
|
-
n.has(i) ? o = n.get(i) : (o = { current: [s], fusedWith: /* @__PURE__ */ new Set([i]) }, e.push(o)), t.slice(i + 1).forEach((
|
|
6326
|
-
const
|
|
6385
|
+
n.has(i) ? o = n.get(i) : (o = { current: [s], fusedWith: /* @__PURE__ */ new Set([i]) }, e.push(o)), t.slice(i + 1).forEach((l, r) => {
|
|
6386
|
+
const u = o.current, a = i + r + 1;
|
|
6327
6387
|
if (o.fusedWith.has(a)) return;
|
|
6328
|
-
let f = [
|
|
6329
|
-
if (n.has(a) && (f = n.get(a).current,
|
|
6388
|
+
let f = [l], c = !1;
|
|
6389
|
+
if (n.has(a) && (f = n.get(a).current, c = !0), !u.some(
|
|
6330
6390
|
(d) => f.some((m) => d.intersects(m))
|
|
6331
6391
|
)) return;
|
|
6332
6392
|
let p;
|
|
6333
|
-
|
|
6393
|
+
u.length > 1 || f.length > 1 ? p = G(u, f) : p = Qt(u[0], f[0]), o.fusedWith.add(a), o.current = p, c || n.set(a, o);
|
|
6334
6394
|
});
|
|
6335
6395
|
}), e.flatMap(({ current: s }) => s);
|
|
6336
6396
|
}
|
|
6337
|
-
function
|
|
6338
|
-
const e =
|
|
6339
|
-
([
|
|
6397
|
+
function Qt(t, n) {
|
|
6398
|
+
const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt$2(l, t.contour)), i = t.holes.flatMap((l) => tt$2(l, n.contour)), o = ee(t.holes, n.holes).flatMap(
|
|
6399
|
+
([l, r]) => dt(l, r)
|
|
6340
6400
|
);
|
|
6341
|
-
return X$
|
|
6401
|
+
return X$2([
|
|
6342
6402
|
...e,
|
|
6343
6403
|
...s,
|
|
6344
6404
|
...i,
|
|
6345
6405
|
...o
|
|
6346
6406
|
]);
|
|
6347
6407
|
}
|
|
6348
|
-
function
|
|
6408
|
+
function nt$1(t, n) {
|
|
6349
6409
|
if (t.isFull && n.isFull)
|
|
6350
|
-
return X$
|
|
6410
|
+
return X$2(tt$2(t.contour, n.contour));
|
|
6351
6411
|
if (t.isFull) {
|
|
6352
|
-
const s =
|
|
6353
|
-
(o) =>
|
|
6412
|
+
const s = tt$2(t.contour, n.contour), i = n.holes.flatMap(
|
|
6413
|
+
(o) => dt(o, t.contour, { firstBoundaryInside: !0 })
|
|
6354
6414
|
);
|
|
6355
|
-
return X$
|
|
6415
|
+
return X$2([...s, ...i]);
|
|
6356
6416
|
} else if (n.isFull && !t.contour.intersects(n.contour))
|
|
6357
6417
|
if (t.contour.contains(n.contour.firstPoint)) {
|
|
6358
6418
|
const s = G(
|
|
6359
|
-
t.holes.map((i) => new v$
|
|
6419
|
+
t.holes.map((i) => new v$2(i)),
|
|
6360
6420
|
[n]
|
|
6361
6421
|
);
|
|
6362
|
-
return X$
|
|
6422
|
+
return X$2([
|
|
6363
6423
|
t.contour,
|
|
6364
6424
|
...s.flatMap((i) => i.allLoops)
|
|
6365
6425
|
]);
|
|
6366
6426
|
} else
|
|
6367
6427
|
return [t];
|
|
6368
|
-
let e =
|
|
6428
|
+
let e = nt$1(new v$2(t.contour), n);
|
|
6369
6429
|
return t.holes.forEach((s) => {
|
|
6370
|
-
e = e.flatMap((i) =>
|
|
6430
|
+
e = e.flatMap((i) => nt$1(i, new v$2(s)));
|
|
6371
6431
|
}), e;
|
|
6372
6432
|
}
|
|
6373
|
-
function
|
|
6374
|
-
const e =
|
|
6433
|
+
function ae(t, n) {
|
|
6434
|
+
const e = dt(t.contour, n.contour);
|
|
6375
6435
|
if (!e.length) return [];
|
|
6376
|
-
let s = X$
|
|
6436
|
+
let s = X$2(e);
|
|
6377
6437
|
return s = Q$1(
|
|
6378
6438
|
s,
|
|
6379
|
-
t.holes.map((i) => new v$
|
|
6439
|
+
t.holes.map((i) => new v$2(i))
|
|
6380
6440
|
), Q$1(
|
|
6381
6441
|
s,
|
|
6382
|
-
n.holes.map((i) => new v$
|
|
6442
|
+
n.holes.map((i) => new v$2(i))
|
|
6383
6443
|
);
|
|
6384
6444
|
}
|
|
6385
6445
|
function G(t, n) {
|
|
6386
6446
|
if (!t.length) return n;
|
|
6387
6447
|
if (!n.length) return t;
|
|
6388
6448
|
if (t.length === 1 && n.length > 1 || n.length === 1 && t.length > 1)
|
|
6389
|
-
return
|
|
6449
|
+
return ce([...t, ...n]);
|
|
6390
6450
|
if (t.length > 1 && n.length > 1) {
|
|
6391
6451
|
let e = G([t[0]], n);
|
|
6392
6452
|
return t.slice(1).forEach((s) => {
|
|
6393
6453
|
e = G([s], e);
|
|
6394
6454
|
}), e;
|
|
6395
6455
|
}
|
|
6396
|
-
return t.length === 1 && n.length === 1 ?
|
|
6456
|
+
return t.length === 1 && n.length === 1 ? Qt(t[0], n[0]) : [];
|
|
6397
6457
|
}
|
|
6398
6458
|
function Q$1(t, n) {
|
|
6399
6459
|
if (!t.length) return [];
|
|
6400
6460
|
if (!n.length) return t;
|
|
6401
6461
|
if (t.length === 1 && n.length === 1)
|
|
6402
|
-
return
|
|
6462
|
+
return nt$1(t[0], n[0]);
|
|
6403
6463
|
if (t.length > 1)
|
|
6404
6464
|
return t.flatMap((s) => Q$1([s], n));
|
|
6405
|
-
let e =
|
|
6465
|
+
let e = nt$1(t[0], n[0]);
|
|
6406
6466
|
return n.slice(1).forEach((s) => {
|
|
6407
6467
|
e = Q$1(e, [s]);
|
|
6408
6468
|
}), e;
|
|
6409
6469
|
}
|
|
6410
|
-
function
|
|
6411
|
-
return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ?
|
|
6470
|
+
function lt$2(t, n) {
|
|
6471
|
+
return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$2([e], n)) : n.flatMap((e) => lt$2(t, [e]));
|
|
6412
6472
|
}
|
|
6413
|
-
let
|
|
6473
|
+
let O$2 = class O extends Ze {
|
|
6414
6474
|
constructor(e = [], { ignoreChecks: s = !1 } = {}) {
|
|
6415
6475
|
super();
|
|
6416
6476
|
C(this, "figures");
|
|
6417
6477
|
C(this, "_boundingBox", null);
|
|
6418
|
-
s ||
|
|
6478
|
+
s || fe(e), this.figures = e;
|
|
6419
6479
|
}
|
|
6420
6480
|
get isEmpty() {
|
|
6421
6481
|
return this.figures.length === 0;
|
|
6422
6482
|
}
|
|
6423
6483
|
get boundingBox() {
|
|
6424
|
-
if (this.isEmpty) return new mt$
|
|
6484
|
+
if (this.isEmpty) return new mt$1();
|
|
6425
6485
|
if (this._boundingBox === null) {
|
|
6426
6486
|
let e = this.figures[0].boundingBox;
|
|
6427
6487
|
for (const s of this.figures.slice(1))
|
|
@@ -6431,13 +6491,15 @@ let _$2 = class _ extends Ze {
|
|
|
6431
6491
|
return this._boundingBox;
|
|
6432
6492
|
}
|
|
6433
6493
|
clone() {
|
|
6434
|
-
return new
|
|
6494
|
+
return new O(this.figures.map((e) => e.clone()));
|
|
6435
6495
|
}
|
|
6436
6496
|
transform(e) {
|
|
6437
|
-
return new
|
|
6497
|
+
return new O(this.figures.map((s) => s.transform(e)));
|
|
6438
6498
|
}
|
|
6439
|
-
contains(e) {
|
|
6440
|
-
return this.figures.some(
|
|
6499
|
+
contains(e, { strokeIsInside: s = !1 } = {}) {
|
|
6500
|
+
return this.figures.some(
|
|
6501
|
+
(i) => i.contains(e, { strokeIsInside: s })
|
|
6502
|
+
);
|
|
6441
6503
|
}
|
|
6442
6504
|
intersects(e) {
|
|
6443
6505
|
return this.figures.some(
|
|
@@ -6445,30 +6507,30 @@ let _$2 = class _ extends Ze {
|
|
|
6445
6507
|
);
|
|
6446
6508
|
}
|
|
6447
6509
|
overlappingStrands(e) {
|
|
6448
|
-
return this.figures.flatMap((s) => e instanceof
|
|
6510
|
+
return this.figures.flatMap((s) => e instanceof O ? e.figures.flatMap(
|
|
6449
6511
|
(i) => s.overlappingStrands(i)
|
|
6450
6512
|
) : s.overlappingStrands(e));
|
|
6451
6513
|
}
|
|
6452
6514
|
fuse(e) {
|
|
6453
|
-
return new
|
|
6515
|
+
return new O(G(this.figures, e.figures));
|
|
6454
6516
|
}
|
|
6455
6517
|
cut(e) {
|
|
6456
|
-
return new
|
|
6518
|
+
return new O(Q$1(this.figures, e.figures));
|
|
6457
6519
|
}
|
|
6458
6520
|
intersect(e) {
|
|
6459
|
-
return new
|
|
6521
|
+
return new O(lt$2(this.figures, e.figures));
|
|
6460
6522
|
}
|
|
6461
6523
|
};
|
|
6462
|
-
function
|
|
6463
|
-
for (const [n, e] of
|
|
6524
|
+
function fe(t) {
|
|
6525
|
+
for (const [n, e] of it$2(t))
|
|
6464
6526
|
if (n.intersects(e))
|
|
6465
6527
|
throw new Error("Diagram figures must not intersect");
|
|
6466
6528
|
}
|
|
6467
6529
|
|
|
6468
|
-
var W$
|
|
6469
|
-
var q$1 = (e, t, n) => t in e ? W$
|
|
6470
|
-
var m = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
|
|
6471
|
-
const B$
|
|
6530
|
+
var W$2 = Object.defineProperty;
|
|
6531
|
+
var q$1 = (e, t, n) => t in e ? W$2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6532
|
+
var m$1 = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
|
|
6533
|
+
const B$2 = (e, t, n) => {
|
|
6472
6534
|
const r = St$2(e.V, t.V), i = e.precision * t.precision;
|
|
6473
6535
|
if (r * r < i)
|
|
6474
6536
|
return "parallel";
|
|
@@ -6481,33 +6543,33 @@ class S {
|
|
|
6481
6543
|
}
|
|
6482
6544
|
}
|
|
6483
6545
|
function y(e, t) {
|
|
6484
|
-
if (e instanceof at$
|
|
6485
|
-
return et$
|
|
6486
|
-
if (e instanceof ct$
|
|
6487
|
-
return rt$
|
|
6546
|
+
if (e instanceof at$3)
|
|
6547
|
+
return et$2(e, t);
|
|
6548
|
+
if (e instanceof ct$3)
|
|
6549
|
+
return rt$2(e, t);
|
|
6488
6550
|
if (e instanceof _t$1 || e instanceof Et$1)
|
|
6489
6551
|
return it$1(e, t);
|
|
6490
6552
|
throw new Error("Not implemented");
|
|
6491
6553
|
}
|
|
6492
|
-
function et$
|
|
6554
|
+
function et$2(e, t) {
|
|
6493
6555
|
const { firstPoint: n, lastPoint: r } = e, i = e.normalVector;
|
|
6494
|
-
return new at$
|
|
6556
|
+
return new at$3(
|
|
6495
6557
|
it$3(n, nt$2(i, t)),
|
|
6496
6558
|
it$3(r, nt$2(i, t))
|
|
6497
6559
|
);
|
|
6498
6560
|
}
|
|
6499
|
-
function rt$
|
|
6561
|
+
function rt$2(e, t) {
|
|
6500
6562
|
const n = it$3(
|
|
6501
6563
|
e.firstPoint,
|
|
6502
|
-
nt$2(tt$
|
|
6564
|
+
nt$2(tt$3(e.tangentAtFirstPoint), t)
|
|
6503
6565
|
), r = it$3(
|
|
6504
6566
|
e.lastPoint,
|
|
6505
|
-
nt$2(tt$
|
|
6567
|
+
nt$2(tt$3(e.tangentAtLastPoint), t)
|
|
6506
6568
|
), i = t * (e.clockwise ? 1 : -1);
|
|
6507
|
-
return e.radius + i < e.precision ? new S(n, r) : new ct$
|
|
6569
|
+
return e.radius + i < e.precision ? new S(n, r) : new ct$3(n, r, e.center, e.clockwise);
|
|
6508
6570
|
}
|
|
6509
6571
|
function b(e, t, n, r, i) {
|
|
6510
|
-
const s = B$
|
|
6572
|
+
const s = B$2(
|
|
6511
6573
|
{
|
|
6512
6574
|
V: n,
|
|
6513
6575
|
firstPoint: r,
|
|
@@ -6526,7 +6588,7 @@ function b(e, t, n, r, i) {
|
|
|
6526
6588
|
return s;
|
|
6527
6589
|
}
|
|
6528
6590
|
function it$1(e, t) {
|
|
6529
|
-
const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$
|
|
6591
|
+
const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$2(
|
|
6530
6592
|
{ V: i, firstPoint: n, precision: e.precision },
|
|
6531
6593
|
{ V: s, firstPoint: r, precision: e.precision }
|
|
6532
6594
|
), a = it$3(
|
|
@@ -6539,8 +6601,8 @@ function it$1(e, t) {
|
|
|
6539
6601
|
if (o === "parallel")
|
|
6540
6602
|
throw new Error("Parallel lines not expected in safe bezier offset");
|
|
6541
6603
|
if (Pe(Q$2(o, n), i) * t > 0 && Math.min(
|
|
6542
|
-
J$
|
|
6543
|
-
J$
|
|
6604
|
+
J$3(n, o),
|
|
6605
|
+
J$3(r, o)
|
|
6544
6606
|
) < t)
|
|
6545
6607
|
return new S(a, h);
|
|
6546
6608
|
if (e instanceof _t$1) {
|
|
@@ -6588,14 +6650,14 @@ function M(e, t, n) {
|
|
|
6588
6650
|
return null;
|
|
6589
6651
|
let h;
|
|
6590
6652
|
try {
|
|
6591
|
-
h =
|
|
6653
|
+
h = de(o, a, 1e-9).at(-1);
|
|
6592
6654
|
} catch {
|
|
6593
6655
|
return null;
|
|
6594
6656
|
}
|
|
6595
6657
|
if (!h)
|
|
6596
6658
|
return null;
|
|
6597
6659
|
const c = h, p = (v, O) => {
|
|
6598
|
-
const I = O.tangentAt(c), N = Qt(I), Y = it$3(c, nt$2(N, s));
|
|
6660
|
+
const I = O.tangentAt(c), N = Qt$1(I), Y = it$3(c, nt$2(N, s));
|
|
6599
6661
|
return v.splitAt(Y);
|
|
6600
6662
|
}, [f] = p(e, o), [, g] = p(t, a);
|
|
6601
6663
|
return { first: f, second: g, center: c };
|
|
@@ -6624,7 +6686,7 @@ function _$1(e, t, n) {
|
|
|
6624
6686
|
t.repr
|
|
6625
6687
|
), [e, t];
|
|
6626
6688
|
const { first: i, second: s } = r;
|
|
6627
|
-
return [i, new at$
|
|
6689
|
+
return [i, new at$3(i.lastPoint, s.firstPoint), s];
|
|
6628
6690
|
}
|
|
6629
6691
|
const st$1 = (e) => {
|
|
6630
6692
|
let t;
|
|
@@ -6636,19 +6698,19 @@ const st$1 = (e) => {
|
|
|
6636
6698
|
startTangent: s
|
|
6637
6699
|
} = t;
|
|
6638
6700
|
let o;
|
|
6639
|
-
typeof n == "number" ? o = Tt(1, n * fe) : o = n;
|
|
6701
|
+
typeof n == "number" ? o = Tt(1, n * fe$1) : o = n;
|
|
6640
6702
|
let a;
|
|
6641
|
-
return typeof s == "number" ? a = Tt(1, s * fe) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
|
|
6703
|
+
return typeof s == "number" ? a = Tt(1, s * fe$1) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
|
|
6642
6704
|
};
|
|
6643
|
-
function z$
|
|
6644
|
-
return new
|
|
6705
|
+
function z$2(e, { ignoreChecks: t = !1 } = {}) {
|
|
6706
|
+
return new O$2([new v$2(new _$2([...e], { ignoreChecks: t }))]);
|
|
6645
6707
|
}
|
|
6646
|
-
let ot$
|
|
6708
|
+
let ot$2 = class ot {
|
|
6647
6709
|
constructor(t = [0, 0]) {
|
|
6648
|
-
m(this, "pointer");
|
|
6649
|
-
m(this, "firstPoint");
|
|
6650
|
-
m(this, "pendingSegments");
|
|
6651
|
-
m(this, "_nextCorner");
|
|
6710
|
+
m$1(this, "pointer");
|
|
6711
|
+
m$1(this, "firstPoint");
|
|
6712
|
+
m$1(this, "pendingSegments");
|
|
6713
|
+
m$1(this, "_nextCorner");
|
|
6652
6714
|
this.pointer = t, this.firstPoint = t, this.pendingSegments = [], this._nextCorner = null;
|
|
6653
6715
|
}
|
|
6654
6716
|
movePointerTo(t) {
|
|
@@ -6659,7 +6721,7 @@ let ot$1 = class ot {
|
|
|
6659
6721
|
return this.pointer = t, this.firstPoint = t, this;
|
|
6660
6722
|
}
|
|
6661
6723
|
saveSegment(t) {
|
|
6662
|
-
if (Y$
|
|
6724
|
+
if (Y$2(t.firstPoint, t.lastPoint))
|
|
6663
6725
|
throw new Error(`Segment has no length, ${t.repr}`);
|
|
6664
6726
|
if (!this._nextCorner)
|
|
6665
6727
|
return this.pendingSegments.push(t), this;
|
|
@@ -6671,7 +6733,7 @@ let ot$1 = class ot {
|
|
|
6671
6733
|
), this._nextCorner = null, this;
|
|
6672
6734
|
}
|
|
6673
6735
|
lineTo(t) {
|
|
6674
|
-
const n = new at$
|
|
6736
|
+
const n = new at$3(this.pointer, t);
|
|
6675
6737
|
return this.pointer = t, this.saveSegment(n);
|
|
6676
6738
|
}
|
|
6677
6739
|
line(t, n) {
|
|
@@ -6690,11 +6752,11 @@ let ot$1 = class ot {
|
|
|
6690
6752
|
return this.lineTo([t, this.pointer[1]]);
|
|
6691
6753
|
}
|
|
6692
6754
|
polarLineTo([t, n]) {
|
|
6693
|
-
const r = n * fe, i = Tt(t, r);
|
|
6755
|
+
const r = n * fe$1, i = Tt(t, r);
|
|
6694
6756
|
return this.lineTo(i);
|
|
6695
6757
|
}
|
|
6696
6758
|
polarLine(t, n) {
|
|
6697
|
-
const r = n * fe, [i, s] = Tt(t, r);
|
|
6759
|
+
const r = n * fe$1, [i, s] = Tt(t, r);
|
|
6698
6760
|
return this.line(i, s);
|
|
6699
6761
|
}
|
|
6700
6762
|
tangentLine(t) {
|
|
@@ -6716,7 +6778,7 @@ let ot$1 = class ot {
|
|
|
6716
6778
|
}
|
|
6717
6779
|
sagittaArcTo(t, n) {
|
|
6718
6780
|
if (!n) return this.lineTo(t);
|
|
6719
|
-
const r = new at$
|
|
6781
|
+
const r = new at$3(this.pointer, t), i = tt$3(r.tangentAtFirstPoint), s = it$3(r.midPoint, nt$2(i, n));
|
|
6720
6782
|
return this.threePointsArcTo(t, s);
|
|
6721
6783
|
}
|
|
6722
6784
|
sagittaArc(t, n, r) {
|
|
@@ -6733,7 +6795,7 @@ let ot$1 = class ot {
|
|
|
6733
6795
|
}
|
|
6734
6796
|
bulgeArcTo(t, n) {
|
|
6735
6797
|
if (!n) return this.lineTo(t);
|
|
6736
|
-
const r = J$
|
|
6798
|
+
const r = J$3(this.pointer, t) / 2, i = -n * r;
|
|
6737
6799
|
return this.sagittaArcTo(t, i);
|
|
6738
6800
|
}
|
|
6739
6801
|
bulgeArc(t, n, r) {
|
|
@@ -6766,7 +6828,7 @@ let ot$1 = class ot {
|
|
|
6766
6828
|
}
|
|
6767
6829
|
ellipseTo(t, n, r, i, s, o) {
|
|
6768
6830
|
return this.saveSegment(
|
|
6769
|
-
pn$
|
|
6831
|
+
pn$1(this.pointer, t, n, r, i, s, o)
|
|
6770
6832
|
), this.pointer = t, this;
|
|
6771
6833
|
}
|
|
6772
6834
|
ellipse(t, n, r, i, s, o, a) {
|
|
@@ -6805,7 +6867,7 @@ let ot$1 = class ot {
|
|
|
6805
6867
|
return this.saveSegment(new _t$1(this.pointer, t, n)), this.pointer = t, this;
|
|
6806
6868
|
}
|
|
6807
6869
|
smoothCurveTo(t, n) {
|
|
6808
|
-
const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$
|
|
6870
|
+
const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$3(this.pointer, t) / 3;
|
|
6809
6871
|
let c;
|
|
6810
6872
|
i ? c = i : a ? c = a.tangentAtLastPoint : c = [1, 0], c = H$1(c);
|
|
6811
6873
|
const p = [
|
|
@@ -6842,66 +6904,425 @@ let ot$1 = class ot {
|
|
|
6842
6904
|
close(t = !1) {
|
|
6843
6905
|
if (!this.pendingSegments.length) throw new Error("No segments to close");
|
|
6844
6906
|
const n = this.pendingSegments[0], r = this.pendingSegments.at(-1);
|
|
6845
|
-
return Y$
|
|
6907
|
+
return Y$2(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
|
|
6846
6908
|
this._nextCorner.radius,
|
|
6847
6909
|
this._nextCorner.mode
|
|
6848
|
-
), this._nextCorner = null), z$
|
|
6910
|
+
), this._nextCorner = null), z$2(this.pendingSegments, { ignoreChecks: t });
|
|
6849
6911
|
}
|
|
6850
6912
|
closeWithMirror(t = !1) {
|
|
6851
6913
|
if (!this.pendingSegments.length) throw new Error("No segments to close");
|
|
6852
6914
|
const n = this.pendingSegments[0], r = this.pendingSegments.at(-1), i = Q$2(
|
|
6853
6915
|
r.lastPoint,
|
|
6854
6916
|
n.firstPoint
|
|
6855
|
-
), s = new et$
|
|
6917
|
+
), s = new et$4().mirrorLine(
|
|
6856
6918
|
i,
|
|
6857
6919
|
n.firstPoint
|
|
6858
6920
|
), o = this.pendingSegments.map(
|
|
6859
6921
|
(a) => a.transform(s).reverse()
|
|
6860
6922
|
);
|
|
6861
|
-
return o.reverse(), z$
|
|
6923
|
+
return o.reverse(), z$2(
|
|
6862
6924
|
[...this.pendingSegments, ...o],
|
|
6863
6925
|
{ ignoreChecks: t }
|
|
6864
6926
|
);
|
|
6865
6927
|
}
|
|
6866
6928
|
asStrand() {
|
|
6867
|
-
return new B$
|
|
6929
|
+
return new B$3([...this.pendingSegments]);
|
|
6868
6930
|
}
|
|
6869
6931
|
get isClosed() {
|
|
6870
6932
|
var t;
|
|
6871
|
-
return Y$
|
|
6933
|
+
return Y$2(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
|
|
6872
6934
|
}
|
|
6873
6935
|
};
|
|
6874
|
-
function lt(e = [0, 0]) {
|
|
6875
|
-
return new ot$
|
|
6936
|
+
function lt$1(e = [0, 0]) {
|
|
6937
|
+
return new ot$2(e);
|
|
6876
6938
|
}
|
|
6877
6939
|
|
|
6878
|
-
function
|
|
6879
|
-
return lt([-
|
|
6880
|
-
}
|
|
6881
|
-
function
|
|
6882
|
-
const { rx:
|
|
6883
|
-
let n = Math.min(
|
|
6884
|
-
const
|
|
6885
|
-
|
|
6886
|
-
const
|
|
6887
|
-
|
|
6940
|
+
function ct$1(c) {
|
|
6941
|
+
return lt$1([-c, 0]).sagittaArc(2 * c, 0, c).sagittaArc(-2 * c, 0, c).close();
|
|
6942
|
+
}
|
|
6943
|
+
function ot$1(c, e, t = 0) {
|
|
6944
|
+
const { rx: a = 0, ry: o = 0 } = typeof t == "number" ? { ry: t, rx: t } : t;
|
|
6945
|
+
let n = Math.min(a ?? t ?? 0, c / 2), r = Math.min(o ?? t ?? 0, e / 2);
|
|
6946
|
+
const s = n && r;
|
|
6947
|
+
s || (n = 0, r = 0);
|
|
6948
|
+
const h = n === r, f = lt$1([Math.min(0, -(c / 2 - n)), -e / 2]), l = (k, i) => {
|
|
6949
|
+
s && (h ? f.tangentArc(k, i) : f.ellipse(k, i, n, r, 0, !1, !1));
|
|
6888
6950
|
};
|
|
6889
|
-
return n <
|
|
6951
|
+
return n < c / 2 && f.hLine(c - 2 * n), l(n, r), r < e / 2 && f.vLine(e - 2 * r), l(-n, r), n < c / 2 && f.hLine(-(c - 2 * n)), l(-n, -r), r < e / 2 && f.vLine(-(e - 2 * r)), l(n, -r), f.close();
|
|
6952
|
+
}
|
|
6953
|
+
function rt$1(c, e) {
|
|
6954
|
+
const t = lt$1([-c, 0]);
|
|
6955
|
+
return t.halfEllipse(2 * c, 0, e), t.halfEllipse(-2 * c, 0, e), t.close();
|
|
6956
|
+
}
|
|
6957
|
+
function lt(c, e, t) {
|
|
6958
|
+
const a = Je(e).map((n) => {
|
|
6959
|
+
const r = -(Math.PI * 2 / e) * n;
|
|
6960
|
+
return [c * Math.sin(r), c * Math.cos(r)];
|
|
6961
|
+
});
|
|
6962
|
+
let o = lt$1(a[a.length - 1]);
|
|
6963
|
+
for (const n of a)
|
|
6964
|
+
t ? o = o.sagittaArcTo(n, t) : o = o.lineTo(n);
|
|
6965
|
+
return o.close();
|
|
6966
|
+
}
|
|
6967
|
+
const N = 0, $ = 1, B$1 = 2, m = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
|
|
6968
|
+
function U(c) {
|
|
6969
|
+
const e = new Array();
|
|
6970
|
+
for (; c !== ""; )
|
|
6971
|
+
if (c.match(/^([ \t\r\n,]+)/))
|
|
6972
|
+
c = c.substr(RegExp.$1.length);
|
|
6973
|
+
else if (c.match(/^([aAcChHlLmMqQsStTvVzZ])/))
|
|
6974
|
+
e[e.length] = { type: N, text: RegExp.$1 }, c = c.substr(RegExp.$1.length);
|
|
6975
|
+
else if (c.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))
|
|
6976
|
+
e[e.length] = { type: $, text: `${parseFloat(RegExp.$1)}` }, c = c.substr(RegExp.$1.length);
|
|
6977
|
+
else
|
|
6978
|
+
return [];
|
|
6979
|
+
return e[e.length] = { type: B$1, text: "" }, e;
|
|
6980
|
+
}
|
|
6981
|
+
function z$1(c, e) {
|
|
6982
|
+
return c.type === e;
|
|
6983
|
+
}
|
|
6984
|
+
function O$1(c) {
|
|
6985
|
+
const e = [], t = U(c);
|
|
6986
|
+
let a = "BOD", o = 0, n = t[o];
|
|
6987
|
+
for (; !z$1(n, B$1); ) {
|
|
6988
|
+
let r = 0;
|
|
6989
|
+
const s = [];
|
|
6990
|
+
if (a === "BOD")
|
|
6991
|
+
if (n.text === "M" || n.text === "m")
|
|
6992
|
+
o++, r = m[n.text], a = n.text;
|
|
6993
|
+
else
|
|
6994
|
+
return O$1("M0,0" + c);
|
|
6995
|
+
else z$1(n, $) ? r = m[a] : (o++, r = m[n.text], a = n.text);
|
|
6996
|
+
if (o + r < t.length) {
|
|
6997
|
+
for (let h = o; h < o + r; h++) {
|
|
6998
|
+
const f = t[h];
|
|
6999
|
+
if (z$1(f, $))
|
|
7000
|
+
s[s.length] = +f.text;
|
|
7001
|
+
else
|
|
7002
|
+
throw new Error("Param not a number: " + a + "," + f.text);
|
|
7003
|
+
}
|
|
7004
|
+
if (typeof m[a] == "number") {
|
|
7005
|
+
const h = { key: a, data: s };
|
|
7006
|
+
e.push(h), o += r, n = t[o], a === "M" && (a = "L"), a === "m" && (a = "l");
|
|
7007
|
+
} else
|
|
7008
|
+
throw new Error("Bad segment: " + a);
|
|
7009
|
+
} else
|
|
7010
|
+
throw new Error("Path data ended short");
|
|
7011
|
+
}
|
|
7012
|
+
return e;
|
|
7013
|
+
}
|
|
7014
|
+
function X$1(c) {
|
|
7015
|
+
const e = [];
|
|
7016
|
+
for (const { key: t, data: a } of c)
|
|
7017
|
+
switch (e.push(t), t) {
|
|
7018
|
+
case "C":
|
|
7019
|
+
case "c":
|
|
7020
|
+
e.push(a[0], `${a[1]},`, a[2], `${a[3]},`, a[4], a[5]);
|
|
7021
|
+
break;
|
|
7022
|
+
case "S":
|
|
7023
|
+
case "s":
|
|
7024
|
+
case "Q":
|
|
7025
|
+
case "q":
|
|
7026
|
+
e.push(a[0], `${a[1]},`, a[2], a[3]);
|
|
7027
|
+
break;
|
|
7028
|
+
default:
|
|
7029
|
+
e.push(...a);
|
|
7030
|
+
break;
|
|
7031
|
+
}
|
|
7032
|
+
return e.join(" ");
|
|
7033
|
+
}
|
|
7034
|
+
function Y(c) {
|
|
7035
|
+
let e = 0, t = 0, a = 0, o = 0;
|
|
7036
|
+
const n = [];
|
|
7037
|
+
for (const { key: r, data: s } of c)
|
|
7038
|
+
switch (r) {
|
|
7039
|
+
case "M":
|
|
7040
|
+
n.push({ key: "M", data: [...s] }), [e, t] = s, [a, o] = s;
|
|
7041
|
+
break;
|
|
7042
|
+
case "m":
|
|
7043
|
+
e += s[0], t += s[1], n.push({ key: "M", data: [e, t] }), a = e, o = t;
|
|
7044
|
+
break;
|
|
7045
|
+
case "L":
|
|
7046
|
+
n.push({ key: "L", data: [...s] }), [e, t] = s;
|
|
7047
|
+
break;
|
|
7048
|
+
case "l":
|
|
7049
|
+
e += s[0], t += s[1], n.push({ key: "L", data: [e, t] });
|
|
7050
|
+
break;
|
|
7051
|
+
case "C":
|
|
7052
|
+
n.push({ key: "C", data: [...s] }), e = s[4], t = s[5];
|
|
7053
|
+
break;
|
|
7054
|
+
case "c": {
|
|
7055
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7056
|
+
n.push({ key: "C", data: h }), e = h[4], t = h[5];
|
|
7057
|
+
break;
|
|
7058
|
+
}
|
|
7059
|
+
case "Q":
|
|
7060
|
+
n.push({ key: "Q", data: [...s] }), e = s[2], t = s[3];
|
|
7061
|
+
break;
|
|
7062
|
+
case "q": {
|
|
7063
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7064
|
+
n.push({ key: "Q", data: h }), e = h[2], t = h[3];
|
|
7065
|
+
break;
|
|
7066
|
+
}
|
|
7067
|
+
case "A":
|
|
7068
|
+
n.push({ key: "A", data: [...s] }), e = s[5], t = s[6];
|
|
7069
|
+
break;
|
|
7070
|
+
case "a":
|
|
7071
|
+
e += s[5], t += s[6], n.push({ key: "A", data: [s[0], s[1], s[2], s[3], s[4], e, t] });
|
|
7072
|
+
break;
|
|
7073
|
+
case "H":
|
|
7074
|
+
n.push({ key: "H", data: [...s] }), e = s[0];
|
|
7075
|
+
break;
|
|
7076
|
+
case "h":
|
|
7077
|
+
e += s[0], n.push({ key: "H", data: [e] });
|
|
7078
|
+
break;
|
|
7079
|
+
case "V":
|
|
7080
|
+
n.push({ key: "V", data: [...s] }), t = s[0];
|
|
7081
|
+
break;
|
|
7082
|
+
case "v":
|
|
7083
|
+
t += s[0], n.push({ key: "V", data: [t] });
|
|
7084
|
+
break;
|
|
7085
|
+
case "S":
|
|
7086
|
+
n.push({ key: "S", data: [...s] }), e = s[2], t = s[3];
|
|
7087
|
+
break;
|
|
7088
|
+
case "s": {
|
|
7089
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7090
|
+
n.push({ key: "S", data: h }), e = h[2], t = h[3];
|
|
7091
|
+
break;
|
|
7092
|
+
}
|
|
7093
|
+
case "T":
|
|
7094
|
+
n.push({ key: "T", data: [...s] }), e = s[0], t = s[1];
|
|
7095
|
+
break;
|
|
7096
|
+
case "t":
|
|
7097
|
+
e += s[0], t += s[1], n.push({ key: "T", data: [e, t] });
|
|
7098
|
+
break;
|
|
7099
|
+
case "Z":
|
|
7100
|
+
case "z":
|
|
7101
|
+
n.push({ key: "Z", data: [] }), e = a, t = o;
|
|
7102
|
+
break;
|
|
7103
|
+
}
|
|
7104
|
+
return n;
|
|
7105
|
+
}
|
|
7106
|
+
function J$1(c) {
|
|
7107
|
+
const e = [];
|
|
7108
|
+
let t = "", a = 0, o = 0, n = 0, r = 0, s = 0, h = 0;
|
|
7109
|
+
for (const { key: f, data: l } of c) {
|
|
7110
|
+
switch (f) {
|
|
7111
|
+
case "M":
|
|
7112
|
+
e.push({ key: "M", data: [...l] }), [a, o] = l, [n, r] = l;
|
|
7113
|
+
break;
|
|
7114
|
+
case "C":
|
|
7115
|
+
e.push({ key: "C", data: [...l] }), a = l[4], o = l[5], s = l[2], h = l[3];
|
|
7116
|
+
break;
|
|
7117
|
+
case "L":
|
|
7118
|
+
e.push({ key: "L", data: [...l] }), [a, o] = l;
|
|
7119
|
+
break;
|
|
7120
|
+
case "H":
|
|
7121
|
+
a = l[0], e.push({ key: "L", data: [a, o] });
|
|
7122
|
+
break;
|
|
7123
|
+
case "V":
|
|
7124
|
+
o = l[0], e.push({ key: "L", data: [a, o] });
|
|
7125
|
+
break;
|
|
7126
|
+
case "S": {
|
|
7127
|
+
let k = 0, i = 0;
|
|
7128
|
+
t === "C" || t === "S" ? (k = a + (a - s), i = o + (o - h)) : (k = a, i = o), e.push({ key: "C", data: [k, i, ...l] }), s = l[0], h = l[1], a = l[2], o = l[3];
|
|
7129
|
+
break;
|
|
7130
|
+
}
|
|
7131
|
+
case "T": {
|
|
7132
|
+
const [k, i] = l;
|
|
7133
|
+
let u = 0, y = 0;
|
|
7134
|
+
t === "Q" || t === "T" ? (u = a + (a - s), y = o + (o - h)) : (u = a, y = o);
|
|
7135
|
+
const M = a + 2 * (u - a) / 3, p = o + 2 * (y - o) / 3, d = k + 2 * (u - k) / 3, g = i + 2 * (y - i) / 3;
|
|
7136
|
+
e.push({ key: "C", data: [M, p, d, g, k, i] }), s = u, h = y, a = k, o = i;
|
|
7137
|
+
break;
|
|
7138
|
+
}
|
|
7139
|
+
case "Q": {
|
|
7140
|
+
const [k, i, u, y] = l, M = a + 2 * (k - a) / 3, p = o + 2 * (i - o) / 3, d = u + 2 * (k - u) / 3, g = y + 2 * (i - y) / 3;
|
|
7141
|
+
e.push({ key: "C", data: [M, p, d, g, u, y] }), s = k, h = i, a = u, o = y;
|
|
7142
|
+
break;
|
|
7143
|
+
}
|
|
7144
|
+
case "A": {
|
|
7145
|
+
const k = Math.abs(l[0]), i = Math.abs(l[1]), u = l[2], y = l[3], M = l[4], p = l[5], d = l[6];
|
|
7146
|
+
k === 0 || i === 0 ? (e.push({ key: "C", data: [a, o, p, d, p, d] }), a = p, o = d) : (a !== p || o !== d) && (F(a, o, p, d, k, i, u, y, M).forEach(function(L) {
|
|
7147
|
+
e.push({ key: "C", data: L });
|
|
7148
|
+
}), a = p, o = d);
|
|
7149
|
+
break;
|
|
7150
|
+
}
|
|
7151
|
+
case "Z":
|
|
7152
|
+
e.push({ key: "Z", data: [] }), a = n, o = r;
|
|
7153
|
+
break;
|
|
7154
|
+
}
|
|
7155
|
+
t = f;
|
|
7156
|
+
}
|
|
7157
|
+
return e;
|
|
7158
|
+
}
|
|
7159
|
+
function K$1(c) {
|
|
7160
|
+
return Math.PI * c / 180;
|
|
7161
|
+
}
|
|
7162
|
+
function T$1(c, e, t) {
|
|
7163
|
+
const a = c * Math.cos(t) - e * Math.sin(t), o = c * Math.sin(t) + e * Math.cos(t);
|
|
7164
|
+
return [a, o];
|
|
7165
|
+
}
|
|
7166
|
+
function F(c, e, t, a, o, n, r, s, h, f) {
|
|
7167
|
+
const l = K$1(r);
|
|
7168
|
+
let k = [], i = 0, u = 0, y = 0, M = 0;
|
|
7169
|
+
if (f)
|
|
7170
|
+
[i, u, y, M] = f;
|
|
7171
|
+
else {
|
|
7172
|
+
[c, e] = T$1(c, e, -l), [t, a] = T$1(t, a, -l);
|
|
7173
|
+
const x = (c - t) / 2, b = (e - a) / 2;
|
|
7174
|
+
let w = x * x / (o * o) + b * b / (n * n);
|
|
7175
|
+
w > 1 && (w = Math.sqrt(w), o = w * o, n = w * n);
|
|
7176
|
+
const S = s === h ? -1 : 1, A = o * o, R = n * n, j = A * R - A * b * b - R * x * x, D = A * b * b + R * x * x, Z = S * Math.sqrt(Math.abs(j / D));
|
|
7177
|
+
y = Z * o * b / n + (c + t) / 2, M = Z * -n * x / o + (e + a) / 2, i = Math.asin(parseFloat(((e - M) / n).toFixed(9))), u = Math.asin(parseFloat(((a - M) / n).toFixed(9))), c < y && (i = Math.PI - i), t < y && (u = Math.PI - u), i < 0 && (i = Math.PI * 2 + i), u < 0 && (u = Math.PI * 2 + u), h && i > u && (i = i - Math.PI * 2), !h && u > i && (u = u - Math.PI * 2);
|
|
7178
|
+
}
|
|
7179
|
+
let p = u - i;
|
|
7180
|
+
if (Math.abs(p) > Math.PI * 120 / 180) {
|
|
7181
|
+
const x = u, b = t, w = a;
|
|
7182
|
+
h && u > i ? u = i + Math.PI * 120 / 180 * 1 : u = i + Math.PI * 120 / 180 * -1, t = y + o * Math.cos(u), a = M + n * Math.sin(u), k = F(t, a, b, w, o, n, r, 0, h, [u, x, y, M]);
|
|
7183
|
+
}
|
|
7184
|
+
p = u - i;
|
|
7185
|
+
const d = Math.cos(i), g = Math.sin(i), L = Math.cos(u), _ = Math.sin(u), I = Math.tan(p / 4), Q = 4 / 3 * o * I, V = 4 / 3 * n * I, q = [c, e], C = [c + Q * g, e - V * d], H = [t + Q * _, a - V * L], P = [t, a];
|
|
7186
|
+
if (C[0] = 2 * q[0] - C[0], C[1] = 2 * q[1] - C[1], f)
|
|
7187
|
+
return [C, H, P].concat(k);
|
|
7188
|
+
{
|
|
7189
|
+
k = [C, H, P].concat(k);
|
|
7190
|
+
const x = [];
|
|
7191
|
+
for (let b = 0; b < k.length; b += 3) {
|
|
7192
|
+
const w = T$1(k[b][0], k[b][1], l), S = T$1(k[b + 1][0], k[b + 1][1], l), A = T$1(k[b + 2][0], k[b + 2][1], l);
|
|
7193
|
+
x.push([w[0], w[1], S[0], S[1], A[0], A[1]]);
|
|
7194
|
+
}
|
|
7195
|
+
return x;
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
const W$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7199
|
+
__proto__: null,
|
|
7200
|
+
absolutize: Y,
|
|
7201
|
+
normalize: J$1,
|
|
7202
|
+
parsePath: O$1,
|
|
7203
|
+
serialize: X$1
|
|
7204
|
+
}, Symbol.toStringTag, { value: "Module" })), { parsePath: v$1, absolutize: tt$1 } = W$1, et$1 = (c, e, t) => {
|
|
7205
|
+
let a, o = null, n = null;
|
|
7206
|
+
if (c.key === "M") {
|
|
7207
|
+
const [r, s] = c.data;
|
|
7208
|
+
return a = [r, s], { p: a };
|
|
7209
|
+
}
|
|
7210
|
+
if (c.key === "H") {
|
|
7211
|
+
const [r] = c.data;
|
|
7212
|
+
return a = [r, (e == null ? void 0 : e[1]) || 0], { p: a };
|
|
7213
|
+
}
|
|
7214
|
+
if (c.key === "V") {
|
|
7215
|
+
const [r] = c.data;
|
|
7216
|
+
return a = [(e == null ? void 0 : e[0]) || 0, r], { p: a };
|
|
7217
|
+
}
|
|
7218
|
+
if (c.key === "L") {
|
|
7219
|
+
const [r, s] = c.data;
|
|
7220
|
+
return a = [r, s], { p: a };
|
|
7221
|
+
}
|
|
7222
|
+
if (c.key === "C") {
|
|
7223
|
+
const [r, s, h, f, l, k] = c.data;
|
|
7224
|
+
return a = [l, k], o = [r, s], n = [h, f], {
|
|
7225
|
+
p: a,
|
|
7226
|
+
control1: o,
|
|
7227
|
+
control2: n
|
|
7228
|
+
};
|
|
7229
|
+
}
|
|
7230
|
+
if (c.key === "S") {
|
|
7231
|
+
const [r, s, h, f] = c.data;
|
|
7232
|
+
if (a = [h, f], n = [r, s], !e)
|
|
7233
|
+
throw new Error("S command without previous point");
|
|
7234
|
+
if (o = e, t.control2) {
|
|
7235
|
+
const l = e;
|
|
7236
|
+
o = [
|
|
7237
|
+
l[0] + (l[0] - t.control2[0]),
|
|
7238
|
+
l[1] + (l[1] - t.control2[1])
|
|
7239
|
+
];
|
|
7240
|
+
}
|
|
7241
|
+
return {
|
|
7242
|
+
p: a,
|
|
7243
|
+
control1: o,
|
|
7244
|
+
control2: n
|
|
7245
|
+
};
|
|
7246
|
+
}
|
|
7247
|
+
if (c.key === "Q") {
|
|
7248
|
+
const [r, s, h, f] = c.data;
|
|
7249
|
+
return a = [h, f], o = [r, s], {
|
|
7250
|
+
p: a,
|
|
7251
|
+
control1: o
|
|
7252
|
+
};
|
|
7253
|
+
}
|
|
7254
|
+
if (c.key === "T") {
|
|
7255
|
+
const [r, s] = c.data;
|
|
7256
|
+
if (a = [r, s], !e)
|
|
7257
|
+
throw new Error("T command without previous point");
|
|
7258
|
+
if (o = e, t.control1 && !t.control2) {
|
|
7259
|
+
const h = e;
|
|
7260
|
+
o = [
|
|
7261
|
+
h[0] + (h[0] - t.control1[0]),
|
|
7262
|
+
h[1] + (h[1] - t.control1[1])
|
|
7263
|
+
];
|
|
7264
|
+
}
|
|
7265
|
+
}
|
|
7266
|
+
if (c.key === "A") {
|
|
7267
|
+
const [r, s, h = 0, f = 0, l = 0, k, i] = c.data;
|
|
7268
|
+
if (a = [k, i], !e)
|
|
7269
|
+
throw new Error("A command without previous point");
|
|
7270
|
+
const u = Math.sqrt(
|
|
7271
|
+
(e[0] - k) ** 2 + (e[1] - i) ** 2
|
|
7272
|
+
), y = Math.max(r, s);
|
|
7273
|
+
let M = r, p = s;
|
|
7274
|
+
if (y < u / 2) {
|
|
7275
|
+
const d = u / 2 / y;
|
|
7276
|
+
M = r * d, p = s * d;
|
|
7277
|
+
}
|
|
7278
|
+
return {
|
|
7279
|
+
p: a,
|
|
7280
|
+
arcConfig: [M, p, h, !!f, !!l]
|
|
7281
|
+
};
|
|
7282
|
+
}
|
|
7283
|
+
throw new Error(`Unknown command ${c.key}`);
|
|
7284
|
+
};
|
|
7285
|
+
function* at$1(c) {
|
|
7286
|
+
const e = tt$1(v$1(c));
|
|
7287
|
+
let t = null, a = null, o = { control1: null, control2: null };
|
|
7288
|
+
for (const n of e) {
|
|
7289
|
+
if (n.key === "Z") {
|
|
7290
|
+
t && (yield t.close(!0)), t = null;
|
|
7291
|
+
continue;
|
|
7292
|
+
}
|
|
7293
|
+
const r = et$1(n, a, o), s = r.p, h = "control1" in r ? r.control1 : null, f = "control1" in r ? r.control2 : null, l = "arcConfig" in r ? r.arcConfig : null;
|
|
7294
|
+
if (n.key === "M") {
|
|
7295
|
+
t && (yield t.isClosed ? t.close() : t.asStrand()), t = lt$1(s), a = s;
|
|
7296
|
+
continue;
|
|
7297
|
+
}
|
|
7298
|
+
if (a && Math.abs(s[0] - a[0]) < 1e-9 && Math.abs(s[1] - a[1]) < 1e-9) {
|
|
7299
|
+
a = s, o = { control1: h, control2: f };
|
|
7300
|
+
continue;
|
|
7301
|
+
}
|
|
7302
|
+
(n.key === "L" || n.key === "H" || n.key === "V") && (t == null || t.lineTo(s)), (n.key === "C" || n.key === "S") && (t == null || t.cubicBezierCurveTo(s, h, f)), (n.key === "Q" || n.key === "T") && (t == null || t.quadraticBezierCurveTo(s, h)), n.key === "A" && (t == null || t.ellipseTo(s, ...l)), a = s, o = { control1: h, control2: f };
|
|
7303
|
+
}
|
|
7304
|
+
t && (yield t.isClosed ? t.close() : t.asStrand());
|
|
7305
|
+
}
|
|
7306
|
+
function ht(c) {
|
|
7307
|
+
return Array.from(at$1(c));
|
|
6890
7308
|
}
|
|
6891
7309
|
|
|
6892
7310
|
var drawShape = /*#__PURE__*/Object.freeze({
|
|
6893
7311
|
__proto__: null,
|
|
6894
|
-
drawCircle:
|
|
6895
|
-
|
|
7312
|
+
drawCircle: ct$1,
|
|
7313
|
+
drawEllipse: rt$1,
|
|
7314
|
+
drawPolysides: lt,
|
|
7315
|
+
drawRect: ot$1,
|
|
7316
|
+
drawSVGPath: ht
|
|
6896
7317
|
});
|
|
6897
7318
|
|
|
6898
7319
|
function i([t, n]) {
|
|
6899
7320
|
return `${t} ${n}`;
|
|
6900
7321
|
}
|
|
6901
7322
|
function s(t) {
|
|
6902
|
-
if (t instanceof at$
|
|
7323
|
+
if (t instanceof at$3)
|
|
6903
7324
|
return `L ${i(t.lastPoint)}`;
|
|
6904
|
-
if (t instanceof ct$
|
|
7325
|
+
if (t instanceof ct$3)
|
|
6905
7326
|
return `A ${t.radius} ${t.radius} 0 ${t.angularLength > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
|
|
6906
7327
|
if (t instanceof jt$1)
|
|
6907
7328
|
return `A ${t.majorRadius} ${t.minorRadius} ${t.tiltAngle * Ue} ${t.deltaAngle > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
|
|
@@ -6951,11 +7372,11 @@ var yt = Object.defineProperty;
|
|
|
6951
7372
|
var Ct = (n, t, e) => t in n ? yt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6952
7373
|
var P = (n, t, e) => Ct(n, typeof t != "symbol" ? t + "" : t, e);
|
|
6953
7374
|
function L(n) {
|
|
6954
|
-
if (n instanceof v$
|
|
7375
|
+
if (n instanceof v$2)
|
|
6955
7376
|
return [n];
|
|
6956
|
-
if (n instanceof O)
|
|
6957
|
-
return [new v$1(n)];
|
|
6958
7377
|
if (n instanceof _$2)
|
|
7378
|
+
return [new v$2(n)];
|
|
7379
|
+
if (n instanceof O$2)
|
|
6959
7380
|
return n.figures;
|
|
6960
7381
|
throw new Error("Unknown shape");
|
|
6961
7382
|
}
|
|
@@ -6964,7 +7385,7 @@ function mt(n, t, e = 1e-9) {
|
|
|
6964
7385
|
const r = [], i = new Array(t.segments.length).fill(0).map(() => []);
|
|
6965
7386
|
t.segments.forEach((a, f) => {
|
|
6966
7387
|
n.segments.forEach((c) => {
|
|
6967
|
-
const { intersections: l, overlaps: p } =
|
|
7388
|
+
const { intersections: l, overlaps: p } = Z(
|
|
6968
7389
|
a,
|
|
6969
7390
|
c,
|
|
6970
7391
|
e
|
|
@@ -6979,7 +7400,7 @@ function mt(n, t, e = 1e-9) {
|
|
|
6979
7400
|
}), s = Te(s, e);
|
|
6980
7401
|
const o = Kt([t.segments, i]).flatMap(([a, f]) => f.length ? a.splitAt(f) : [a]);
|
|
6981
7402
|
return Array.from(
|
|
6982
|
-
|
|
7403
|
+
vt$1(
|
|
6983
7404
|
o,
|
|
6984
7405
|
s,
|
|
6985
7406
|
r
|
|
@@ -7021,42 +7442,42 @@ function j(n, t, e = !1) {
|
|
|
7021
7442
|
}), s;
|
|
7022
7443
|
}
|
|
7023
7444
|
function sn(n, t) {
|
|
7024
|
-
return new
|
|
7445
|
+
return new O$2(
|
|
7025
7446
|
G(L(n), L(t))
|
|
7026
7447
|
);
|
|
7027
7448
|
}
|
|
7028
7449
|
function z(n) {
|
|
7029
7450
|
return n.reduce(
|
|
7030
7451
|
(t, e) => sn(t, e),
|
|
7031
|
-
new
|
|
7452
|
+
new O$2()
|
|
7032
7453
|
);
|
|
7033
7454
|
}
|
|
7034
7455
|
function Pt(n, t) {
|
|
7035
|
-
return new
|
|
7456
|
+
return new O$2(
|
|
7036
7457
|
Q$1(L(n), L(t))
|
|
7037
7458
|
);
|
|
7038
7459
|
}
|
|
7039
7460
|
function yn(n, t) {
|
|
7040
|
-
return new
|
|
7041
|
-
|
|
7461
|
+
return new O$2(
|
|
7462
|
+
lt$2(L(n), L(t))
|
|
7042
7463
|
);
|
|
7043
7464
|
}
|
|
7044
7465
|
function Cn(n, t, e = !0) {
|
|
7045
|
-
if (t instanceof
|
|
7466
|
+
if (t instanceof _$2)
|
|
7046
7467
|
return J(n, t, e);
|
|
7047
|
-
if (t instanceof v$
|
|
7468
|
+
if (t instanceof v$2)
|
|
7048
7469
|
return W(n, t, e);
|
|
7049
|
-
let s = [new B$
|
|
7470
|
+
let s = [new B$3([...n.segments])];
|
|
7050
7471
|
return t.figures.forEach((r) => {
|
|
7051
7472
|
s = s.flatMap((i) => W(i, r, e));
|
|
7052
7473
|
}), s;
|
|
7053
7474
|
}
|
|
7054
7475
|
function xn(n, t, e = !1) {
|
|
7055
|
-
if (t instanceof
|
|
7476
|
+
if (t instanceof _$2)
|
|
7056
7477
|
return Q(n, t, e);
|
|
7057
|
-
if (t instanceof v$
|
|
7478
|
+
if (t instanceof v$2)
|
|
7058
7479
|
return j(n, t, e);
|
|
7059
|
-
let s = [new B$
|
|
7480
|
+
let s = [new B$3([...n.segments])];
|
|
7060
7481
|
return t.figures.forEach((r) => {
|
|
7061
7482
|
s = s.flatMap((i) => j(i, r, e));
|
|
7062
7483
|
}), s;
|
|
@@ -7086,21 +7507,21 @@ function rn(n, t) {
|
|
|
7086
7507
|
if (o === "between" && i !== "between")
|
|
7087
7508
|
return nt(t, n, i);
|
|
7088
7509
|
if (i === "before" && o === "before")
|
|
7089
|
-
return J$
|
|
7510
|
+
return J$3(n.firstPoint, t.firstPoint);
|
|
7090
7511
|
if (i === "after" && o === "after")
|
|
7091
|
-
return J$
|
|
7512
|
+
return J$3(n.lastPoint, t.lastPoint);
|
|
7092
7513
|
if (i === "before" && o === "after")
|
|
7093
|
-
return J$
|
|
7514
|
+
return J$3(n.firstPoint, t.lastPoint);
|
|
7094
7515
|
if (i === "after" && o === "before")
|
|
7095
|
-
return J$
|
|
7516
|
+
return J$3(n.lastPoint, t.firstPoint);
|
|
7096
7517
|
throw new Error("Invalid position");
|
|
7097
7518
|
}
|
|
7098
7519
|
function et(n, t) {
|
|
7099
|
-
if (
|
|
7520
|
+
if (K$2(n, t).length > 0)
|
|
7100
7521
|
return 0;
|
|
7101
|
-
const e =
|
|
7522
|
+
const e = dn$1(n, t.center);
|
|
7102
7523
|
if (n.isOnSegment(e)) {
|
|
7103
|
-
const s = J$
|
|
7524
|
+
const s = J$3(e, t.center);
|
|
7104
7525
|
if (Math.abs(s - t.radius) < n.precision && t.isOnSegment(e))
|
|
7105
7526
|
return 0;
|
|
7106
7527
|
if (s - t.radius > n.precision) {
|
|
@@ -7111,7 +7532,7 @@ function et(n, t) {
|
|
|
7111
7532
|
nt$2(r, t.radius)
|
|
7112
7533
|
);
|
|
7113
7534
|
if (t.isOnSegment(i))
|
|
7114
|
-
return J$
|
|
7535
|
+
return J$3(i, e);
|
|
7115
7536
|
}
|
|
7116
7537
|
}
|
|
7117
7538
|
return Math.min(
|
|
@@ -7128,15 +7549,15 @@ const on = (n, t) => {
|
|
|
7128
7549
|
return !!n.isValidParameter(s);
|
|
7129
7550
|
};
|
|
7130
7551
|
function an(n, t) {
|
|
7131
|
-
if (
|
|
7132
|
-
const e = J$
|
|
7552
|
+
if (Dt(n, t, !0).length > 0) return 0;
|
|
7553
|
+
const e = J$3(n.center, t.center);
|
|
7133
7554
|
if (e < n.precision && on(n, t))
|
|
7134
7555
|
return Math.abs(n.radius - t.radius);
|
|
7135
7556
|
const s = H$1(Q$2(t.center, n.center)), r = e - Math.abs(n.radius - t.radius) < n.precision;
|
|
7136
7557
|
let i = Ye(s);
|
|
7137
7558
|
r && t.radius > n.radius && (i += Math.PI);
|
|
7138
7559
|
const o = r ? i : i + Math.PI, a = n.angleToParam(i), f = t.angleToParam(o);
|
|
7139
|
-
return n.isValidParameter(a) && t.isValidParameter(f) ? J$
|
|
7560
|
+
return n.isValidParameter(a) && t.isValidParameter(f) ? J$3(n.paramPoint(a), t.paramPoint(f)) : Math.min(
|
|
7140
7561
|
n.distanceFrom(t.firstPoint),
|
|
7141
7562
|
n.distanceFrom(t.lastPoint),
|
|
7142
7563
|
t.distanceFrom(n.firstPoint),
|
|
@@ -7222,7 +7643,7 @@ class hn {
|
|
|
7222
7643
|
P(this, "tol");
|
|
7223
7644
|
this.fcn = t, this.endTolerance = e, this.maxIterations = s, this.epsilon = r, this.fcn = t, this.epsilon = r, this.endTolerance = e, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new ln();
|
|
7224
7645
|
const i = [0.5, 0.5], o = this.rect(0, 0), a = this.fcn(i);
|
|
7225
|
-
this.buckets.addInterval(new
|
|
7646
|
+
this.buckets.addInterval(new O(i, a, o)), this.fMin = a, this.argMin = i, this.tol = o.diagonal;
|
|
7226
7647
|
}
|
|
7227
7648
|
registerInterval(t) {
|
|
7228
7649
|
this.buckets.addInterval(t), t.value <= this.fMin && (this.fMin = t.value, this.argMin = t.center, this.tol = t.rectangle.diagonal);
|
|
@@ -7235,9 +7656,9 @@ class hn {
|
|
|
7235
7656
|
let e, s, r;
|
|
7236
7657
|
const [i, o] = t.center;
|
|
7237
7658
|
return t.rectangle.x <= t.rectangle.y ? (e = this.rect(t.rectangle.x + 1, t.rectangle.y), s = [i - e.xLength, o], r = [i + e.xLength, o]) : (e = this.rect(t.rectangle.x, t.rectangle.y + 1), s = [i, o - e.yLength], r = [i, o + e.yLength]), [
|
|
7238
|
-
new
|
|
7239
|
-
new
|
|
7240
|
-
new
|
|
7659
|
+
new O(s, this.fcn(s), e),
|
|
7660
|
+
new O(t.center, t.value, e),
|
|
7661
|
+
new O(r, this.fcn(r), e)
|
|
7241
7662
|
];
|
|
7242
7663
|
}
|
|
7243
7664
|
single_iteration() {
|
|
@@ -7269,7 +7690,7 @@ class hn {
|
|
|
7269
7690
|
};
|
|
7270
7691
|
}
|
|
7271
7692
|
}
|
|
7272
|
-
class
|
|
7693
|
+
class O {
|
|
7273
7694
|
constructor(t, e, s) {
|
|
7274
7695
|
this.center = t, this.value = e, this.rectangle = s;
|
|
7275
7696
|
}
|
|
@@ -7290,14 +7711,14 @@ function pn(n, t, e = 1e-9) {
|
|
|
7290
7711
|
return Math.sqrt(s.fMin);
|
|
7291
7712
|
}
|
|
7292
7713
|
function dn(n, t) {
|
|
7293
|
-
return n instanceof at$
|
|
7714
|
+
return n instanceof at$3 && t instanceof at$3 ? rn(n, t) : n instanceof at$3 && t instanceof ct$3 ? et(n, t) : n instanceof ct$3 && t instanceof at$3 ? et(t, n) : n instanceof ct$3 && t instanceof ct$3 ? an(n, t) : pn(n, t);
|
|
7294
7715
|
}
|
|
7295
7716
|
function wt(n) {
|
|
7296
7717
|
if (n instanceof Et$1) {
|
|
7297
7718
|
const r = Q$2(n.lastPoint, n.firstPoint), i = Q$2(n.firstControlPoint, n.firstPoint), o = Q$2(n.lastControlPoint, n.firstPoint), a = un$1(r, i), f = un$1(r, o);
|
|
7298
7719
|
if (a > 0 && f < 0 || a < 0 && f > 0) return !1;
|
|
7299
7720
|
}
|
|
7300
|
-
const t = tt$
|
|
7721
|
+
const t = tt$3(n.tangentAtFirstPoint), e = tt$3(n.tangentAtLastPoint);
|
|
7301
7722
|
let s = Pe(t, e);
|
|
7302
7723
|
return Math.abs(Math.acos(s)) < Math.PI / 3;
|
|
7303
7724
|
}
|
|
@@ -7318,22 +7739,22 @@ function mn(n) {
|
|
|
7318
7739
|
(f, c) => n.firstAngle + c * s * i
|
|
7319
7740
|
);
|
|
7320
7741
|
return o.slice(0, -1).map((f, c) => [f, o[c + 1]]).map(([f, c]) => {
|
|
7321
|
-
const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$
|
|
7742
|
+
const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$4().rotate(
|
|
7322
7743
|
n.tiltAngle,
|
|
7323
7744
|
n.center
|
|
7324
|
-
), C = (Ft) => k.transform(Ft),
|
|
7745
|
+
), C = (Ft) => k.transform(Ft), D = C([u + v * l, S + M * p]), G = C([
|
|
7325
7746
|
u + v * (l - r * p * i),
|
|
7326
7747
|
S + M * (p + r * l * i)
|
|
7327
7748
|
]), kt = C([
|
|
7328
7749
|
u + v * (g + r * d * i),
|
|
7329
7750
|
S + M * (d - r * g * i)
|
|
7330
7751
|
]), Et = C([u + v * g, S + M * d]);
|
|
7331
|
-
return new Et$1(
|
|
7752
|
+
return new Et$1(D, Et, G, kt);
|
|
7332
7753
|
});
|
|
7333
7754
|
}
|
|
7334
|
-
const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$
|
|
7755
|
+
const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$3 ? [t] : t instanceof ct$3 ? [t] : t instanceof jt$1 ? mn(t).flatMap(
|
|
7335
7756
|
(e) => st(e)
|
|
7336
|
-
) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$
|
|
7757
|
+
) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$3(t.firstPoint, t.lastPoint)]);
|
|
7337
7758
|
function q(n, t, e = !0) {
|
|
7338
7759
|
const s = n.map((c) => ({
|
|
7339
7760
|
offset: y(c, t),
|
|
@@ -7342,8 +7763,8 @@ function q(n, t, e = !0) {
|
|
|
7342
7763
|
let i = e ? null : s.at(-1), o = e ? s.at(-1) : null;
|
|
7343
7764
|
if (r.length === 1) return r;
|
|
7344
7765
|
const a = (c) => {
|
|
7345
|
-
i ? c.offset instanceof S ? Y$
|
|
7346
|
-
new at$
|
|
7766
|
+
i ? c.offset instanceof S ? Y$2(c.offset.firstPoint, c.offset.lastPoint) || r.push(
|
|
7767
|
+
new at$3(c.offset.firstPoint, c.offset.lastPoint)
|
|
7347
7768
|
) : r.push(c.offset) : i = c;
|
|
7348
7769
|
}, f = function* () {
|
|
7349
7770
|
for (const c of s.slice(0, -1))
|
|
@@ -7357,13 +7778,13 @@ function q(n, t, e = !0) {
|
|
|
7357
7778
|
continue;
|
|
7358
7779
|
}
|
|
7359
7780
|
const l = o.offset.lastPoint, p = c.offset.firstPoint;
|
|
7360
|
-
if (Y$
|
|
7781
|
+
if (Y$2(l, p)) {
|
|
7361
7782
|
a(o), o = c;
|
|
7362
7783
|
continue;
|
|
7363
7784
|
}
|
|
7364
7785
|
let g = [];
|
|
7365
7786
|
if (!(o.offset instanceof S) && !(c.offset instanceof S)) {
|
|
7366
|
-
const { intersections: M, overlaps: v } =
|
|
7787
|
+
const { intersections: M, overlaps: v } = Z(
|
|
7367
7788
|
o.offset,
|
|
7368
7789
|
c.offset,
|
|
7369
7790
|
X / 100
|
|
@@ -7376,10 +7797,10 @@ function q(n, t, e = !0) {
|
|
|
7376
7797
|
if (g.length > 0) {
|
|
7377
7798
|
let M = g[0];
|
|
7378
7799
|
if (g.length > 1) {
|
|
7379
|
-
const C = o == null ? void 0 : o.original.lastPoint,
|
|
7800
|
+
const C = o == null ? void 0 : o.original.lastPoint, D = g.map(
|
|
7380
7801
|
(G) => Rt$1(G, C)
|
|
7381
7802
|
);
|
|
7382
|
-
M = g[
|
|
7803
|
+
M = g[D.indexOf(Math.min(...D))];
|
|
7383
7804
|
}
|
|
7384
7805
|
const v = o.offset.splitAt([
|
|
7385
7806
|
M
|
|
@@ -7394,7 +7815,7 @@ function q(n, t, e = !0) {
|
|
|
7394
7815
|
const d = o.original.lastPoint, u = St$2(
|
|
7395
7816
|
Q$2(p, d),
|
|
7396
7817
|
Q$2(l, d)
|
|
7397
|
-
) > 0, S$1 = new ct$
|
|
7818
|
+
) > 0, S$1 = new ct$3(l, p, d, u);
|
|
7398
7819
|
a(o), r.push(S$1), o = c;
|
|
7399
7820
|
}
|
|
7400
7821
|
return o && a(o), r;
|
|
@@ -7406,11 +7827,11 @@ function It(n) {
|
|
|
7406
7827
|
};
|
|
7407
7828
|
return n.forEach((s, r) => {
|
|
7408
7829
|
n.slice(r + 1).forEach((i, o) => {
|
|
7409
|
-
const { intersections: a, overlaps: f } =
|
|
7830
|
+
const { intersections: a, overlaps: f } = Z(s, i, X), c = [
|
|
7410
7831
|
...a,
|
|
7411
7832
|
...f.flatMap((l) => [l.firstPoint, l.lastPoint])
|
|
7412
7833
|
].filter((l) => {
|
|
7413
|
-
const p = Y$
|
|
7834
|
+
const p = Y$2(l, s.firstPoint) || Y$2(l, s.lastPoint), g = Y$2(l, i.firstPoint) || Y$2(l, i.lastPoint);
|
|
7414
7835
|
return !(p && g);
|
|
7415
7836
|
});
|
|
7416
7837
|
c.length && (e(r, c), e(o + r + 1, c));
|
|
@@ -7429,19 +7850,19 @@ function bt(n, t, e) {
|
|
|
7429
7850
|
}
|
|
7430
7851
|
function T(n, t) {
|
|
7431
7852
|
const e = n.clockwise ? t : -t, s = Mt(n.segments), r = q(s, e);
|
|
7432
|
-
if (r.length < 2) return new
|
|
7853
|
+
if (r.length < 2) return new O$2();
|
|
7433
7854
|
const i = It(r);
|
|
7434
7855
|
if (!i.size) {
|
|
7435
|
-
const l = new
|
|
7436
|
-
return new
|
|
7856
|
+
const l = new _$2(r);
|
|
7857
|
+
return new O$2([new v$2(l)]);
|
|
7437
7858
|
}
|
|
7438
7859
|
const o = St(
|
|
7439
7860
|
i,
|
|
7440
7861
|
r
|
|
7441
7862
|
), a = bt(o, n, t);
|
|
7442
|
-
if (!a.length) return new
|
|
7443
|
-
const c =
|
|
7444
|
-
return c.length ? new
|
|
7863
|
+
if (!a.length) return new O$2();
|
|
7864
|
+
const c = Xt(a).filter((l) => l.length > 1).filter((l) => Y$2(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new _$2(l));
|
|
7865
|
+
return c.length ? new O$2(c.map((l) => new v$2(l))) : new O$2();
|
|
7445
7866
|
}
|
|
7446
7867
|
function Pn(n, t, e = "round") {
|
|
7447
7868
|
const s = t / 2, r = Mt(n.segments), i = q(r, s, !1), o = q(
|
|
@@ -7454,7 +7875,7 @@ function Pn(n, t, e = "round") {
|
|
|
7454
7875
|
u.lastPoint,
|
|
7455
7876
|
S.firstPoint,
|
|
7456
7877
|
u.tangentAtLastPoint
|
|
7457
|
-
) : new at$
|
|
7878
|
+
) : new at$3(u.lastPoint, S.firstPoint), f = [
|
|
7458
7879
|
...i,
|
|
7459
7880
|
a(
|
|
7460
7881
|
i[i.length - 1],
|
|
@@ -7467,16 +7888,16 @@ function Pn(n, t, e = "round") {
|
|
|
7467
7888
|
)
|
|
7468
7889
|
], c = It(f);
|
|
7469
7890
|
if (!c.size) {
|
|
7470
|
-
const u = new
|
|
7471
|
-
return new
|
|
7891
|
+
const u = new _$2(f);
|
|
7892
|
+
return new O$2([new v$2(u)]);
|
|
7472
7893
|
}
|
|
7473
7894
|
const l = St(
|
|
7474
7895
|
c,
|
|
7475
7896
|
f
|
|
7476
7897
|
), p = bt(l, n, s);
|
|
7477
|
-
if (!p.length) return new
|
|
7478
|
-
const d =
|
|
7479
|
-
return d.length ? new
|
|
7898
|
+
if (!p.length) return new O$2();
|
|
7899
|
+
const d = Xt(p).filter((u) => u.length > 1).filter((u) => Y$2(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new _$2(u));
|
|
7900
|
+
return d.length ? new O$2(d.map((u) => new v$2(u))) : new O$2();
|
|
7480
7901
|
}
|
|
7481
7902
|
function wn(n, t) {
|
|
7482
7903
|
const e = n.map((s) => {
|
|
@@ -7495,11 +7916,11 @@ function Mn(n, t) {
|
|
|
7495
7916
|
);
|
|
7496
7917
|
return z(s);
|
|
7497
7918
|
}
|
|
7498
|
-
function
|
|
7919
|
+
function Dn(n, t) {
|
|
7499
7920
|
return wn(L(n), t);
|
|
7500
7921
|
}
|
|
7501
|
-
function
|
|
7502
|
-
return n instanceof B$
|
|
7922
|
+
function On(n, t, { endCap: e = "round" } = {}) {
|
|
7923
|
+
return n instanceof B$3 ? Pn(n, t, e) : Mn(L(n), t);
|
|
7503
7924
|
}
|
|
7504
7925
|
class In {
|
|
7505
7926
|
constructor() {
|
|
@@ -7552,7 +7973,7 @@ class x extends In {
|
|
|
7552
7973
|
*
|
|
7553
7974
|
*/
|
|
7554
7975
|
inList(t) {
|
|
7555
|
-
const e = ({ element: s }) => !!t.find((r) => Y$
|
|
7976
|
+
const e = ({ element: s }) => !!t.find((r) => Y$2(r, s.point));
|
|
7556
7977
|
return this.filters.push(e), this;
|
|
7557
7978
|
}
|
|
7558
7979
|
/**
|
|
@@ -7561,7 +7982,7 @@ class x extends In {
|
|
|
7561
7982
|
*/
|
|
7562
7983
|
atDistance(t, e = [0, 0]) {
|
|
7563
7984
|
function s({ element: r }) {
|
|
7564
|
-
return Math.abs(J$
|
|
7985
|
+
return Math.abs(J$3(e, r.point) - t) < 1e-9;
|
|
7565
7986
|
}
|
|
7566
7987
|
return this.filters.push(s), this;
|
|
7567
7988
|
}
|
|
@@ -7572,7 +7993,7 @@ class x extends In {
|
|
|
7572
7993
|
*/
|
|
7573
7994
|
atPoint(t) {
|
|
7574
7995
|
function e({ element: s }) {
|
|
7575
|
-
return Y$
|
|
7996
|
+
return Y$2(t, s.point);
|
|
7576
7997
|
}
|
|
7577
7998
|
return this.filters.push(e), this;
|
|
7578
7999
|
}
|
|
@@ -7598,7 +8019,7 @@ class x extends In {
|
|
|
7598
8019
|
function e({ element: s }) {
|
|
7599
8020
|
const r = s.firstCurve.tangentAtLastPoint, i = s.secondCurve.tangentAtFirstPoint;
|
|
7600
8021
|
return Math.abs(
|
|
7601
|
-
rt(un$1(r, i)) - rt(fe * t)
|
|
8022
|
+
rt(un$1(r, i)) - rt(fe$1 * t)
|
|
7602
8023
|
) < 1e-9;
|
|
7603
8024
|
}
|
|
7604
8025
|
return this.filters.push(e), this;
|
|
@@ -7643,39 +8064,39 @@ function At(n, t, e, s = () => !0) {
|
|
|
7643
8064
|
if (!f) throw new Error("Bug in the stroke filletting algo");
|
|
7644
8065
|
i(f, a);
|
|
7645
8066
|
}), !r.at(-1)) throw new Error("Bug in the stroke corner algo");
|
|
7646
|
-
if (t instanceof
|
|
8067
|
+
if (t instanceof _$2) {
|
|
7647
8068
|
const a = r.pop(), f = r.shift();
|
|
7648
8069
|
if (!a || !f)
|
|
7649
8070
|
throw new Error("Bug in the filletting algo");
|
|
7650
|
-
return i(a, f), new
|
|
8071
|
+
return i(a, f), new _$2(r, { ignoreChecks: !0 });
|
|
7651
8072
|
} else
|
|
7652
|
-
return new B$
|
|
8073
|
+
return new B$3(r, { ignoreChecks: !0 });
|
|
7653
8074
|
}
|
|
7654
8075
|
function B(n, t, e) {
|
|
7655
8076
|
const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
|
|
7656
|
-
if (n instanceof
|
|
8077
|
+
if (n instanceof _$2 || n instanceof B$3)
|
|
7657
8078
|
return At(V, n, t, r);
|
|
7658
|
-
if (n instanceof v$
|
|
8079
|
+
if (n instanceof v$2) {
|
|
7659
8080
|
const i = B(n.contour, t, s), o = n.holes.map((a) => B(a, t, s));
|
|
7660
|
-
return new v$
|
|
8081
|
+
return new v$2(i, o, { ignoreChecks: !0 });
|
|
7661
8082
|
}
|
|
7662
|
-
if (n instanceof
|
|
8083
|
+
if (n instanceof O$2) {
|
|
7663
8084
|
const i = n.figures.map((o) => B(o, t, s));
|
|
7664
|
-
return new
|
|
8085
|
+
return new O$2(i, { ignoreChecks: !0 });
|
|
7665
8086
|
}
|
|
7666
8087
|
throw new Error("invalid shape to fillet");
|
|
7667
8088
|
}
|
|
7668
8089
|
function R(n, t, e) {
|
|
7669
8090
|
const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
|
|
7670
|
-
if (n instanceof
|
|
8091
|
+
if (n instanceof _$2 || n instanceof B$3)
|
|
7671
8092
|
return At(V, n, t, r);
|
|
7672
|
-
if (n instanceof v$
|
|
8093
|
+
if (n instanceof v$2) {
|
|
7673
8094
|
const i = R(n.contour, t, s), o = n.holes.map((a) => R(a, t, s));
|
|
7674
|
-
return new v$
|
|
8095
|
+
return new v$2(i, o, { ignoreChecks: !0 });
|
|
7675
8096
|
}
|
|
7676
|
-
if (n instanceof
|
|
8097
|
+
if (n instanceof O$2) {
|
|
7677
8098
|
const i = n.figures.map((o) => R(o, t, s));
|
|
7678
|
-
return new
|
|
8099
|
+
return new O$2(i, { ignoreChecks: !0 });
|
|
7679
8100
|
}
|
|
7680
8101
|
throw new Error("invalid shape to chamfer");
|
|
7681
8102
|
}
|
|
@@ -7694,15 +8115,15 @@ function Bn(n) {
|
|
|
7694
8115
|
return new Sn(n);
|
|
7695
8116
|
}
|
|
7696
8117
|
function it(n) {
|
|
7697
|
-
if (n instanceof
|
|
8118
|
+
if (n instanceof O$2)
|
|
7698
8119
|
return d(n);
|
|
7699
|
-
if (n instanceof v$
|
|
8120
|
+
if (n instanceof v$2)
|
|
7700
8121
|
return p(n);
|
|
7701
|
-
if (n instanceof
|
|
8122
|
+
if (n instanceof _$2)
|
|
7702
8123
|
return `<path d="${w(n)}" />`;
|
|
7703
|
-
if (n instanceof B$
|
|
8124
|
+
if (n instanceof B$3)
|
|
7704
8125
|
return `<path d="${j$1(n)}" />`;
|
|
7705
|
-
if (
|
|
8126
|
+
if (Hn(n))
|
|
7706
8127
|
return `<path d="${`M ${n.firstPoint.join(" ")}`} ${s(
|
|
7707
8128
|
n
|
|
7708
8129
|
)}" />`;
|
|
@@ -7712,7 +8133,7 @@ const ot = (n) => "shape" in n ? n.shape : n, at = (n, t) => {
|
|
|
7712
8133
|
if (!("shape" in n)) return t;
|
|
7713
8134
|
const { color: e } = n;
|
|
7714
8135
|
return e ? `<g stroke="${e}">${t}</g>` : t;
|
|
7715
|
-
}, ct = (n) => new mt$
|
|
8136
|
+
}, ct = (n) => new mt$1(n.xMin, -n.yMax, n.xMax, -n.yMin);
|
|
7716
8137
|
function Rn(n, {
|
|
7717
8138
|
margin: t = 1,
|
|
7718
8139
|
unit: e = null,
|
|
@@ -7733,9 +8154,9 @@ function Rn(n, {
|
|
|
7733
8154
|
}
|
|
7734
8155
|
const vt = (n) => {
|
|
7735
8156
|
if (n.type === "LINE")
|
|
7736
|
-
return new at$
|
|
8157
|
+
return new at$3(n.firstPoint, n.lastPoint);
|
|
7737
8158
|
if (n.type === "ARC")
|
|
7738
|
-
return new ct$
|
|
8159
|
+
return new ct$3(
|
|
7739
8160
|
n.firstPoint,
|
|
7740
8161
|
n.lastPoint,
|
|
7741
8162
|
n.center,
|
|
@@ -7768,13 +8189,13 @@ const vt = (n) => {
|
|
|
7768
8189
|
throw new Error("Unknown segment type");
|
|
7769
8190
|
}, H = (n) => {
|
|
7770
8191
|
const t = n.segments.map(vt);
|
|
7771
|
-
return new
|
|
8192
|
+
return new _$2(t);
|
|
7772
8193
|
}, Lt = (n) => {
|
|
7773
8194
|
const t = H(n.contour), e = n.holes.map(H);
|
|
7774
|
-
return new v$
|
|
8195
|
+
return new v$2(t, e);
|
|
7775
8196
|
}, bn = (n) => {
|
|
7776
8197
|
const t = n.figures.map(Lt);
|
|
7777
|
-
return new
|
|
8198
|
+
return new O$2(t);
|
|
7778
8199
|
};
|
|
7779
8200
|
function zn(n) {
|
|
7780
8201
|
if (n.type === "DIAGRAM")
|
|
@@ -7800,34 +8221,35 @@ function $n([n, t]) {
|
|
|
7800
8221
|
var pantograph = /*#__PURE__*/Object.freeze({
|
|
7801
8222
|
__proto__: null,
|
|
7802
8223
|
DEG2RAD: ft,
|
|
8224
|
+
DrawingPen: ot$2,
|
|
7803
8225
|
RAD2DEG: An,
|
|
7804
8226
|
cartesianToPolar: $n,
|
|
7805
8227
|
chamfer: R,
|
|
7806
8228
|
confineStrand: xn,
|
|
7807
8229
|
cut: Pt,
|
|
7808
|
-
draw: lt,
|
|
8230
|
+
draw: lt$1,
|
|
7809
8231
|
eraseStrand: Cn,
|
|
7810
|
-
exportJSON:
|
|
8232
|
+
exportJSON: It$1,
|
|
7811
8233
|
exportSVG: Rn,
|
|
7812
8234
|
fillet: B,
|
|
7813
8235
|
fuse: sn,
|
|
7814
8236
|
fuseAll: z,
|
|
7815
8237
|
importJSON: zn,
|
|
7816
8238
|
intersect: yn,
|
|
7817
|
-
offset:
|
|
7818
|
-
outlineStroke:
|
|
8239
|
+
offset: Dn,
|
|
8240
|
+
outlineStroke: On,
|
|
7819
8241
|
polarToCartesian: Tn,
|
|
7820
8242
|
selectCorners: Bn,
|
|
7821
8243
|
svgBody: it
|
|
7822
8244
|
});
|
|
7823
8245
|
|
|
7824
8246
|
function sketchSegment(segment, plane) {
|
|
7825
|
-
if (segment instanceof at$
|
|
8247
|
+
if (segment instanceof at$3) {
|
|
7826
8248
|
const firstPoint = plane.toWorldCoords(segment.firstPoint);
|
|
7827
8249
|
const lastPoint = plane.toWorldCoords(segment.lastPoint);
|
|
7828
8250
|
return makeLine(firstPoint, lastPoint);
|
|
7829
8251
|
}
|
|
7830
|
-
if (segment instanceof ct$
|
|
8252
|
+
if (segment instanceof ct$3) {
|
|
7831
8253
|
return makeThreePointArc(plane.toWorldCoords(segment.firstPoint), plane.toWorldCoords(segment.midPoint), plane.toWorldCoords(segment.lastPoint));
|
|
7832
8254
|
}
|
|
7833
8255
|
if (segment instanceof jt$1) {
|
|
@@ -7882,17 +8304,17 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
7882
8304
|
const plane = planeInput instanceof Plane
|
|
7883
8305
|
? makePlane(planeInput)
|
|
7884
8306
|
: makePlane(planeInput, origin);
|
|
7885
|
-
if (pantographObject instanceof
|
|
8307
|
+
if (pantographObject instanceof O$2) {
|
|
7886
8308
|
return sketchDiagram(pantographObject, plane);
|
|
7887
8309
|
}
|
|
7888
|
-
if (pantographObject instanceof v$
|
|
8310
|
+
if (pantographObject instanceof v$2) {
|
|
7889
8311
|
return sketchFigure(pantographObject, plane);
|
|
7890
8312
|
}
|
|
7891
|
-
if (pantographObject instanceof
|
|
8313
|
+
if (pantographObject instanceof _$2) {
|
|
7892
8314
|
return sketchStroke(pantographObject, plane);
|
|
7893
8315
|
}
|
|
7894
|
-
if (pantographObject instanceof at$
|
|
7895
|
-
pantographObject instanceof ct$
|
|
8316
|
+
if (pantographObject instanceof at$3 ||
|
|
8317
|
+
pantographObject instanceof ct$3 ||
|
|
7896
8318
|
pantographObject instanceof jt$1 ||
|
|
7897
8319
|
pantographObject instanceof _t$1 ||
|
|
7898
8320
|
pantographObject instanceof Et$1) {
|
|
@@ -7900,20 +8322,20 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
7900
8322
|
}
|
|
7901
8323
|
throw new Error(`Unsupported object type "${pantographObject.constructor.name}"`);
|
|
7902
8324
|
}
|
|
7903
|
-
function
|
|
7904
|
-
if (shape instanceof
|
|
7905
|
-
return shape.figures.flatMap(
|
|
8325
|
+
function svgPathsForShape(shape) {
|
|
8326
|
+
if (shape instanceof O$2) {
|
|
8327
|
+
return shape.figures.flatMap(svgPathsForShape);
|
|
7906
8328
|
}
|
|
7907
|
-
else if (shape instanceof v$
|
|
8329
|
+
else if (shape instanceof v$2) {
|
|
7908
8330
|
return shape.allLoops.map((loop) => w(loop));
|
|
7909
8331
|
}
|
|
7910
|
-
else if (shape instanceof
|
|
8332
|
+
else if (shape instanceof _$2) {
|
|
7911
8333
|
return [w(shape)];
|
|
7912
8334
|
}
|
|
7913
|
-
else if (shape instanceof B$
|
|
8335
|
+
else if (shape instanceof B$3) {
|
|
7914
8336
|
return [j$1(shape)];
|
|
7915
8337
|
}
|
|
7916
|
-
else if (
|
|
8338
|
+
else if (Hn(shape)) {
|
|
7917
8339
|
return [`M ${shape.firstPoint.join(" ")} ${s(shape)}`];
|
|
7918
8340
|
}
|
|
7919
8341
|
throw new Error(`Failed to export ${shape}`);
|
|
@@ -7923,15 +8345,18 @@ function toSVGViewBox(shape) {
|
|
|
7923
8345
|
return v(boundingBox);
|
|
7924
8346
|
}
|
|
7925
8347
|
function wrapPantograph(pantographObject) {
|
|
7926
|
-
const isPantograph =
|
|
7927
|
-
pantographObject instanceof
|
|
7928
|
-
pantographObject instanceof v$
|
|
7929
|
-
pantographObject instanceof
|
|
8348
|
+
const isPantograph = Hn(pantographObject) ||
|
|
8349
|
+
pantographObject instanceof _$2 ||
|
|
8350
|
+
pantographObject instanceof v$2 ||
|
|
8351
|
+
pantographObject instanceof O$2 ||
|
|
8352
|
+
pantographObject instanceof Drawing;
|
|
7930
8353
|
if (!isPantograph)
|
|
7931
8354
|
return pantographObject;
|
|
7932
8355
|
const shape = pantographObject.mirror();
|
|
8356
|
+
if (pantographObject instanceof Drawing)
|
|
8357
|
+
return pantographObject;
|
|
7933
8358
|
return {
|
|
7934
|
-
toSVGPaths: () =>
|
|
8359
|
+
toSVGPaths: () => svgPathsForShape(shape),
|
|
7935
8360
|
toSVGViewBox: () => toSVGViewBox(shape),
|
|
7936
8361
|
};
|
|
7937
8362
|
}
|
|
@@ -7940,5 +8365,105 @@ function initStudioIntegration() {
|
|
|
7940
8365
|
return;
|
|
7941
8366
|
globalThis.registerShapeStandardizer("pantograph", wrapPantograph);
|
|
7942
8367
|
}
|
|
8368
|
+
class Drawing {
|
|
8369
|
+
diagram;
|
|
8370
|
+
constructor(diagram = new O$2()) {
|
|
8371
|
+
this.diagram = diagram;
|
|
8372
|
+
}
|
|
8373
|
+
clone() {
|
|
8374
|
+
return new Drawing(this.diagram.clone());
|
|
8375
|
+
}
|
|
8376
|
+
serialize() {
|
|
8377
|
+
return JSON.stringify(It$1(this.diagram));
|
|
8378
|
+
}
|
|
8379
|
+
get boundingBox() {
|
|
8380
|
+
return this.diagram.boundingBox;
|
|
8381
|
+
}
|
|
8382
|
+
get repr() {
|
|
8383
|
+
return JSON.stringify(It$1(this.diagram));
|
|
8384
|
+
}
|
|
8385
|
+
rotate(angle, center) {
|
|
8386
|
+
return new Drawing(this.diagram.rotate(angle, center));
|
|
8387
|
+
}
|
|
8388
|
+
translate(xDist, yDist) {
|
|
8389
|
+
return new Drawing(this.diagram.translate(xDist, yDist));
|
|
8390
|
+
}
|
|
8391
|
+
translateTo(translationVector) {
|
|
8392
|
+
return new Drawing(this.diagram.translateTo(translationVector));
|
|
8393
|
+
}
|
|
8394
|
+
scale(scaleFactor, center) {
|
|
8395
|
+
return new Drawing(this.diagram.scale(scaleFactor, center));
|
|
8396
|
+
}
|
|
8397
|
+
mirror(directionOrAxis, origin) {
|
|
8398
|
+
if (!directionOrAxis || typeof directionOrAxis === "string") {
|
|
8399
|
+
return new Drawing(this.diagram.mirror(directionOrAxis));
|
|
8400
|
+
}
|
|
8401
|
+
return new Drawing(this.diagram.mirror(directionOrAxis, origin));
|
|
8402
|
+
}
|
|
8403
|
+
mirrorCenter(center) {
|
|
8404
|
+
return new Drawing(this.diagram.mirrorCenter(center));
|
|
8405
|
+
}
|
|
8406
|
+
cut(other) {
|
|
8407
|
+
const base = this.diagram;
|
|
8408
|
+
const tool = other.diagram;
|
|
8409
|
+
return new Drawing(Pt(base, tool));
|
|
8410
|
+
}
|
|
8411
|
+
fuse(other) {
|
|
8412
|
+
const base = this.diagram;
|
|
8413
|
+
const tool = other.diagram;
|
|
8414
|
+
return new Drawing(sn(base, tool));
|
|
8415
|
+
}
|
|
8416
|
+
intersect(other) {
|
|
8417
|
+
const base = this.diagram;
|
|
8418
|
+
const tool = other.diagram;
|
|
8419
|
+
return new Drawing(yn(base, tool));
|
|
8420
|
+
}
|
|
8421
|
+
fillet(radius, filter) {
|
|
8422
|
+
return new Drawing(B(this.diagram, radius, filter));
|
|
8423
|
+
}
|
|
8424
|
+
chamfer(radius, filter) {
|
|
8425
|
+
return new Drawing(R(this.diagram, radius, filter));
|
|
8426
|
+
}
|
|
8427
|
+
sketchOnPlane(inputPlane = "XY", origin = [0, 0, 0]) {
|
|
8428
|
+
if (typeof inputPlane !== "string") {
|
|
8429
|
+
return sketchOnPlane(this.diagram, inputPlane);
|
|
8430
|
+
}
|
|
8431
|
+
return sketchOnPlane(this.diagram, inputPlane, origin);
|
|
8432
|
+
}
|
|
8433
|
+
toSVG(margin) {
|
|
8434
|
+
return Rn(this.diagram, { margin });
|
|
8435
|
+
}
|
|
8436
|
+
toSVGViewBox(margin = 1) {
|
|
8437
|
+
return v(this.diagram.boundingBox, margin);
|
|
8438
|
+
}
|
|
8439
|
+
toSVGPaths() {
|
|
8440
|
+
return svgPathsForShape(this.diagram);
|
|
8441
|
+
}
|
|
8442
|
+
offset(distance) {
|
|
8443
|
+
return new Drawing(Dn(this.diagram, distance));
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
class ReDrawingPen extends ot$2 {
|
|
8447
|
+
// @ts-expect-error forcing a different type
|
|
8448
|
+
close() {
|
|
8449
|
+
return new Drawing(super.close());
|
|
8450
|
+
}
|
|
8451
|
+
// @ts-expect-error forcing a different type
|
|
8452
|
+
closeWithMirror() {
|
|
8453
|
+
return new Drawing(super.close());
|
|
8454
|
+
}
|
|
8455
|
+
}
|
|
8456
|
+
function redraw(p) {
|
|
8457
|
+
return new ReDrawingPen(p);
|
|
8458
|
+
}
|
|
8459
|
+
function wrapDrawing(fn) {
|
|
8460
|
+
return function (...args) {
|
|
8461
|
+
return new Drawing(fn.apply(this, args));
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
const drawCircle = wrapDrawing(ct$1);
|
|
8465
|
+
const drawRect = wrapDrawing(ot$1);
|
|
8466
|
+
const drawEllipse = wrapDrawing(rt$1);
|
|
8467
|
+
const drawPolysides = wrapDrawing(lt);
|
|
7943
8468
|
|
|
7944
|
-
export { drawShape, initStudioIntegration, pantograph, sketchDiagram, sketchFigure, sketchOnPlane, sketchSegment, sketchStroke };
|
|
8469
|
+
export { Drawing, ReDrawingPen, drawCircle, drawEllipse, drawPolysides, drawRect, drawShape, initStudioIntegration, pantograph, redraw, sketchDiagram, sketchFigure, sketchOnPlane, sketchSegment, sketchStroke, wrapDrawing };
|