@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
|
@@ -43,13 +43,18 @@ __export(index_exports, {
|
|
|
43
43
|
Output: () => Output,
|
|
44
44
|
ResourceBuilder: () => ResourceBuilder,
|
|
45
45
|
StringWriter: () => StringWriter,
|
|
46
|
+
TextMarkType: () => TextMarkType,
|
|
47
|
+
TextNodeType: () => TextNodeType,
|
|
46
48
|
bitmarkTextParse: () => parse
|
|
47
49
|
});
|
|
48
50
|
module.exports = __toCommonJS(index_exports);
|
|
49
51
|
|
|
52
|
+
// src/config/Config.ts
|
|
53
|
+
var import_superenum16 = require("@ncoderz/superenum");
|
|
54
|
+
|
|
50
55
|
// src/model/enum/BitType.ts
|
|
51
56
|
var import_superenum = require("@ncoderz/superenum");
|
|
52
|
-
var BitType =
|
|
57
|
+
var BitType = {
|
|
53
58
|
_error: "_error",
|
|
54
59
|
// Used for error handling to indicate a bit type that is not supported or a bit parse error
|
|
55
60
|
_comment: "_comment",
|
|
@@ -438,6 +443,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
438
443
|
multipleResponse: "multiple-response",
|
|
439
444
|
multipleResponse1: "multiple-response-1",
|
|
440
445
|
newspaperArticle: "newspaper-article",
|
|
446
|
+
nonProductionPrototypeIframe: "non-production-prototype-iframe",
|
|
441
447
|
note: "note",
|
|
442
448
|
noteAi: "note-ai",
|
|
443
449
|
noteAlt: "note-alt",
|
|
@@ -650,6 +656,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
650
656
|
vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
|
|
651
657
|
vendorJupyterIpynb: "vendor-jupyter-ipynb",
|
|
652
658
|
vendorJupyterOutput: "vendor-jupyter-output",
|
|
659
|
+
vendorLearndashEmbed: "vendor-learndash-embed",
|
|
653
660
|
vendorPadletEmbed: "vendor-padlet-embed",
|
|
654
661
|
vendorStripePricingTable: "vendor-stripe-pricing-table",
|
|
655
662
|
vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
|
|
@@ -668,24 +675,24 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
668
675
|
warningCollapsible: "warning-collapsible",
|
|
669
676
|
websiteLink: "website-link",
|
|
670
677
|
workbookArticle: "workbook-article"
|
|
671
|
-
}
|
|
678
|
+
};
|
|
672
679
|
|
|
673
680
|
// src/model/enum/Count.ts
|
|
674
681
|
var import_superenum2 = require("@ncoderz/superenum");
|
|
675
|
-
var Count =
|
|
682
|
+
var Count = {
|
|
676
683
|
infinity: "infinity"
|
|
677
|
-
}
|
|
684
|
+
};
|
|
678
685
|
|
|
679
686
|
// src/model/enum/ExampleType.ts
|
|
680
687
|
var import_superenum3 = require("@ncoderz/superenum");
|
|
681
|
-
var ExampleType =
|
|
688
|
+
var ExampleType = {
|
|
682
689
|
none: "none",
|
|
683
690
|
// Example is not allowed
|
|
684
691
|
string: "string",
|
|
685
692
|
// Example is a string value
|
|
686
693
|
boolean: "boolean"
|
|
687
694
|
// Example is a boolean value
|
|
688
|
-
}
|
|
695
|
+
};
|
|
689
696
|
|
|
690
697
|
// src/model/enum/Tag.ts
|
|
691
698
|
var import_superenum4 = require("@ncoderz/superenum");
|
|
@@ -704,11 +711,11 @@ var tags = {
|
|
|
704
711
|
tag_mark: "=",
|
|
705
712
|
tag_resource: "&"
|
|
706
713
|
};
|
|
707
|
-
var Tag =
|
|
714
|
+
var Tag = tags;
|
|
708
715
|
|
|
709
716
|
// src/model/enum/TagFormat.ts
|
|
710
717
|
var import_superenum5 = require("@ncoderz/superenum");
|
|
711
|
-
var TagFormat =
|
|
718
|
+
var TagFormat = {
|
|
712
719
|
none: "none",
|
|
713
720
|
// The property does not have a value
|
|
714
721
|
plainText: "plainText",
|
|
@@ -721,11 +728,11 @@ var TagFormat = (0, import_superenum5.superenum)({
|
|
|
721
728
|
// If the value is treated as a boolean
|
|
722
729
|
invertedBoolean: "invertedBoolean"
|
|
723
730
|
// If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
|
|
724
|
-
}
|
|
731
|
+
};
|
|
725
732
|
|
|
726
733
|
// src/model/enum/TextFormat.ts
|
|
727
734
|
var import_superenum6 = require("@ncoderz/superenum");
|
|
728
|
-
var TextFormat2 =
|
|
735
|
+
var TextFormat2 = {
|
|
729
736
|
// plain text
|
|
730
737
|
plainText: "text",
|
|
731
738
|
latex: "latex",
|
|
@@ -737,11 +744,11 @@ var TextFormat2 = (0, import_superenum6.superenum)({
|
|
|
737
744
|
// bitmarkText
|
|
738
745
|
// bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
|
|
739
746
|
bitmarkText: "bitmark++"
|
|
740
|
-
}
|
|
747
|
+
};
|
|
741
748
|
|
|
742
749
|
// src/model/config/enum/CardSetConfigKey.ts
|
|
743
750
|
var import_superenum7 = require("@ncoderz/superenum");
|
|
744
|
-
var CardSetConfigKey =
|
|
751
|
+
var CardSetConfigKey = {
|
|
745
752
|
flashcard: "flashcard",
|
|
746
753
|
definitionList: "definitionList",
|
|
747
754
|
elements: "elements",
|
|
@@ -763,22 +770,22 @@ var CardSetConfigKey = (0, import_superenum7.superenum)({
|
|
|
763
770
|
// DEPRECATED - TO BE REMOVED IN THE FUTURE
|
|
764
771
|
// captionDefinitionsList: 'captionDefinitionsList',
|
|
765
772
|
bookReferenceList: "bookReferenceList"
|
|
766
|
-
}
|
|
773
|
+
};
|
|
767
774
|
|
|
768
775
|
// src/model/config/enum/GroupConfigType.ts
|
|
769
776
|
var import_superenum8 = require("@ncoderz/superenum");
|
|
770
|
-
var GroupConfigType =
|
|
777
|
+
var GroupConfigType = {
|
|
771
778
|
standard: "standard",
|
|
772
779
|
// Any ordinary group
|
|
773
780
|
resource: "resource",
|
|
774
781
|
// A resource group
|
|
775
782
|
comboResource: "comboResource"
|
|
776
783
|
// A combo resource group
|
|
777
|
-
}
|
|
784
|
+
};
|
|
778
785
|
|
|
779
786
|
// src/model/enum/BitTagConfigKeyType.ts
|
|
780
787
|
var import_superenum9 = require("@ncoderz/superenum");
|
|
781
|
-
var BitTagConfigKeyType =
|
|
788
|
+
var BitTagConfigKeyType = {
|
|
782
789
|
unknown: "unknown",
|
|
783
790
|
// Unknown tag type, used for error handling
|
|
784
791
|
tag: "tag",
|
|
@@ -790,7 +797,7 @@ var BitTagConfigKeyType = (0, import_superenum9.superenum)({
|
|
|
790
797
|
//
|
|
791
798
|
group: "group"
|
|
792
799
|
// A reusable group of tags
|
|
793
|
-
}
|
|
800
|
+
};
|
|
794
801
|
|
|
795
802
|
// src/model/config/AbstractTagConfig.ts
|
|
796
803
|
var AbstractTagConfig = class {
|
|
@@ -1159,7 +1166,6 @@ var groupKeys = {
|
|
|
1159
1166
|
group_previewImages: "group_previewImages",
|
|
1160
1167
|
group_previewVideos: "group_previewVideos"
|
|
1161
1168
|
};
|
|
1162
|
-
var GroupKey = (0, import_superenum10.superenum)(groupKeys);
|
|
1163
1169
|
|
|
1164
1170
|
// src/model/enum/PropertyKey.ts
|
|
1165
1171
|
var import_superenum11 = require("@ncoderz/superenum");
|
|
@@ -1266,6 +1272,8 @@ var propertyKeys = {
|
|
|
1266
1272
|
property_icon: "@icon",
|
|
1267
1273
|
property_iconTag: "@iconTag",
|
|
1268
1274
|
property_id: "@id",
|
|
1275
|
+
property_iframeSrc: "@iframeSrc",
|
|
1276
|
+
property_iframeName: "@iframeName",
|
|
1269
1277
|
property_imageFirst: "@imageFirst",
|
|
1270
1278
|
property_imageSource: "@imageSource",
|
|
1271
1279
|
property_index: "@index",
|
|
@@ -1432,7 +1440,7 @@ var propertyKeys = {
|
|
|
1432
1440
|
property_y: "@y",
|
|
1433
1441
|
property_zoomDisabled: "@zoomDisabled"
|
|
1434
1442
|
};
|
|
1435
|
-
var PropertyKey =
|
|
1443
|
+
var PropertyKey = propertyKeys;
|
|
1436
1444
|
|
|
1437
1445
|
// src/model/enum/ResourceKey.ts
|
|
1438
1446
|
var import_superenum12 = require("@ncoderz/superenum");
|
|
@@ -1471,7 +1479,6 @@ var resourceKeys = {
|
|
|
1471
1479
|
resource_previewVideo: "&previewVideo",
|
|
1472
1480
|
resource_coverImage: "&coverImage"
|
|
1473
1481
|
};
|
|
1474
|
-
var ResourceKey = (0, import_superenum12.superenum)(resourceKeys);
|
|
1475
1482
|
|
|
1476
1483
|
// src/model/enum/ResourceType.ts
|
|
1477
1484
|
var import_superenum13 = require("@ncoderz/superenum");
|
|
@@ -1665,7 +1672,7 @@ var StringUtils = class {
|
|
|
1665
1672
|
var stringUtils = new StringUtils();
|
|
1666
1673
|
|
|
1667
1674
|
// src/model/enum/ResourceType.ts
|
|
1668
|
-
var ResourceType =
|
|
1675
|
+
var ResourceType = {
|
|
1669
1676
|
unknown: "unknown",
|
|
1670
1677
|
image: "image",
|
|
1671
1678
|
imageResponsive: "image-responsive",
|
|
@@ -1701,13 +1708,13 @@ var ResourceType = (0, import_superenum13.superenum)({
|
|
|
1701
1708
|
previewImage: "previewImage",
|
|
1702
1709
|
previewVideo: "previewVideo",
|
|
1703
1710
|
coverImage: "coverImage"
|
|
1704
|
-
}
|
|
1711
|
+
};
|
|
1705
1712
|
function resourceTypeToConfigKey(type) {
|
|
1706
1713
|
return `&${stringUtils.kebabToCamel(type)}`;
|
|
1707
1714
|
}
|
|
1708
1715
|
|
|
1709
1716
|
// src/model/config/enum/ConfigKey.ts
|
|
1710
|
-
var ConfigKey =
|
|
1717
|
+
var ConfigKey = {
|
|
1711
1718
|
// Internal
|
|
1712
1719
|
_unknown: "_unknown",
|
|
1713
1720
|
// Tags
|
|
@@ -1718,7 +1725,7 @@ var ConfigKey = (0, import_superenum14.superenum)({
|
|
|
1718
1725
|
...propertyKeys,
|
|
1719
1726
|
// Groups
|
|
1720
1727
|
...groupKeys
|
|
1721
|
-
}
|
|
1728
|
+
};
|
|
1722
1729
|
function typeFromConfigKey(tagKey) {
|
|
1723
1730
|
if (!tagKey) return BitTagConfigKeyType.unknown;
|
|
1724
1731
|
if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
|
|
@@ -1730,7 +1737,7 @@ function configKeyToPropertyType(configKey) {
|
|
|
1730
1737
|
return configKey.replace(/^@/, "");
|
|
1731
1738
|
}
|
|
1732
1739
|
function configKeyToResourceType(configKey) {
|
|
1733
|
-
return ResourceType.fromKey(configKey.replace(/^&/, ""));
|
|
1740
|
+
return (0, import_superenum14.Enum)(ResourceType).fromKey(configKey.replace(/^&/, ""));
|
|
1734
1741
|
}
|
|
1735
1742
|
|
|
1736
1743
|
// src/model/config/ResourcesConfig.ts
|
|
@@ -2122,6 +2129,9 @@ var ObjectUtils = class {
|
|
|
2122
2129
|
};
|
|
2123
2130
|
var objectUtils = new ObjectUtils();
|
|
2124
2131
|
|
|
2132
|
+
// src/config/ConfigHydrator.ts
|
|
2133
|
+
var import_superenum15 = require("@ncoderz/superenum");
|
|
2134
|
+
|
|
2125
2135
|
// src/config/raw/cardSets.ts
|
|
2126
2136
|
var CARDSETS = {
|
|
2127
2137
|
[CardSetConfigKey.definitionList]: {
|
|
@@ -4360,9 +4370,9 @@ var ConfigHydrator = class {
|
|
|
4360
4370
|
}
|
|
4361
4371
|
hydrateTagConfig(_tag) {
|
|
4362
4372
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
|
|
4363
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4373
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4364
4374
|
if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
|
|
4365
|
-
const tag = Tag.fromValue(configKey);
|
|
4375
|
+
const tag = (0, import_superenum15.Enum)(Tag).fromValue(configKey);
|
|
4366
4376
|
if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
|
|
4367
4377
|
let chain;
|
|
4368
4378
|
if (_chain) {
|
|
@@ -4393,7 +4403,7 @@ var ConfigHydrator = class {
|
|
|
4393
4403
|
defaultValue,
|
|
4394
4404
|
jsonKey
|
|
4395
4405
|
} = _tag;
|
|
4396
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4406
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4397
4407
|
if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
|
|
4398
4408
|
const tag = _configKey.substring(1);
|
|
4399
4409
|
let chain;
|
|
@@ -4419,7 +4429,7 @@ var ConfigHydrator = class {
|
|
|
4419
4429
|
}
|
|
4420
4430
|
hydrateResourceTagConfig(_tag) {
|
|
4421
4431
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
|
|
4422
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4432
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4423
4433
|
if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
|
|
4424
4434
|
const tag = _configKey.substring(1);
|
|
4425
4435
|
let chain;
|
|
@@ -4443,7 +4453,7 @@ var ConfigHydrator = class {
|
|
|
4443
4453
|
}
|
|
4444
4454
|
hydrateTagGroupConfig(_tag) {
|
|
4445
4455
|
const { key: _configKey } = _tag;
|
|
4446
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4456
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4447
4457
|
if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
|
|
4448
4458
|
const _groupConfig = GROUPS[configKey];
|
|
4449
4459
|
if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
|
|
@@ -9887,6 +9897,27 @@ var BITS = {
|
|
|
9887
9897
|
}
|
|
9888
9898
|
],
|
|
9889
9899
|
resourceAttachmentAllowed: false
|
|
9900
|
+
},
|
|
9901
|
+
[BitType.nonProductionPrototypeIframe]: {
|
|
9902
|
+
since: "4.20.0",
|
|
9903
|
+
baseBitType: BitType._standard,
|
|
9904
|
+
description: "A non-production prototype iframe bit, used to embed prototype iframes",
|
|
9905
|
+
tags: [
|
|
9906
|
+
{
|
|
9907
|
+
key: ConfigKey.property_iframeSrc,
|
|
9908
|
+
description: "Iframe source URL, used to define the source of the iframe"
|
|
9909
|
+
},
|
|
9910
|
+
{
|
|
9911
|
+
key: ConfigKey.property_iframeName,
|
|
9912
|
+
description: "Iframe name, used to define the name of the iframe",
|
|
9913
|
+
minCount: 1
|
|
9914
|
+
}
|
|
9915
|
+
]
|
|
9916
|
+
},
|
|
9917
|
+
[BitType.vendorLearndashEmbed]: {
|
|
9918
|
+
since: "5.0.0",
|
|
9919
|
+
baseBitType: BitType.nonProductionPrototypeIframe,
|
|
9920
|
+
description: "Learndash embed bit, used to embed Learndash content in an iframe"
|
|
9890
9921
|
}
|
|
9891
9922
|
};
|
|
9892
9923
|
|
|
@@ -9909,7 +9940,7 @@ var Config = class {
|
|
|
9909
9940
|
*/
|
|
9910
9941
|
getBitType(bitType) {
|
|
9911
9942
|
if (bitType?.startsWith("|")) bitType = bitType.substring(1);
|
|
9912
|
-
return BitType.fromValue(bitType) ?? BitType._error;
|
|
9943
|
+
return (0, import_superenum16.Enum)(BitType).fromValue(bitType) ?? BitType._error;
|
|
9913
9944
|
}
|
|
9914
9945
|
/**
|
|
9915
9946
|
* Check if a bit type is and instance of the given root bit type.
|
|
@@ -10229,15 +10260,15 @@ var instance2 = new Config();
|
|
|
10229
10260
|
// src/generated/package_info.ts
|
|
10230
10261
|
var PACKAGE_INFO = {
|
|
10231
10262
|
"name": "@gmb/bitmark-parser-generator",
|
|
10232
|
-
"version": "
|
|
10263
|
+
"version": "5.0.0",
|
|
10233
10264
|
"author": "Get More Brain Ltd",
|
|
10234
10265
|
"license": "ISC",
|
|
10235
10266
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
10236
10267
|
};
|
|
10237
10268
|
|
|
10238
10269
|
// src/utils/env/Environment.ts
|
|
10239
|
-
var
|
|
10240
|
-
var Environment =
|
|
10270
|
+
var import_superenum17 = require("@ncoderz/superenum");
|
|
10271
|
+
var Environment = {
|
|
10241
10272
|
unknown: "",
|
|
10242
10273
|
node: "node",
|
|
10243
10274
|
chrome: "chrome",
|
|
@@ -10245,18 +10276,18 @@ var Environment = (0, import_superenum15.superenum)({
|
|
|
10245
10276
|
firefox: "firefox",
|
|
10246
10277
|
edge: "edge",
|
|
10247
10278
|
ie: "ie"
|
|
10248
|
-
}
|
|
10279
|
+
};
|
|
10249
10280
|
|
|
10250
10281
|
// src/utils/env/Os.ts
|
|
10251
|
-
var
|
|
10252
|
-
var Os =
|
|
10282
|
+
var import_superenum18 = require("@ncoderz/superenum");
|
|
10283
|
+
var Os = {
|
|
10253
10284
|
unknown: "",
|
|
10254
10285
|
macos: "macos",
|
|
10255
10286
|
windows: "windows",
|
|
10256
10287
|
linux: "linux",
|
|
10257
10288
|
android: "android",
|
|
10258
10289
|
ios: "ios"
|
|
10259
|
-
}
|
|
10290
|
+
};
|
|
10260
10291
|
|
|
10261
10292
|
// src/utils/env/userAgent.ts
|
|
10262
10293
|
function parseUserAgent() {
|
|
@@ -10464,8 +10495,11 @@ function init() {
|
|
|
10464
10495
|
initialised = true;
|
|
10465
10496
|
}
|
|
10466
10497
|
|
|
10498
|
+
// src/ast/Ast.ts
|
|
10499
|
+
var import_superenum23 = require("@ncoderz/superenum");
|
|
10500
|
+
|
|
10467
10501
|
// src/model/enum/BodyBitType.ts
|
|
10468
|
-
var
|
|
10502
|
+
var import_superenum19 = require("@ncoderz/superenum");
|
|
10469
10503
|
var BodyBitTypeRaw = {
|
|
10470
10504
|
text: "text",
|
|
10471
10505
|
gap: "gap",
|
|
@@ -10473,11 +10507,11 @@ var BodyBitTypeRaw = {
|
|
|
10473
10507
|
select: "select",
|
|
10474
10508
|
highlight: "highlight"
|
|
10475
10509
|
};
|
|
10476
|
-
var BodyBitType =
|
|
10510
|
+
var BodyBitType = BodyBitTypeRaw;
|
|
10477
10511
|
|
|
10478
10512
|
// src/model/enum/TextMarkType.ts
|
|
10479
|
-
var
|
|
10480
|
-
var TextMarkType =
|
|
10513
|
+
var import_superenum20 = require("@ncoderz/superenum");
|
|
10514
|
+
var TextMarkType = {
|
|
10481
10515
|
// Styles
|
|
10482
10516
|
bold: "bold",
|
|
10483
10517
|
light: "light",
|
|
@@ -10524,11 +10558,11 @@ var TextMarkType = (0, import_superenum18.superenum)({
|
|
|
10524
10558
|
duration: "duration",
|
|
10525
10559
|
color: "color",
|
|
10526
10560
|
comment: "comment"
|
|
10527
|
-
}
|
|
10561
|
+
};
|
|
10528
10562
|
|
|
10529
10563
|
// src/model/enum/TextNodeType.ts
|
|
10530
|
-
var
|
|
10531
|
-
var TextNodeType =
|
|
10564
|
+
var import_superenum21 = require("@ncoderz/superenum");
|
|
10565
|
+
var TextNodeType = {
|
|
10532
10566
|
// Text
|
|
10533
10567
|
text: "text",
|
|
10534
10568
|
// Blocks
|
|
@@ -10556,11 +10590,11 @@ var TextNodeType = (0, import_superenum19.superenum)({
|
|
|
10556
10590
|
select: "select",
|
|
10557
10591
|
highlight: "highlight",
|
|
10558
10592
|
mark: "mark"
|
|
10559
|
-
}
|
|
10593
|
+
};
|
|
10560
10594
|
|
|
10561
10595
|
// src/model/ast/NodeType.ts
|
|
10562
|
-
var
|
|
10563
|
-
var NodeType =
|
|
10596
|
+
var import_superenum22 = require("@ncoderz/superenum");
|
|
10597
|
+
var NodeType = {
|
|
10564
10598
|
unknown: "unknown",
|
|
10565
10599
|
// unknown
|
|
10566
10600
|
__isDefaultExample: "__isDefaultExample",
|
|
@@ -10823,6 +10857,8 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
10823
10857
|
iconValue: "iconValue",
|
|
10824
10858
|
id: "id",
|
|
10825
10859
|
idValue: "idValue",
|
|
10860
|
+
iframeSrc: "iframeSrc",
|
|
10861
|
+
iframeName: "iframeName",
|
|
10826
10862
|
image: "image",
|
|
10827
10863
|
imageFirst: "imageFirst",
|
|
10828
10864
|
imageFirstValue: "imageFirstValue",
|
|
@@ -11241,7 +11277,7 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
11241
11277
|
y: "y",
|
|
11242
11278
|
yValue: "yValue",
|
|
11243
11279
|
zoomDisabled: "zoomDisabled"
|
|
11244
|
-
}
|
|
11280
|
+
};
|
|
11245
11281
|
|
|
11246
11282
|
// src/ast/Ast.ts
|
|
11247
11283
|
var Ast = class {
|
|
@@ -11424,7 +11460,7 @@ var Ast = class {
|
|
|
11424
11460
|
if (isParentArray && parentKey) {
|
|
11425
11461
|
astKey = `${parentKey}Value`;
|
|
11426
11462
|
}
|
|
11427
|
-
return NodeType.fromKey(astKey) || `unknown(${astKey})`;
|
|
11463
|
+
return (0, import_superenum23.Enum)(NodeType).fromKey(astKey) || `unknown(${astKey})`;
|
|
11428
11464
|
}
|
|
11429
11465
|
isArray(x) {
|
|
11430
11466
|
return Array.isArray(x);
|
|
@@ -11437,16 +11473,19 @@ var Ast = class {
|
|
|
11437
11473
|
}
|
|
11438
11474
|
};
|
|
11439
11475
|
|
|
11476
|
+
// src/ast/Builder.ts
|
|
11477
|
+
var import_superenum30 = require("@ncoderz/superenum");
|
|
11478
|
+
|
|
11440
11479
|
// src/model/enum/TextLocation.ts
|
|
11441
|
-
var
|
|
11442
|
-
var TextLocation2 =
|
|
11480
|
+
var import_superenum24 = require("@ncoderz/superenum");
|
|
11481
|
+
var TextLocation2 = {
|
|
11443
11482
|
tag: "tag",
|
|
11444
11483
|
body: "body"
|
|
11445
|
-
}
|
|
11484
|
+
};
|
|
11446
11485
|
|
|
11447
11486
|
// src/model/enum/BodyTextFormat.ts
|
|
11448
|
-
var
|
|
11449
|
-
var BodyTextFormat =
|
|
11487
|
+
var import_superenum25 = require("@ncoderz/superenum");
|
|
11488
|
+
var BodyTextFormat = {
|
|
11450
11489
|
plainText: "text",
|
|
11451
11490
|
// plain text
|
|
11452
11491
|
latex: "latex",
|
|
@@ -11457,7 +11496,7 @@ var BodyTextFormat = (0, import_superenum22.superenum)({
|
|
|
11457
11496
|
// xml
|
|
11458
11497
|
// bitmark++ text
|
|
11459
11498
|
bitmarkPlusPlus: "bitmark++"
|
|
11460
|
-
}
|
|
11499
|
+
};
|
|
11461
11500
|
|
|
11462
11501
|
// src/breakscaping/RegexConfigs.ts
|
|
11463
11502
|
var REGEX_MARKS = /([*`_!=])(?=\1)/;
|
|
@@ -11706,11 +11745,11 @@ var Breakscape3 = class {
|
|
|
11706
11745
|
var instance3 = new Breakscape3();
|
|
11707
11746
|
|
|
11708
11747
|
// src/model/enum/DeprecatedTextFormat.ts
|
|
11709
|
-
var
|
|
11710
|
-
var DeprecatedTextFormat =
|
|
11748
|
+
var import_superenum26 = require("@ncoderz/superenum");
|
|
11749
|
+
var DeprecatedTextFormat = {
|
|
11711
11750
|
bitmarkMinusMinus: "bitmark--"
|
|
11712
11751
|
// bitmark-- text format, deprecated
|
|
11713
|
-
}
|
|
11752
|
+
};
|
|
11714
11753
|
|
|
11715
11754
|
// src/parser/json/TableUtils.ts
|
|
11716
11755
|
function isTableBasicFormat(table) {
|
|
@@ -11869,14 +11908,14 @@ var ArrayUtils = class {
|
|
|
11869
11908
|
var instance4 = new ArrayUtils();
|
|
11870
11909
|
|
|
11871
11910
|
// src/generator/text/TextGenerator.ts
|
|
11872
|
-
var
|
|
11911
|
+
var import_superenum28 = require("@ncoderz/superenum");
|
|
11873
11912
|
|
|
11874
11913
|
// src/model/enum/BitmarkVersion.ts
|
|
11875
|
-
var
|
|
11876
|
-
var BitmarkVersion =
|
|
11914
|
+
var import_superenum27 = require("@ncoderz/superenum");
|
|
11915
|
+
var BitmarkVersion = {
|
|
11877
11916
|
v2: 2,
|
|
11878
11917
|
v3: 3
|
|
11879
|
-
}
|
|
11918
|
+
};
|
|
11880
11919
|
var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
|
|
11881
11920
|
|
|
11882
11921
|
// src/generator/AstWalkerGenerator.ts
|
|
@@ -12063,7 +12102,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12063
12102
|
__publicField(this, "preTextIndexTemp", -1);
|
|
12064
12103
|
__publicField(this, "havePreText", false);
|
|
12065
12104
|
__publicField(this, "preTextIndex", -1);
|
|
12066
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12105
|
+
this.bitmarkVersion = (0, import_superenum28.Enum)(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12067
12106
|
this.options = {
|
|
12068
12107
|
...DEFAULT_OPTIONS,
|
|
12069
12108
|
...options
|
|
@@ -22248,6 +22287,9 @@ var BitUtils = class {
|
|
|
22248
22287
|
};
|
|
22249
22288
|
var instance7 = new BitUtils();
|
|
22250
22289
|
|
|
22290
|
+
// src/ast/ResourceBuilder.ts
|
|
22291
|
+
var import_superenum29 = require("@ncoderz/superenum");
|
|
22292
|
+
|
|
22251
22293
|
// src/utils/UrlUtils.ts
|
|
22252
22294
|
var UrlUtils = class {
|
|
22253
22295
|
fileExtensionFromUrl(url) {
|
|
@@ -22487,11 +22529,11 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22487
22529
|
const nodes = [];
|
|
22488
22530
|
if (!Array.isArray(resource)) resource = [resource];
|
|
22489
22531
|
for (const thisResource of resource) {
|
|
22490
|
-
let type = ResourceType.fromValue(thisResource.type);
|
|
22532
|
+
let type = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.type);
|
|
22491
22533
|
if (!type) return void 0;
|
|
22492
|
-
const resourceKey = ResourceType.keyFromValue(type);
|
|
22534
|
+
const resourceKey = (0, import_superenum29.Enum)(ResourceType).keyFromValue(type);
|
|
22493
22535
|
if (!resourceKey) return void 0;
|
|
22494
|
-
const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
|
|
22536
|
+
const __typeAlias = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.__typeAlias);
|
|
22495
22537
|
type = __typeAlias ?? type;
|
|
22496
22538
|
let data;
|
|
22497
22539
|
if (type === ResourceType.imageResponsive) {
|
|
@@ -22527,7 +22569,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22527
22569
|
}
|
|
22528
22570
|
resourceFromResourceDataJson(context, type, data) {
|
|
22529
22571
|
if (!data) return void 0;
|
|
22530
|
-
type = ResourceType.fromValue(type);
|
|
22572
|
+
type = (0, import_superenum29.Enum)(ResourceType).fromValue(type);
|
|
22531
22573
|
if (!type) return void 0;
|
|
22532
22574
|
const dataAsString = stringUtils.isString(data) ? data : void 0;
|
|
22533
22575
|
const url = data.url || data.src || data.body || dataAsString;
|
|
@@ -23640,8 +23682,8 @@ var Builder = class extends BaseBuilder {
|
|
|
23640
23682
|
data = structuredClone(data);
|
|
23641
23683
|
const bitType = data.bitType;
|
|
23642
23684
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
23643
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
|
|
23644
|
-
let textFormat = TextFormat2.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23685
|
+
const deprecatedTextFormat = (0, import_superenum30.Enum)(DeprecatedTextFormat).fromValue(data.textFormat);
|
|
23686
|
+
let textFormat = (0, import_superenum30.Enum)(TextFormat2).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23645
23687
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
23646
23688
|
textFormat = TextFormat2.bitmarkText;
|
|
23647
23689
|
}
|
|
@@ -23664,7 +23706,7 @@ var Builder = class extends BaseBuilder {
|
|
|
23664
23706
|
bitType,
|
|
23665
23707
|
bitLevel: data.bitLevel,
|
|
23666
23708
|
textFormat,
|
|
23667
|
-
resourceType: ResourceType.fromValue(data.resourceType),
|
|
23709
|
+
resourceType: (0, import_superenum30.Enum)(ResourceType).fromValue(data.resourceType),
|
|
23668
23710
|
isCommented: data.isCommented,
|
|
23669
23711
|
// Properties
|
|
23670
23712
|
id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
|
|
@@ -23812,6 +23854,13 @@ var Builder = class extends BaseBuilder {
|
|
|
23812
23854
|
data.releaseDate,
|
|
23813
23855
|
options
|
|
23814
23856
|
),
|
|
23857
|
+
iframeSrc: this.toAstProperty(bitType, ConfigKey.property_iframeSrc, data.iframeSrc, options),
|
|
23858
|
+
iframeName: this.toAstProperty(
|
|
23859
|
+
bitType,
|
|
23860
|
+
ConfigKey.property_iframeName,
|
|
23861
|
+
data.iframeName,
|
|
23862
|
+
options
|
|
23863
|
+
),
|
|
23815
23864
|
book: this.buildBooks(context, data.book),
|
|
23816
23865
|
ageRange: this.toAstProperty(bitType, ConfigKey.property_ageRange, data.ageRange, options),
|
|
23817
23866
|
lang: this.toAstProperty(bitType, ConfigKey.property_lang, data.lang, options),
|
|
@@ -24982,14 +25031,14 @@ var Builder = class extends BaseBuilder {
|
|
|
24982
25031
|
response: data.response ?? "",
|
|
24983
25032
|
reaction: data.reaction ?? "",
|
|
24984
25033
|
feedback: data.feedback ?? "",
|
|
24985
|
-
item:
|
|
25034
|
+
item: data.item ?? "",
|
|
24986
25035
|
lead: this.handleJsonText(context, TextLocation2.tag, data.lead),
|
|
24987
25036
|
hint: this.handleJsonText(context, TextLocation2.tag, data.hint)
|
|
24988
25037
|
};
|
|
24989
25038
|
objectUtils.removeUnwantedProperties(node, {
|
|
24990
|
-
ignoreEmptyString: ["response", "reaction", "feedback"],
|
|
25039
|
+
ignoreEmptyString: ["response", "reaction", "feedback", "item"],
|
|
24991
25040
|
ignoreAllFalse: true,
|
|
24992
|
-
ignoreEmptyArrays: [
|
|
25041
|
+
ignoreEmptyArrays: [],
|
|
24993
25042
|
ignoreUndefined: ["example"]
|
|
24994
25043
|
});
|
|
24995
25044
|
return node;
|
|
@@ -26607,14 +26656,17 @@ var StringWriter = class {
|
|
|
26607
26656
|
};
|
|
26608
26657
|
|
|
26609
26658
|
// src/BitmarkParserGenerator.ts
|
|
26610
|
-
var
|
|
26659
|
+
var import_superenum50 = require("@ncoderz/superenum");
|
|
26660
|
+
|
|
26661
|
+
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26662
|
+
var import_superenum32 = require("@ncoderz/superenum");
|
|
26611
26663
|
|
|
26612
26664
|
// src/model/enum/CardSetVersion.ts
|
|
26613
|
-
var
|
|
26614
|
-
var CardSetVersion =
|
|
26665
|
+
var import_superenum31 = require("@ncoderz/superenum");
|
|
26666
|
+
var CardSetVersion = {
|
|
26615
26667
|
v1: 1,
|
|
26616
26668
|
v2: 2
|
|
26617
|
-
}
|
|
26669
|
+
};
|
|
26618
26670
|
|
|
26619
26671
|
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26620
26672
|
var DEFAULT_OPTIONS2 = {
|
|
@@ -26669,7 +26721,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
26669
26721
|
this.leaf = this.leaf.bind(this);
|
|
26670
26722
|
this.write = this.write.bind(this);
|
|
26671
26723
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
26672
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26724
|
+
this.bitmarkVersion = (0, import_superenum32.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26673
26725
|
this.options = {
|
|
26674
26726
|
...DEFAULT_OPTIONS2,
|
|
26675
26727
|
...options?.bitmarkOptions
|
|
@@ -27231,7 +27283,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27231
27283
|
this.inTag = true;
|
|
27232
27284
|
}
|
|
27233
27285
|
bodyBitCallback(bodyBit, _index, _route) {
|
|
27234
|
-
const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27286
|
+
const nodeType = (0, import_superenum32.Enum)(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27235
27287
|
this.ast.walk(bodyBit, nodeType, this, void 0);
|
|
27236
27288
|
return "";
|
|
27237
27289
|
}
|
|
@@ -27776,6 +27828,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27776
27828
|
between_cardBits(_node, _left, _right, _route) {
|
|
27777
27829
|
this.writeCardSetCardDivider();
|
|
27778
27830
|
}
|
|
27831
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> item
|
|
27832
|
+
leaf_item(node, route) {
|
|
27833
|
+
const parent = this.getParentNode(route);
|
|
27834
|
+
if (parent?.key !== NodeType.botResponsesValue) return;
|
|
27835
|
+
this.writeNL();
|
|
27836
|
+
this.writeOPC();
|
|
27837
|
+
this.writeTextOrValue(node.value, TextFormat2.plainText, TextLocation2.tag);
|
|
27838
|
+
this.writeCL();
|
|
27839
|
+
}
|
|
27779
27840
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
27780
27841
|
leaf_response(node, route) {
|
|
27781
27842
|
const parent = this.getParentNode(route);
|
|
@@ -28437,8 +28498,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28437
28498
|
* Generate the handlers for resources, as they are mostly the same, but not quite
|
|
28438
28499
|
*/
|
|
28439
28500
|
generateResourceHandlers() {
|
|
28440
|
-
for (const tag of ResourceType.keys()) {
|
|
28441
|
-
if (tag === ResourceType.keyFromValue(ResourceType.unknown)) continue;
|
|
28501
|
+
for (const tag of (0, import_superenum32.Enum)(ResourceType).keys()) {
|
|
28502
|
+
if (tag === (0, import_superenum32.Enum)(ResourceType).keyFromValue(ResourceType.unknown)) continue;
|
|
28442
28503
|
const enterFuncName = `enter_${tag}`;
|
|
28443
28504
|
if (typeof this[enterFuncName] === "function") {
|
|
28444
28505
|
continue;
|
|
@@ -28448,8 +28509,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28448
28509
|
if (resource == null) return false;
|
|
28449
28510
|
const parent = this.getParentNode(route);
|
|
28450
28511
|
if (parent?.key !== NodeType.resourcesValue) return true;
|
|
28451
|
-
const alias = ResourceType.fromValue(parent
|
|
28452
|
-
const type = alias ?? ResourceType.fromValue(parent
|
|
28512
|
+
const alias = (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.__typeAlias);
|
|
28513
|
+
const type = alias ?? (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.type);
|
|
28453
28514
|
if (!type) return false;
|
|
28454
28515
|
const url = resource.url || resource.src || resource.body || "";
|
|
28455
28516
|
this.writeNL();
|
|
@@ -28463,7 +28524,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28463
28524
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
28464
28525
|
*/
|
|
28465
28526
|
generatePropertyHandlers() {
|
|
28466
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
28527
|
+
for (const propertyConfigKey of (0, import_superenum32.Enum)(PropertyKey).values()) {
|
|
28467
28528
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
28468
28529
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
28469
28530
|
for (const funcName of funcNames) {
|
|
@@ -28813,7 +28874,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28813
28874
|
}
|
|
28814
28875
|
writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
|
|
28815
28876
|
if (key && resource) {
|
|
28816
|
-
const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
|
|
28877
|
+
const resourceTag = (0, import_superenum32.Enum)(ResourceType).keyFromValue(resource.type) ?? "";
|
|
28817
28878
|
const resourceData = resource[resourceTag];
|
|
28818
28879
|
const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
|
|
28819
28880
|
if (deprecated_writeAsProperty) {
|
|
@@ -28898,7 +28959,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28898
28959
|
return true;
|
|
28899
28960
|
}
|
|
28900
28961
|
isWriteTextFormat(bitsValue, textFormatDefault) {
|
|
28901
|
-
const isDefault = TextFormat2.fromValue(bitsValue) === textFormatDefault;
|
|
28962
|
+
const isDefault = (0, import_superenum32.Enum)(TextFormat2).fromValue(bitsValue) === textFormatDefault;
|
|
28902
28963
|
const writeFormat = !isDefault || this.options.explicitTextFormat;
|
|
28903
28964
|
return !!writeFormat;
|
|
28904
28965
|
}
|
|
@@ -28990,6 +29051,7 @@ var BitmarkStringGenerator = class {
|
|
|
28990
29051
|
};
|
|
28991
29052
|
|
|
28992
29053
|
// src/generator/json/JsonGenerator.ts
|
|
29054
|
+
var import_superenum33 = require("@ncoderz/superenum");
|
|
28993
29055
|
var MOVE_BODY_RECURSION_LIMIT = 5e3;
|
|
28994
29056
|
var DEFAULT_OPTIONS3 = {
|
|
28995
29057
|
// debugGenerationInline: true,
|
|
@@ -29026,7 +29088,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29026
29088
|
this.exit = this.exit.bind(this);
|
|
29027
29089
|
this.leaf = this.leaf.bind(this);
|
|
29028
29090
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
29029
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29091
|
+
this.bitmarkVersion = (0, import_superenum33.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29030
29092
|
this.textParserVersion = this.textParser.version();
|
|
29031
29093
|
this.options = {
|
|
29032
29094
|
...DEFAULT_OPTIONS3,
|
|
@@ -29380,7 +29442,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29380
29442
|
throw new Error("Recursion limit exceeded");
|
|
29381
29443
|
}
|
|
29382
29444
|
for (const node of nodes) {
|
|
29383
|
-
if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
|
|
29445
|
+
if (node.type !== BodyBitType.text && (0, import_superenum33.Enum)(BodyBitType).values().includes(node.type)) {
|
|
29384
29446
|
const bodyBit = node;
|
|
29385
29447
|
bodyBit.attrs = {};
|
|
29386
29448
|
for (const [key, value] of Object.entries(bodyBit)) {
|
|
@@ -29667,7 +29729,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29667
29729
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
29668
29730
|
*/
|
|
29669
29731
|
generatePropertyHandlers() {
|
|
29670
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
29732
|
+
for (const propertyConfigKey of (0, import_superenum33.Enum)(PropertyKey).values()) {
|
|
29671
29733
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
29672
29734
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
29673
29735
|
for (const funcName of funcNames) {
|
|
@@ -29783,7 +29845,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29783
29845
|
for (const node of route) {
|
|
29784
29846
|
if (node.key === NodeType.bitsValue) {
|
|
29785
29847
|
const n = node.value;
|
|
29786
|
-
return TextFormat2.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29848
|
+
return (0, import_superenum33.Enum)(TextFormat2).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29787
29849
|
}
|
|
29788
29850
|
}
|
|
29789
29851
|
}
|
|
@@ -30332,12 +30394,13 @@ var JsonObjectGenerator = class {
|
|
|
30332
30394
|
};
|
|
30333
30395
|
|
|
30334
30396
|
// src/info/InfoBuilder.ts
|
|
30397
|
+
var import_superenum34 = require("@ncoderz/superenum");
|
|
30335
30398
|
var InfoBuilder = class {
|
|
30336
30399
|
getSupportedBits(options) {
|
|
30337
30400
|
const includeNonDeprecated = options?.includeNonDeprecated ?? true;
|
|
30338
30401
|
const includeDeprecated = options?.includeDeprecated ?? false;
|
|
30339
30402
|
const supportedBits = [];
|
|
30340
|
-
for (const bt of BitType.values()) {
|
|
30403
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30341
30404
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30342
30405
|
const bitType = instance2.getBitType(bt);
|
|
30343
30406
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
@@ -30356,7 +30419,7 @@ var InfoBuilder = class {
|
|
|
30356
30419
|
}
|
|
30357
30420
|
getSupportedBitConfigs() {
|
|
30358
30421
|
const res = [];
|
|
30359
|
-
for (const bt of BitType.values()) {
|
|
30422
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30360
30423
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30361
30424
|
const bitType = instance2.getBitType(bt);
|
|
30362
30425
|
const config = instance2.getBitConfig(bitType);
|
|
@@ -30367,22 +30430,22 @@ var InfoBuilder = class {
|
|
|
30367
30430
|
};
|
|
30368
30431
|
|
|
30369
30432
|
// src/model/enum/BitmarkParserType.ts
|
|
30370
|
-
var
|
|
30371
|
-
var BitmarkParserType =
|
|
30433
|
+
var import_superenum35 = require("@ncoderz/superenum");
|
|
30434
|
+
var BitmarkParserType = {
|
|
30372
30435
|
peggy: "peggy"
|
|
30373
|
-
}
|
|
30436
|
+
};
|
|
30374
30437
|
|
|
30375
30438
|
// src/model/info/enum/InfoFormat.ts
|
|
30376
|
-
var
|
|
30377
|
-
var InfoFormat =
|
|
30439
|
+
var import_superenum36 = require("@ncoderz/superenum");
|
|
30440
|
+
var InfoFormat = {
|
|
30378
30441
|
text: "text",
|
|
30379
30442
|
json: "json",
|
|
30380
30443
|
pojo: "pojo"
|
|
30381
|
-
}
|
|
30444
|
+
};
|
|
30382
30445
|
|
|
30383
30446
|
// src/model/info/enum/InfoType.ts
|
|
30384
|
-
var
|
|
30385
|
-
var InfoType =
|
|
30447
|
+
var import_superenum37 = require("@ncoderz/superenum");
|
|
30448
|
+
var InfoType = {
|
|
30386
30449
|
list: "list",
|
|
30387
30450
|
// List non-deprecated bits
|
|
30388
30451
|
deprecated: "deprecated",
|
|
@@ -30391,9 +30454,10 @@ var InfoType = (0, import_superenum29.superenum)({
|
|
|
30391
30454
|
// List all bits
|
|
30392
30455
|
bit: "bit"
|
|
30393
30456
|
// Get information for a bit
|
|
30394
|
-
}
|
|
30457
|
+
};
|
|
30395
30458
|
|
|
30396
30459
|
// src/parser/json/JsonParser.ts
|
|
30460
|
+
var import_superenum38 = require("@ncoderz/superenum");
|
|
30397
30461
|
var builder = new Builder();
|
|
30398
30462
|
var JsonParser = class {
|
|
30399
30463
|
/**
|
|
@@ -30495,8 +30559,8 @@ var JsonParser = class {
|
|
|
30495
30559
|
const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
|
|
30496
30560
|
const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
|
|
30497
30561
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
30498
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
|
|
30499
|
-
let _textFormat = TextFormat2.fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30562
|
+
const deprecatedTextFormat = (0, import_superenum38.Enum)(DeprecatedTextFormat).fromValue(bit.format);
|
|
30563
|
+
let _textFormat = (0, import_superenum38.Enum)(TextFormat2).fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30500
30564
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
30501
30565
|
_textFormat = TextFormat2.bitmarkText;
|
|
30502
30566
|
}
|
|
@@ -30573,7 +30637,7 @@ var JsonParser = class {
|
|
|
30573
30637
|
}
|
|
30574
30638
|
getResourceType(resource) {
|
|
30575
30639
|
if (resource) {
|
|
30576
|
-
const resourceKey = ResourceType.fromValue(resource.type);
|
|
30640
|
+
const resourceKey = (0, import_superenum38.Enum)(ResourceType).fromValue(resource.type);
|
|
30577
30641
|
return resourceKey;
|
|
30578
30642
|
}
|
|
30579
30643
|
return void 0;
|
|
@@ -30645,7 +30709,7 @@ var JsonParser = class {
|
|
|
30645
30709
|
};
|
|
30646
30710
|
|
|
30647
30711
|
// src/parser/bitmark/peg/BitmarkPegParserTypes.ts
|
|
30648
|
-
var
|
|
30712
|
+
var import_superenum39 = require("@ncoderz/superenum");
|
|
30649
30713
|
|
|
30650
30714
|
// src/parser/bitmark/peg/PeggyGrammarLocation.ts
|
|
30651
30715
|
var PeggyGrammarLocation = class {
|
|
@@ -30725,7 +30789,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
|
|
|
30725
30789
|
var CARD_DIVIDER_V1 = "===";
|
|
30726
30790
|
var CARD_SIDE_DIVIDER_V1 = "==";
|
|
30727
30791
|
var CARD_VARIANT_DIVIDER_V1 = "--";
|
|
30728
|
-
var TypeKey =
|
|
30792
|
+
var TypeKey = {
|
|
30729
30793
|
// Bit header
|
|
30730
30794
|
TextFormat: "TextFormat",
|
|
30731
30795
|
ResourceType: "ResourceType",
|
|
@@ -30760,14 +30824,15 @@ var TypeKey = (0, import_superenum30.superenum)({
|
|
|
30760
30824
|
// Dividers
|
|
30761
30825
|
PlainTextDivider: "PlainTextDivider",
|
|
30762
30826
|
FooterDivider: "FooterDivider"
|
|
30763
|
-
}
|
|
30764
|
-
var ContentDepth =
|
|
30827
|
+
};
|
|
30828
|
+
var ContentDepth = {
|
|
30765
30829
|
Bit: "Bit",
|
|
30766
30830
|
Card: "Card",
|
|
30767
30831
|
Chain: "Chain"
|
|
30768
|
-
}
|
|
30832
|
+
};
|
|
30769
30833
|
|
|
30770
30834
|
// src/parser/bitmark/peg/BitmarkPegParserHelper.ts
|
|
30835
|
+
var import_superenum40 = require("@ncoderz/superenum");
|
|
30771
30836
|
var DEBUG_TRACE_RAW_BIT = true;
|
|
30772
30837
|
var DEBUG_TRACE_TEXT_FORMAT = false;
|
|
30773
30838
|
var DEBUG_TRACE_RESOURCE_TYPE = false;
|
|
@@ -30857,7 +30922,7 @@ var BitmarkPegParserHelper = class {
|
|
|
30857
30922
|
if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
|
|
30858
30923
|
return {
|
|
30859
30924
|
type,
|
|
30860
|
-
key: Tag.fromValue(type),
|
|
30925
|
+
key: (0, import_superenum40.Enum)(Tag).fromValue(type),
|
|
30861
30926
|
value,
|
|
30862
30927
|
parser: {
|
|
30863
30928
|
text: this.parserText(),
|
|
@@ -31252,7 +31317,7 @@ var BitmarkPegParserHelper = class {
|
|
|
31252
31317
|
if (!value) return false;
|
|
31253
31318
|
const { type } = value;
|
|
31254
31319
|
if (!validType) {
|
|
31255
|
-
return !!TypeKey.fromValue(type);
|
|
31320
|
+
return !!(0, import_superenum40.Enum)(TypeKey).fromValue(type);
|
|
31256
31321
|
}
|
|
31257
31322
|
if (Array.isArray(validType)) {
|
|
31258
31323
|
return validType.indexOf(type) >= 0;
|
|
@@ -31322,7 +31387,11 @@ var BitmarkPegParserHelper = class {
|
|
|
31322
31387
|
}
|
|
31323
31388
|
};
|
|
31324
31389
|
|
|
31390
|
+
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31391
|
+
var import_superenum49 = require("@ncoderz/superenum");
|
|
31392
|
+
|
|
31325
31393
|
// src/parser/bitmark/peg/BitmarkPegParserValidator.ts
|
|
31394
|
+
var import_superenum41 = require("@ncoderz/superenum");
|
|
31326
31395
|
var COMMON_MISTAKE_STRINGS = [
|
|
31327
31396
|
// Card divider errors
|
|
31328
31397
|
"----",
|
|
@@ -31494,7 +31563,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31494
31563
|
const content = dataOrNull[i];
|
|
31495
31564
|
if (!content) continue;
|
|
31496
31565
|
const { type, key } = content;
|
|
31497
|
-
let typeKey = TypeKey.fromValue(type);
|
|
31566
|
+
let typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(type);
|
|
31498
31567
|
if (!typeKey) continue;
|
|
31499
31568
|
let validTypeKey = typeKey;
|
|
31500
31569
|
if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
|
|
@@ -31917,7 +31986,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31917
31986
|
} else if (tagValidationData.isResource) {
|
|
31918
31987
|
res.set(v.configKey, tagValidationData);
|
|
31919
31988
|
} else {
|
|
31920
|
-
const typeKey = TypeKey.fromValue(v.tag);
|
|
31989
|
+
const typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(v.tag);
|
|
31921
31990
|
if (typeKey) {
|
|
31922
31991
|
res.set(typeKey, tagValidationData);
|
|
31923
31992
|
}
|
|
@@ -32930,12 +32999,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
32930
32999
|
for (const card of cardSet.cards) {
|
|
32931
33000
|
for (const side of card.sides) {
|
|
32932
33001
|
for (const content of side.variants) {
|
|
32933
|
-
const {
|
|
33002
|
+
const {
|
|
33003
|
+
__instructionString,
|
|
33004
|
+
__itemString,
|
|
33005
|
+
reaction,
|
|
33006
|
+
cardBodyStr: feedback,
|
|
33007
|
+
...tags2
|
|
33008
|
+
} = content.data;
|
|
32934
33009
|
const botResponse = {
|
|
32935
33010
|
response: __instructionString ?? instance3.EMPTY_STRING,
|
|
32936
33011
|
reaction: reaction ?? instance3.EMPTY_STRING,
|
|
32937
33012
|
feedback: feedback ?? instance3.EMPTY_STRING,
|
|
32938
|
-
...tags2
|
|
33013
|
+
...tags2,
|
|
33014
|
+
item: __itemString ?? instance3.EMPTY_STRING
|
|
32939
33015
|
};
|
|
32940
33016
|
if (botResponse) botResponses.push(botResponse);
|
|
32941
33017
|
}
|
|
@@ -33171,6 +33247,9 @@ var FooterContentProcessor = class {
|
|
|
33171
33247
|
};
|
|
33172
33248
|
var instance12 = new FooterContentProcessor();
|
|
33173
33249
|
|
|
33250
|
+
// src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
|
|
33251
|
+
var import_superenum42 = require("@ncoderz/superenum");
|
|
33252
|
+
|
|
33174
33253
|
// src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
|
|
33175
33254
|
var textParser4 = new TextParser();
|
|
33176
33255
|
function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
@@ -33206,7 +33285,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33206
33285
|
}
|
|
33207
33286
|
function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
33208
33287
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
|
|
33209
|
-
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33288
|
+
const gapConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum42.Enum)(Tag).fromValue(content.type));
|
|
33210
33289
|
const chainContent = [content, ...content.chain ?? []];
|
|
33211
33290
|
const chainTags = context.bitContentProcessor(
|
|
33212
33291
|
ContentDepth.Chain,
|
|
@@ -33221,6 +33300,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
|
33221
33300
|
return gap;
|
|
33222
33301
|
}
|
|
33223
33302
|
|
|
33303
|
+
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
33304
|
+
var import_superenum43 = require("@ncoderz/superenum");
|
|
33305
|
+
|
|
33224
33306
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
|
|
33225
33307
|
function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
33226
33308
|
const { textFormat } = context;
|
|
@@ -33233,6 +33315,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
|
|
|
33233
33315
|
location: TextLocation2.tag
|
|
33234
33316
|
});
|
|
33235
33317
|
target.itemLead.push(text);
|
|
33318
|
+
if (!target.__itemLeadString) target.__itemLeadString = [];
|
|
33319
|
+
target.__itemLeadString.push(
|
|
33320
|
+
instance3.unbreakscape(trimmedStringValue, {
|
|
33321
|
+
format: TextFormat2.bitmarkText,
|
|
33322
|
+
location: TextLocation2.tag
|
|
33323
|
+
})
|
|
33324
|
+
);
|
|
33236
33325
|
}
|
|
33237
33326
|
|
|
33238
33327
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
@@ -33245,7 +33334,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
|
|
|
33245
33334
|
}
|
|
33246
33335
|
function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
33247
33336
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
|
|
33248
|
-
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33337
|
+
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum43.Enum)(Tag).fromValue(content.type));
|
|
33249
33338
|
const chainContent = [content, ...content.chain ?? []];
|
|
33250
33339
|
const chainTags = context.bitContentProcessor(
|
|
33251
33340
|
ContentDepth.Chain,
|
|
@@ -33254,8 +33343,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
|
33254
33343
|
);
|
|
33255
33344
|
if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
|
|
33256
33345
|
target.itemLead = chainTags.itemLead;
|
|
33346
|
+
target.__itemLeadString = chainTags.__itemLeadString;
|
|
33257
33347
|
}
|
|
33258
33348
|
|
|
33349
|
+
// src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
|
|
33350
|
+
var import_superenum44 = require("@ncoderz/superenum");
|
|
33351
|
+
|
|
33259
33352
|
// src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
|
|
33260
33353
|
function markTagContentProcessor(_context, _contentDepth, content, target) {
|
|
33261
33354
|
const { value } = content;
|
|
@@ -33280,7 +33373,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
|
|
|
33280
33373
|
}
|
|
33281
33374
|
function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
33282
33375
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33283
|
-
const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33376
|
+
const markConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum44.Enum)(Tag).fromValue(content.type));
|
|
33284
33377
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33285
33378
|
const chainTags = context.bitContentProcessor(
|
|
33286
33379
|
ContentDepth.Chain,
|
|
@@ -33299,6 +33392,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
|
33299
33392
|
return mark;
|
|
33300
33393
|
}
|
|
33301
33394
|
|
|
33395
|
+
// src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
|
|
33396
|
+
var import_superenum47 = require("@ncoderz/superenum");
|
|
33397
|
+
|
|
33302
33398
|
// src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
|
|
33303
33399
|
function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33304
33400
|
if (contentDepth === ContentDepth.Chain) {
|
|
@@ -33473,6 +33569,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
|
|
|
33473
33569
|
}
|
|
33474
33570
|
|
|
33475
33571
|
// src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
|
|
33572
|
+
var import_superenum45 = require("@ncoderz/superenum");
|
|
33476
33573
|
function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33477
33574
|
if (contentDepth === ContentDepth.Chain) {
|
|
33478
33575
|
imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
|
|
@@ -33491,7 +33588,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
|
|
|
33491
33588
|
function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
|
|
33492
33589
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
|
|
33493
33590
|
const { key: tag } = content;
|
|
33494
|
-
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33591
|
+
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum45.Enum)(ConfigKey).fromValue(tag));
|
|
33495
33592
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33496
33593
|
const chainTags = context.bitContentProcessor(
|
|
33497
33594
|
ContentDepth.Chain,
|
|
@@ -33525,12 +33622,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
|
|
|
33525
33622
|
}
|
|
33526
33623
|
|
|
33527
33624
|
// src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
|
|
33625
|
+
var import_superenum46 = require("@ncoderz/superenum");
|
|
33528
33626
|
function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|
|
33529
33627
|
const { key: tag } = content;
|
|
33530
33628
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33531
33629
|
const markConfig = target.markConfig;
|
|
33532
33630
|
if (!markConfig) return;
|
|
33533
|
-
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33631
|
+
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum46.Enum)(ConfigKey).fromValue(tag));
|
|
33534
33632
|
const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
|
|
33535
33633
|
ContentDepth.Chain,
|
|
33536
33634
|
markTagConfig?.chain,
|
|
@@ -33663,7 +33761,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33663
33761
|
const { value } = content;
|
|
33664
33762
|
const { key: keyIn } = content;
|
|
33665
33763
|
const isChain = contentDepth === ContentDepth.Chain;
|
|
33666
|
-
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
|
|
33764
|
+
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum47.Enum)(PropertyKey).fromValue(keyIn));
|
|
33667
33765
|
const configKey = propertyConfig ? propertyConfig.configKey : void 0;
|
|
33668
33766
|
let property = configKeyToPropertyType(keyIn);
|
|
33669
33767
|
if (configKey === ConfigKey.property_internalComment) {
|
|
@@ -33820,12 +33918,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
|
|
|
33820
33918
|
}
|
|
33821
33919
|
|
|
33822
33920
|
// src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
|
|
33921
|
+
var import_superenum48 = require("@ncoderz/superenum");
|
|
33823
33922
|
var resourceBuilder = new ResourceBuilder();
|
|
33824
33923
|
function buildResources(context, resourceTypeAttachment, resources) {
|
|
33825
33924
|
const { bitType } = context;
|
|
33826
33925
|
const filteredResources = [];
|
|
33827
33926
|
const excessResources = [];
|
|
33828
|
-
const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
|
|
33927
|
+
const validatedResourceTypeAttachemnt = (0, import_superenum48.Enum)(ResourceType).fromValue(resourceTypeAttachment);
|
|
33829
33928
|
const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
|
|
33830
33929
|
const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
|
|
33831
33930
|
const countsMin = resourcesConfig.getCountsMin();
|
|
@@ -33869,9 +33968,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
|
|
|
33869
33968
|
const { type: _ignoreType, key, value, chain } = content;
|
|
33870
33969
|
const resources = target.resources;
|
|
33871
33970
|
if (!resources) return;
|
|
33872
|
-
const configKey = ConfigKey.fromValue(key);
|
|
33971
|
+
const configKey = (0, import_superenum48.Enum)(ConfigKey).fromValue(key);
|
|
33873
33972
|
if (!configKey) return;
|
|
33874
|
-
const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33973
|
+
const resourceType = (0, import_superenum48.Enum)(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33875
33974
|
const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
|
|
33876
33975
|
const { posterImage, ...tags2 } = context.bitContentProcessor(
|
|
33877
33976
|
ContentDepth.Chain,
|
|
@@ -34363,14 +34462,14 @@ var BitmarkPegParserProcessor = class {
|
|
|
34363
34462
|
);
|
|
34364
34463
|
bitLevel = instance2.bitLevelMin;
|
|
34365
34464
|
}
|
|
34366
|
-
let textFormat = TextFormat2.fromValue(textFormatAndResourceType.textFormat);
|
|
34465
|
+
let textFormat = (0, import_superenum49.Enum)(TextFormat2).fromValue(textFormatAndResourceType.textFormat);
|
|
34367
34466
|
const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
|
|
34368
34467
|
if (isInvalidTextFormat) {
|
|
34369
34468
|
this.addWarning(
|
|
34370
34469
|
`Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
|
|
34371
34470
|
);
|
|
34372
34471
|
}
|
|
34373
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
|
|
34472
|
+
const deprecatedTextFormat = (0, import_superenum49.Enum)(DeprecatedTextFormat).fromValue(
|
|
34374
34473
|
textFormatAndResourceType.textFormat
|
|
34375
34474
|
);
|
|
34376
34475
|
if (deprecatedTextFormat) {
|
|
@@ -34380,7 +34479,7 @@ var BitmarkPegParserProcessor = class {
|
|
|
34380
34479
|
);
|
|
34381
34480
|
}
|
|
34382
34481
|
textFormat = textFormat ?? bitConfig.textFormatDefault;
|
|
34383
|
-
const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
|
|
34482
|
+
const resourceType = (0, import_superenum49.Enum)(ResourceType).fromValue(textFormatAndResourceType.resourceType);
|
|
34384
34483
|
if (textFormatAndResourceType.resourceType && !resourceType) {
|
|
34385
34484
|
this.addWarning(
|
|
34386
34485
|
`Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
|
|
@@ -34634,6 +34733,13 @@ var BitmarkPegParserProcessor = class {
|
|
|
34634
34733
|
if (l > 2) result.pageNumber = result.itemLead[2];
|
|
34635
34734
|
if (l > 3) result.marginNumber = result.itemLead[l - 1];
|
|
34636
34735
|
}
|
|
34736
|
+
if (result.__itemLeadString) {
|
|
34737
|
+
const l = result.__itemLeadString.length;
|
|
34738
|
+
if (l > 0) result.__itemString = result.__itemLeadString[0];
|
|
34739
|
+
if (l > 1) result.__leadString = result.__itemLeadString[1];
|
|
34740
|
+
if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
|
|
34741
|
+
if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
|
|
34742
|
+
}
|
|
34637
34743
|
if (inBit) {
|
|
34638
34744
|
result.body = instance11.process(
|
|
34639
34745
|
this.context,
|
|
@@ -38175,7 +38281,7 @@ var BitmarkParser = class {
|
|
|
38175
38281
|
};
|
|
38176
38282
|
|
|
38177
38283
|
// src/BitmarkParserGenerator.ts
|
|
38178
|
-
var Input =
|
|
38284
|
+
var Input = {
|
|
38179
38285
|
/**
|
|
38180
38286
|
* Input is as a string
|
|
38181
38287
|
*/
|
|
@@ -38184,8 +38290,8 @@ var Input = (0, import_superenum31.superenum)({
|
|
|
38184
38290
|
* Input is as a file path
|
|
38185
38291
|
*/
|
|
38186
38292
|
file: "file"
|
|
38187
|
-
}
|
|
38188
|
-
var Output =
|
|
38293
|
+
};
|
|
38294
|
+
var Output = {
|
|
38189
38295
|
/**
|
|
38190
38296
|
* Output bitmark string
|
|
38191
38297
|
*/
|
|
@@ -38198,7 +38304,7 @@ var Output = (0, import_superenum31.superenum)({
|
|
|
38198
38304
|
* Output AST as a plain JS object, or a file
|
|
38199
38305
|
*/
|
|
38200
38306
|
ast: "ast"
|
|
38201
|
-
}
|
|
38307
|
+
};
|
|
38202
38308
|
var BitmarkParserGenerator = class {
|
|
38203
38309
|
constructor() {
|
|
38204
38310
|
__publicField(this, "ast", new Ast());
|
|
@@ -38583,7 +38689,7 @@ var BitmarkParserGenerator = class {
|
|
|
38583
38689
|
const opts = Object.assign({}, options);
|
|
38584
38690
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38585
38691
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
38586
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38692
|
+
const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38587
38693
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38588
38694
|
let inStr = input;
|
|
38589
38695
|
const inputIsString = typeof input === "string";
|
|
@@ -38651,7 +38757,7 @@ var BitmarkParserGenerator = class {
|
|
|
38651
38757
|
if (!input) return input;
|
|
38652
38758
|
const opts = Object.assign({}, options);
|
|
38653
38759
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38654
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38760
|
+
const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38655
38761
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38656
38762
|
let inStr = input;
|
|
38657
38763
|
const inputIsString = typeof input === "string";
|
|
@@ -38704,7 +38810,7 @@ var BitmarkParserGenerator = class {
|
|
|
38704
38810
|
if (!input) return input;
|
|
38705
38811
|
const opts = Object.assign({}, options);
|
|
38706
38812
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
38707
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38813
|
+
const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
38708
38814
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
38709
38815
|
let inStr = input;
|
|
38710
38816
|
const inputIsString = typeof input === "string";
|
|
@@ -38811,6 +38917,8 @@ init();
|
|
|
38811
38917
|
Output,
|
|
38812
38918
|
ResourceBuilder,
|
|
38813
38919
|
StringWriter,
|
|
38920
|
+
TextMarkType,
|
|
38921
|
+
TextNodeType,
|
|
38814
38922
|
bitmarkTextParse
|
|
38815
38923
|
});
|
|
38816
38924
|
//# sourceMappingURL=index.cjs.map
|