@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
|
@@ -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 TextFormat2 =
|
|
687
|
+
import "@ncoderz/superenum";
|
|
688
|
+
var TextFormat2 = {
|
|
684
689
|
// plain text
|
|
685
690
|
plainText: "text",
|
|
686
691
|
latex: "latex",
|
|
@@ -692,11 +697,11 @@ var TextFormat2 = 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 TextLocation2 =
|
|
11433
|
+
import "@ncoderz/superenum";
|
|
11434
|
+
var TextLocation2 = {
|
|
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 Breakscape3 = class {
|
|
|
11661
11698
|
var instance3 = new Breakscape3();
|
|
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 = TextFormat2.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23638
|
+
const deprecatedTextFormat = Enum7(DeprecatedTextFormat).fromValue(data.textFormat);
|
|
23639
|
+
let textFormat = Enum7(TextFormat2).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23600
23640
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
23601
23641
|
textFormat = TextFormat2.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, TextLocation2.tag, data.lead),
|
|
24942
24989
|
hint: this.handleJsonText(context, TextLocation2.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 Enum22 } 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, TextFormat2.plainText, TextLocation2.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 = TextFormat2.fromValue(bitsValue) === textFormatDefault;
|
|
28915
|
+
const isDefault = Enum8(TextFormat2).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 TextFormat2.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29801
|
+
return Enum9(TextFormat2).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 = TextFormat2.fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30515
|
+
const deprecatedTextFormat = Enum11(DeprecatedTextFormat).fromValue(bit.format);
|
|
30516
|
+
let _textFormat = Enum11(TextFormat2).fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30455
30517
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
30456
30518
|
_textFormat = TextFormat2.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 DEBUG_TRACE_RAW_BIT = true;
|
|
30727
30790
|
var DEBUG_TRACE_TEXT_FORMAT = false;
|
|
30728
30791
|
var DEBUG_TRACE_RESOURCE_TYPE = false;
|
|
@@ -30812,7 +30875,7 @@ var BitmarkPegParserHelper = class {
|
|
|
30812
30875
|
if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
|
|
30813
30876
|
return {
|
|
30814
30877
|
type,
|
|
30815
|
-
key: Tag.fromValue(type),
|
|
30878
|
+
key: Enum12(Tag).fromValue(type),
|
|
30816
30879
|
value,
|
|
30817
30880
|
parser: {
|
|
30818
30881
|
text: this.parserText(),
|
|
@@ -31207,7 +31270,7 @@ var BitmarkPegParserHelper = class {
|
|
|
31207
31270
|
if (!value) return false;
|
|
31208
31271
|
const { type } = value;
|
|
31209
31272
|
if (!validType) {
|
|
31210
|
-
return !!TypeKey.fromValue(type);
|
|
31273
|
+
return !!Enum12(TypeKey).fromValue(type);
|
|
31211
31274
|
}
|
|
31212
31275
|
if (Array.isArray(validType)) {
|
|
31213
31276
|
return validType.indexOf(type) >= 0;
|
|
@@ -31277,7 +31340,11 @@ var BitmarkPegParserHelper = class {
|
|
|
31277
31340
|
}
|
|
31278
31341
|
};
|
|
31279
31342
|
|
|
31343
|
+
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31344
|
+
import { Enum as Enum21 } from "@ncoderz/superenum";
|
|
31345
|
+
|
|
31280
31346
|
// src/parser/bitmark/peg/BitmarkPegParserValidator.ts
|
|
31347
|
+
import { Enum as Enum13 } from "@ncoderz/superenum";
|
|
31281
31348
|
var COMMON_MISTAKE_STRINGS = [
|
|
31282
31349
|
// Card divider errors
|
|
31283
31350
|
"----",
|
|
@@ -31449,7 +31516,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31449
31516
|
const content = dataOrNull[i];
|
|
31450
31517
|
if (!content) continue;
|
|
31451
31518
|
const { type, key } = content;
|
|
31452
|
-
let typeKey = TypeKey.fromValue(type);
|
|
31519
|
+
let typeKey = Enum13(TypeKey).fromValue(type);
|
|
31453
31520
|
if (!typeKey) continue;
|
|
31454
31521
|
let validTypeKey = typeKey;
|
|
31455
31522
|
if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
|
|
@@ -31872,7 +31939,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31872
31939
|
} else if (tagValidationData.isResource) {
|
|
31873
31940
|
res.set(v.configKey, tagValidationData);
|
|
31874
31941
|
} else {
|
|
31875
|
-
const typeKey = TypeKey.fromValue(v.tag);
|
|
31942
|
+
const typeKey = Enum13(TypeKey).fromValue(v.tag);
|
|
31876
31943
|
if (typeKey) {
|
|
31877
31944
|
res.set(typeKey, tagValidationData);
|
|
31878
31945
|
}
|
|
@@ -32885,12 +32952,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
32885
32952
|
for (const card of cardSet.cards) {
|
|
32886
32953
|
for (const side of card.sides) {
|
|
32887
32954
|
for (const content of side.variants) {
|
|
32888
|
-
const {
|
|
32955
|
+
const {
|
|
32956
|
+
__instructionString,
|
|
32957
|
+
__itemString,
|
|
32958
|
+
reaction,
|
|
32959
|
+
cardBodyStr: feedback,
|
|
32960
|
+
...tags2
|
|
32961
|
+
} = content.data;
|
|
32889
32962
|
const botResponse = {
|
|
32890
32963
|
response: __instructionString ?? instance3.EMPTY_STRING,
|
|
32891
32964
|
reaction: reaction ?? instance3.EMPTY_STRING,
|
|
32892
32965
|
feedback: feedback ?? instance3.EMPTY_STRING,
|
|
32893
|
-
...tags2
|
|
32966
|
+
...tags2,
|
|
32967
|
+
item: __itemString ?? instance3.EMPTY_STRING
|
|
32894
32968
|
};
|
|
32895
32969
|
if (botResponse) botResponses.push(botResponse);
|
|
32896
32970
|
}
|
|
@@ -33126,6 +33200,9 @@ var FooterContentProcessor = class {
|
|
|
33126
33200
|
};
|
|
33127
33201
|
var instance12 = new FooterContentProcessor();
|
|
33128
33202
|
|
|
33203
|
+
// src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
|
|
33204
|
+
import { Enum as Enum14 } from "@ncoderz/superenum";
|
|
33205
|
+
|
|
33129
33206
|
// src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
|
|
33130
33207
|
var textParser4 = new TextParser();
|
|
33131
33208
|
function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
@@ -33161,7 +33238,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33161
33238
|
}
|
|
33162
33239
|
function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
33163
33240
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
|
|
33164
|
-
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33241
|
+
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Enum14(Tag).fromValue(content.type));
|
|
33165
33242
|
const chainContent = [content, ...content.chain ?? []];
|
|
33166
33243
|
const chainTags = context.bitContentProcessor(
|
|
33167
33244
|
ContentDepth.Chain,
|
|
@@ -33176,6 +33253,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
|
33176
33253
|
return gap;
|
|
33177
33254
|
}
|
|
33178
33255
|
|
|
33256
|
+
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
33257
|
+
import { Enum as Enum15 } from "@ncoderz/superenum";
|
|
33258
|
+
|
|
33179
33259
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
|
|
33180
33260
|
function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
33181
33261
|
const { textFormat } = context;
|
|
@@ -33188,6 +33268,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
|
|
|
33188
33268
|
location: TextLocation2.tag
|
|
33189
33269
|
});
|
|
33190
33270
|
target.itemLead.push(text);
|
|
33271
|
+
if (!target.__itemLeadString) target.__itemLeadString = [];
|
|
33272
|
+
target.__itemLeadString.push(
|
|
33273
|
+
instance3.unbreakscape(trimmedStringValue, {
|
|
33274
|
+
format: TextFormat2.bitmarkText,
|
|
33275
|
+
location: TextLocation2.tag
|
|
33276
|
+
})
|
|
33277
|
+
);
|
|
33191
33278
|
}
|
|
33192
33279
|
|
|
33193
33280
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
@@ -33200,7 +33287,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
|
|
|
33200
33287
|
}
|
|
33201
33288
|
function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
33202
33289
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
|
|
33203
|
-
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33290
|
+
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum15(Tag).fromValue(content.type));
|
|
33204
33291
|
const chainContent = [content, ...content.chain ?? []];
|
|
33205
33292
|
const chainTags = context.bitContentProcessor(
|
|
33206
33293
|
ContentDepth.Chain,
|
|
@@ -33209,8 +33296,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
|
33209
33296
|
);
|
|
33210
33297
|
if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
|
|
33211
33298
|
target.itemLead = chainTags.itemLead;
|
|
33299
|
+
target.__itemLeadString = chainTags.__itemLeadString;
|
|
33212
33300
|
}
|
|
33213
33301
|
|
|
33302
|
+
// src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
|
|
33303
|
+
import { Enum as Enum16 } from "@ncoderz/superenum";
|
|
33304
|
+
|
|
33214
33305
|
// src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
|
|
33215
33306
|
function markTagContentProcessor(_context, _contentDepth, content, target) {
|
|
33216
33307
|
const { value } = content;
|
|
@@ -33235,7 +33326,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
|
|
|
33235
33326
|
}
|
|
33236
33327
|
function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
33237
33328
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33238
|
-
const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33329
|
+
const markConfig = instance2.getTagConfigForTag(tagsConfig, Enum16(Tag).fromValue(content.type));
|
|
33239
33330
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33240
33331
|
const chainTags = context.bitContentProcessor(
|
|
33241
33332
|
ContentDepth.Chain,
|
|
@@ -33254,6 +33345,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
|
33254
33345
|
return mark;
|
|
33255
33346
|
}
|
|
33256
33347
|
|
|
33348
|
+
// src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
|
|
33349
|
+
import { Enum as Enum19 } from "@ncoderz/superenum";
|
|
33350
|
+
|
|
33257
33351
|
// src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
|
|
33258
33352
|
function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33259
33353
|
if (contentDepth === ContentDepth.Chain) {
|
|
@@ -33428,6 +33522,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
|
|
|
33428
33522
|
}
|
|
33429
33523
|
|
|
33430
33524
|
// src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
|
|
33525
|
+
import { Enum as Enum17 } from "@ncoderz/superenum";
|
|
33431
33526
|
function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33432
33527
|
if (contentDepth === ContentDepth.Chain) {
|
|
33433
33528
|
imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
|
|
@@ -33446,7 +33541,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
|
|
|
33446
33541
|
function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
|
|
33447
33542
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
|
|
33448
33543
|
const { key: tag } = content;
|
|
33449
|
-
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33544
|
+
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, Enum17(ConfigKey).fromValue(tag));
|
|
33450
33545
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33451
33546
|
const chainTags = context.bitContentProcessor(
|
|
33452
33547
|
ContentDepth.Chain,
|
|
@@ -33480,12 +33575,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
|
|
|
33480
33575
|
}
|
|
33481
33576
|
|
|
33482
33577
|
// src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
|
|
33578
|
+
import { Enum as Enum18 } from "@ncoderz/superenum";
|
|
33483
33579
|
function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|
|
33484
33580
|
const { key: tag } = content;
|
|
33485
33581
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33486
33582
|
const markConfig = target.markConfig;
|
|
33487
33583
|
if (!markConfig) return;
|
|
33488
|
-
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33584
|
+
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, Enum18(ConfigKey).fromValue(tag));
|
|
33489
33585
|
const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
|
|
33490
33586
|
ContentDepth.Chain,
|
|
33491
33587
|
markTagConfig?.chain,
|
|
@@ -33618,7 +33714,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33618
33714
|
const { value } = content;
|
|
33619
33715
|
const { key: keyIn } = content;
|
|
33620
33716
|
const isChain = contentDepth === ContentDepth.Chain;
|
|
33621
|
-
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
|
|
33717
|
+
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, Enum19(PropertyKey).fromValue(keyIn));
|
|
33622
33718
|
const configKey = propertyConfig ? propertyConfig.configKey : void 0;
|
|
33623
33719
|
let property = configKeyToPropertyType(keyIn);
|
|
33624
33720
|
if (configKey === ConfigKey.property_internalComment) {
|
|
@@ -33775,12 +33871,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
|
|
|
33775
33871
|
}
|
|
33776
33872
|
|
|
33777
33873
|
// src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
|
|
33874
|
+
import { Enum as Enum20 } from "@ncoderz/superenum";
|
|
33778
33875
|
var resourceBuilder = new ResourceBuilder();
|
|
33779
33876
|
function buildResources(context, resourceTypeAttachment, resources) {
|
|
33780
33877
|
const { bitType } = context;
|
|
33781
33878
|
const filteredResources = [];
|
|
33782
33879
|
const excessResources = [];
|
|
33783
|
-
const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
|
|
33880
|
+
const validatedResourceTypeAttachemnt = Enum20(ResourceType).fromValue(resourceTypeAttachment);
|
|
33784
33881
|
const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
|
|
33785
33882
|
const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
|
|
33786
33883
|
const countsMin = resourcesConfig.getCountsMin();
|
|
@@ -33824,9 +33921,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
|
|
|
33824
33921
|
const { type: _ignoreType, key, value, chain } = content;
|
|
33825
33922
|
const resources = target.resources;
|
|
33826
33923
|
if (!resources) return;
|
|
33827
|
-
const configKey = ConfigKey.fromValue(key);
|
|
33924
|
+
const configKey = Enum20(ConfigKey).fromValue(key);
|
|
33828
33925
|
if (!configKey) return;
|
|
33829
|
-
const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33926
|
+
const resourceType = Enum20(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33830
33927
|
const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
|
|
33831
33928
|
const { posterImage, ...tags2 } = context.bitContentProcessor(
|
|
33832
33929
|
ContentDepth.Chain,
|
|
@@ -34318,14 +34415,14 @@ var BitmarkPegParserProcessor = class {
|
|
|
34318
34415
|
);
|
|
34319
34416
|
bitLevel = instance2.bitLevelMin;
|
|
34320
34417
|
}
|
|
34321
|
-
let textFormat = TextFormat2.fromValue(textFormatAndResourceType.textFormat);
|
|
34418
|
+
let textFormat = Enum21(TextFormat2).fromValue(textFormatAndResourceType.textFormat);
|
|
34322
34419
|
const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
|
|
34323
34420
|
if (isInvalidTextFormat) {
|
|
34324
34421
|
this.addWarning(
|
|
34325
34422
|
`Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
|
|
34326
34423
|
);
|
|
34327
34424
|
}
|
|
34328
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
|
|
34425
|
+
const deprecatedTextFormat = Enum21(DeprecatedTextFormat).fromValue(
|
|
34329
34426
|
textFormatAndResourceType.textFormat
|
|
34330
34427
|
);
|
|
34331
34428
|
if (deprecatedTextFormat) {
|
|
@@ -34335,7 +34432,7 @@ var BitmarkPegParserProcessor = class {
|
|
|
34335
34432
|
);
|
|
34336
34433
|
}
|
|
34337
34434
|
textFormat = textFormat ?? bitConfig.textFormatDefault;
|
|
34338
|
-
const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
|
|
34435
|
+
const resourceType = Enum21(ResourceType).fromValue(textFormatAndResourceType.resourceType);
|
|
34339
34436
|
if (textFormatAndResourceType.resourceType && !resourceType) {
|
|
34340
34437
|
this.addWarning(
|
|
34341
34438
|
`Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
|
|
@@ -34589,6 +34686,13 @@ var BitmarkPegParserProcessor = class {
|
|
|
34589
34686
|
if (l > 2) result.pageNumber = result.itemLead[2];
|
|
34590
34687
|
if (l > 3) result.marginNumber = result.itemLead[l - 1];
|
|
34591
34688
|
}
|
|
34689
|
+
if (result.__itemLeadString) {
|
|
34690
|
+
const l = result.__itemLeadString.length;
|
|
34691
|
+
if (l > 0) result.__itemString = result.__itemLeadString[0];
|
|
34692
|
+
if (l > 1) result.__leadString = result.__itemLeadString[1];
|
|
34693
|
+
if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
|
|
34694
|
+
if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
|
|
34695
|
+
}
|
|
34592
34696
|
if (inBit) {
|
|
34593
34697
|
result.body = instance11.process(
|
|
34594
34698
|
this.context,
|
|
@@ -38130,7 +38234,7 @@ var BitmarkParser = class {
|
|
|
38130
38234
|
};
|
|
38131
38235
|
|
|
38132
38236
|
// src/BitmarkParserGenerator.ts
|
|
38133
|
-
var Input =
|
|
38237
|
+
var Input = {
|
|
38134
38238
|
/**
|
|
38135
38239
|
* Input is as a string
|
|
38136
38240
|
*/
|
|
@@ -38139,8 +38243,8 @@ var Input = superenum30({
|
|
|
38139
38243
|
* Input is as a file path
|
|
38140
38244
|
*/
|
|
38141
38245
|
file: "file"
|
|
38142
|
-
}
|
|
38143
|
-
var Output =
|
|
38246
|
+
};
|
|
38247
|
+
var Output = {
|
|
38144
38248
|
/**
|
|
38145
38249
|
* Output bitmark string
|
|
38146
38250
|
*/
|
|
@@ -38153,7 +38257,7 @@ var Output = superenum30({
|
|
|
38153
38257
|
* Output AST as a plain JS object, or a file
|
|
38154
38258
|
*/
|
|
38155
38259
|
ast: "ast"
|
|
38156
|
-
}
|
|
38260
|
+
};
|
|
38157
38261
|
var BitmarkParserGenerator = class {
|
|
38158
38262
|
constructor() {
|
|
38159
38263
|
__publicField(this, "ast", new Ast());
|
|
@@ -38538,7 +38642,7 @@ var BitmarkParserGenerator = class {
|
|
|
38538
38642
|
const opts = Object.assign({}, options);
|
|
38539
38643
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38540
38644
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
38541
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38645
|
+
const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38542
38646
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38543
38647
|
let inStr = input;
|
|
38544
38648
|
const inputIsString = typeof input === "string";
|
|
@@ -38606,7 +38710,7 @@ var BitmarkParserGenerator = class {
|
|
|
38606
38710
|
if (!input) return input;
|
|
38607
38711
|
const opts = Object.assign({}, options);
|
|
38608
38712
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38609
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38713
|
+
const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38610
38714
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38611
38715
|
let inStr = input;
|
|
38612
38716
|
const inputIsString = typeof input === "string";
|
|
@@ -38659,7 +38763,7 @@ var BitmarkParserGenerator = class {
|
|
|
38659
38763
|
if (!input) return input;
|
|
38660
38764
|
const opts = Object.assign({}, options);
|
|
38661
38765
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38662
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38766
|
+
const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38663
38767
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38664
38768
|
let inStr = input;
|
|
38665
38769
|
const inputIsString = typeof input === "string";
|
|
@@ -38765,6 +38869,8 @@ export {
|
|
|
38765
38869
|
Output,
|
|
38766
38870
|
ResourceBuilder,
|
|
38767
38871
|
StringWriter,
|
|
38872
|
+
TextMarkType,
|
|
38873
|
+
TextNodeType,
|
|
38768
38874
|
parse as bitmarkTextParse
|
|
38769
38875
|
};
|
|
38770
38876
|
//# sourceMappingURL=index.js.map
|