modern-text 0.2.13 → 0.2.14
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 +49 -46
- package/dist/index.d.cts +12 -7
- package/dist/index.d.mts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +2 -2
- package/dist/index.mjs +49 -46
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -52,28 +52,31 @@ function parseCssLinearGradient(css, x, y, width, height) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function
|
|
56
|
-
const { ctx,
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
function drawPath(options) {
|
|
56
|
+
const { ctx, path, fontSize, clipRect } = options;
|
|
57
|
+
ctx.save();
|
|
58
|
+
ctx.beginPath();
|
|
59
|
+
const style = path.style;
|
|
60
|
+
path.style = {
|
|
61
|
+
...style,
|
|
62
|
+
fill: options.color ?? style.fill,
|
|
63
|
+
stroke: options.textStrokeColor ?? style.stroke,
|
|
64
|
+
strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
|
|
65
|
+
shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
|
|
66
|
+
shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
|
|
67
|
+
shadowBlur: (options.shadowBlur ?? 0) * fontSize,
|
|
68
|
+
shadowColor: options.shadowColor
|
|
69
|
+
};
|
|
70
|
+
const offsetX = (options.offsetX ?? 0) * fontSize;
|
|
71
|
+
const offsetY = (options.offsetY ?? 0) * fontSize;
|
|
72
|
+
ctx.translate(offsetX, offsetY);
|
|
73
|
+
if (clipRect) {
|
|
74
|
+
ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
|
75
|
+
ctx.clip();
|
|
59
76
|
ctx.beginPath();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
fill: options.color ?? style.fill,
|
|
64
|
-
stroke: options.textStrokeColor ?? style.stroke,
|
|
65
|
-
strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
|
|
66
|
-
shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
|
|
67
|
-
shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
|
|
68
|
-
shadowBlur: (options.shadowBlur ?? 0) * fontSize,
|
|
69
|
-
shadowColor: options.shadowColor
|
|
70
|
-
};
|
|
71
|
-
const offsetX = (options.offsetX ?? 0) * fontSize;
|
|
72
|
-
const offsetY = (options.offsetY ?? 0) * fontSize;
|
|
73
|
-
ctx.translate(offsetX, offsetY);
|
|
74
|
-
path.drawTo(ctx);
|
|
75
|
-
ctx.restore();
|
|
76
|
-
});
|
|
77
|
+
}
|
|
78
|
+
path.drawTo(ctx);
|
|
79
|
+
ctx.restore();
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
function filterEmpty(val) {
|
|
@@ -209,7 +212,6 @@ class Character {
|
|
|
209
212
|
this.centerDiviation = 0.5 * height - baseline;
|
|
210
213
|
this.glyphBox = isVertical ? new modernPath2d.BoundingBox(left, top, glyphHeight, glyphWidth) : new modernPath2d.BoundingBox(left, top, glyphWidth, glyphHeight);
|
|
211
214
|
this.centerPoint = this.glyphBox.getCenterPoint();
|
|
212
|
-
this.fontMinGlyphWidth = font.getAdvanceWidth("i", fontSize);
|
|
213
215
|
return this;
|
|
214
216
|
}
|
|
215
217
|
updatePath() {
|
|
@@ -381,9 +383,9 @@ class Character {
|
|
|
381
383
|
return this.path.getBoundingBox();
|
|
382
384
|
}
|
|
383
385
|
drawTo(ctx, config = {}) {
|
|
384
|
-
|
|
386
|
+
drawPath({
|
|
385
387
|
ctx,
|
|
386
|
-
|
|
388
|
+
path: this.path,
|
|
387
389
|
fontSize: this.computedStyle.fontSize,
|
|
388
390
|
color: this.computedStyle.color,
|
|
389
391
|
...config
|
|
@@ -524,7 +526,7 @@ class Highlighter extends Feature {
|
|
|
524
526
|
}
|
|
525
527
|
const min = modernPath2d.Vector2.MAX;
|
|
526
528
|
const max = modernPath2d.Vector2.MIN;
|
|
527
|
-
this.paths.forEach((
|
|
529
|
+
this.paths.forEach((v) => v.path.getMinMax(min, max));
|
|
528
530
|
return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
|
|
529
531
|
}
|
|
530
532
|
highlight() {
|
|
@@ -550,7 +552,6 @@ class Highlighter extends Feature {
|
|
|
550
552
|
url: characters2[0].parent.highlight.url,
|
|
551
553
|
box: modernPath2d.BoundingBox.from(...characters2.map((c) => c.boundingBox)),
|
|
552
554
|
baseline: Math.max(...characters2.map((c) => c.baseline)),
|
|
553
|
-
fontMinGlyphWidth: characters2[0].fontMinGlyphWidth,
|
|
554
555
|
fontSize: characters2[0].fontSize
|
|
555
556
|
};
|
|
556
557
|
}).map((group2) => this._parseGroup(group2)).flat();
|
|
@@ -568,23 +569,23 @@ class Highlighter extends Feature {
|
|
|
568
569
|
};
|
|
569
570
|
}
|
|
570
571
|
_parseGroup(group) {
|
|
571
|
-
const { url, box: groupBox, baseline, fontSize
|
|
572
|
+
const { url, box: groupBox, baseline, fontSize } = group;
|
|
572
573
|
const { box, viewBox, paths } = this._parseSvg(url);
|
|
574
|
+
const centerY = viewBox.top + viewBox.height / 2;
|
|
573
575
|
const result = [];
|
|
574
|
-
const type =
|
|
575
|
-
function transformPathStyle(path) {
|
|
576
|
-
const rate = fontSize * 0.03;
|
|
576
|
+
const type = centerY > box.top ? 0 : 1;
|
|
577
|
+
function transformPathStyle(path, scale) {
|
|
577
578
|
if (path.style.strokeWidth) {
|
|
578
|
-
path.style.strokeWidth *=
|
|
579
|
+
path.style.strokeWidth *= scale;
|
|
579
580
|
}
|
|
580
581
|
if (path.style.strokeMiterlimit) {
|
|
581
|
-
path.style.strokeMiterlimit *=
|
|
582
|
+
path.style.strokeMiterlimit *= scale;
|
|
582
583
|
}
|
|
583
584
|
if (path.style.strokeDashoffset) {
|
|
584
|
-
path.style.strokeDashoffset *=
|
|
585
|
+
path.style.strokeDashoffset *= scale;
|
|
585
586
|
}
|
|
586
587
|
if (path.style.strokeDasharray) {
|
|
587
|
-
path.style.strokeDasharray = path.style.strokeDasharray.map((v) => v *
|
|
588
|
+
path.style.strokeDasharray = path.style.strokeDasharray.map((v) => v * scale);
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
591
|
if (type === 0) {
|
|
@@ -597,16 +598,15 @@ class Highlighter extends Feature {
|
|
|
597
598
|
const m = new modernPath2d.Matrix3().translate(-box.x, -box.y).scale(scaleX, scaleY).translate(offset.x, offset.y);
|
|
598
599
|
paths.forEach((original) => {
|
|
599
600
|
const path = original.clone().transform(m);
|
|
600
|
-
transformPathStyle(path);
|
|
601
|
-
result.push(path);
|
|
601
|
+
transformPathStyle(path, scaleX);
|
|
602
|
+
result.push({ path });
|
|
602
603
|
});
|
|
603
604
|
} else if (type === 1) {
|
|
604
|
-
const scale =
|
|
605
|
+
const scale = fontSize / box.width;
|
|
605
606
|
const width = box.width * scale;
|
|
606
607
|
const length = Math.ceil(groupBox.width / width);
|
|
607
|
-
const totalWidth = width * length;
|
|
608
608
|
const offset = {
|
|
609
|
-
x: groupBox.left
|
|
609
|
+
x: groupBox.left,
|
|
610
610
|
y: groupBox.top + baseline + fontSize * 0.1
|
|
611
611
|
};
|
|
612
612
|
const m = new modernPath2d.Matrix3().translate(-box.x, -box.y).scale(scale, scale).translate(offset.x, offset.y);
|
|
@@ -614,18 +614,21 @@ class Highlighter extends Feature {
|
|
|
614
614
|
const _m = m.clone().translate(i * width, 0);
|
|
615
615
|
paths.forEach((original) => {
|
|
616
616
|
const path = original.clone().transform(_m);
|
|
617
|
-
transformPathStyle(path);
|
|
618
|
-
result.push(path);
|
|
617
|
+
transformPathStyle(path, scale);
|
|
618
|
+
result.push({ clipRect: groupBox, path });
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
return result;
|
|
623
623
|
}
|
|
624
624
|
draw({ ctx }) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
625
|
+
this.paths.forEach((v) => {
|
|
626
|
+
drawPath({
|
|
627
|
+
ctx,
|
|
628
|
+
path: v.path,
|
|
629
|
+
clipRect: v.clipRect,
|
|
630
|
+
fontSize: this._text.computedStyle.fontSize
|
|
631
|
+
});
|
|
629
632
|
});
|
|
630
633
|
return this;
|
|
631
634
|
}
|
|
@@ -1092,7 +1095,7 @@ exports.Reflector = Reflector;
|
|
|
1092
1095
|
exports.Renderer2D = Renderer2D;
|
|
1093
1096
|
exports.Text = Text;
|
|
1094
1097
|
exports.defaultTextStyles = defaultTextStyles;
|
|
1095
|
-
exports.
|
|
1098
|
+
exports.drawPath = drawPath;
|
|
1096
1099
|
exports.filterEmpty = filterEmpty;
|
|
1097
1100
|
exports.getPointPosition = getPointPosition;
|
|
1098
1101
|
exports.getRotationPoint = getRotationPoint;
|
package/dist/index.d.cts
CHANGED
|
@@ -72,10 +72,11 @@ interface LinearGradient {
|
|
|
72
72
|
|
|
73
73
|
interface DrawShapePathsOptions extends Partial<TextEffect> {
|
|
74
74
|
ctx: CanvasRenderingContext2D;
|
|
75
|
-
|
|
75
|
+
path: Path2D;
|
|
76
76
|
fontSize: number;
|
|
77
|
+
clipRect?: BoundingBox;
|
|
77
78
|
}
|
|
78
|
-
declare function
|
|
79
|
+
declare function drawPath(options: DrawShapePathsOptions): void;
|
|
79
80
|
|
|
80
81
|
declare class Fragment {
|
|
81
82
|
content: string;
|
|
@@ -109,7 +110,6 @@ declare class Character {
|
|
|
109
110
|
centerDiviation: number;
|
|
110
111
|
glyphBox: BoundingBox;
|
|
111
112
|
centerPoint: VectorLike;
|
|
112
|
-
fontMinGlyphWidth: number;
|
|
113
113
|
get computedStyle(): TextStyle;
|
|
114
114
|
get isVertical(): boolean;
|
|
115
115
|
get fontSize(): number;
|
|
@@ -223,10 +223,12 @@ interface HighlightGroup {
|
|
|
223
223
|
box: BoundingBox;
|
|
224
224
|
baseline: number;
|
|
225
225
|
fontSize: number;
|
|
226
|
-
fontMinGlyphWidth: number;
|
|
227
226
|
}
|
|
228
227
|
declare class Highlighter extends Feature {
|
|
229
|
-
paths:
|
|
228
|
+
paths: {
|
|
229
|
+
clipRect?: BoundingBox;
|
|
230
|
+
path: Path2D;
|
|
231
|
+
}[];
|
|
230
232
|
getBoundingBox(): BoundingBox;
|
|
231
233
|
highlight(): void;
|
|
232
234
|
protected _parseSvg(url: string): {
|
|
@@ -234,7 +236,10 @@ declare class Highlighter extends Feature {
|
|
|
234
236
|
box: BoundingBox;
|
|
235
237
|
viewBox: BoundingBox;
|
|
236
238
|
};
|
|
237
|
-
protected _parseGroup(group: HighlightGroup):
|
|
239
|
+
protected _parseGroup(group: HighlightGroup): {
|
|
240
|
+
clipRect?: BoundingBox;
|
|
241
|
+
path: Path2D;
|
|
242
|
+
}[];
|
|
238
243
|
draw({ ctx }: {
|
|
239
244
|
ctx: CanvasRenderingContext2D;
|
|
240
245
|
}): this;
|
|
@@ -339,4 +344,4 @@ declare function getPointPosition(point: {
|
|
|
339
344
|
y: number;
|
|
340
345
|
};
|
|
341
346
|
|
|
342
|
-
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles,
|
|
347
|
+
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPath, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
|
package/dist/index.d.mts
CHANGED
|
@@ -72,10 +72,11 @@ interface LinearGradient {
|
|
|
72
72
|
|
|
73
73
|
interface DrawShapePathsOptions extends Partial<TextEffect> {
|
|
74
74
|
ctx: CanvasRenderingContext2D;
|
|
75
|
-
|
|
75
|
+
path: Path2D;
|
|
76
76
|
fontSize: number;
|
|
77
|
+
clipRect?: BoundingBox;
|
|
77
78
|
}
|
|
78
|
-
declare function
|
|
79
|
+
declare function drawPath(options: DrawShapePathsOptions): void;
|
|
79
80
|
|
|
80
81
|
declare class Fragment {
|
|
81
82
|
content: string;
|
|
@@ -109,7 +110,6 @@ declare class Character {
|
|
|
109
110
|
centerDiviation: number;
|
|
110
111
|
glyphBox: BoundingBox;
|
|
111
112
|
centerPoint: VectorLike;
|
|
112
|
-
fontMinGlyphWidth: number;
|
|
113
113
|
get computedStyle(): TextStyle;
|
|
114
114
|
get isVertical(): boolean;
|
|
115
115
|
get fontSize(): number;
|
|
@@ -223,10 +223,12 @@ interface HighlightGroup {
|
|
|
223
223
|
box: BoundingBox;
|
|
224
224
|
baseline: number;
|
|
225
225
|
fontSize: number;
|
|
226
|
-
fontMinGlyphWidth: number;
|
|
227
226
|
}
|
|
228
227
|
declare class Highlighter extends Feature {
|
|
229
|
-
paths:
|
|
228
|
+
paths: {
|
|
229
|
+
clipRect?: BoundingBox;
|
|
230
|
+
path: Path2D;
|
|
231
|
+
}[];
|
|
230
232
|
getBoundingBox(): BoundingBox;
|
|
231
233
|
highlight(): void;
|
|
232
234
|
protected _parseSvg(url: string): {
|
|
@@ -234,7 +236,10 @@ declare class Highlighter extends Feature {
|
|
|
234
236
|
box: BoundingBox;
|
|
235
237
|
viewBox: BoundingBox;
|
|
236
238
|
};
|
|
237
|
-
protected _parseGroup(group: HighlightGroup):
|
|
239
|
+
protected _parseGroup(group: HighlightGroup): {
|
|
240
|
+
clipRect?: BoundingBox;
|
|
241
|
+
path: Path2D;
|
|
242
|
+
}[];
|
|
238
243
|
draw({ ctx }: {
|
|
239
244
|
ctx: CanvasRenderingContext2D;
|
|
240
245
|
}): this;
|
|
@@ -339,4 +344,4 @@ declare function getPointPosition(point: {
|
|
|
339
344
|
y: number;
|
|
340
345
|
};
|
|
341
346
|
|
|
342
|
-
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles,
|
|
347
|
+
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPath, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,10 +72,11 @@ interface LinearGradient {
|
|
|
72
72
|
|
|
73
73
|
interface DrawShapePathsOptions extends Partial<TextEffect> {
|
|
74
74
|
ctx: CanvasRenderingContext2D;
|
|
75
|
-
|
|
75
|
+
path: Path2D;
|
|
76
76
|
fontSize: number;
|
|
77
|
+
clipRect?: BoundingBox;
|
|
77
78
|
}
|
|
78
|
-
declare function
|
|
79
|
+
declare function drawPath(options: DrawShapePathsOptions): void;
|
|
79
80
|
|
|
80
81
|
declare class Fragment {
|
|
81
82
|
content: string;
|
|
@@ -109,7 +110,6 @@ declare class Character {
|
|
|
109
110
|
centerDiviation: number;
|
|
110
111
|
glyphBox: BoundingBox;
|
|
111
112
|
centerPoint: VectorLike;
|
|
112
|
-
fontMinGlyphWidth: number;
|
|
113
113
|
get computedStyle(): TextStyle;
|
|
114
114
|
get isVertical(): boolean;
|
|
115
115
|
get fontSize(): number;
|
|
@@ -223,10 +223,12 @@ interface HighlightGroup {
|
|
|
223
223
|
box: BoundingBox;
|
|
224
224
|
baseline: number;
|
|
225
225
|
fontSize: number;
|
|
226
|
-
fontMinGlyphWidth: number;
|
|
227
226
|
}
|
|
228
227
|
declare class Highlighter extends Feature {
|
|
229
|
-
paths:
|
|
228
|
+
paths: {
|
|
229
|
+
clipRect?: BoundingBox;
|
|
230
|
+
path: Path2D;
|
|
231
|
+
}[];
|
|
230
232
|
getBoundingBox(): BoundingBox;
|
|
231
233
|
highlight(): void;
|
|
232
234
|
protected _parseSvg(url: string): {
|
|
@@ -234,7 +236,10 @@ declare class Highlighter extends Feature {
|
|
|
234
236
|
box: BoundingBox;
|
|
235
237
|
viewBox: BoundingBox;
|
|
236
238
|
};
|
|
237
|
-
protected _parseGroup(group: HighlightGroup):
|
|
239
|
+
protected _parseGroup(group: HighlightGroup): {
|
|
240
|
+
clipRect?: BoundingBox;
|
|
241
|
+
path: Path2D;
|
|
242
|
+
}[];
|
|
238
243
|
draw({ ctx }: {
|
|
239
244
|
ctx: CanvasRenderingContext2D;
|
|
240
245
|
}): this;
|
|
@@ -339,4 +344,4 @@ declare function getPointPosition(point: {
|
|
|
339
344
|
y: number;
|
|
340
345
|
};
|
|
341
346
|
|
|
342
|
-
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles,
|
|
347
|
+
export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPath, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(f=typeof globalThis<"u"?globalThis:f||self,H(f.modernText={}))})(this,function(f){"use strict";var so=Object.defineProperty;var oo=(f,H,dt)=>H in f?so(f,H,{enumerable:!0,configurable:!0,writable:!0,value:dt}):f[H]=dt;var D=(f,H,dt)=>oo(f,typeof H!="symbol"?H+"":H,dt);function H(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:a}=wr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return a.forEach(h=>c.addColorStop(h.offset,h.color)),c}return t}function dt(i,t,e){i!=null&&i.color&&(i.color=H(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=H(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=H(e,i.textStrokeColor,t))}function wr(i,t,e,n,r){var y;const s=((y=i.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",o=s.split(",")[0],a=o.includes("deg")?o:"0deg",c=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(a.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),p=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+p,x1:t+n/2+u,y1:e+r/2-p,stops:Array.from(c).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function Pe(i){const{ctx:t,paths:e,fontSize:n}=i;e.forEach(r=>{t.save(),t.beginPath();const s=r.style;r.style={...s,fill:i.color??s.fill,stroke:i.textStrokeColor??s.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};const o=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(o,a),r.drawTo(t),t.restore()})}var z=Uint8Array,it=Uint16Array,Me=Int32Array,le=new z([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ue=new z([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ce=new z([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Me(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(le,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ue,0),vr=on.b,an=on.r,Oe=new it(32768),I=0;I<32768;++I){var Mt=(I&43690)>>1|(I&21845)<<1;Mt=(Mt&52428)>>2|(Mt&13107)<<2,Mt=(Mt&61680)>>4|(Mt&3855)<<4,Oe[I]=((Mt&65280)>>8|(Mt&255)<<8)>>1}for(var gt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(e){a=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,p=u|(1<<l)-1;u<=p;++u)a[Oe[u]>>c]=h}else for(a=new it(n),r=0;r<n;++r)i[r]&&(a[r]=Oe[o[i[r]-1]++]>>15-i[r]);return a},Ct=new z(288),I=0;I<144;++I)Ct[I]=8;for(var I=144;I<256;++I)Ct[I]=9;for(var I=256;I<280;++I)Ct[I]=7;for(var I=280;I<288;++I)Ct[I]=8;for(var Wt=new z(32),I=0;I<32;++I)Wt[I]=5;var br=gt(Ct,9,0),xr=gt(Ct,9,1),_r=gt(Wt,5,0),Sr=gt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ft=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},De=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new z(i.subarray(t,e))},Pr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pt=function(i,t,e){var n=new Error(t||Pr[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pt),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new z(0);var o=!e,a=o||t.i!=2,c=t.i;o&&(e=new z(r*3));var h=function(ae){var he=e.length;if(ae>he){var zt=new z(Math.max(he*2,ae));zt.set(e),e=zt}},l=t.f||0,u=t.p||0,p=t.b||0,y=t.l,g=t.d,m=t.m,w=t.n,x=r*8;do{if(!y){l=ft(i,u,1);var _=ft(i,u+1,3);if(u+=3,_)if(_==1)y=xr,g=Sr,m=9,w=5;else if(_==2){var O=ft(i,u,31)+257,A=ft(i,u+10,15)+4,S=O+ft(i,u+5,31)+1;u+=14;for(var P=new z(S),U=new z(19),N=0;N<A;++N)U[Ce[N]]=ft(i,u+N*3,7);u+=A*3;for(var K=Ae(U),Ot=(1<<K)-1,ot=gt(U,K,1),N=0;N<S;){var nt=ot[ft(i,u,Ot)];u+=nt&15;var v=nt>>4;if(v<16)P[N++]=v;else{var V=0,L=0;for(v==16?(L=3+ft(i,u,3),u+=2,V=P[N-1]):v==17?(L=3+ft(i,u,7),u+=3):v==18&&(L=11+ft(i,u,127),u+=7);L--;)P[N++]=V}}var rt=P.subarray(0,O),k=P.subarray(O);m=Ae(rt),w=Ae(k),y=gt(rt,m,1),g=gt(k,w,1)}else pt(1);else{var v=De(u)+4,C=i[v-4]|i[v-3]<<8,T=v+C;if(T>r){c&&pt(0);break}a&&h(p+C),e.set(i.subarray(v,T),p),t.b=p+=C,t.p=u=T*8,t.f=l;continue}if(u>x){c&&pt(0);break}}a&&h(p+131072);for(var oe=(1<<m)-1,ut=(1<<w)-1,Pt=u;;Pt=u){var V=y[$e(i,u)&oe],at=V>>4;if(u+=V&15,u>x){c&&pt(0);break}if(V||pt(2),at<256)e[p++]=at;else if(at==256){Pt=u,y=null;break}else{var ht=at-254;if(at>264){var N=at-257,B=le[N];ht=ft(i,u,(1<<B)-1)+sn[N],u+=B}var bt=g[$e(i,u)&ut],kt=bt>>4;bt||pt(3),u+=bt&15;var k=vr[kt];if(kt>3){var B=ue[kt];k+=$e(i,u)&(1<<B)-1,u+=B}if(u>x){c&&pt(0);break}a&&h(p+131072);var Ht=p+ht;if(p<k){var xe=s-k,_e=Math.min(k,Ht);for(xe+p<0&&pt(3);p<_e;++p)e[p]=n[xe+p]}for(;p<Ht;++p)e[p]=e[p-k]}}t.l=y,t.p=Pt,t.b=p,t.f=l,y&&(l=1,t.m=m,t.d=g,t.n=w)}while(!l);return p!=e.length&&o?hn(e,0,p):e.subarray(0,p)},xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},Ie=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new z(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(T,O){return T.f-O.f}),e.push({s:-1,f:25001});var a=e[0],c=e[1],h=0,l=1,u=2;for(e[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=r-1;)a=e[e[h].f<e[u].f?h++:u++],c=e[h!=l&&e[h].f<e[u].f?h++:u++],e[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var p=s[0].s,n=1;n<r;++n)s[n].s>p&&(p=s[n].s);var y=new it(p+1),g=Ee(e[l-1],y,0);if(g>t){var n=0,m=0,w=g-t,x=1<<w;for(s.sort(function(O,A){return y[A.s]-y[O.s]||O.f-A.f});n<r;++n){var _=s[n].s;if(y[_]>t)m+=x-(1<<g-y[_]),y[_]=t;else break}for(m>>=w;m>0;){var v=s[n].s;y[v]<t?m-=1<<t-y[v]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;y[C]==t&&(--y[C],++m)}g=t}return{t:new z(y),l:g}},Ee=function(i,t,e){return i.s==-1?Math.max(Ee(i.l,t,e+1),Ee(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},a=1;a<=t;++a)if(i[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[a]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=De(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,a,c,h,l){xt(t,l++,e),++r[256];for(var u=Ie(r,15),p=u.t,y=u.l,g=Ie(s,15),m=g.t,w=g.l,x=cn(p),_=x.c,v=x.n,C=cn(m),T=C.c,O=C.n,A=new it(19),S=0;S<_.length;++S)++A[_[S]&31];for(var S=0;S<T.length;++S)++A[T[S]&31];for(var P=Ie(A,7),U=P.t,N=P.l,K=19;K>4&&!U[Ce[K-1]];--K);var Ot=h+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,p)+qt(s,m)+o+14+3*K+qt(A,U)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+h));var V,L,rt,k;if(xt(t,l,1+(nt<ot)),l+=2,nt<ot){V=gt(p,y,0),L=p,rt=gt(m,w,0),k=m;var oe=gt(U,N,0);xt(t,l,v-257),xt(t,l+5,O-1),xt(t,l+10,K-4),l+=14;for(var S=0;S<K;++S)xt(t,l+3*S,U[Ce[S]]);l+=3*K;for(var ut=[_,T],Pt=0;Pt<2;++Pt)for(var at=ut[Pt],S=0;S<at.length;++S){var ht=at[S]&31;xt(t,l,oe[ht]),l+=U[ht],ht>15&&(xt(t,l,at[S]>>5&127),l+=at[S]>>12)}}else V=br,L=Ct,rt=_r,k=Wt;for(var S=0;S<a;++S){var B=n[S];if(B>255){var ht=B>>18&31;Xt(t,l,V[ht+257]),l+=L[ht+257],ht>7&&(xt(t,l,B>>23&31),l+=le[ht]);var bt=B&31;Xt(t,l,rt[bt]),l+=k[bt],bt>3&&(Xt(t,l,B>>5&8191),l+=ue[bt])}else Xt(t,l,V[B]),l+=L[B]}return Xt(t,l,V[256]),l+L[256]},Cr=new Me([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new z(0),Tr=function(i,t,e,n,r,s){var o=s.z||i.length,a=new z(n+o+5*(1+Math.ceil(o/7e3))+r),c=a.subarray(n,a.length-r),h=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Cr[t-1],p=u>>13,y=u&8191,g=(1<<e)-1,m=s.p||new it(32768),w=s.h||new it(g+1),x=Math.ceil(e/3),_=2*x,v=function(tn){return(i[tn]^i[tn+1]<<x^i[tn+2]<<_)&g},C=new Me(25e3),T=new it(288),O=new it(32),A=0,S=0,P=s.i||0,U=0,N=s.w||0,K=0;P+2<o;++P){var Ot=v(P),ot=P&32767,nt=w[Ot];if(m[ot]=nt,w[Ot]=ot,N<=P){var V=o-P;if((A>7e3||U>24576)&&(V>423||!h)){l=un(i,c,0,C,T,O,S,U,K,P-K,l),U=A=S=0,K=P;for(var L=0;L<286;++L)T[L]=0;for(var L=0;L<30;++L)O[L]=0}var rt=2,k=0,oe=y,ut=ot-nt&32767;if(V>2&&Ot==v(P-ut))for(var Pt=Math.min(p,V)-1,at=Math.min(32767,P),ht=Math.min(258,V);ut<=at&&--oe&&ot!=nt;){if(i[P+rt]==i[P+rt-ut]){for(var B=0;B<ht&&i[P+B]==i[P+B-ut];++B);if(B>rt){if(rt=B,k=ut,B>Pt)break;for(var bt=Math.min(ut,B-2),kt=0,L=0;L<bt;++L){var Ht=P-ut+L&32767,xe=m[Ht],_e=Ht-xe&32767;_e>kt&&(kt=_e,nt=Ht)}}}ot=nt,nt=m[ot],ut+=ot-nt&32767}if(k){C[U++]=268435456|Te[rt]<<18|an[k];var ae=Te[rt]&31,he=an[k]&31;S+=le[ae]+ue[he],++T[257+ae],++O[he],N=P+rt,++A}else C[U++]=i[P],++T[i[P]]}}for(P=Math.max(P,N);P<o;++P)C[U++]=i[P],++T[i[P]];l=un(i,c,h,C,T,O,S,U,K,P-K,l),h||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=w,s.p=m,s.i=P,s.w=N)}else{for(var P=s.w||0;P<o+h;P+=65535){var zt=P+65535;zt>=o&&(c[l/8|0]=h,zt=o),l=ln(c,l+1,i.subarray(P,zt))}s.i=o}return hn(a,0,n+De(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Or=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new z(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Tr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},dn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Ar=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),dn(i,2,r.d())}},$r=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&pt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&pt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Dr(i,t){t||(t={});var e=pn();e.p(i);var n=Or(i,t,t.dictionary?6:2,4);return Ar(n,t),dn(n,n.length-4,e.d()),n}function Ir(i,t){return Mr(i.subarray($r(i,t),-4),{i:2},t,t)}var Er=typeof TextDecoder<"u"&&new TextDecoder,Ur=0;try{Er.decode(fn,{stream:!0}),Ur=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Br(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var gn=Object.defineProperty,Fr=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&gn(t,e,r),r},Nr=(i,t,e)=>(Fr(i,t+"",e),e);const fe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class R extends DataView{constructor(t,e,n,r){super(Br(t),e,n),this.littleEndian=r,Nr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=fe[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=fe[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Gr=Object.defineProperty,Rr=(i,t,e)=>t in i?Gr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vr=(i,t,e)=>(Rr(i,t+"",e),e);const yn=new WeakMap;function d(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=yn.get(r);o||(o={columns:[],byteLength:0},yn.set(r,o));const a={...t,name:s,byteLength:e*fe[n],offset:t.offset??o.columns.reduce((c,h)=>c+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((c,h)=>c+fe[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(a)},set(c){this.view.setColumn(a,c)},configurable:!0,enumerable:!0})}}class yt{constructor(t,e,n,r){Vr(this,"view"),this.view=new R(t,e,n,r)}}function kr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function pe(i){i=kr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var Wr=Object.defineProperty,Xr=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qr=(i,t,e)=>(Xr(i,t+"",e),e);class de extends yt{constructor(){super(...arguments),qr(this,"mimeType","font/opentype")}get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var mn=Object.defineProperty,jr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},Yr=(i,t,e)=>(jr(i,t+"",e),e);const q=class pr extends de{constructor(){super(...arguments),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=pe(r.fontFamily||""),o=s.length,a=pe(r.fontStyle||""),c=a.length,h=pe(r.version||""),l=h.length,u=pe(r.fullName||""),p=u.length,y=86+o+4+c+4+l+4+p+2+t.view.byteLength,g=new pr(new ArrayBuffer(y),0,y,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(p),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Q([d("uint32")],q.prototype,"EOTSize"),Q([d("uint32")],q.prototype,"FontDataSize"),Q([d("uint32")],q.prototype,"Version"),Q([d("uint32")],q.prototype,"Flags"),Q([d({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([d("uint8")],q.prototype,"Charset"),Q([d("uint8")],q.prototype,"Italic"),Q([d("uint32")],q.prototype,"Weight"),Q([d("uint16")],q.prototype,"fsType"),Q([d("uint16")],q.prototype,"MagicNumber"),Q([d({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([d({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([d("uint32")],q.prototype,"CheckSumAdjustment"),Q([d({type:"uint8",size:16})],q.prototype,"Reserved"),Q([d("uint16")],q.prototype,"Padding1");let Kr=q;var Qr=Object.defineProperty,ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Ft extends yt{constructor(t,e){super(t,e,16)}}ge([d({type:"char",size:4})],Ft.prototype,"tag"),ge([d("uint32")],Ft.prototype,"checkSum"),ge([d("uint32")],Ft.prototype,"offset"),ge([d("uint32")],Ft.prototype,"length");var Zr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Yt=class dr extends yt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new dr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([d("uint16")],Yt.prototype,"format"),ye([d("uint16")],Yt.prototype,"length"),ye([d("uint16")],Yt.prototype,"language"),ye([d({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ue=Yt;var Jr=Object.defineProperty,Le=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class Kt extends yt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,a=n.findIndex(h=>h===r);let c=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<s[0].firstCode||h>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(h-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(h-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(h,c);else{const l=n[h];for(let u=0,p=s[l].entryCount;u<p;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const y=(h<<8|u+s[l].firstCode)%65535;e.set(y,c)}}return e}}Le([d("uint16")],Kt.prototype,"format"),Le([d("uint16")],Kt.prototype,"length"),Le([d("uint16")],Kt.prototype,"language");function wn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Be(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:wn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=wn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var ti=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Tt=class gr extends yt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=Be(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new gr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,a=this.idDelta,c=this.glyphIndexArray;for(let h=0;h<e;++h)for(let l=r[h],u=s[h];l<=u;++l)if(o[h]===0)t.set(l,(l+a[h])%65536);else{const p=h+o[h]/2+(l-r[h])-n,y=c[p];y!==0?t.set(l,(y+a[h])%65536):t.set(l,0)}return t.delete(65535),t}};$t([d("uint16")],Tt.prototype,"format"),$t([d("uint16")],Tt.prototype,"length"),$t([d("uint16")],Tt.prototype,"language"),$t([d("uint16")],Tt.prototype,"segCountX2"),$t([d("uint16")],Tt.prototype,"searchRange"),$t([d("uint16")],Tt.prototype,"entrySelector"),$t([d("uint16")],Tt.prototype,"rangeShift");let Fe=Tt;var ei=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class Dt extends yt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([d("uint16")],Dt.prototype,"format"),Qt([d("uint16")],Dt.prototype,"length"),Qt([d("uint16")],Dt.prototype,"language"),Qt([d("uint16")],Dt.prototype,"firstCode"),Qt([d("uint16")],Dt.prototype,"entryCount");var ni=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ni(t,e,r),r};const Nt=class yr extends yt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Be(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,a=s.startCharCode;const c=s.endCharCode;for(;a<=c;)t.set(a++,o++)}return t}};Zt([d("uint16")],Nt.prototype,"format"),Zt([d("uint16")],Nt.prototype,"reserved"),Zt([d("uint32")],Nt.prototype,"length"),Zt([d("uint32")],Nt.prototype,"language"),Zt([d("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ri=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ri(t,e,r),r};class Jt extends yt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([d("uint16")],Jt.prototype,"format"),Ge([d("uint32")],Jt.prototype,"length"),Ge([d("uint32")],Jt.prototype,"numVarSelectorRecords");var ii=Object.defineProperty,si=(i,t,e)=>t in i?ii(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(si(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const vn=class ce{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let a=0;a<r;a+=1)s[a]=e.get(n[a])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const a=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let h=0;h<c.length;h+=1){const l=c[h];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*a),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ce(this.tableViews)}delete(t){const e=ce.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ce.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ce.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(vn,"tableDefinitions",new Map);let te=vn;class Z extends yt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var bn=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ai=(i,t,e)=>t in i?bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bn(t,e,r),r},hi=(i,t,e)=>(ai(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),hi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Fe.from(t),r=Ue.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),a=o+n.view.byteLength,c=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=h.length,l.view.seek(4),h.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,a),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new Ue(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Fe(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new Dt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var a,c,h,l,u;const t=this._getSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,n=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:c.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:h.view,s=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:l.view,o=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([d("uint16")],f.Cmap.prototype,"version",2),Ve([d("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ci=Object.defineProperty,li=(i,t,e)=>t in i?ci(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ui=(i,t,e)=>(li(i,t+"",e),e);class xn{constructor(t){ui(this,"pathCommands",[]);const e={...t};if(this.index=e.index||0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name||null,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const h=this.instructions=[];for(let m=0;m<c;++m)h.push(t.view.readUint8());const l=t.view.byteOffset,u=a[a.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const p=[];let y,g=0;for(;g<u;)if(y=t.view.readUint8(),p.push(y),g++,y&8&&g<u){const m=t.view.readUint8();for(let w=0;w<m;w++)p.push(y),g++}if(jt(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let w;if(u>0){for(let v=0;v<u;v+=1)y=p[v],w={},w.onCurve=!!(y&1),w.lastPointOfContour=a.includes(v),m.push(w);let x=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.x=this._parseGlyphCoordinate(t,y,x,2,16),x=w.x;let _=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.y=this._parseGlyphCoordinate(t,y,_,4,32),_=w.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,c=!0;for(;c;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),c=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const c=this.components[a],h=n.get(c.glyphIndex);if(h.getPathCommands(),h.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(h.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let p=h.points[c.matchedPoints[1]];const y={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};p=this._transformPoints([p],y)[0],y.dx=u.x-p.x,y.dy=u.y-p.y,l=this._transformPoints(h.points,y)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let a=0,c=o.length;a<c;++a){const h=o[a];let l=h[h.length-1],u=h[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let p=0,y=h.length;p<y;++p)if(l=u,u=h[(p+1)%y],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let g=u;u.onCurve||(g={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:g.x,y:g.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:a=o,yScale:c=o}=r,h=this.pathCommands,l=[];for(let u=0,p=h.length;u<p;u+=1){const y=h[u];y.type==="M"?l.push({type:"M",x:t+y.x*a,y:e+-y.y*c}):y.type==="L"?l.push({type:"L",x:t+y.x*a,y:e+-y.y*c}):y.type==="Q"?l.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*c,x:t+y.x*a,y:e+-y.y*c}):y.type==="Z"&&l.push({type:"Z"})}return l}}var fi=Object.defineProperty,pi=(i,t,e)=>t in i?fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,di=(i,t,e)=>(pi(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,di(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new xn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],a=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),a!==r[t+1]&&n._parse(this._sfnt.glyf,a,this),this._items[t]=n}return n}}var Sn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mi=(i,t,e,n)=>{for(var r=n>1?void 0:n?gi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},wi=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),wi(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=mi([j("glyf")],f.Glyf);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,xi=(i,t,e,n)=>{for(var r=n>1?void 0:n?bi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&vi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=xi([j("GPOS","gpos")],f.Gpos);var _i=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,It=(i,t,e,n)=>{for(var r=n>1?void 0:n?Si(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Gsub=class extends Z{},It([d("uint16")],f.Gsub.prototype,"majorVersion",2),It([d("uint16")],f.Gsub.prototype,"minorVersion",2),It([d("uint16")],f.Gsub.prototype,"scriptListOffset",2),It([d("uint16")],f.Gsub.prototype,"featureListOffset",2),It([d("uint16")],f.Gsub.prototype,"lookupListOffset",2),It([d("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=It([j("GSUB","gsub")],f.Gsub);var Pi=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pi(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([d("fixed")],f.Head.prototype,"version",2),G([d("fixed")],f.Head.prototype,"fontRevision",2),G([d("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([d("uint32")],f.Head.prototype,"magickNumber",2),G([d("uint16")],f.Head.prototype,"flags",2),G([d("uint16")],f.Head.prototype,"unitsPerEm",2),G([d({type:"longDateTime"})],f.Head.prototype,"created",2),G([d({type:"longDateTime"})],f.Head.prototype,"modified",2),G([d("int16")],f.Head.prototype,"xMin",2),G([d("int16")],f.Head.prototype,"yMin",2),G([d("int16")],f.Head.prototype,"xMax",2),G([d("int16")],f.Head.prototype,"yMax",2),G([d("uint16")],f.Head.prototype,"macStyle",2),G([d("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([d("int16")],f.Head.prototype,"fontDirectionHint",2),G([d("int16")],f.Head.prototype,"indexToLocFormat",2),G([d("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Ci=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ti(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ci(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([d("fixed")],f.Hhea.prototype,"version",2),J([d("int16")],f.Hhea.prototype,"ascent",2),J([d("int16")],f.Hhea.prototype,"descent",2),J([d("int16")],f.Hhea.prototype,"lineGap",2),J([d("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([d("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([d("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([d("int16")],f.Hhea.prototype,"xMaxExtent",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([d("int16")],f.Hhea.prototype,"caretOffset",2),J([d({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([d("int16")],f.Hhea.prototype,"metricDataFormat",2),J([d("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Pn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ai=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$i=(i,t,e,n)=>{for(var r=n>1?void 0:n?Oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},Di=(i,t,e)=>(Ai(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Di(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=$i([j("hmtx")],f.Hmtx);var Ii=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Ui=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ei(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ii(t,e,r),r};f.Kern=class extends Z{},f.Kern=Ui([j("kern","kern")],f.Kern);var Mn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Bi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},Ni=(i,t,e)=>(Bi(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Ni(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Fi([j("loca")],f.Loca);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([d("fixed")],f.Maxp.prototype,"version",2),Y([d("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([d("uint16")],f.Maxp.prototype,"maxPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxContours",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([d("uint16")],f.Maxp.prototype,"maxZones",2),Y([d("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxStorage",2),Y([d("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([d("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Vi=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,me=(i,t,e,n)=>{for(var r=n>1?void 0:n?ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Vi(t,e,r),r};const Cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},ke={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Hi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Tn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let c=0;c<t;++c){const h=e[c];h.name=this.view.readBytes(n+h.offset,h.length)}let r=ke.Macintosh,s=Hi.Default,o=0;e.some(c=>c.platform===ke.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=ke.Microsoft,s=Tn.UCS2,o=1033);const a={};for(let c=0;c<t;++c){const h=e[c];h.platform===r&&h.encoding===s&&h.language===o&&Cn[h.nameId]&&(a[Cn[h.nameId]]=o===0?Hr(h.name):zr(h.name))}return a}},me([d("uint16")],f.Name.prototype,"format",2),me([d("uint16")],f.Name.prototype,"count",2),me([d("uint16")],f.Name.prototype,"stringOffset",2),f.Name=me([j("name")],f.Name);var zi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,M=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&zi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},M([d("uint16")],f.Os2.prototype,"version",2),M([d("int16")],f.Os2.prototype,"xAvgCharWidth",2),M([d("uint16")],f.Os2.prototype,"usWeightClass",2),M([d("uint16")],f.Os2.prototype,"usWidthClass",2),M([d("uint16")],f.Os2.prototype,"fsType",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutSize",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),M([d("uint16")],f.Os2.prototype,"sFamilyClass",2),M([d({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),M([d({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bWeight",2),M([d({type:"uint8"})],f.Os2.prototype,"bProportion",2),M([d({type:"uint8"})],f.Os2.prototype,"bContrast",2),M([d({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),M([d({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bLetterform",2),M([d({type:"uint8"})],f.Os2.prototype,"bMidline",2),M([d({type:"uint8"})],f.Os2.prototype,"bXHeight",2),M([d({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),M([d({type:"char",size:4})],f.Os2.prototype,"achVendID",2),M([d("uint16")],f.Os2.prototype,"fsSelection",2),M([d("uint16")],f.Os2.prototype,"usFirstCharIndex",2),M([d("uint16")],f.Os2.prototype,"usLastCharIndex",2),M([d("int16")],f.Os2.prototype,"sTypoAscender",2),M([d("int16")],f.Os2.prototype,"sTypoDescender",2),M([d("int16")],f.Os2.prototype,"sTypoLineGap",2),M([d("uint16")],f.Os2.prototype,"usWinAscent",2),M([d("uint16")],f.Os2.prototype,"usWinDescent",2),M([d({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),M([d({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),M([d("int16")],f.Os2.prototype,"sCapHeight",2),M([d("uint16")],f.Os2.prototype,"usDefaultChar",2),M([d("uint16")],f.Os2.prototype,"usBreakChar",2),M([d("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=M([j("OS/2","os2")],f.Os2);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([d("fixed")],f.Post.prototype,"format",2),mt([d("fixed")],f.Post.prototype,"italicAngle",2),mt([d("int16")],f.Post.prototype,"underlinePosition",2),mt([d("int16")],f.Post.prototype,"underlineThickness",2),mt([d("uint32")],f.Post.prototype,"isFixedPitch",2),mt([d("uint32")],f.Post.prototype,"minMemType42",2),mt([d("uint32")],f.Post.prototype,"maxMemType42",2),mt([d("uint32")],f.Post.prototype,"minMemType1",2),mt([d("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var ji=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Yi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ji(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([d("fixed")],f.Vhea.prototype,"version",2),tt([d("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([d("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([d("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([d("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([d("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([d("int16")],f.Vhea.prototype,"caretOffset",2),tt([d({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([d("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([d("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Qi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Ji=(i,t,e)=>(Qi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Ji(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Zi([j("vmtx")],f.Vmtx);var An=Object.defineProperty,ts=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},He=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const Et=class Se extends de{constructor(){super(...arguments),He(this,"mimeType","font/ttf"),He(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,p)=>u+e(p.byteLength),0),s=new Se(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let a=12+n*16,c=0;const h=s.getDirectories();t.tableViews.forEach((u,p)=>{const y=h[c++];y.tag=p,y.checkSum=Se.checksum(u),y.offset=a,y.length=u.byteLength,s.view.writeBytes(u,a),a+=e(y.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Se.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ft(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};He(Et,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([d("uint32")],Et.prototype,"scalerType"),ee([d("uint16")],Et.prototype,"numTables"),ee([d("uint16")],Et.prototype,"searchRange"),ee([d("uint16")],Et.prototype,"entrySelector"),ee([d("uint16")],Et.prototype,"rangeShift");let _t=Et;var es=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&es(t,e,r),r};class Ut extends yt{constructor(t,e){super(t,e,20)}}ne([d({type:"char",size:4})],Ut.prototype,"tag"),ne([d("uint32")],Ut.prototype,"offset"),ne([d("uint32")],Ut.prototype,"compLength"),ne([d("uint32")],Ut.prototype,"origLength"),ne([d("uint32")],Ut.prototype,"origChecksum");var $n=Object.defineProperty,ns=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ze=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends de{constructor(){super(...arguments),ze(this,"mimeType","font/woff"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let a=n-r*4;if(a){let c=r*4;for(;a>0;)s+=e.getUint8(c)<<a*8,c++,a--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,p)=>{const y=At(Dr(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:p,view:y.byteLength<u.byteLength?y:u,rawView:u})});const s=r.length,o=r.reduce((u,p)=>u+n(p.view.byteLength),0),a=new en(new ArrayBuffer(44+20*s+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=s,a.totalSfntSize=12+16*s+r.reduce((u,p)=>u+n(p.rawView.byteLength),0);let c=44+s*20,h=0;const l=a.getDirectories();return r.forEach(u=>{const p=l[h++];p.tag=u.tag,p.offset=c,p.compLength=u.view.byteLength,p.origChecksum=en.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,c),c+=n(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ut(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,a=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView(Ir(new Uint8Array(this.view.buffer.slice(r,a))).buffer),t},{}))}};ze(et,"FLAGS",new Set([2001684038])),st([d("uint32")],et.prototype,"signature"),st([d("uint32")],et.prototype,"flavor"),st([d("uint32")],et.prototype,"length"),st([d("uint16")],et.prototype,"numTables"),st([d("uint16")],et.prototype,"reserved"),st([d("uint32")],et.prototype,"totalSfntSize"),st([d("uint16")],et.prototype,"majorVersion"),st([d("uint16")],et.prototype,"minorVersion"),st([d("uint32")],et.prototype,"metaOffset"),st([d("uint32")],et.prototype,"metaLength"),st([d("uint32")],et.prototype,"metaOrigLength"),st([d("uint32")],et.prototype,"privOffset"),st([d("uint32")],et.prototype,"privLength");let St=et;var rs=Object.defineProperty,is=(i,t,e)=>t in i?rs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(is(i,typeof t!="symbol"?t+"":t,e),e);const Dn=class mr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...mr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(f,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(f=typeof globalThis<"u"?globalThis:f||self,H(f.modernText={}))})(this,function(f){"use strict";var so=Object.defineProperty;var oo=(f,H,dt)=>H in f?so(f,H,{enumerable:!0,configurable:!0,writable:!0,value:dt}):f[H]=dt;var I=(f,H,dt)=>oo(f,typeof H!="symbol"?H+"":H,dt);function H(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:a}=wr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return a.forEach(h=>c.addColorStop(h.offset,h.color)),c}return t}function dt(i,t,e){i!=null&&i.color&&(i.color=H(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=H(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=H(e,i.textStrokeColor,t))}function wr(i,t,e,n,r){var y;const s=((y=i.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",o=s.split(",")[0],a=o.includes("deg")?o:"0deg",c=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(a.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),p=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+p,x1:t+n/2+u,y1:e+r/2-p,stops:Array.from(c).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function Se(i){const{ctx:t,path:e,fontSize:n,clipRect:r}=i;t.save(),t.beginPath();const s=e.style;e.style={...s,fill:i.color??s.fill,stroke:i.textStrokeColor??s.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};const o=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(o,a),r&&(t.rect(r.x,r.y,r.width,r.height),t.clip(),t.beginPath()),e.drawTo(t),t.restore()}var z=Uint8Array,it=Uint16Array,Me=Int32Array,le=new z([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ue=new z([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ce=new z([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Me(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(le,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ue,0),vr=on.b,an=on.r,Oe=new it(32768),D=0;D<32768;++D){var Mt=(D&43690)>>1|(D&21845)<<1;Mt=(Mt&52428)>>2|(Mt&13107)<<2,Mt=(Mt&61680)>>4|(Mt&3855)<<4,Oe[D]=((Mt&65280)>>8|(Mt&255)<<8)>>1}for(var gt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(e){a=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,p=u|(1<<l)-1;u<=p;++u)a[Oe[u]>>c]=h}else for(a=new it(n),r=0;r<n;++r)i[r]&&(a[r]=Oe[o[i[r]-1]++]>>15-i[r]);return a},Ct=new z(288),D=0;D<144;++D)Ct[D]=8;for(var D=144;D<256;++D)Ct[D]=9;for(var D=256;D<280;++D)Ct[D]=7;for(var D=280;D<288;++D)Ct[D]=8;for(var Wt=new z(32),D=0;D<32;++D)Wt[D]=5;var br=gt(Ct,9,0),xr=gt(Ct,9,1),_r=gt(Wt,5,0),Pr=gt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ft=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ie=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new z(i.subarray(t,e))},Sr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pt=function(i,t,e){var n=new Error(t||Sr[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pt),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new z(0);var o=!e,a=o||t.i!=2,c=t.i;o&&(e=new z(r*3));var h=function(ae){var he=e.length;if(ae>he){var zt=new z(Math.max(he*2,ae));zt.set(e),e=zt}},l=t.f||0,u=t.p||0,p=t.b||0,y=t.l,g=t.d,m=t.m,w=t.n,x=r*8;do{if(!y){l=ft(i,u,1);var _=ft(i,u+1,3);if(u+=3,_)if(_==1)y=xr,g=Pr,m=9,w=5;else if(_==2){var O=ft(i,u,31)+257,A=ft(i,u+10,15)+4,P=O+ft(i,u+5,31)+1;u+=14;for(var S=new z(P),U=new z(19),N=0;N<A;++N)U[Ce[N]]=ft(i,u+N*3,7);u+=A*3;for(var K=Ae(U),Ot=(1<<K)-1,ot=gt(U,K,1),N=0;N<P;){var nt=ot[ft(i,u,Ot)];u+=nt&15;var v=nt>>4;if(v<16)S[N++]=v;else{var V=0,L=0;for(v==16?(L=3+ft(i,u,3),u+=2,V=S[N-1]):v==17?(L=3+ft(i,u,7),u+=3):v==18&&(L=11+ft(i,u,127),u+=7);L--;)S[N++]=V}}var rt=S.subarray(0,O),k=S.subarray(O);m=Ae(rt),w=Ae(k),y=gt(rt,m,1),g=gt(k,w,1)}else pt(1);else{var v=Ie(u)+4,T=i[v-4]|i[v-3]<<8,C=v+T;if(C>r){c&&pt(0);break}a&&h(p+T),e.set(i.subarray(v,C),p),t.b=p+=T,t.p=u=C*8,t.f=l;continue}if(u>x){c&&pt(0);break}}a&&h(p+131072);for(var oe=(1<<m)-1,ut=(1<<w)-1,St=u;;St=u){var V=y[$e(i,u)&oe],at=V>>4;if(u+=V&15,u>x){c&&pt(0);break}if(V||pt(2),at<256)e[p++]=at;else if(at==256){St=u,y=null;break}else{var ht=at-254;if(at>264){var N=at-257,B=le[N];ht=ft(i,u,(1<<B)-1)+sn[N],u+=B}var bt=g[$e(i,u)&ut],kt=bt>>4;bt||pt(3),u+=bt&15;var k=vr[kt];if(kt>3){var B=ue[kt];k+=$e(i,u)&(1<<B)-1,u+=B}if(u>x){c&&pt(0);break}a&&h(p+131072);var Ht=p+ht;if(p<k){var xe=s-k,_e=Math.min(k,Ht);for(xe+p<0&&pt(3);p<_e;++p)e[p]=n[xe+p]}for(;p<Ht;++p)e[p]=e[p-k]}}t.l=y,t.p=St,t.b=p,t.f=l,y&&(l=1,t.m=m,t.d=g,t.n=w)}while(!l);return p!=e.length&&o?hn(e,0,p):e.subarray(0,p)},xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},De=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new z(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(C,O){return C.f-O.f}),e.push({s:-1,f:25001});var a=e[0],c=e[1],h=0,l=1,u=2;for(e[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=r-1;)a=e[e[h].f<e[u].f?h++:u++],c=e[h!=l&&e[h].f<e[u].f?h++:u++],e[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var p=s[0].s,n=1;n<r;++n)s[n].s>p&&(p=s[n].s);var y=new it(p+1),g=Ee(e[l-1],y,0);if(g>t){var n=0,m=0,w=g-t,x=1<<w;for(s.sort(function(O,A){return y[A.s]-y[O.s]||O.f-A.f});n<r;++n){var _=s[n].s;if(y[_]>t)m+=x-(1<<g-y[_]),y[_]=t;else break}for(m>>=w;m>0;){var v=s[n].s;y[v]<t?m-=1<<t-y[v]++-1:++n}for(;n>=0&&m;--n){var T=s[n].s;y[T]==t&&(--y[T],++m)}g=t}return{t:new z(y),l:g}},Ee=function(i,t,e){return i.s==-1?Math.max(Ee(i.l,t,e+1),Ee(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},a=1;a<=t;++a)if(i[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[a]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=Ie(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,a,c,h,l){xt(t,l++,e),++r[256];for(var u=De(r,15),p=u.t,y=u.l,g=De(s,15),m=g.t,w=g.l,x=cn(p),_=x.c,v=x.n,T=cn(m),C=T.c,O=T.n,A=new it(19),P=0;P<_.length;++P)++A[_[P]&31];for(var P=0;P<C.length;++P)++A[C[P]&31];for(var S=De(A,7),U=S.t,N=S.l,K=19;K>4&&!U[Ce[K-1]];--K);var Ot=h+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,p)+qt(s,m)+o+14+3*K+qt(A,U)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+h));var V,L,rt,k;if(xt(t,l,1+(nt<ot)),l+=2,nt<ot){V=gt(p,y,0),L=p,rt=gt(m,w,0),k=m;var oe=gt(U,N,0);xt(t,l,v-257),xt(t,l+5,O-1),xt(t,l+10,K-4),l+=14;for(var P=0;P<K;++P)xt(t,l+3*P,U[Ce[P]]);l+=3*K;for(var ut=[_,C],St=0;St<2;++St)for(var at=ut[St],P=0;P<at.length;++P){var ht=at[P]&31;xt(t,l,oe[ht]),l+=U[ht],ht>15&&(xt(t,l,at[P]>>5&127),l+=at[P]>>12)}}else V=br,L=Ct,rt=_r,k=Wt;for(var P=0;P<a;++P){var B=n[P];if(B>255){var ht=B>>18&31;Xt(t,l,V[ht+257]),l+=L[ht+257],ht>7&&(xt(t,l,B>>23&31),l+=le[ht]);var bt=B&31;Xt(t,l,rt[bt]),l+=k[bt],bt>3&&(Xt(t,l,B>>5&8191),l+=ue[bt])}else Xt(t,l,V[B]),l+=L[B]}return Xt(t,l,V[256]),l+L[256]},Cr=new Me([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new z(0),Tr=function(i,t,e,n,r,s){var o=s.z||i.length,a=new z(n+o+5*(1+Math.ceil(o/7e3))+r),c=a.subarray(n,a.length-r),h=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Cr[t-1],p=u>>13,y=u&8191,g=(1<<e)-1,m=s.p||new it(32768),w=s.h||new it(g+1),x=Math.ceil(e/3),_=2*x,v=function(tn){return(i[tn]^i[tn+1]<<x^i[tn+2]<<_)&g},T=new Me(25e3),C=new it(288),O=new it(32),A=0,P=0,S=s.i||0,U=0,N=s.w||0,K=0;S+2<o;++S){var Ot=v(S),ot=S&32767,nt=w[Ot];if(m[ot]=nt,w[Ot]=ot,N<=S){var V=o-S;if((A>7e3||U>24576)&&(V>423||!h)){l=un(i,c,0,T,C,O,P,U,K,S-K,l),U=A=P=0,K=S;for(var L=0;L<286;++L)C[L]=0;for(var L=0;L<30;++L)O[L]=0}var rt=2,k=0,oe=y,ut=ot-nt&32767;if(V>2&&Ot==v(S-ut))for(var St=Math.min(p,V)-1,at=Math.min(32767,S),ht=Math.min(258,V);ut<=at&&--oe&&ot!=nt;){if(i[S+rt]==i[S+rt-ut]){for(var B=0;B<ht&&i[S+B]==i[S+B-ut];++B);if(B>rt){if(rt=B,k=ut,B>St)break;for(var bt=Math.min(ut,B-2),kt=0,L=0;L<bt;++L){var Ht=S-ut+L&32767,xe=m[Ht],_e=Ht-xe&32767;_e>kt&&(kt=_e,nt=Ht)}}}ot=nt,nt=m[ot],ut+=ot-nt&32767}if(k){T[U++]=268435456|Te[rt]<<18|an[k];var ae=Te[rt]&31,he=an[k]&31;P+=le[ae]+ue[he],++C[257+ae],++O[he],N=S+rt,++A}else T[U++]=i[S],++C[i[S]]}}for(S=Math.max(S,N);S<o;++S)T[U++]=i[S],++C[i[S]];l=un(i,c,h,T,C,O,P,U,K,S-K,l),h||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=w,s.p=m,s.i=S,s.w=N)}else{for(var S=s.w||0;S<o+h;S+=65535){var zt=S+65535;zt>=o&&(c[l/8|0]=h,zt=o),l=ln(c,l+1,i.subarray(S,zt))}s.i=o}return hn(a,0,n+Ie(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Or=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new z(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Tr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},dn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Ar=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),dn(i,2,r.d())}},$r=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&pt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&pt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ir(i,t){t||(t={});var e=pn();e.p(i);var n=Or(i,t,t.dictionary?6:2,4);return Ar(n,t),dn(n,n.length-4,e.d()),n}function Dr(i,t){return Mr(i.subarray($r(i,t),-4),{i:2},t,t)}var Er=typeof TextDecoder<"u"&&new TextDecoder,Ur=0;try{Er.decode(fn,{stream:!0}),Ur=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Br(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var gn=Object.defineProperty,Fr=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&gn(t,e,r),r},Nr=(i,t,e)=>(Fr(i,t+"",e),e);const fe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class R extends DataView{constructor(t,e,n,r){super(Br(t),e,n),this.littleEndian=r,Nr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=fe[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=fe[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Gr=Object.defineProperty,Rr=(i,t,e)=>t in i?Gr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vr=(i,t,e)=>(Rr(i,t+"",e),e);const yn=new WeakMap;function d(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=yn.get(r);o||(o={columns:[],byteLength:0},yn.set(r,o));const a={...t,name:s,byteLength:e*fe[n],offset:t.offset??o.columns.reduce((c,h)=>c+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((c,h)=>c+fe[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(a)},set(c){this.view.setColumn(a,c)},configurable:!0,enumerable:!0})}}class yt{constructor(t,e,n,r){Vr(this,"view"),this.view=new R(t,e,n,r)}}function kr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function pe(i){i=kr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var Wr=Object.defineProperty,Xr=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qr=(i,t,e)=>(Xr(i,t+"",e),e);class de extends yt{constructor(){super(...arguments),qr(this,"mimeType","font/opentype")}get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var mn=Object.defineProperty,jr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},Yr=(i,t,e)=>(jr(i,t+"",e),e);const q=class pr extends de{constructor(){super(...arguments),Yr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=pe(r.fontFamily||""),o=s.length,a=pe(r.fontStyle||""),c=a.length,h=pe(r.version||""),l=h.length,u=pe(r.fullName||""),p=u.length,y=86+o+4+c+4+l+4+p+2+t.view.byteLength,g=new pr(new ArrayBuffer(y),0,y,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(p),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Q([d("uint32")],q.prototype,"EOTSize"),Q([d("uint32")],q.prototype,"FontDataSize"),Q([d("uint32")],q.prototype,"Version"),Q([d("uint32")],q.prototype,"Flags"),Q([d({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([d("uint8")],q.prototype,"Charset"),Q([d("uint8")],q.prototype,"Italic"),Q([d("uint32")],q.prototype,"Weight"),Q([d("uint16")],q.prototype,"fsType"),Q([d("uint16")],q.prototype,"MagicNumber"),Q([d({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([d({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([d("uint32")],q.prototype,"CheckSumAdjustment"),Q([d({type:"uint8",size:16})],q.prototype,"Reserved"),Q([d("uint16")],q.prototype,"Padding1");let Kr=q;var Qr=Object.defineProperty,ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Ft extends yt{constructor(t,e){super(t,e,16)}}ge([d({type:"char",size:4})],Ft.prototype,"tag"),ge([d("uint32")],Ft.prototype,"checkSum"),ge([d("uint32")],Ft.prototype,"offset"),ge([d("uint32")],Ft.prototype,"length");var Zr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Yt=class dr extends yt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new dr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([d("uint16")],Yt.prototype,"format"),ye([d("uint16")],Yt.prototype,"length"),ye([d("uint16")],Yt.prototype,"language"),ye([d({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ue=Yt;var Jr=Object.defineProperty,Le=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class Kt extends yt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,a=n.findIndex(h=>h===r);let c=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<s[0].firstCode||h>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(h-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(h-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(h,c);else{const l=n[h];for(let u=0,p=s[l].entryCount;u<p;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const y=(h<<8|u+s[l].firstCode)%65535;e.set(y,c)}}return e}}Le([d("uint16")],Kt.prototype,"format"),Le([d("uint16")],Kt.prototype,"length"),Le([d("uint16")],Kt.prototype,"language");function wn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Be(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:wn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=wn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var ti=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Tt=class gr extends yt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=Be(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new gr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,a=this.idDelta,c=this.glyphIndexArray;for(let h=0;h<e;++h)for(let l=r[h],u=s[h];l<=u;++l)if(o[h]===0)t.set(l,(l+a[h])%65536);else{const p=h+o[h]/2+(l-r[h])-n,y=c[p];y!==0?t.set(l,(y+a[h])%65536):t.set(l,0)}return t.delete(65535),t}};$t([d("uint16")],Tt.prototype,"format"),$t([d("uint16")],Tt.prototype,"length"),$t([d("uint16")],Tt.prototype,"language"),$t([d("uint16")],Tt.prototype,"segCountX2"),$t([d("uint16")],Tt.prototype,"searchRange"),$t([d("uint16")],Tt.prototype,"entrySelector"),$t([d("uint16")],Tt.prototype,"rangeShift");let Fe=Tt;var ei=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class It extends yt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([d("uint16")],It.prototype,"format"),Qt([d("uint16")],It.prototype,"length"),Qt([d("uint16")],It.prototype,"language"),Qt([d("uint16")],It.prototype,"firstCode"),Qt([d("uint16")],It.prototype,"entryCount");var ni=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ni(t,e,r),r};const Nt=class yr extends yt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Be(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,a=s.startCharCode;const c=s.endCharCode;for(;a<=c;)t.set(a++,o++)}return t}};Zt([d("uint16")],Nt.prototype,"format"),Zt([d("uint16")],Nt.prototype,"reserved"),Zt([d("uint32")],Nt.prototype,"length"),Zt([d("uint32")],Nt.prototype,"language"),Zt([d("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ri=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ri(t,e,r),r};class Jt extends yt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([d("uint16")],Jt.prototype,"format"),Ge([d("uint32")],Jt.prototype,"length"),Ge([d("uint32")],Jt.prototype,"numVarSelectorRecords");var ii=Object.defineProperty,si=(i,t,e)=>t in i?ii(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(si(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const vn=class ce{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let a=0;a<r;a+=1)s[a]=e.get(n[a])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const a=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let h=0;h<c.length;h+=1){const l=c[h];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*a),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ce(this.tableViews)}delete(t){const e=ce.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ce.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ce.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(vn,"tableDefinitions",new Map);let te=vn;class Z extends yt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var bn=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ai=(i,t,e)=>t in i?bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bn(t,e,r),r},hi=(i,t,e)=>(ai(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),hi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Fe.from(t),r=Ue.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),a=o+n.view.byteLength,c=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=h.length,l.view.seek(4),h.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,a),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new Ue(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Fe(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new It(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var a,c,h,l,u;const t=this._getSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,n=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:c.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:h.view,s=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:l.view,o=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([d("uint16")],f.Cmap.prototype,"version",2),Ve([d("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ci=Object.defineProperty,li=(i,t,e)=>t in i?ci(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ui=(i,t,e)=>(li(i,t+"",e),e);class xn{constructor(t){ui(this,"pathCommands",[]);const e={...t};if(this.index=e.index||0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name||null,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const h=this.instructions=[];for(let m=0;m<c;++m)h.push(t.view.readUint8());const l=t.view.byteOffset,u=a[a.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const p=[];let y,g=0;for(;g<u;)if(y=t.view.readUint8(),p.push(y),g++,y&8&&g<u){const m=t.view.readUint8();for(let w=0;w<m;w++)p.push(y),g++}if(jt(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let w;if(u>0){for(let v=0;v<u;v+=1)y=p[v],w={},w.onCurve=!!(y&1),w.lastPointOfContour=a.includes(v),m.push(w);let x=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.x=this._parseGlyphCoordinate(t,y,x,2,16),x=w.x;let _=0;for(let v=0;v<u;v+=1)y=p[v],w=m[v],w.y=this._parseGlyphCoordinate(t,y,_,4,32),_=w.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,c=!0;for(;c;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),c=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const c=this.components[a],h=n.get(c.glyphIndex);if(h.getPathCommands(),h.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(h.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let p=h.points[c.matchedPoints[1]];const y={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};p=this._transformPoints([p],y)[0],y.dx=u.x-p.x,y.dy=u.y-p.y,l=this._transformPoints(h.points,y)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let a=0,c=o.length;a<c;++a){const h=o[a];let l=h[h.length-1],u=h[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let p=0,y=h.length;p<y;++p)if(l=u,u=h[(p+1)%y],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let g=u;u.onCurve||(g={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:g.x,y:g.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:a=o,yScale:c=o}=r,h=this.pathCommands,l=[];for(let u=0,p=h.length;u<p;u+=1){const y=h[u];y.type==="M"?l.push({type:"M",x:t+y.x*a,y:e+-y.y*c}):y.type==="L"?l.push({type:"L",x:t+y.x*a,y:e+-y.y*c}):y.type==="Q"?l.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*c,x:t+y.x*a,y:e+-y.y*c}):y.type==="Z"&&l.push({type:"Z"})}return l}}var fi=Object.defineProperty,pi=(i,t,e)=>t in i?fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,di=(i,t,e)=>(pi(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,di(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new xn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],a=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),a!==r[t+1]&&n._parse(this._sfnt.glyf,a,this),this._items[t]=n}return n}}var Pn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mi=(i,t,e,n)=>{for(var r=n>1?void 0:n?gi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},wi=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),wi(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=mi([j("glyf")],f.Glyf);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,xi=(i,t,e,n)=>{for(var r=n>1?void 0:n?bi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&vi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=xi([j("GPOS","gpos")],f.Gpos);var _i=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Dt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Gsub=class extends Z{},Dt([d("uint16")],f.Gsub.prototype,"majorVersion",2),Dt([d("uint16")],f.Gsub.prototype,"minorVersion",2),Dt([d("uint16")],f.Gsub.prototype,"scriptListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"featureListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"lookupListOffset",2),Dt([d("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Dt([j("GSUB","gsub")],f.Gsub);var Si=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Si(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([d("fixed")],f.Head.prototype,"version",2),G([d("fixed")],f.Head.prototype,"fontRevision",2),G([d("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([d("uint32")],f.Head.prototype,"magickNumber",2),G([d("uint16")],f.Head.prototype,"flags",2),G([d("uint16")],f.Head.prototype,"unitsPerEm",2),G([d({type:"longDateTime"})],f.Head.prototype,"created",2),G([d({type:"longDateTime"})],f.Head.prototype,"modified",2),G([d("int16")],f.Head.prototype,"xMin",2),G([d("int16")],f.Head.prototype,"yMin",2),G([d("int16")],f.Head.prototype,"xMax",2),G([d("int16")],f.Head.prototype,"yMax",2),G([d("uint16")],f.Head.prototype,"macStyle",2),G([d("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([d("int16")],f.Head.prototype,"fontDirectionHint",2),G([d("int16")],f.Head.prototype,"indexToLocFormat",2),G([d("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Ci=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ti(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Ci(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([d("fixed")],f.Hhea.prototype,"version",2),J([d("int16")],f.Hhea.prototype,"ascent",2),J([d("int16")],f.Hhea.prototype,"descent",2),J([d("int16")],f.Hhea.prototype,"lineGap",2),J([d("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([d("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([d("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([d("int16")],f.Hhea.prototype,"xMaxExtent",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([d("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([d("int16")],f.Hhea.prototype,"caretOffset",2),J([d({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([d("int16")],f.Hhea.prototype,"metricDataFormat",2),J([d("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Sn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ai=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$i=(i,t,e,n)=>{for(var r=n>1?void 0:n?Oi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Ii=(i,t,e)=>(Ai(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Ii(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=$i([j("hmtx")],f.Hmtx);var Di=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Ui=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ei(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Di(t,e,r),r};f.Kern=class extends Z{},f.Kern=Ui([j("kern","kern")],f.Kern);var Mn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Bi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},Ni=(i,t,e)=>(Bi(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Ni(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Fi([j("loca")],f.Loca);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([d("fixed")],f.Maxp.prototype,"version",2),Y([d("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([d("uint16")],f.Maxp.prototype,"maxPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxContours",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([d("uint16")],f.Maxp.prototype,"maxZones",2),Y([d("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([d("uint16")],f.Maxp.prototype,"maxStorage",2),Y([d("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([d("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([d("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([d("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Vi=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,me=(i,t,e,n)=>{for(var r=n>1?void 0:n?ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Vi(t,e,r),r};const Cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},ke={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Hi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Tn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let c=0;c<t;++c){const h=e[c];h.name=this.view.readBytes(n+h.offset,h.length)}let r=ke.Macintosh,s=Hi.Default,o=0;e.some(c=>c.platform===ke.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=ke.Microsoft,s=Tn.UCS2,o=1033);const a={};for(let c=0;c<t;++c){const h=e[c];h.platform===r&&h.encoding===s&&h.language===o&&Cn[h.nameId]&&(a[Cn[h.nameId]]=o===0?Hr(h.name):zr(h.name))}return a}},me([d("uint16")],f.Name.prototype,"format",2),me([d("uint16")],f.Name.prototype,"count",2),me([d("uint16")],f.Name.prototype,"stringOffset",2),f.Name=me([j("name")],f.Name);var zi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,M=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&zi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},M([d("uint16")],f.Os2.prototype,"version",2),M([d("int16")],f.Os2.prototype,"xAvgCharWidth",2),M([d("uint16")],f.Os2.prototype,"usWeightClass",2),M([d("uint16")],f.Os2.prototype,"usWidthClass",2),M([d("uint16")],f.Os2.prototype,"fsType",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),M([d("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutSize",2),M([d("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),M([d("uint16")],f.Os2.prototype,"sFamilyClass",2),M([d({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),M([d({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bWeight",2),M([d({type:"uint8"})],f.Os2.prototype,"bProportion",2),M([d({type:"uint8"})],f.Os2.prototype,"bContrast",2),M([d({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),M([d({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),M([d({type:"uint8"})],f.Os2.prototype,"bLetterform",2),M([d({type:"uint8"})],f.Os2.prototype,"bMidline",2),M([d({type:"uint8"})],f.Os2.prototype,"bXHeight",2),M([d({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),M([d({type:"char",size:4})],f.Os2.prototype,"achVendID",2),M([d("uint16")],f.Os2.prototype,"fsSelection",2),M([d("uint16")],f.Os2.prototype,"usFirstCharIndex",2),M([d("uint16")],f.Os2.prototype,"usLastCharIndex",2),M([d("int16")],f.Os2.prototype,"sTypoAscender",2),M([d("int16")],f.Os2.prototype,"sTypoDescender",2),M([d("int16")],f.Os2.prototype,"sTypoLineGap",2),M([d("uint16")],f.Os2.prototype,"usWinAscent",2),M([d("uint16")],f.Os2.prototype,"usWinDescent",2),M([d({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),M([d({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),M([d("int16")],f.Os2.prototype,"sCapHeight",2),M([d("uint16")],f.Os2.prototype,"usDefaultChar",2),M([d("uint16")],f.Os2.prototype,"usBreakChar",2),M([d("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=M([j("OS/2","os2")],f.Os2);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([d("fixed")],f.Post.prototype,"format",2),mt([d("fixed")],f.Post.prototype,"italicAngle",2),mt([d("int16")],f.Post.prototype,"underlinePosition",2),mt([d("int16")],f.Post.prototype,"underlineThickness",2),mt([d("uint32")],f.Post.prototype,"isFixedPitch",2),mt([d("uint32")],f.Post.prototype,"minMemType42",2),mt([d("uint32")],f.Post.prototype,"maxMemType42",2),mt([d("uint32")],f.Post.prototype,"minMemType1",2),mt([d("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var ji=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Yi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ji(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([d("fixed")],f.Vhea.prototype,"version",2),tt([d("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([d("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([d("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([d("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([d("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([d("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([d("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([d("int16")],f.Vhea.prototype,"caretOffset",2),tt([d({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([d("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([d("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Qi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ki(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Ji=(i,t,e)=>(Qi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Ji(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Zi([j("vmtx")],f.Vmtx);var An=Object.defineProperty,ts=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},He=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const Et=class Pe extends de{constructor(){super(...arguments),He(this,"mimeType","font/ttf"),He(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,p)=>u+e(p.byteLength),0),s=new Pe(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let a=12+n*16,c=0;const h=s.getDirectories();t.tableViews.forEach((u,p)=>{const y=h[c++];y.tag=p,y.checkSum=Pe.checksum(u),y.offset=a,y.length=u.byteLength,s.view.writeBytes(u,a),a+=e(y.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Pe.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ft(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};He(Et,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([d("uint32")],Et.prototype,"scalerType"),ee([d("uint16")],Et.prototype,"numTables"),ee([d("uint16")],Et.prototype,"searchRange"),ee([d("uint16")],Et.prototype,"entrySelector"),ee([d("uint16")],Et.prototype,"rangeShift");let _t=Et;var es=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&es(t,e,r),r};class Ut extends yt{constructor(t,e){super(t,e,20)}}ne([d({type:"char",size:4})],Ut.prototype,"tag"),ne([d("uint32")],Ut.prototype,"offset"),ne([d("uint32")],Ut.prototype,"compLength"),ne([d("uint32")],Ut.prototype,"origLength"),ne([d("uint32")],Ut.prototype,"origChecksum");var $n=Object.defineProperty,ns=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ze=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends de{constructor(){super(...arguments),ze(this,"mimeType","font/woff"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let a=n-r*4;if(a){let c=r*4;for(;a>0;)s+=e.getUint8(c)<<a*8,c++,a--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,p)=>{const y=At(Ir(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:p,view:y.byteLength<u.byteLength?y:u,rawView:u})});const s=r.length,o=r.reduce((u,p)=>u+n(p.view.byteLength),0),a=new en(new ArrayBuffer(44+20*s+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=s,a.totalSfntSize=12+16*s+r.reduce((u,p)=>u+n(p.rawView.byteLength),0);let c=44+s*20,h=0;const l=a.getDirectories();return r.forEach(u=>{const p=l[h++];p.tag=u.tag,p.offset=c,p.compLength=u.view.byteLength,p.origChecksum=en.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,c),c+=n(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ut(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,a=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView(Dr(new Uint8Array(this.view.buffer.slice(r,a))).buffer),t},{}))}};ze(et,"FLAGS",new Set([2001684038])),st([d("uint32")],et.prototype,"signature"),st([d("uint32")],et.prototype,"flavor"),st([d("uint32")],et.prototype,"length"),st([d("uint16")],et.prototype,"numTables"),st([d("uint16")],et.prototype,"reserved"),st([d("uint32")],et.prototype,"totalSfntSize"),st([d("uint16")],et.prototype,"majorVersion"),st([d("uint16")],et.prototype,"minorVersion"),st([d("uint32")],et.prototype,"metaOffset"),st([d("uint32")],et.prototype,"metaLength"),st([d("uint32")],et.prototype,"metaOrigLength"),st([d("uint32")],et.prototype,"privOffset"),st([d("uint32")],et.prototype,"privLength");let Pt=et;var rs=Object.defineProperty,is=(i,t,e)=>t in i?rs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(is(i,typeof t!="symbol"?t+"":t,e),e);const In=class mr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...mr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${t}";
|
|
3
3
|
src: url(${e});
|
|
4
|
-
}`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(St.is(t))return new St(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:a,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let h=this._loading.get(c);return h||(h=this._createRequest(c,o),this._loading.set(c,h)),n&&this._loading.forEach((l,u)=>{l!==h&&(l.cancel(),this._loading.delete(u))}),h.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,c),typeof document<"u"&&(r&&this.injectFontFace(p,l),s&&this.injectStyleTag(p,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(Dn,"defaultRequestInit",{cache:"force-cache"});let In=Dn;const En=new In;function Un(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,a=e.unicodeGlyphIndexMap,c=n.locations,h=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&a.has(m)))).sort((m,w)=>m-w),p=new Map;u.forEach(m=>{const w=a.get(m)??0;let x=p.get(w);x||p.set(w,x=new Set),x.add(m)});const y=[],g=m=>{const w=h[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=c[m],v=c[m+1]??_,C={...w,...x,rawGlyphIndex:m,glyphIndex:y.length,unicodes:Array.from(p.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,v-_)};return y.push(C),C};return g(0),u.forEach(m=>g(a.get(m))),y.slice().forEach(m=>{const{view:w}=m;if(!w.byteLength||w.getInt16(0)>=0)return;let _=10,v;do{v=w.getUint16(_);const C=_+2,T=w.getUint16(C);_+=4,Gt.ARG_1_AND_2_ARE_WORDS&v?_+=4:_+=2,Gt.WE_HAVE_A_SCALE&v?_+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&v?_+=4:Gt.WE_HAVE_A_TWO_BY_TWO&v&&(_+=8);const O=g(T);w.setUint16(C,O.glyphIndex)}while(Gt.MORE_COMPONENTS&v)}),y}function Ln(i,t){const e=Un(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:a}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(p=>{const y=c;return c+=p.view.byteLength,y}),c],r.indexToLocFormat);const h=e.reduce((p,y,g)=>(y.unicodes.forEach(m=>p.set(m,g)),p),new Map);i.cmap=f.Cmap.from(h),i.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ss(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof St)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(St.is(s))e=new St(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Ln(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return St.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return St.from(r).view.buffer}}const os={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function as(i,t){const{fill:e="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:c,strokeDashoffset:h=0,shadowOffsetX:l=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=n,i.lineWidth=r,i.lineCap=s,i.lineJoin=os[o],i.miterLimit=a,c&&i.setLineDash(c),i.lineDashOffset=h,i.shadowOffsetX=l,i.shadowOffsetY=u,i.shadowBlur=p,i.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class E{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new E(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new E(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var hs=Object.defineProperty,cs=(i,t,e)=>t in i?hs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ls=(i,t,e)=>(cs(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,a=0,c=0,h=1){ls(this,"elements",[]),this.set(t,e,n,r,s,o,a,c,h)}set(t,e,n,r,s,o,a,c,h){const l=this.elements;return l[0]=t,l[1]=r,l[2]=a,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],c=n[6],h=n[1],l=n[4],u=n[7],p=n[2],y=n[5],g=n[8],m=r[0],w=r[3],x=r[6],_=r[1],v=r[4],C=r[7],T=r[2],O=r[5],A=r[8];return s[0]=o*m+a*_+c*T,s[3]=o*w+a*v+c*O,s[6]=o*x+a*C+c*A,s[1]=h*m+l*_+u*T,s[4]=h*w+l*v+u*O,s[7]=h*x+l*C+u*A,s[2]=p*m+y*_+g*T,s[5]=p*w+y*v+g*O,s[8]=p*x+y*C+g*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],c=t[6],h=t[7],l=t[8],u=l*o-a*h,p=a*c-l*s,y=h*s-o*c,g=e*u+n*p+r*y;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(r*h-l*n)*m,t[2]=(a*n-r*o)*m,t[3]=p*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-a*e)*m,t[6]=y*m,t[7]=(n*c-h*e)*m,t[8]=(o*e-n*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Bn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function us(i,t,e,n,r,s,o,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-a.x)/2,h=(o.y-a.y)/2,l=Math.cos(n)*c+Math.sin(n)*h,u=-Math.sin(n)*c+Math.cos(n)*h;let p=t*t,y=e*e;const g=l*l,m=u*u,w=g/p+m/y;if(w>1){const U=Math.sqrt(w);t=U*t,e=U*e,p=t*t,y=e*e}const x=p*m+y*g,_=(p*y-x)/x;let v=Math.sqrt(Math.max(0,_));r===s&&(v=-v);const C=v*t*u/e,T=-v*e*l/t,O=Math.cos(n)*C-Math.sin(n)*T+(o.x+a.x)/2,A=Math.sin(n)*C+Math.cos(n)*T+(o.y+a.y)/2,S=Bn(1,0,(l-C)/t,(u-T)/e),P=Bn((l-C)/t,(u-T)/e,(-l-C)/t,(-u-T)/e)%(Math.PI*2);i.ellipse(O,A,t,e,n,S,S+P,s===1)}function Rt(i,t){return i-(t-i)}function Fn(i,t){const e=new b,n=new b;for(let r=0,s=i.length;r<s;r++){const o=i[r];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),n.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),n.x=e.x+o.x1,n.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),n.x=o.x1,n.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Rt(e.x,n.x),c=Rt(e.y,n.y);n.x=a,n.y=c,o.type==="t"?(t.quadraticCurveTo(a,c,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,c,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}n.copy(e),us(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function wt(i,t,e=0){let a=0,c=!0,h="",l="";const u=[];function p(w,x,_){const v=new SyntaxError(`Unexpected character "${w}" at index ${x}.`);throw v.partial=_,v}function y(){h!==""&&(l===""?u.push(Number(h)):u.push(Number(h)*10**Number(l))),h="",l=""}let g;const m=i.length;for(let w=0;w<m;w++){if(g=i[w],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(g)){a=1,h=g,y();continue}if(a===0){if(F.WHITESPACE.test(g))continue;if(F.DIGIT.test(g)||F.SIGN.test(g)){a=1,h=g;continue}if(F.POINT.test(g)){a=2,h=g;continue}F.COMMA.test(g)&&(c&&p(g,w,u),c=!0)}if(a===1){if(F.DIGIT.test(g)){h+=g;continue}if(F.POINT.test(g)){h+=g,a=2;continue}if(F.EXP.test(g)){a=3;continue}F.SIGN.test(g)&&h.length===1&&F.SIGN.test(h[0])&&p(g,w,u)}if(a===2){if(F.DIGIT.test(g)){h+=g;continue}if(F.EXP.test(g)){a=3;continue}F.POINT.test(g)&&h[h.length-1]==="."&&p(g,w,u)}if(a===3){if(F.DIGIT.test(g)){l+=g;continue}if(F.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&F.SIGN.test(l)&&p(g,w,u)}}F.WHITESPACE.test(g)?(y(),a=0,c=!1):F.COMMA.test(g)?(y(),a=0,c=!0):F.SIGN.test(g)?(y(),a=1,h=g):F.POINT.test(g)?(y(),a=2,h=g):p(g,w,u)}return y(),u}function fs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ps(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${fs(i[e])} `;return t}const ds=/[a-df-z][^a-df-z]*/gi;function Nn(i){const t=[],e=i.match(ds);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),a=s.slice(1).trim();let c;switch(o){case"m":case"M":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)h===0?t.push({type:o,x:c[h],y:c[h+1]}):t.push({type:o==="m"?"l":"L",x:c[h],y:c[h+1]});break;case"h":case"H":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,x:c[h]});break;case"v":case"V":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,y:c[h]});break;case"l":case"L":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"c":case"C":c=wt(a);for(let h=0,l=c.length;h<l;h+=6)t.push({type:o,x1:c[h],y1:c[h+1],x2:c[h+2],y2:c[h+3],x:c[h+4],y:c[h+5]});break;case"s":case"S":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x2:c[h],y2:c[h+1],x:c[h+2],y:c[h+3]});break;case"q":case"Q":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x1:c[h],y1:c[h+1],x:c[h+2],y:c[h+3]});break;case"t":case"T":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"a":case"A":c=wt(a,[3,4],7);for(let h=0,l=c.length;h<l;h+=7)t.push({type:o,rx:c[h],ry:c[h+1],angle:c[h+2],largeArcFlag:c[h+3],sweepFlag:c[h+4],x:c[h+5],y:c[h+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var gs=Object.defineProperty,ys=(i,t,e)=>t in i?gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Lt{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new b){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let a=0,c=s-1,h;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),h=n[r]-o,h<0)a=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],p=n[r+1]-l,y=(o-l)/p;return(r+y)/(s-1)}getTangent(t,e=new b){const r=Math.max(0,t-1e-4),s=Math.min(1,t+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(r)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getDivisions(t){return t}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return ps(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Gn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,a=i*i,c=i*a;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*a+s*i+e}function ms(i,t){const e=1-i;return e*e*t}function ws(i,t){return 2*(1-i)*i*t}function vs(i,t){return i*i*t}function Rn(i,t,e,n){return ms(i,t)+ws(i,e)+vs(i,n)}function bs(i,t){const e=1-i;return e*e*e*t}function xs(i,t){const e=1-i;return 3*e*e*i*t}function _s(i,t){return 3*(1-i)*i*i*t}function Ss(i,t){return i*i*i*t}function Vn(i,t,e,n,r){return bs(i,t)+xs(i,e)+_s(i,n)+Ss(i,r)}class Ps extends Lt{constructor(t=new b,e=new b,n=new b,r=new b){super(),this.start=t,this.startControl=e,this.endControl=n,this.end=r}getPoint(t,e=new b){const{start:n,startControl:r,endControl:s,end:o}=this;return e.set(Vn(t,n.x,r.x,s.x,o.x),Vn(t,n.y,r.y,s.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,startControl:r,endControl:s,end:o}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,o.x),t.y=Math.min(t.y,n.y,r.y,s.y,o.y),e.x=Math.max(e.x,n.x,r.x,s.x,o.x),e.y=Math.max(e.y,n.y,r.y,s.y,o.y),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:n,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{startControl:e,endControl:n,end:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Ms=new ct,kn=new ct,Hn=new ct,we=new b;class Cs extends Lt{constructor(t=new b,e=1,n=1,r=0,s=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=n,this.rotation=r,this.startAngle=s,this.endAngle=o,this.clockwise=a}getPoint(t,e=new b){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let a=this.center.x+this.radiusX*Math.cos(o),c=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const h=Math.cos(this.rotation),l=Math.sin(this.rotation),u=a-this.center.x,p=c-this.center.y;a=u*h-p*l+this.center.x,c=u*l+p*h+this.center.y}return e.set(a,c)}getDivisions(t=12){return t*2}getCommands(){const{center:t,radiusX:e,radiusY:n,startAngle:r,endAngle:s,clockwise:o,rotation:a}=this,{x:c,y:h}=t,l=c+e*Math.cos(r)*Math.cos(a)-n*Math.sin(r)*Math.sin(a),u=h+e*Math.cos(r)*Math.sin(a)+n*Math.sin(r)*Math.cos(a),p=Math.abs(r-s),y=p>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(p>=2*Math.PI){const w=r+Math.PI,x=c+e*Math.cos(w)*Math.cos(a)-n*Math.sin(w)*Math.sin(a),_=h+e*Math.cos(w)*Math.sin(a)+n*Math.sin(w)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x,y:_},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x:l,y:u}]}else{const w=c+e*Math.cos(s)*Math.cos(a)-n*Math.sin(s)*Math.sin(a),x=h+e*Math.cos(s)*Math.sin(a)+n*Math.sin(s)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:y,sweepFlag:g,x:w,y:x}]}}drawTo(t){const{center:e,radiusX:n,radiusY:r,rotation:s,startAngle:o,endAngle:a,clockwise:c}=this;return t.ellipse(e.x,e.y,n,r,s,o,a,!c),this}transform(t){return we.set(this.center.x,this.center.y),we.applyMatrix3(t),this.center.x=we.x,this.center.y=we.y,As(t)?Ts(this,t):Os(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=b.MAX,e=b.MIN){const{center:n,radiusX:r,radiusY:s,rotation:o}=this,{x:a,y:c}=n,h=Math.cos(o),l=Math.sin(o),u=Math.sqrt(r*r*h*h+s*s*l*l),p=Math.sqrt(r*r*l*l+s*s*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,c-p),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,c+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Ts(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new b(e*r,e*s),a=new b(-n*s,n*r),c=o.applyMatrix3(t),h=a.applyMatrix3(t),l=Ms.set(c.x,h.x,0,c.y,h.y,0,0,0,1),u=kn.copy(l).invert(),g=Hn.copy(u).transpose().multiply(u).elements,m=$s(g[0],g[1],g[4]),w=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/w,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=kn.set(w,0,0,0,x,0,0,0,1),C=Hn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=v.multiply(C).multiply(l),O=A=>{const{x:S,y:P}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(T);return Math.atan2(P,S)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),zn(t)&&(i.clockwise=!i.clockwise)}}function Os(i,t){const e=Wn(t),n=Xn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,zn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function zn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function As(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=Wn(i),r=Xn(i);return Math.abs(e/(n*r))>Number.EPSILON}function Wn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Xn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function $s(i,t,e){let n,r,s,o,a;const c=i+e,h=i-e,l=Math.sqrt(h*h+4*t*t);return c>0?(n=.5*(c+l),a=1/n,r=i*a*e-t*a*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),h>0?s=h+l:s=h-l,Math.abs(s)>2*Math.abs(t)?(a=-2*t/s,o=1/Math.sqrt(1+a*a),s=a*o):Math.abs(t)===0?(s=1,o=0):(a=-.5*s/t,s=1/Math.sqrt(1+a*a),o=a*s),h>0&&(a=s,s=-o,o=a),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Lt{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getNormal(t,e=new b){const{x:n,y:r}=this.getPoint(t).sub(this.start);return e.set(r,-n).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getDivisions(){return 1}getMinMax(t=b.MAX,e=b.MIN){const{start:n,end:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Ds extends Lt{constructor(t=new b,e=new b,n=new b){super(),this.start=t,this.control=e,this.end=n}getPoint(t,e=new b){const{start:n,control:r,end:s}=this;return e.set(Rn(t,n.x,r.x,s.x),Rn(t,n.y,r.y,s.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,control:r,end:s}=this,o=.5*(n.x+r.x),a=.5*(n.y+r.y),c=.5*(n.x+s.x),h=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,a,h),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,a,h),{min:t,max:e}}getCommands(){const{start:t,control:e,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{control:e,end:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Is=Object.defineProperty,Es=(i,t,e)=>t in i?Is(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qn=(i,t,e)=>(Es(i,typeof t!="symbol"?t+"":t,e),e);class Us extends Lt{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,qn(this,"curves",[]),qn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,n=this.rx,r=this.rx/this.aspectRatio,s=[new b(t-n,e-r),new b(t+n,e-r),new b(t+n,e+r),new b(t-n,e+r)];for(let o=0;o<4;o++)this.curves.push(new qe(s[o].clone(),s[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Ls extends Lt{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new b){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,a=n[s===0?s:s-1],c=n[s],h=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Gn(o,a.x,c.x,h.x,l.x),Gn(o,a.y,c.y,h.y,l.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Bs=Object.defineProperty,Fs=(i,t,e)=>t in i?Bs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ie=(i,t,e)=>(Fs(i,typeof t!="symbol"?t+"":t,e),e);class se extends Lt{constructor(t){super(),ie(this,"curves",[]),ie(this,"startPoint"),ie(this,"currentPoint",new b),ie(this,"autoClose",!1),ie(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++){const{x:r,y:s}=t[e];this.lineTo(r,s)}return this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}getPoint(t,e=new b){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],c=a.getLength();return a.getPointAt(c===0?0:1-o/c,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.getPoints(o.getDivisions(t));for(let c=0;c<a.length;c++){const h=a[c];n!=null&&n.equals(h)||(e.push(h),n=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new qe(e,t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.curves.push(new qe(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,n,r,s,o){return this.curves.push(new Ps(this.currentPoint.clone(),new b(t,e),new b(n,r),new b(s,o))),this._setCurrentPoint({x:s,y:o}),this}quadraticCurveTo(t,e,n,r){return this.curves.push(new Ds(this.currentPoint.clone(),new b(t,e),new b(n,r))),this._setCurrentPoint({x:n,y:r}),this}arc(t,e,n,r,s,o){return this.ellipse(t,e,n,n,0,r,s,o),this}relativeArc(t,e,n,r,s,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,n,r,s,o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,a,c=!0){const h=new Cs(new b(t,e),n,r,s,o,a,!c);if(this.curves.length>0){const l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,n,r,s,o,a,c){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,n,r,s,o,a,c),this}rect(t,e,n,r){return this.curves.push(new Us(new b(t+n/2,e+r/2),n/2,n/r)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Ls([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Ns(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Gs=Object.defineProperty,Rs=(i,t,e)=>t in i?Gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Rs(i,typeof t!="symbol"?t+"":t,e),e);class lt{constructor(t){je(this,"currentPath",new se),je(this,"paths",[this.currentPath]),je(this,"style",{}),t&&(t instanceof lt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof lt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new se().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return n.equals({x:t,y:e})||(r.length?(this.currentPath=new se().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.arc(t,e,n,r,s,o),this}arcTo(t,e,n,r,s){return this.currentPath.arcTo(t,e,n,r,s),this}ellipse(t,e,n,r,s,o,a,c){return this.currentPath.ellipse(t,e,n,r,s,o,a,c),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN,n=!0){if(this.forEachCurve(r=>r.getMinMax(t,e)),n){const r=this.strokeWidth/2;t.x-=r,t.y-=r,e.x+=r,e.y+=r}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:n}=this.getMinMax(void 0,void 0,t);return new E(e.x,e.y,n.x-e.x,n.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const r in t)t[r]!==void 0&&(e[Ns(r)]=t[r]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let n="";for(const r in e)e[r]!==void 0&&(n+=`${r}:${e[r]};`);return`<path d="${this.getData()}" style="${n}"></path>`}getSvgXml(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:n="#000",stroke:r="none"}=this.style;e&&as(t,this.style),this.paths.forEach(s=>{s.drawTo(t)}),n!=="none"&&t.fill(),r!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:n,width:r,height:s}=this.getBoundingBox(),o=document.createElement("canvas");o.width=r*t,o.height=s*t,o.style.width=`${r}px`,o.style.height=`${s}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-n),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const Ye="px",jn=90,Yn=["mm","cm","in","pt","pc","px"],Ke={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 $(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Yn.length;n<r;n++){const s=Yn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/jn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*jn)),e*Number.parseFloat(i)}const Vs=new ct,ve=new ct,Kn=new ct,Qn=new ct;function ks(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Hs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Hs(i){const t=new ct,e=Vs;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate($(i.getAttribute("x")),$(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),a=s.length;if(o>0&&o<a){const c=s.slice(0,o),h=wt(s.slice(o+1));switch(e.identity(),c){case"translate":if(h.length>=1){const l=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(l,u)}break;case"rotate":if(h.length>=1){let l=0,u=0,p=0;l=h[0]*Math.PI/180,h.length>=3&&(u=h[1],p=h[2]),ve.makeTranslation(-u,-p),Kn.makeRotation(l),Qn.multiplyMatrices(Kn,ve),ve.makeTranslation(u,p),e.multiplyMatrices(ve,Qn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function zs(i){return new lt().addPath(new se().arc($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("r")||0),0,Math.PI*2))}function Ws(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,a])=>a!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function Xs(i){return new lt().addPath(new se().ellipse($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("rx")||0),$(i.getAttribute("ry")||0),0,0,Math.PI*2))}function qs(i){return new lt().moveTo($(i.getAttribute("x1")||0),$(i.getAttribute("y1")||0)).lineTo($(i.getAttribute("x2")||0),$(i.getAttribute("y2")||0))}function js(i){const t=new lt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Ys=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ks(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Ys,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!0,t}const Qs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zs(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Qs,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!1,t}function Js(i){const t=$(i.getAttribute("x")||0),e=$(i.getAttribute("y")||0),n=$(i.getAttribute("rx")||i.getAttribute("ry")||0),r=$(i.getAttribute("ry")||i.getAttribute("rx")||0),s=$(i.getAttribute("width")),o=$(i.getAttribute("height")),a=1-.551915024494,c=new lt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*a,e,t+s,e+r*a,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*a,t+s-n*a,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*a,e+o,t,e+o-r*a,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*a,t+n*a,e,t+n,e),c}function vt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,l){l===void 0&&(l=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),i.hasAttribute(c)&&(t[h]=l(i.getAttribute(c))),n[c]&&(t[h]=l(n[c])),i.style&&i.style[c]!==""&&(t[h]=l(i.style[c]))}function s(c){return Math.max(0,Math.min(1,$(c)))}function o(c){return Math.max(0,$(c))}function a(c){return c.split(" ").filter(h=>h!=="").map(h=>$(h))}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",o),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",o),r("stroke-dasharray","strokeDasharray",a),r("stroke-dashoffset","strokeDashoffset",$),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=vt(i,t,s);break;case"style":Ws(i,s);break;case"g":t=vt(i,t,s);break;case"path":t=vt(i,t,s),i.hasAttribute("d")&&(r=js(i));break;case"rect":t=vt(i,t,s),r=Js(i);break;case"polygon":t=vt(i,t,s),r=Ks(i);break;case"polyline":t=vt(i,t,s),r=Zs(i);break;case"circle":t=vt(i,t,s),r=zs(i);break;case"ellipse":t=vt(i,t,s),r=Xs(i);break;case"line":t=vt(i,t,s),r=qs(i);break;case"defs":n=!0;break;case"use":{t=vt(i,t,s);const p=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),y=(l=i.viewportElement)==null?void 0:l.getElementById(p);y?Qe(y,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(i);break}const o=new ct,a=[],c=ks(i,o,a);r&&(r.transform(o),e.push(r),r.style=t);const h=i.childNodes;for(let u=0,p=h.length;u<p;u++){const y=h[u];n&&y.nodeName!=="style"&&y.nodeName!=="defs"||Qe(y,t,e)}return c&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Zn="data:image/svg+xml;",Jn=`${Zn}base64,`,tr=`${Zn}charset=utf8,`;function er(i){if(typeof i=="string"){let t;return i.startsWith(Jn)?(i=i.substring(Jn.length,i.length),t=atob(i)):i.startsWith(tr)?(i=i.substring(tr.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function to(i){return Qe(er(i),{})}function be(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function nr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function rr(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function ir(i,t,e=0,n=0,r=0,s=1,o=1){let a=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:h,y:l}=t;return(s!==1||o!==1)&&(a=a.map(u=>rr(u,t,s,o))),(n||r)&&(a=a.map(u=>Ze(u,t,n,r))),a=a.map(u=>{const p=u.x-h,y=-(u.y-l);return u=nr({x:p,y},c),{x:h+u.x,y:l-u.y}}),a[0]}const eo=new Set(["©","®","÷"]),no=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class sr{constructor(t,e,n){D(this,"boundingBox",new E);D(this,"textWidth",0);D(this,"textHeight",0);D(this,"path",new lt);this.content=t,this.index=e,this.parent=n}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=En.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof St||t instanceof _t)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:n,descender:r,os2:s,post:o}=t,{content:a,computedStyle:c,boundingBox:h,isVertical:l}=this,{left:u,top:p,height:y}=h,{fontSize:g}=c,m=e/g,w=t.getAdvanceWidth(a,g),x=(n+Math.abs(r))/m,_=n/m,v=(n-s.yStrikeoutPosition)/m,C=s.yStrikeoutSize/m,T=(n-o.underlinePosition)/m,O=o.underlineThickness/m;return this.glyphWidth=w,this.glyphHeight=x,this.underlinePosition=T,this.underlineThickness=O,this.yStrikeoutPosition=v,this.yStrikeoutSize=C,this.baseline=_,this.centerDiviation=.5*y-_,this.glyphBox=l?new E(u,p,x,w):new E(u,p,w,x),this.centerPoint=this.glyphBox.getCenterPoint(),this.fontMinGlyphWidth=t.getAdvanceWidth("i",g),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:a,baseline:c,glyphHeight:h,glyphWidth:l}=this.updateGlyph(t),{os2:u,ascender:p,descender:y}=t,g=p,m=y,w=u.sTypoAscender,{left:x,top:_}=o,{fontSize:v,fontStyle:C}=a;let T=x,O=_+c,A,S;if(e&&(T+=(h-l)/2,Math.abs(r-s)>.1&&(O-=(g-w)/(g+Math.abs(m))*h),A=void 0),e&&!eo.has(n)&&(n.codePointAt(0)<=256||no.has(n))){S=t.getPathCommands(n,T,_+c-(h-l)/2,v)??[];const U={y:_-(h-l)/2+h/2,x:T+l/2};C==="italic"&&(S=this._italic(S,e?{x:U.x,y:_-(h-l)/2+c}:void 0)),S=this._rotation90(S,U)}else A!==void 0?(S=t.glyf.glyphs.get(A).getPathCommands(T,O,v),C==="italic"&&(S=this._italic(S,e?{x:T+l/2,y:_+w/(g+Math.abs(m))*h}:void 0))):(S=t.getPathCommands(n,T,O,v)??[],C==="italic"&&(S=this._italic(S,e?{x:T+h/2,y:O}:void 0)));S.push(...this._decoration());const P=new lt(S);return P.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*v*.03:0},this.path=P,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:a,width:c,height:h}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+c/2:u=a+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+h},{type:"L",x:u+l,y:a+h},{type:"L",x:u+l,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,a=e||{y:o+n,x:s+r/2};return this._transform(t,(c,h)=>{const l=Ze({x:c,y:h},a,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=ir({x:n,y:r},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Pe({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class or{constructor(t,e={},n){D(this,"boundingBox",new E);D(this,"highlight");this.content=t,this.style=e,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...be(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new sr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){D(this,"boundingBox",new E);D(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...be(this.parentStyle),...be(this.style)},this}addFragment(t,e){const n=new or(t,e,this);return this.fragments.push(n),n}}class Bt{constructor(t){this._text=t}}class ar extends Bt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class hr extends Bt{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*s,c=(o.offsetY??0)*s,h=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,p=r.boundingBox.clone();p.left+=a+h-u,p.top+=c+l-u,p.width+=u*2,p.height+=u*2,n.push(p)})}),E.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{dt(o,s,e)}),r.forEach(o=>{n.forEach(a=>{o.drawTo(e,a)})})),this}}class cr extends Bt{constructor(){super(...arguments);D(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new E;const e=b.MAX,n=b.MIN;return this.paths.forEach(r=>r.getMinMax(e,n)),new E(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e}=this._text;let n;const r=[];let s;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((s==null?void 0:s.url)===a.url&&n.length&&n[0].boundingBox.top===o.boundingBox.top&&n[0].fontSize===o.fontSize?n.push(o):(n=[],n.push(o),r.push(n))),s=a}),this.paths=r.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:E.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontMinGlyphWidth:o[0].fontMinGlyphWidth,fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const n=er(e),r=to(n),s=b.MAX,o=b.MIN;return r.forEach(a=>a.getMinMax(s,o)),{paths:r,box:new E(s.x,s.y,o.x-s.x,o.y-s.y),viewBox:new E(...n.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:n,box:r,baseline:s,fontSize:o,fontMinGlyphWidth:a}=e,{box:c,viewBox:h,paths:l}=this._parseSvg(n),u=[],p=c.height/h.height>.3?0:1;function y(g){const m=o*.03;g.style.strokeWidth&&(g.style.strokeWidth*=m),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=m),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=m),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(w=>w*m))}if(p===0){const g={x:r.left-o*.2,y:r.top},m=(r.width+o*.2*2)/c.width,w=r.height/c.height,x=new ct().translate(-c.x,-c.y).scale(m,w).translate(g.x,g.y);l.forEach(_=>{const v=_.clone().transform(x);y(v),u.push(v)})}else if(p===1){const g=a/c.width,m=c.width*g,w=Math.ceil(r.width/m),x=m*w,_={x:r.left+(r.width-x)/2,y:r.top+s+o*.1},v=new ct().translate(-c.x,-c.y).scale(g,g).translate(_.x,_.y);for(let C=0;C<w;C++){const T=v.clone().translate(C*m,0);l.forEach(O=>{const A=O.clone().transform(T);y(A),u.push(A)})}}return u}draw({ctx:e}){return Pe({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize}),this}}class lr extends Bt{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(c.style)),h.appendChild(document.createTextNode(c.content)),a.appendChild(h)}),s.appendChild(a)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const a=s.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll("span").forEach((c,h)=>{var p;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:h,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.firstChild;if(u instanceof window.Text){const y=document.createRange();y.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){y.setStart(u,Math.max(m-1,0)),y.setEnd(u,m);const w=((p=y.getClientRects)==null?void 0:p.call(y))??[y.getBoundingClientRect()];let x=w[w.length-1];w.length>1&&x.width<2&&(x=w[w.length-2]);const _=y.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const a=[[]];let c=a[0];const{characters:h}=this._measureDom(t);h.length>0&&(c.push(h[0]),h.reduce((y,g)=>{const m=s?"left":"top";return Math.abs(g[m]-y[m])>4e3/2&&(c=[],a.push(c)),c.push(g),g})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(y=>{const g=e[y.paragraphIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height}),l.fragments.forEach(y=>{const g=e[y.paragraphIndex].fragments[y.fragmentIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height});const u=[];let p=0;return a.forEach(y=>{y.forEach(g=>{const m=l.characters[p],{paragraphIndex:w,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:w,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const v=e[w].fragments[x].characters[_];v.boundingBox.left=u[p].left,v.boundingBox.top=u[p].top,v.boundingBox.width=u[p].width,v.boundingBox.height=u[p].height,v.textWidth=u[p].textWidth,v.textHeight=u[p].textHeight,p++})}),{paragraphs:e,boundingBox:new E(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class ur extends Bt{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:a,highlight:c,...h}=o;if(a!==void 0){const l=s.addFragment(a,h);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,a=new Vt(o,e);s.forEach(c=>{const{content:h,highlight:l,...u}=c;if(h!==void 0){const p=a.addFragment(h,u);p.highlight=l}}),n.push(a)}else if("content"in r){const{content:s,highlight:o,...a}=r;if(s!==void 0){const c=new Vt(a,e),h=c.addFragment(s);h.highlight=o,n.push(c)}}}return n}}class ro extends Bt{}class fr extends Bt{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:a,height:c}=r,h=e.canvas;return h.dataset.viewbox=`${s} ${o} ${a} ${c}`,h.dataset.pixelRatio=String(n),h.width=Math.max(1,Math.ceil(a*n)),h.height=Math.max(1,Math.ceil(c*n)),h.style.marginTop=`${o}px`,h.style.marginLeft=`${s}px`,h.style.width=`${a}px`,h.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:a}=s;return dt(r,new E(0,0,o,a),e),n.forEach(c=>{dt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(h=>{dt(h.computedStyle,h.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,a,c,h,l){e.fillStyle=o,e.fillRect(a,c,h,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var h;(h=c.style)!=null&&h.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class io{constructor(t={}){D(this,"content");D(this,"style");D(this,"effects");D(this,"deformation");D(this,"measureDom");D(this,"needsUpdate",!0);D(this,"computedStyle",{...Je});D(this,"paragraphs",[]);D(this,"boundingBox",new E);D(this,"renderBoundingBox",new E);D(this,"parser",new ur(this));D(this,"measurer",new lr(this));D(this,"deformer",new ar(this));D(this,"effector",new hr(this));D(this,"highlighter",new cr(this));D(this,"renderer2D",new fr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const n=this.measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const n=this.characters;n.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const r=b.MAX,s=b.MIN;return n.forEach(o=>o.getMinMax(r,s)),this.renderBoundingBox=new E(r.x,r.y,s.x-r.x,s.y-r.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=E.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=E.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:n,ctx:r}),this.renderer2D.uploadColors({ctx:r}),this.highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:r}):this.renderer2D.draw({ctx:r}),this):this}}f.Character=sr,f.CmapSubtableFormat0=Ue,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Fe,f.CmapSubtableFormat6=Dt,f.Deformer=ar,f.Effector=hr,f.Eot=Kr,f.Font=de,f.Fonts=In,f.Fragment=or,f.Glyph=xn,f.GlyphSet=_n,f.Highlighter=cr,f.Measurer=lr,f.Paragraph=Vt,f.Parser=ur,f.Reflector=ro,f.Renderer2D=fr,f.Sfnt=te,f.TableDirectory=Ft,f.Text=io,f.Ttf=_t,f.Woff=St,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Be,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPaths=Pe,f.filterEmpty=be,f.fonts=En,f.getPointPosition=ir,f.getRotationPoint=nr,f.getScalePoint=rr,f.getSkewPoint=Ze,f.minify=ss,f.minifyGlyphs=Un,f.minifySfnt=Ln,f.parseColor=H,f.uploadColor=dt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
}`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(Pt.is(t))return new Pt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:a,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let h=this._loading.get(c);return h||(h=this._createRequest(c,o),this._loading.set(c,h)),n&&this._loading.forEach((l,u)=>{l!==h&&(l.cancel(),this._loading.delete(u))}),h.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,c),typeof document<"u"&&(r&&this.injectFontFace(p,l),s&&this.injectStyleTag(p,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(In,"defaultRequestInit",{cache:"force-cache"});let Dn=In;const En=new Dn;function Un(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,a=e.unicodeGlyphIndexMap,c=n.locations,h=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&a.has(m)))).sort((m,w)=>m-w),p=new Map;u.forEach(m=>{const w=a.get(m)??0;let x=p.get(w);x||p.set(w,x=new Set),x.add(m)});const y=[],g=m=>{const w=h[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=c[m],v=c[m+1]??_,T={...w,...x,rawGlyphIndex:m,glyphIndex:y.length,unicodes:Array.from(p.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,v-_)};return y.push(T),T};return g(0),u.forEach(m=>g(a.get(m))),y.slice().forEach(m=>{const{view:w}=m;if(!w.byteLength||w.getInt16(0)>=0)return;let _=10,v;do{v=w.getUint16(_);const T=_+2,C=w.getUint16(T);_+=4,Gt.ARG_1_AND_2_ARE_WORDS&v?_+=4:_+=2,Gt.WE_HAVE_A_SCALE&v?_+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&v?_+=4:Gt.WE_HAVE_A_TWO_BY_TWO&v&&(_+=8);const O=g(C);w.setUint16(T,O.glyphIndex)}while(Gt.MORE_COMPONENTS&v)}),y}function Ln(i,t){const e=Un(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:a}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(p=>{const y=c;return c+=p.view.byteLength,y}),c],r.indexToLocFormat);const h=e.reduce((p,y,g)=>(y.unicodes.forEach(m=>p.set(m,g)),p),new Map);i.cmap=f.Cmap.from(h),i.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ss(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof Pt)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(Pt.is(s))e=new Pt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Ln(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return Pt.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return Pt.from(r).view.buffer}}const os={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function as(i,t){const{fill:e="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:c,strokeDashoffset:h=0,shadowOffsetX:l=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=n,i.lineWidth=r,i.lineCap=s,i.lineJoin=os[o],i.miterLimit=a,c&&i.setLineDash(c),i.lineDashOffset=h,i.shadowOffsetX=l,i.shadowOffsetY=u,i.shadowBlur=p,i.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class E{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new E(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new E(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var hs=Object.defineProperty,cs=(i,t,e)=>t in i?hs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ls=(i,t,e)=>(cs(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,a=0,c=0,h=1){ls(this,"elements",[]),this.set(t,e,n,r,s,o,a,c,h)}set(t,e,n,r,s,o,a,c,h){const l=this.elements;return l[0]=t,l[1]=r,l[2]=a,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],c=n[6],h=n[1],l=n[4],u=n[7],p=n[2],y=n[5],g=n[8],m=r[0],w=r[3],x=r[6],_=r[1],v=r[4],T=r[7],C=r[2],O=r[5],A=r[8];return s[0]=o*m+a*_+c*C,s[3]=o*w+a*v+c*O,s[6]=o*x+a*T+c*A,s[1]=h*m+l*_+u*C,s[4]=h*w+l*v+u*O,s[7]=h*x+l*T+u*A,s[2]=p*m+y*_+g*C,s[5]=p*w+y*v+g*O,s[8]=p*x+y*T+g*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],c=t[6],h=t[7],l=t[8],u=l*o-a*h,p=a*c-l*s,y=h*s-o*c,g=e*u+n*p+r*y;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(r*h-l*n)*m,t[2]=(a*n-r*o)*m,t[3]=p*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-a*e)*m,t[6]=y*m,t[7]=(n*c-h*e)*m,t[8]=(o*e-n*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Bn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function us(i,t,e,n,r,s,o,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-a.x)/2,h=(o.y-a.y)/2,l=Math.cos(n)*c+Math.sin(n)*h,u=-Math.sin(n)*c+Math.cos(n)*h;let p=t*t,y=e*e;const g=l*l,m=u*u,w=g/p+m/y;if(w>1){const U=Math.sqrt(w);t=U*t,e=U*e,p=t*t,y=e*e}const x=p*m+y*g,_=(p*y-x)/x;let v=Math.sqrt(Math.max(0,_));r===s&&(v=-v);const T=v*t*u/e,C=-v*e*l/t,O=Math.cos(n)*T-Math.sin(n)*C+(o.x+a.x)/2,A=Math.sin(n)*T+Math.cos(n)*C+(o.y+a.y)/2,P=Bn(1,0,(l-T)/t,(u-C)/e),S=Bn((l-T)/t,(u-C)/e,(-l-T)/t,(-u-C)/e)%(Math.PI*2);i.ellipse(O,A,t,e,n,P,P+S,s===1)}function Rt(i,t){return i-(t-i)}function Fn(i,t){const e=new b,n=new b;for(let r=0,s=i.length;r<s;r++){const o=i[r];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),n.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),n.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),n.x=e.x+o.x1,n.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),n.x=o.x1,n.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Rt(e.x,n.x),c=Rt(e.y,n.y);n.x=a,n.y=c,o.type==="t"?(t.quadraticCurveTo(a,c,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,c,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}n.copy(e),us(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function wt(i,t,e=0){let a=0,c=!0,h="",l="";const u=[];function p(w,x,_){const v=new SyntaxError(`Unexpected character "${w}" at index ${x}.`);throw v.partial=_,v}function y(){h!==""&&(l===""?u.push(Number(h)):u.push(Number(h)*10**Number(l))),h="",l=""}let g;const m=i.length;for(let w=0;w<m;w++){if(g=i[w],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(g)){a=1,h=g,y();continue}if(a===0){if(F.WHITESPACE.test(g))continue;if(F.DIGIT.test(g)||F.SIGN.test(g)){a=1,h=g;continue}if(F.POINT.test(g)){a=2,h=g;continue}F.COMMA.test(g)&&(c&&p(g,w,u),c=!0)}if(a===1){if(F.DIGIT.test(g)){h+=g;continue}if(F.POINT.test(g)){h+=g,a=2;continue}if(F.EXP.test(g)){a=3;continue}F.SIGN.test(g)&&h.length===1&&F.SIGN.test(h[0])&&p(g,w,u)}if(a===2){if(F.DIGIT.test(g)){h+=g;continue}if(F.EXP.test(g)){a=3;continue}F.POINT.test(g)&&h[h.length-1]==="."&&p(g,w,u)}if(a===3){if(F.DIGIT.test(g)){l+=g;continue}if(F.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&F.SIGN.test(l)&&p(g,w,u)}}F.WHITESPACE.test(g)?(y(),a=0,c=!1):F.COMMA.test(g)?(y(),a=0,c=!0):F.SIGN.test(g)?(y(),a=1,h=g):F.POINT.test(g)?(y(),a=2,h=g):p(g,w,u)}return y(),u}function fs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ps(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${fs(i[e])} `;return t}const ds=/[a-df-z][^a-df-z]*/gi;function Nn(i){const t=[],e=i.match(ds);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),a=s.slice(1).trim();let c;switch(o){case"m":case"M":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)h===0?t.push({type:o,x:c[h],y:c[h+1]}):t.push({type:o==="m"?"l":"L",x:c[h],y:c[h+1]});break;case"h":case"H":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,x:c[h]});break;case"v":case"V":c=wt(a);for(let h=0,l=c.length;h<l;h++)t.push({type:o,y:c[h]});break;case"l":case"L":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"c":case"C":c=wt(a);for(let h=0,l=c.length;h<l;h+=6)t.push({type:o,x1:c[h],y1:c[h+1],x2:c[h+2],y2:c[h+3],x:c[h+4],y:c[h+5]});break;case"s":case"S":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x2:c[h],y2:c[h+1],x:c[h+2],y:c[h+3]});break;case"q":case"Q":c=wt(a);for(let h=0,l=c.length;h<l;h+=4)t.push({type:o,x1:c[h],y1:c[h+1],x:c[h+2],y:c[h+3]});break;case"t":case"T":c=wt(a);for(let h=0,l=c.length;h<l;h+=2)t.push({type:o,x:c[h],y:c[h+1]});break;case"a":case"A":c=wt(a,[3,4],7);for(let h=0,l=c.length;h<l;h+=7)t.push({type:o,rx:c[h],ry:c[h+1],angle:c[h+2],largeArcFlag:c[h+3],sweepFlag:c[h+4],x:c[h+5],y:c[h+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var gs=Object.defineProperty,ys=(i,t,e)=>t in i?gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Lt{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new b){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let a=0,c=s-1,h;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),h=n[r]-o,h<0)a=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],p=n[r+1]-l,y=(o-l)/p;return(r+y)/(s-1)}getTangent(t,e=new b){const r=Math.max(0,t-1e-4),s=Math.min(1,t+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(r)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return ps(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Gn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,a=i*i,c=i*a;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*a+s*i+e}function ms(i,t){const e=1-i;return e*e*t}function ws(i,t){return 2*(1-i)*i*t}function vs(i,t){return i*i*t}function Rn(i,t,e,n){return ms(i,t)+ws(i,e)+vs(i,n)}function bs(i,t){const e=1-i;return e*e*e*t}function xs(i,t){const e=1-i;return 3*e*e*i*t}function _s(i,t){return 3*(1-i)*i*i*t}function Ps(i,t){return i*i*i*t}function Vn(i,t,e,n,r){return bs(i,t)+xs(i,e)+_s(i,n)+Ps(i,r)}class Ss extends Lt{constructor(t=new b,e=new b,n=new b,r=new b){super(),this.start=t,this.startControl=e,this.endControl=n,this.end=r}getPoint(t,e=new b){const{start:n,startControl:r,endControl:s,end:o}=this;return e.set(Vn(t,n.x,r.x,s.x,o.x),Vn(t,n.y,r.y,s.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,n){const r=e*e-4*t*n;if(r<0)return[];const s=Math.sqrt(r),o=(-e+s)/(2*t),a=(-e-s)/(2*t);return[o,a].filter(c=>c>=0&&c<=1)}getMinMax(t=b.MAX,e=b.MIN){const n=this.start,r=this.startControl,s=this.endControl,o=this.end,a=this._solveQuadratic(3*(r.x-n.x),6*(s.x-r.x),3*(o.x-s.x)),c=this._solveQuadratic(3*(r.y-n.y),6*(s.y-r.y),3*(o.y-s.y)),h=[0,1,...a,...c];return((u,p)=>{for(const y of u)for(let g=0;g<=p;g++){const m=g/p-.5,w=Math.min(1,Math.max(0,y+m)),x=this.getPoint(w);t.x=Math.min(t.x,x.x),t.y=Math.min(t.y,x.y),e.x=Math.max(e.x,x.x),e.y=Math.max(e.y,x.y)}})(h,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:n,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{startControl:e,endControl:n,end:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Ms=new ct,kn=new ct,Hn=new ct,we=new b;class Cs extends Lt{constructor(t=new b,e=1,n=1,r=0,s=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=n,this.rotation=r,this.startAngle=s,this.endAngle=o,this.clockwise=a}getPoint(t,e=new b){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let a=this.center.x+this.radiusX*Math.cos(o),c=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const h=Math.cos(this.rotation),l=Math.sin(this.rotation),u=a-this.center.x,p=c-this.center.y;a=u*h-p*l+this.center.x,c=u*l+p*h+this.center.y}return e.set(a,c)}getCommands(){const{center:t,radiusX:e,radiusY:n,startAngle:r,endAngle:s,clockwise:o,rotation:a}=this,{x:c,y:h}=t,l=c+e*Math.cos(r)*Math.cos(a)-n*Math.sin(r)*Math.sin(a),u=h+e*Math.cos(r)*Math.sin(a)+n*Math.sin(r)*Math.cos(a),p=Math.abs(r-s),y=p>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(p>=2*Math.PI){const w=r+Math.PI,x=c+e*Math.cos(w)*Math.cos(a)-n*Math.sin(w)*Math.sin(a),_=h+e*Math.cos(w)*Math.sin(a)+n*Math.sin(w)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x,y:_},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x:l,y:u}]}else{const w=c+e*Math.cos(s)*Math.cos(a)-n*Math.sin(s)*Math.sin(a),x=h+e*Math.cos(s)*Math.sin(a)+n*Math.sin(s)*Math.cos(a);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:y,sweepFlag:g,x:w,y:x}]}}drawTo(t){const{center:e,radiusX:n,radiusY:r,rotation:s,startAngle:o,endAngle:a,clockwise:c}=this;return t.ellipse(e.x,e.y,n,r,s,o,a,!c),this}transform(t){return we.set(this.center.x,this.center.y),we.applyMatrix3(t),this.center.x=we.x,this.center.y=we.y,As(t)?Ts(this,t):Os(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=b.MAX,e=b.MIN){const{center:n,radiusX:r,radiusY:s,rotation:o}=this,{x:a,y:c}=n,h=Math.cos(o),l=Math.sin(o),u=Math.sqrt(r*r*h*h+s*s*l*l),p=Math.sqrt(r*r*l*l+s*s*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,c-p),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,c+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Ts(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new b(e*r,e*s),a=new b(-n*s,n*r),c=o.applyMatrix3(t),h=a.applyMatrix3(t),l=Ms.set(c.x,h.x,0,c.y,h.y,0,0,0,1),u=kn.copy(l).invert(),g=Hn.copy(u).transpose().multiply(u).elements,m=$s(g[0],g[1],g[4]),w=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/w,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=kn.set(w,0,0,0,x,0,0,0,1),T=Hn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),C=v.multiply(T).multiply(l),O=A=>{const{x:P,y:S}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(C);return Math.atan2(S,P)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),zn(t)&&(i.clockwise=!i.clockwise)}}function Os(i,t){const e=Wn(t),n=Xn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,zn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function zn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function As(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=Wn(i),r=Xn(i);return Math.abs(e/(n*r))>Number.EPSILON}function Wn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Xn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function $s(i,t,e){let n,r,s,o,a;const c=i+e,h=i-e,l=Math.sqrt(h*h+4*t*t);return c>0?(n=.5*(c+l),a=1/n,r=i*a*e-t*a*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),h>0?s=h+l:s=h-l,Math.abs(s)>2*Math.abs(t)?(a=-2*t/s,o=1/Math.sqrt(1+a*a),s=a*o):Math.abs(t)===0?(s=1,o=0):(a=-.5*s/t,s=1/Math.sqrt(1+a*a),o=a*s),h>0&&(a=s,s=-o,o=a),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Lt{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getNormal(t,e=new b){const{x:n,y:r}=this.getPoint(t).sub(this.start);return e.set(r,-n).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,end:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Is extends Lt{constructor(t=new b,e=new b,n=new b){super(),this.start=t,this.control=e,this.end=n}getPoint(t,e=new b){const{start:n,control:r,end:s}=this;return e.set(Rn(t,n.x,r.x,s.x),Rn(t,n.y,r.y,s.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=b.MAX,e=b.MIN){const{start:n,control:r,end:s}=this,o=.5*(n.x+r.x),a=.5*(n.y+r.y),c=.5*(n.x+s.x),h=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,a,h),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,a,h),{min:t,max:e}}getCommands(){const{start:t,control:e,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{control:e,end:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Ds=Object.defineProperty,Es=(i,t,e)=>t in i?Ds(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qn=(i,t,e)=>(Es(i,typeof t!="symbol"?t+"":t,e),e);class Us extends Lt{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,qn(this,"curves",[]),qn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,n=this.rx,r=this.rx/this.aspectRatio,s=[new b(t-n,e-r),new b(t+n,e-r),new b(t+n,e+r),new b(t-n,e+r)];for(let o=0;o<4;o++)this.curves.push(new qe(s[o].clone(),s[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Ls extends Lt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,a=n[s===0?s:s-1],c=n[s],h=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Gn(o,a.x,c.x,h.x,l.x),Gn(o,a.y,c.y,h.y,l.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Bs=Object.defineProperty,Fs=(i,t,e)=>t in i?Bs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ie=(i,t,e)=>(Fs(i,typeof t!="symbol"?t+"":t,e),e);class se extends Lt{constructor(t){super(),ie(this,"curves",[]),ie(this,"startPoint"),ie(this,"currentPoint",new b),ie(this,"autoClose",!1),ie(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++){const{x:r,y:s}=t[e];this.lineTo(r,s)}return this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}getPoint(t,e=new b){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],c=a.getLength();return a.getPointAt(c===0?0:1-o/c,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],n=this.curves;let r;for(let s=0,o=n.length;s<o;s++){const c=n[s].getPoints(t);for(let h=0;h<c.length;h++){const l=c[h];r!=null&&r.equals(l)||(e.push(l),r=l)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new qe(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new qe(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPoint.equals({x:s,y:o})||this.curves.push(new Ss(this.currentPoint.clone(),new b(t,e),new b(n,r),new b(s,o))),this._setCurrentPoint({x:s,y:o}),this}quadraticCurveTo(t,e,n,r){return this.currentPoint.equals({x:n,y:r})||this.curves.push(new Is(this.currentPoint.clone(),new b(t,e),new b(n,r))),this._setCurrentPoint({x:n,y:r}),this}arc(t,e,n,r,s,o){return this.ellipse(t,e,n,n,0,r,s,o),this}relativeArc(t,e,n,r,s,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,n,r,s,o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,a,c=!0){const h=new Cs(new b(t,e),n,r,s,o,a,!c);if(this.curves.length>0){const l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,n,r,s,o,a,c){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,n,r,s,o,a,c),this}rect(t,e,n,r){return this.curves.push(new Us(new b(t+n/2,e+r/2),n/2,n/r)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Ls([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Ns(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Gs=Object.defineProperty,Rs=(i,t,e)=>t in i?Gs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Rs(i,typeof t!="symbol"?t+"":t,e),e);class lt{constructor(t){je(this,"currentPath",new se),je(this,"paths",[this.currentPath]),je(this,"style",{}),t&&(t instanceof lt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof lt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new se().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return n.equals({x:t,y:e})||(r.length?(this.currentPath=new se().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.arc(t,e,n,r,s,o),this}arcTo(t,e,n,r,s){return this.currentPath.arcTo(t,e,n,r,s),this}ellipse(t,e,n,r,s,o,a,c){return this.currentPath.ellipse(t,e,n,r,s,o,a,c),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return Fn(t,this),this}addData(t){return this.addCommands(Nn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN,n=!0){if(this.forEachCurve(r=>r.getMinMax(t,e)),n){const r=this.strokeWidth/2;t.x-=r,t.y-=r,e.x+=r,e.y+=r}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:n}=this.getMinMax(void 0,void 0,t);return new E(e.x,e.y,n.x-e.x,n.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const r in t)t[r]!==void 0&&(e[Ns(r)]=t[r]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let n="";for(const r in e)e[r]!==void 0&&(n+=`${r}:${e[r]};`);return`<path d="${this.getData()}" style="${n}"></path>`}getSvgXml(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:n="#000",stroke:r="none"}=this.style;e&&as(t,this.style),this.paths.forEach(s=>{s.drawTo(t)}),n!=="none"&&t.fill(),r!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:n,width:r,height:s}=this.getBoundingBox(),o=document.createElement("canvas");o.width=r*t,o.height=s*t,o.style.width=`${r}px`,o.style.height=`${s}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-n),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const Ye="px",jn=90,Yn=["mm","cm","in","pt","pc","px"],Ke={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 $(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Yn.length;n<r;n++){const s=Yn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/jn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*jn)),e*Number.parseFloat(i)}const Vs=new ct,ve=new ct,Kn=new ct,Qn=new ct;function ks(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Hs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Hs(i){const t=new ct,e=Vs;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate($(i.getAttribute("x")),$(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),a=s.length;if(o>0&&o<a){const c=s.slice(0,o),h=wt(s.slice(o+1));switch(e.identity(),c){case"translate":if(h.length>=1){const l=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(l,u)}break;case"rotate":if(h.length>=1){let l=0,u=0,p=0;l=h[0]*Math.PI/180,h.length>=3&&(u=h[1],p=h[2]),ve.makeTranslation(-u,-p),Kn.makeRotation(l),Qn.multiplyMatrices(Kn,ve),ve.makeTranslation(u,p),e.multiplyMatrices(ve,Qn)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function zs(i){return new lt().addPath(new se().arc($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("r")||0),0,Math.PI*2))}function Ws(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,a])=>a!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function Xs(i){return new lt().addPath(new se().ellipse($(i.getAttribute("cx")||0),$(i.getAttribute("cy")||0),$(i.getAttribute("rx")||0),$(i.getAttribute("ry")||0),0,0,Math.PI*2))}function qs(i){return new lt().moveTo($(i.getAttribute("x1")||0),$(i.getAttribute("y1")||0)).lineTo($(i.getAttribute("x2")||0),$(i.getAttribute("y2")||0))}function js(i){const t=new lt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Ys=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ks(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Ys,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!0,t}const Qs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zs(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Qs,(r,s,o)=>{const a=$(s),c=$(o);return e===0?t.moveTo(a,c):t.lineTo(a,c),e++,r}),t.currentPath.autoClose=!1,t}function Js(i){const t=$(i.getAttribute("x")||0),e=$(i.getAttribute("y")||0),n=$(i.getAttribute("rx")||i.getAttribute("ry")||0),r=$(i.getAttribute("ry")||i.getAttribute("rx")||0),s=$(i.getAttribute("width")),o=$(i.getAttribute("height")),a=1-.551915024494,c=new lt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*a,e,t+s,e+r*a,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*a,t+s-n*a,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*a,e+o,t,e+o-r*a,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*a,t+n*a,e,t+n,e),c}function vt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,l){l===void 0&&(l=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),i.hasAttribute(c)&&(t[h]=l(i.getAttribute(c))),n[c]&&(t[h]=l(n[c])),i.style&&i.style[c]!==""&&(t[h]=l(i.style[c]))}function s(c){return Math.max(0,Math.min(1,$(c)))}function o(c){return Math.max(0,$(c))}function a(c){return c.split(" ").filter(h=>h!=="").map(h=>$(h))}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",o),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",o),r("stroke-dasharray","strokeDasharray",a),r("stroke-dashoffset","strokeDashoffset",$),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=vt(i,t,s);break;case"style":Ws(i,s);break;case"g":t=vt(i,t,s);break;case"path":t=vt(i,t,s),i.hasAttribute("d")&&(r=js(i));break;case"rect":t=vt(i,t,s),r=Js(i);break;case"polygon":t=vt(i,t,s),r=Ks(i);break;case"polyline":t=vt(i,t,s),r=Zs(i);break;case"circle":t=vt(i,t,s),r=zs(i);break;case"ellipse":t=vt(i,t,s),r=Xs(i);break;case"line":t=vt(i,t,s),r=qs(i);break;case"defs":n=!0;break;case"use":{t=vt(i,t,s);const p=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),y=(l=i.viewportElement)==null?void 0:l.getElementById(p);y?Qe(y,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(i);break}const o=new ct,a=[],c=ks(i,o,a);r&&(r.transform(o),e.push(r),r.style=t);const h=i.childNodes;for(let u=0,p=h.length;u<p;u++){const y=h[u];n&&y.nodeName!=="style"&&y.nodeName!=="defs"||Qe(y,t,e)}return c&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Zn="data:image/svg+xml;",Jn=`${Zn}base64,`,tr=`${Zn}charset=utf8,`;function er(i){if(typeof i=="string"){let t;return i.startsWith(Jn)?(i=i.substring(Jn.length,i.length),t=atob(i)):i.startsWith(tr)?(i=i.substring(tr.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function to(i){return Qe(er(i),{})}function be(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function nr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function rr(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function ir(i,t,e=0,n=0,r=0,s=1,o=1){let a=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:h,y:l}=t;return(s!==1||o!==1)&&(a=a.map(u=>rr(u,t,s,o))),(n||r)&&(a=a.map(u=>Ze(u,t,n,r))),a=a.map(u=>{const p=u.x-h,y=-(u.y-l);return u=nr({x:p,y},c),{x:h+u.x,y:l-u.y}}),a[0]}const eo=new Set(["©","®","÷"]),no=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class sr{constructor(t,e,n){I(this,"boundingBox",new E);I(this,"textWidth",0);I(this,"textHeight",0);I(this,"path",new lt);this.content=t,this.index=e,this.parent=n}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=En.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Pt||t instanceof _t)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:n,descender:r,os2:s,post:o}=t,{content:a,computedStyle:c,boundingBox:h,isVertical:l}=this,{left:u,top:p,height:y}=h,{fontSize:g}=c,m=e/g,w=t.getAdvanceWidth(a,g),x=(n+Math.abs(r))/m,_=n/m,v=(n-s.yStrikeoutPosition)/m,T=s.yStrikeoutSize/m,C=(n-o.underlinePosition)/m,O=o.underlineThickness/m;return this.glyphWidth=w,this.glyphHeight=x,this.underlinePosition=C,this.underlineThickness=O,this.yStrikeoutPosition=v,this.yStrikeoutSize=T,this.baseline=_,this.centerDiviation=.5*y-_,this.glyphBox=l?new E(u,p,x,w):new E(u,p,w,x),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:a,baseline:c,glyphHeight:h,glyphWidth:l}=this.updateGlyph(t),{os2:u,ascender:p,descender:y}=t,g=p,m=y,w=u.sTypoAscender,{left:x,top:_}=o,{fontSize:v,fontStyle:T}=a;let C=x,O=_+c,A,P;if(e&&(C+=(h-l)/2,Math.abs(r-s)>.1&&(O-=(g-w)/(g+Math.abs(m))*h),A=void 0),e&&!eo.has(n)&&(n.codePointAt(0)<=256||no.has(n))){P=t.getPathCommands(n,C,_+c-(h-l)/2,v)??[];const U={y:_-(h-l)/2+h/2,x:C+l/2};T==="italic"&&(P=this._italic(P,e?{x:U.x,y:_-(h-l)/2+c}:void 0)),P=this._rotation90(P,U)}else A!==void 0?(P=t.glyf.glyphs.get(A).getPathCommands(C,O,v),T==="italic"&&(P=this._italic(P,e?{x:C+l/2,y:_+w/(g+Math.abs(m))*h}:void 0))):(P=t.getPathCommands(n,C,O,v)??[],T==="italic"&&(P=this._italic(P,e?{x:C+h/2,y:O}:void 0)));P.push(...this._decoration());const S=new lt(P);return S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*v*.03:0},this.path=S,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:a,width:c,height:h}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+c/2:u=a+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+h},{type:"L",x:u+l,y:a+h},{type:"L",x:u+l,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,a=e||{y:o+n,x:s+r/2};return this._transform(t,(c,h)=>{const l=Ze({x:c,y:h},a,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=ir({x:n,y:r},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Se({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class or{constructor(t,e={},n){I(this,"boundingBox",new E);I(this,"highlight");this.content=t,this.style=e,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...be(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new sr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){I(this,"boundingBox",new E);I(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...be(this.parentStyle),...be(this.style)},this}addFragment(t,e){const n=new or(t,e,this);return this.fragments.push(n),n}}class Bt{constructor(t){this._text=t}}class ar extends Bt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class hr extends Bt{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*s,c=(o.offsetY??0)*s,h=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,p=r.boundingBox.clone();p.left+=a+h-u,p.top+=c+l-u,p.width+=u*2,p.height+=u*2,n.push(p)})}),E.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{dt(o,s,e)}),r.forEach(o=>{n.forEach(a=>{o.drawTo(e,a)})})),this}}class cr extends Bt{constructor(){super(...arguments);I(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new E;const e=b.MAX,n=b.MIN;return this.paths.forEach(r=>r.path.getMinMax(e,n)),new E(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e}=this._text;let n;const r=[];let s;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((s==null?void 0:s.url)===a.url&&n.length&&n[0].boundingBox.top===o.boundingBox.top&&n[0].fontSize===o.fontSize?n.push(o):(n=[],n.push(o),r.push(n))),s=a}),this.paths=r.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:E.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const n=er(e),r=to(n),s=b.MAX,o=b.MIN;return r.forEach(a=>a.getMinMax(s,o)),{paths:r,box:new E(s.x,s.y,o.x-s.x,o.y-s.y),viewBox:new E(...n.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:n,box:r,baseline:s,fontSize:o}=e,{box:a,viewBox:c,paths:h}=this._parseSvg(n),l=c.top+c.height/2,u=[],p=l>a.top?0:1;function y(g,m){g.style.strokeWidth&&(g.style.strokeWidth*=m),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=m),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=m),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(w=>w*m))}if(p===0){const g={x:r.left-o*.2,y:r.top},m=(r.width+o*.2*2)/a.width,w=r.height/a.height,x=new ct().translate(-a.x,-a.y).scale(m,w).translate(g.x,g.y);h.forEach(_=>{const v=_.clone().transform(x);y(v,m),u.push({path:v})})}else if(p===1){const g=o/a.width,m=a.width*g,w=Math.ceil(r.width/m),x={x:r.left,y:r.top+s+o*.1},_=new ct().translate(-a.x,-a.y).scale(g,g).translate(x.x,x.y);for(let v=0;v<w;v++){const T=_.clone().translate(v*m,0);h.forEach(C=>{const O=C.clone().transform(T);y(O,g),u.push({clipRect:r,path:O})})}}return u}draw({ctx:e}){return this.paths.forEach(n=>{Se({ctx:e,path:n.path,clipRect:n.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class lr extends Bt{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(c.style)),h.appendChild(document.createTextNode(c.content)),a.appendChild(h)}),s.appendChild(a)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const a=s.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll("span").forEach((c,h)=>{var p;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:h,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.firstChild;if(u instanceof window.Text){const y=document.createRange();y.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){y.setStart(u,Math.max(m-1,0)),y.setEnd(u,m);const w=((p=y.getClientRects)==null?void 0:p.call(y))??[y.getBoundingClientRect()];let x=w[w.length-1];w.length>1&&x.width<2&&(x=w[w.length-2]);const _=y.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const a=[[]];let c=a[0];const{characters:h}=this._measureDom(t);h.length>0&&(c.push(h[0]),h.reduce((y,g)=>{const m=s?"left":"top";return Math.abs(g[m]-y[m])>4e3/2&&(c=[],a.push(c)),c.push(g),g})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(y=>{const g=e[y.paragraphIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height}),l.fragments.forEach(y=>{const g=e[y.paragraphIndex].fragments[y.fragmentIndex];g.boundingBox.left=y.left,g.boundingBox.top=y.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height});const u=[];let p=0;return a.forEach(y=>{y.forEach(g=>{const m=l.characters[p],{paragraphIndex:w,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:w,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const v=e[w].fragments[x].characters[_];v.boundingBox.left=u[p].left,v.boundingBox.top=u[p].top,v.boundingBox.width=u[p].width,v.boundingBox.height=u[p].height,v.textWidth=u[p].textWidth,v.textHeight=u[p].textHeight,p++})}),{paragraphs:e,boundingBox:new E(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class ur extends Bt{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:a,highlight:c,...h}=o;if(a!==void 0){const l=s.addFragment(a,h);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,a=new Vt(o,e);s.forEach(c=>{const{content:h,highlight:l,...u}=c;if(h!==void 0){const p=a.addFragment(h,u);p.highlight=l}}),n.push(a)}else if("content"in r){const{content:s,highlight:o,...a}=r;if(s!==void 0){const c=new Vt(a,e),h=c.addFragment(s);h.highlight=o,n.push(c)}}}return n}}class ro extends Bt{}class fr extends Bt{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:a,height:c}=r,h=e.canvas;return h.dataset.viewbox=`${s} ${o} ${a} ${c}`,h.dataset.pixelRatio=String(n),h.width=Math.max(1,Math.ceil(a*n)),h.height=Math.max(1,Math.ceil(c*n)),h.style.marginTop=`${o}px`,h.style.marginLeft=`${s}px`,h.style.width=`${a}px`,h.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:a}=s;return dt(r,new E(0,0,o,a),e),n.forEach(c=>{dt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(h=>{dt(h.computedStyle,h.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,a,c,h,l){e.fillStyle=o,e.fillRect(a,c,h,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var h;(h=c.style)!=null&&h.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class io{constructor(t={}){I(this,"content");I(this,"style");I(this,"effects");I(this,"deformation");I(this,"measureDom");I(this,"needsUpdate",!0);I(this,"computedStyle",{...Je});I(this,"paragraphs",[]);I(this,"boundingBox",new E);I(this,"renderBoundingBox",new E);I(this,"parser",new ur(this));I(this,"measurer",new lr(this));I(this,"deformer",new ar(this));I(this,"effector",new hr(this));I(this,"highlighter",new cr(this));I(this,"renderer2D",new fr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const n=this.measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const n=this.characters;n.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const r=b.MAX,s=b.MIN;return n.forEach(o=>o.getMinMax(r,s)),this.renderBoundingBox=new E(r.x,r.y,s.x-r.x,s.y-r.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=E.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=E.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:n,ctx:r}),this.renderer2D.uploadColors({ctx:r}),this.highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:r}):this.renderer2D.draw({ctx:r}),this):this}}f.Character=sr,f.CmapSubtableFormat0=Ue,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Fe,f.CmapSubtableFormat6=It,f.Deformer=ar,f.Effector=hr,f.Eot=Kr,f.Font=de,f.Fonts=Dn,f.Fragment=or,f.Glyph=xn,f.GlyphSet=_n,f.Highlighter=cr,f.Measurer=lr,f.Paragraph=Vt,f.Parser=ur,f.Reflector=ro,f.Renderer2D=fr,f.Sfnt=te,f.TableDirectory=Ft,f.Text=io,f.Ttf=_t,f.Woff=Pt,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Be,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPath=Se,f.filterEmpty=be,f.fonts=En,f.getPointPosition=ir,f.getRotationPoint=nr,f.getScalePoint=rr,f.getSkewPoint=Ze,f.minify=ss,f.minifyGlyphs=Un,f.minifySfnt=Ln,f.parseColor=H,f.uploadColor=dt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -51,28 +51,31 @@ function parseCssLinearGradient(css, x, y, width, height) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function
|
|
55
|
-
const { ctx,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
function drawPath(options) {
|
|
55
|
+
const { ctx, path, fontSize, clipRect } = options;
|
|
56
|
+
ctx.save();
|
|
57
|
+
ctx.beginPath();
|
|
58
|
+
const style = path.style;
|
|
59
|
+
path.style = {
|
|
60
|
+
...style,
|
|
61
|
+
fill: options.color ?? style.fill,
|
|
62
|
+
stroke: options.textStrokeColor ?? style.stroke,
|
|
63
|
+
strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
|
|
64
|
+
shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
|
|
65
|
+
shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
|
|
66
|
+
shadowBlur: (options.shadowBlur ?? 0) * fontSize,
|
|
67
|
+
shadowColor: options.shadowColor
|
|
68
|
+
};
|
|
69
|
+
const offsetX = (options.offsetX ?? 0) * fontSize;
|
|
70
|
+
const offsetY = (options.offsetY ?? 0) * fontSize;
|
|
71
|
+
ctx.translate(offsetX, offsetY);
|
|
72
|
+
if (clipRect) {
|
|
73
|
+
ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
|
74
|
+
ctx.clip();
|
|
58
75
|
ctx.beginPath();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
fill: options.color ?? style.fill,
|
|
63
|
-
stroke: options.textStrokeColor ?? style.stroke,
|
|
64
|
-
strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
|
|
65
|
-
shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
|
|
66
|
-
shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
|
|
67
|
-
shadowBlur: (options.shadowBlur ?? 0) * fontSize,
|
|
68
|
-
shadowColor: options.shadowColor
|
|
69
|
-
};
|
|
70
|
-
const offsetX = (options.offsetX ?? 0) * fontSize;
|
|
71
|
-
const offsetY = (options.offsetY ?? 0) * fontSize;
|
|
72
|
-
ctx.translate(offsetX, offsetY);
|
|
73
|
-
path.drawTo(ctx);
|
|
74
|
-
ctx.restore();
|
|
75
|
-
});
|
|
76
|
+
}
|
|
77
|
+
path.drawTo(ctx);
|
|
78
|
+
ctx.restore();
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
function filterEmpty(val) {
|
|
@@ -208,7 +211,6 @@ class Character {
|
|
|
208
211
|
this.centerDiviation = 0.5 * height - baseline;
|
|
209
212
|
this.glyphBox = isVertical ? new BoundingBox(left, top, glyphHeight, glyphWidth) : new BoundingBox(left, top, glyphWidth, glyphHeight);
|
|
210
213
|
this.centerPoint = this.glyphBox.getCenterPoint();
|
|
211
|
-
this.fontMinGlyphWidth = font.getAdvanceWidth("i", fontSize);
|
|
212
214
|
return this;
|
|
213
215
|
}
|
|
214
216
|
updatePath() {
|
|
@@ -380,9 +382,9 @@ class Character {
|
|
|
380
382
|
return this.path.getBoundingBox();
|
|
381
383
|
}
|
|
382
384
|
drawTo(ctx, config = {}) {
|
|
383
|
-
|
|
385
|
+
drawPath({
|
|
384
386
|
ctx,
|
|
385
|
-
|
|
387
|
+
path: this.path,
|
|
386
388
|
fontSize: this.computedStyle.fontSize,
|
|
387
389
|
color: this.computedStyle.color,
|
|
388
390
|
...config
|
|
@@ -523,7 +525,7 @@ class Highlighter extends Feature {
|
|
|
523
525
|
}
|
|
524
526
|
const min = Vector2.MAX;
|
|
525
527
|
const max = Vector2.MIN;
|
|
526
|
-
this.paths.forEach((
|
|
528
|
+
this.paths.forEach((v) => v.path.getMinMax(min, max));
|
|
527
529
|
return new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
|
|
528
530
|
}
|
|
529
531
|
highlight() {
|
|
@@ -549,7 +551,6 @@ class Highlighter extends Feature {
|
|
|
549
551
|
url: characters2[0].parent.highlight.url,
|
|
550
552
|
box: BoundingBox.from(...characters2.map((c) => c.boundingBox)),
|
|
551
553
|
baseline: Math.max(...characters2.map((c) => c.baseline)),
|
|
552
|
-
fontMinGlyphWidth: characters2[0].fontMinGlyphWidth,
|
|
553
554
|
fontSize: characters2[0].fontSize
|
|
554
555
|
};
|
|
555
556
|
}).map((group2) => this._parseGroup(group2)).flat();
|
|
@@ -567,23 +568,23 @@ class Highlighter extends Feature {
|
|
|
567
568
|
};
|
|
568
569
|
}
|
|
569
570
|
_parseGroup(group) {
|
|
570
|
-
const { url, box: groupBox, baseline, fontSize
|
|
571
|
+
const { url, box: groupBox, baseline, fontSize } = group;
|
|
571
572
|
const { box, viewBox, paths } = this._parseSvg(url);
|
|
573
|
+
const centerY = viewBox.top + viewBox.height / 2;
|
|
572
574
|
const result = [];
|
|
573
|
-
const type =
|
|
574
|
-
function transformPathStyle(path) {
|
|
575
|
-
const rate = fontSize * 0.03;
|
|
575
|
+
const type = centerY > box.top ? 0 : 1;
|
|
576
|
+
function transformPathStyle(path, scale) {
|
|
576
577
|
if (path.style.strokeWidth) {
|
|
577
|
-
path.style.strokeWidth *=
|
|
578
|
+
path.style.strokeWidth *= scale;
|
|
578
579
|
}
|
|
579
580
|
if (path.style.strokeMiterlimit) {
|
|
580
|
-
path.style.strokeMiterlimit *=
|
|
581
|
+
path.style.strokeMiterlimit *= scale;
|
|
581
582
|
}
|
|
582
583
|
if (path.style.strokeDashoffset) {
|
|
583
|
-
path.style.strokeDashoffset *=
|
|
584
|
+
path.style.strokeDashoffset *= scale;
|
|
584
585
|
}
|
|
585
586
|
if (path.style.strokeDasharray) {
|
|
586
|
-
path.style.strokeDasharray = path.style.strokeDasharray.map((v) => v *
|
|
587
|
+
path.style.strokeDasharray = path.style.strokeDasharray.map((v) => v * scale);
|
|
587
588
|
}
|
|
588
589
|
}
|
|
589
590
|
if (type === 0) {
|
|
@@ -596,16 +597,15 @@ class Highlighter extends Feature {
|
|
|
596
597
|
const m = new Matrix3().translate(-box.x, -box.y).scale(scaleX, scaleY).translate(offset.x, offset.y);
|
|
597
598
|
paths.forEach((original) => {
|
|
598
599
|
const path = original.clone().transform(m);
|
|
599
|
-
transformPathStyle(path);
|
|
600
|
-
result.push(path);
|
|
600
|
+
transformPathStyle(path, scaleX);
|
|
601
|
+
result.push({ path });
|
|
601
602
|
});
|
|
602
603
|
} else if (type === 1) {
|
|
603
|
-
const scale =
|
|
604
|
+
const scale = fontSize / box.width;
|
|
604
605
|
const width = box.width * scale;
|
|
605
606
|
const length = Math.ceil(groupBox.width / width);
|
|
606
|
-
const totalWidth = width * length;
|
|
607
607
|
const offset = {
|
|
608
|
-
x: groupBox.left
|
|
608
|
+
x: groupBox.left,
|
|
609
609
|
y: groupBox.top + baseline + fontSize * 0.1
|
|
610
610
|
};
|
|
611
611
|
const m = new Matrix3().translate(-box.x, -box.y).scale(scale, scale).translate(offset.x, offset.y);
|
|
@@ -613,18 +613,21 @@ class Highlighter extends Feature {
|
|
|
613
613
|
const _m = m.clone().translate(i * width, 0);
|
|
614
614
|
paths.forEach((original) => {
|
|
615
615
|
const path = original.clone().transform(_m);
|
|
616
|
-
transformPathStyle(path);
|
|
617
|
-
result.push(path);
|
|
616
|
+
transformPathStyle(path, scale);
|
|
617
|
+
result.push({ clipRect: groupBox, path });
|
|
618
618
|
});
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
return result;
|
|
622
622
|
}
|
|
623
623
|
draw({ ctx }) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
this.paths.forEach((v) => {
|
|
625
|
+
drawPath({
|
|
626
|
+
ctx,
|
|
627
|
+
path: v.path,
|
|
628
|
+
clipRect: v.clipRect,
|
|
629
|
+
fontSize: this._text.computedStyle.fontSize
|
|
630
|
+
});
|
|
628
631
|
});
|
|
629
632
|
return this;
|
|
630
633
|
}
|
|
@@ -1079,4 +1082,4 @@ class Text {
|
|
|
1079
1082
|
}
|
|
1080
1083
|
}
|
|
1081
1084
|
|
|
1082
|
-
export { Character, Deformer, Effector, Fragment, Highlighter, Measurer, Paragraph, Parser, Reflector, Renderer2D, Text, defaultTextStyles,
|
|
1085
|
+
export { Character, Deformer, Effector, Fragment, Highlighter, Measurer, Paragraph, Parser, Reflector, Renderer2D, Text, defaultTextStyles, drawPath, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.14",
|
|
5
5
|
"packageManager": "pnpm@9.9.0",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"modern-font": "^0.1.5",
|
|
61
|
-
"modern-path2d": "^0.1.
|
|
61
|
+
"modern-path2d": "^0.1.16"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@antfu/eslint-config": "^3.7.3",
|