cn-font-split
Version:
划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.
1,258 lines • 368 kB
JavaScript
import * as R from "google-protobuf";
import { Buffer as bs } from "buffer";
import ol from "path";
var Rt;
((e) => {
((c) => {
c[c.UNSPECIFIED = 0] = "UNSPECIFIED", c[c.OUTPUT_DATA = 1] = "OUTPUT_DATA", c[c.END = 2] = "END";
})(e.EventName || (e.EventName = {}));
class t extends R.Message {
#e = [[2], [5], [6], [9], [10], [11], [13], [14], [15], [18], [20], [8], [21], [22], [23], [24], [25]];
constructor(n) {
super(), R.Message.initialize(this, Array.isArray(n) ? n : [], 0, -1, [7], this.#e), !Array.isArray(n) && typeof n == "object" && ("input" in n && n.input != null && (this.input = n.input), "outDir" in n && n.outDir != null && (this.outDir = n.outDir), "css" in n && n.css != null && (this.css = n.css), "targetType" in n && n.targetType != null && (this.targetType = n.targetType), "subsets" in n && n.subsets != null && (this.subsets = n.subsets), "chunkSize" in n && n.chunkSize != null && (this.chunkSize = n.chunkSize), "chunkSizeTolerance" in n && n.chunkSizeTolerance != null && (this.chunkSizeTolerance = n.chunkSizeTolerance), "maxAllowSubsetsCount" in n && n.maxAllowSubsetsCount != null && (this.maxAllowSubsetsCount = n.maxAllowSubsetsCount), "testHtml" in n && n.testHtml != null && (this.testHtml = n.testHtml), "reporter" in n && n.reporter != null && (this.reporter = n.reporter), "previewImage" in n && n.previewImage != null && (this.previewImage = n.previewImage), "renameOutputFont" in n && n.renameOutputFont != null && (this.renameOutputFont = n.renameOutputFont), "buildMode" in n && n.buildMode != null && (this.buildMode = n.buildMode), "languageAreas" in n && n.languageAreas != null && (this.languageAreas = n.languageAreas), "multiThreads" in n && n.multiThreads != null && (this.multiThreads = n.multiThreads), "fontFeature" in n && n.fontFeature != null && (this.fontFeature = n.fontFeature), "reduceMins" in n && n.reduceMins != null && (this.reduceMins = n.reduceMins), "autoSubset" in n && n.autoSubset != null && (this.autoSubset = n.autoSubset), "subsetRemainChars" in n && n.subsetRemainChars != null && (this.subsetRemainChars = n.subsetRemainChars));
}
get input() {
return R.Message.getFieldWithDefault(this, 1, new Uint8Array(0));
}
set input(n) {
R.Message.setField(this, 1, n);
}
get outDir() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set outDir(n) {
R.Message.setOneofField(this, 2, this.#e[0], n);
}
get hasOutDir() {
return R.Message.getField(this, 2) != null;
}
get css() {
return R.Message.getWrapperField(this, t.CssProperties, 5);
}
set css(n) {
R.Message.setOneofWrapperField(this, 5, this.#e[1], n);
}
get hasCss() {
return R.Message.getField(this, 5) != null;
}
get targetType() {
return R.Message.getFieldWithDefault(this, 6, "");
}
set targetType(n) {
R.Message.setOneofField(this, 6, this.#e[2], n);
}
get hasTargetType() {
return R.Message.getField(this, 6) != null;
}
get subsets() {
return R.Message.getFieldWithDefault(this, 7, []);
}
set subsets(n) {
R.Message.setField(this, 7, n);
}
get chunkSize() {
return R.Message.getFieldWithDefault(this, 9, 0);
}
set chunkSize(n) {
R.Message.setOneofField(this, 9, this.#e[3], n);
}
get hasChunkSize() {
return R.Message.getField(this, 9) != null;
}
get chunkSizeTolerance() {
return R.Message.getFieldWithDefault(this, 10, 0);
}
set chunkSizeTolerance(n) {
R.Message.setOneofField(this, 10, this.#e[4], n);
}
get hasChunkSizeTolerance() {
return R.Message.getField(this, 10) != null;
}
get maxAllowSubsetsCount() {
return R.Message.getFieldWithDefault(this, 11, 0);
}
set maxAllowSubsetsCount(n) {
R.Message.setOneofField(this, 11, this.#e[5], n);
}
get hasMaxAllowSubsetsCount() {
return R.Message.getField(this, 11) != null;
}
get testHtml() {
return R.Message.getFieldWithDefault(this, 13, !1);
}
set testHtml(n) {
R.Message.setOneofField(this, 13, this.#e[6], n);
}
get hasTestHtml() {
return R.Message.getField(this, 13) != null;
}
get reporter() {
return R.Message.getFieldWithDefault(this, 14, !1);
}
set reporter(n) {
R.Message.setOneofField(this, 14, this.#e[7], n);
}
get hasReporter() {
return R.Message.getField(this, 14) != null;
}
get previewImage() {
return R.Message.getWrapperField(this, t.PreviewImage, 15);
}
set previewImage(n) {
R.Message.setOneofWrapperField(this, 15, this.#e[8], n);
}
get hasPreviewImage() {
return R.Message.getField(this, 15) != null;
}
get renameOutputFont() {
return R.Message.getFieldWithDefault(this, 18, "");
}
set renameOutputFont(n) {
R.Message.setOneofField(this, 18, this.#e[9], n);
}
get hasRenameOutputFont() {
return R.Message.getField(this, 18) != null;
}
get buildMode() {
return R.Message.getFieldWithDefault(this, 20, "");
}
set buildMode(n) {
R.Message.setOneofField(this, 20, this.#e[10], n);
}
get hasBuildMode() {
return R.Message.getField(this, 20) != null;
}
get languageAreas() {
return R.Message.getFieldWithDefault(this, 8, !1);
}
set languageAreas(n) {
R.Message.setOneofField(this, 8, this.#e[11], n);
}
get hasLanguageAreas() {
return R.Message.getField(this, 8) != null;
}
get multiThreads() {
return R.Message.getFieldWithDefault(this, 21, !1);
}
set multiThreads(n) {
R.Message.setOneofField(this, 21, this.#e[12], n);
}
get hasMultiThreads() {
return R.Message.getField(this, 21) != null;
}
get fontFeature() {
return R.Message.getFieldWithDefault(this, 22, !1);
}
set fontFeature(n) {
R.Message.setOneofField(this, 22, this.#e[13], n);
}
get hasFontFeature() {
return R.Message.getField(this, 22) != null;
}
get reduceMins() {
return R.Message.getFieldWithDefault(this, 23, !1);
}
set reduceMins(n) {
R.Message.setOneofField(this, 23, this.#e[14], n);
}
get hasReduceMins() {
return R.Message.getField(this, 23) != null;
}
get autoSubset() {
return R.Message.getFieldWithDefault(this, 24, !1);
}
set autoSubset(n) {
R.Message.setOneofField(this, 24, this.#e[15], n);
}
get hasAutoSubset() {
return R.Message.getField(this, 24) != null;
}
get subsetRemainChars() {
return R.Message.getFieldWithDefault(this, 25, !1);
}
set subsetRemainChars(n) {
R.Message.setOneofField(this, 25, this.#e[16], n);
}
get hasSubsetRemainChars() {
return R.Message.getField(this, 25) != null;
}
get _out_dir() {
return {
0: "none",
2: "outDir"
}[R.Message.computeOneofCase(this, [2])];
}
get _css() {
return {
0: "none",
5: "css"
}[R.Message.computeOneofCase(this, [5])];
}
get _target_type() {
return {
0: "none",
6: "targetType"
}[R.Message.computeOneofCase(this, [6])];
}
get _chunk_size() {
return {
0: "none",
9: "chunkSize"
}[R.Message.computeOneofCase(this, [9])];
}
get _chunk_size_tolerance() {
return {
0: "none",
10: "chunkSizeTolerance"
}[R.Message.computeOneofCase(this, [10])];
}
get _max_allow_subsets_count() {
return {
0: "none",
11: "maxAllowSubsetsCount"
}[R.Message.computeOneofCase(this, [11])];
}
get _test_html() {
return {
0: "none",
13: "testHtml"
}[R.Message.computeOneofCase(this, [13])];
}
get _reporter() {
return {
0: "none",
14: "reporter"
}[R.Message.computeOneofCase(this, [14])];
}
get _preview_image() {
return {
0: "none",
15: "previewImage"
}[R.Message.computeOneofCase(this, [15])];
}
get _rename_output_font() {
return {
0: "none",
18: "renameOutputFont"
}[R.Message.computeOneofCase(this, [18])];
}
get _build_mode() {
return {
0: "none",
20: "buildMode"
}[R.Message.computeOneofCase(this, [20])];
}
get _language_areas() {
return {
0: "none",
8: "languageAreas"
}[R.Message.computeOneofCase(this, [8])];
}
get _multi_threads() {
return {
0: "none",
21: "multiThreads"
}[R.Message.computeOneofCase(this, [21])];
}
get _font_feature() {
return {
0: "none",
22: "fontFeature"
}[R.Message.computeOneofCase(this, [22])];
}
get _reduce_mins() {
return {
0: "none",
23: "reduceMins"
}[R.Message.computeOneofCase(this, [23])];
}
get _auto_subset() {
return {
0: "none",
24: "autoSubset"
}[R.Message.computeOneofCase(this, [24])];
}
get _subset_remain_chars() {
return {
0: "none",
25: "subsetRemainChars"
}[R.Message.computeOneofCase(this, [25])];
}
static fromObject(n) {
const u = new t({});
return n.input != null && (u.input = n.input), n.outDir != null && (u.outDir = n.outDir), n.css != null && (u.css = t.CssProperties.fromObject(n.css)), n.targetType != null && (u.targetType = n.targetType), n.subsets != null && (u.subsets = n.subsets), n.chunkSize != null && (u.chunkSize = n.chunkSize), n.chunkSizeTolerance != null && (u.chunkSizeTolerance = n.chunkSizeTolerance), n.maxAllowSubsetsCount != null && (u.maxAllowSubsetsCount = n.maxAllowSubsetsCount), n.testHtml != null && (u.testHtml = n.testHtml), n.reporter != null && (u.reporter = n.reporter), n.previewImage != null && (u.previewImage = t.PreviewImage.fromObject(n.previewImage)), n.renameOutputFont != null && (u.renameOutputFont = n.renameOutputFont), n.buildMode != null && (u.buildMode = n.buildMode), n.languageAreas != null && (u.languageAreas = n.languageAreas), n.multiThreads != null && (u.multiThreads = n.multiThreads), n.fontFeature != null && (u.fontFeature = n.fontFeature), n.reduceMins != null && (u.reduceMins = n.reduceMins), n.autoSubset != null && (u.autoSubset = n.autoSubset), n.subsetRemainChars != null && (u.subsetRemainChars = n.subsetRemainChars), u;
}
toObject() {
const n = {};
return this.input != null && (n.input = this.input), this.outDir != null && (n.outDir = this.outDir), this.css != null && (n.css = this.css.toObject()), this.targetType != null && (n.targetType = this.targetType), this.subsets != null && (n.subsets = this.subsets), this.chunkSize != null && (n.chunkSize = this.chunkSize), this.chunkSizeTolerance != null && (n.chunkSizeTolerance = this.chunkSizeTolerance), this.maxAllowSubsetsCount != null && (n.maxAllowSubsetsCount = this.maxAllowSubsetsCount), this.testHtml != null && (n.testHtml = this.testHtml), this.reporter != null && (n.reporter = this.reporter), this.previewImage != null && (n.previewImage = this.previewImage.toObject()), this.renameOutputFont != null && (n.renameOutputFont = this.renameOutputFont), this.buildMode != null && (n.buildMode = this.buildMode), this.languageAreas != null && (n.languageAreas = this.languageAreas), this.multiThreads != null && (n.multiThreads = this.multiThreads), this.fontFeature != null && (n.fontFeature = this.fontFeature), this.reduceMins != null && (n.reduceMins = this.reduceMins), this.autoSubset != null && (n.autoSubset = this.autoSubset), this.subsetRemainChars != null && (n.subsetRemainChars = this.subsetRemainChars), n;
}
serialize(n) {
const u = n || new R.BinaryWriter();
if (this.input.length && u.writeBytes(1, this.input), this.hasOutDir && u.writeString(2, this.outDir), this.hasCss && u.writeMessage(5, this.css, () => this.css.serialize(u)), this.hasTargetType && u.writeString(6, this.targetType), this.subsets.length && u.writeRepeatedBytes(7, this.subsets), this.hasChunkSize && u.writeInt32(9, this.chunkSize), this.hasChunkSizeTolerance && u.writeFloat(10, this.chunkSizeTolerance), this.hasMaxAllowSubsetsCount && u.writeInt32(11, this.maxAllowSubsetsCount), this.hasTestHtml && u.writeBool(13, this.testHtml), this.hasReporter && u.writeBool(14, this.reporter), this.hasPreviewImage && u.writeMessage(15, this.previewImage, () => this.previewImage.serialize(u)), this.hasRenameOutputFont && u.writeString(18, this.renameOutputFont), this.hasBuildMode && u.writeString(20, this.buildMode), this.hasLanguageAreas && u.writeBool(8, this.languageAreas), this.hasMultiThreads && u.writeBool(21, this.multiThreads), this.hasFontFeature && u.writeBool(22, this.fontFeature), this.hasReduceMins && u.writeBool(23, this.reduceMins), this.hasAutoSubset && u.writeBool(24, this.autoSubset), this.hasSubsetRemainChars && u.writeBool(25, this.subsetRemainChars), !n)
return u.getResultBuffer();
}
static deserialize(n) {
const u = n instanceof R.BinaryReader ? n : new R.BinaryReader(n), _ = new t();
for (; u.nextField() && !u.isEndGroup(); )
switch (u.getFieldNumber()) {
case 1:
_.input = u.readBytes();
break;
case 2:
_.outDir = u.readString();
break;
case 5:
u.readMessage(_.css, () => _.css = t.CssProperties.deserialize(u));
break;
case 6:
_.targetType = u.readString();
break;
case 7:
R.Message.addToRepeatedField(_, 7, u.readBytes());
break;
case 9:
_.chunkSize = u.readInt32();
break;
case 10:
_.chunkSizeTolerance = u.readFloat();
break;
case 11:
_.maxAllowSubsetsCount = u.readInt32();
break;
case 13:
_.testHtml = u.readBool();
break;
case 14:
_.reporter = u.readBool();
break;
case 15:
u.readMessage(_.previewImage, () => _.previewImage = t.PreviewImage.deserialize(u));
break;
case 18:
_.renameOutputFont = u.readString();
break;
case 20:
_.buildMode = u.readString();
break;
case 8:
_.languageAreas = u.readBool();
break;
case 21:
_.multiThreads = u.readBool();
break;
case 22:
_.fontFeature = u.readBool();
break;
case 23:
_.reduceMins = u.readBool();
break;
case 24:
_.autoSubset = u.readBool();
break;
case 25:
_.subsetRemainChars = u.readBool();
break;
default:
u.skipField();
}
return _;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(n) {
return t.deserialize(n);
}
}
e.InputTemplate = t, ((c) => {
class n extends R.Message {
#e = [[1], [2], [3], [4], [11], [12], [13], [8], [9]];
constructor(d) {
super(), R.Message.initialize(this, Array.isArray(d) ? d : [], 0, -1, [5, 6], this.#e), !Array.isArray(d) && typeof d == "object" && ("fontFamily" in d && d.fontFamily != null && (this.fontFamily = d.fontFamily), "fontWeight" in d && d.fontWeight != null && (this.fontWeight = d.fontWeight), "fontStyle" in d && d.fontStyle != null && (this.fontStyle = d.fontStyle), "fontDisplay" in d && d.fontDisplay != null && (this.fontDisplay = d.fontDisplay), "localFamily" in d && d.localFamily != null && (this.localFamily = d.localFamily), "polyfill" in d && d.polyfill != null && (this.polyfill = d.polyfill), "commentBase" in d && d.commentBase != null && (this.commentBase = d.commentBase), "commentNameTable" in d && d.commentNameTable != null && (this.commentNameTable = d.commentNameTable), "commentUnicodes" in d && d.commentUnicodes != null && (this.commentUnicodes = d.commentUnicodes), "compress" in d && d.compress != null && (this.compress = d.compress), "fileName" in d && d.fileName != null && (this.fileName = d.fileName));
}
get fontFamily() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set fontFamily(d) {
R.Message.setOneofField(this, 1, this.#e[0], d);
}
get hasFontFamily() {
return R.Message.getField(this, 1) != null;
}
get fontWeight() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set fontWeight(d) {
R.Message.setOneofField(this, 2, this.#e[1], d);
}
get hasFontWeight() {
return R.Message.getField(this, 2) != null;
}
get fontStyle() {
return R.Message.getFieldWithDefault(this, 3, "");
}
set fontStyle(d) {
R.Message.setOneofField(this, 3, this.#e[2], d);
}
get hasFontStyle() {
return R.Message.getField(this, 3) != null;
}
get fontDisplay() {
return R.Message.getFieldWithDefault(this, 4, "");
}
set fontDisplay(d) {
R.Message.setOneofField(this, 4, this.#e[3], d);
}
get hasFontDisplay() {
return R.Message.getField(this, 4) != null;
}
get localFamily() {
return R.Message.getFieldWithDefault(this, 5, []);
}
set localFamily(d) {
R.Message.setField(this, 5, d);
}
get polyfill() {
return R.Message.getRepeatedWrapperField(this, c.PolyfillType, 6);
}
set polyfill(d) {
R.Message.setRepeatedWrapperField(this, 6, d);
}
get commentBase() {
return R.Message.getFieldWithDefault(this, 11, !1);
}
set commentBase(d) {
R.Message.setOneofField(this, 11, this.#e[4], d);
}
get hasCommentBase() {
return R.Message.getField(this, 11) != null;
}
get commentNameTable() {
return R.Message.getFieldWithDefault(this, 12, !1);
}
set commentNameTable(d) {
R.Message.setOneofField(this, 12, this.#e[5], d);
}
get hasCommentNameTable() {
return R.Message.getField(this, 12) != null;
}
get commentUnicodes() {
return R.Message.getFieldWithDefault(this, 13, !1);
}
set commentUnicodes(d) {
R.Message.setOneofField(this, 13, this.#e[6], d);
}
get hasCommentUnicodes() {
return R.Message.getField(this, 13) != null;
}
get compress() {
return R.Message.getFieldWithDefault(this, 8, !1);
}
set compress(d) {
R.Message.setOneofField(this, 8, this.#e[7], d);
}
get hasCompress() {
return R.Message.getField(this, 8) != null;
}
get fileName() {
return R.Message.getFieldWithDefault(this, 9, "");
}
set fileName(d) {
R.Message.setOneofField(this, 9, this.#e[8], d);
}
get hasFileName() {
return R.Message.getField(this, 9) != null;
}
get _font_family() {
return {
0: "none",
1: "fontFamily"
}[R.Message.computeOneofCase(this, [1])];
}
get _font_weight() {
return {
0: "none",
2: "fontWeight"
}[R.Message.computeOneofCase(this, [2])];
}
get _font_style() {
return {
0: "none",
3: "fontStyle"
}[R.Message.computeOneofCase(this, [3])];
}
get _font_display() {
return {
0: "none",
4: "fontDisplay"
}[R.Message.computeOneofCase(this, [4])];
}
get _comment_base() {
return {
0: "none",
11: "commentBase"
}[R.Message.computeOneofCase(this, [11])];
}
get _comment_name_table() {
return {
0: "none",
12: "commentNameTable"
}[R.Message.computeOneofCase(this, [12])];
}
get _comment_unicodes() {
return {
0: "none",
13: "commentUnicodes"
}[R.Message.computeOneofCase(this, [13])];
}
get _compress() {
return {
0: "none",
8: "compress"
}[R.Message.computeOneofCase(this, [8])];
}
get _file_name() {
return {
0: "none",
9: "fileName"
}[R.Message.computeOneofCase(this, [9])];
}
static fromObject(d) {
const s = new n({});
return d.fontFamily != null && (s.fontFamily = d.fontFamily), d.fontWeight != null && (s.fontWeight = d.fontWeight), d.fontStyle != null && (s.fontStyle = d.fontStyle), d.fontDisplay != null && (s.fontDisplay = d.fontDisplay), d.localFamily != null && (s.localFamily = d.localFamily), d.polyfill != null && (s.polyfill = d.polyfill.map((l) => c.PolyfillType.fromObject(l))), d.commentBase != null && (s.commentBase = d.commentBase), d.commentNameTable != null && (s.commentNameTable = d.commentNameTable), d.commentUnicodes != null && (s.commentUnicodes = d.commentUnicodes), d.compress != null && (s.compress = d.compress), d.fileName != null && (s.fileName = d.fileName), s;
}
toObject() {
const d = {};
return this.fontFamily != null && (d.fontFamily = this.fontFamily), this.fontWeight != null && (d.fontWeight = this.fontWeight), this.fontStyle != null && (d.fontStyle = this.fontStyle), this.fontDisplay != null && (d.fontDisplay = this.fontDisplay), this.localFamily != null && (d.localFamily = this.localFamily), this.polyfill != null && (d.polyfill = this.polyfill.map((s) => s.toObject())), this.commentBase != null && (d.commentBase = this.commentBase), this.commentNameTable != null && (d.commentNameTable = this.commentNameTable), this.commentUnicodes != null && (d.commentUnicodes = this.commentUnicodes), this.compress != null && (d.compress = this.compress), this.fileName != null && (d.fileName = this.fileName), d;
}
serialize(d) {
const s = d || new R.BinaryWriter();
if (this.hasFontFamily && s.writeString(1, this.fontFamily), this.hasFontWeight && s.writeString(2, this.fontWeight), this.hasFontStyle && s.writeString(3, this.fontStyle), this.hasFontDisplay && s.writeString(4, this.fontDisplay), this.localFamily.length && s.writeRepeatedString(5, this.localFamily), this.polyfill.length && s.writeRepeatedMessage(6, this.polyfill, (l) => l.serialize(s)), this.hasCommentBase && s.writeBool(11, this.commentBase), this.hasCommentNameTable && s.writeBool(12, this.commentNameTable), this.hasCommentUnicodes && s.writeBool(13, this.commentUnicodes), this.hasCompress && s.writeBool(8, this.compress), this.hasFileName && s.writeString(9, this.fileName), !d)
return s.getResultBuffer();
}
static deserialize(d) {
const s = d instanceof R.BinaryReader ? d : new R.BinaryReader(d), l = new n();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
l.fontFamily = s.readString();
break;
case 2:
l.fontWeight = s.readString();
break;
case 3:
l.fontStyle = s.readString();
break;
case 4:
l.fontDisplay = s.readString();
break;
case 5:
R.Message.addToRepeatedField(l, 5, s.readString());
break;
case 6:
s.readMessage(l.polyfill, () => R.Message.addToRepeatedWrapperField(l, 6, c.PolyfillType.deserialize(s), c.PolyfillType));
break;
case 11:
l.commentBase = s.readBool();
break;
case 12:
l.commentNameTable = s.readBool();
break;
case 13:
l.commentUnicodes = s.readBool();
break;
case 8:
l.compress = s.readBool();
break;
case 9:
l.fileName = s.readString();
break;
default:
s.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(d) {
return n.deserialize(d);
}
}
c.CssProperties = n;
class u extends R.Message {
#e = [];
constructor(d) {
super(), R.Message.initialize(this, Array.isArray(d) ? d : [], 0, -1, [], this.#e), !Array.isArray(d) && typeof d == "object" && ("name" in d && d.name != null && (this.name = d.name), "format" in d && d.format != null && (this.format = d.format));
}
get name() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set name(d) {
R.Message.setField(this, 1, d);
}
get format() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set format(d) {
R.Message.setField(this, 2, d);
}
static fromObject(d) {
const s = new u({});
return d.name != null && (s.name = d.name), d.format != null && (s.format = d.format), s;
}
toObject() {
const d = {};
return this.name != null && (d.name = this.name), this.format != null && (d.format = this.format), d;
}
serialize(d) {
const s = d || new R.BinaryWriter();
if (this.name.length && s.writeString(1, this.name), this.format.length && s.writeString(2, this.format), !d)
return s.getResultBuffer();
}
static deserialize(d) {
const s = d instanceof R.BinaryReader ? d : new R.BinaryReader(d), l = new u();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
l.name = s.readString();
break;
case 2:
l.format = s.readString();
break;
default:
s.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(d) {
return u.deserialize(d);
}
}
c.PolyfillType = u;
class _ extends R.Message {
#e = [];
constructor(d) {
super(), R.Message.initialize(this, Array.isArray(d) ? d : [], 0, -1, [], this.#e), !Array.isArray(d) && typeof d == "object" && ("text" in d && d.text != null && (this.text = d.text), "name" in d && d.name != null && (this.name = d.name));
}
get text() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set text(d) {
R.Message.setField(this, 1, d);
}
get name() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set name(d) {
R.Message.setField(this, 2, d);
}
static fromObject(d) {
const s = new _({});
return d.text != null && (s.text = d.text), d.name != null && (s.name = d.name), s;
}
toObject() {
const d = {};
return this.text != null && (d.text = this.text), this.name != null && (d.name = this.name), d;
}
serialize(d) {
const s = d || new R.BinaryWriter();
if (this.text.length && s.writeString(1, this.text), this.name.length && s.writeString(2, this.name), !d)
return s.getResultBuffer();
}
static deserialize(d) {
const s = d instanceof R.BinaryReader ? d : new R.BinaryReader(d), l = new _();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
l.text = s.readString();
break;
case 2:
l.name = s.readString();
break;
default:
s.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(d) {
return _.deserialize(d);
}
}
c.PreviewImage = _;
})(t = e.InputTemplate || (e.InputTemplate = {}));
class r extends R.Message {
#e = [[3]];
constructor(n) {
super(), R.Message.initialize(this, Array.isArray(n) ? n : [], 0, -1, [], this.#e), !Array.isArray(n) && typeof n == "object" && ("event" in n && n.event != null && (this.event = n.event), "message" in n && n.message != null && (this.message = n.message), "data" in n && n.data != null && (this.data = n.data));
}
get event() {
return R.Message.getFieldWithDefault(
this,
1,
0
/* UNSPECIFIED */
);
}
set event(n) {
R.Message.setField(this, 1, n);
}
get message() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set message(n) {
R.Message.setField(this, 2, n);
}
get data() {
return R.Message.getFieldWithDefault(this, 3, new Uint8Array(0));
}
set data(n) {
R.Message.setOneofField(this, 3, this.#e[0], n);
}
get hasData() {
return R.Message.getField(this, 3) != null;
}
get _data() {
return {
0: "none",
3: "data"
}[R.Message.computeOneofCase(this, [3])];
}
static fromObject(n) {
const u = new r({});
return n.event != null && (u.event = n.event), n.message != null && (u.message = n.message), n.data != null && (u.data = n.data), u;
}
toObject() {
const n = {};
return this.event != null && (n.event = this.event), this.message != null && (n.message = this.message), this.data != null && (n.data = this.data), n;
}
serialize(n) {
const u = n || new R.BinaryWriter();
if (this.event != 0 && u.writeEnum(1, this.event), this.message.length && u.writeString(2, this.message), this.hasData && u.writeBytes(3, this.data), !n)
return u.getResultBuffer();
}
static deserialize(n) {
const u = n instanceof R.BinaryReader ? n : new R.BinaryReader(n), _ = new r();
for (; u.nextField() && !u.isEndGroup(); )
switch (u.getFieldNumber()) {
case 1:
_.event = u.readEnum();
break;
case 2:
_.message = u.readString();
break;
case 3:
_.data = u.readBytes();
break;
default:
u.skipField();
}
return _;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(n) {
return r.deserialize(n);
}
}
e.EventMessage = r;
class i extends R.Message {
#e = [];
constructor(n) {
super(), R.Message.initialize(this, Array.isArray(n) ? n : [], 0, -1, [1], this.#e), !Array.isArray(n) && typeof n == "object" && "messages" in n && n.messages != null && (this.messages = n.messages);
}
get messages() {
return R.Message.getRepeatedWrapperField(this, r, 1);
}
set messages(n) {
R.Message.setRepeatedWrapperField(this, 1, n);
}
static fromObject(n) {
const u = new i({});
return n.messages != null && (u.messages = n.messages.map((_) => r.fromObject(_))), u;
}
toObject() {
const n = {};
return this.messages != null && (n.messages = this.messages.map((u) => u.toObject())), n;
}
serialize(n) {
const u = n || new R.BinaryWriter();
if (this.messages.length && u.writeRepeatedMessage(1, this.messages, (_) => _.serialize(u)), !n)
return u.getResultBuffer();
}
static deserialize(n) {
const u = n instanceof R.BinaryReader ? n : new R.BinaryReader(n), _ = new i();
for (; u.nextField() && !u.isEndGroup(); )
switch (u.getFieldNumber()) {
case 1:
u.readMessage(_.messages, () => R.Message.addToRepeatedWrapperField(_, 1, r.deserialize(u), r));
break;
default:
u.skipField();
}
return _;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(n) {
return i.deserialize(n);
}
}
e.MultiMessages = i;
class o extends R.Message {
#e = [];
constructor(n) {
super(), R.Message.initialize(this, Array.isArray(n) ? n : [], 0, -1, [25, 26], this.#e), !Array.isArray(n) && typeof n == "object" && ("version" in n && n.version != null && (this.version = n.version), "css" in n && n.css != null && (this.css = n.css), "platform" in n && n.platform != null && (this.platform = n.platform), "bundleMessage" in n && n.bundleMessage != null && (this.bundleMessage = n.bundleMessage), "nameTable" in n && n.nameTable != null && (this.nameTable = n.nameTable), "subsetDetail" in n && n.subsetDetail != null && (this.subsetDetail = n.subsetDetail));
}
get version() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set version(n) {
R.Message.setField(this, 1, n);
}
get css() {
return R.Message.getWrapperField(this, o.Css, 2);
}
set css(n) {
R.Message.setWrapperField(this, 2, n);
}
get hasCss() {
return R.Message.getField(this, 2) != null;
}
get platform() {
return R.Message.getFieldWithDefault(this, 3, "");
}
set platform(n) {
R.Message.setField(this, 3, n);
}
get bundleMessage() {
return R.Message.getWrapperField(this, o.BundleMessage, 24);
}
set bundleMessage(n) {
R.Message.setWrapperField(this, 24, n);
}
get hasBundleMessage() {
return R.Message.getField(this, 24) != null;
}
get nameTable() {
return R.Message.getRepeatedWrapperField(this, o.NameTable, 25);
}
set nameTable(n) {
R.Message.setRepeatedWrapperField(this, 25, n);
}
get subsetDetail() {
return R.Message.getRepeatedWrapperField(this, o.SubsetDetail, 26);
}
set subsetDetail(n) {
R.Message.setRepeatedWrapperField(this, 26, n);
}
static fromObject(n) {
const u = new o({});
return n.version != null && (u.version = n.version), n.css != null && (u.css = o.Css.fromObject(n.css)), n.platform != null && (u.platform = n.platform), n.bundleMessage != null && (u.bundleMessage = o.BundleMessage.fromObject(n.bundleMessage)), n.nameTable != null && (u.nameTable = n.nameTable.map((_) => o.NameTable.fromObject(_))), n.subsetDetail != null && (u.subsetDetail = n.subsetDetail.map((_) => o.SubsetDetail.fromObject(_))), u;
}
toObject() {
const n = {};
return this.version != null && (n.version = this.version), this.css != null && (n.css = this.css.toObject()), this.platform != null && (n.platform = this.platform), this.bundleMessage != null && (n.bundleMessage = this.bundleMessage.toObject()), this.nameTable != null && (n.nameTable = this.nameTable.map((u) => u.toObject())), this.subsetDetail != null && (n.subsetDetail = this.subsetDetail.map((u) => u.toObject())), n;
}
serialize(n) {
const u = n || new R.BinaryWriter();
if (this.version.length && u.writeString(1, this.version), this.hasCss && u.writeMessage(2, this.css, () => this.css.serialize(u)), this.platform.length && u.writeString(3, this.platform), this.hasBundleMessage && u.writeMessage(24, this.bundleMessage, () => this.bundleMessage.serialize(u)), this.nameTable.length && u.writeRepeatedMessage(25, this.nameTable, (_) => _.serialize(u)), this.subsetDetail.length && u.writeRepeatedMessage(26, this.subsetDetail, (_) => _.serialize(u)), !n)
return u.getResultBuffer();
}
static deserialize(n) {
const u = n instanceof R.BinaryReader ? n : new R.BinaryReader(n), _ = new o();
for (; u.nextField() && !u.isEndGroup(); )
switch (u.getFieldNumber()) {
case 1:
_.version = u.readString();
break;
case 2:
u.readMessage(_.css, () => _.css = o.Css.deserialize(u));
break;
case 3:
_.platform = u.readString();
break;
case 24:
u.readMessage(_.bundleMessage, () => _.bundleMessage = o.BundleMessage.deserialize(u));
break;
case 25:
u.readMessage(_.nameTable, () => R.Message.addToRepeatedWrapperField(_, 25, o.NameTable.deserialize(u), o.NameTable));
break;
case 26:
u.readMessage(_.subsetDetail, () => R.Message.addToRepeatedWrapperField(_, 26, o.SubsetDetail.deserialize(u), o.SubsetDetail));
break;
default:
u.skipField();
}
return _;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(n) {
return o.deserialize(n);
}
}
e.OutputReport = o, ((c) => {
class n extends R.Message {
#e = [];
constructor(s) {
super(), R.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("platform" in s && s.platform != null && (this.platform = s.platform), "language" in s && s.language != null && (this.language = s.language), "name" in s && s.name != null && (this.name = s.name), "value" in s && s.value != null && (this.value = s.value));
}
get platform() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set platform(s) {
R.Message.setField(this, 1, s);
}
get language() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set language(s) {
R.Message.setField(this, 2, s);
}
get name() {
return R.Message.getFieldWithDefault(this, 3, "");
}
set name(s) {
R.Message.setField(this, 3, s);
}
get value() {
return R.Message.getFieldWithDefault(this, 4, "");
}
set value(s) {
R.Message.setField(this, 4, s);
}
static fromObject(s) {
const l = new n({});
return s.platform != null && (l.platform = s.platform), s.language != null && (l.language = s.language), s.name != null && (l.name = s.name), s.value != null && (l.value = s.value), l;
}
toObject() {
const s = {};
return this.platform != null && (s.platform = this.platform), this.language != null && (s.language = this.language), this.name != null && (s.name = this.name), this.value != null && (s.value = this.value), s;
}
serialize(s) {
const l = s || new R.BinaryWriter();
if (this.platform.length && l.writeString(1, this.platform), this.language.length && l.writeString(2, this.language), this.name.length && l.writeString(3, this.name), this.value.length && l.writeString(4, this.value), !s)
return l.getResultBuffer();
}
static deserialize(s) {
const l = s instanceof R.BinaryReader ? s : new R.BinaryReader(s), h = new n();
for (; l.nextField() && !l.isEndGroup(); )
switch (l.getFieldNumber()) {
case 1:
h.platform = l.readString();
break;
case 2:
h.language = l.readString();
break;
case 3:
h.name = l.readString();
break;
case 4:
h.value = l.readString();
break;
default:
l.skipField();
}
return h;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return n.deserialize(s);
}
}
c.NameTable = n;
class u extends R.Message {
#e = [];
constructor(s) {
super(), R.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [4], this.#e), !Array.isArray(s) && typeof s == "object" && ("id" in s && s.id != null && (this.id = s.id), "hash" in s && s.hash != null && (this.hash = s.hash), "fileName" in s && s.fileName != null && (this.fileName = s.fileName), "bytes" in s && s.bytes != null && (this.bytes = s.bytes), "chars" in s && s.chars != null && (this.chars = s.chars), "duration" in s && s.duration != null && (this.duration = s.duration));
}
get id() {
return R.Message.getFieldWithDefault(this, 1, 0);
}
set id(s) {
R.Message.setField(this, 1, s);
}
get hash() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set hash(s) {
R.Message.setField(this, 2, s);
}
get fileName() {
return R.Message.getFieldWithDefault(this, 6, "");
}
set fileName(s) {
R.Message.setField(this, 6, s);
}
get bytes() {
return R.Message.getFieldWithDefault(this, 3, 0);
}
set bytes(s) {
R.Message.setField(this, 3, s);
}
get chars() {
return R.Message.getFieldWithDefault(this, 4, []);
}
set chars(s) {
R.Message.setField(this, 4, s);
}
get duration() {
return R.Message.getFieldWithDefault(this, 5, 0);
}
set duration(s) {
R.Message.setField(this, 5, s);
}
static fromObject(s) {
const l = new u({});
return s.id != null && (l.id = s.id), s.hash != null && (l.hash = s.hash), s.fileName != null && (l.fileName = s.fileName), s.bytes != null && (l.bytes = s.bytes), s.chars != null && (l.chars = s.chars), s.duration != null && (l.duration = s.duration), l;
}
toObject() {
const s = {};
return this.id != null && (s.id = this.id), this.hash != null && (s.hash = this.hash), this.fileName != null && (s.fileName = this.fileName), this.bytes != null && (s.bytes = this.bytes), this.chars != null && (s.chars = this.chars), this.duration != null && (s.duration = this.duration), s;
}
serialize(s) {
const l = s || new R.BinaryWriter();
if (this.id != 0 && l.writeUint32(1, this.id), this.hash.length && l.writeString(2, this.hash), this.fileName.length && l.writeString(6, this.fileName), this.bytes != 0 && l.writeUint32(3, this.bytes), this.chars.length && l.writePackedUint32(4, this.chars), this.duration != 0 && l.writeUint32(5, this.duration), !s)
return l.getResultBuffer();
}
static deserialize(s) {
const l = s instanceof R.BinaryReader ? s : new R.BinaryReader(s), h = new u();
for (; l.nextField() && !l.isEndGroup(); )
switch (l.getFieldNumber()) {
case 1:
h.id = l.readUint32();
break;
case 2:
h.hash = l.readString();
break;
case 6:
h.fileName = l.readString();
break;
case 3:
h.bytes = l.readUint32();
break;
case 4:
h.chars = l.readPackedUint32();
break;
case 5:
h.duration = l.readUint32();
break;
default:
l.skipField();
}
return h;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return u.deserialize(s);
}
}
c.SubsetDetail = u;
class _ extends R.Message {
#e = [];
constructor(s) {
super(), R.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("originSize" in s && s.originSize != null && (this.originSize = s.originSize), "bundledSize" in s && s.bundledSize != null && (this.bundledSize = s.bundledSize), "originBytes" in s && s.originBytes != null && (this.originBytes = s.originBytes), "bundledBytes" in s && s.bundledBytes != null && (this.bundledBytes = s.bundledBytes));
}
get originSize() {
return R.Message.getFieldWithDefault(this, 1, 0);
}
set originSize(s) {
R.Message.setField(this, 1, s);
}
get bundledSize() {
return R.Message.getFieldWithDefault(this, 2, 0);
}
set bundledSize(s) {
R.Message.setField(this, 2, s);
}
get originBytes() {
return R.Message.getFieldWithDefault(this, 3, 0);
}
set originBytes(s) {
R.Message.setField(this, 3, s);
}
get bundledBytes() {
return R.Message.getFieldWithDefault(this, 4, 0);
}
set bundledBytes(s) {
R.Message.setField(this, 4, s);
}
static fromObject(s) {
const l = new _({});
return s.originSize != null && (l.originSize = s.originSize), s.bundledSize != null && (l.bundledSize = s.bundledSize), s.originBytes != null && (l.originBytes = s.originBytes), s.bundledBytes != null && (l.bundledBytes = s.bundledBytes), l;
}
toObject() {
const s = {};
return this.originSize != null && (s.originSize = this.originSize), this.bundledSize != null && (s.bundledSize = this.bundledSize), this.originBytes != null && (s.originBytes = this.originBytes), this.bundledBytes != null && (s.bundledBytes = this.bundledBytes), s;
}
serialize(s) {
const l = s || new R.BinaryWriter();
if (this.originSize != 0 && l.writeUint32(1, this.originSize), this.bundledSize != 0 && l.writeUint32(2, this.bundledSize), this.originBytes != 0 && l.writeUint32(3, this.originBytes), this.bundledBytes != 0 && l.writeUint32(4, this.bundledBytes), !s)
return l.getResultBuffer();
}
static deserialize(s) {
const l = s instanceof R.BinaryReader ? s : new R.BinaryReader(s), h = new _();
for (; l.nextField() && !l.isEndGroup(); )
switch (l.getFieldNumber()) {
case 1:
h.originSize = l.readUint32();
break;
case 2:
h.bundledSize = l.readUint32();
break;
case 3:
h.originBytes = l.readUint32();
break;
case 4:
h.bundledBytes = l.readUint32();
break;
default:
l.skipField();
}
return h;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return _.deserialize(s);
}
}
c.BundleMessage = _;
class F extends R.Message {
#e = [];
constructor(s) {
super(), R.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("family" in s && s.family != null && (this.family = s.family), "style" in s && s.style != null && (this.style = s.style), "weight" in s && s.weight != null && (this.weight = s.weight), "display" in s && s.display != null && (this.display = s.display));
}
get family() {
return R.Message.getFieldWithDefault(this, 1, "");
}
set family(s) {
R.Message.setField(this, 1, s);
}
get style() {
return R.Message.getFieldWithDefault(this, 2, "");
}
set style(s) {
R.Message.setField(this, 2, s);
}
get weight() {
return R.Message.getFieldWithDefault(this, 3, "");
}
set weight(s) {
R.Message.setField(this, 3, s);
}
get display() {
return R.Message.getFieldWithDefault(this, 4, "");
}
set display(s) {
R.Message.setField(this, 4, s);
}
static fromObject(s) {
const l = new F({});
return s.family != null && (l.family = s.family), s.style != null && (l.style = s.style), s.weight != null && (l.weight = s.weight), s.display != null && (l.display = s.display), l;
}
toObject() {
const s = {};
return this.family != null && (s.family = this.family), this.style != null && (s.style = this.style), this.weight != null && (s.weight = this.weight), this.display != null && (s.display = this.display), s;
}
serialize(s) {
const l = s || new R.BinaryWriter();
if (this.family.length && l.writeString(1, this.family), this.style.length && l.writeString(2, this.style), this.weight.length && l.writeString(3, this.weight), this.display.length && l.writeString(4, this.display), !s)
return l.getResultBuffer();
}
static deserialize(s) {
const l = s instanceof R.BinaryReader ? s : new R.BinaryReader(s), h = new F();
for (; l.nextField() && !l.isEndGroup(); )
switch (l.getFieldNumber()) {
case 1:
h.family = l.readString();
break;
case 2:
h.style = l.readString();
break;
case 3:
h.weight = l.readString();
break;
case 4:
h.display = l.readString();
break;
default:
l.skipField();
}
return h;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return F.deserialize(s);
}
}
c.Css = F;
})(o = e.OutputReport || (e.OutputReport = {}));
})(Rt || (Rt = {}));
var Ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function al(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Si = { exports: {} }, Ht = {}, Ft = {};
Object.defineProperty(Ft, "__esModule", { value: !0 });
Ft.constants = void 0;
Ft.constants = {
O_RDONLY: 0,
O_WRONLY: 1,
O_RDWR: 2,
S_IFMT: 61440,
S_IFREG: 32768,
S_IFDIR: 16384,
S_IFCHR: 8192,
S_IFBLK: 24576,
S_IFIFO: 4096,
S_IFLNK: 40960,
S_IFSOCK: 49152,
O_CREAT: 64,
O_EXCL: 128,
O_NOCTTY: 256,
O_TRUNC: 512,
O_APPEND: 1024,
O_DIRECTORY: 65536,
O_NOATIME: 262144,
O_NOFOLLOW: 131072,
O_SYNC: 1052672,
O_DIRECT: 16384,
O_NONBLOCK: 2048,
S_IRWXU: 448,
S_IRUSR: 256,
S_IWUSR: 128,
S_IXUSR: 64,
S_IRWXG: 56,
S_IRGRP: 32,
S_IWGRP: 16,
S_IXGRP: 8,
S_IRWXO: 7,
S_IROTH: 4,
S_IWOTH: 2,
S_IXOTH: 1,
F_OK: 0,
R_OK: 4,
W_OK: 2,
X_OK: 1,
UV_FS_SYMLINK_DIR: 1,
UV_FS_SYMLINK_JUNCTION: 2,
UV_FS_COPYFILE_EXCL: 1,
UV_FS_COPYFILE_FI