@gmb/bitmark-parser-generator 4.19.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run +4 -0
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +6 -5
- package/dist/browser/cjs/index.cjs +243 -135
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +1886 -3721
- package/dist/browser/esm/index.d.ts +1886 -3721
- package/dist/browser/esm/index.js +255 -149
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +39514 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/index.cjs +246 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1886 -3721
- package/dist/index.d.ts +1886 -3721
- package/dist/index.js +258 -151
- package/dist/index.js.map +1 -1
- package/package.json +29 -23
package/dist/index.js
CHANGED
|
@@ -2,9 +2,12 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
|
|
5
|
+
// src/config/Config.ts
|
|
6
|
+
import { Enum as Enum3 } from "@ncoderz/superenum";
|
|
7
|
+
|
|
5
8
|
// src/model/enum/BitType.ts
|
|
6
|
-
import
|
|
7
|
-
var BitType =
|
|
9
|
+
import "@ncoderz/superenum";
|
|
10
|
+
var BitType = {
|
|
8
11
|
_error: "_error",
|
|
9
12
|
// Used for error handling to indicate a bit type that is not supported or a bit parse error
|
|
10
13
|
_comment: "_comment",
|
|
@@ -393,6 +396,7 @@ var BitType = superenum({
|
|
|
393
396
|
multipleResponse: "multiple-response",
|
|
394
397
|
multipleResponse1: "multiple-response-1",
|
|
395
398
|
newspaperArticle: "newspaper-article",
|
|
399
|
+
nonProductionPrototypeIframe: "non-production-prototype-iframe",
|
|
396
400
|
note: "note",
|
|
397
401
|
noteAi: "note-ai",
|
|
398
402
|
noteAlt: "note-alt",
|
|
@@ -605,6 +609,7 @@ var BitType = superenum({
|
|
|
605
609
|
vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
|
|
606
610
|
vendorJupyterIpynb: "vendor-jupyter-ipynb",
|
|
607
611
|
vendorJupyterOutput: "vendor-jupyter-output",
|
|
612
|
+
vendorLearndashEmbed: "vendor-learndash-embed",
|
|
608
613
|
vendorPadletEmbed: "vendor-padlet-embed",
|
|
609
614
|
vendorStripePricingTable: "vendor-stripe-pricing-table",
|
|
610
615
|
vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
|
|
@@ -623,27 +628,27 @@ var BitType = superenum({
|
|
|
623
628
|
warningCollapsible: "warning-collapsible",
|
|
624
629
|
websiteLink: "website-link",
|
|
625
630
|
workbookArticle: "workbook-article"
|
|
626
|
-
}
|
|
631
|
+
};
|
|
627
632
|
|
|
628
633
|
// src/model/enum/Count.ts
|
|
629
|
-
import
|
|
630
|
-
var Count =
|
|
634
|
+
import "@ncoderz/superenum";
|
|
635
|
+
var Count = {
|
|
631
636
|
infinity: "infinity"
|
|
632
|
-
}
|
|
637
|
+
};
|
|
633
638
|
|
|
634
639
|
// src/model/enum/ExampleType.ts
|
|
635
|
-
import
|
|
636
|
-
var ExampleType =
|
|
640
|
+
import "@ncoderz/superenum";
|
|
641
|
+
var ExampleType = {
|
|
637
642
|
none: "none",
|
|
638
643
|
// Example is not allowed
|
|
639
644
|
string: "string",
|
|
640
645
|
// Example is a string value
|
|
641
646
|
boolean: "boolean"
|
|
642
647
|
// Example is a boolean value
|
|
643
|
-
}
|
|
648
|
+
};
|
|
644
649
|
|
|
645
650
|
// src/model/enum/Tag.ts
|
|
646
|
-
import
|
|
651
|
+
import "@ncoderz/superenum";
|
|
647
652
|
var tags = {
|
|
648
653
|
tag_title: "#",
|
|
649
654
|
tag_anchor: "\u25BC",
|
|
@@ -659,11 +664,11 @@ var tags = {
|
|
|
659
664
|
tag_mark: "=",
|
|
660
665
|
tag_resource: "&"
|
|
661
666
|
};
|
|
662
|
-
var Tag =
|
|
667
|
+
var Tag = tags;
|
|
663
668
|
|
|
664
669
|
// src/model/enum/TagFormat.ts
|
|
665
|
-
import
|
|
666
|
-
var TagFormat =
|
|
670
|
+
import "@ncoderz/superenum";
|
|
671
|
+
var TagFormat = {
|
|
667
672
|
none: "none",
|
|
668
673
|
// The property does not have a value
|
|
669
674
|
plainText: "plainText",
|
|
@@ -676,11 +681,11 @@ var TagFormat = superenum5({
|
|
|
676
681
|
// If the value is treated as a boolean
|
|
677
682
|
invertedBoolean: "invertedBoolean"
|
|
678
683
|
// If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
|
|
679
|
-
}
|
|
684
|
+
};
|
|
680
685
|
|
|
681
686
|
// src/model/enum/TextFormat.ts
|
|
682
|
-
import
|
|
683
|
-
var TextFormat =
|
|
687
|
+
import "@ncoderz/superenum";
|
|
688
|
+
var TextFormat = {
|
|
684
689
|
// plain text
|
|
685
690
|
plainText: "text",
|
|
686
691
|
latex: "latex",
|
|
@@ -692,11 +697,11 @@ var TextFormat = superenum6({
|
|
|
692
697
|
// bitmarkText
|
|
693
698
|
// bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
|
|
694
699
|
bitmarkText: "bitmark++"
|
|
695
|
-
}
|
|
700
|
+
};
|
|
696
701
|
|
|
697
702
|
// src/model/config/enum/CardSetConfigKey.ts
|
|
698
|
-
import
|
|
699
|
-
var CardSetConfigKey =
|
|
703
|
+
import "@ncoderz/superenum";
|
|
704
|
+
var CardSetConfigKey = {
|
|
700
705
|
flashcard: "flashcard",
|
|
701
706
|
definitionList: "definitionList",
|
|
702
707
|
elements: "elements",
|
|
@@ -718,22 +723,22 @@ var CardSetConfigKey = superenum7({
|
|
|
718
723
|
// DEPRECATED - TO BE REMOVED IN THE FUTURE
|
|
719
724
|
// captionDefinitionsList: 'captionDefinitionsList',
|
|
720
725
|
bookReferenceList: "bookReferenceList"
|
|
721
|
-
}
|
|
726
|
+
};
|
|
722
727
|
|
|
723
728
|
// src/model/config/enum/GroupConfigType.ts
|
|
724
|
-
import
|
|
725
|
-
var GroupConfigType =
|
|
729
|
+
import "@ncoderz/superenum";
|
|
730
|
+
var GroupConfigType = {
|
|
726
731
|
standard: "standard",
|
|
727
732
|
// Any ordinary group
|
|
728
733
|
resource: "resource",
|
|
729
734
|
// A resource group
|
|
730
735
|
comboResource: "comboResource"
|
|
731
736
|
// A combo resource group
|
|
732
|
-
}
|
|
737
|
+
};
|
|
733
738
|
|
|
734
739
|
// src/model/enum/BitTagConfigKeyType.ts
|
|
735
|
-
import
|
|
736
|
-
var BitTagConfigKeyType =
|
|
740
|
+
import "@ncoderz/superenum";
|
|
741
|
+
var BitTagConfigKeyType = {
|
|
737
742
|
unknown: "unknown",
|
|
738
743
|
// Unknown tag type, used for error handling
|
|
739
744
|
tag: "tag",
|
|
@@ -745,7 +750,7 @@ var BitTagConfigKeyType = superenum9({
|
|
|
745
750
|
//
|
|
746
751
|
group: "group"
|
|
747
752
|
// A reusable group of tags
|
|
748
|
-
}
|
|
753
|
+
};
|
|
749
754
|
|
|
750
755
|
// src/model/config/AbstractTagConfig.ts
|
|
751
756
|
var AbstractTagConfig = class {
|
|
@@ -1058,10 +1063,10 @@ ${this.cardSet.toString(opts)}`;
|
|
|
1058
1063
|
};
|
|
1059
1064
|
|
|
1060
1065
|
// src/model/config/enum/ConfigKey.ts
|
|
1061
|
-
import {
|
|
1066
|
+
import { Enum } from "@ncoderz/superenum";
|
|
1062
1067
|
|
|
1063
1068
|
// src/model/enum/GroupKey.ts
|
|
1064
|
-
import
|
|
1069
|
+
import "@ncoderz/superenum";
|
|
1065
1070
|
var groupKeys = {
|
|
1066
1071
|
group_standardAllBits: "group_standardAllBits",
|
|
1067
1072
|
group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
|
|
@@ -1114,10 +1119,9 @@ var groupKeys = {
|
|
|
1114
1119
|
group_previewImages: "group_previewImages",
|
|
1115
1120
|
group_previewVideos: "group_previewVideos"
|
|
1116
1121
|
};
|
|
1117
|
-
var GroupKey = superenum10(groupKeys);
|
|
1118
1122
|
|
|
1119
1123
|
// src/model/enum/PropertyKey.ts
|
|
1120
|
-
import
|
|
1124
|
+
import "@ncoderz/superenum";
|
|
1121
1125
|
var propertyKeys = {
|
|
1122
1126
|
property_action: "@action",
|
|
1123
1127
|
property_activityType: "@activityType",
|
|
@@ -1221,6 +1225,8 @@ var propertyKeys = {
|
|
|
1221
1225
|
property_icon: "@icon",
|
|
1222
1226
|
property_iconTag: "@iconTag",
|
|
1223
1227
|
property_id: "@id",
|
|
1228
|
+
property_iframeSrc: "@iframeSrc",
|
|
1229
|
+
property_iframeName: "@iframeName",
|
|
1224
1230
|
property_imageFirst: "@imageFirst",
|
|
1225
1231
|
property_imageSource: "@imageSource",
|
|
1226
1232
|
property_index: "@index",
|
|
@@ -1387,10 +1393,10 @@ var propertyKeys = {
|
|
|
1387
1393
|
property_y: "@y",
|
|
1388
1394
|
property_zoomDisabled: "@zoomDisabled"
|
|
1389
1395
|
};
|
|
1390
|
-
var PropertyKey =
|
|
1396
|
+
var PropertyKey = propertyKeys;
|
|
1391
1397
|
|
|
1392
1398
|
// src/model/enum/ResourceKey.ts
|
|
1393
|
-
import
|
|
1399
|
+
import "@ncoderz/superenum";
|
|
1394
1400
|
var resourceKeys = {
|
|
1395
1401
|
resource_image: "&image",
|
|
1396
1402
|
resource_imageResponsive: "&imageResponsive",
|
|
@@ -1426,10 +1432,9 @@ var resourceKeys = {
|
|
|
1426
1432
|
resource_previewVideo: "&previewVideo",
|
|
1427
1433
|
resource_coverImage: "&coverImage"
|
|
1428
1434
|
};
|
|
1429
|
-
var ResourceKey = superenum12(resourceKeys);
|
|
1430
1435
|
|
|
1431
1436
|
// src/model/enum/ResourceType.ts
|
|
1432
|
-
import
|
|
1437
|
+
import "@ncoderz/superenum";
|
|
1433
1438
|
|
|
1434
1439
|
// src/utils/StringUtils.ts
|
|
1435
1440
|
var StringUtils = class {
|
|
@@ -1620,7 +1625,7 @@ var StringUtils = class {
|
|
|
1620
1625
|
var stringUtils = new StringUtils();
|
|
1621
1626
|
|
|
1622
1627
|
// src/model/enum/ResourceType.ts
|
|
1623
|
-
var ResourceType =
|
|
1628
|
+
var ResourceType = {
|
|
1624
1629
|
unknown: "unknown",
|
|
1625
1630
|
image: "image",
|
|
1626
1631
|
imageResponsive: "image-responsive",
|
|
@@ -1656,13 +1661,13 @@ var ResourceType = superenum13({
|
|
|
1656
1661
|
previewImage: "previewImage",
|
|
1657
1662
|
previewVideo: "previewVideo",
|
|
1658
1663
|
coverImage: "coverImage"
|
|
1659
|
-
}
|
|
1664
|
+
};
|
|
1660
1665
|
function resourceTypeToConfigKey(type) {
|
|
1661
1666
|
return `&${stringUtils.kebabToCamel(type)}`;
|
|
1662
1667
|
}
|
|
1663
1668
|
|
|
1664
1669
|
// src/model/config/enum/ConfigKey.ts
|
|
1665
|
-
var ConfigKey =
|
|
1670
|
+
var ConfigKey = {
|
|
1666
1671
|
// Internal
|
|
1667
1672
|
_unknown: "_unknown",
|
|
1668
1673
|
// Tags
|
|
@@ -1673,7 +1678,7 @@ var ConfigKey = superenum14({
|
|
|
1673
1678
|
...propertyKeys,
|
|
1674
1679
|
// Groups
|
|
1675
1680
|
...groupKeys
|
|
1676
|
-
}
|
|
1681
|
+
};
|
|
1677
1682
|
function typeFromConfigKey(tagKey) {
|
|
1678
1683
|
if (!tagKey) return BitTagConfigKeyType.unknown;
|
|
1679
1684
|
if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
|
|
@@ -1685,7 +1690,7 @@ function configKeyToPropertyType(configKey) {
|
|
|
1685
1690
|
return configKey.replace(/^@/, "");
|
|
1686
1691
|
}
|
|
1687
1692
|
function configKeyToResourceType(configKey) {
|
|
1688
|
-
return ResourceType.fromKey(configKey.replace(/^&/, ""));
|
|
1693
|
+
return Enum(ResourceType).fromKey(configKey.replace(/^&/, ""));
|
|
1689
1694
|
}
|
|
1690
1695
|
|
|
1691
1696
|
// src/model/config/ResourcesConfig.ts
|
|
@@ -2077,6 +2082,9 @@ var ObjectUtils = class {
|
|
|
2077
2082
|
};
|
|
2078
2083
|
var objectUtils = new ObjectUtils();
|
|
2079
2084
|
|
|
2085
|
+
// src/config/ConfigHydrator.ts
|
|
2086
|
+
import { Enum as Enum2 } from "@ncoderz/superenum";
|
|
2087
|
+
|
|
2080
2088
|
// src/config/raw/cardSets.ts
|
|
2081
2089
|
var CARDSETS = {
|
|
2082
2090
|
[CardSetConfigKey.definitionList]: {
|
|
@@ -4315,9 +4323,9 @@ var ConfigHydrator = class {
|
|
|
4315
4323
|
}
|
|
4316
4324
|
hydrateTagConfig(_tag) {
|
|
4317
4325
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
|
|
4318
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4326
|
+
const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4319
4327
|
if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
|
|
4320
|
-
const tag = Tag.fromValue(configKey);
|
|
4328
|
+
const tag = Enum2(Tag).fromValue(configKey);
|
|
4321
4329
|
if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
|
|
4322
4330
|
let chain;
|
|
4323
4331
|
if (_chain) {
|
|
@@ -4348,7 +4356,7 @@ var ConfigHydrator = class {
|
|
|
4348
4356
|
defaultValue,
|
|
4349
4357
|
jsonKey
|
|
4350
4358
|
} = _tag;
|
|
4351
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4359
|
+
const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4352
4360
|
if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
|
|
4353
4361
|
const tag = _configKey.substring(1);
|
|
4354
4362
|
let chain;
|
|
@@ -4374,7 +4382,7 @@ var ConfigHydrator = class {
|
|
|
4374
4382
|
}
|
|
4375
4383
|
hydrateResourceTagConfig(_tag) {
|
|
4376
4384
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
|
|
4377
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4385
|
+
const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4378
4386
|
if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
|
|
4379
4387
|
const tag = _configKey.substring(1);
|
|
4380
4388
|
let chain;
|
|
@@ -4398,7 +4406,7 @@ var ConfigHydrator = class {
|
|
|
4398
4406
|
}
|
|
4399
4407
|
hydrateTagGroupConfig(_tag) {
|
|
4400
4408
|
const { key: _configKey } = _tag;
|
|
4401
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4409
|
+
const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4402
4410
|
if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
|
|
4403
4411
|
const _groupConfig = GROUPS[configKey];
|
|
4404
4412
|
if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
|
|
@@ -9842,6 +9850,27 @@ var BITS = {
|
|
|
9842
9850
|
}
|
|
9843
9851
|
],
|
|
9844
9852
|
resourceAttachmentAllowed: false
|
|
9853
|
+
},
|
|
9854
|
+
[BitType.nonProductionPrototypeIframe]: {
|
|
9855
|
+
since: "4.20.0",
|
|
9856
|
+
baseBitType: BitType._standard,
|
|
9857
|
+
description: "A non-production prototype iframe bit, used to embed prototype iframes",
|
|
9858
|
+
tags: [
|
|
9859
|
+
{
|
|
9860
|
+
key: ConfigKey.property_iframeSrc,
|
|
9861
|
+
description: "Iframe source URL, used to define the source of the iframe"
|
|
9862
|
+
},
|
|
9863
|
+
{
|
|
9864
|
+
key: ConfigKey.property_iframeName,
|
|
9865
|
+
description: "Iframe name, used to define the name of the iframe",
|
|
9866
|
+
minCount: 1
|
|
9867
|
+
}
|
|
9868
|
+
]
|
|
9869
|
+
},
|
|
9870
|
+
[BitType.vendorLearndashEmbed]: {
|
|
9871
|
+
since: "5.0.0",
|
|
9872
|
+
baseBitType: BitType.nonProductionPrototypeIframe,
|
|
9873
|
+
description: "Learndash embed bit, used to embed Learndash content in an iframe"
|
|
9845
9874
|
}
|
|
9846
9875
|
};
|
|
9847
9876
|
|
|
@@ -9864,7 +9893,7 @@ var Config = class {
|
|
|
9864
9893
|
*/
|
|
9865
9894
|
getBitType(bitType) {
|
|
9866
9895
|
if (bitType?.startsWith("|")) bitType = bitType.substring(1);
|
|
9867
|
-
return BitType.fromValue(bitType) ?? BitType._error;
|
|
9896
|
+
return Enum3(BitType).fromValue(bitType) ?? BitType._error;
|
|
9868
9897
|
}
|
|
9869
9898
|
/**
|
|
9870
9899
|
* Check if a bit type is and instance of the given root bit type.
|
|
@@ -10184,15 +10213,15 @@ var instance2 = new Config();
|
|
|
10184
10213
|
// src/generated/package_info.ts
|
|
10185
10214
|
var PACKAGE_INFO = {
|
|
10186
10215
|
"name": "@gmb/bitmark-parser-generator",
|
|
10187
|
-
"version": "
|
|
10216
|
+
"version": "5.0.0",
|
|
10188
10217
|
"author": "Get More Brain Ltd",
|
|
10189
10218
|
"license": "ISC",
|
|
10190
10219
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
10191
10220
|
};
|
|
10192
10221
|
|
|
10193
10222
|
// src/utils/env/Environment.ts
|
|
10194
|
-
import
|
|
10195
|
-
var Environment =
|
|
10223
|
+
import "@ncoderz/superenum";
|
|
10224
|
+
var Environment = {
|
|
10196
10225
|
unknown: "",
|
|
10197
10226
|
node: "node",
|
|
10198
10227
|
chrome: "chrome",
|
|
@@ -10200,18 +10229,18 @@ var Environment = superenum15({
|
|
|
10200
10229
|
firefox: "firefox",
|
|
10201
10230
|
edge: "edge",
|
|
10202
10231
|
ie: "ie"
|
|
10203
|
-
}
|
|
10232
|
+
};
|
|
10204
10233
|
|
|
10205
10234
|
// src/utils/env/Os.ts
|
|
10206
|
-
import
|
|
10207
|
-
var Os =
|
|
10235
|
+
import "@ncoderz/superenum";
|
|
10236
|
+
var Os = {
|
|
10208
10237
|
unknown: "",
|
|
10209
10238
|
macos: "macos",
|
|
10210
10239
|
windows: "windows",
|
|
10211
10240
|
linux: "linux",
|
|
10212
10241
|
android: "android",
|
|
10213
10242
|
ios: "ios"
|
|
10214
|
-
}
|
|
10243
|
+
};
|
|
10215
10244
|
|
|
10216
10245
|
// src/utils/env/userAgent.ts
|
|
10217
10246
|
function parseUserAgent() {
|
|
@@ -10419,8 +10448,11 @@ function init() {
|
|
|
10419
10448
|
initialised = true;
|
|
10420
10449
|
}
|
|
10421
10450
|
|
|
10451
|
+
// src/ast/Ast.ts
|
|
10452
|
+
import { Enum as Enum4 } from "@ncoderz/superenum";
|
|
10453
|
+
|
|
10422
10454
|
// src/model/enum/BodyBitType.ts
|
|
10423
|
-
import
|
|
10455
|
+
import "@ncoderz/superenum";
|
|
10424
10456
|
var BodyBitTypeRaw = {
|
|
10425
10457
|
text: "text",
|
|
10426
10458
|
gap: "gap",
|
|
@@ -10428,11 +10460,11 @@ var BodyBitTypeRaw = {
|
|
|
10428
10460
|
select: "select",
|
|
10429
10461
|
highlight: "highlight"
|
|
10430
10462
|
};
|
|
10431
|
-
var BodyBitType =
|
|
10463
|
+
var BodyBitType = BodyBitTypeRaw;
|
|
10432
10464
|
|
|
10433
10465
|
// src/model/enum/TextMarkType.ts
|
|
10434
|
-
import
|
|
10435
|
-
var TextMarkType =
|
|
10466
|
+
import "@ncoderz/superenum";
|
|
10467
|
+
var TextMarkType = {
|
|
10436
10468
|
// Styles
|
|
10437
10469
|
bold: "bold",
|
|
10438
10470
|
light: "light",
|
|
@@ -10479,11 +10511,11 @@ var TextMarkType = superenum18({
|
|
|
10479
10511
|
duration: "duration",
|
|
10480
10512
|
color: "color",
|
|
10481
10513
|
comment: "comment"
|
|
10482
|
-
}
|
|
10514
|
+
};
|
|
10483
10515
|
|
|
10484
10516
|
// src/model/enum/TextNodeType.ts
|
|
10485
|
-
import
|
|
10486
|
-
var TextNodeType =
|
|
10517
|
+
import "@ncoderz/superenum";
|
|
10518
|
+
var TextNodeType = {
|
|
10487
10519
|
// Text
|
|
10488
10520
|
text: "text",
|
|
10489
10521
|
// Blocks
|
|
@@ -10511,11 +10543,11 @@ var TextNodeType = superenum19({
|
|
|
10511
10543
|
select: "select",
|
|
10512
10544
|
highlight: "highlight",
|
|
10513
10545
|
mark: "mark"
|
|
10514
|
-
}
|
|
10546
|
+
};
|
|
10515
10547
|
|
|
10516
10548
|
// src/model/ast/NodeType.ts
|
|
10517
|
-
import
|
|
10518
|
-
var NodeType =
|
|
10549
|
+
import "@ncoderz/superenum";
|
|
10550
|
+
var NodeType = {
|
|
10519
10551
|
unknown: "unknown",
|
|
10520
10552
|
// unknown
|
|
10521
10553
|
__isDefaultExample: "__isDefaultExample",
|
|
@@ -10778,6 +10810,8 @@ var NodeType = superenum20({
|
|
|
10778
10810
|
iconValue: "iconValue",
|
|
10779
10811
|
id: "id",
|
|
10780
10812
|
idValue: "idValue",
|
|
10813
|
+
iframeSrc: "iframeSrc",
|
|
10814
|
+
iframeName: "iframeName",
|
|
10781
10815
|
image: "image",
|
|
10782
10816
|
imageFirst: "imageFirst",
|
|
10783
10817
|
imageFirstValue: "imageFirstValue",
|
|
@@ -11196,7 +11230,7 @@ var NodeType = superenum20({
|
|
|
11196
11230
|
y: "y",
|
|
11197
11231
|
yValue: "yValue",
|
|
11198
11232
|
zoomDisabled: "zoomDisabled"
|
|
11199
|
-
}
|
|
11233
|
+
};
|
|
11200
11234
|
|
|
11201
11235
|
// src/ast/Ast.ts
|
|
11202
11236
|
var Ast = class {
|
|
@@ -11379,7 +11413,7 @@ var Ast = class {
|
|
|
11379
11413
|
if (isParentArray && parentKey) {
|
|
11380
11414
|
astKey = `${parentKey}Value`;
|
|
11381
11415
|
}
|
|
11382
|
-
return NodeType.fromKey(astKey) || `unknown(${astKey})`;
|
|
11416
|
+
return Enum4(NodeType).fromKey(astKey) || `unknown(${astKey})`;
|
|
11383
11417
|
}
|
|
11384
11418
|
isArray(x) {
|
|
11385
11419
|
return Array.isArray(x);
|
|
@@ -11392,16 +11426,19 @@ var Ast = class {
|
|
|
11392
11426
|
}
|
|
11393
11427
|
};
|
|
11394
11428
|
|
|
11429
|
+
// src/ast/Builder.ts
|
|
11430
|
+
import { Enum as Enum7 } from "@ncoderz/superenum";
|
|
11431
|
+
|
|
11395
11432
|
// src/model/enum/TextLocation.ts
|
|
11396
|
-
import
|
|
11397
|
-
var TextLocation =
|
|
11433
|
+
import "@ncoderz/superenum";
|
|
11434
|
+
var TextLocation = {
|
|
11398
11435
|
tag: "tag",
|
|
11399
11436
|
body: "body"
|
|
11400
|
-
}
|
|
11437
|
+
};
|
|
11401
11438
|
|
|
11402
11439
|
// src/model/enum/BodyTextFormat.ts
|
|
11403
|
-
import
|
|
11404
|
-
var BodyTextFormat =
|
|
11440
|
+
import "@ncoderz/superenum";
|
|
11441
|
+
var BodyTextFormat = {
|
|
11405
11442
|
plainText: "text",
|
|
11406
11443
|
// plain text
|
|
11407
11444
|
latex: "latex",
|
|
@@ -11412,7 +11449,7 @@ var BodyTextFormat = superenum22({
|
|
|
11412
11449
|
// xml
|
|
11413
11450
|
// bitmark++ text
|
|
11414
11451
|
bitmarkPlusPlus: "bitmark++"
|
|
11415
|
-
}
|
|
11452
|
+
};
|
|
11416
11453
|
|
|
11417
11454
|
// src/breakscaping/RegexConfigs.ts
|
|
11418
11455
|
var REGEX_MARKS = /([*`_!=])(?=\1)/;
|
|
@@ -11661,11 +11698,11 @@ var Breakscape2 = class {
|
|
|
11661
11698
|
var instance3 = new Breakscape2();
|
|
11662
11699
|
|
|
11663
11700
|
// src/model/enum/DeprecatedTextFormat.ts
|
|
11664
|
-
import
|
|
11665
|
-
var DeprecatedTextFormat =
|
|
11701
|
+
import "@ncoderz/superenum";
|
|
11702
|
+
var DeprecatedTextFormat = {
|
|
11666
11703
|
bitmarkMinusMinus: "bitmark--"
|
|
11667
11704
|
// bitmark-- text format, deprecated
|
|
11668
|
-
}
|
|
11705
|
+
};
|
|
11669
11706
|
|
|
11670
11707
|
// src/parser/json/TableUtils.ts
|
|
11671
11708
|
function isTableBasicFormat(table) {
|
|
@@ -11824,14 +11861,14 @@ var ArrayUtils = class {
|
|
|
11824
11861
|
var instance4 = new ArrayUtils();
|
|
11825
11862
|
|
|
11826
11863
|
// src/generator/text/TextGenerator.ts
|
|
11827
|
-
import "@ncoderz/superenum";
|
|
11864
|
+
import { Enum as Enum5 } from "@ncoderz/superenum";
|
|
11828
11865
|
|
|
11829
11866
|
// src/model/enum/BitmarkVersion.ts
|
|
11830
|
-
import
|
|
11831
|
-
var BitmarkVersion =
|
|
11867
|
+
import "@ncoderz/superenum";
|
|
11868
|
+
var BitmarkVersion = {
|
|
11832
11869
|
v2: 2,
|
|
11833
11870
|
v3: 3
|
|
11834
|
-
}
|
|
11871
|
+
};
|
|
11835
11872
|
var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
|
|
11836
11873
|
|
|
11837
11874
|
// src/generator/AstWalkerGenerator.ts
|
|
@@ -12018,7 +12055,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12018
12055
|
__publicField(this, "preTextIndexTemp", -1);
|
|
12019
12056
|
__publicField(this, "havePreText", false);
|
|
12020
12057
|
__publicField(this, "preTextIndex", -1);
|
|
12021
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12058
|
+
this.bitmarkVersion = Enum5(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12022
12059
|
this.options = {
|
|
12023
12060
|
...DEFAULT_OPTIONS,
|
|
12024
12061
|
...options
|
|
@@ -22203,6 +22240,9 @@ var BitUtils = class {
|
|
|
22203
22240
|
};
|
|
22204
22241
|
var instance7 = new BitUtils();
|
|
22205
22242
|
|
|
22243
|
+
// src/ast/ResourceBuilder.ts
|
|
22244
|
+
import { Enum as Enum6 } from "@ncoderz/superenum";
|
|
22245
|
+
|
|
22206
22246
|
// src/utils/UrlUtils.ts
|
|
22207
22247
|
var UrlUtils = class {
|
|
22208
22248
|
fileExtensionFromUrl(url) {
|
|
@@ -22442,11 +22482,11 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22442
22482
|
const nodes = [];
|
|
22443
22483
|
if (!Array.isArray(resource)) resource = [resource];
|
|
22444
22484
|
for (const thisResource of resource) {
|
|
22445
|
-
let type = ResourceType.fromValue(thisResource.type);
|
|
22485
|
+
let type = Enum6(ResourceType).fromValue(thisResource.type);
|
|
22446
22486
|
if (!type) return void 0;
|
|
22447
|
-
const resourceKey = ResourceType.keyFromValue(type);
|
|
22487
|
+
const resourceKey = Enum6(ResourceType).keyFromValue(type);
|
|
22448
22488
|
if (!resourceKey) return void 0;
|
|
22449
|
-
const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
|
|
22489
|
+
const __typeAlias = Enum6(ResourceType).fromValue(thisResource.__typeAlias);
|
|
22450
22490
|
type = __typeAlias ?? type;
|
|
22451
22491
|
let data;
|
|
22452
22492
|
if (type === ResourceType.imageResponsive) {
|
|
@@ -22482,7 +22522,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22482
22522
|
}
|
|
22483
22523
|
resourceFromResourceDataJson(context, type, data) {
|
|
22484
22524
|
if (!data) return void 0;
|
|
22485
|
-
type = ResourceType.fromValue(type);
|
|
22525
|
+
type = Enum6(ResourceType).fromValue(type);
|
|
22486
22526
|
if (!type) return void 0;
|
|
22487
22527
|
const dataAsString = stringUtils.isString(data) ? data : void 0;
|
|
22488
22528
|
const url = data.url || data.src || data.body || dataAsString;
|
|
@@ -23595,8 +23635,8 @@ var Builder = class extends BaseBuilder {
|
|
|
23595
23635
|
data = structuredClone(data);
|
|
23596
23636
|
const bitType = data.bitType;
|
|
23597
23637
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
23598
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
|
|
23599
|
-
let textFormat = TextFormat.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23638
|
+
const deprecatedTextFormat = Enum7(DeprecatedTextFormat).fromValue(data.textFormat);
|
|
23639
|
+
let textFormat = Enum7(TextFormat).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23600
23640
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
23601
23641
|
textFormat = TextFormat.bitmarkText;
|
|
23602
23642
|
}
|
|
@@ -23619,7 +23659,7 @@ var Builder = class extends BaseBuilder {
|
|
|
23619
23659
|
bitType,
|
|
23620
23660
|
bitLevel: data.bitLevel,
|
|
23621
23661
|
textFormat,
|
|
23622
|
-
resourceType: ResourceType.fromValue(data.resourceType),
|
|
23662
|
+
resourceType: Enum7(ResourceType).fromValue(data.resourceType),
|
|
23623
23663
|
isCommented: data.isCommented,
|
|
23624
23664
|
// Properties
|
|
23625
23665
|
id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
|
|
@@ -23767,6 +23807,13 @@ var Builder = class extends BaseBuilder {
|
|
|
23767
23807
|
data.releaseDate,
|
|
23768
23808
|
options
|
|
23769
23809
|
),
|
|
23810
|
+
iframeSrc: this.toAstProperty(bitType, ConfigKey.property_iframeSrc, data.iframeSrc, options),
|
|
23811
|
+
iframeName: this.toAstProperty(
|
|
23812
|
+
bitType,
|
|
23813
|
+
ConfigKey.property_iframeName,
|
|
23814
|
+
data.iframeName,
|
|
23815
|
+
options
|
|
23816
|
+
),
|
|
23770
23817
|
book: this.buildBooks(context, data.book),
|
|
23771
23818
|
ageRange: this.toAstProperty(bitType, ConfigKey.property_ageRange, data.ageRange, options),
|
|
23772
23819
|
lang: this.toAstProperty(bitType, ConfigKey.property_lang, data.lang, options),
|
|
@@ -24937,14 +24984,14 @@ var Builder = class extends BaseBuilder {
|
|
|
24937
24984
|
response: data.response ?? "",
|
|
24938
24985
|
reaction: data.reaction ?? "",
|
|
24939
24986
|
feedback: data.feedback ?? "",
|
|
24940
|
-
item:
|
|
24987
|
+
item: data.item ?? "",
|
|
24941
24988
|
lead: this.handleJsonText(context, TextLocation.tag, data.lead),
|
|
24942
24989
|
hint: this.handleJsonText(context, TextLocation.tag, data.hint)
|
|
24943
24990
|
};
|
|
24944
24991
|
objectUtils.removeUnwantedProperties(node, {
|
|
24945
|
-
ignoreEmptyString: ["response", "reaction", "feedback"],
|
|
24992
|
+
ignoreEmptyString: ["response", "reaction", "feedback", "item"],
|
|
24946
24993
|
ignoreAllFalse: true,
|
|
24947
|
-
ignoreEmptyArrays: [
|
|
24994
|
+
ignoreEmptyArrays: [],
|
|
24948
24995
|
ignoreUndefined: ["example"]
|
|
24949
24996
|
});
|
|
24950
24997
|
return node;
|
|
@@ -26562,14 +26609,17 @@ var StringWriter = class {
|
|
|
26562
26609
|
};
|
|
26563
26610
|
|
|
26564
26611
|
// src/BitmarkParserGenerator.ts
|
|
26565
|
-
import {
|
|
26612
|
+
import { Enum as Enum23 } from "@ncoderz/superenum";
|
|
26613
|
+
|
|
26614
|
+
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26615
|
+
import { Enum as Enum8 } from "@ncoderz/superenum";
|
|
26566
26616
|
|
|
26567
26617
|
// src/model/enum/CardSetVersion.ts
|
|
26568
|
-
import
|
|
26569
|
-
var CardSetVersion =
|
|
26618
|
+
import "@ncoderz/superenum";
|
|
26619
|
+
var CardSetVersion = {
|
|
26570
26620
|
v1: 1,
|
|
26571
26621
|
v2: 2
|
|
26572
|
-
}
|
|
26622
|
+
};
|
|
26573
26623
|
|
|
26574
26624
|
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26575
26625
|
var DEFAULT_OPTIONS2 = {
|
|
@@ -26624,7 +26674,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
26624
26674
|
this.leaf = this.leaf.bind(this);
|
|
26625
26675
|
this.write = this.write.bind(this);
|
|
26626
26676
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
26627
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26677
|
+
this.bitmarkVersion = Enum8(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26628
26678
|
this.options = {
|
|
26629
26679
|
...DEFAULT_OPTIONS2,
|
|
26630
26680
|
...options?.bitmarkOptions
|
|
@@ -27186,7 +27236,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27186
27236
|
this.inTag = true;
|
|
27187
27237
|
}
|
|
27188
27238
|
bodyBitCallback(bodyBit, _index, _route) {
|
|
27189
|
-
const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27239
|
+
const nodeType = Enum8(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27190
27240
|
this.ast.walk(bodyBit, nodeType, this, void 0);
|
|
27191
27241
|
return "";
|
|
27192
27242
|
}
|
|
@@ -27731,6 +27781,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27731
27781
|
between_cardBits(_node, _left, _right, _route) {
|
|
27732
27782
|
this.writeCardSetCardDivider();
|
|
27733
27783
|
}
|
|
27784
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> item
|
|
27785
|
+
leaf_item(node, route) {
|
|
27786
|
+
const parent = this.getParentNode(route);
|
|
27787
|
+
if (parent?.key !== NodeType.botResponsesValue) return;
|
|
27788
|
+
this.writeNL();
|
|
27789
|
+
this.writeOPC();
|
|
27790
|
+
this.writeTextOrValue(node.value, TextFormat.plainText, TextLocation.tag);
|
|
27791
|
+
this.writeCL();
|
|
27792
|
+
}
|
|
27734
27793
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
27735
27794
|
leaf_response(node, route) {
|
|
27736
27795
|
const parent = this.getParentNode(route);
|
|
@@ -28392,8 +28451,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28392
28451
|
* Generate the handlers for resources, as they are mostly the same, but not quite
|
|
28393
28452
|
*/
|
|
28394
28453
|
generateResourceHandlers() {
|
|
28395
|
-
for (const tag of ResourceType.keys()) {
|
|
28396
|
-
if (tag === ResourceType.keyFromValue(ResourceType.unknown)) continue;
|
|
28454
|
+
for (const tag of Enum8(ResourceType).keys()) {
|
|
28455
|
+
if (tag === Enum8(ResourceType).keyFromValue(ResourceType.unknown)) continue;
|
|
28397
28456
|
const enterFuncName = `enter_${tag}`;
|
|
28398
28457
|
if (typeof this[enterFuncName] === "function") {
|
|
28399
28458
|
continue;
|
|
@@ -28403,8 +28462,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28403
28462
|
if (resource == null) return false;
|
|
28404
28463
|
const parent = this.getParentNode(route);
|
|
28405
28464
|
if (parent?.key !== NodeType.resourcesValue) return true;
|
|
28406
|
-
const alias = ResourceType.fromValue(parent
|
|
28407
|
-
const type = alias ?? ResourceType.fromValue(parent
|
|
28465
|
+
const alias = Enum8(ResourceType).fromValue(parent?.value.__typeAlias);
|
|
28466
|
+
const type = alias ?? Enum8(ResourceType).fromValue(parent?.value.type);
|
|
28408
28467
|
if (!type) return false;
|
|
28409
28468
|
const url = resource.url || resource.src || resource.body || "";
|
|
28410
28469
|
this.writeNL();
|
|
@@ -28418,7 +28477,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28418
28477
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
28419
28478
|
*/
|
|
28420
28479
|
generatePropertyHandlers() {
|
|
28421
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
28480
|
+
for (const propertyConfigKey of Enum8(PropertyKey).values()) {
|
|
28422
28481
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
28423
28482
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
28424
28483
|
for (const funcName of funcNames) {
|
|
@@ -28768,7 +28827,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28768
28827
|
}
|
|
28769
28828
|
writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
|
|
28770
28829
|
if (key && resource) {
|
|
28771
|
-
const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
|
|
28830
|
+
const resourceTag = Enum8(ResourceType).keyFromValue(resource.type) ?? "";
|
|
28772
28831
|
const resourceData = resource[resourceTag];
|
|
28773
28832
|
const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
|
|
28774
28833
|
if (deprecated_writeAsProperty) {
|
|
@@ -28853,7 +28912,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28853
28912
|
return true;
|
|
28854
28913
|
}
|
|
28855
28914
|
isWriteTextFormat(bitsValue, textFormatDefault) {
|
|
28856
|
-
const isDefault = TextFormat.fromValue(bitsValue) === textFormatDefault;
|
|
28915
|
+
const isDefault = Enum8(TextFormat).fromValue(bitsValue) === textFormatDefault;
|
|
28857
28916
|
const writeFormat = !isDefault || this.options.explicitTextFormat;
|
|
28858
28917
|
return !!writeFormat;
|
|
28859
28918
|
}
|
|
@@ -28945,6 +29004,7 @@ var BitmarkStringGenerator = class {
|
|
|
28945
29004
|
};
|
|
28946
29005
|
|
|
28947
29006
|
// src/generator/json/JsonGenerator.ts
|
|
29007
|
+
import { Enum as Enum9 } from "@ncoderz/superenum";
|
|
28948
29008
|
var MOVE_BODY_RECURSION_LIMIT = 5e3;
|
|
28949
29009
|
var DEFAULT_OPTIONS3 = {
|
|
28950
29010
|
// debugGenerationInline: true,
|
|
@@ -28981,7 +29041,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
28981
29041
|
this.exit = this.exit.bind(this);
|
|
28982
29042
|
this.leaf = this.leaf.bind(this);
|
|
28983
29043
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
28984
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29044
|
+
this.bitmarkVersion = Enum9(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
28985
29045
|
this.textParserVersion = this.textParser.version();
|
|
28986
29046
|
this.options = {
|
|
28987
29047
|
...DEFAULT_OPTIONS3,
|
|
@@ -29335,7 +29395,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29335
29395
|
throw new Error("Recursion limit exceeded");
|
|
29336
29396
|
}
|
|
29337
29397
|
for (const node of nodes) {
|
|
29338
|
-
if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
|
|
29398
|
+
if (node.type !== BodyBitType.text && Enum9(BodyBitType).values().includes(node.type)) {
|
|
29339
29399
|
const bodyBit = node;
|
|
29340
29400
|
bodyBit.attrs = {};
|
|
29341
29401
|
for (const [key, value] of Object.entries(bodyBit)) {
|
|
@@ -29622,7 +29682,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29622
29682
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
29623
29683
|
*/
|
|
29624
29684
|
generatePropertyHandlers() {
|
|
29625
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
29685
|
+
for (const propertyConfigKey of Enum9(PropertyKey).values()) {
|
|
29626
29686
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
29627
29687
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
29628
29688
|
for (const funcName of funcNames) {
|
|
@@ -29738,7 +29798,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29738
29798
|
for (const node of route) {
|
|
29739
29799
|
if (node.key === NodeType.bitsValue) {
|
|
29740
29800
|
const n = node.value;
|
|
29741
|
-
return TextFormat.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29801
|
+
return Enum9(TextFormat).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29742
29802
|
}
|
|
29743
29803
|
}
|
|
29744
29804
|
}
|
|
@@ -30287,12 +30347,13 @@ var JsonObjectGenerator = class {
|
|
|
30287
30347
|
};
|
|
30288
30348
|
|
|
30289
30349
|
// src/info/InfoBuilder.ts
|
|
30350
|
+
import { Enum as Enum10 } from "@ncoderz/superenum";
|
|
30290
30351
|
var InfoBuilder = class {
|
|
30291
30352
|
getSupportedBits(options) {
|
|
30292
30353
|
const includeNonDeprecated = options?.includeNonDeprecated ?? true;
|
|
30293
30354
|
const includeDeprecated = options?.includeDeprecated ?? false;
|
|
30294
30355
|
const supportedBits = [];
|
|
30295
|
-
for (const bt of BitType.values()) {
|
|
30356
|
+
for (const bt of Enum10(BitType).values()) {
|
|
30296
30357
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30297
30358
|
const bitType = instance2.getBitType(bt);
|
|
30298
30359
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
@@ -30311,7 +30372,7 @@ var InfoBuilder = class {
|
|
|
30311
30372
|
}
|
|
30312
30373
|
getSupportedBitConfigs() {
|
|
30313
30374
|
const res = [];
|
|
30314
|
-
for (const bt of BitType.values()) {
|
|
30375
|
+
for (const bt of Enum10(BitType).values()) {
|
|
30315
30376
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30316
30377
|
const bitType = instance2.getBitType(bt);
|
|
30317
30378
|
const config = instance2.getBitConfig(bitType);
|
|
@@ -30322,22 +30383,22 @@ var InfoBuilder = class {
|
|
|
30322
30383
|
};
|
|
30323
30384
|
|
|
30324
30385
|
// src/model/enum/BitmarkParserType.ts
|
|
30325
|
-
import
|
|
30326
|
-
var BitmarkParserType =
|
|
30386
|
+
import "@ncoderz/superenum";
|
|
30387
|
+
var BitmarkParserType = {
|
|
30327
30388
|
peggy: "peggy"
|
|
30328
|
-
}
|
|
30389
|
+
};
|
|
30329
30390
|
|
|
30330
30391
|
// src/model/info/enum/InfoFormat.ts
|
|
30331
|
-
import
|
|
30332
|
-
var InfoFormat =
|
|
30392
|
+
import "@ncoderz/superenum";
|
|
30393
|
+
var InfoFormat = {
|
|
30333
30394
|
text: "text",
|
|
30334
30395
|
json: "json",
|
|
30335
30396
|
pojo: "pojo"
|
|
30336
|
-
}
|
|
30397
|
+
};
|
|
30337
30398
|
|
|
30338
30399
|
// src/model/info/enum/InfoType.ts
|
|
30339
|
-
import
|
|
30340
|
-
var InfoType =
|
|
30400
|
+
import "@ncoderz/superenum";
|
|
30401
|
+
var InfoType = {
|
|
30341
30402
|
list: "list",
|
|
30342
30403
|
// List non-deprecated bits
|
|
30343
30404
|
deprecated: "deprecated",
|
|
@@ -30346,9 +30407,10 @@ var InfoType = superenum28({
|
|
|
30346
30407
|
// List all bits
|
|
30347
30408
|
bit: "bit"
|
|
30348
30409
|
// Get information for a bit
|
|
30349
|
-
}
|
|
30410
|
+
};
|
|
30350
30411
|
|
|
30351
30412
|
// src/parser/json/JsonParser.ts
|
|
30413
|
+
import { Enum as Enum11 } from "@ncoderz/superenum";
|
|
30352
30414
|
var builder = new Builder();
|
|
30353
30415
|
var JsonParser = class {
|
|
30354
30416
|
/**
|
|
@@ -30450,8 +30512,8 @@ var JsonParser = class {
|
|
|
30450
30512
|
const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
|
|
30451
30513
|
const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
|
|
30452
30514
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
30453
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
|
|
30454
|
-
let _textFormat = TextFormat.fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30515
|
+
const deprecatedTextFormat = Enum11(DeprecatedTextFormat).fromValue(bit.format);
|
|
30516
|
+
let _textFormat = Enum11(TextFormat).fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30455
30517
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
30456
30518
|
_textFormat = TextFormat.bitmarkText;
|
|
30457
30519
|
}
|
|
@@ -30528,7 +30590,7 @@ var JsonParser = class {
|
|
|
30528
30590
|
}
|
|
30529
30591
|
getResourceType(resource) {
|
|
30530
30592
|
if (resource) {
|
|
30531
|
-
const resourceKey = ResourceType.fromValue(resource.type);
|
|
30593
|
+
const resourceKey = Enum11(ResourceType).fromValue(resource.type);
|
|
30532
30594
|
return resourceKey;
|
|
30533
30595
|
}
|
|
30534
30596
|
return void 0;
|
|
@@ -30600,7 +30662,7 @@ var JsonParser = class {
|
|
|
30600
30662
|
};
|
|
30601
30663
|
|
|
30602
30664
|
// src/parser/bitmark/peg/BitmarkPegParserTypes.ts
|
|
30603
|
-
import
|
|
30665
|
+
import "@ncoderz/superenum";
|
|
30604
30666
|
|
|
30605
30667
|
// src/parser/bitmark/peg/PeggyGrammarLocation.ts
|
|
30606
30668
|
var PeggyGrammarLocation = class {
|
|
@@ -30680,7 +30742,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
|
|
|
30680
30742
|
var CARD_DIVIDER_V1 = "===";
|
|
30681
30743
|
var CARD_SIDE_DIVIDER_V1 = "==";
|
|
30682
30744
|
var CARD_VARIANT_DIVIDER_V1 = "--";
|
|
30683
|
-
var TypeKey =
|
|
30745
|
+
var TypeKey = {
|
|
30684
30746
|
// Bit header
|
|
30685
30747
|
TextFormat: "TextFormat",
|
|
30686
30748
|
ResourceType: "ResourceType",
|
|
@@ -30715,14 +30777,15 @@ var TypeKey = superenum29({
|
|
|
30715
30777
|
// Dividers
|
|
30716
30778
|
PlainTextDivider: "PlainTextDivider",
|
|
30717
30779
|
FooterDivider: "FooterDivider"
|
|
30718
|
-
}
|
|
30719
|
-
var ContentDepth =
|
|
30780
|
+
};
|
|
30781
|
+
var ContentDepth = {
|
|
30720
30782
|
Bit: "Bit",
|
|
30721
30783
|
Card: "Card",
|
|
30722
30784
|
Chain: "Chain"
|
|
30723
|
-
}
|
|
30785
|
+
};
|
|
30724
30786
|
|
|
30725
30787
|
// src/parser/bitmark/peg/BitmarkPegParserHelper.ts
|
|
30788
|
+
import { Enum as Enum12 } from "@ncoderz/superenum";
|
|
30726
30789
|
var ENABLE_DEBUG = true;
|
|
30727
30790
|
var DEBUG_DATA = true;
|
|
30728
30791
|
var DEBUG_DATA_INCLUDE_PARSER = false;
|
|
@@ -30816,7 +30879,7 @@ var BitmarkPegParserHelper = class {
|
|
|
30816
30879
|
if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
|
|
30817
30880
|
return {
|
|
30818
30881
|
type,
|
|
30819
|
-
key: Tag.fromValue(type),
|
|
30882
|
+
key: Enum12(Tag).fromValue(type),
|
|
30820
30883
|
value,
|
|
30821
30884
|
parser: {
|
|
30822
30885
|
text: this.parserText(),
|
|
@@ -31211,7 +31274,7 @@ var BitmarkPegParserHelper = class {
|
|
|
31211
31274
|
if (!value) return false;
|
|
31212
31275
|
const { type } = value;
|
|
31213
31276
|
if (!validType) {
|
|
31214
|
-
return !!TypeKey.fromValue(type);
|
|
31277
|
+
return !!Enum12(TypeKey).fromValue(type);
|
|
31215
31278
|
}
|
|
31216
31279
|
if (Array.isArray(validType)) {
|
|
31217
31280
|
return validType.indexOf(type) >= 0;
|
|
@@ -31295,7 +31358,11 @@ var BitmarkPegParserHelper = class {
|
|
|
31295
31358
|
}
|
|
31296
31359
|
};
|
|
31297
31360
|
|
|
31361
|
+
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31362
|
+
import { Enum as Enum21 } from "@ncoderz/superenum";
|
|
31363
|
+
|
|
31298
31364
|
// src/parser/bitmark/peg/BitmarkPegParserValidator.ts
|
|
31365
|
+
import { Enum as Enum13 } from "@ncoderz/superenum";
|
|
31299
31366
|
var COMMON_MISTAKE_STRINGS = [
|
|
31300
31367
|
// Card divider errors
|
|
31301
31368
|
"----",
|
|
@@ -31467,7 +31534,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31467
31534
|
const content = dataOrNull[i];
|
|
31468
31535
|
if (!content) continue;
|
|
31469
31536
|
const { type, key } = content;
|
|
31470
|
-
let typeKey = TypeKey.fromValue(type);
|
|
31537
|
+
let typeKey = Enum13(TypeKey).fromValue(type);
|
|
31471
31538
|
if (!typeKey) continue;
|
|
31472
31539
|
let validTypeKey = typeKey;
|
|
31473
31540
|
if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
|
|
@@ -31890,7 +31957,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31890
31957
|
} else if (tagValidationData.isResource) {
|
|
31891
31958
|
res.set(v.configKey, tagValidationData);
|
|
31892
31959
|
} else {
|
|
31893
|
-
const typeKey = TypeKey.fromValue(v.tag);
|
|
31960
|
+
const typeKey = Enum13(TypeKey).fromValue(v.tag);
|
|
31894
31961
|
if (typeKey) {
|
|
31895
31962
|
res.set(typeKey, tagValidationData);
|
|
31896
31963
|
}
|
|
@@ -32903,12 +32970,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
32903
32970
|
for (const card of cardSet.cards) {
|
|
32904
32971
|
for (const side of card.sides) {
|
|
32905
32972
|
for (const content of side.variants) {
|
|
32906
|
-
const {
|
|
32973
|
+
const {
|
|
32974
|
+
__instructionString,
|
|
32975
|
+
__itemString,
|
|
32976
|
+
reaction,
|
|
32977
|
+
cardBodyStr: feedback,
|
|
32978
|
+
...tags2
|
|
32979
|
+
} = content.data;
|
|
32907
32980
|
const botResponse = {
|
|
32908
32981
|
response: __instructionString ?? instance3.EMPTY_STRING,
|
|
32909
32982
|
reaction: reaction ?? instance3.EMPTY_STRING,
|
|
32910
32983
|
feedback: feedback ?? instance3.EMPTY_STRING,
|
|
32911
|
-
...tags2
|
|
32984
|
+
...tags2,
|
|
32985
|
+
item: __itemString ?? instance3.EMPTY_STRING
|
|
32912
32986
|
};
|
|
32913
32987
|
if (botResponse) botResponses.push(botResponse);
|
|
32914
32988
|
}
|
|
@@ -33144,6 +33218,9 @@ var FooterContentProcessor = class {
|
|
|
33144
33218
|
};
|
|
33145
33219
|
var instance12 = new FooterContentProcessor();
|
|
33146
33220
|
|
|
33221
|
+
// src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
|
|
33222
|
+
import { Enum as Enum14 } from "@ncoderz/superenum";
|
|
33223
|
+
|
|
33147
33224
|
// src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
|
|
33148
33225
|
var textParser4 = new TextParser();
|
|
33149
33226
|
function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
@@ -33179,7 +33256,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33179
33256
|
}
|
|
33180
33257
|
function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
33181
33258
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
|
|
33182
|
-
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33259
|
+
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Enum14(Tag).fromValue(content.type));
|
|
33183
33260
|
const chainContent = [content, ...content.chain ?? []];
|
|
33184
33261
|
const chainTags = context.bitContentProcessor(
|
|
33185
33262
|
ContentDepth.Chain,
|
|
@@ -33194,6 +33271,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
|
33194
33271
|
return gap;
|
|
33195
33272
|
}
|
|
33196
33273
|
|
|
33274
|
+
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
33275
|
+
import { Enum as Enum15 } from "@ncoderz/superenum";
|
|
33276
|
+
|
|
33197
33277
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
|
|
33198
33278
|
function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
33199
33279
|
const { textFormat } = context;
|
|
@@ -33206,6 +33286,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
|
|
|
33206
33286
|
location: TextLocation.tag
|
|
33207
33287
|
});
|
|
33208
33288
|
target.itemLead.push(text);
|
|
33289
|
+
if (!target.__itemLeadString) target.__itemLeadString = [];
|
|
33290
|
+
target.__itemLeadString.push(
|
|
33291
|
+
instance3.unbreakscape(trimmedStringValue, {
|
|
33292
|
+
format: TextFormat.bitmarkText,
|
|
33293
|
+
location: TextLocation.tag
|
|
33294
|
+
})
|
|
33295
|
+
);
|
|
33209
33296
|
}
|
|
33210
33297
|
|
|
33211
33298
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
@@ -33218,7 +33305,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
|
|
|
33218
33305
|
}
|
|
33219
33306
|
function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
33220
33307
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
|
|
33221
|
-
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33308
|
+
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum15(Tag).fromValue(content.type));
|
|
33222
33309
|
const chainContent = [content, ...content.chain ?? []];
|
|
33223
33310
|
const chainTags = context.bitContentProcessor(
|
|
33224
33311
|
ContentDepth.Chain,
|
|
@@ -33227,8 +33314,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
|
33227
33314
|
);
|
|
33228
33315
|
if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
|
|
33229
33316
|
target.itemLead = chainTags.itemLead;
|
|
33317
|
+
target.__itemLeadString = chainTags.__itemLeadString;
|
|
33230
33318
|
}
|
|
33231
33319
|
|
|
33320
|
+
// src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
|
|
33321
|
+
import { Enum as Enum16 } from "@ncoderz/superenum";
|
|
33322
|
+
|
|
33232
33323
|
// src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
|
|
33233
33324
|
function markTagContentProcessor(_context, _contentDepth, content, target) {
|
|
33234
33325
|
const { value } = content;
|
|
@@ -33253,7 +33344,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
|
|
|
33253
33344
|
}
|
|
33254
33345
|
function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
33255
33346
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33256
|
-
const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33347
|
+
const markConfig = instance2.getTagConfigForTag(tagsConfig, Enum16(Tag).fromValue(content.type));
|
|
33257
33348
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33258
33349
|
const chainTags = context.bitContentProcessor(
|
|
33259
33350
|
ContentDepth.Chain,
|
|
@@ -33272,6 +33363,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
|
33272
33363
|
return mark;
|
|
33273
33364
|
}
|
|
33274
33365
|
|
|
33366
|
+
// src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
|
|
33367
|
+
import { Enum as Enum19 } from "@ncoderz/superenum";
|
|
33368
|
+
|
|
33275
33369
|
// src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
|
|
33276
33370
|
function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33277
33371
|
if (contentDepth === ContentDepth.Chain) {
|
|
@@ -33446,6 +33540,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
|
|
|
33446
33540
|
}
|
|
33447
33541
|
|
|
33448
33542
|
// src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
|
|
33543
|
+
import { Enum as Enum17 } from "@ncoderz/superenum";
|
|
33449
33544
|
function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33450
33545
|
if (contentDepth === ContentDepth.Chain) {
|
|
33451
33546
|
imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
|
|
@@ -33464,7 +33559,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
|
|
|
33464
33559
|
function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
|
|
33465
33560
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
|
|
33466
33561
|
const { key: tag } = content;
|
|
33467
|
-
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33562
|
+
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, Enum17(ConfigKey).fromValue(tag));
|
|
33468
33563
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33469
33564
|
const chainTags = context.bitContentProcessor(
|
|
33470
33565
|
ContentDepth.Chain,
|
|
@@ -33498,12 +33593,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
|
|
|
33498
33593
|
}
|
|
33499
33594
|
|
|
33500
33595
|
// src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
|
|
33596
|
+
import { Enum as Enum18 } from "@ncoderz/superenum";
|
|
33501
33597
|
function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|
|
33502
33598
|
const { key: tag } = content;
|
|
33503
33599
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33504
33600
|
const markConfig = target.markConfig;
|
|
33505
33601
|
if (!markConfig) return;
|
|
33506
|
-
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33602
|
+
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, Enum18(ConfigKey).fromValue(tag));
|
|
33507
33603
|
const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
|
|
33508
33604
|
ContentDepth.Chain,
|
|
33509
33605
|
markTagConfig?.chain,
|
|
@@ -33636,7 +33732,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33636
33732
|
const { value } = content;
|
|
33637
33733
|
const { key: keyIn } = content;
|
|
33638
33734
|
const isChain = contentDepth === ContentDepth.Chain;
|
|
33639
|
-
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
|
|
33735
|
+
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, Enum19(PropertyKey).fromValue(keyIn));
|
|
33640
33736
|
const configKey = propertyConfig ? propertyConfig.configKey : void 0;
|
|
33641
33737
|
let property = configKeyToPropertyType(keyIn);
|
|
33642
33738
|
if (configKey === ConfigKey.property_internalComment) {
|
|
@@ -33793,12 +33889,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
|
|
|
33793
33889
|
}
|
|
33794
33890
|
|
|
33795
33891
|
// src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
|
|
33892
|
+
import { Enum as Enum20 } from "@ncoderz/superenum";
|
|
33796
33893
|
var resourceBuilder = new ResourceBuilder();
|
|
33797
33894
|
function buildResources(context, resourceTypeAttachment, resources) {
|
|
33798
33895
|
const { bitType } = context;
|
|
33799
33896
|
const filteredResources = [];
|
|
33800
33897
|
const excessResources = [];
|
|
33801
|
-
const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
|
|
33898
|
+
const validatedResourceTypeAttachemnt = Enum20(ResourceType).fromValue(resourceTypeAttachment);
|
|
33802
33899
|
const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
|
|
33803
33900
|
const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
|
|
33804
33901
|
const countsMin = resourcesConfig.getCountsMin();
|
|
@@ -33842,9 +33939,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
|
|
|
33842
33939
|
const { type: _ignoreType, key, value, chain } = content;
|
|
33843
33940
|
const resources = target.resources;
|
|
33844
33941
|
if (!resources) return;
|
|
33845
|
-
const configKey = ConfigKey.fromValue(key);
|
|
33942
|
+
const configKey = Enum20(ConfigKey).fromValue(key);
|
|
33846
33943
|
if (!configKey) return;
|
|
33847
|
-
const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33944
|
+
const resourceType = Enum20(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33848
33945
|
const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
|
|
33849
33946
|
const { posterImage, ...tags2 } = context.bitContentProcessor(
|
|
33850
33947
|
ContentDepth.Chain,
|
|
@@ -34340,14 +34437,14 @@ var BitmarkPegParserProcessor = class {
|
|
|
34340
34437
|
);
|
|
34341
34438
|
bitLevel = instance2.bitLevelMin;
|
|
34342
34439
|
}
|
|
34343
|
-
let textFormat = TextFormat.fromValue(textFormatAndResourceType.textFormat);
|
|
34440
|
+
let textFormat = Enum21(TextFormat).fromValue(textFormatAndResourceType.textFormat);
|
|
34344
34441
|
const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
|
|
34345
34442
|
if (isInvalidTextFormat) {
|
|
34346
34443
|
this.addWarning(
|
|
34347
34444
|
`Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
|
|
34348
34445
|
);
|
|
34349
34446
|
}
|
|
34350
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
|
|
34447
|
+
const deprecatedTextFormat = Enum21(DeprecatedTextFormat).fromValue(
|
|
34351
34448
|
textFormatAndResourceType.textFormat
|
|
34352
34449
|
);
|
|
34353
34450
|
if (deprecatedTextFormat) {
|
|
@@ -34357,7 +34454,7 @@ var BitmarkPegParserProcessor = class {
|
|
|
34357
34454
|
);
|
|
34358
34455
|
}
|
|
34359
34456
|
textFormat = textFormat ?? bitConfig.textFormatDefault;
|
|
34360
|
-
const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
|
|
34457
|
+
const resourceType = Enum21(ResourceType).fromValue(textFormatAndResourceType.resourceType);
|
|
34361
34458
|
if (textFormatAndResourceType.resourceType && !resourceType) {
|
|
34362
34459
|
this.addWarning(
|
|
34363
34460
|
`Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
|
|
@@ -34611,6 +34708,13 @@ var BitmarkPegParserProcessor = class {
|
|
|
34611
34708
|
if (l > 2) result.pageNumber = result.itemLead[2];
|
|
34612
34709
|
if (l > 3) result.marginNumber = result.itemLead[l - 1];
|
|
34613
34710
|
}
|
|
34711
|
+
if (result.__itemLeadString) {
|
|
34712
|
+
const l = result.__itemLeadString.length;
|
|
34713
|
+
if (l > 0) result.__itemString = result.__itemLeadString[0];
|
|
34714
|
+
if (l > 1) result.__leadString = result.__itemLeadString[1];
|
|
34715
|
+
if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
|
|
34716
|
+
if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
|
|
34717
|
+
}
|
|
34614
34718
|
if (inBit) {
|
|
34615
34719
|
result.body = instance11.process(
|
|
34616
34720
|
this.context,
|
|
@@ -38499,6 +38603,7 @@ var JsonFileGenerator = class {
|
|
|
38499
38603
|
|
|
38500
38604
|
// src/info/ConfigBuilder.ts
|
|
38501
38605
|
import path3 from "path";
|
|
38606
|
+
import { Enum as Enum22 } from "@ncoderz/superenum";
|
|
38502
38607
|
import fs3 from "fs-extra";
|
|
38503
38608
|
var ConfigBuilder = class {
|
|
38504
38609
|
build(options) {
|
|
@@ -38508,7 +38613,7 @@ var ConfigBuilder = class {
|
|
|
38508
38613
|
const groupConfigs = [];
|
|
38509
38614
|
const bitGroupConfigKeys = [];
|
|
38510
38615
|
const bitGroupConfigs = [];
|
|
38511
|
-
for (const bt of BitType.values()) {
|
|
38616
|
+
for (const bt of Enum22(BitType).values()) {
|
|
38512
38617
|
const bitType = instance2.getBitType(bt);
|
|
38513
38618
|
const _bitConfig = BITS[bitType];
|
|
38514
38619
|
if (_bitConfig) {
|
|
@@ -38790,7 +38895,7 @@ var ConfigBuilder = class {
|
|
|
38790
38895
|
buildFlat(options) {
|
|
38791
38896
|
const opts = Object.assign({}, options);
|
|
38792
38897
|
const bitConfigs = [];
|
|
38793
|
-
for (const bt of BitType.values()) {
|
|
38898
|
+
for (const bt of Enum22(BitType).values()) {
|
|
38794
38899
|
const bitType = instance2.getBitType(bt);
|
|
38795
38900
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
38796
38901
|
if (bitConfig) bitConfigs.push(bitConfig);
|
|
@@ -38901,7 +39006,7 @@ var ConfigBuilder = class {
|
|
|
38901
39006
|
};
|
|
38902
39007
|
|
|
38903
39008
|
// src/BitmarkParserGenerator.ts
|
|
38904
|
-
var Input =
|
|
39009
|
+
var Input = {
|
|
38905
39010
|
/**
|
|
38906
39011
|
* Input is as a string
|
|
38907
39012
|
*/
|
|
@@ -38910,8 +39015,8 @@ var Input = superenum30({
|
|
|
38910
39015
|
* Input is as a file path
|
|
38911
39016
|
*/
|
|
38912
39017
|
file: "file"
|
|
38913
|
-
}
|
|
38914
|
-
var Output =
|
|
39018
|
+
};
|
|
39019
|
+
var Output = {
|
|
38915
39020
|
/**
|
|
38916
39021
|
* Output bitmark string
|
|
38917
39022
|
*/
|
|
@@ -38924,7 +39029,7 @@ var Output = superenum30({
|
|
|
38924
39029
|
* Output AST as a plain JS object, or a file
|
|
38925
39030
|
*/
|
|
38926
39031
|
ast: "ast"
|
|
38927
|
-
}
|
|
39032
|
+
};
|
|
38928
39033
|
var BitmarkParserGenerator = class {
|
|
38929
39034
|
constructor() {
|
|
38930
39035
|
__publicField(this, "ast", new Ast());
|
|
@@ -39309,7 +39414,7 @@ var BitmarkParserGenerator = class {
|
|
|
39309
39414
|
const opts = Object.assign({}, options);
|
|
39310
39415
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39311
39416
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
39312
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39417
|
+
const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39313
39418
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39314
39419
|
let inStr = input;
|
|
39315
39420
|
const inputIsString = typeof input === "string";
|
|
@@ -39377,7 +39482,7 @@ var BitmarkParserGenerator = class {
|
|
|
39377
39482
|
if (!input) return input;
|
|
39378
39483
|
const opts = Object.assign({}, options);
|
|
39379
39484
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39380
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39485
|
+
const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39381
39486
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39382
39487
|
let inStr = input;
|
|
39383
39488
|
const inputIsString = typeof input === "string";
|
|
@@ -39430,7 +39535,7 @@ var BitmarkParserGenerator = class {
|
|
|
39430
39535
|
if (!input) return input;
|
|
39431
39536
|
const opts = Object.assign({}, options);
|
|
39432
39537
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39433
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39538
|
+
const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39434
39539
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39435
39540
|
let inStr = input;
|
|
39436
39541
|
const inputIsString = typeof input === "string";
|
|
@@ -39540,6 +39645,8 @@ export {
|
|
|
39540
39645
|
ResourceBuilder,
|
|
39541
39646
|
StreamWriter,
|
|
39542
39647
|
StringWriter,
|
|
39648
|
+
TextMarkType,
|
|
39649
|
+
TextNodeType,
|
|
39543
39650
|
parse as bitmarkTextParse
|
|
39544
39651
|
};
|
|
39545
39652
|
//# sourceMappingURL=index.js.map
|