modern-path2d 1.2.17 → 1.2.18

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/index.cjs CHANGED
@@ -1966,63 +1966,77 @@ class RoundCurve extends Curve {
1966
1966
  return [this._center];
1967
1967
  }
1968
1968
  getAdaptivePointArray(output = []) {
1969
- const { cx, cy, rx, ry, dx, dy, startAngle } = this;
1969
+ const { cx, cy, rx, ry, dx, dy } = this;
1970
1970
  if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
1971
1971
  return output;
1972
1972
  }
1973
- const PI_2 = Math.PI * 2;
1974
- const deltaAngle = this._getDeltaAngle();
1975
- const arcLengthFactor = Math.abs(deltaAngle) / PI_2;
1976
- let n = Math.ceil(2.3 * Math.sqrt(rx + ry) * arcLengthFactor);
1977
- const array = [];
1978
- if (dx && dy) {
1979
- n = Math.ceil(n / 4);
1980
- const x0 = cx - dx / 2;
1981
- const y0 = cy - dy / 2;
1982
- const x1 = cx + dx / 2;
1983
- const y1 = cy - dy / 2;
1984
- const x2 = cx + dx / 2;
1985
- const y2 = cy + dy / 2;
1986
- const x3 = cx - dx / 2;
1987
- const y3 = cy + dy / 2;
1988
- for (let i = 0; i <= n; i++) {
1989
- const t = i / n;
1990
- const angle = -Math.PI / 2 + t * (Math.PI / 2);
1991
- const x = x1 + Math.cos(angle) * rx;
1992
- const y = y1 + Math.sin(angle) * ry;
1993
- output.push(x, y);
1994
- }
1995
- for (let i = 0; i <= n; i++) {
1996
- const t = i / n;
1997
- const angle = 0 + t * (Math.PI / 2);
1998
- const x = x2 + Math.cos(angle) * rx;
1999
- const y = y2 + Math.sin(angle) * ry;
2000
- output.push(x, y);
2001
- }
2002
- for (let i = 0; i <= n; i++) {
2003
- const t = i / n;
2004
- const angle = Math.PI / 2 + t * (Math.PI / 2);
2005
- const x = x3 + Math.cos(angle) * rx;
2006
- const y = y3 + Math.sin(angle) * ry;
2007
- output.push(x, y);
2008
- }
2009
- for (let i = 0; i <= n; i++) {
2010
- const t = i / n;
2011
- const angle = Math.PI + t * (Math.PI / 2);
2012
- const x = x0 + Math.cos(angle) * rx;
2013
- const y = y0 + Math.sin(angle) * ry;
2014
- output.push(x, y);
2015
- }
2016
- } else {
2017
- for (let i = 0; i <= n; i++) {
2018
- const t = i / n;
2019
- const angle = startAngle + t * deltaAngle;
2020
- const x = cx + Math.cos(angle) * rx;
2021
- const y = cy + Math.sin(angle) * ry;
2022
- array.push(x, y);
2023
- }
1973
+ const n = Math.ceil(2.3 * Math.sqrt(rx + ry));
1974
+ const x = cx;
1975
+ const y = cy;
1976
+ const m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
1977
+ if (m === 0) {
1978
+ return output;
1979
+ }
1980
+ if (n === 0) {
1981
+ output[0] = output[6] = x + dx;
1982
+ output[1] = output[3] = y + dy;
1983
+ output[2] = output[4] = x - dx;
1984
+ output[5] = output[7] = y - dy;
1985
+ return output;
1986
+ }
1987
+ let j1 = 0;
1988
+ let j2 = n * 4 + (dx ? 2 : 0) + 2;
1989
+ let j3 = j2;
1990
+ let j4 = m;
1991
+ let x0 = dx + rx;
1992
+ let y0 = dy;
1993
+ let x1 = x + x0;
1994
+ let x2 = x - x0;
1995
+ let y1 = y + y0;
1996
+ output[j1++] = x1;
1997
+ output[j1++] = y1;
1998
+ output[--j2] = y1;
1999
+ output[--j2] = x2;
2000
+ if (dy) {
2001
+ const y22 = y - y0;
2002
+ output[j3++] = x2;
2003
+ output[j3++] = y22;
2004
+ output[--j4] = y22;
2005
+ output[--j4] = x1;
2006
+ }
2007
+ for (let i = 1; i < n; i++) {
2008
+ const a = Math.PI / 2 * (i / n);
2009
+ const x02 = dx + Math.cos(a) * rx;
2010
+ const y02 = dy + Math.sin(a) * ry;
2011
+ const x12 = x + x02;
2012
+ const x22 = x - x02;
2013
+ const y12 = y + y02;
2014
+ const y22 = y - y02;
2015
+ output[j1++] = x12;
2016
+ output[j1++] = y12;
2017
+ output[--j2] = y12;
2018
+ output[--j2] = x22;
2019
+ output[j3++] = x22;
2020
+ output[j3++] = y22;
2021
+ output[--j4] = y22;
2022
+ output[--j4] = x12;
2023
+ }
2024
+ x0 = dx;
2025
+ y0 = dy + ry;
2026
+ x1 = x + x0;
2027
+ x2 = x - x0;
2028
+ y1 = y + y0;
2029
+ const y2 = y - y0;
2030
+ output[j1++] = x1;
2031
+ output[j1++] = y1;
2032
+ output[--j4] = y2;
2033
+ output[--j4] = x1;
2034
+ if (dx) {
2035
+ output[j1++] = x2;
2036
+ output[j1++] = y1;
2037
+ output[--j4] = y2;
2038
+ output[--j4] = x2;
2024
2039
  }
2025
- Array.prototype.push.apply(output, array);
2026
2040
  return output;
2027
2041
  }
2028
2042
  fillTriangulate(options = {}) {
@@ -2030,8 +2044,8 @@ class RoundCurve extends Curve {
2030
2044
  vertices = [],
2031
2045
  indices = [],
2032
2046
  verticesStride = 2,
2033
- verticesOffset = 0,
2034
- indicesOffset = 0
2047
+ verticesOffset = vertices.length / verticesStride,
2048
+ indicesOffset = indices.length
2035
2049
  } = options;
2036
2050
  const points = this.getAdaptivePointArray();
2037
2051
  if (points.length === 0) {
@@ -2287,6 +2301,121 @@ class ArcCurve extends RoundCurve {
2287
2301
  }
2288
2302
  }
2289
2303
 
2304
+ class LineCurve extends Curve {
2305
+ constructor(p1 = new Vector2(), p2 = new Vector2()) {
2306
+ super();
2307
+ this.p1 = p1;
2308
+ this.p2 = p2;
2309
+ }
2310
+ static from(p1x, p1y, p2x, p2y) {
2311
+ return new LineCurve(
2312
+ new Vector2(p1x, p1y),
2313
+ new Vector2(p2x, p2y)
2314
+ );
2315
+ }
2316
+ getPoint(t, output = new Vector2()) {
2317
+ if (t === 1) {
2318
+ output.copy(this.p2);
2319
+ } else {
2320
+ output.copy(this.p2).sub(this.p1).scale(t).add(this.p1);
2321
+ }
2322
+ return output;
2323
+ }
2324
+ getPointAt(u, output = new Vector2()) {
2325
+ return this.getPoint(u, output);
2326
+ }
2327
+ getTangent(_t, output = new Vector2()) {
2328
+ return output.subVectors(this.p2, this.p1).normalize();
2329
+ }
2330
+ getTangentAt(u, output = new Vector2()) {
2331
+ return this.getTangent(u, output);
2332
+ }
2333
+ getControlPointRefs() {
2334
+ return [this.p1, this.p2];
2335
+ }
2336
+ getAdaptivePointArray(output = []) {
2337
+ output.push(
2338
+ this.p1.x,
2339
+ this.p1.y,
2340
+ this.p2.x,
2341
+ this.p2.y
2342
+ );
2343
+ return output;
2344
+ }
2345
+ getMinMax(min = Vector2.MAX, max = Vector2.MIN) {
2346
+ const { p1, p2 } = this;
2347
+ min.x = Math.min(min.x, p1.x, p2.x);
2348
+ min.y = Math.min(min.y, p1.y, p2.y);
2349
+ max.x = Math.max(max.x, p1.x, p2.x);
2350
+ max.y = Math.max(max.y, p1.y, p2.y);
2351
+ return { min, max };
2352
+ }
2353
+ toCommands() {
2354
+ const { p1, p2 } = this;
2355
+ return [
2356
+ { type: "M", x: p1.x, y: p1.y },
2357
+ { type: "L", x: p2.x, y: p2.y }
2358
+ ];
2359
+ }
2360
+ fillTriangulate(options = {}) {
2361
+ let {
2362
+ vertices = [],
2363
+ indices = [],
2364
+ verticesStride = 2,
2365
+ verticesOffset = vertices.length / verticesStride,
2366
+ indicesOffset = indices.length
2367
+ } = options;
2368
+ const x = this.p1.x;
2369
+ const y = this.p1.y;
2370
+ const width = this.p2.x - this.p1.x || 1;
2371
+ const height = this.p2.y - this.p2.y || 1;
2372
+ const points = [
2373
+ x,
2374
+ y,
2375
+ x + width,
2376
+ y,
2377
+ x + width,
2378
+ y + height,
2379
+ x,
2380
+ y + height
2381
+ ];
2382
+ let count = 0;
2383
+ verticesOffset *= verticesStride;
2384
+ vertices[verticesOffset + count] = points[0];
2385
+ vertices[verticesOffset + count + 1] = points[1];
2386
+ count += verticesStride;
2387
+ vertices[verticesOffset + count] = points[2];
2388
+ vertices[verticesOffset + count + 1] = points[3];
2389
+ count += verticesStride;
2390
+ vertices[verticesOffset + count] = points[6];
2391
+ vertices[verticesOffset + count + 1] = points[7];
2392
+ count += verticesStride;
2393
+ vertices[verticesOffset + count] = points[4];
2394
+ vertices[verticesOffset + count + 1] = points[5];
2395
+ count += verticesStride;
2396
+ const verticesIndex = verticesOffset / verticesStride;
2397
+ indices[indicesOffset++] = verticesIndex;
2398
+ indices[indicesOffset++] = verticesIndex + 1;
2399
+ indices[indicesOffset++] = verticesIndex + 2;
2400
+ indices[indicesOffset++] = verticesIndex + 1;
2401
+ indices[indicesOffset++] = verticesIndex + 3;
2402
+ indices[indicesOffset++] = verticesIndex + 2;
2403
+ return { vertices, indices };
2404
+ }
2405
+ drawTo(ctx) {
2406
+ const { p1, p2 } = this;
2407
+ ctx.lineTo(p1.x, p1.y);
2408
+ ctx.lineTo(p2.x, p2.y);
2409
+ return this;
2410
+ }
2411
+ copy(source) {
2412
+ super.copy(source);
2413
+ this.p1.copy(source.p1);
2414
+ this.p2.copy(source.p2);
2415
+ return this;
2416
+ }
2417
+ }
2418
+
2290
2419
  class CompositeCurve extends Curve {
2291
2420
  constructor(curves = []) {
2292
2421
  super();
@@ -2361,6 +2490,44 @@ class CompositeCurve extends Curve {
2361
2490
  });
2362
2491
  return output;
2363
2492
  }
2493
+ fillTriangulate(options) {
2494
+ const indices = options?.indices ?? [];
2495
+ const vertices = options?.vertices ?? [];
2496
+ const lines = [];
2497
+ const fillLines = () => {
2498
+ if (lines.length) {
2499
+ const pointArray = [];
2500
+ lines.forEach((line) => {
2501
+ const x = line.p1.x;
2502
+ const y = line.p1.y;
2503
+ if (pointArray[pointArray.length - 2] !== x || pointArray[pointArray.length - 1] !== y) {
2504
+ pointArray.push(x, y);
2505
+ }
2506
+ pointArray.push(line.p2.x, line.p2.y);
2507
+ });
2508
+ fillTriangulate(pointArray, {
2509
+ ...options,
2510
+ indices,
2511
+ vertices
2512
+ });
2513
+ lines.length = 0;
2514
+ }
2515
+ };
2516
+ this.curves.forEach((curve) => {
2517
+ if (curve instanceof LineCurve) {
2518
+ lines.push(curve);
2519
+ } else {
2520
+ fillLines();
2521
+ curve.fillTriangulate({
2522
+ ...options,
2523
+ indices,
2524
+ vertices
2525
+ });
2526
+ }
2527
+ });
2528
+ fillLines();
2529
+ return { indices, vertices };
2530
+ }
2364
2531
  applyTransform(transform) {
2365
2532
  this.curves.forEach((curve) => curve.applyTransform(transform));
2366
2533
  return this;
@@ -2519,76 +2686,6 @@ class EllipseCurve extends RoundCurve {
2519
2686
  }
2520
2687
  }
2521
2688
 
2522
- class LineCurve extends Curve {
2523
- constructor(p1 = new Vector2(), p2 = new Vector2()) {
2524
- super();
2525
- this.p1 = p1;
2526
- this.p2 = p2;
2527
- }
2528
- static from(p1x, p1y, p2x, p2y) {
2529
- return new LineCurve(
2530
- new Vector2(p1x, p1y),
2531
- new Vector2(p2x, p2y)
2532
- );
2533
- }
2534
- getPoint(t, output = new Vector2()) {
2535
- if (t === 1) {
2536
- output.copy(this.p2);
2537
- } else {
2538
- output.copy(this.p2).sub(this.p1).scale(t).add(this.p1);
2539
- }
2540
- return output;
2541
- }
2542
- getPointAt(u, output = new Vector2()) {
2543
- return this.getPoint(u, output);
2544
- }
2545
- getTangent(_t, output = new Vector2()) {
2546
- return output.subVectors(this.p2, this.p1).normalize();
2547
- }
2548
- getTangentAt(u, output = new Vector2()) {
2549
- return this.getTangent(u, output);
2550
- }
2551
- getControlPointRefs() {
2552
- return [this.p1, this.p2];
2553
- }
2554
- getAdaptivePointArray(output = []) {
2555
- output.push(
2556
- this.p1.x,
2557
- this.p1.y,
2558
- this.p2.x,
2559
- this.p2.y
2560
- );
2561
- return output;
2562
- }
2563
- getMinMax(min = Vector2.MAX, max = Vector2.MIN) {
2564
- const { p1, p2 } = this;
2565
- min.x = Math.min(min.x, p1.x, p2.x);
2566
- min.y = Math.min(min.y, p1.y, p2.y);
2567
- max.x = Math.max(max.x, p1.x, p2.x);
2568
- max.y = Math.max(max.y, p1.y, p2.y);
2569
- return { min, max };
2570
- }
2571
- toCommands() {
2572
- const { p1, p2 } = this;
2573
- return [
2574
- { type: "M", x: p1.x, y: p1.y },
2575
- { type: "L", x: p2.x, y: p2.y }
2576
- ];
2577
- }
2578
- drawTo(ctx) {
2579
- const { p1, p2 } = this;
2580
- ctx.lineTo(p1.x, p1.y);
2581
- ctx.lineTo(p2.x, p2.y);
2582
- return this;
2583
- }
2584
- copy(source) {
2585
- super.copy(source);
2586
- this.p1.copy(source.p1);
2587
- this.p2.copy(source.p2);
2588
- return this;
2589
- }
2590
- }
2591
-
2592
2689
  class PloygonCurve extends CompositeCurve {
2593
2690
  //
2594
2691
  }
@@ -2742,8 +2839,8 @@ class RectangleCurve extends PloygonCurve {
2742
2839
  vertices = [],
2743
2840
  indices = [],
2744
2841
  verticesStride = 2,
2745
- verticesOffset = 0,
2746
- indicesOffset = 0
2842
+ verticesOffset = vertices.length / verticesStride,
2843
+ indicesOffset = indices.length
2747
2844
  } = options;
2748
2845
  const { x, y, width, height } = this;
2749
2846
  const points = [
@@ -2810,7 +2907,7 @@ class RoundRectangleCurve extends RoundCurve {
2810
2907
  const ry = rx;
2811
2908
  this._center = new Vector2(cx, cy);
2812
2909
  this._radius = new Vector2(rx, ry);
2813
- this._diff = new Vector2(width, height);
2910
+ this._diff = new Vector2(halfWidth - rx, halfHeight - ry);
2814
2911
  return this;
2815
2912
  }
2816
2913
  drawTo(ctx) {
@@ -3328,18 +3425,6 @@ class Path2D extends CompositeCurve {
3328
3425
  });
3329
3426
  return { min, max };
3330
3427
  }
3331
- fillTriangulate(options) {
3332
- const indices = options?.indices ?? [];
3333
- const vertices = options?.vertices ?? [];
3334
- this.curves.forEach((curve) => {
3335
- curve.fillTriangulate({
3336
- ...options,
3337
- indices,
3338
- vertices
3339
- });
3340
- });
3341
- return { indices, vertices };
3342
- }
3343
3428
  strokeTriangulate(options) {
3344
3429
  const indices = options?.indices ?? [];
3345
3430
  const vertices = options?.vertices ?? [];
package/dist/index.d.cts CHANGED
@@ -224,6 +224,7 @@ declare class CompositeCurve<T extends Curve = Curve> extends Curve {
224
224
  protected _removeNextPointIfEqualPrevPoint(output: number[], offset: number): number[];
225
225
  getSpacedPointArray(count?: number, output?: number[]): number[];
226
226
  getAdaptivePointArray(output?: number[]): number[];
227
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
227
228
  applyTransform(transform: Matrix3): this;
228
229
  getMinMax(min?: Vector2, max?: Vector2): {
229
230
  min: Vector2;
@@ -276,6 +277,7 @@ declare class LineCurve extends Curve {
276
277
  max: Vector2;
277
278
  };
278
279
  toCommands(): Path2DCommand[];
280
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
279
281
  drawTo(ctx: CanvasRenderingContext2D): this;
280
282
  copy(source: LineCurve): this;
281
283
  }
@@ -494,7 +496,6 @@ declare class Path2D extends CompositeCurve<CurvePath> {
494
496
  min: Vector2;
495
497
  max: Vector2;
496
498
  };
497
- fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
498
499
  strokeTriangulate(options?: StrokeTriangulateOptions): StrokeTriangulatedResult;
499
500
  getBoundingBox(withStyle?: boolean): BoundingBox;
500
501
  drawTo(ctx: CanvasRenderingContext2D, style?: Partial<Path2DStyle>): this;
package/dist/index.d.mts CHANGED
@@ -224,6 +224,7 @@ declare class CompositeCurve<T extends Curve = Curve> extends Curve {
224
224
  protected _removeNextPointIfEqualPrevPoint(output: number[], offset: number): number[];
225
225
  getSpacedPointArray(count?: number, output?: number[]): number[];
226
226
  getAdaptivePointArray(output?: number[]): number[];
227
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
227
228
  applyTransform(transform: Matrix3): this;
228
229
  getMinMax(min?: Vector2, max?: Vector2): {
229
230
  min: Vector2;
@@ -276,6 +277,7 @@ declare class LineCurve extends Curve {
276
277
  max: Vector2;
277
278
  };
278
279
  toCommands(): Path2DCommand[];
280
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
279
281
  drawTo(ctx: CanvasRenderingContext2D): this;
280
282
  copy(source: LineCurve): this;
281
283
  }
@@ -494,7 +496,6 @@ declare class Path2D extends CompositeCurve<CurvePath> {
494
496
  min: Vector2;
495
497
  max: Vector2;
496
498
  };
497
- fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
498
499
  strokeTriangulate(options?: StrokeTriangulateOptions): StrokeTriangulatedResult;
499
500
  getBoundingBox(withStyle?: boolean): BoundingBox;
500
501
  drawTo(ctx: CanvasRenderingContext2D, style?: Partial<Path2DStyle>): this;
package/dist/index.d.ts CHANGED
@@ -224,6 +224,7 @@ declare class CompositeCurve<T extends Curve = Curve> extends Curve {
224
224
  protected _removeNextPointIfEqualPrevPoint(output: number[], offset: number): number[];
225
225
  getSpacedPointArray(count?: number, output?: number[]): number[];
226
226
  getAdaptivePointArray(output?: number[]): number[];
227
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
227
228
  applyTransform(transform: Matrix3): this;
228
229
  getMinMax(min?: Vector2, max?: Vector2): {
229
230
  min: Vector2;
@@ -276,6 +277,7 @@ declare class LineCurve extends Curve {
276
277
  max: Vector2;
277
278
  };
278
279
  toCommands(): Path2DCommand[];
280
+ fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
279
281
  drawTo(ctx: CanvasRenderingContext2D): this;
280
282
  copy(source: LineCurve): this;
281
283
  }
@@ -494,7 +496,6 @@ declare class Path2D extends CompositeCurve<CurvePath> {
494
496
  min: Vector2;
495
497
  max: Vector2;
496
498
  };
497
- fillTriangulate(options?: FillTriangulateOptions): FillTriangulatedResult;
498
499
  strokeTriangulate(options?: StrokeTriangulateOptions): StrokeTriangulatedResult;
499
500
  getBoundingBox(withStyle?: boolean): BoundingBox;
500
501
  drawTo(ctx: CanvasRenderingContext2D, style?: Partial<Path2DStyle>): this;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(T,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(T=typeof globalThis<"u"?globalThis:T||self,R(T.modernPath2d={}))})(this,function(T){"use strict";var En=Object.defineProperty;var Ln=(T,R,nt)=>R in T?En(T,R,{enumerable:!0,configurable:!0,writable:!0,value:nt}):T[R]=nt;var X=(T,R,nt)=>Ln(T,typeof R!="symbol"?R+"":R,nt);function R(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const nt={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ct(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:c=0,strokeDasharray:h=[],strokeDashoffset:a=0,shadowOffsetX:l=0,shadowOffsetY:y=0,shadowBlur:f=0,shadowColor:x="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=nt[s],i.miterLimit=c,i.setLineDash(h),i.lineDashOffset=a,i.shadowOffsetX=l,i.shadowOffsetY=y,i.shadowBlur=f,i.shadowColor=x}class g{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new g(1/0,1/0)}static get MIN(){return new g(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),c=Math.cos(n);return this.set(t.x+(r*c-o*s),t.y-(r*s+o*c)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new g(this.x,this.y)}}class V{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new g((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new V;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new V(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new V(this.left,this.top,this.width,this.height)}}class z{constructor(e=1,t=0,n=0,r=0,o=1,s=0,c=0,h=0,a=1){X(this,"elements",[]);this.set(e,t,n,r,o,s,c,h,a)}set(e,t,n,r,o,s,c,h,a){const l=this.elements;return l[0]=e,l[1]=r,l[2]=c,l[3]=t,l[4]=o,l[5]=h,l[6]=n,l[7]=s,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,s=n[0],c=n[3],h=n[6],a=n[1],l=n[4],y=n[7],f=n[2],x=n[5],u=n[8],m=r[0],M=r[3],C=r[6],E=r[1],P=r[4],w=r[7],S=r[2],v=r[5],d=r[8];return o[0]=s*m+c*E+h*S,o[3]=s*M+c*P+h*v,o[6]=s*C+c*w+h*d,o[1]=a*m+l*E+y*S,o[4]=a*M+l*P+y*v,o[7]=a*C+l*w+y*d,o[2]=f*m+x*E+u*S,o[5]=f*M+x*P+u*v,o[8]=f*C+x*w+u*d,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],c=e[5],h=e[6],a=e[7],l=e[8],y=l*s-c*a,f=c*h-l*o,x=a*o-s*h,u=t*y+n*f+r*x;if(u===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/u;return e[0]=y*m,e[1]=(r*a-l*n)*m,e[2]=(c*n-r*s)*m,e[3]=f*m,e[4]=(l*t-r*h)*m,e[5]=(r*o-c*t)*m,e[6]=x*m,e[7]=(n*h-a*t)*m,e[8]=(s*t-n*o)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(bt.makeScale(e,t)),this}rotate(e){return this.premultiply(bt.makeRotation(-e)),this}translate(e,t){return this.premultiply(bt.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const bt=new z;function zt(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function Zt(i,e,t,n,r,o,s,c){if(e===0||t===0){i.lineTo(c.x,c.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const h=(s.x-c.x)/2,a=(s.y-c.y)/2,l=Math.cos(n)*h+Math.sin(n)*a,y=-Math.sin(n)*h+Math.cos(n)*a;let f=e*e,x=t*t;const u=l*l,m=y*y,M=u/f+m/x;if(M>1){const _=Math.sqrt(M);e=_*e,t=_*t,f=e*e,x=t*t}const C=f*m+x*u,E=(f*x-C)/C;let P=Math.sqrt(Math.max(0,E));r===o&&(P=-P);const w=P*e*y/t,S=-P*t*l/e,v=Math.cos(n)*w-Math.sin(n)*S+(s.x+c.x)/2,d=Math.sin(n)*w+Math.cos(n)*S+(s.y+c.y)/2,p=zt(1,0,(l-w)/e,(y-S)/t),N=zt((l-w)/e,(y-S)/t,(-l-w)/e,(-y-S)/t)%(Math.PI*2);i.ellipse(v,d,e,t,n,p,p+N,o===0)}const q={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Z(i,e,t=0){let c=0,h=!0,a="",l="";const y=[];function f(M,C,E){const P=new SyntaxError(`Unexpected character "${M}" at index ${C}.`);throw P.partial=E,P}function x(){a!==""&&(l===""?y.push(Number(a)):y.push(Number(a)*10**Number(l))),a="",l=""}let u;const m=i.length;for(let M=0;M<m;M++){if(u=i[M],Array.isArray(e)&&e.includes(y.length%t)&&q.FLAGS.test(u)){c=1,a=u,x();continue}if(c===0){if(q.WHITESPACE.test(u))continue;if(q.DIGIT.test(u)||q.SIGN.test(u)){c=1,a=u;continue}if(q.POINT.test(u)){c=2,a=u;continue}q.COMMA.test(u)&&(h&&f(u,M,y),h=!0)}if(c===1){if(q.DIGIT.test(u)){a+=u;continue}if(q.POINT.test(u)){a+=u,c=2;continue}if(q.EXP.test(u)){c=3;continue}q.SIGN.test(u)&&a.length===1&&q.SIGN.test(a[0])&&f(u,M,y)}if(c===2){if(q.DIGIT.test(u)){a+=u;continue}if(q.EXP.test(u)){c=3;continue}q.POINT.test(u)&&a[a.length-1]==="."&&f(u,M,y)}if(c===3){if(q.DIGIT.test(u)){l+=u;continue}if(q.SIGN.test(u)){if(l===""){l+=u;continue}l.length===1&&q.SIGN.test(l)&&f(u,M,y)}}q.WHITESPACE.test(u)?(x(),c=0,h=!1):q.COMMA.test(u)?(x(),c=0,h=!0):q.SIGN.test(u)?(x(),c=1,a=u):q.POINT.test(u)?(x(),c=2,a=u):f(u,M,y)}return x(),y}function st(i,e){return i-(e-i)}function kt(i,e){const t=new g,n=new g;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(st(t.x,n.x),st(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(st(t.x,n.x),st(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const c=st(t.x,n.x),h=st(t.y,n.y);n.x=c,n.y=h,s.type==="t"?(e.quadraticCurveTo(c,h,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(c,h,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const c=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),Zt(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,c,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function Gt(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const Ae=/[a-df-z][^a-df-z]*/gi;function It(i){const e=[],t=i.match(Ae);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),c=o.slice(1).trim();let h;switch(s){case"m":case"M":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)a===0?e.push({type:s,x:h[a],y:h[a+1]}):e.push({type:s==="m"?"l":"L",x:h[a],y:h[a+1]});break;case"h":case"H":h=Z(c);for(let a=0,l=h.length;a<l;a++)e.push({type:s,x:h[a]});break;case"v":case"V":h=Z(c);for(let a=0,l=h.length;a<l;a++)e.push({type:s,y:h[a]});break;case"l":case"L":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)e.push({type:s,x:h[a],y:h[a+1]});break;case"c":case"C":h=Z(c);for(let a=0,l=h.length;a<l;a+=6)e.push({type:s,x1:h[a],y1:h[a+1],x2:h[a+2],y2:h[a+3],x:h[a+4],y:h[a+5]});break;case"s":case"S":h=Z(c);for(let a=0,l=h.length;a<l;a+=4)e.push({type:s,x2:h[a],y2:h[a+1],x:h[a+2],y:h[a+3]});break;case"q":case"Q":h=Z(c);for(let a=0,l=h.length;a<l;a+=4)e.push({type:s,x1:h[a],y1:h[a+1],x:h[a+2],y:h[a+3]});break;case"t":case"T":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)e.push({type:s,x:h[a],y:h[a+1]});break;case"a":case"A":h=Z(c,[3,4],7);for(let a=0,l=h.length;a<l;a+=7)e.push({type:s,rx:h[a],ry:h[a+1],angle:h[a+2],largeArcFlag:h[a+3],sweepFlag:h[a+4],x:h[a+5],y:h[a+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function St(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,c=i*i,h=i*c;return(2*t-2*n+o+s)*h+(-3*t+3*n-2*o-s)*c+o*i+t}function Ce(i,e){const t=1-i;return t*t*t*e}function be(i,e){const t=1-i;return 3*t*t*i*e}function ke(i,e){return 3*(1-i)*i*i*e}function Ie(i,e){return i*i*i*e}function Et(i,e,t,n,r){return Ce(i,e)+be(i,t)+ke(i,n)+Ie(i,r)}function Se(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=Bt(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let c,h,a;if(n&&(o=_e(i,e,o,t)),i.length>80*t){c=1/0,h=1/0;let l=-1/0,y=-1/0;for(let f=t;f<r;f+=t){const x=i[f],u=i[f+1];x<c&&(c=x),u<h&&(h=u),x>l&&(l=x),u>y&&(y=u)}a=Math.max(l-c,y-h),a=a!==0?32767/a:0}return ot(o,s,t,c,h,a,0),s}function Bt(i,e,t,n,r){let o;if(r===Ue(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=Xt(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=Xt(s/n|0,i[s],i[s+1],o);return o&&it(o,o.next)&&(at(o),o=o.next),o}function H(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(it(t,t.next)||D(t.prev,t,t.next)===0)){if(at(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ot(i,e,t,n,r,o,s){if(!i)return;!s&&o&&Re(i,n,r,o);let c=i;for(;i.prev!==i.next;){const h=i.prev,a=i.next;if(o?Le(i,n,r,o):Ee(i)){e.push(h.i,i.i,a.i),at(i),i=a.next,c=a.next;continue}if(i=a,i===c){s?s===1?(i=$e(H(i),e),ot(i,e,t,n,r,o,2)):s===2&&Ne(i,e,t,n,r,o):ot(H(i),e,t,n,r,o,1);break}}}function Ee(i){const e=i.prev,t=i,n=i.next;if(D(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,c=e.y,h=t.y,a=n.y,l=Math.min(r,o,s),y=Math.min(c,h,a),f=Math.max(r,o,s),x=Math.max(c,h,a);let u=n.next;for(;u!==e;){if(u.x>=l&&u.x<=f&&u.y>=y&&u.y<=x&&ct(r,c,o,h,s,a,u.x,u.y)&&D(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function Le(i,e,t,n){const r=i.prev,o=i,s=i.next;if(D(r,o,s)>=0)return!1;const c=r.x,h=o.x,a=s.x,l=r.y,y=o.y,f=s.y,x=Math.min(c,h,a),u=Math.min(l,y,f),m=Math.max(c,h,a),M=Math.max(l,y,f),C=Lt(x,u,e,t,n),E=Lt(m,M,e,t,n);let P=i.prevZ,w=i.nextZ;for(;P&&P.z>=C&&w&&w.z<=E;){if(P.x>=x&&P.x<=m&&P.y>=u&&P.y<=M&&P!==r&&P!==s&&ct(c,l,h,y,a,f,P.x,P.y)&&D(P.prev,P,P.next)>=0||(P=P.prevZ,w.x>=x&&w.x<=m&&w.y>=u&&w.y<=M&&w!==r&&w!==s&&ct(c,l,h,y,a,f,w.x,w.y)&&D(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;P&&P.z>=C;){if(P.x>=x&&P.x<=m&&P.y>=u&&P.y<=M&&P!==r&&P!==s&&ct(c,l,h,y,a,f,P.x,P.y)&&D(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;w&&w.z<=E;){if(w.x>=x&&w.x<=m&&w.y>=u&&w.y<=M&&w!==r&&w!==s&&ct(c,l,h,y,a,f,w.x,w.y)&&D(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function $e(i,e){let t=i;do{const n=t.prev,r=t.next.next;!it(n,r)&&Ut(n,t,t.next,r)&&ht(n,r)&&ht(r,n)&&(e.push(n.i,t.i,r.i),at(t),at(t.next),t=i=r),t=t.next}while(t!==i);return H(t)}function Ne(i,e,t,n,r,o){let s=i;do{let c=s.next.next;for(;c!==s.prev;){if(s.i!==c.i&&Ge(s,c)){let h=Vt(s,c);s=H(s,s.next),h=H(h,h.next),ot(s,e,t,n,r,o,0),ot(h,e,t,n,r,o,0);return}c=c.next}s=s.next}while(s!==i)}function _e(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const c=e[o]*n,h=o<s-1?e[o+1]*n:i.length,a=Bt(i,c,h,n,!1);a===a.next&&(a.steiner=!0),r.push(Ze(a))}r.sort(De);for(let o=0;o<r.length;o++)t=qe(r[o],t);return t}function De(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function qe(i,e){const t=Fe(i,e);if(!t)return e;const n=Vt(t,i);return H(n,n.next),H(t,t.next)}function Fe(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(it(i,t))return t;do{if(it(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const y=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(y<=n&&y>o&&(o=y,s=t.x<t.next.x?t:t.next,y===n))return s}t=t.next}while(t!==e);if(!s)return null;const c=s,h=s.x,a=s.y;let l=1/0;t=s;do{if(n>=t.x&&t.x>=h&&n!==t.x&&jt(r<a?n:o,r,h,a,r<a?o:n,r,t.x,t.y)){const y=Math.abs(r-t.y)/(n-t.x);ht(t,i)&&(y<l||y===l&&(t.x>s.x||t.x===s.x&&Oe(s,t)))&&(s=t,l=y)}t=t.next}while(t!==c);return s}function Oe(i,e){return D(i.prev,i,e.prev)<0&&D(e.next,i,i.next)<0}function Re(i,e,t,n){let r=i;do r.z===0&&(r.z=Lt(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,ze(r)}function ze(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let s=n,c=0;for(let a=0;a<t&&(c++,s=s.nextZ,!!s);a++);let h=t;for(;c>0||h>0&&s;)c!==0&&(h===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,c--):(r=s,s=s.nextZ,h--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function Lt(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Ze(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function jt(i,e,t,n,r,o,s,c){return(r-s)*(e-c)>=(i-s)*(o-c)&&(i-s)*(n-c)>=(t-s)*(e-c)&&(t-s)*(o-c)>=(r-s)*(n-c)}function ct(i,e,t,n,r,o,s,c){return!(i===s&&e===c)&&jt(i,e,t,n,r,o,s,c)}function Ge(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Be(i,e)&&(ht(i,e)&&ht(e,i)&&je(i,e)&&(D(i.prev,i,e.prev)||D(i,e.prev,e))||it(i,e)&&D(i.prev,i,i.next)>0&&D(e.prev,e,e.next)>0)}function D(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function it(i,e){return i.x===e.x&&i.y===e.y}function Ut(i,e,t,n){const r=gt(D(i,e,t)),o=gt(D(i,e,n)),s=gt(D(t,n,i)),c=gt(D(t,n,e));return!!(r!==o&&s!==c||r===0&&pt(i,t,e)||o===0&&pt(i,n,e)||s===0&&pt(t,i,n)||c===0&&pt(t,e,n))}function pt(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function gt(i){return i>0?1:i<0?-1:0}function Be(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Ut(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function ht(i,e){return D(i.prev,i,i.next)<0?D(i,e,i.next)>=0&&D(i,i.prev,e)>=0:D(i,e,i.prev)<0||D(i,i.next,e)<0}function je(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Vt(i,e){const t=$t(i.i,i.x,i.y),n=$t(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Xt(i,e,t,n){const r=$t(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function at(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function $t(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ue(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function Wt(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=t.length/o,indicesOffset:c=n.length}=e;const h=Se(i,r,2);if(h){for(let l=0;l<h.length;l+=3)n[c++]=h[l]+s,n[c++]=h[l+1]+s,n[c++]=h[l+2]+s;let a=s*o;for(let l=0;l<i.length;l+=2)t[a]=i[l],t[a+1]=i[l+1],a+=o}return{vertices:t,indices:n}}const Ve=8,dt=11920929e-14,Xe=1;function Ht(i,e,t,n,r,o,s,c,h=.5,a=[]){const y=Math.min(.99,Math.max(0,h));let f=(Xe-y)/1;return f*=f,Nt(i,e,t,n,r,o,s,c,a,f,0),a.push(s,c),a}function Nt(i,e,t,n,r,o,s,c,h,a,l){if(l>Ve)return;const y=(i+t)/2,f=(e+n)/2,x=(t+r)/2,u=(n+o)/2,m=(r+s)/2,M=(o+c)/2,C=(y+x)/2,E=(f+u)/2,P=(x+m)/2,w=(u+M)/2,S=(C+P)/2,v=(E+w)/2;if(l>0){let d=s-i,p=c-e;const N=Math.abs((t-s)*p-(n-c)*d),_=Math.abs((r-s)*p-(o-c)*d);if(N>dt&&_>dt){if((N+_)*(N+_)<=a*(d*d+p*p)){h.push(S,v);return}}else if(N>dt){if(N*N<=a*(d*d+p*p)){h.push(S,v);return}}else if(_>dt){if(_*_<=a*(d*d+p*p)){h.push(S,v);return}}else if(d=S-(i+s)/2,p=v-(e+c)/2,d*d+p*p<=a){h.push(S,v);return}}Nt(i,e,y,f,C,E,S,v,h,a,l+1),Nt(S,v,P,w,m,M,s,c,h,a,l+1)}const We=8,He=11920929e-14,Qe=1;function Qt(i,e,t,n,r,o,s=.5,c=[]){const a=Math.min(.99,Math.max(0,s));let l=(Qe-a)/1;return l*=l,_t(c,i,e,t,n,r,o,l,0),c.push(r,o),c}function _t(i,e,t,n,r,o,s,c,h){if(h>We)return;const a=(e+n)/2,l=(t+r)/2,y=(n+o)/2,f=(r+s)/2,x=(a+y)/2,u=(l+f)/2;let m=o-e,M=s-t;const C=Math.abs((n-o)*M-(r-s)*m);if(C>He){if(C*C<=c*(m*m+M*M)){i.push(x,u);return}}else if(m=x-(e+o)/2,M=u-(t+s)/2,m*m+M*M<=c){i.push(x,u);return}_t(i,e,t,a,l,x,u,c,h+1),_t(i,x,u,y,f,o,s,c,h+1)}function Ye(i,e){const t=1-i;return t*t*e}function Je(i,e){return 2*(1-i)*i*e}function Ke(i,e){return i*i*e}function Dt(i,e,t,n){return Ye(i,e)+Je(i,t)+Ke(i,n)}const tn=1e-4,Yt=1e-4;function Jt(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,c=tn;if(i.length===0)return{vertices:t,indices:n};const h=r;let a=h.alignment;if(r.alignment!==.5){let $=en(i);o&&($*=-1),a=(a-.5)*$+.5}const l={x:i[0],y:i[1]},y={x:i[i.length-2],y:i[i.length-1]},f=s,x=Math.abs(l.x-y.x)<c&&Math.abs(l.y-y.y)<c;if(f){i=i.slice(),x&&(i.pop(),i.pop(),y.x=i[i.length-2],y.y=i[i.length-1]);const $=(l.x+y.x)*.5,W=(y.y+l.y)*.5;i.unshift($,W),i.push($,W)}const u=t,m=i.length/2;let M=i.length;const C=u.length/2,E=h.width/2,P=E*E,w=h.miterLimit*h.miterLimit;let S=i[0],v=i[1],d=i[2],p=i[3],N=0,_=0,b=-(v-p),k=S-d,F=0,O=0,B=Math.sqrt(b*b+k*k);b/=B,k/=B,b*=E,k*=E;const Me=a,A=(1-Me)*2,I=Me*2;f||(h.cap==="round"?M+=Q(S-b*(A-I)*.5,v-k*(A-I)*.5,S-b*A,v-k*A,S+b*I,v+k*I,u,!0)+2:h.cap==="square"&&(M+=Kt(S,v,b,k,A,I,!0,u))),u.push(S-b*A,v-k*A),u.push(S+b*I,v+k*I);for(let $=1;$<m-1;++$){S=i[($-1)*2],v=i[($-1)*2+1],d=i[$*2],p=i[$*2+1],N=i[($+1)*2],_=i[($+1)*2+1],b=-(v-p),k=S-d,B=Math.sqrt(b*b+k*k),b/=B,k/=B,b*=E,k*=E,F=-(p-_),O=d-N,B=Math.sqrt(F*F+O*O),F/=B,O/=B,F*=E,O*=E;const W=d-S,ut=v-p,yt=d-N,ft=_-p,Pe=W*yt+ut*ft,vt=ut*yt-ft*W,xt=vt<0;if(Math.abs(vt)<.001*Math.abs(Pe)){u.push(d-b*A,p-k*A),u.push(d+b*I,p+k*I),Pe>=0&&(h.join==="round"?M+=Q(d,p,d-b*A,p-k*A,d-F*A,p-O*A,u,!1)+4:M+=2,u.push(d-F*I,p-O*I),u.push(d+F*A,p+O*A));continue}const we=(-b+S)*(-k+p)-(-b+d)*(-k+v),ve=(-F+N)*(-O+p)-(-F+d)*(-O+_),Tt=(W*ve-yt*we)/vt,At=(ft*we-ut*ve)/vt,Rt=(Tt-d)*(Tt-d)+(At-p)*(At-p),J=d+(Tt-d)*A,K=p+(At-p)*A,tt=d-(Tt-d)*I,et=p-(At-p)*I,In=Math.min(W*W+ut*ut,yt*yt+ft*ft),Te=xt?A:I,Sn=In+Te*Te*P;Rt<=Sn?h.join==="bevel"||Rt/P>w?(xt?(u.push(J,K),u.push(d+b*I,p+k*I),u.push(J,K),u.push(d+F*I,p+O*I)):(u.push(d-b*A,p-k*A),u.push(tt,et),u.push(d-F*A,p-O*A),u.push(tt,et)),M+=2):h.join==="round"?xt?(u.push(J,K),u.push(d+b*I,p+k*I),M+=Q(d,p,d+b*I,p+k*I,d+F*I,p+O*I,u,!0)+4,u.push(J,K),u.push(d+F*I,p+O*I)):(u.push(d-b*A,p-k*A),u.push(tt,et),M+=Q(d,p,d-b*A,p-k*A,d-F*A,p-O*A,u,!1)+4,u.push(d-F*A,p-O*A),u.push(tt,et)):(u.push(J,K),u.push(tt,et)):(u.push(d-b*A,p-k*A),u.push(d+b*I,p+k*I),h.join==="round"?xt?M+=Q(d,p,d+b*I,p+k*I,d+F*I,p+O*I,u,!0)+2:M+=Q(d,p,d-b*A,p-k*A,d-F*A,p-O*A,u,!1)+2:h.join==="miter"&&Rt/P<=w&&(xt?(u.push(tt,et),u.push(tt,et)):(u.push(J,K),u.push(J,K)),M+=2),u.push(d-F*A,p-O*A),u.push(d+F*I,p+O*I),M+=2)}S=i[(m-2)*2],v=i[(m-2)*2+1],d=i[(m-1)*2],p=i[(m-1)*2+1],b=-(v-p),k=S-d,B=Math.sqrt(b*b+k*k),b/=B,k/=B,b*=E,k*=E,u.push(d-b*A,p-k*A),u.push(d+b*I,p+k*I),f||(h.cap==="round"?M+=Q(d-b*(A-I)*.5,p-k*(A-I)*.5,d-b*A,p-k*A,d+b*I,p+k*I,u,!1)+2:h.cap==="square"&&(M+=Kt(d,p,b,k,A,I,!1,u)));const kn=Yt*Yt;for(let $=C;$<M+C-2;++$)S=u[$*2],v=u[$*2+1],d=u[($+1)*2],p=u[($+1)*2+1],N=u[($+2)*2],_=u[($+2)*2+1],!(Math.abs(S*(p-_)+d*(_-v)+N*(v-p))<kn)&&n.push($,$+1,$+2);return{vertices:t,indices:n}}function en(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],c=i[n+1];t+=(s-r)*(c+o),r=s,o=c}return t<0?-1:1}function Kt(i,e,t,n,r,o,s,c){const h=i-t*r,a=e-n*r,l=i+t*o,y=e+n*o;let f,x;s?(f=n,x=-t):(f=-n,x=t);const u=h+f,m=a+x,M=l+f,C=y+x;return c.push(u,m),c.push(M,C),2}function Q(i,e,t,n,r,o,s,c){const h=t-i,a=n-e;let l=Math.atan2(h,a),y=Math.atan2(r-i,o-e);c&&l<y?l+=Math.PI*2:!c&&l>y&&(y+=Math.PI*2);let f=l;const x=y-l,u=Math.abs(x),m=Math.sqrt(h*h+a*a),M=(15*u*Math.sqrt(m)/Math.PI>>0)+1,C=x/M;if(f+=C,c){s.push(i,e),s.push(t,n);for(let E=1,P=f;E<M;E++,P+=C)s.push(i,e),s.push(i+Math.sin(P)*m,e+Math.cos(P)*m);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let E=1,P=f;E<M;E++,P+=C)s.push(i+Math.sin(P)*m,e+Math.cos(P)*m),s.push(i,e);s.push(r,o),s.push(i,e)}return M*2}class Y{constructor(){X(this,"arcLengthDivision",200);X(this,"_arcLengths")}getPointAt(e,t=new g){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new g;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new g;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const o=e[n],s=e[n+1];t.push(new g(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/n[0];let s=0,c=0,h=r-1,a;for(;c<=h;)if(s=Math.floor(c+(h-c)/2),a=n[s]-o,a<0)c=s+1;else if(a>0)h=s-1;else{h=s;break}if(s=h,n[s]===o)return s/(r-1);const l=n[s],f=n[s+1]-l,x=(o-l)/f;return(s+x)/(r-1)}getTangent(e,t=new g){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new g){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=g.MAX,t=g.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;r++){const s=n[r];e.min(s),t.max(s)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new V(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return Wt(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Jt(this.getAdaptivePointArray(),e)}toTriangulatedSVGString(e=this.fillTriangulate(),t=0){const{vertices:n,indices:r}=e,o={x:-t,y:-t},s={x:t,y:t},c=l=>{const y=n[l*2],f=n[l*2+1];return o.x=Math.min(o.x,y+t),s.x=Math.max(s.x,y+t),o.y=Math.min(o.y,f+t),s.y=Math.max(s.y,f+t),[y,f]};let h="";for(let l=0,y=r.length;l<y;l+=3){const f=c(r[l]),x=c(r[l+1]),u=c(r[l+2]);h+=`<polygon points="${f.join(",")} ${x.join(",")} ${u.join(",")}" fill="none" stroke="black" />`}const a=[o.x,o.y,s.x-o.x,s.y-o.y];return`<svg width="${a[2]}" height="${a[3]}" viewBox="${a.join(" ")}" xmlns="http://www.w3.org/2000/svg">${h}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return Gt(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const nn=new z,te=new z,ee=new z,mt=new g;class qt extends Y{constructor(e=new g,t=new g,n=new g,r=0,o=0,s=Math.PI*2,c=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=c}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new g){const n=this._getDeltaAngle(),r=this.startAngle+e*n;let o=this.cx+this.rx*Math.cos(r),s=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const c=Math.cos(this.rotate),h=Math.sin(this.rotate),a=o-this.cx,l=s-this.cy;o=a*c-l*h+this.cx,s=a*h+l*c+this.cy}return t.set(o,s)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:c,rotate:h}=this,a=e+n*Math.cos(o)*Math.cos(h)-r*Math.sin(o)*Math.sin(h),l=t+n*Math.cos(o)*Math.sin(h)+r*Math.sin(o)*Math.cos(h),y=Math.abs(o-s),f=y>Math.PI?1:0,x=c?1:0,u=h*180/Math.PI;if(y>=2*Math.PI){const m=o+Math.PI,M=e+n*Math.cos(m)*Math.cos(h)-r*Math.sin(m)*Math.sin(h),C=t+n*Math.cos(m)*Math.sin(h)+r*Math.sin(m)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:0,sweepFlag:x,x:M,y:C},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:0,sweepFlag:x,x:a,y:l}]}else{const m=e+n*Math.cos(s)*Math.cos(h)-r*Math.sin(s)*Math.sin(h),M=t+n*Math.cos(s)*Math.sin(h)+r*Math.sin(s)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:f,sweepFlag:x,x:m,y:M}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:c,endAngle:h,clockwise:a}=this;return e.ellipse(t,n,r,o,s,c,h,!a),this}applyTransform(e){return mt.set(this.cx,this.cy),mt.applyMatrix3(e),this.cx=mt.x,this.cy=mt.y,on(e)?sn(this,e):rn(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:c,startAngle:h}=this;if(!(r>=0&&o>=0&&s>=0&&c>=0))return e;const a=Math.PI*2,l=this._getDeltaAngle(),y=Math.abs(l)/a;let f=Math.ceil(2.3*Math.sqrt(r+o)*y);const x=[];if(s&&c){f=Math.ceil(f/4);const u=t-s/2,m=n-c/2,M=t+s/2,C=n-c/2,E=t+s/2,P=n+c/2,w=t-s/2,S=n+c/2;for(let v=0;v<=f;v++){const d=v/f,p=-Math.PI/2+d*(Math.PI/2),N=M+Math.cos(p)*r,_=C+Math.sin(p)*o;e.push(N,_)}for(let v=0;v<=f;v++){const p=0+v/f*(Math.PI/2),N=E+Math.cos(p)*r,_=P+Math.sin(p)*o;e.push(N,_)}for(let v=0;v<=f;v++){const d=v/f,p=Math.PI/2+d*(Math.PI/2),N=w+Math.cos(p)*r,_=S+Math.sin(p)*o;e.push(N,_)}for(let v=0;v<=f;v++){const d=v/f,p=Math.PI+d*(Math.PI/2),N=u+Math.cos(p)*r,_=m+Math.sin(p)*o;e.push(N,_)}}else for(let u=0;u<=f;u++){const m=u/f,M=h+m*l,C=t+Math.cos(M)*r,E=n+Math.sin(M)*o;x.push(C,E)}return Array.prototype.push.apply(e,x),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const c=this.getAdaptivePointArray();if(c.length===0)return{vertices:t,indices:n};let h=0,a=0;for(let f=0;f<c.length;f+=2)h+=c[f],a+=c[f+1];h/=c.length/2,a/=c.length/2;let l=o;t[l*r]=h,t[l*r+1]=a;const y=l++;for(let f=0;f<c.length;f+=2)t[l*r]=c[f],t[l*r+1]=c[f+1],f>0&&(n[s++]=l,n[s++]=y,n[s++]=l-1),l++;return n[s++]=y+1,n[s++]=y,n[s++]=l-1,{vertices:t,indices:n}}getMinMax(e=g.MAX,t=g.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:c}=this,h=Math.cos(c),a=Math.sin(c),l=Math.sqrt(o*o*h*h+s*s*a*a),y=Math.sqrt(o*o*a*a+s*s*h*h);return e.x=Math.min(e.x,n-l),e.y=Math.min(e.y,r-y),t.x=Math.max(t.x,n+l),t.y=Math.max(t.y,r+y),{min:e,max:t}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function sn(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new g(t*r,t*o),c=new g(-n*o,n*r),h=s.applyMatrix3(e),a=c.applyMatrix3(e),l=nn.set(h.x,a.x,0,h.y,a.y,0,0,0,1),y=te.copy(l).invert(),u=ee.copy(y).transpose().multiply(y).elements,m=cn(u[0],u[1],u[4]),M=Math.sqrt(m.rt1),C=Math.sqrt(m.rt2);if(i.rx=1/M,i.ry=1/C,i.rotate=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const P=te.set(M,0,0,0,C,0,0,0,1),w=ee.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),S=P.multiply(w).multiply(l),v=d=>{const{x:p,y:N}=new g(Math.cos(d),Math.sin(d)).applyMatrix3(S);return Math.atan2(N,p)};i.startAngle=v(i.startAngle),i.endAngle=v(i.endAngle),ne(e)&&(i.clockwise=!i.clockwise)}}function rn(i,e){const t=se(e),n=ie(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,ne(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function ne(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function on(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=se(i),r=ie(i);return Math.abs(t/(n*r))>Number.EPSILON}function se(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ie(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function cn(i,e,t){let n,r,o,s,c;const h=i+t,a=i-t,l=Math.sqrt(a*a+4*e*e);return h>0?(n=.5*(h+l),c=1/n,r=i*c*t-e*c*e):h<0?r=.5*(h-l):(n=.5*l,r=-.5*l),a>0?o=a+l:o=a-l,Math.abs(o)>2*Math.abs(e)?(c=-2*e/o,s=1/Math.sqrt(1+c*c),o=c*s):Math.abs(e)===0?(o=1,s=0):(c=-.5*o/e,o=1/Math.sqrt(1+c*c),s=c*o),a>0&&(c=o,o=-s,s=c),{rt1:n,rt2:r,cs:o,sn:s}}class re extends qt{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new g(e,t),new g(n,n),new g,0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:c}=this;return e.arc(t,n,r,o,s,!c),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:c}=this;let h=Math.abs(o-s);(!c&&o>s||c&&s>o)&&(h=2*Math.PI-h);let a=Math.max(6,Math.floor(6*r**(1/3)*(h/Math.PI)));a=Math.max(a,3);let l=h/a,y=o;l*=c?1:-1;for(let f=0;f<a+1;f++){const x=Math.cos(y),u=Math.sin(y),m=t+x*r,M=n+u*r;e.push(m,M),y+=l}return e}}class rt extends Y{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof rt?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new g){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,c=this.curves[o],h=c.getLength();return c.getPointAt(h===0?0:1-s/h,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){return e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),e}getSpacedPointArray(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedPointArray(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=g.MAX,t=g.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new V(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Mt extends Y{constructor(e=new g,t=new g,n=new g,r=new g){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,c,h){return new Mt(new g(e,t),new g(n,r),new g(o,s),new g(c,h))}getPoint(e,t=new g){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Et(e,n.x,r.x,o.x,s.x),Et(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return Ht(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),c=(-t-o)/(2*e);return[s,c].filter(h=>h>=0&&h<=1)}getMinMax(e=g.MAX,t=g.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,c=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),h=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),a=[0,1,...c,...h];return((y,f)=>{for(const x of y)for(let u=0;u<=f;u++){const m=u/f-.5,M=Math.min(1,Math.max(0,x+m)),C=this.getPoint(M);e.x=Math.min(e.x,C.x),e.y=Math.min(e.y,C.y),t.x=Math.max(t.x,C.x),t.y=Math.max(t.y,C.y)}})(a,10),{min:e,max:t}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class oe extends qt{constructor(e=0,t=0,n=1,r=1,o=0,s=0,c=Math.PI*2,h=!1){super(new g(e,t),new g(n,r),new g,o,s,c,h)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class j extends Y{constructor(e=new g,t=new g){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new j(new g(e,t),new g(n,r))}getPoint(e,t=new g){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new g){return this.getPoint(e,t)}getTangent(e,t=new g){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new g){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=g.MAX,t=g.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class Ft extends rt{}class hn extends Ft{constructor(e=0,t=0,n=1,r=3){super(),this.cx=e,this.cy=t,this.radius=n,this.sideCount=r,this.update()}update(){const{cx:e,cy:t,radius:n,sideCount:r}=this,o=[];for(let c=0;c<r;c++){const h=c*2*Math.PI/r-.5*Math.PI;o.push(new g(n*Math.cos(h),n*Math.sin(h)).add({x:e,y:t}))}const s=[];for(let c=0;c<r;c++)s.push(new j(o[c],o[(c+1)%r]));return this.curves=s,this}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.radius=e.radius,this.sideCount=e.sideCount,this.update(),this}}class Pt extends Y{constructor(e=new g,t=new g,n=new g){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new Pt(new g(e,t),new g(n,r),new g(o,s))}getPoint(e,t=new g){const{p1:n,cp:r,p2:o}=this;return t.set(Dt(e,n.x,r.x,o.x),Dt(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Qt(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=g.MAX,t=g.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),c=.5*(n.y+r.y),h=.5*(n.x+o.x),a=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,h),e.y=Math.min(e.y,n.y,o.y,c,a),t.x=Math.max(t.x,n.x,o.x,s,h),t.y=Math.max(t.y,n.y,o.y,c,a),{min:e,max:t}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class ce extends Ft{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,o=[new g(e,t),new g(e+n,t),new g(e+n,t+r),new g(e,t+r)];return this.curves=[new j(o[0],o[1]),new j(o[1],o[2]),new j(o[2],o[3]),new j(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const{x:c,y:h,width:a,height:l}=this,y=[c,h,c+a,h,c+a,h+l,c,h+l];let f=0;o*=r,t[o+f]=y[0],t[o+f+1]=y[1],f+=r,t[o+f]=y[2],t[o+f+1]=y[3],f+=r,t[o+f]=y[6],t[o+f+1]=y[7],f+=r,t[o+f]=y[4],t[o+f+1]=y[5],f+=r;const x=o/r;return n[s++]=x,n[s++]=x+1,n[s++]=x+2,n[s++]=x+1,n[s++]=x+3,n[s++]=x+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class he extends qt{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,c=r/2,h=e+s,a=t+c,l=Math.max(0,Math.min(o,Math.min(s,c))),y=l;return this._center=new g(h,a),this._radius=new g(l,y),this._diff=new g(n,r),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class ae extends Y{constructor(e=[]){super(),this.points=e}getPoint(e,t=new g){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,c=n[o===0?o:o-1],h=n[o],a=n[o>n.length-2?n.length-1:o+1],l=n[o>n.length-3?n.length-1:o+2];return t.set(St(s,c.x,h.x,a.x,l.x),St(s,c.y,h.y,a.y,l.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class lt extends rt{constructor(t){super();X(this,"startPoint");X(this,"currentPoint");X(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return kt(t,this),this}addData(t){return this.addCommands(It(t)),this}_closePointArray(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenPointArray(t=40,n=[]){return this._closePointArray(super.getUnevenPointArray(t,n))}getSpacedPointArray(t=40,n=[]){return this._closePointArray(super.getSpacedPointArray(t,n))}getAdaptivePointArray(t=[]){return this._closePointArray(super.getAdaptivePointArray(t))}_setCurrentPoint(t){return this.currentPoint=new g(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new j(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new g(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(j.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,c){const h=this.currentPoint;return h!=null&&h.equals({x:s,y:c})||this.curves.push(Mt.from((h==null?void 0:h.x)??0,(h==null?void 0:h.y)??0,t,n,r,o,s,c)),this._setCurrentPoint({x:s,y:c}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(Pt.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,c){const h=new re(t,n,r,o,s,!c);return this._connetLineTo(h),this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeArc(t,n,r,o,s,c){var h,a;return t+=((h=this.currentPoint)==null?void 0:h.x)??0,n+=((a=this.currentPoint)==null?void 0:a.y)??0,this.arc(t,n,r,o,s,c),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,c,h,a=!0){const l=new oe(t,n,r,o,s,c,h,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,n,r,o,s,c,h,a){var l,y;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((y=this.currentPoint)==null?void 0:y.y)??0,this.ellipse(t,n,r,o,s,c,h,a),this}rect(t,n,r,o){const s=new ce(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const c=new he(t,n,r,o,s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new g;return this.curves.push(new ae([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function an(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function ln(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),c=r.cross(o);if(c===0)return new g((i.x+t.x)/2,(i.y+t.y)/2);const h=s.cross(o)/c;return Math.abs(h)>1?new g((i.x+t.x)/2,(i.y+t.y)/2):new g(i.x+h*r.x,i.y+h*r.y)}class G extends rt{constructor(t,n={}){super();X(this,"currentCurve",new lt);X(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof G?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(r=>r===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof G?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new lt().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new lt,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,o,s,c){return this.currentCurve.bezierCurveTo(t,n,r,o,s,c),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,c){return this.currentCurve.arc(t,n,r,o,s,c),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,c,h,a){return this.currentCurve.ellipse(t,n,r,o,s,c,h,a),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}reset(){return this.currentCurve=new lt,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return kt(t,this),this}addData(t){return this.addCommands(It(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],o=[],s=[];n.forEach((h,a)=>{const l=h.getControlPointRefs(),y=h.isClockwise();s[a]=l,o[a]=y;const f=l[0],x=l[l.length-1]??f;r.push({start:y?x:f,end:y?f:x,index:a})});const c=[];return r.forEach((h,a)=>{c[a]=[],r.forEach((l,y)=>{var f;l.start&&h.end&&y!==a&&((f=l.start)!=null&&f.equals(h.end))&&c[a].push(l.index)})}),n.forEach((h,a)=>{const l=o[a];s[a].forEach(y=>{y.add(h.getNormal(h.getTForPoint(y)).scale(l?t:-t))})}),c.forEach((h,a)=>{const l=s[a];h.forEach(y=>{const f=s[y],x=ln(l[l.length-1],l[l.length-2]??l[l.length-1],f[0],f[1]??f[0]);x&&(l[l.length-1].copy(x),f[0].copy(x))})}),this}getMinMax(t=g.MAX,n=g.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const c=o/2,h=s.isClockwise(),a=[];for(let l=0;l<=1;l+=1/s.arcLengthDivision){const y=s.getPoint(l),f=s.getNormal(l),x=f.clone().scale(h?c:-c),u=f.clone().scale(h?-c:c);a.push(y.clone().add(x),y.clone().add(u),y.clone().add({x:c,y:0}),y.clone().add({x:-c,y:0}),y.clone().add({x:0,y:c}),y.clone().add({x:0,y:-c}),y.clone().add({x:c,y:c}),y.clone().add({x:-c,y:-c}))}t.min(...a),n.max(...a)}}),{min:t,max:n}}fillTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(o=>{o.fillTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(o=>{o.strokeTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new V(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Ct(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Ct(t,n),this.getControlPointRefs().forEach(s=>{R(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[an(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class le{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=g.MAX,n=g.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new V(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:o,width:s,height:c}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*t,h.height=c*t,h.style.width=`${s}px`,h.style.height=`${c}px`;const a=h.getContext("2d");return a&&(a.scale(t,t),a.translate(-r,-o),this.paths.forEach(l=>{l.drawTo(a,n)})),h}}const ue="data:image/svg+xml;",ye=`${ue}base64,`,fe=`${ue}charset=utf8,`;function xe(i){if(typeof i=="string"){let e;i.startsWith(ye)?(i=i.substring(ye.length,i.length),e=atob(i)):i.startsWith(fe)?(i=i.substring(fe.length,i.length),e=decodeURIComponent(i)):e=i;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
2
- ${e}`);return t.documentElement}else return i}const un="px",yn=90,pe=["mm","cm","in","pt","pc","px"],ge={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function L(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=pe.length;n<r;n++){const o=pe[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=ge[e][un],t<0&&(t=ge[e].in*yn),t*Number.parseFloat(i)}const fn=new z,wt=new z,de=new z,me=new z;function xn(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=pn(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function pn(i){const e=new z,t=fn;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(L(i.getAttribute("x")),L(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),c=o.length;if(s>0&&s<c){const h=o.slice(0,s),a=Z(o.slice(s+1));switch(t.identity(),h){case"translate":if(a.length>=1){const l=a[0];let y=0;a.length>=2&&(y=a[1]),t.translate(l,y)}break;case"rotate":if(a.length>=1){let l=0,y=0,f=0;l=a[0]*Math.PI/180,a.length>=3&&(y=a[1],f=a[2]),wt.makeTranslation(-y,-f),de.makeRotation(l),me.multiplyMatrices(de,wt),wt.makeTranslation(y,f),t.multiplyMatrices(wt,me)}break;case"scale":a.length>=1&&t.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&t.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&t.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&t.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}e.premultiply(t)}}return e}function gn(i){return new G().arc(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("r")||0),0,Math.PI*2)}function dn(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,c=0;c<s;c++){const h=n.style.item(c);o[h]=n.style.getPropertyValue(h)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function mn(i){return new G().ellipse(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("rx")||0),L(i.getAttribute("ry")||0),0,0,Math.PI*2)}function Mn(i){return new G().moveTo(L(i.getAttribute("x1")||0),L(i.getAttribute("y1")||0)).lineTo(L(i.getAttribute("x2")||0),L(i.getAttribute("y2")||0))}function Pn(i){const e=new G,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const wn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function vn(i){var n;const e=new G;let t=0;return(n=i.getAttribute("points"))==null||n.replace(wn,(r,o,s)=>{const c=L(o),h=L(s);return t===0?e.moveTo(c,h):e.lineTo(c,h),t++,r}),e.currentCurve.autoClose=!0,e}const Tn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function An(i){var n;const e=new G;let t=0;return(n=i.getAttribute("points"))==null||n.replace(Tn,(r,o,s)=>{const c=L(o),h=L(s);return t===0?e.moveTo(c,h):e.lineTo(c,h),t++,r}),e.currentCurve.autoClose=!1,e}function Cn(i){const e=L(i.getAttribute("x")||0),t=L(i.getAttribute("y")||0),n=L(i.getAttribute("rx")||i.getAttribute("ry")||0),r=L(i.getAttribute("ry")||i.getAttribute("rx")||0),o=L(i.getAttribute("width")),s=L(i.getAttribute("height")),c=1-.551915024494,h=new G;return h.moveTo(e+n,t),h.lineTo(e+o-n,t),(n!==0||r!==0)&&h.bezierCurveTo(e+o-n*c,t,e+o,t+r*c,e+o,t+r),h.lineTo(e+o,t+s-r),(n!==0||r!==0)&&h.bezierCurveTo(e+o,t+s-r*c,e+o-n*c,t+s,e+o-n,t+s),h.lineTo(e+n,t+s),(n!==0||r!==0)&&h.bezierCurveTo(e+n*c,t+s,e,t+s-r*c,e,t+s-r),h.lineTo(e,t+r),(n!==0||r!==0)&&h.bezierCurveTo(e,t+r*c,e+n*c,t,e+n,t),h}function U(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const a=i.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<a.length;l++)n=Object.assign(n,t[`.${a[l]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let a=i.style.length,l=0;l<a;l++){const y=i.style.item(l),f=i.style.getPropertyValue(y);e[y]=f,n[y]=f}function r(a,l,y=o){i.hasAttribute(a)&&(e[l]=y(i.getAttribute(a))),n[a]&&(e[l]=y(n[a]))}function o(a){return a.startsWith("url")&&console.warn("url access in attributes is not implemented."),a}function s(a){return Math.max(0,Math.min(1,L(a)))}function c(a){return Math.max(0,L(a))}function h(a){return a.split(" ").filter(l=>l!=="").map(l=>L(l))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",c),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",c),r("stroke-dasharray","strokeDasharray",h),r("stroke-dashoffset","strokeDashoffset",L),r("visibility","visibility"),e}function Ot(i,e,t=[],n={}){var y;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=U(i,s,n);break;case"style":dn(i,n);break;case"g":s=U(i,s,n);break;case"path":s=U(i,s,n),i.hasAttribute("d")&&(o=Pn(i));break;case"rect":s=U(i,s,n),o=Cn(i);break;case"polygon":s=U(i,s,n),o=vn(i);break;case"polyline":s=U(i,s,n),o=An(i);break;case"circle":s=U(i,s,n),o=gn(i);break;case"ellipse":s=U(i,s,n),o=mn(i);break;case"line":s=U(i,s,n),o=Mn(i);break;case"defs":r=!0;break;case"use":{s=U(i,s,n);const x=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),u=(y=i.viewportElement)==null?void 0:y.getElementById(x);u?Ot(u,s,t,n):console.warn(`'use node' references non-existent node id: ${x}`);break}default:console.warn(i);break}if(s.display==="none")return t;const c=new z,h=[],a=xn(i,c,h);o&&(o.applyTransform(c),t.push(o),o.style={...s});const l=i.childNodes;for(let f=0,x=l.length;f<x;f++){const u=l[f];r&&u.nodeName!=="style"&&u.nodeName!=="defs"||Ot(u,s,t,n)}return a&&(h.pop(),h.length>0?c.copy(h[h.length-1]):c.identity()),t}function bn(i){var t;const e=xe(i);return new le(Ot(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}T.ArcCurve=re,T.BoundingBox=V,T.CompositeCurve=rt,T.CubicBezierCurve=Mt,T.Curve=Y,T.CurvePath=lt,T.EllipseCurve=oe,T.EquilateralPloygonCurve=hn,T.LineCurve=j,T.Matrix3=z,T.Path2D=G,T.Path2DSet=le,T.PloygonCurve=Ft,T.QuadraticBezierCurve=Pt,T.RectangleCurve=ce,T.RoundRectangleCurve=he,T.SplineCurve=ae,T.Vector2=g,T.catmullRom=St,T.cubicBezier=Et,T.drawPoint=R,T.fillTriangulate=Wt,T.getAdaptiveCubicBezierCurvePoints=Ht,T.getAdaptiveQuadraticBezierCurvePoints=Qt,T.parseArcCommand=Zt,T.parsePathDataArgs=Z,T.quadraticBezier=Dt,T.setCanvasContext=Ct,T.strokeTriangulate=Jt,T.svgPathCommandsAddToPath2D=kt,T.svgPathCommandsToData=Gt,T.svgPathDataToCommands=It,T.svgToDOM=xe,T.svgToPath2DSet=bn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
1
+ (function(v,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(v=typeof globalThis<"u"?globalThis:v||self,R(v.modernPath2d={}))})(this,function(v){"use strict";var En=Object.defineProperty;var Ln=(v,R,nt)=>R in v?En(v,R,{enumerable:!0,configurable:!0,writable:!0,value:nt}):v[R]=nt;var X=(v,R,nt)=>Ln(v,typeof R!="symbol"?R+"":R,nt);function R(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const nt={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ct(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:c=0,strokeDasharray:h=[],strokeDashoffset:a=0,shadowOffsetX:l=0,shadowOffsetY:y=0,shadowBlur:f=0,shadowColor:x="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=nt[s],i.miterLimit=c,i.setLineDash(h),i.lineDashOffset=a,i.shadowOffsetX=l,i.shadowOffsetY=y,i.shadowBlur=f,i.shadowColor=x}class p{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new p(1/0,1/0)}static get MIN(){return new p(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),c=Math.cos(n);return this.set(t.x+(r*c-o*s),t.y-(r*s+o*c)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new p(this.x,this.y)}}class V{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new p((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new V;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new V(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new V(this.left,this.top,this.width,this.height)}}class z{constructor(e=1,t=0,n=0,r=0,o=1,s=0,c=0,h=0,a=1){X(this,"elements",[]);this.set(e,t,n,r,o,s,c,h,a)}set(e,t,n,r,o,s,c,h,a){const l=this.elements;return l[0]=e,l[1]=r,l[2]=c,l[3]=t,l[4]=o,l[5]=h,l[6]=n,l[7]=s,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,s=n[0],c=n[3],h=n[6],a=n[1],l=n[4],y=n[7],f=n[2],x=n[5],u=n[8],d=r[0],M=r[3],b=r[6],E=r[1],P=r[4],w=r[7],S=r[2],I=r[5],g=r[8];return o[0]=s*d+c*E+h*S,o[3]=s*M+c*P+h*I,o[6]=s*b+c*w+h*g,o[1]=a*d+l*E+y*S,o[4]=a*M+l*P+y*I,o[7]=a*b+l*w+y*g,o[2]=f*d+x*E+u*S,o[5]=f*M+x*P+u*I,o[8]=f*b+x*w+u*g,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],c=e[5],h=e[6],a=e[7],l=e[8],y=l*s-c*a,f=c*h-l*o,x=a*o-s*h,u=t*y+n*f+r*x;if(u===0)return this.set(0,0,0,0,0,0,0,0,0);const d=1/u;return e[0]=y*d,e[1]=(r*a-l*n)*d,e[2]=(c*n-r*s)*d,e[3]=f*d,e[4]=(l*t-r*h)*d,e[5]=(r*o-c*t)*d,e[6]=x*d,e[7]=(n*h-a*t)*d,e[8]=(s*t-n*o)*d,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(bt.makeScale(e,t)),this}rotate(e){return this.premultiply(bt.makeRotation(-e)),this}translate(e,t){return this.premultiply(bt.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const bt=new z;function Zt(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function jt(i,e,t,n,r,o,s,c){if(e===0||t===0){i.lineTo(c.x,c.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const h=(s.x-c.x)/2,a=(s.y-c.y)/2,l=Math.cos(n)*h+Math.sin(n)*a,y=-Math.sin(n)*h+Math.cos(n)*a;let f=e*e,x=t*t;const u=l*l,d=y*y,M=u/f+d/x;if(M>1){const F=Math.sqrt(M);e=F*e,t=F*t,f=e*e,x=t*t}const b=f*d+x*u,E=(f*x-b)/b;let P=Math.sqrt(Math.max(0,E));r===o&&(P=-P);const w=P*e*y/t,S=-P*t*l/e,I=Math.cos(n)*w-Math.sin(n)*S+(s.x+c.x)/2,g=Math.sin(n)*w+Math.cos(n)*S+(s.y+c.y)/2,m=Zt(1,0,(l-w)/e,(y-S)/t),q=Zt((l-w)/e,(y-S)/t,(-l-w)/e,(-y-S)/t)%(Math.PI*2);i.ellipse(I,g,e,t,n,m,m+q,o===0)}const D={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Z(i,e,t=0){let c=0,h=!0,a="",l="";const y=[];function f(M,b,E){const P=new SyntaxError(`Unexpected character "${M}" at index ${b}.`);throw P.partial=E,P}function x(){a!==""&&(l===""?y.push(Number(a)):y.push(Number(a)*10**Number(l))),a="",l=""}let u;const d=i.length;for(let M=0;M<d;M++){if(u=i[M],Array.isArray(e)&&e.includes(y.length%t)&&D.FLAGS.test(u)){c=1,a=u,x();continue}if(c===0){if(D.WHITESPACE.test(u))continue;if(D.DIGIT.test(u)||D.SIGN.test(u)){c=1,a=u;continue}if(D.POINT.test(u)){c=2,a=u;continue}D.COMMA.test(u)&&(h&&f(u,M,y),h=!0)}if(c===1){if(D.DIGIT.test(u)){a+=u;continue}if(D.POINT.test(u)){a+=u,c=2;continue}if(D.EXP.test(u)){c=3;continue}D.SIGN.test(u)&&a.length===1&&D.SIGN.test(a[0])&&f(u,M,y)}if(c===2){if(D.DIGIT.test(u)){a+=u;continue}if(D.EXP.test(u)){c=3;continue}D.POINT.test(u)&&a[a.length-1]==="."&&f(u,M,y)}if(c===3){if(D.DIGIT.test(u)){l+=u;continue}if(D.SIGN.test(u)){if(l===""){l+=u;continue}l.length===1&&D.SIGN.test(l)&&f(u,M,y)}}D.WHITESPACE.test(u)?(x(),c=0,h=!1):D.COMMA.test(u)?(x(),c=0,h=!0):D.SIGN.test(u)?(x(),c=1,a=u):D.POINT.test(u)?(x(),c=2,a=u):f(u,M,y)}return x(),y}function st(i,e){return i-(e-i)}function kt(i,e){const t=new p,n=new p;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(st(t.x,n.x),st(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(st(t.x,n.x),st(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const c=st(t.x,n.x),h=st(t.y,n.y);n.x=c,n.y=h,s.type==="t"?(e.quadraticCurveTo(c,h,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(c,h,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const c=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),jt(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,c,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function Gt(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const Ae=/[a-df-z][^a-df-z]*/gi;function It(i){const e=[],t=i.match(Ae);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),c=o.slice(1).trim();let h;switch(s){case"m":case"M":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)a===0?e.push({type:s,x:h[a],y:h[a+1]}):e.push({type:s==="m"?"l":"L",x:h[a],y:h[a+1]});break;case"h":case"H":h=Z(c);for(let a=0,l=h.length;a<l;a++)e.push({type:s,x:h[a]});break;case"v":case"V":h=Z(c);for(let a=0,l=h.length;a<l;a++)e.push({type:s,y:h[a]});break;case"l":case"L":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)e.push({type:s,x:h[a],y:h[a+1]});break;case"c":case"C":h=Z(c);for(let a=0,l=h.length;a<l;a+=6)e.push({type:s,x1:h[a],y1:h[a+1],x2:h[a+2],y2:h[a+3],x:h[a+4],y:h[a+5]});break;case"s":case"S":h=Z(c);for(let a=0,l=h.length;a<l;a+=4)e.push({type:s,x2:h[a],y2:h[a+1],x:h[a+2],y:h[a+3]});break;case"q":case"Q":h=Z(c);for(let a=0,l=h.length;a<l;a+=4)e.push({type:s,x1:h[a],y1:h[a+1],x:h[a+2],y:h[a+3]});break;case"t":case"T":h=Z(c);for(let a=0,l=h.length;a<l;a+=2)e.push({type:s,x:h[a],y:h[a+1]});break;case"a":case"A":h=Z(c,[3,4],7);for(let a=0,l=h.length;a<l;a+=7)e.push({type:s,rx:h[a],ry:h[a+1],angle:h[a+2],largeArcFlag:h[a+3],sweepFlag:h[a+4],x:h[a+5],y:h[a+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function St(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,c=i*i,h=i*c;return(2*t-2*n+o+s)*h+(-3*t+3*n-2*o-s)*c+o*i+t}function Ce(i,e){const t=1-i;return t*t*t*e}function be(i,e){const t=1-i;return 3*t*t*i*e}function ke(i,e){return 3*(1-i)*i*i*e}function Ie(i,e){return i*i*i*e}function Et(i,e,t,n,r){return Ce(i,e)+be(i,t)+ke(i,n)+Ie(i,r)}function Se(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=Bt(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let c,h,a;if(n&&(o=_e(i,e,o,t)),i.length>80*t){c=1/0,h=1/0;let l=-1/0,y=-1/0;for(let f=t;f<r;f+=t){const x=i[f],u=i[f+1];x<c&&(c=x),u<h&&(h=u),x>l&&(l=x),u>y&&(y=u)}a=Math.max(l-c,y-h),a=a!==0?32767/a:0}return ot(o,s,t,c,h,a,0),s}function Bt(i,e,t,n,r){let o;if(r===Ue(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=Wt(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=Wt(s/n|0,i[s],i[s+1],o);return o&&it(o,o.next)&&(at(o),o=o.next),o}function H(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(it(t,t.next)||N(t.prev,t,t.next)===0)){if(at(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ot(i,e,t,n,r,o,s){if(!i)return;!s&&o&&Re(i,n,r,o);let c=i;for(;i.prev!==i.next;){const h=i.prev,a=i.next;if(o?Le(i,n,r,o):Ee(i)){e.push(h.i,i.i,a.i),at(i),i=a.next,c=a.next;continue}if(i=a,i===c){s?s===1?(i=$e(H(i),e),ot(i,e,t,n,r,o,2)):s===2&&Ne(i,e,t,n,r,o):ot(H(i),e,t,n,r,o,1);break}}}function Ee(i){const e=i.prev,t=i,n=i.next;if(N(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,c=e.y,h=t.y,a=n.y,l=Math.min(r,o,s),y=Math.min(c,h,a),f=Math.max(r,o,s),x=Math.max(c,h,a);let u=n.next;for(;u!==e;){if(u.x>=l&&u.x<=f&&u.y>=y&&u.y<=x&&ct(r,c,o,h,s,a,u.x,u.y)&&N(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function Le(i,e,t,n){const r=i.prev,o=i,s=i.next;if(N(r,o,s)>=0)return!1;const c=r.x,h=o.x,a=s.x,l=r.y,y=o.y,f=s.y,x=Math.min(c,h,a),u=Math.min(l,y,f),d=Math.max(c,h,a),M=Math.max(l,y,f),b=Lt(x,u,e,t,n),E=Lt(d,M,e,t,n);let P=i.prevZ,w=i.nextZ;for(;P&&P.z>=b&&w&&w.z<=E;){if(P.x>=x&&P.x<=d&&P.y>=u&&P.y<=M&&P!==r&&P!==s&&ct(c,l,h,y,a,f,P.x,P.y)&&N(P.prev,P,P.next)>=0||(P=P.prevZ,w.x>=x&&w.x<=d&&w.y>=u&&w.y<=M&&w!==r&&w!==s&&ct(c,l,h,y,a,f,w.x,w.y)&&N(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;P&&P.z>=b;){if(P.x>=x&&P.x<=d&&P.y>=u&&P.y<=M&&P!==r&&P!==s&&ct(c,l,h,y,a,f,P.x,P.y)&&N(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;w&&w.z<=E;){if(w.x>=x&&w.x<=d&&w.y>=u&&w.y<=M&&w!==r&&w!==s&&ct(c,l,h,y,a,f,w.x,w.y)&&N(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function $e(i,e){let t=i;do{const n=t.prev,r=t.next.next;!it(n,r)&&Vt(n,t,t.next,r)&&ht(n,r)&&ht(r,n)&&(e.push(n.i,t.i,r.i),at(t),at(t.next),t=i=r),t=t.next}while(t!==i);return H(t)}function Ne(i,e,t,n,r,o){let s=i;do{let c=s.next.next;for(;c!==s.prev;){if(s.i!==c.i&&je(s,c)){let h=Xt(s,c);s=H(s,s.next),h=H(h,h.next),ot(s,e,t,n,r,o,0),ot(h,e,t,n,r,o,0);return}c=c.next}s=s.next}while(s!==i)}function _e(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const c=e[o]*n,h=o<s-1?e[o+1]*n:i.length,a=Bt(i,c,h,n,!1);a===a.next&&(a.steiner=!0),r.push(Ze(a))}r.sort(De);for(let o=0;o<r.length;o++)t=qe(r[o],t);return t}function De(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function qe(i,e){const t=Fe(i,e);if(!t)return e;const n=Xt(t,i);return H(n,n.next),H(t,t.next)}function Fe(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(it(i,t))return t;do{if(it(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const y=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(y<=n&&y>o&&(o=y,s=t.x<t.next.x?t:t.next,y===n))return s}t=t.next}while(t!==e);if(!s)return null;const c=s,h=s.x,a=s.y;let l=1/0;t=s;do{if(n>=t.x&&t.x>=h&&n!==t.x&&Ut(r<a?n:o,r,h,a,r<a?o:n,r,t.x,t.y)){const y=Math.abs(r-t.y)/(n-t.x);ht(t,i)&&(y<l||y===l&&(t.x>s.x||t.x===s.x&&Oe(s,t)))&&(s=t,l=y)}t=t.next}while(t!==c);return s}function Oe(i,e){return N(i.prev,i,e.prev)<0&&N(e.next,i,i.next)<0}function Re(i,e,t,n){let r=i;do r.z===0&&(r.z=Lt(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,ze(r)}function ze(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let s=n,c=0;for(let a=0;a<t&&(c++,s=s.nextZ,!!s);a++);let h=t;for(;c>0||h>0&&s;)c!==0&&(h===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,c--):(r=s,s=s.nextZ,h--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function Lt(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Ze(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Ut(i,e,t,n,r,o,s,c){return(r-s)*(e-c)>=(i-s)*(o-c)&&(i-s)*(n-c)>=(t-s)*(e-c)&&(t-s)*(o-c)>=(r-s)*(n-c)}function ct(i,e,t,n,r,o,s,c){return!(i===s&&e===c)&&Ut(i,e,t,n,r,o,s,c)}function je(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Ge(i,e)&&(ht(i,e)&&ht(e,i)&&Be(i,e)&&(N(i.prev,i,e.prev)||N(i,e.prev,e))||it(i,e)&&N(i.prev,i,i.next)>0&&N(e.prev,e,e.next)>0)}function N(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function it(i,e){return i.x===e.x&&i.y===e.y}function Vt(i,e,t,n){const r=gt(N(i,e,t)),o=gt(N(i,e,n)),s=gt(N(t,n,i)),c=gt(N(t,n,e));return!!(r!==o&&s!==c||r===0&&pt(i,t,e)||o===0&&pt(i,n,e)||s===0&&pt(t,i,n)||c===0&&pt(t,e,n))}function pt(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function gt(i){return i>0?1:i<0?-1:0}function Ge(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Vt(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function ht(i,e){return N(i.prev,i,i.next)<0?N(i,e,i.next)>=0&&N(i,i.prev,e)>=0:N(i,e,i.prev)<0||N(i,i.next,e)<0}function Be(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Xt(i,e){const t=$t(i.i,i.x,i.y),n=$t(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Wt(i,e,t,n){const r=$t(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function at(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function $t(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ue(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function Nt(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=t.length/o,indicesOffset:c=n.length}=e;const h=Se(i,r,2);if(h){for(let l=0;l<h.length;l+=3)n[c++]=h[l]+s,n[c++]=h[l+1]+s,n[c++]=h[l+2]+s;let a=s*o;for(let l=0;l<i.length;l+=2)t[a]=i[l],t[a+1]=i[l+1],a+=o}return{vertices:t,indices:n}}const Ve=8,dt=11920929e-14,Xe=1;function Ht(i,e,t,n,r,o,s,c,h=.5,a=[]){const y=Math.min(.99,Math.max(0,h));let f=(Xe-y)/1;return f*=f,_t(i,e,t,n,r,o,s,c,a,f,0),a.push(s,c),a}function _t(i,e,t,n,r,o,s,c,h,a,l){if(l>Ve)return;const y=(i+t)/2,f=(e+n)/2,x=(t+r)/2,u=(n+o)/2,d=(r+s)/2,M=(o+c)/2,b=(y+x)/2,E=(f+u)/2,P=(x+d)/2,w=(u+M)/2,S=(b+P)/2,I=(E+w)/2;if(l>0){let g=s-i,m=c-e;const q=Math.abs((t-s)*m-(n-c)*g),F=Math.abs((r-s)*m-(o-c)*g);if(q>dt&&F>dt){if((q+F)*(q+F)<=a*(g*g+m*m)){h.push(S,I);return}}else if(q>dt){if(q*q<=a*(g*g+m*m)){h.push(S,I);return}}else if(F>dt){if(F*F<=a*(g*g+m*m)){h.push(S,I);return}}else if(g=S-(i+s)/2,m=I-(e+c)/2,g*g+m*m<=a){h.push(S,I);return}}_t(i,e,y,f,b,E,S,I,h,a,l+1),_t(S,I,P,w,d,M,s,c,h,a,l+1)}const We=8,He=11920929e-14,Qe=1;function Qt(i,e,t,n,r,o,s=.5,c=[]){const a=Math.min(.99,Math.max(0,s));let l=(Qe-a)/1;return l*=l,Dt(c,i,e,t,n,r,o,l,0),c.push(r,o),c}function Dt(i,e,t,n,r,o,s,c,h){if(h>We)return;const a=(e+n)/2,l=(t+r)/2,y=(n+o)/2,f=(r+s)/2,x=(a+y)/2,u=(l+f)/2;let d=o-e,M=s-t;const b=Math.abs((n-o)*M-(r-s)*d);if(b>He){if(b*b<=c*(d*d+M*M)){i.push(x,u);return}}else if(d=x-(e+o)/2,M=u-(t+s)/2,d*d+M*M<=c){i.push(x,u);return}Dt(i,e,t,a,l,x,u,c,h+1),Dt(i,x,u,y,f,o,s,c,h+1)}function Ye(i,e){const t=1-i;return t*t*e}function Je(i,e){return 2*(1-i)*i*e}function Ke(i,e){return i*i*e}function qt(i,e,t,n){return Ye(i,e)+Je(i,t)+Ke(i,n)}const tn=1e-4,Yt=1e-4;function Jt(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,c=tn;if(i.length===0)return{vertices:t,indices:n};const h=r;let a=h.alignment;if(r.alignment!==.5){let $=en(i);o&&($*=-1),a=(a-.5)*$+.5}const l={x:i[0],y:i[1]},y={x:i[i.length-2],y:i[i.length-1]},f=s,x=Math.abs(l.x-y.x)<c&&Math.abs(l.y-y.y)<c;if(f){i=i.slice(),x&&(i.pop(),i.pop(),y.x=i[i.length-2],y.y=i[i.length-1]);const $=(l.x+y.x)*.5,W=(y.y+l.y)*.5;i.unshift($,W),i.push($,W)}const u=t,d=i.length/2;let M=i.length;const b=u.length/2,E=h.width/2,P=E*E,w=h.miterLimit*h.miterLimit;let S=i[0],I=i[1],g=i[2],m=i[3],q=0,F=0,A=-(I-m),C=S-g,_=0,O=0,B=Math.sqrt(A*A+C*C);A/=B,C/=B,A*=E,C*=E;const Me=a,T=(1-Me)*2,k=Me*2;f||(h.cap==="round"?M+=Q(S-A*(T-k)*.5,I-C*(T-k)*.5,S-A*T,I-C*T,S+A*k,I+C*k,u,!0)+2:h.cap==="square"&&(M+=Kt(S,I,A,C,T,k,!0,u))),u.push(S-A*T,I-C*T),u.push(S+A*k,I+C*k);for(let $=1;$<d-1;++$){S=i[($-1)*2],I=i[($-1)*2+1],g=i[$*2],m=i[$*2+1],q=i[($+1)*2],F=i[($+1)*2+1],A=-(I-m),C=S-g,B=Math.sqrt(A*A+C*C),A/=B,C/=B,A*=E,C*=E,_=-(m-F),O=g-q,B=Math.sqrt(_*_+O*O),_/=B,O/=B,_*=E,O*=E;const W=g-S,ut=I-m,yt=g-q,ft=F-m,Pe=W*yt+ut*ft,vt=ut*yt-ft*W,xt=vt<0;if(Math.abs(vt)<.001*Math.abs(Pe)){u.push(g-A*T,m-C*T),u.push(g+A*k,m+C*k),Pe>=0&&(h.join==="round"?M+=Q(g,m,g-A*T,m-C*T,g-_*T,m-O*T,u,!1)+4:M+=2,u.push(g-_*k,m-O*k),u.push(g+_*T,m+O*T));continue}const we=(-A+S)*(-C+m)-(-A+g)*(-C+I),ve=(-_+q)*(-O+m)-(-_+g)*(-O+F),Tt=(W*ve-yt*we)/vt,At=(ft*we-ut*ve)/vt,zt=(Tt-g)*(Tt-g)+(At-m)*(At-m),J=g+(Tt-g)*T,K=m+(At-m)*T,tt=g-(Tt-g)*k,et=m-(At-m)*k,In=Math.min(W*W+ut*ut,yt*yt+ft*ft),Te=xt?T:k,Sn=In+Te*Te*P;zt<=Sn?h.join==="bevel"||zt/P>w?(xt?(u.push(J,K),u.push(g+A*k,m+C*k),u.push(J,K),u.push(g+_*k,m+O*k)):(u.push(g-A*T,m-C*T),u.push(tt,et),u.push(g-_*T,m-O*T),u.push(tt,et)),M+=2):h.join==="round"?xt?(u.push(J,K),u.push(g+A*k,m+C*k),M+=Q(g,m,g+A*k,m+C*k,g+_*k,m+O*k,u,!0)+4,u.push(J,K),u.push(g+_*k,m+O*k)):(u.push(g-A*T,m-C*T),u.push(tt,et),M+=Q(g,m,g-A*T,m-C*T,g-_*T,m-O*T,u,!1)+4,u.push(g-_*T,m-O*T),u.push(tt,et)):(u.push(J,K),u.push(tt,et)):(u.push(g-A*T,m-C*T),u.push(g+A*k,m+C*k),h.join==="round"?xt?M+=Q(g,m,g+A*k,m+C*k,g+_*k,m+O*k,u,!0)+2:M+=Q(g,m,g-A*T,m-C*T,g-_*T,m-O*T,u,!1)+2:h.join==="miter"&&zt/P<=w&&(xt?(u.push(tt,et),u.push(tt,et)):(u.push(J,K),u.push(J,K)),M+=2),u.push(g-_*T,m-O*T),u.push(g+_*k,m+O*k),M+=2)}S=i[(d-2)*2],I=i[(d-2)*2+1],g=i[(d-1)*2],m=i[(d-1)*2+1],A=-(I-m),C=S-g,B=Math.sqrt(A*A+C*C),A/=B,C/=B,A*=E,C*=E,u.push(g-A*T,m-C*T),u.push(g+A*k,m+C*k),f||(h.cap==="round"?M+=Q(g-A*(T-k)*.5,m-C*(T-k)*.5,g-A*T,m-C*T,g+A*k,m+C*k,u,!1)+2:h.cap==="square"&&(M+=Kt(g,m,A,C,T,k,!1,u)));const kn=Yt*Yt;for(let $=b;$<M+b-2;++$)S=u[$*2],I=u[$*2+1],g=u[($+1)*2],m=u[($+1)*2+1],q=u[($+2)*2],F=u[($+2)*2+1],!(Math.abs(S*(m-F)+g*(F-I)+q*(I-m))<kn)&&n.push($,$+1,$+2);return{vertices:t,indices:n}}function en(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],c=i[n+1];t+=(s-r)*(c+o),r=s,o=c}return t<0?-1:1}function Kt(i,e,t,n,r,o,s,c){const h=i-t*r,a=e-n*r,l=i+t*o,y=e+n*o;let f,x;s?(f=n,x=-t):(f=-n,x=t);const u=h+f,d=a+x,M=l+f,b=y+x;return c.push(u,d),c.push(M,b),2}function Q(i,e,t,n,r,o,s,c){const h=t-i,a=n-e;let l=Math.atan2(h,a),y=Math.atan2(r-i,o-e);c&&l<y?l+=Math.PI*2:!c&&l>y&&(y+=Math.PI*2);let f=l;const x=y-l,u=Math.abs(x),d=Math.sqrt(h*h+a*a),M=(15*u*Math.sqrt(d)/Math.PI>>0)+1,b=x/M;if(f+=b,c){s.push(i,e),s.push(t,n);for(let E=1,P=f;E<M;E++,P+=b)s.push(i,e),s.push(i+Math.sin(P)*d,e+Math.cos(P)*d);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let E=1,P=f;E<M;E++,P+=b)s.push(i+Math.sin(P)*d,e+Math.cos(P)*d),s.push(i,e);s.push(r,o),s.push(i,e)}return M*2}class Y{constructor(){X(this,"arcLengthDivision",200);X(this,"_arcLengths")}getPointAt(e,t=new p){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new p;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new p;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const o=e[n],s=e[n+1];t.push(new p(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/n[0];let s=0,c=0,h=r-1,a;for(;c<=h;)if(s=Math.floor(c+(h-c)/2),a=n[s]-o,a<0)c=s+1;else if(a>0)h=s-1;else{h=s;break}if(s=h,n[s]===o)return s/(r-1);const l=n[s],f=n[s+1]-l,x=(o-l)/f;return(s+x)/(r-1)}getTangent(e,t=new p){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new p){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=p.MAX,t=p.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;r++){const s=n[r];e.min(s),t.max(s)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new V(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return Nt(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Jt(this.getAdaptivePointArray(),e)}toTriangulatedSVGString(e=this.fillTriangulate(),t=0){const{vertices:n,indices:r}=e,o={x:-t,y:-t},s={x:t,y:t},c=l=>{const y=n[l*2],f=n[l*2+1];return o.x=Math.min(o.x,y+t),s.x=Math.max(s.x,y+t),o.y=Math.min(o.y,f+t),s.y=Math.max(s.y,f+t),[y,f]};let h="";for(let l=0,y=r.length;l<y;l+=3){const f=c(r[l]),x=c(r[l+1]),u=c(r[l+2]);h+=`<polygon points="${f.join(",")} ${x.join(",")} ${u.join(",")}" fill="none" stroke="black" />`}const a=[o.x,o.y,s.x-o.x,s.y-o.y];return`<svg width="${a[2]}" height="${a[3]}" viewBox="${a.join(" ")}" xmlns="http://www.w3.org/2000/svg">${h}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return Gt(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const nn=new z,te=new z,ee=new z,mt=new p;class Ft extends Y{constructor(e=new p,t=new p,n=new p,r=0,o=0,s=Math.PI*2,c=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=c}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new p){const n=this._getDeltaAngle(),r=this.startAngle+e*n;let o=this.cx+this.rx*Math.cos(r),s=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const c=Math.cos(this.rotate),h=Math.sin(this.rotate),a=o-this.cx,l=s-this.cy;o=a*c-l*h+this.cx,s=a*h+l*c+this.cy}return t.set(o,s)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:c,rotate:h}=this,a=e+n*Math.cos(o)*Math.cos(h)-r*Math.sin(o)*Math.sin(h),l=t+n*Math.cos(o)*Math.sin(h)+r*Math.sin(o)*Math.cos(h),y=Math.abs(o-s),f=y>Math.PI?1:0,x=c?1:0,u=h*180/Math.PI;if(y>=2*Math.PI){const d=o+Math.PI,M=e+n*Math.cos(d)*Math.cos(h)-r*Math.sin(d)*Math.sin(h),b=t+n*Math.cos(d)*Math.sin(h)+r*Math.sin(d)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:0,sweepFlag:x,x:M,y:b},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:0,sweepFlag:x,x:a,y:l}]}else{const d=e+n*Math.cos(s)*Math.cos(h)-r*Math.sin(s)*Math.sin(h),M=t+n*Math.cos(s)*Math.sin(h)+r*Math.sin(s)*Math.cos(h);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:u,largeArcFlag:f,sweepFlag:x,x:d,y:M}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:c,endAngle:h,clockwise:a}=this;return e.ellipse(t,n,r,o,s,c,h,!a),this}applyTransform(e){return mt.set(this.cx,this.cy),mt.applyMatrix3(e),this.cx=mt.x,this.cy=mt.y,on(e)?sn(this,e):rn(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:c}=this;if(!(r>=0&&o>=0&&s>=0&&c>=0))return e;const h=Math.ceil(2.3*Math.sqrt(r+o)),a=t,l=n,y=h*8+(s?4:0)+(c?4:0);if(y===0)return e;if(h===0)return e[0]=e[6]=a+s,e[1]=e[3]=l+c,e[2]=e[4]=a-s,e[5]=e[7]=l-c,e;let f=0,x=h*4+(s?2:0)+2,u=x,d=y,M=s+r,b=c,E=a+M,P=a-M,w=l+b;if(e[f++]=E,e[f++]=w,e[--x]=w,e[--x]=P,c){const I=l-b;e[u++]=P,e[u++]=I,e[--d]=I,e[--d]=E}for(let I=1;I<h;I++){const g=Math.PI/2*(I/h),m=s+Math.cos(g)*r,q=c+Math.sin(g)*o,F=a+m,A=a-m,C=l+q,_=l-q;e[f++]=F,e[f++]=C,e[--x]=C,e[--x]=A,e[u++]=A,e[u++]=_,e[--d]=_,e[--d]=F}M=s,b=c+o,E=a+M,P=a-M,w=l+b;const S=l-b;return e[f++]=E,e[f++]=w,e[--d]=S,e[--d]=E,s&&(e[f++]=P,e[f++]=w,e[--d]=S,e[--d]=P),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const c=this.getAdaptivePointArray();if(c.length===0)return{vertices:t,indices:n};let h=0,a=0;for(let f=0;f<c.length;f+=2)h+=c[f],a+=c[f+1];h/=c.length/2,a/=c.length/2;let l=o;t[l*r]=h,t[l*r+1]=a;const y=l++;for(let f=0;f<c.length;f+=2)t[l*r]=c[f],t[l*r+1]=c[f+1],f>0&&(n[s++]=l,n[s++]=y,n[s++]=l-1),l++;return n[s++]=y+1,n[s++]=y,n[s++]=l-1,{vertices:t,indices:n}}getMinMax(e=p.MAX,t=p.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:c}=this,h=Math.cos(c),a=Math.sin(c),l=Math.sqrt(o*o*h*h+s*s*a*a),y=Math.sqrt(o*o*a*a+s*s*h*h);return e.x=Math.min(e.x,n-l),e.y=Math.min(e.y,r-y),t.x=Math.max(t.x,n+l),t.y=Math.max(t.y,r+y),{min:e,max:t}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function sn(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new p(t*r,t*o),c=new p(-n*o,n*r),h=s.applyMatrix3(e),a=c.applyMatrix3(e),l=nn.set(h.x,a.x,0,h.y,a.y,0,0,0,1),y=te.copy(l).invert(),u=ee.copy(y).transpose().multiply(y).elements,d=cn(u[0],u[1],u[4]),M=Math.sqrt(d.rt1),b=Math.sqrt(d.rt2);if(i.rx=1/M,i.ry=1/b,i.rotate=Math.atan2(d.sn,d.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const P=te.set(M,0,0,0,b,0,0,0,1),w=ee.set(d.cs,d.sn,0,-d.sn,d.cs,0,0,0,1),S=P.multiply(w).multiply(l),I=g=>{const{x:m,y:q}=new p(Math.cos(g),Math.sin(g)).applyMatrix3(S);return Math.atan2(q,m)};i.startAngle=I(i.startAngle),i.endAngle=I(i.endAngle),ne(e)&&(i.clockwise=!i.clockwise)}}function rn(i,e){const t=se(e),n=ie(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,ne(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function ne(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function on(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=se(i),r=ie(i);return Math.abs(t/(n*r))>Number.EPSILON}function se(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ie(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function cn(i,e,t){let n,r,o,s,c;const h=i+t,a=i-t,l=Math.sqrt(a*a+4*e*e);return h>0?(n=.5*(h+l),c=1/n,r=i*c*t-e*c*e):h<0?r=.5*(h-l):(n=.5*l,r=-.5*l),a>0?o=a+l:o=a-l,Math.abs(o)>2*Math.abs(e)?(c=-2*e/o,s=1/Math.sqrt(1+c*c),o=c*s):Math.abs(e)===0?(o=1,s=0):(c=-.5*o/e,o=1/Math.sqrt(1+c*c),s=c*o),a>0&&(c=o,o=-s,s=c),{rt1:n,rt2:r,cs:o,sn:s}}class re extends Ft{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new p(e,t),new p(n,n),new p,0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:c}=this;return e.arc(t,n,r,o,s,!c),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:c}=this;let h=Math.abs(o-s);(!c&&o>s||c&&s>o)&&(h=2*Math.PI-h);let a=Math.max(6,Math.floor(6*r**(1/3)*(h/Math.PI)));a=Math.max(a,3);let l=h/a,y=o;l*=c?1:-1;for(let f=0;f<a+1;f++){const x=Math.cos(y),u=Math.sin(y),d=t+x*r,M=n+u*r;e.push(d,M),y+=l}return e}}class j extends Y{constructor(e=new p,t=new p){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new j(new p(e,t),new p(n,r))}getPoint(e,t=new p){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new p){return this.getPoint(e,t)}getTangent(e,t=new p){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new p){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=p.MAX,t=p.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const c=this.p1.x,h=this.p1.y,a=this.p2.x-this.p1.x||1,l=this.p2.y-this.p2.y||1,y=[c,h,c+a,h,c+a,h+l,c,h+l];let f=0;o*=r,t[o+f]=y[0],t[o+f+1]=y[1],f+=r,t[o+f]=y[2],t[o+f+1]=y[3],f+=r,t[o+f]=y[6],t[o+f+1]=y[7],f+=r,t[o+f]=y[4],t[o+f+1]=y[5],f+=r;const x=o/r;return n[s++]=x,n[s++]=x+1,n[s++]=x+2,n[s++]=x+1,n[s++]=x+3,n[s++]=x+2,{vertices:t,indices:n}}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class rt extends Y{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof rt?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new p){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,c=this.curves[o],h=c.getLength();return c.getPointAt(h===0?0:1-s/h,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){return e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),e}getSpacedPointArray(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedPointArray(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}fillTriangulate(e){const t=(e==null?void 0:e.indices)??[],n=(e==null?void 0:e.vertices)??[],r=[],o=()=>{if(r.length){const s=[];r.forEach(c=>{const h=c.p1.x,a=c.p1.y;(s[s.length-2]!==h||s[s.length-1]!==a)&&s.push(h,a),s.push(c.p2.x,c.p2.y)}),Nt(s,{...e,indices:t,vertices:n}),r.length=0}};return this.curves.forEach(s=>{s instanceof j?r.push(s):(o(),s.fillTriangulate({...e,indices:t,vertices:n}))}),o(),{indices:t,vertices:n}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=p.MAX,t=p.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new V(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Mt extends Y{constructor(e=new p,t=new p,n=new p,r=new p){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,c,h){return new Mt(new p(e,t),new p(n,r),new p(o,s),new p(c,h))}getPoint(e,t=new p){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Et(e,n.x,r.x,o.x,s.x),Et(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return Ht(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),c=(-t-o)/(2*e);return[s,c].filter(h=>h>=0&&h<=1)}getMinMax(e=p.MAX,t=p.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,c=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),h=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),a=[0,1,...c,...h];return((y,f)=>{for(const x of y)for(let u=0;u<=f;u++){const d=u/f-.5,M=Math.min(1,Math.max(0,x+d)),b=this.getPoint(M);e.x=Math.min(e.x,b.x),e.y=Math.min(e.y,b.y),t.x=Math.max(t.x,b.x),t.y=Math.max(t.y,b.y)}})(a,10),{min:e,max:t}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class oe extends Ft{constructor(e=0,t=0,n=1,r=1,o=0,s=0,c=Math.PI*2,h=!1){super(new p(e,t),new p(n,r),new p,o,s,c,h)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Ot extends rt{}class hn extends Ot{constructor(e=0,t=0,n=1,r=3){super(),this.cx=e,this.cy=t,this.radius=n,this.sideCount=r,this.update()}update(){const{cx:e,cy:t,radius:n,sideCount:r}=this,o=[];for(let c=0;c<r;c++){const h=c*2*Math.PI/r-.5*Math.PI;o.push(new p(n*Math.cos(h),n*Math.sin(h)).add({x:e,y:t}))}const s=[];for(let c=0;c<r;c++)s.push(new j(o[c],o[(c+1)%r]));return this.curves=s,this}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.radius=e.radius,this.sideCount=e.sideCount,this.update(),this}}class Pt extends Y{constructor(e=new p,t=new p,n=new p){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new Pt(new p(e,t),new p(n,r),new p(o,s))}getPoint(e,t=new p){const{p1:n,cp:r,p2:o}=this;return t.set(qt(e,n.x,r.x,o.x),qt(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Qt(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=p.MAX,t=p.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),c=.5*(n.y+r.y),h=.5*(n.x+o.x),a=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,h),e.y=Math.min(e.y,n.y,o.y,c,a),t.x=Math.max(t.x,n.x,o.x,s,h),t.y=Math.max(t.y,n.y,o.y,c,a),{min:e,max:t}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class ce extends Ot{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,o=[new p(e,t),new p(e+n,t),new p(e+n,t+r),new p(e,t+r)];return this.curves=[new j(o[0],o[1]),new j(o[1],o[2]),new j(o[2],o[3]),new j(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const{x:c,y:h,width:a,height:l}=this,y=[c,h,c+a,h,c+a,h+l,c,h+l];let f=0;o*=r,t[o+f]=y[0],t[o+f+1]=y[1],f+=r,t[o+f]=y[2],t[o+f+1]=y[3],f+=r,t[o+f]=y[6],t[o+f+1]=y[7],f+=r,t[o+f]=y[4],t[o+f+1]=y[5],f+=r;const x=o/r;return n[s++]=x,n[s++]=x+1,n[s++]=x+2,n[s++]=x+1,n[s++]=x+3,n[s++]=x+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class he extends Ft{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,c=r/2,h=e+s,a=t+c,l=Math.max(0,Math.min(o,Math.min(s,c))),y=l;return this._center=new p(h,a),this._radius=new p(l,y),this._diff=new p(s-l,c-y),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class ae extends Y{constructor(e=[]){super(),this.points=e}getPoint(e,t=new p){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,c=n[o===0?o:o-1],h=n[o],a=n[o>n.length-2?n.length-1:o+1],l=n[o>n.length-3?n.length-1:o+2];return t.set(St(s,c.x,h.x,a.x,l.x),St(s,c.y,h.y,a.y,l.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class lt extends rt{constructor(t){super();X(this,"startPoint");X(this,"currentPoint");X(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return kt(t,this),this}addData(t){return this.addCommands(It(t)),this}_closePointArray(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenPointArray(t=40,n=[]){return this._closePointArray(super.getUnevenPointArray(t,n))}getSpacedPointArray(t=40,n=[]){return this._closePointArray(super.getSpacedPointArray(t,n))}getAdaptivePointArray(t=[]){return this._closePointArray(super.getAdaptivePointArray(t))}_setCurrentPoint(t){return this.currentPoint=new p(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new j(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new p(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(j.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,c){const h=this.currentPoint;return h!=null&&h.equals({x:s,y:c})||this.curves.push(Mt.from((h==null?void 0:h.x)??0,(h==null?void 0:h.y)??0,t,n,r,o,s,c)),this._setCurrentPoint({x:s,y:c}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(Pt.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,c){const h=new re(t,n,r,o,s,!c);return this._connetLineTo(h),this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeArc(t,n,r,o,s,c){var h,a;return t+=((h=this.currentPoint)==null?void 0:h.x)??0,n+=((a=this.currentPoint)==null?void 0:a.y)??0,this.arc(t,n,r,o,s,c),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,c,h,a=!0){const l=new oe(t,n,r,o,s,c,h,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,n,r,o,s,c,h,a){var l,y;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((y=this.currentPoint)==null?void 0:y.y)??0,this.ellipse(t,n,r,o,s,c,h,a),this}rect(t,n,r,o){const s=new ce(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const c=new he(t,n,r,o,s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new p;return this.curves.push(new ae([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function an(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function ln(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),c=r.cross(o);if(c===0)return new p((i.x+t.x)/2,(i.y+t.y)/2);const h=s.cross(o)/c;return Math.abs(h)>1?new p((i.x+t.x)/2,(i.y+t.y)/2):new p(i.x+h*r.x,i.y+h*r.y)}class G extends rt{constructor(t,n={}){super();X(this,"currentCurve",new lt);X(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof G?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(r=>r===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof G?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new lt().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new lt,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,o,s,c){return this.currentCurve.bezierCurveTo(t,n,r,o,s,c),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,c){return this.currentCurve.arc(t,n,r,o,s,c),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,c,h,a){return this.currentCurve.ellipse(t,n,r,o,s,c,h,a),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}reset(){return this.currentCurve=new lt,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return kt(t,this),this}addData(t){return this.addCommands(It(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],o=[],s=[];n.forEach((h,a)=>{const l=h.getControlPointRefs(),y=h.isClockwise();s[a]=l,o[a]=y;const f=l[0],x=l[l.length-1]??f;r.push({start:y?x:f,end:y?f:x,index:a})});const c=[];return r.forEach((h,a)=>{c[a]=[],r.forEach((l,y)=>{var f;l.start&&h.end&&y!==a&&((f=l.start)!=null&&f.equals(h.end))&&c[a].push(l.index)})}),n.forEach((h,a)=>{const l=o[a];s[a].forEach(y=>{y.add(h.getNormal(h.getTForPoint(y)).scale(l?t:-t))})}),c.forEach((h,a)=>{const l=s[a];h.forEach(y=>{const f=s[y],x=ln(l[l.length-1],l[l.length-2]??l[l.length-1],f[0],f[1]??f[0]);x&&(l[l.length-1].copy(x),f[0].copy(x))})}),this}getMinMax(t=p.MAX,n=p.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const c=o/2,h=s.isClockwise(),a=[];for(let l=0;l<=1;l+=1/s.arcLengthDivision){const y=s.getPoint(l),f=s.getNormal(l),x=f.clone().scale(h?c:-c),u=f.clone().scale(h?-c:c);a.push(y.clone().add(x),y.clone().add(u),y.clone().add({x:c,y:0}),y.clone().add({x:-c,y:0}),y.clone().add({x:0,y:c}),y.clone().add({x:0,y:-c}),y.clone().add({x:c,y:c}),y.clone().add({x:-c,y:-c}))}t.min(...a),n.max(...a)}}),{min:t,max:n}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(o=>{o.strokeTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new V(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Ct(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Ct(t,n),this.getControlPointRefs().forEach(s=>{R(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[an(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class le{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=p.MAX,n=p.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new V(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:o,width:s,height:c}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*t,h.height=c*t,h.style.width=`${s}px`,h.style.height=`${c}px`;const a=h.getContext("2d");return a&&(a.scale(t,t),a.translate(-r,-o),this.paths.forEach(l=>{l.drawTo(a,n)})),h}}const ue="data:image/svg+xml;",ye=`${ue}base64,`,fe=`${ue}charset=utf8,`;function xe(i){if(typeof i=="string"){let e;i.startsWith(ye)?(i=i.substring(ye.length,i.length),e=atob(i)):i.startsWith(fe)?(i=i.substring(fe.length,i.length),e=decodeURIComponent(i)):e=i;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
2
+ ${e}`);return t.documentElement}else return i}const un="px",yn=90,pe=["mm","cm","in","pt","pc","px"],ge={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function L(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=pe.length;n<r;n++){const o=pe[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=ge[e][un],t<0&&(t=ge[e].in*yn),t*Number.parseFloat(i)}const fn=new z,wt=new z,de=new z,me=new z;function xn(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=pn(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function pn(i){const e=new z,t=fn;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(L(i.getAttribute("x")),L(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),c=o.length;if(s>0&&s<c){const h=o.slice(0,s),a=Z(o.slice(s+1));switch(t.identity(),h){case"translate":if(a.length>=1){const l=a[0];let y=0;a.length>=2&&(y=a[1]),t.translate(l,y)}break;case"rotate":if(a.length>=1){let l=0,y=0,f=0;l=a[0]*Math.PI/180,a.length>=3&&(y=a[1],f=a[2]),wt.makeTranslation(-y,-f),de.makeRotation(l),me.multiplyMatrices(de,wt),wt.makeTranslation(y,f),t.multiplyMatrices(wt,me)}break;case"scale":a.length>=1&&t.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&t.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&t.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&t.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}e.premultiply(t)}}return e}function gn(i){return new G().arc(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("r")||0),0,Math.PI*2)}function dn(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,c=0;c<s;c++){const h=n.style.item(c);o[h]=n.style.getPropertyValue(h)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function mn(i){return new G().ellipse(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("rx")||0),L(i.getAttribute("ry")||0),0,0,Math.PI*2)}function Mn(i){return new G().moveTo(L(i.getAttribute("x1")||0),L(i.getAttribute("y1")||0)).lineTo(L(i.getAttribute("x2")||0),L(i.getAttribute("y2")||0))}function Pn(i){const e=new G,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const wn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function vn(i){var n;const e=new G;let t=0;return(n=i.getAttribute("points"))==null||n.replace(wn,(r,o,s)=>{const c=L(o),h=L(s);return t===0?e.moveTo(c,h):e.lineTo(c,h),t++,r}),e.currentCurve.autoClose=!0,e}const Tn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function An(i){var n;const e=new G;let t=0;return(n=i.getAttribute("points"))==null||n.replace(Tn,(r,o,s)=>{const c=L(o),h=L(s);return t===0?e.moveTo(c,h):e.lineTo(c,h),t++,r}),e.currentCurve.autoClose=!1,e}function Cn(i){const e=L(i.getAttribute("x")||0),t=L(i.getAttribute("y")||0),n=L(i.getAttribute("rx")||i.getAttribute("ry")||0),r=L(i.getAttribute("ry")||i.getAttribute("rx")||0),o=L(i.getAttribute("width")),s=L(i.getAttribute("height")),c=1-.551915024494,h=new G;return h.moveTo(e+n,t),h.lineTo(e+o-n,t),(n!==0||r!==0)&&h.bezierCurveTo(e+o-n*c,t,e+o,t+r*c,e+o,t+r),h.lineTo(e+o,t+s-r),(n!==0||r!==0)&&h.bezierCurveTo(e+o,t+s-r*c,e+o-n*c,t+s,e+o-n,t+s),h.lineTo(e+n,t+s),(n!==0||r!==0)&&h.bezierCurveTo(e+n*c,t+s,e,t+s-r*c,e,t+s-r),h.lineTo(e,t+r),(n!==0||r!==0)&&h.bezierCurveTo(e,t+r*c,e+n*c,t,e+n,t),h}function U(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const a=i.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<a.length;l++)n=Object.assign(n,t[`.${a[l]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let a=i.style.length,l=0;l<a;l++){const y=i.style.item(l),f=i.style.getPropertyValue(y);e[y]=f,n[y]=f}function r(a,l,y=o){i.hasAttribute(a)&&(e[l]=y(i.getAttribute(a))),n[a]&&(e[l]=y(n[a]))}function o(a){return a.startsWith("url")&&console.warn("url access in attributes is not implemented."),a}function s(a){return Math.max(0,Math.min(1,L(a)))}function c(a){return Math.max(0,L(a))}function h(a){return a.split(" ").filter(l=>l!=="").map(l=>L(l))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",c),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",c),r("stroke-dasharray","strokeDasharray",h),r("stroke-dashoffset","strokeDashoffset",L),r("visibility","visibility"),e}function Rt(i,e,t=[],n={}){var y;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=U(i,s,n);break;case"style":dn(i,n);break;case"g":s=U(i,s,n);break;case"path":s=U(i,s,n),i.hasAttribute("d")&&(o=Pn(i));break;case"rect":s=U(i,s,n),o=Cn(i);break;case"polygon":s=U(i,s,n),o=vn(i);break;case"polyline":s=U(i,s,n),o=An(i);break;case"circle":s=U(i,s,n),o=gn(i);break;case"ellipse":s=U(i,s,n),o=mn(i);break;case"line":s=U(i,s,n),o=Mn(i);break;case"defs":r=!0;break;case"use":{s=U(i,s,n);const x=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),u=(y=i.viewportElement)==null?void 0:y.getElementById(x);u?Rt(u,s,t,n):console.warn(`'use node' references non-existent node id: ${x}`);break}default:console.warn(i);break}if(s.display==="none")return t;const c=new z,h=[],a=xn(i,c,h);o&&(o.applyTransform(c),t.push(o),o.style={...s});const l=i.childNodes;for(let f=0,x=l.length;f<x;f++){const u=l[f];r&&u.nodeName!=="style"&&u.nodeName!=="defs"||Rt(u,s,t,n)}return a&&(h.pop(),h.length>0?c.copy(h[h.length-1]):c.identity()),t}function bn(i){var t;const e=xe(i);return new le(Rt(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}v.ArcCurve=re,v.BoundingBox=V,v.CompositeCurve=rt,v.CubicBezierCurve=Mt,v.Curve=Y,v.CurvePath=lt,v.EllipseCurve=oe,v.EquilateralPloygonCurve=hn,v.LineCurve=j,v.Matrix3=z,v.Path2D=G,v.Path2DSet=le,v.PloygonCurve=Ot,v.QuadraticBezierCurve=Pt,v.RectangleCurve=ce,v.RoundRectangleCurve=he,v.SplineCurve=ae,v.Vector2=p,v.catmullRom=St,v.cubicBezier=Et,v.drawPoint=R,v.fillTriangulate=Nt,v.getAdaptiveCubicBezierCurvePoints=Ht,v.getAdaptiveQuadraticBezierCurvePoints=Qt,v.parseArcCommand=jt,v.parsePathDataArgs=Z,v.quadraticBezier=qt,v.setCanvasContext=Ct,v.strokeTriangulate=Jt,v.svgPathCommandsAddToPath2D=kt,v.svgPathCommandsToData=Gt,v.svgPathDataToCommands=It,v.svgToDOM=xe,v.svgToPath2DSet=bn,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -1960,63 +1960,77 @@ class RoundCurve extends Curve {
1960
1960
  return [this._center];
1961
1961
  }
1962
1962
  getAdaptivePointArray(output = []) {
1963
- const { cx, cy, rx, ry, dx, dy, startAngle } = this;
1963
+ const { cx, cy, rx, ry, dx, dy } = this;
1964
1964
  if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
1965
1965
  return output;
1966
1966
  }
1967
- const PI_2 = Math.PI * 2;
1968
- const deltaAngle = this._getDeltaAngle();
1969
- const arcLengthFactor = Math.abs(deltaAngle) / PI_2;
1970
- let n = Math.ceil(2.3 * Math.sqrt(rx + ry) * arcLengthFactor);
1971
- const array = [];
1972
- if (dx && dy) {
1973
- n = Math.ceil(n / 4);
1974
- const x0 = cx - dx / 2;
1975
- const y0 = cy - dy / 2;
1976
- const x1 = cx + dx / 2;
1977
- const y1 = cy - dy / 2;
1978
- const x2 = cx + dx / 2;
1979
- const y2 = cy + dy / 2;
1980
- const x3 = cx - dx / 2;
1981
- const y3 = cy + dy / 2;
1982
- for (let i = 0; i <= n; i++) {
1983
- const t = i / n;
1984
- const angle = -Math.PI / 2 + t * (Math.PI / 2);
1985
- const x = x1 + Math.cos(angle) * rx;
1986
- const y = y1 + Math.sin(angle) * ry;
1987
- output.push(x, y);
1988
- }
1989
- for (let i = 0; i <= n; i++) {
1990
- const t = i / n;
1991
- const angle = 0 + t * (Math.PI / 2);
1992
- const x = x2 + Math.cos(angle) * rx;
1993
- const y = y2 + Math.sin(angle) * ry;
1994
- output.push(x, y);
1995
- }
1996
- for (let i = 0; i <= n; i++) {
1997
- const t = i / n;
1998
- const angle = Math.PI / 2 + t * (Math.PI / 2);
1999
- const x = x3 + Math.cos(angle) * rx;
2000
- const y = y3 + Math.sin(angle) * ry;
2001
- output.push(x, y);
2002
- }
2003
- for (let i = 0; i <= n; i++) {
2004
- const t = i / n;
2005
- const angle = Math.PI + t * (Math.PI / 2);
2006
- const x = x0 + Math.cos(angle) * rx;
2007
- const y = y0 + Math.sin(angle) * ry;
2008
- output.push(x, y);
2009
- }
2010
- } else {
2011
- for (let i = 0; i <= n; i++) {
2012
- const t = i / n;
2013
- const angle = startAngle + t * deltaAngle;
2014
- const x = cx + Math.cos(angle) * rx;
2015
- const y = cy + Math.sin(angle) * ry;
2016
- array.push(x, y);
2017
- }
1967
+ const n = Math.ceil(2.3 * Math.sqrt(rx + ry));
1968
+ const x = cx;
1969
+ const y = cy;
1970
+ const m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
1971
+ if (m === 0) {
1972
+ return output;
1973
+ }
1974
+ if (n === 0) {
1975
+ output[0] = output[6] = x + dx;
1976
+ output[1] = output[3] = y + dy;
1977
+ output[2] = output[4] = x - dx;
1978
+ output[5] = output[7] = y - dy;
1979
+ return output;
1980
+ }
1981
+ let j1 = 0;
1982
+ let j2 = n * 4 + (dx ? 2 : 0) + 2;
1983
+ let j3 = j2;
1984
+ let j4 = m;
1985
+ let x0 = dx + rx;
1986
+ let y0 = dy;
1987
+ let x1 = x + x0;
1988
+ let x2 = x - x0;
1989
+ let y1 = y + y0;
1990
+ output[j1++] = x1;
1991
+ output[j1++] = y1;
1992
+ output[--j2] = y1;
1993
+ output[--j2] = x2;
1994
+ if (dy) {
1995
+ const y22 = y - y0;
1996
+ output[j3++] = x2;
1997
+ output[j3++] = y22;
1998
+ output[--j4] = y22;
1999
+ output[--j4] = x1;
2000
+ }
2001
+ for (let i = 1; i < n; i++) {
2002
+ const a = Math.PI / 2 * (i / n);
2003
+ const x02 = dx + Math.cos(a) * rx;
2004
+ const y02 = dy + Math.sin(a) * ry;
2005
+ const x12 = x + x02;
2006
+ const x22 = x - x02;
2007
+ const y12 = y + y02;
2008
+ const y22 = y - y02;
2009
+ output[j1++] = x12;
2010
+ output[j1++] = y12;
2011
+ output[--j2] = y12;
2012
+ output[--j2] = x22;
2013
+ output[j3++] = x22;
2014
+ output[j3++] = y22;
2015
+ output[--j4] = y22;
2016
+ output[--j4] = x12;
2017
+ }
2018
+ x0 = dx;
2019
+ y0 = dy + ry;
2020
+ x1 = x + x0;
2021
+ x2 = x - x0;
2022
+ y1 = y + y0;
2023
+ const y2 = y - y0;
2024
+ output[j1++] = x1;
2025
+ output[j1++] = y1;
2026
+ output[--j4] = y2;
2027
+ output[--j4] = x1;
2028
+ if (dx) {
2029
+ output[j1++] = x2;
2030
+ output[j1++] = y1;
2031
+ output[--j4] = y2;
2032
+ output[--j4] = x2;
2018
2033
  }
2019
- Array.prototype.push.apply(output, array);
2020
2034
  return output;
2021
2035
  }
2022
2036
  fillTriangulate(options = {}) {
@@ -2024,8 +2038,8 @@ class RoundCurve extends Curve {
2024
2038
  vertices = [],
2025
2039
  indices = [],
2026
2040
  verticesStride = 2,
2027
- verticesOffset = 0,
2028
- indicesOffset = 0
2041
+ verticesOffset = vertices.length / verticesStride,
2042
+ indicesOffset = indices.length
2029
2043
  } = options;
2030
2044
  const points = this.getAdaptivePointArray();
2031
2045
  if (points.length === 0) {
@@ -2281,6 +2295,121 @@ class ArcCurve extends RoundCurve {
2281
2295
  }
2282
2296
  }
2283
2297
 
2298
+ class LineCurve extends Curve {
2299
+ constructor(p1 = new Vector2(), p2 = new Vector2()) {
2300
+ super();
2301
+ this.p1 = p1;
2302
+ this.p2 = p2;
2303
+ }
2304
+ static from(p1x, p1y, p2x, p2y) {
2305
+ return new LineCurve(
2306
+ new Vector2(p1x, p1y),
2307
+ new Vector2(p2x, p2y)
2308
+ );
2309
+ }
2310
+ getPoint(t, output = new Vector2()) {
2311
+ if (t === 1) {
2312
+ output.copy(this.p2);
2313
+ } else {
2314
+ output.copy(this.p2).sub(this.p1).scale(t).add(this.p1);
2315
+ }
2316
+ return output;
2317
+ }
2318
+ getPointAt(u, output = new Vector2()) {
2319
+ return this.getPoint(u, output);
2320
+ }
2321
+ getTangent(_t, output = new Vector2()) {
2322
+ return output.subVectors(this.p2, this.p1).normalize();
2323
+ }
2324
+ getTangentAt(u, output = new Vector2()) {
2325
+ return this.getTangent(u, output);
2326
+ }
2327
+ getControlPointRefs() {
2328
+ return [this.p1, this.p2];
2329
+ }
2330
+ getAdaptivePointArray(output = []) {
2331
+ output.push(
2332
+ this.p1.x,
2333
+ this.p1.y,
2334
+ this.p2.x,
2335
+ this.p2.y
2336
+ );
2337
+ return output;
2338
+ }
2339
+ getMinMax(min = Vector2.MAX, max = Vector2.MIN) {
2340
+ const { p1, p2 } = this;
2341
+ min.x = Math.min(min.x, p1.x, p2.x);
2342
+ min.y = Math.min(min.y, p1.y, p2.y);
2343
+ max.x = Math.max(max.x, p1.x, p2.x);
2344
+ max.y = Math.max(max.y, p1.y, p2.y);
2345
+ return { min, max };
2346
+ }
2347
+ toCommands() {
2348
+ const { p1, p2 } = this;
2349
+ return [
2350
+ { type: "M", x: p1.x, y: p1.y },
2351
+ { type: "L", x: p2.x, y: p2.y }
2352
+ ];
2353
+ }
2354
+ fillTriangulate(options = {}) {
2355
+ let {
2356
+ vertices = [],
2357
+ indices = [],
2358
+ verticesStride = 2,
2359
+ verticesOffset = vertices.length / verticesStride,
2360
+ indicesOffset = indices.length
2361
+ } = options;
2362
+ const x = this.p1.x;
2363
+ const y = this.p1.y;
2364
+ const width = this.p2.x - this.p1.x || 1;
2365
+ const height = this.p2.y - this.p2.y || 1;
2366
+ const points = [
2367
+ x,
2368
+ y,
2369
+ x + width,
2370
+ y,
2371
+ x + width,
2372
+ y + height,
2373
+ x,
2374
+ y + height
2375
+ ];
2376
+ let count = 0;
2377
+ verticesOffset *= verticesStride;
2378
+ vertices[verticesOffset + count] = points[0];
2379
+ vertices[verticesOffset + count + 1] = points[1];
2380
+ count += verticesStride;
2381
+ vertices[verticesOffset + count] = points[2];
2382
+ vertices[verticesOffset + count + 1] = points[3];
2383
+ count += verticesStride;
2384
+ vertices[verticesOffset + count] = points[6];
2385
+ vertices[verticesOffset + count + 1] = points[7];
2386
+ count += verticesStride;
2387
+ vertices[verticesOffset + count] = points[4];
2388
+ vertices[verticesOffset + count + 1] = points[5];
2389
+ count += verticesStride;
2390
+ const verticesIndex = verticesOffset / verticesStride;
2391
+ indices[indicesOffset++] = verticesIndex;
2392
+ indices[indicesOffset++] = verticesIndex + 1;
2393
+ indices[indicesOffset++] = verticesIndex + 2;
2394
+ indices[indicesOffset++] = verticesIndex + 1;
2395
+ indices[indicesOffset++] = verticesIndex + 3;
2396
+ indices[indicesOffset++] = verticesIndex + 2;
2397
+ return { vertices, indices };
2398
+ }
2399
+ drawTo(ctx) {
2400
+ const { p1, p2 } = this;
2401
+ ctx.lineTo(p1.x, p1.y);
2402
+ ctx.lineTo(p2.x, p2.y);
2403
+ return this;
2404
+ }
2405
+ copy(source) {
2406
+ super.copy(source);
2407
+ this.p1.copy(source.p1);
2408
+ this.p2.copy(source.p2);
2409
+ return this;
2410
+ }
2411
+ }
2412
+
2284
2413
  class CompositeCurve extends Curve {
2285
2414
  constructor(curves = []) {
2286
2415
  super();
@@ -2355,6 +2484,44 @@ class CompositeCurve extends Curve {
2355
2484
  });
2356
2485
  return output;
2357
2486
  }
2487
+ fillTriangulate(options) {
2488
+ const indices = options?.indices ?? [];
2489
+ const vertices = options?.vertices ?? [];
2490
+ const lines = [];
2491
+ const fillLines = () => {
2492
+ if (lines.length) {
2493
+ const pointArray = [];
2494
+ lines.forEach((line) => {
2495
+ const x = line.p1.x;
2496
+ const y = line.p1.y;
2497
+ if (pointArray[pointArray.length - 2] !== x || pointArray[pointArray.length - 1] !== y) {
2498
+ pointArray.push(x, y);
2499
+ }
2500
+ pointArray.push(line.p2.x, line.p2.y);
2501
+ });
2502
+ fillTriangulate(pointArray, {
2503
+ ...options,
2504
+ indices,
2505
+ vertices
2506
+ });
2507
+ lines.length = 0;
2508
+ }
2509
+ };
2510
+ this.curves.forEach((curve) => {
2511
+ if (curve instanceof LineCurve) {
2512
+ lines.push(curve);
2513
+ } else {
2514
+ fillLines();
2515
+ curve.fillTriangulate({
2516
+ ...options,
2517
+ indices,
2518
+ vertices
2519
+ });
2520
+ }
2521
+ });
2522
+ fillLines();
2523
+ return { indices, vertices };
2524
+ }
2358
2525
  applyTransform(transform) {
2359
2526
  this.curves.forEach((curve) => curve.applyTransform(transform));
2360
2527
  return this;
@@ -2513,76 +2680,6 @@ class EllipseCurve extends RoundCurve {
2513
2680
  }
2514
2681
  }
2515
2682
 
2516
- class LineCurve extends Curve {
2517
- constructor(p1 = new Vector2(), p2 = new Vector2()) {
2518
- super();
2519
- this.p1 = p1;
2520
- this.p2 = p2;
2521
- }
2522
- static from(p1x, p1y, p2x, p2y) {
2523
- return new LineCurve(
2524
- new Vector2(p1x, p1y),
2525
- new Vector2(p2x, p2y)
2526
- );
2527
- }
2528
- getPoint(t, output = new Vector2()) {
2529
- if (t === 1) {
2530
- output.copy(this.p2);
2531
- } else {
2532
- output.copy(this.p2).sub(this.p1).scale(t).add(this.p1);
2533
- }
2534
- return output;
2535
- }
2536
- getPointAt(u, output = new Vector2()) {
2537
- return this.getPoint(u, output);
2538
- }
2539
- getTangent(_t, output = new Vector2()) {
2540
- return output.subVectors(this.p2, this.p1).normalize();
2541
- }
2542
- getTangentAt(u, output = new Vector2()) {
2543
- return this.getTangent(u, output);
2544
- }
2545
- getControlPointRefs() {
2546
- return [this.p1, this.p2];
2547
- }
2548
- getAdaptivePointArray(output = []) {
2549
- output.push(
2550
- this.p1.x,
2551
- this.p1.y,
2552
- this.p2.x,
2553
- this.p2.y
2554
- );
2555
- return output;
2556
- }
2557
- getMinMax(min = Vector2.MAX, max = Vector2.MIN) {
2558
- const { p1, p2 } = this;
2559
- min.x = Math.min(min.x, p1.x, p2.x);
2560
- min.y = Math.min(min.y, p1.y, p2.y);
2561
- max.x = Math.max(max.x, p1.x, p2.x);
2562
- max.y = Math.max(max.y, p1.y, p2.y);
2563
- return { min, max };
2564
- }
2565
- toCommands() {
2566
- const { p1, p2 } = this;
2567
- return [
2568
- { type: "M", x: p1.x, y: p1.y },
2569
- { type: "L", x: p2.x, y: p2.y }
2570
- ];
2571
- }
2572
- drawTo(ctx) {
2573
- const { p1, p2 } = this;
2574
- ctx.lineTo(p1.x, p1.y);
2575
- ctx.lineTo(p2.x, p2.y);
2576
- return this;
2577
- }
2578
- copy(source) {
2579
- super.copy(source);
2580
- this.p1.copy(source.p1);
2581
- this.p2.copy(source.p2);
2582
- return this;
2583
- }
2584
- }
2585
-
2586
2683
  class PloygonCurve extends CompositeCurve {
2587
2684
  //
2588
2685
  }
@@ -2736,8 +2833,8 @@ class RectangleCurve extends PloygonCurve {
2736
2833
  vertices = [],
2737
2834
  indices = [],
2738
2835
  verticesStride = 2,
2739
- verticesOffset = 0,
2740
- indicesOffset = 0
2836
+ verticesOffset = vertices.length / verticesStride,
2837
+ indicesOffset = indices.length
2741
2838
  } = options;
2742
2839
  const { x, y, width, height } = this;
2743
2840
  const points = [
@@ -2804,7 +2901,7 @@ class RoundRectangleCurve extends RoundCurve {
2804
2901
  const ry = rx;
2805
2902
  this._center = new Vector2(cx, cy);
2806
2903
  this._radius = new Vector2(rx, ry);
2807
- this._diff = new Vector2(width, height);
2904
+ this._diff = new Vector2(halfWidth - rx, halfHeight - ry);
2808
2905
  return this;
2809
2906
  }
2810
2907
  drawTo(ctx) {
@@ -3322,18 +3419,6 @@ class Path2D extends CompositeCurve {
3322
3419
  });
3323
3420
  return { min, max };
3324
3421
  }
3325
- fillTriangulate(options) {
3326
- const indices = options?.indices ?? [];
3327
- const vertices = options?.vertices ?? [];
3328
- this.curves.forEach((curve) => {
3329
- curve.fillTriangulate({
3330
- ...options,
3331
- indices,
3332
- vertices
3333
- });
3334
- });
3335
- return { indices, vertices };
3336
- }
3337
3422
  strokeTriangulate(options) {
3338
3423
  const indices = options?.indices ?? [];
3339
3424
  const vertices = options?.vertices ?? [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-path2d",
3
3
  "type": "module",
4
- "version": "1.2.17",
4
+ "version": "1.2.18",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A modern Path2D library, fully compatible with Web Path2D, with additional support for path animation, path deformation, path playback, etc.",
7
7
  "author": "wxm",