@gmb/bitmark-parser-generator 4.20.0 → 5.0.1
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 +214 -138
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +1863 -3728
- package/dist/browser/esm/index.d.ts +1863 -3728
- package/dist/browser/esm/index.js +228 -152
- 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 +217 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1863 -3728
- package/dist/index.d.ts +1863 -3728
- package/dist/index.js +231 -154
- package/dist/index.js.map +1 -1
- package/package.json +29 -23
package/dist/index.cjs
CHANGED
|
@@ -63,9 +63,12 @@ __export(index_exports, {
|
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(index_exports);
|
|
65
65
|
|
|
66
|
+
// src/config/Config.ts
|
|
67
|
+
var import_superenum16 = require("@ncoderz/superenum");
|
|
68
|
+
|
|
66
69
|
// src/model/enum/BitType.ts
|
|
67
70
|
var import_superenum = require("@ncoderz/superenum");
|
|
68
|
-
var BitType =
|
|
71
|
+
var BitType = {
|
|
69
72
|
_error: "_error",
|
|
70
73
|
// Used for error handling to indicate a bit type that is not supported or a bit parse error
|
|
71
74
|
_comment: "_comment",
|
|
@@ -667,6 +670,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
667
670
|
vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
|
|
668
671
|
vendorJupyterIpynb: "vendor-jupyter-ipynb",
|
|
669
672
|
vendorJupyterOutput: "vendor-jupyter-output",
|
|
673
|
+
vendorLearndashEmbed: "vendor-learndash-embed",
|
|
670
674
|
vendorPadletEmbed: "vendor-padlet-embed",
|
|
671
675
|
vendorStripePricingTable: "vendor-stripe-pricing-table",
|
|
672
676
|
vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
|
|
@@ -685,24 +689,24 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
685
689
|
warningCollapsible: "warning-collapsible",
|
|
686
690
|
websiteLink: "website-link",
|
|
687
691
|
workbookArticle: "workbook-article"
|
|
688
|
-
}
|
|
692
|
+
};
|
|
689
693
|
|
|
690
694
|
// src/model/enum/Count.ts
|
|
691
695
|
var import_superenum2 = require("@ncoderz/superenum");
|
|
692
|
-
var Count =
|
|
696
|
+
var Count = {
|
|
693
697
|
infinity: "infinity"
|
|
694
|
-
}
|
|
698
|
+
};
|
|
695
699
|
|
|
696
700
|
// src/model/enum/ExampleType.ts
|
|
697
701
|
var import_superenum3 = require("@ncoderz/superenum");
|
|
698
|
-
var ExampleType =
|
|
702
|
+
var ExampleType = {
|
|
699
703
|
none: "none",
|
|
700
704
|
// Example is not allowed
|
|
701
705
|
string: "string",
|
|
702
706
|
// Example is a string value
|
|
703
707
|
boolean: "boolean"
|
|
704
708
|
// Example is a boolean value
|
|
705
|
-
}
|
|
709
|
+
};
|
|
706
710
|
|
|
707
711
|
// src/model/enum/Tag.ts
|
|
708
712
|
var import_superenum4 = require("@ncoderz/superenum");
|
|
@@ -721,11 +725,11 @@ var tags = {
|
|
|
721
725
|
tag_mark: "=",
|
|
722
726
|
tag_resource: "&"
|
|
723
727
|
};
|
|
724
|
-
var Tag =
|
|
728
|
+
var Tag = tags;
|
|
725
729
|
|
|
726
730
|
// src/model/enum/TagFormat.ts
|
|
727
731
|
var import_superenum5 = require("@ncoderz/superenum");
|
|
728
|
-
var TagFormat =
|
|
732
|
+
var TagFormat = {
|
|
729
733
|
none: "none",
|
|
730
734
|
// The property does not have a value
|
|
731
735
|
plainText: "plainText",
|
|
@@ -738,11 +742,11 @@ var TagFormat = (0, import_superenum5.superenum)({
|
|
|
738
742
|
// If the value is treated as a boolean
|
|
739
743
|
invertedBoolean: "invertedBoolean"
|
|
740
744
|
// If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
|
|
741
|
-
}
|
|
745
|
+
};
|
|
742
746
|
|
|
743
747
|
// src/model/enum/TextFormat.ts
|
|
744
748
|
var import_superenum6 = require("@ncoderz/superenum");
|
|
745
|
-
var TextFormat =
|
|
749
|
+
var TextFormat = {
|
|
746
750
|
// plain text
|
|
747
751
|
plainText: "text",
|
|
748
752
|
latex: "latex",
|
|
@@ -754,11 +758,11 @@ var TextFormat = (0, import_superenum6.superenum)({
|
|
|
754
758
|
// bitmarkText
|
|
755
759
|
// bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
|
|
756
760
|
bitmarkText: "bitmark++"
|
|
757
|
-
}
|
|
761
|
+
};
|
|
758
762
|
|
|
759
763
|
// src/model/config/enum/CardSetConfigKey.ts
|
|
760
764
|
var import_superenum7 = require("@ncoderz/superenum");
|
|
761
|
-
var CardSetConfigKey =
|
|
765
|
+
var CardSetConfigKey = {
|
|
762
766
|
flashcard: "flashcard",
|
|
763
767
|
definitionList: "definitionList",
|
|
764
768
|
elements: "elements",
|
|
@@ -780,22 +784,22 @@ var CardSetConfigKey = (0, import_superenum7.superenum)({
|
|
|
780
784
|
// DEPRECATED - TO BE REMOVED IN THE FUTURE
|
|
781
785
|
// captionDefinitionsList: 'captionDefinitionsList',
|
|
782
786
|
bookReferenceList: "bookReferenceList"
|
|
783
|
-
}
|
|
787
|
+
};
|
|
784
788
|
|
|
785
789
|
// src/model/config/enum/GroupConfigType.ts
|
|
786
790
|
var import_superenum8 = require("@ncoderz/superenum");
|
|
787
|
-
var GroupConfigType =
|
|
791
|
+
var GroupConfigType = {
|
|
788
792
|
standard: "standard",
|
|
789
793
|
// Any ordinary group
|
|
790
794
|
resource: "resource",
|
|
791
795
|
// A resource group
|
|
792
796
|
comboResource: "comboResource"
|
|
793
797
|
// A combo resource group
|
|
794
|
-
}
|
|
798
|
+
};
|
|
795
799
|
|
|
796
800
|
// src/model/enum/BitTagConfigKeyType.ts
|
|
797
801
|
var import_superenum9 = require("@ncoderz/superenum");
|
|
798
|
-
var BitTagConfigKeyType =
|
|
802
|
+
var BitTagConfigKeyType = {
|
|
799
803
|
unknown: "unknown",
|
|
800
804
|
// Unknown tag type, used for error handling
|
|
801
805
|
tag: "tag",
|
|
@@ -807,7 +811,7 @@ var BitTagConfigKeyType = (0, import_superenum9.superenum)({
|
|
|
807
811
|
//
|
|
808
812
|
group: "group"
|
|
809
813
|
// A reusable group of tags
|
|
810
|
-
}
|
|
814
|
+
};
|
|
811
815
|
|
|
812
816
|
// src/model/config/AbstractTagConfig.ts
|
|
813
817
|
var AbstractTagConfig = class {
|
|
@@ -1176,7 +1180,6 @@ var groupKeys = {
|
|
|
1176
1180
|
group_previewImages: "group_previewImages",
|
|
1177
1181
|
group_previewVideos: "group_previewVideos"
|
|
1178
1182
|
};
|
|
1179
|
-
var GroupKey = (0, import_superenum10.superenum)(groupKeys);
|
|
1180
1183
|
|
|
1181
1184
|
// src/model/enum/PropertyKey.ts
|
|
1182
1185
|
var import_superenum11 = require("@ncoderz/superenum");
|
|
@@ -1451,7 +1454,7 @@ var propertyKeys = {
|
|
|
1451
1454
|
property_y: "@y",
|
|
1452
1455
|
property_zoomDisabled: "@zoomDisabled"
|
|
1453
1456
|
};
|
|
1454
|
-
var PropertyKey =
|
|
1457
|
+
var PropertyKey = propertyKeys;
|
|
1455
1458
|
|
|
1456
1459
|
// src/model/enum/ResourceKey.ts
|
|
1457
1460
|
var import_superenum12 = require("@ncoderz/superenum");
|
|
@@ -1490,7 +1493,6 @@ var resourceKeys = {
|
|
|
1490
1493
|
resource_previewVideo: "&previewVideo",
|
|
1491
1494
|
resource_coverImage: "&coverImage"
|
|
1492
1495
|
};
|
|
1493
|
-
var ResourceKey = (0, import_superenum12.superenum)(resourceKeys);
|
|
1494
1496
|
|
|
1495
1497
|
// src/model/enum/ResourceType.ts
|
|
1496
1498
|
var import_superenum13 = require("@ncoderz/superenum");
|
|
@@ -1684,7 +1686,7 @@ var StringUtils = class {
|
|
|
1684
1686
|
var stringUtils = new StringUtils();
|
|
1685
1687
|
|
|
1686
1688
|
// src/model/enum/ResourceType.ts
|
|
1687
|
-
var ResourceType =
|
|
1689
|
+
var ResourceType = {
|
|
1688
1690
|
unknown: "unknown",
|
|
1689
1691
|
image: "image",
|
|
1690
1692
|
imageResponsive: "image-responsive",
|
|
@@ -1720,13 +1722,13 @@ var ResourceType = (0, import_superenum13.superenum)({
|
|
|
1720
1722
|
previewImage: "previewImage",
|
|
1721
1723
|
previewVideo: "previewVideo",
|
|
1722
1724
|
coverImage: "coverImage"
|
|
1723
|
-
}
|
|
1725
|
+
};
|
|
1724
1726
|
function resourceTypeToConfigKey(type) {
|
|
1725
1727
|
return `&${stringUtils.kebabToCamel(type)}`;
|
|
1726
1728
|
}
|
|
1727
1729
|
|
|
1728
1730
|
// src/model/config/enum/ConfigKey.ts
|
|
1729
|
-
var ConfigKey =
|
|
1731
|
+
var ConfigKey = {
|
|
1730
1732
|
// Internal
|
|
1731
1733
|
_unknown: "_unknown",
|
|
1732
1734
|
// Tags
|
|
@@ -1737,7 +1739,7 @@ var ConfigKey = (0, import_superenum14.superenum)({
|
|
|
1737
1739
|
...propertyKeys,
|
|
1738
1740
|
// Groups
|
|
1739
1741
|
...groupKeys
|
|
1740
|
-
}
|
|
1742
|
+
};
|
|
1741
1743
|
function typeFromConfigKey(tagKey) {
|
|
1742
1744
|
if (!tagKey) return BitTagConfigKeyType.unknown;
|
|
1743
1745
|
if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
|
|
@@ -1749,7 +1751,7 @@ function configKeyToPropertyType(configKey) {
|
|
|
1749
1751
|
return configKey.replace(/^@/, "");
|
|
1750
1752
|
}
|
|
1751
1753
|
function configKeyToResourceType(configKey) {
|
|
1752
|
-
return ResourceType.fromKey(configKey.replace(/^&/, ""));
|
|
1754
|
+
return (0, import_superenum14.Enum)(ResourceType).fromKey(configKey.replace(/^&/, ""));
|
|
1753
1755
|
}
|
|
1754
1756
|
|
|
1755
1757
|
// src/model/config/ResourcesConfig.ts
|
|
@@ -2141,6 +2143,9 @@ var ObjectUtils = class {
|
|
|
2141
2143
|
};
|
|
2142
2144
|
var objectUtils = new ObjectUtils();
|
|
2143
2145
|
|
|
2146
|
+
// src/config/ConfigHydrator.ts
|
|
2147
|
+
var import_superenum15 = require("@ncoderz/superenum");
|
|
2148
|
+
|
|
2144
2149
|
// src/config/raw/cardSets.ts
|
|
2145
2150
|
var CARDSETS = {
|
|
2146
2151
|
[CardSetConfigKey.definitionList]: {
|
|
@@ -4379,9 +4384,9 @@ var ConfigHydrator = class {
|
|
|
4379
4384
|
}
|
|
4380
4385
|
hydrateTagConfig(_tag) {
|
|
4381
4386
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
|
|
4382
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4387
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4383
4388
|
if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
|
|
4384
|
-
const tag = Tag.fromValue(configKey);
|
|
4389
|
+
const tag = (0, import_superenum15.Enum)(Tag).fromValue(configKey);
|
|
4385
4390
|
if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
|
|
4386
4391
|
let chain;
|
|
4387
4392
|
if (_chain) {
|
|
@@ -4412,7 +4417,7 @@ var ConfigHydrator = class {
|
|
|
4412
4417
|
defaultValue,
|
|
4413
4418
|
jsonKey
|
|
4414
4419
|
} = _tag;
|
|
4415
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4420
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4416
4421
|
if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
|
|
4417
4422
|
const tag = _configKey.substring(1);
|
|
4418
4423
|
let chain;
|
|
@@ -4438,7 +4443,7 @@ var ConfigHydrator = class {
|
|
|
4438
4443
|
}
|
|
4439
4444
|
hydrateResourceTagConfig(_tag) {
|
|
4440
4445
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
|
|
4441
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4446
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4442
4447
|
if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
|
|
4443
4448
|
const tag = _configKey.substring(1);
|
|
4444
4449
|
let chain;
|
|
@@ -4462,7 +4467,7 @@ var ConfigHydrator = class {
|
|
|
4462
4467
|
}
|
|
4463
4468
|
hydrateTagGroupConfig(_tag) {
|
|
4464
4469
|
const { key: _configKey } = _tag;
|
|
4465
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4470
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4466
4471
|
if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
|
|
4467
4472
|
const _groupConfig = GROUPS[configKey];
|
|
4468
4473
|
if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
|
|
@@ -9914,14 +9919,19 @@ var BITS = {
|
|
|
9914
9919
|
tags: [
|
|
9915
9920
|
{
|
|
9916
9921
|
key: ConfigKey.property_iframeSrc,
|
|
9917
|
-
description: "Iframe source URL, used to define the source of the iframe"
|
|
9922
|
+
description: "Iframe source URL, used to define the source of the iframe",
|
|
9923
|
+
minCount: 1
|
|
9918
9924
|
},
|
|
9919
9925
|
{
|
|
9920
9926
|
key: ConfigKey.property_iframeName,
|
|
9921
|
-
description: "Iframe name, used to define the name of the iframe"
|
|
9922
|
-
minCount: 1
|
|
9927
|
+
description: "Iframe name, used to define the name of the iframe"
|
|
9923
9928
|
}
|
|
9924
9929
|
]
|
|
9930
|
+
},
|
|
9931
|
+
[BitType.vendorLearndashEmbed]: {
|
|
9932
|
+
since: "5.0.0",
|
|
9933
|
+
baseBitType: BitType.nonProductionPrototypeIframe,
|
|
9934
|
+
description: "Learndash embed bit, used to embed Learndash content in an iframe"
|
|
9925
9935
|
}
|
|
9926
9936
|
};
|
|
9927
9937
|
|
|
@@ -9944,7 +9954,7 @@ var Config = class {
|
|
|
9944
9954
|
*/
|
|
9945
9955
|
getBitType(bitType) {
|
|
9946
9956
|
if (bitType?.startsWith("|")) bitType = bitType.substring(1);
|
|
9947
|
-
return BitType.fromValue(bitType) ?? BitType._error;
|
|
9957
|
+
return (0, import_superenum16.Enum)(BitType).fromValue(bitType) ?? BitType._error;
|
|
9948
9958
|
}
|
|
9949
9959
|
/**
|
|
9950
9960
|
* Check if a bit type is and instance of the given root bit type.
|
|
@@ -10264,15 +10274,15 @@ var instance2 = new Config();
|
|
|
10264
10274
|
// src/generated/package_info.ts
|
|
10265
10275
|
var PACKAGE_INFO = {
|
|
10266
10276
|
"name": "@gmb/bitmark-parser-generator",
|
|
10267
|
-
"version": "
|
|
10277
|
+
"version": "5.0.1",
|
|
10268
10278
|
"author": "Get More Brain Ltd",
|
|
10269
10279
|
"license": "ISC",
|
|
10270
10280
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
10271
10281
|
};
|
|
10272
10282
|
|
|
10273
10283
|
// src/utils/env/Environment.ts
|
|
10274
|
-
var
|
|
10275
|
-
var Environment =
|
|
10284
|
+
var import_superenum17 = require("@ncoderz/superenum");
|
|
10285
|
+
var Environment = {
|
|
10276
10286
|
unknown: "",
|
|
10277
10287
|
node: "node",
|
|
10278
10288
|
chrome: "chrome",
|
|
@@ -10280,18 +10290,18 @@ var Environment = (0, import_superenum15.superenum)({
|
|
|
10280
10290
|
firefox: "firefox",
|
|
10281
10291
|
edge: "edge",
|
|
10282
10292
|
ie: "ie"
|
|
10283
|
-
}
|
|
10293
|
+
};
|
|
10284
10294
|
|
|
10285
10295
|
// src/utils/env/Os.ts
|
|
10286
|
-
var
|
|
10287
|
-
var Os =
|
|
10296
|
+
var import_superenum18 = require("@ncoderz/superenum");
|
|
10297
|
+
var Os = {
|
|
10288
10298
|
unknown: "",
|
|
10289
10299
|
macos: "macos",
|
|
10290
10300
|
windows: "windows",
|
|
10291
10301
|
linux: "linux",
|
|
10292
10302
|
android: "android",
|
|
10293
10303
|
ios: "ios"
|
|
10294
|
-
}
|
|
10304
|
+
};
|
|
10295
10305
|
|
|
10296
10306
|
// src/utils/env/userAgent.ts
|
|
10297
10307
|
function parseUserAgent() {
|
|
@@ -10499,8 +10509,11 @@ function init() {
|
|
|
10499
10509
|
initialised = true;
|
|
10500
10510
|
}
|
|
10501
10511
|
|
|
10512
|
+
// src/ast/Ast.ts
|
|
10513
|
+
var import_superenum23 = require("@ncoderz/superenum");
|
|
10514
|
+
|
|
10502
10515
|
// src/model/enum/BodyBitType.ts
|
|
10503
|
-
var
|
|
10516
|
+
var import_superenum19 = require("@ncoderz/superenum");
|
|
10504
10517
|
var BodyBitTypeRaw = {
|
|
10505
10518
|
text: "text",
|
|
10506
10519
|
gap: "gap",
|
|
@@ -10508,11 +10521,11 @@ var BodyBitTypeRaw = {
|
|
|
10508
10521
|
select: "select",
|
|
10509
10522
|
highlight: "highlight"
|
|
10510
10523
|
};
|
|
10511
|
-
var BodyBitType =
|
|
10524
|
+
var BodyBitType = BodyBitTypeRaw;
|
|
10512
10525
|
|
|
10513
10526
|
// src/model/enum/TextMarkType.ts
|
|
10514
|
-
var
|
|
10515
|
-
var TextMarkType =
|
|
10527
|
+
var import_superenum20 = require("@ncoderz/superenum");
|
|
10528
|
+
var TextMarkType = {
|
|
10516
10529
|
// Styles
|
|
10517
10530
|
bold: "bold",
|
|
10518
10531
|
light: "light",
|
|
@@ -10559,11 +10572,11 @@ var TextMarkType = (0, import_superenum18.superenum)({
|
|
|
10559
10572
|
duration: "duration",
|
|
10560
10573
|
color: "color",
|
|
10561
10574
|
comment: "comment"
|
|
10562
|
-
}
|
|
10575
|
+
};
|
|
10563
10576
|
|
|
10564
10577
|
// src/model/enum/TextNodeType.ts
|
|
10565
|
-
var
|
|
10566
|
-
var TextNodeType =
|
|
10578
|
+
var import_superenum21 = require("@ncoderz/superenum");
|
|
10579
|
+
var TextNodeType = {
|
|
10567
10580
|
// Text
|
|
10568
10581
|
text: "text",
|
|
10569
10582
|
// Blocks
|
|
@@ -10591,11 +10604,11 @@ var TextNodeType = (0, import_superenum19.superenum)({
|
|
|
10591
10604
|
select: "select",
|
|
10592
10605
|
highlight: "highlight",
|
|
10593
10606
|
mark: "mark"
|
|
10594
|
-
}
|
|
10607
|
+
};
|
|
10595
10608
|
|
|
10596
10609
|
// src/model/ast/NodeType.ts
|
|
10597
|
-
var
|
|
10598
|
-
var NodeType =
|
|
10610
|
+
var import_superenum22 = require("@ncoderz/superenum");
|
|
10611
|
+
var NodeType = {
|
|
10599
10612
|
unknown: "unknown",
|
|
10600
10613
|
// unknown
|
|
10601
10614
|
__isDefaultExample: "__isDefaultExample",
|
|
@@ -11278,7 +11291,7 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
11278
11291
|
y: "y",
|
|
11279
11292
|
yValue: "yValue",
|
|
11280
11293
|
zoomDisabled: "zoomDisabled"
|
|
11281
|
-
}
|
|
11294
|
+
};
|
|
11282
11295
|
|
|
11283
11296
|
// src/ast/Ast.ts
|
|
11284
11297
|
var Ast = class {
|
|
@@ -11461,7 +11474,7 @@ var Ast = class {
|
|
|
11461
11474
|
if (isParentArray && parentKey) {
|
|
11462
11475
|
astKey = `${parentKey}Value`;
|
|
11463
11476
|
}
|
|
11464
|
-
return NodeType.fromKey(astKey) || `unknown(${astKey})`;
|
|
11477
|
+
return (0, import_superenum23.Enum)(NodeType).fromKey(astKey) || `unknown(${astKey})`;
|
|
11465
11478
|
}
|
|
11466
11479
|
isArray(x) {
|
|
11467
11480
|
return Array.isArray(x);
|
|
@@ -11474,16 +11487,19 @@ var Ast = class {
|
|
|
11474
11487
|
}
|
|
11475
11488
|
};
|
|
11476
11489
|
|
|
11490
|
+
// src/ast/Builder.ts
|
|
11491
|
+
var import_superenum30 = require("@ncoderz/superenum");
|
|
11492
|
+
|
|
11477
11493
|
// src/model/enum/TextLocation.ts
|
|
11478
|
-
var
|
|
11479
|
-
var TextLocation =
|
|
11494
|
+
var import_superenum24 = require("@ncoderz/superenum");
|
|
11495
|
+
var TextLocation = {
|
|
11480
11496
|
tag: "tag",
|
|
11481
11497
|
body: "body"
|
|
11482
|
-
}
|
|
11498
|
+
};
|
|
11483
11499
|
|
|
11484
11500
|
// src/model/enum/BodyTextFormat.ts
|
|
11485
|
-
var
|
|
11486
|
-
var BodyTextFormat =
|
|
11501
|
+
var import_superenum25 = require("@ncoderz/superenum");
|
|
11502
|
+
var BodyTextFormat = {
|
|
11487
11503
|
plainText: "text",
|
|
11488
11504
|
// plain text
|
|
11489
11505
|
latex: "latex",
|
|
@@ -11494,7 +11510,7 @@ var BodyTextFormat = (0, import_superenum22.superenum)({
|
|
|
11494
11510
|
// xml
|
|
11495
11511
|
// bitmark++ text
|
|
11496
11512
|
bitmarkPlusPlus: "bitmark++"
|
|
11497
|
-
}
|
|
11513
|
+
};
|
|
11498
11514
|
|
|
11499
11515
|
// src/breakscaping/RegexConfigs.ts
|
|
11500
11516
|
var REGEX_MARKS = /([*`_!=])(?=\1)/;
|
|
@@ -11743,11 +11759,11 @@ var Breakscape2 = class {
|
|
|
11743
11759
|
var instance3 = new Breakscape2();
|
|
11744
11760
|
|
|
11745
11761
|
// src/model/enum/DeprecatedTextFormat.ts
|
|
11746
|
-
var
|
|
11747
|
-
var DeprecatedTextFormat =
|
|
11762
|
+
var import_superenum26 = require("@ncoderz/superenum");
|
|
11763
|
+
var DeprecatedTextFormat = {
|
|
11748
11764
|
bitmarkMinusMinus: "bitmark--"
|
|
11749
11765
|
// bitmark-- text format, deprecated
|
|
11750
|
-
}
|
|
11766
|
+
};
|
|
11751
11767
|
|
|
11752
11768
|
// src/parser/json/TableUtils.ts
|
|
11753
11769
|
function isTableBasicFormat(table) {
|
|
@@ -11906,14 +11922,14 @@ var ArrayUtils = class {
|
|
|
11906
11922
|
var instance4 = new ArrayUtils();
|
|
11907
11923
|
|
|
11908
11924
|
// src/generator/text/TextGenerator.ts
|
|
11909
|
-
var
|
|
11925
|
+
var import_superenum28 = require("@ncoderz/superenum");
|
|
11910
11926
|
|
|
11911
11927
|
// src/model/enum/BitmarkVersion.ts
|
|
11912
|
-
var
|
|
11913
|
-
var BitmarkVersion =
|
|
11928
|
+
var import_superenum27 = require("@ncoderz/superenum");
|
|
11929
|
+
var BitmarkVersion = {
|
|
11914
11930
|
v2: 2,
|
|
11915
11931
|
v3: 3
|
|
11916
|
-
}
|
|
11932
|
+
};
|
|
11917
11933
|
var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
|
|
11918
11934
|
|
|
11919
11935
|
// src/generator/AstWalkerGenerator.ts
|
|
@@ -12100,7 +12116,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12100
12116
|
__publicField(this, "preTextIndexTemp", -1);
|
|
12101
12117
|
__publicField(this, "havePreText", false);
|
|
12102
12118
|
__publicField(this, "preTextIndex", -1);
|
|
12103
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12119
|
+
this.bitmarkVersion = (0, import_superenum28.Enum)(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12104
12120
|
this.options = {
|
|
12105
12121
|
...DEFAULT_OPTIONS,
|
|
12106
12122
|
...options
|
|
@@ -22285,6 +22301,9 @@ var BitUtils = class {
|
|
|
22285
22301
|
};
|
|
22286
22302
|
var instance7 = new BitUtils();
|
|
22287
22303
|
|
|
22304
|
+
// src/ast/ResourceBuilder.ts
|
|
22305
|
+
var import_superenum29 = require("@ncoderz/superenum");
|
|
22306
|
+
|
|
22288
22307
|
// src/utils/UrlUtils.ts
|
|
22289
22308
|
var UrlUtils = class {
|
|
22290
22309
|
fileExtensionFromUrl(url) {
|
|
@@ -22524,11 +22543,11 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22524
22543
|
const nodes = [];
|
|
22525
22544
|
if (!Array.isArray(resource)) resource = [resource];
|
|
22526
22545
|
for (const thisResource of resource) {
|
|
22527
|
-
let type = ResourceType.fromValue(thisResource.type);
|
|
22546
|
+
let type = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.type);
|
|
22528
22547
|
if (!type) return void 0;
|
|
22529
|
-
const resourceKey = ResourceType.keyFromValue(type);
|
|
22548
|
+
const resourceKey = (0, import_superenum29.Enum)(ResourceType).keyFromValue(type);
|
|
22530
22549
|
if (!resourceKey) return void 0;
|
|
22531
|
-
const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
|
|
22550
|
+
const __typeAlias = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.__typeAlias);
|
|
22532
22551
|
type = __typeAlias ?? type;
|
|
22533
22552
|
let data;
|
|
22534
22553
|
if (type === ResourceType.imageResponsive) {
|
|
@@ -22564,7 +22583,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22564
22583
|
}
|
|
22565
22584
|
resourceFromResourceDataJson(context, type, data) {
|
|
22566
22585
|
if (!data) return void 0;
|
|
22567
|
-
type = ResourceType.fromValue(type);
|
|
22586
|
+
type = (0, import_superenum29.Enum)(ResourceType).fromValue(type);
|
|
22568
22587
|
if (!type) return void 0;
|
|
22569
22588
|
const dataAsString = stringUtils.isString(data) ? data : void 0;
|
|
22570
22589
|
const url = data.url || data.src || data.body || dataAsString;
|
|
@@ -23677,8 +23696,8 @@ var Builder = class extends BaseBuilder {
|
|
|
23677
23696
|
data = structuredClone(data);
|
|
23678
23697
|
const bitType = data.bitType;
|
|
23679
23698
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
23680
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
|
|
23681
|
-
let textFormat = TextFormat.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23699
|
+
const deprecatedTextFormat = (0, import_superenum30.Enum)(DeprecatedTextFormat).fromValue(data.textFormat);
|
|
23700
|
+
let textFormat = (0, import_superenum30.Enum)(TextFormat).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23682
23701
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
23683
23702
|
textFormat = TextFormat.bitmarkText;
|
|
23684
23703
|
}
|
|
@@ -23701,7 +23720,7 @@ var Builder = class extends BaseBuilder {
|
|
|
23701
23720
|
bitType,
|
|
23702
23721
|
bitLevel: data.bitLevel,
|
|
23703
23722
|
textFormat,
|
|
23704
|
-
resourceType: ResourceType.fromValue(data.resourceType),
|
|
23723
|
+
resourceType: (0, import_superenum30.Enum)(ResourceType).fromValue(data.resourceType),
|
|
23705
23724
|
isCommented: data.isCommented,
|
|
23706
23725
|
// Properties
|
|
23707
23726
|
id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
|
|
@@ -25026,14 +25045,14 @@ var Builder = class extends BaseBuilder {
|
|
|
25026
25045
|
response: data.response ?? "",
|
|
25027
25046
|
reaction: data.reaction ?? "",
|
|
25028
25047
|
feedback: data.feedback ?? "",
|
|
25029
|
-
item:
|
|
25048
|
+
item: data.item ?? "",
|
|
25030
25049
|
lead: this.handleJsonText(context, TextLocation.tag, data.lead),
|
|
25031
25050
|
hint: this.handleJsonText(context, TextLocation.tag, data.hint)
|
|
25032
25051
|
};
|
|
25033
25052
|
objectUtils.removeUnwantedProperties(node, {
|
|
25034
|
-
ignoreEmptyString: ["response", "reaction", "feedback"],
|
|
25053
|
+
ignoreEmptyString: ["response", "reaction", "feedback", "item"],
|
|
25035
25054
|
ignoreAllFalse: true,
|
|
25036
|
-
ignoreEmptyArrays: [
|
|
25055
|
+
ignoreEmptyArrays: [],
|
|
25037
25056
|
ignoreUndefined: ["example"]
|
|
25038
25057
|
});
|
|
25039
25058
|
return node;
|
|
@@ -26651,14 +26670,17 @@ var StringWriter = class {
|
|
|
26651
26670
|
};
|
|
26652
26671
|
|
|
26653
26672
|
// src/BitmarkParserGenerator.ts
|
|
26654
|
-
var
|
|
26673
|
+
var import_superenum51 = require("@ncoderz/superenum");
|
|
26674
|
+
|
|
26675
|
+
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26676
|
+
var import_superenum32 = require("@ncoderz/superenum");
|
|
26655
26677
|
|
|
26656
26678
|
// src/model/enum/CardSetVersion.ts
|
|
26657
|
-
var
|
|
26658
|
-
var CardSetVersion =
|
|
26679
|
+
var import_superenum31 = require("@ncoderz/superenum");
|
|
26680
|
+
var CardSetVersion = {
|
|
26659
26681
|
v1: 1,
|
|
26660
26682
|
v2: 2
|
|
26661
|
-
}
|
|
26683
|
+
};
|
|
26662
26684
|
|
|
26663
26685
|
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26664
26686
|
var DEFAULT_OPTIONS2 = {
|
|
@@ -26713,7 +26735,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
26713
26735
|
this.leaf = this.leaf.bind(this);
|
|
26714
26736
|
this.write = this.write.bind(this);
|
|
26715
26737
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
26716
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26738
|
+
this.bitmarkVersion = (0, import_superenum32.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26717
26739
|
this.options = {
|
|
26718
26740
|
...DEFAULT_OPTIONS2,
|
|
26719
26741
|
...options?.bitmarkOptions
|
|
@@ -27275,7 +27297,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27275
27297
|
this.inTag = true;
|
|
27276
27298
|
}
|
|
27277
27299
|
bodyBitCallback(bodyBit, _index, _route) {
|
|
27278
|
-
const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27300
|
+
const nodeType = (0, import_superenum32.Enum)(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27279
27301
|
this.ast.walk(bodyBit, nodeType, this, void 0);
|
|
27280
27302
|
return "";
|
|
27281
27303
|
}
|
|
@@ -27820,6 +27842,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27820
27842
|
between_cardBits(_node, _left, _right, _route) {
|
|
27821
27843
|
this.writeCardSetCardDivider();
|
|
27822
27844
|
}
|
|
27845
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> item
|
|
27846
|
+
leaf_item(node, route) {
|
|
27847
|
+
const parent = this.getParentNode(route);
|
|
27848
|
+
if (parent?.key !== NodeType.botResponsesValue) return;
|
|
27849
|
+
this.writeNL();
|
|
27850
|
+
this.writeOPC();
|
|
27851
|
+
this.writeTextOrValue(node.value, TextFormat.plainText, TextLocation.tag);
|
|
27852
|
+
this.writeCL();
|
|
27853
|
+
}
|
|
27823
27854
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
27824
27855
|
leaf_response(node, route) {
|
|
27825
27856
|
const parent = this.getParentNode(route);
|
|
@@ -28481,8 +28512,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28481
28512
|
* Generate the handlers for resources, as they are mostly the same, but not quite
|
|
28482
28513
|
*/
|
|
28483
28514
|
generateResourceHandlers() {
|
|
28484
|
-
for (const tag of ResourceType.keys()) {
|
|
28485
|
-
if (tag === ResourceType.keyFromValue(ResourceType.unknown)) continue;
|
|
28515
|
+
for (const tag of (0, import_superenum32.Enum)(ResourceType).keys()) {
|
|
28516
|
+
if (tag === (0, import_superenum32.Enum)(ResourceType).keyFromValue(ResourceType.unknown)) continue;
|
|
28486
28517
|
const enterFuncName = `enter_${tag}`;
|
|
28487
28518
|
if (typeof this[enterFuncName] === "function") {
|
|
28488
28519
|
continue;
|
|
@@ -28492,8 +28523,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28492
28523
|
if (resource == null) return false;
|
|
28493
28524
|
const parent = this.getParentNode(route);
|
|
28494
28525
|
if (parent?.key !== NodeType.resourcesValue) return true;
|
|
28495
|
-
const alias = ResourceType.fromValue(parent
|
|
28496
|
-
const type = alias ?? ResourceType.fromValue(parent
|
|
28526
|
+
const alias = (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.__typeAlias);
|
|
28527
|
+
const type = alias ?? (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.type);
|
|
28497
28528
|
if (!type) return false;
|
|
28498
28529
|
const url = resource.url || resource.src || resource.body || "";
|
|
28499
28530
|
this.writeNL();
|
|
@@ -28507,7 +28538,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28507
28538
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
28508
28539
|
*/
|
|
28509
28540
|
generatePropertyHandlers() {
|
|
28510
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
28541
|
+
for (const propertyConfigKey of (0, import_superenum32.Enum)(PropertyKey).values()) {
|
|
28511
28542
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
28512
28543
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
28513
28544
|
for (const funcName of funcNames) {
|
|
@@ -28857,7 +28888,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28857
28888
|
}
|
|
28858
28889
|
writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
|
|
28859
28890
|
if (key && resource) {
|
|
28860
|
-
const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
|
|
28891
|
+
const resourceTag = (0, import_superenum32.Enum)(ResourceType).keyFromValue(resource.type) ?? "";
|
|
28861
28892
|
const resourceData = resource[resourceTag];
|
|
28862
28893
|
const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
|
|
28863
28894
|
if (deprecated_writeAsProperty) {
|
|
@@ -28942,7 +28973,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28942
28973
|
return true;
|
|
28943
28974
|
}
|
|
28944
28975
|
isWriteTextFormat(bitsValue, textFormatDefault) {
|
|
28945
|
-
const isDefault = TextFormat.fromValue(bitsValue) === textFormatDefault;
|
|
28976
|
+
const isDefault = (0, import_superenum32.Enum)(TextFormat).fromValue(bitsValue) === textFormatDefault;
|
|
28946
28977
|
const writeFormat = !isDefault || this.options.explicitTextFormat;
|
|
28947
28978
|
return !!writeFormat;
|
|
28948
28979
|
}
|
|
@@ -29034,6 +29065,7 @@ var BitmarkStringGenerator = class {
|
|
|
29034
29065
|
};
|
|
29035
29066
|
|
|
29036
29067
|
// src/generator/json/JsonGenerator.ts
|
|
29068
|
+
var import_superenum33 = require("@ncoderz/superenum");
|
|
29037
29069
|
var MOVE_BODY_RECURSION_LIMIT = 5e3;
|
|
29038
29070
|
var DEFAULT_OPTIONS3 = {
|
|
29039
29071
|
// debugGenerationInline: true,
|
|
@@ -29070,7 +29102,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29070
29102
|
this.exit = this.exit.bind(this);
|
|
29071
29103
|
this.leaf = this.leaf.bind(this);
|
|
29072
29104
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
29073
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29105
|
+
this.bitmarkVersion = (0, import_superenum33.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29074
29106
|
this.textParserVersion = this.textParser.version();
|
|
29075
29107
|
this.options = {
|
|
29076
29108
|
...DEFAULT_OPTIONS3,
|
|
@@ -29424,7 +29456,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29424
29456
|
throw new Error("Recursion limit exceeded");
|
|
29425
29457
|
}
|
|
29426
29458
|
for (const node of nodes) {
|
|
29427
|
-
if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
|
|
29459
|
+
if (node.type !== BodyBitType.text && (0, import_superenum33.Enum)(BodyBitType).values().includes(node.type)) {
|
|
29428
29460
|
const bodyBit = node;
|
|
29429
29461
|
bodyBit.attrs = {};
|
|
29430
29462
|
for (const [key, value] of Object.entries(bodyBit)) {
|
|
@@ -29711,7 +29743,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29711
29743
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
29712
29744
|
*/
|
|
29713
29745
|
generatePropertyHandlers() {
|
|
29714
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
29746
|
+
for (const propertyConfigKey of (0, import_superenum33.Enum)(PropertyKey).values()) {
|
|
29715
29747
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
29716
29748
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
29717
29749
|
for (const funcName of funcNames) {
|
|
@@ -29827,7 +29859,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29827
29859
|
for (const node of route) {
|
|
29828
29860
|
if (node.key === NodeType.bitsValue) {
|
|
29829
29861
|
const n = node.value;
|
|
29830
|
-
return TextFormat.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29862
|
+
return (0, import_superenum33.Enum)(TextFormat).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29831
29863
|
}
|
|
29832
29864
|
}
|
|
29833
29865
|
}
|
|
@@ -30376,12 +30408,13 @@ var JsonObjectGenerator = class {
|
|
|
30376
30408
|
};
|
|
30377
30409
|
|
|
30378
30410
|
// src/info/InfoBuilder.ts
|
|
30411
|
+
var import_superenum34 = require("@ncoderz/superenum");
|
|
30379
30412
|
var InfoBuilder = class {
|
|
30380
30413
|
getSupportedBits(options) {
|
|
30381
30414
|
const includeNonDeprecated = options?.includeNonDeprecated ?? true;
|
|
30382
30415
|
const includeDeprecated = options?.includeDeprecated ?? false;
|
|
30383
30416
|
const supportedBits = [];
|
|
30384
|
-
for (const bt of BitType.values()) {
|
|
30417
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30385
30418
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30386
30419
|
const bitType = instance2.getBitType(bt);
|
|
30387
30420
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
@@ -30400,7 +30433,7 @@ var InfoBuilder = class {
|
|
|
30400
30433
|
}
|
|
30401
30434
|
getSupportedBitConfigs() {
|
|
30402
30435
|
const res = [];
|
|
30403
|
-
for (const bt of BitType.values()) {
|
|
30436
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30404
30437
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30405
30438
|
const bitType = instance2.getBitType(bt);
|
|
30406
30439
|
const config = instance2.getBitConfig(bitType);
|
|
@@ -30411,22 +30444,22 @@ var InfoBuilder = class {
|
|
|
30411
30444
|
};
|
|
30412
30445
|
|
|
30413
30446
|
// src/model/enum/BitmarkParserType.ts
|
|
30414
|
-
var
|
|
30415
|
-
var BitmarkParserType =
|
|
30447
|
+
var import_superenum35 = require("@ncoderz/superenum");
|
|
30448
|
+
var BitmarkParserType = {
|
|
30416
30449
|
peggy: "peggy"
|
|
30417
|
-
}
|
|
30450
|
+
};
|
|
30418
30451
|
|
|
30419
30452
|
// src/model/info/enum/InfoFormat.ts
|
|
30420
|
-
var
|
|
30421
|
-
var InfoFormat =
|
|
30453
|
+
var import_superenum36 = require("@ncoderz/superenum");
|
|
30454
|
+
var InfoFormat = {
|
|
30422
30455
|
text: "text",
|
|
30423
30456
|
json: "json",
|
|
30424
30457
|
pojo: "pojo"
|
|
30425
|
-
}
|
|
30458
|
+
};
|
|
30426
30459
|
|
|
30427
30460
|
// src/model/info/enum/InfoType.ts
|
|
30428
|
-
var
|
|
30429
|
-
var InfoType =
|
|
30461
|
+
var import_superenum37 = require("@ncoderz/superenum");
|
|
30462
|
+
var InfoType = {
|
|
30430
30463
|
list: "list",
|
|
30431
30464
|
// List non-deprecated bits
|
|
30432
30465
|
deprecated: "deprecated",
|
|
@@ -30435,9 +30468,10 @@ var InfoType = (0, import_superenum29.superenum)({
|
|
|
30435
30468
|
// List all bits
|
|
30436
30469
|
bit: "bit"
|
|
30437
30470
|
// Get information for a bit
|
|
30438
|
-
}
|
|
30471
|
+
};
|
|
30439
30472
|
|
|
30440
30473
|
// src/parser/json/JsonParser.ts
|
|
30474
|
+
var import_superenum38 = require("@ncoderz/superenum");
|
|
30441
30475
|
var builder = new Builder();
|
|
30442
30476
|
var JsonParser = class {
|
|
30443
30477
|
/**
|
|
@@ -30539,8 +30573,8 @@ var JsonParser = class {
|
|
|
30539
30573
|
const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
|
|
30540
30574
|
const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
|
|
30541
30575
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
30542
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
|
|
30543
|
-
let _textFormat = TextFormat.fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30576
|
+
const deprecatedTextFormat = (0, import_superenum38.Enum)(DeprecatedTextFormat).fromValue(bit.format);
|
|
30577
|
+
let _textFormat = (0, import_superenum38.Enum)(TextFormat).fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30544
30578
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
30545
30579
|
_textFormat = TextFormat.bitmarkText;
|
|
30546
30580
|
}
|
|
@@ -30617,7 +30651,7 @@ var JsonParser = class {
|
|
|
30617
30651
|
}
|
|
30618
30652
|
getResourceType(resource) {
|
|
30619
30653
|
if (resource) {
|
|
30620
|
-
const resourceKey = ResourceType.fromValue(resource.type);
|
|
30654
|
+
const resourceKey = (0, import_superenum38.Enum)(ResourceType).fromValue(resource.type);
|
|
30621
30655
|
return resourceKey;
|
|
30622
30656
|
}
|
|
30623
30657
|
return void 0;
|
|
@@ -30689,7 +30723,7 @@ var JsonParser = class {
|
|
|
30689
30723
|
};
|
|
30690
30724
|
|
|
30691
30725
|
// src/parser/bitmark/peg/BitmarkPegParserTypes.ts
|
|
30692
|
-
var
|
|
30726
|
+
var import_superenum39 = require("@ncoderz/superenum");
|
|
30693
30727
|
|
|
30694
30728
|
// src/parser/bitmark/peg/PeggyGrammarLocation.ts
|
|
30695
30729
|
var PeggyGrammarLocation = class {
|
|
@@ -30769,7 +30803,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
|
|
|
30769
30803
|
var CARD_DIVIDER_V1 = "===";
|
|
30770
30804
|
var CARD_SIDE_DIVIDER_V1 = "==";
|
|
30771
30805
|
var CARD_VARIANT_DIVIDER_V1 = "--";
|
|
30772
|
-
var TypeKey =
|
|
30806
|
+
var TypeKey = {
|
|
30773
30807
|
// Bit header
|
|
30774
30808
|
TextFormat: "TextFormat",
|
|
30775
30809
|
ResourceType: "ResourceType",
|
|
@@ -30804,14 +30838,15 @@ var TypeKey = (0, import_superenum30.superenum)({
|
|
|
30804
30838
|
// Dividers
|
|
30805
30839
|
PlainTextDivider: "PlainTextDivider",
|
|
30806
30840
|
FooterDivider: "FooterDivider"
|
|
30807
|
-
}
|
|
30808
|
-
var ContentDepth =
|
|
30841
|
+
};
|
|
30842
|
+
var ContentDepth = {
|
|
30809
30843
|
Bit: "Bit",
|
|
30810
30844
|
Card: "Card",
|
|
30811
30845
|
Chain: "Chain"
|
|
30812
|
-
}
|
|
30846
|
+
};
|
|
30813
30847
|
|
|
30814
30848
|
// src/parser/bitmark/peg/BitmarkPegParserHelper.ts
|
|
30849
|
+
var import_superenum40 = require("@ncoderz/superenum");
|
|
30815
30850
|
var ENABLE_DEBUG = true;
|
|
30816
30851
|
var DEBUG_DATA = true;
|
|
30817
30852
|
var DEBUG_DATA_INCLUDE_PARSER = false;
|
|
@@ -30905,7 +30940,7 @@ var BitmarkPegParserHelper = class {
|
|
|
30905
30940
|
if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
|
|
30906
30941
|
return {
|
|
30907
30942
|
type,
|
|
30908
|
-
key: Tag.fromValue(type),
|
|
30943
|
+
key: (0, import_superenum40.Enum)(Tag).fromValue(type),
|
|
30909
30944
|
value,
|
|
30910
30945
|
parser: {
|
|
30911
30946
|
text: this.parserText(),
|
|
@@ -31300,7 +31335,7 @@ var BitmarkPegParserHelper = class {
|
|
|
31300
31335
|
if (!value) return false;
|
|
31301
31336
|
const { type } = value;
|
|
31302
31337
|
if (!validType) {
|
|
31303
|
-
return !!TypeKey.fromValue(type);
|
|
31338
|
+
return !!(0, import_superenum40.Enum)(TypeKey).fromValue(type);
|
|
31304
31339
|
}
|
|
31305
31340
|
if (Array.isArray(validType)) {
|
|
31306
31341
|
return validType.indexOf(type) >= 0;
|
|
@@ -31384,7 +31419,11 @@ var BitmarkPegParserHelper = class {
|
|
|
31384
31419
|
}
|
|
31385
31420
|
};
|
|
31386
31421
|
|
|
31422
|
+
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31423
|
+
var import_superenum49 = require("@ncoderz/superenum");
|
|
31424
|
+
|
|
31387
31425
|
// src/parser/bitmark/peg/BitmarkPegParserValidator.ts
|
|
31426
|
+
var import_superenum41 = require("@ncoderz/superenum");
|
|
31388
31427
|
var COMMON_MISTAKE_STRINGS = [
|
|
31389
31428
|
// Card divider errors
|
|
31390
31429
|
"----",
|
|
@@ -31556,7 +31595,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31556
31595
|
const content = dataOrNull[i];
|
|
31557
31596
|
if (!content) continue;
|
|
31558
31597
|
const { type, key } = content;
|
|
31559
|
-
let typeKey = TypeKey.fromValue(type);
|
|
31598
|
+
let typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(type);
|
|
31560
31599
|
if (!typeKey) continue;
|
|
31561
31600
|
let validTypeKey = typeKey;
|
|
31562
31601
|
if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
|
|
@@ -31979,7 +32018,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31979
32018
|
} else if (tagValidationData.isResource) {
|
|
31980
32019
|
res.set(v.configKey, tagValidationData);
|
|
31981
32020
|
} else {
|
|
31982
|
-
const typeKey = TypeKey.fromValue(v.tag);
|
|
32021
|
+
const typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(v.tag);
|
|
31983
32022
|
if (typeKey) {
|
|
31984
32023
|
res.set(typeKey, tagValidationData);
|
|
31985
32024
|
}
|
|
@@ -32992,12 +33031,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
32992
33031
|
for (const card of cardSet.cards) {
|
|
32993
33032
|
for (const side of card.sides) {
|
|
32994
33033
|
for (const content of side.variants) {
|
|
32995
|
-
const {
|
|
33034
|
+
const {
|
|
33035
|
+
__instructionString,
|
|
33036
|
+
__itemString,
|
|
33037
|
+
reaction,
|
|
33038
|
+
cardBodyStr: feedback,
|
|
33039
|
+
...tags2
|
|
33040
|
+
} = content.data;
|
|
32996
33041
|
const botResponse = {
|
|
32997
33042
|
response: __instructionString ?? instance3.EMPTY_STRING,
|
|
32998
33043
|
reaction: reaction ?? instance3.EMPTY_STRING,
|
|
32999
33044
|
feedback: feedback ?? instance3.EMPTY_STRING,
|
|
33000
|
-
...tags2
|
|
33045
|
+
...tags2,
|
|
33046
|
+
item: __itemString ?? instance3.EMPTY_STRING
|
|
33001
33047
|
};
|
|
33002
33048
|
if (botResponse) botResponses.push(botResponse);
|
|
33003
33049
|
}
|
|
@@ -33233,6 +33279,9 @@ var FooterContentProcessor = class {
|
|
|
33233
33279
|
};
|
|
33234
33280
|
var instance12 = new FooterContentProcessor();
|
|
33235
33281
|
|
|
33282
|
+
// src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
|
|
33283
|
+
var import_superenum42 = require("@ncoderz/superenum");
|
|
33284
|
+
|
|
33236
33285
|
// src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
|
|
33237
33286
|
var textParser4 = new TextParser();
|
|
33238
33287
|
function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
@@ -33268,7 +33317,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33268
33317
|
}
|
|
33269
33318
|
function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
33270
33319
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
|
|
33271
|
-
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33320
|
+
const gapConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum42.Enum)(Tag).fromValue(content.type));
|
|
33272
33321
|
const chainContent = [content, ...content.chain ?? []];
|
|
33273
33322
|
const chainTags = context.bitContentProcessor(
|
|
33274
33323
|
ContentDepth.Chain,
|
|
@@ -33283,6 +33332,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
|
33283
33332
|
return gap;
|
|
33284
33333
|
}
|
|
33285
33334
|
|
|
33335
|
+
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
33336
|
+
var import_superenum43 = require("@ncoderz/superenum");
|
|
33337
|
+
|
|
33286
33338
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
|
|
33287
33339
|
function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
33288
33340
|
const { textFormat } = context;
|
|
@@ -33295,6 +33347,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
|
|
|
33295
33347
|
location: TextLocation.tag
|
|
33296
33348
|
});
|
|
33297
33349
|
target.itemLead.push(text);
|
|
33350
|
+
if (!target.__itemLeadString) target.__itemLeadString = [];
|
|
33351
|
+
target.__itemLeadString.push(
|
|
33352
|
+
instance3.unbreakscape(trimmedStringValue, {
|
|
33353
|
+
format: TextFormat.bitmarkText,
|
|
33354
|
+
location: TextLocation.tag
|
|
33355
|
+
})
|
|
33356
|
+
);
|
|
33298
33357
|
}
|
|
33299
33358
|
|
|
33300
33359
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
@@ -33307,7 +33366,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
|
|
|
33307
33366
|
}
|
|
33308
33367
|
function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
33309
33368
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
|
|
33310
|
-
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33369
|
+
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum43.Enum)(Tag).fromValue(content.type));
|
|
33311
33370
|
const chainContent = [content, ...content.chain ?? []];
|
|
33312
33371
|
const chainTags = context.bitContentProcessor(
|
|
33313
33372
|
ContentDepth.Chain,
|
|
@@ -33316,8 +33375,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
|
33316
33375
|
);
|
|
33317
33376
|
if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
|
|
33318
33377
|
target.itemLead = chainTags.itemLead;
|
|
33378
|
+
target.__itemLeadString = chainTags.__itemLeadString;
|
|
33319
33379
|
}
|
|
33320
33380
|
|
|
33381
|
+
// src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
|
|
33382
|
+
var import_superenum44 = require("@ncoderz/superenum");
|
|
33383
|
+
|
|
33321
33384
|
// src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
|
|
33322
33385
|
function markTagContentProcessor(_context, _contentDepth, content, target) {
|
|
33323
33386
|
const { value } = content;
|
|
@@ -33342,7 +33405,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
|
|
|
33342
33405
|
}
|
|
33343
33406
|
function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
33344
33407
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33345
|
-
const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33408
|
+
const markConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum44.Enum)(Tag).fromValue(content.type));
|
|
33346
33409
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33347
33410
|
const chainTags = context.bitContentProcessor(
|
|
33348
33411
|
ContentDepth.Chain,
|
|
@@ -33361,6 +33424,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
|
33361
33424
|
return mark;
|
|
33362
33425
|
}
|
|
33363
33426
|
|
|
33427
|
+
// src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
|
|
33428
|
+
var import_superenum47 = require("@ncoderz/superenum");
|
|
33429
|
+
|
|
33364
33430
|
// src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
|
|
33365
33431
|
function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33366
33432
|
if (contentDepth === ContentDepth.Chain) {
|
|
@@ -33535,6 +33601,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
|
|
|
33535
33601
|
}
|
|
33536
33602
|
|
|
33537
33603
|
// src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
|
|
33604
|
+
var import_superenum45 = require("@ncoderz/superenum");
|
|
33538
33605
|
function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33539
33606
|
if (contentDepth === ContentDepth.Chain) {
|
|
33540
33607
|
imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
|
|
@@ -33553,7 +33620,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
|
|
|
33553
33620
|
function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
|
|
33554
33621
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
|
|
33555
33622
|
const { key: tag } = content;
|
|
33556
|
-
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33623
|
+
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum45.Enum)(ConfigKey).fromValue(tag));
|
|
33557
33624
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33558
33625
|
const chainTags = context.bitContentProcessor(
|
|
33559
33626
|
ContentDepth.Chain,
|
|
@@ -33587,12 +33654,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
|
|
|
33587
33654
|
}
|
|
33588
33655
|
|
|
33589
33656
|
// src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
|
|
33657
|
+
var import_superenum46 = require("@ncoderz/superenum");
|
|
33590
33658
|
function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|
|
33591
33659
|
const { key: tag } = content;
|
|
33592
33660
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33593
33661
|
const markConfig = target.markConfig;
|
|
33594
33662
|
if (!markConfig) return;
|
|
33595
|
-
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33663
|
+
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum46.Enum)(ConfigKey).fromValue(tag));
|
|
33596
33664
|
const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
|
|
33597
33665
|
ContentDepth.Chain,
|
|
33598
33666
|
markTagConfig?.chain,
|
|
@@ -33725,7 +33793,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33725
33793
|
const { value } = content;
|
|
33726
33794
|
const { key: keyIn } = content;
|
|
33727
33795
|
const isChain = contentDepth === ContentDepth.Chain;
|
|
33728
|
-
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
|
|
33796
|
+
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum47.Enum)(PropertyKey).fromValue(keyIn));
|
|
33729
33797
|
const configKey = propertyConfig ? propertyConfig.configKey : void 0;
|
|
33730
33798
|
let property = configKeyToPropertyType(keyIn);
|
|
33731
33799
|
if (configKey === ConfigKey.property_internalComment) {
|
|
@@ -33882,12 +33950,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
|
|
|
33882
33950
|
}
|
|
33883
33951
|
|
|
33884
33952
|
// src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
|
|
33953
|
+
var import_superenum48 = require("@ncoderz/superenum");
|
|
33885
33954
|
var resourceBuilder = new ResourceBuilder();
|
|
33886
33955
|
function buildResources(context, resourceTypeAttachment, resources) {
|
|
33887
33956
|
const { bitType } = context;
|
|
33888
33957
|
const filteredResources = [];
|
|
33889
33958
|
const excessResources = [];
|
|
33890
|
-
const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
|
|
33959
|
+
const validatedResourceTypeAttachemnt = (0, import_superenum48.Enum)(ResourceType).fromValue(resourceTypeAttachment);
|
|
33891
33960
|
const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
|
|
33892
33961
|
const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
|
|
33893
33962
|
const countsMin = resourcesConfig.getCountsMin();
|
|
@@ -33931,9 +34000,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
|
|
|
33931
34000
|
const { type: _ignoreType, key, value, chain } = content;
|
|
33932
34001
|
const resources = target.resources;
|
|
33933
34002
|
if (!resources) return;
|
|
33934
|
-
const configKey = ConfigKey.fromValue(key);
|
|
34003
|
+
const configKey = (0, import_superenum48.Enum)(ConfigKey).fromValue(key);
|
|
33935
34004
|
if (!configKey) return;
|
|
33936
|
-
const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
34005
|
+
const resourceType = (0, import_superenum48.Enum)(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33937
34006
|
const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
|
|
33938
34007
|
const { posterImage, ...tags2 } = context.bitContentProcessor(
|
|
33939
34008
|
ContentDepth.Chain,
|
|
@@ -34429,14 +34498,14 @@ var BitmarkPegParserProcessor = class {
|
|
|
34429
34498
|
);
|
|
34430
34499
|
bitLevel = instance2.bitLevelMin;
|
|
34431
34500
|
}
|
|
34432
|
-
let textFormat = TextFormat.fromValue(textFormatAndResourceType.textFormat);
|
|
34501
|
+
let textFormat = (0, import_superenum49.Enum)(TextFormat).fromValue(textFormatAndResourceType.textFormat);
|
|
34433
34502
|
const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
|
|
34434
34503
|
if (isInvalidTextFormat) {
|
|
34435
34504
|
this.addWarning(
|
|
34436
34505
|
`Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
|
|
34437
34506
|
);
|
|
34438
34507
|
}
|
|
34439
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
|
|
34508
|
+
const deprecatedTextFormat = (0, import_superenum49.Enum)(DeprecatedTextFormat).fromValue(
|
|
34440
34509
|
textFormatAndResourceType.textFormat
|
|
34441
34510
|
);
|
|
34442
34511
|
if (deprecatedTextFormat) {
|
|
@@ -34446,7 +34515,7 @@ var BitmarkPegParserProcessor = class {
|
|
|
34446
34515
|
);
|
|
34447
34516
|
}
|
|
34448
34517
|
textFormat = textFormat ?? bitConfig.textFormatDefault;
|
|
34449
|
-
const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
|
|
34518
|
+
const resourceType = (0, import_superenum49.Enum)(ResourceType).fromValue(textFormatAndResourceType.resourceType);
|
|
34450
34519
|
if (textFormatAndResourceType.resourceType && !resourceType) {
|
|
34451
34520
|
this.addWarning(
|
|
34452
34521
|
`Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
|
|
@@ -34700,6 +34769,13 @@ var BitmarkPegParserProcessor = class {
|
|
|
34700
34769
|
if (l > 2) result.pageNumber = result.itemLead[2];
|
|
34701
34770
|
if (l > 3) result.marginNumber = result.itemLead[l - 1];
|
|
34702
34771
|
}
|
|
34772
|
+
if (result.__itemLeadString) {
|
|
34773
|
+
const l = result.__itemLeadString.length;
|
|
34774
|
+
if (l > 0) result.__itemString = result.__itemLeadString[0];
|
|
34775
|
+
if (l > 1) result.__leadString = result.__itemLeadString[1];
|
|
34776
|
+
if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
|
|
34777
|
+
if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
|
|
34778
|
+
}
|
|
34703
34779
|
if (inBit) {
|
|
34704
34780
|
result.body = instance11.process(
|
|
34705
34781
|
this.context,
|
|
@@ -38588,6 +38664,7 @@ var JsonFileGenerator = class {
|
|
|
38588
38664
|
|
|
38589
38665
|
// src/info/ConfigBuilder.ts
|
|
38590
38666
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
38667
|
+
var import_superenum50 = require("@ncoderz/superenum");
|
|
38591
38668
|
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
38592
38669
|
var ConfigBuilder = class {
|
|
38593
38670
|
build(options) {
|
|
@@ -38597,7 +38674,7 @@ var ConfigBuilder = class {
|
|
|
38597
38674
|
const groupConfigs = [];
|
|
38598
38675
|
const bitGroupConfigKeys = [];
|
|
38599
38676
|
const bitGroupConfigs = [];
|
|
38600
|
-
for (const bt of BitType.values()) {
|
|
38677
|
+
for (const bt of (0, import_superenum50.Enum)(BitType).values()) {
|
|
38601
38678
|
const bitType = instance2.getBitType(bt);
|
|
38602
38679
|
const _bitConfig = BITS[bitType];
|
|
38603
38680
|
if (_bitConfig) {
|
|
@@ -38879,7 +38956,7 @@ var ConfigBuilder = class {
|
|
|
38879
38956
|
buildFlat(options) {
|
|
38880
38957
|
const opts = Object.assign({}, options);
|
|
38881
38958
|
const bitConfigs = [];
|
|
38882
|
-
for (const bt of BitType.values()) {
|
|
38959
|
+
for (const bt of (0, import_superenum50.Enum)(BitType).values()) {
|
|
38883
38960
|
const bitType = instance2.getBitType(bt);
|
|
38884
38961
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
38885
38962
|
if (bitConfig) bitConfigs.push(bitConfig);
|
|
@@ -38990,7 +39067,7 @@ var ConfigBuilder = class {
|
|
|
38990
39067
|
};
|
|
38991
39068
|
|
|
38992
39069
|
// src/BitmarkParserGenerator.ts
|
|
38993
|
-
var Input =
|
|
39070
|
+
var Input = {
|
|
38994
39071
|
/**
|
|
38995
39072
|
* Input is as a string
|
|
38996
39073
|
*/
|
|
@@ -38999,8 +39076,8 @@ var Input = (0, import_superenum31.superenum)({
|
|
|
38999
39076
|
* Input is as a file path
|
|
39000
39077
|
*/
|
|
39001
39078
|
file: "file"
|
|
39002
|
-
}
|
|
39003
|
-
var Output =
|
|
39079
|
+
};
|
|
39080
|
+
var Output = {
|
|
39004
39081
|
/**
|
|
39005
39082
|
* Output bitmark string
|
|
39006
39083
|
*/
|
|
@@ -39013,7 +39090,7 @@ var Output = (0, import_superenum31.superenum)({
|
|
|
39013
39090
|
* Output AST as a plain JS object, or a file
|
|
39014
39091
|
*/
|
|
39015
39092
|
ast: "ast"
|
|
39016
|
-
}
|
|
39093
|
+
};
|
|
39017
39094
|
var BitmarkParserGenerator = class {
|
|
39018
39095
|
constructor() {
|
|
39019
39096
|
__publicField(this, "ast", new Ast());
|
|
@@ -39398,7 +39475,7 @@ var BitmarkParserGenerator = class {
|
|
|
39398
39475
|
const opts = Object.assign({}, options);
|
|
39399
39476
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39400
39477
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
39401
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39478
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39402
39479
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39403
39480
|
let inStr = input;
|
|
39404
39481
|
const inputIsString = typeof input === "string";
|
|
@@ -39466,7 +39543,7 @@ var BitmarkParserGenerator = class {
|
|
|
39466
39543
|
if (!input) return input;
|
|
39467
39544
|
const opts = Object.assign({}, options);
|
|
39468
39545
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39469
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39546
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39470
39547
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39471
39548
|
let inStr = input;
|
|
39472
39549
|
const inputIsString = typeof input === "string";
|
|
@@ -39519,7 +39596,7 @@ var BitmarkParserGenerator = class {
|
|
|
39519
39596
|
if (!input) return input;
|
|
39520
39597
|
const opts = Object.assign({}, options);
|
|
39521
39598
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39522
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39599
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39523
39600
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39524
39601
|
let inStr = input;
|
|
39525
39602
|
const inputIsString = typeof input === "string";
|