@gmb/bitmark-parser-generator 4.20.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.
@@ -49,9 +49,12 @@ __export(index_exports, {
49
49
  });
50
50
  module.exports = __toCommonJS(index_exports);
51
51
 
52
+ // src/config/Config.ts
53
+ var import_superenum16 = require("@ncoderz/superenum");
54
+
52
55
  // src/model/enum/BitType.ts
53
56
  var import_superenum = require("@ncoderz/superenum");
54
- var BitType = (0, import_superenum.superenum)({
57
+ var BitType = {
55
58
  _error: "_error",
56
59
  // Used for error handling to indicate a bit type that is not supported or a bit parse error
57
60
  _comment: "_comment",
@@ -653,6 +656,7 @@ var BitType = (0, import_superenum.superenum)({
653
656
  vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
654
657
  vendorJupyterIpynb: "vendor-jupyter-ipynb",
655
658
  vendorJupyterOutput: "vendor-jupyter-output",
659
+ vendorLearndashEmbed: "vendor-learndash-embed",
656
660
  vendorPadletEmbed: "vendor-padlet-embed",
657
661
  vendorStripePricingTable: "vendor-stripe-pricing-table",
658
662
  vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
@@ -671,24 +675,24 @@ var BitType = (0, import_superenum.superenum)({
671
675
  warningCollapsible: "warning-collapsible",
672
676
  websiteLink: "website-link",
673
677
  workbookArticle: "workbook-article"
674
- });
678
+ };
675
679
 
676
680
  // src/model/enum/Count.ts
677
681
  var import_superenum2 = require("@ncoderz/superenum");
678
- var Count = (0, import_superenum2.superenum)({
682
+ var Count = {
679
683
  infinity: "infinity"
680
- });
684
+ };
681
685
 
682
686
  // src/model/enum/ExampleType.ts
683
687
  var import_superenum3 = require("@ncoderz/superenum");
684
- var ExampleType = (0, import_superenum3.superenum)({
688
+ var ExampleType = {
685
689
  none: "none",
686
690
  // Example is not allowed
687
691
  string: "string",
688
692
  // Example is a string value
689
693
  boolean: "boolean"
690
694
  // Example is a boolean value
691
- });
695
+ };
692
696
 
693
697
  // src/model/enum/Tag.ts
694
698
  var import_superenum4 = require("@ncoderz/superenum");
@@ -707,11 +711,11 @@ var tags = {
707
711
  tag_mark: "=",
708
712
  tag_resource: "&"
709
713
  };
710
- var Tag = (0, import_superenum4.superenum)(tags);
714
+ var Tag = tags;
711
715
 
712
716
  // src/model/enum/TagFormat.ts
713
717
  var import_superenum5 = require("@ncoderz/superenum");
714
- var TagFormat = (0, import_superenum5.superenum)({
718
+ var TagFormat = {
715
719
  none: "none",
716
720
  // The property does not have a value
717
721
  plainText: "plainText",
@@ -724,11 +728,11 @@ var TagFormat = (0, import_superenum5.superenum)({
724
728
  // If the value is treated as a boolean
725
729
  invertedBoolean: "invertedBoolean"
726
730
  // If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
727
- });
731
+ };
728
732
 
729
733
  // src/model/enum/TextFormat.ts
730
734
  var import_superenum6 = require("@ncoderz/superenum");
731
- var TextFormat2 = (0, import_superenum6.superenum)({
735
+ var TextFormat2 = {
732
736
  // plain text
733
737
  plainText: "text",
734
738
  latex: "latex",
@@ -740,11 +744,11 @@ var TextFormat2 = (0, import_superenum6.superenum)({
740
744
  // bitmarkText
741
745
  // bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
742
746
  bitmarkText: "bitmark++"
743
- });
747
+ };
744
748
 
745
749
  // src/model/config/enum/CardSetConfigKey.ts
746
750
  var import_superenum7 = require("@ncoderz/superenum");
747
- var CardSetConfigKey = (0, import_superenum7.superenum)({
751
+ var CardSetConfigKey = {
748
752
  flashcard: "flashcard",
749
753
  definitionList: "definitionList",
750
754
  elements: "elements",
@@ -766,22 +770,22 @@ var CardSetConfigKey = (0, import_superenum7.superenum)({
766
770
  // DEPRECATED - TO BE REMOVED IN THE FUTURE
767
771
  // captionDefinitionsList: 'captionDefinitionsList',
768
772
  bookReferenceList: "bookReferenceList"
769
- });
773
+ };
770
774
 
771
775
  // src/model/config/enum/GroupConfigType.ts
772
776
  var import_superenum8 = require("@ncoderz/superenum");
773
- var GroupConfigType = (0, import_superenum8.superenum)({
777
+ var GroupConfigType = {
774
778
  standard: "standard",
775
779
  // Any ordinary group
776
780
  resource: "resource",
777
781
  // A resource group
778
782
  comboResource: "comboResource"
779
783
  // A combo resource group
780
- });
784
+ };
781
785
 
782
786
  // src/model/enum/BitTagConfigKeyType.ts
783
787
  var import_superenum9 = require("@ncoderz/superenum");
784
- var BitTagConfigKeyType = (0, import_superenum9.superenum)({
788
+ var BitTagConfigKeyType = {
785
789
  unknown: "unknown",
786
790
  // Unknown tag type, used for error handling
787
791
  tag: "tag",
@@ -793,7 +797,7 @@ var BitTagConfigKeyType = (0, import_superenum9.superenum)({
793
797
  //
794
798
  group: "group"
795
799
  // A reusable group of tags
796
- });
800
+ };
797
801
 
798
802
  // src/model/config/AbstractTagConfig.ts
799
803
  var AbstractTagConfig = class {
@@ -1162,7 +1166,6 @@ var groupKeys = {
1162
1166
  group_previewImages: "group_previewImages",
1163
1167
  group_previewVideos: "group_previewVideos"
1164
1168
  };
1165
- var GroupKey = (0, import_superenum10.superenum)(groupKeys);
1166
1169
 
1167
1170
  // src/model/enum/PropertyKey.ts
1168
1171
  var import_superenum11 = require("@ncoderz/superenum");
@@ -1437,7 +1440,7 @@ var propertyKeys = {
1437
1440
  property_y: "@y",
1438
1441
  property_zoomDisabled: "@zoomDisabled"
1439
1442
  };
1440
- var PropertyKey = (0, import_superenum11.superenum)(propertyKeys);
1443
+ var PropertyKey = propertyKeys;
1441
1444
 
1442
1445
  // src/model/enum/ResourceKey.ts
1443
1446
  var import_superenum12 = require("@ncoderz/superenum");
@@ -1476,7 +1479,6 @@ var resourceKeys = {
1476
1479
  resource_previewVideo: "&previewVideo",
1477
1480
  resource_coverImage: "&coverImage"
1478
1481
  };
1479
- var ResourceKey = (0, import_superenum12.superenum)(resourceKeys);
1480
1482
 
1481
1483
  // src/model/enum/ResourceType.ts
1482
1484
  var import_superenum13 = require("@ncoderz/superenum");
@@ -1670,7 +1672,7 @@ var StringUtils = class {
1670
1672
  var stringUtils = new StringUtils();
1671
1673
 
1672
1674
  // src/model/enum/ResourceType.ts
1673
- var ResourceType = (0, import_superenum13.superenum)({
1675
+ var ResourceType = {
1674
1676
  unknown: "unknown",
1675
1677
  image: "image",
1676
1678
  imageResponsive: "image-responsive",
@@ -1706,13 +1708,13 @@ var ResourceType = (0, import_superenum13.superenum)({
1706
1708
  previewImage: "previewImage",
1707
1709
  previewVideo: "previewVideo",
1708
1710
  coverImage: "coverImage"
1709
- });
1711
+ };
1710
1712
  function resourceTypeToConfigKey(type) {
1711
1713
  return `&${stringUtils.kebabToCamel(type)}`;
1712
1714
  }
1713
1715
 
1714
1716
  // src/model/config/enum/ConfigKey.ts
1715
- var ConfigKey = (0, import_superenum14.superenum)({
1717
+ var ConfigKey = {
1716
1718
  // Internal
1717
1719
  _unknown: "_unknown",
1718
1720
  // Tags
@@ -1723,7 +1725,7 @@ var ConfigKey = (0, import_superenum14.superenum)({
1723
1725
  ...propertyKeys,
1724
1726
  // Groups
1725
1727
  ...groupKeys
1726
- });
1728
+ };
1727
1729
  function typeFromConfigKey(tagKey) {
1728
1730
  if (!tagKey) return BitTagConfigKeyType.unknown;
1729
1731
  if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
@@ -1735,7 +1737,7 @@ function configKeyToPropertyType(configKey) {
1735
1737
  return configKey.replace(/^@/, "");
1736
1738
  }
1737
1739
  function configKeyToResourceType(configKey) {
1738
- return ResourceType.fromKey(configKey.replace(/^&/, ""));
1740
+ return (0, import_superenum14.Enum)(ResourceType).fromKey(configKey.replace(/^&/, ""));
1739
1741
  }
1740
1742
 
1741
1743
  // src/model/config/ResourcesConfig.ts
@@ -2127,6 +2129,9 @@ var ObjectUtils = class {
2127
2129
  };
2128
2130
  var objectUtils = new ObjectUtils();
2129
2131
 
2132
+ // src/config/ConfigHydrator.ts
2133
+ var import_superenum15 = require("@ncoderz/superenum");
2134
+
2130
2135
  // src/config/raw/cardSets.ts
2131
2136
  var CARDSETS = {
2132
2137
  [CardSetConfigKey.definitionList]: {
@@ -4365,9 +4370,9 @@ var ConfigHydrator = class {
4365
4370
  }
4366
4371
  hydrateTagConfig(_tag) {
4367
4372
  const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
4368
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4373
+ const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4369
4374
  if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
4370
- const tag = Tag.fromValue(configKey);
4375
+ const tag = (0, import_superenum15.Enum)(Tag).fromValue(configKey);
4371
4376
  if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
4372
4377
  let chain;
4373
4378
  if (_chain) {
@@ -4398,7 +4403,7 @@ var ConfigHydrator = class {
4398
4403
  defaultValue,
4399
4404
  jsonKey
4400
4405
  } = _tag;
4401
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4406
+ const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4402
4407
  if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
4403
4408
  const tag = _configKey.substring(1);
4404
4409
  let chain;
@@ -4424,7 +4429,7 @@ var ConfigHydrator = class {
4424
4429
  }
4425
4430
  hydrateResourceTagConfig(_tag) {
4426
4431
  const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
4427
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4432
+ const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4428
4433
  if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
4429
4434
  const tag = _configKey.substring(1);
4430
4435
  let chain;
@@ -4448,7 +4453,7 @@ var ConfigHydrator = class {
4448
4453
  }
4449
4454
  hydrateTagGroupConfig(_tag) {
4450
4455
  const { key: _configKey } = _tag;
4451
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4456
+ const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4452
4457
  if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
4453
4458
  const _groupConfig = GROUPS[configKey];
4454
4459
  if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
@@ -9908,6 +9913,11 @@ var BITS = {
9908
9913
  minCount: 1
9909
9914
  }
9910
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"
9911
9921
  }
9912
9922
  };
9913
9923
 
@@ -9930,7 +9940,7 @@ var Config = class {
9930
9940
  */
9931
9941
  getBitType(bitType) {
9932
9942
  if (bitType?.startsWith("|")) bitType = bitType.substring(1);
9933
- return BitType.fromValue(bitType) ?? BitType._error;
9943
+ return (0, import_superenum16.Enum)(BitType).fromValue(bitType) ?? BitType._error;
9934
9944
  }
9935
9945
  /**
9936
9946
  * Check if a bit type is and instance of the given root bit type.
@@ -10250,15 +10260,15 @@ var instance2 = new Config();
10250
10260
  // src/generated/package_info.ts
10251
10261
  var PACKAGE_INFO = {
10252
10262
  "name": "@gmb/bitmark-parser-generator",
10253
- "version": "4.20.0",
10263
+ "version": "5.0.0",
10254
10264
  "author": "Get More Brain Ltd",
10255
10265
  "license": "ISC",
10256
10266
  "description": "A bitmark parser and generator using Peggy.js"
10257
10267
  };
10258
10268
 
10259
10269
  // src/utils/env/Environment.ts
10260
- var import_superenum15 = require("@ncoderz/superenum");
10261
- var Environment = (0, import_superenum15.superenum)({
10270
+ var import_superenum17 = require("@ncoderz/superenum");
10271
+ var Environment = {
10262
10272
  unknown: "",
10263
10273
  node: "node",
10264
10274
  chrome: "chrome",
@@ -10266,18 +10276,18 @@ var Environment = (0, import_superenum15.superenum)({
10266
10276
  firefox: "firefox",
10267
10277
  edge: "edge",
10268
10278
  ie: "ie"
10269
- });
10279
+ };
10270
10280
 
10271
10281
  // src/utils/env/Os.ts
10272
- var import_superenum16 = require("@ncoderz/superenum");
10273
- var Os = (0, import_superenum16.superenum)({
10282
+ var import_superenum18 = require("@ncoderz/superenum");
10283
+ var Os = {
10274
10284
  unknown: "",
10275
10285
  macos: "macos",
10276
10286
  windows: "windows",
10277
10287
  linux: "linux",
10278
10288
  android: "android",
10279
10289
  ios: "ios"
10280
- });
10290
+ };
10281
10291
 
10282
10292
  // src/utils/env/userAgent.ts
10283
10293
  function parseUserAgent() {
@@ -10485,8 +10495,11 @@ function init() {
10485
10495
  initialised = true;
10486
10496
  }
10487
10497
 
10498
+ // src/ast/Ast.ts
10499
+ var import_superenum23 = require("@ncoderz/superenum");
10500
+
10488
10501
  // src/model/enum/BodyBitType.ts
10489
- var import_superenum17 = require("@ncoderz/superenum");
10502
+ var import_superenum19 = require("@ncoderz/superenum");
10490
10503
  var BodyBitTypeRaw = {
10491
10504
  text: "text",
10492
10505
  gap: "gap",
@@ -10494,11 +10507,11 @@ var BodyBitTypeRaw = {
10494
10507
  select: "select",
10495
10508
  highlight: "highlight"
10496
10509
  };
10497
- var BodyBitType = (0, import_superenum17.superenum)(BodyBitTypeRaw);
10510
+ var BodyBitType = BodyBitTypeRaw;
10498
10511
 
10499
10512
  // src/model/enum/TextMarkType.ts
10500
- var import_superenum18 = require("@ncoderz/superenum");
10501
- var TextMarkType = (0, import_superenum18.superenum)({
10513
+ var import_superenum20 = require("@ncoderz/superenum");
10514
+ var TextMarkType = {
10502
10515
  // Styles
10503
10516
  bold: "bold",
10504
10517
  light: "light",
@@ -10545,11 +10558,11 @@ var TextMarkType = (0, import_superenum18.superenum)({
10545
10558
  duration: "duration",
10546
10559
  color: "color",
10547
10560
  comment: "comment"
10548
- });
10561
+ };
10549
10562
 
10550
10563
  // src/model/enum/TextNodeType.ts
10551
- var import_superenum19 = require("@ncoderz/superenum");
10552
- var TextNodeType = (0, import_superenum19.superenum)({
10564
+ var import_superenum21 = require("@ncoderz/superenum");
10565
+ var TextNodeType = {
10553
10566
  // Text
10554
10567
  text: "text",
10555
10568
  // Blocks
@@ -10577,11 +10590,11 @@ var TextNodeType = (0, import_superenum19.superenum)({
10577
10590
  select: "select",
10578
10591
  highlight: "highlight",
10579
10592
  mark: "mark"
10580
- });
10593
+ };
10581
10594
 
10582
10595
  // src/model/ast/NodeType.ts
10583
- var import_superenum20 = require("@ncoderz/superenum");
10584
- var NodeType = (0, import_superenum20.superenum)({
10596
+ var import_superenum22 = require("@ncoderz/superenum");
10597
+ var NodeType = {
10585
10598
  unknown: "unknown",
10586
10599
  // unknown
10587
10600
  __isDefaultExample: "__isDefaultExample",
@@ -11264,7 +11277,7 @@ var NodeType = (0, import_superenum20.superenum)({
11264
11277
  y: "y",
11265
11278
  yValue: "yValue",
11266
11279
  zoomDisabled: "zoomDisabled"
11267
- });
11280
+ };
11268
11281
 
11269
11282
  // src/ast/Ast.ts
11270
11283
  var Ast = class {
@@ -11447,7 +11460,7 @@ var Ast = class {
11447
11460
  if (isParentArray && parentKey) {
11448
11461
  astKey = `${parentKey}Value`;
11449
11462
  }
11450
- return NodeType.fromKey(astKey) || `unknown(${astKey})`;
11463
+ return (0, import_superenum23.Enum)(NodeType).fromKey(astKey) || `unknown(${astKey})`;
11451
11464
  }
11452
11465
  isArray(x) {
11453
11466
  return Array.isArray(x);
@@ -11460,16 +11473,19 @@ var Ast = class {
11460
11473
  }
11461
11474
  };
11462
11475
 
11476
+ // src/ast/Builder.ts
11477
+ var import_superenum30 = require("@ncoderz/superenum");
11478
+
11463
11479
  // src/model/enum/TextLocation.ts
11464
- var import_superenum21 = require("@ncoderz/superenum");
11465
- var TextLocation2 = (0, import_superenum21.superenum)({
11480
+ var import_superenum24 = require("@ncoderz/superenum");
11481
+ var TextLocation2 = {
11466
11482
  tag: "tag",
11467
11483
  body: "body"
11468
- });
11484
+ };
11469
11485
 
11470
11486
  // src/model/enum/BodyTextFormat.ts
11471
- var import_superenum22 = require("@ncoderz/superenum");
11472
- var BodyTextFormat = (0, import_superenum22.superenum)({
11487
+ var import_superenum25 = require("@ncoderz/superenum");
11488
+ var BodyTextFormat = {
11473
11489
  plainText: "text",
11474
11490
  // plain text
11475
11491
  latex: "latex",
@@ -11480,7 +11496,7 @@ var BodyTextFormat = (0, import_superenum22.superenum)({
11480
11496
  // xml
11481
11497
  // bitmark++ text
11482
11498
  bitmarkPlusPlus: "bitmark++"
11483
- });
11499
+ };
11484
11500
 
11485
11501
  // src/breakscaping/RegexConfigs.ts
11486
11502
  var REGEX_MARKS = /([*`_!=])(?=\1)/;
@@ -11729,11 +11745,11 @@ var Breakscape3 = class {
11729
11745
  var instance3 = new Breakscape3();
11730
11746
 
11731
11747
  // src/model/enum/DeprecatedTextFormat.ts
11732
- var import_superenum23 = require("@ncoderz/superenum");
11733
- var DeprecatedTextFormat = (0, import_superenum23.superenum)({
11748
+ var import_superenum26 = require("@ncoderz/superenum");
11749
+ var DeprecatedTextFormat = {
11734
11750
  bitmarkMinusMinus: "bitmark--"
11735
11751
  // bitmark-- text format, deprecated
11736
- });
11752
+ };
11737
11753
 
11738
11754
  // src/parser/json/TableUtils.ts
11739
11755
  function isTableBasicFormat(table) {
@@ -11892,14 +11908,14 @@ var ArrayUtils = class {
11892
11908
  var instance4 = new ArrayUtils();
11893
11909
 
11894
11910
  // src/generator/text/TextGenerator.ts
11895
- var import_superenum25 = require("@ncoderz/superenum");
11911
+ var import_superenum28 = require("@ncoderz/superenum");
11896
11912
 
11897
11913
  // src/model/enum/BitmarkVersion.ts
11898
- var import_superenum24 = require("@ncoderz/superenum");
11899
- var BitmarkVersion = (0, import_superenum24.superenum)({
11914
+ var import_superenum27 = require("@ncoderz/superenum");
11915
+ var BitmarkVersion = {
11900
11916
  v2: 2,
11901
11917
  v3: 3
11902
- });
11918
+ };
11903
11919
  var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
11904
11920
 
11905
11921
  // src/generator/AstWalkerGenerator.ts
@@ -12086,7 +12102,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12086
12102
  __publicField(this, "preTextIndexTemp", -1);
12087
12103
  __publicField(this, "havePreText", false);
12088
12104
  __publicField(this, "preTextIndex", -1);
12089
- this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
12105
+ this.bitmarkVersion = (0, import_superenum28.Enum)(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
12090
12106
  this.options = {
12091
12107
  ...DEFAULT_OPTIONS,
12092
12108
  ...options
@@ -22271,6 +22287,9 @@ var BitUtils = class {
22271
22287
  };
22272
22288
  var instance7 = new BitUtils();
22273
22289
 
22290
+ // src/ast/ResourceBuilder.ts
22291
+ var import_superenum29 = require("@ncoderz/superenum");
22292
+
22274
22293
  // src/utils/UrlUtils.ts
22275
22294
  var UrlUtils = class {
22276
22295
  fileExtensionFromUrl(url) {
@@ -22510,11 +22529,11 @@ var ResourceBuilder = class extends BaseBuilder {
22510
22529
  const nodes = [];
22511
22530
  if (!Array.isArray(resource)) resource = [resource];
22512
22531
  for (const thisResource of resource) {
22513
- let type = ResourceType.fromValue(thisResource.type);
22532
+ let type = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.type);
22514
22533
  if (!type) return void 0;
22515
- const resourceKey = ResourceType.keyFromValue(type);
22534
+ const resourceKey = (0, import_superenum29.Enum)(ResourceType).keyFromValue(type);
22516
22535
  if (!resourceKey) return void 0;
22517
- const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
22536
+ const __typeAlias = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.__typeAlias);
22518
22537
  type = __typeAlias ?? type;
22519
22538
  let data;
22520
22539
  if (type === ResourceType.imageResponsive) {
@@ -22550,7 +22569,7 @@ var ResourceBuilder = class extends BaseBuilder {
22550
22569
  }
22551
22570
  resourceFromResourceDataJson(context, type, data) {
22552
22571
  if (!data) return void 0;
22553
- type = ResourceType.fromValue(type);
22572
+ type = (0, import_superenum29.Enum)(ResourceType).fromValue(type);
22554
22573
  if (!type) return void 0;
22555
22574
  const dataAsString = stringUtils.isString(data) ? data : void 0;
22556
22575
  const url = data.url || data.src || data.body || dataAsString;
@@ -23663,8 +23682,8 @@ var Builder = class extends BaseBuilder {
23663
23682
  data = structuredClone(data);
23664
23683
  const bitType = data.bitType;
23665
23684
  const bitConfig = instance2.getBitConfig(bitType);
23666
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
23667
- 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;
23668
23687
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
23669
23688
  textFormat = TextFormat2.bitmarkText;
23670
23689
  }
@@ -23687,7 +23706,7 @@ var Builder = class extends BaseBuilder {
23687
23706
  bitType,
23688
23707
  bitLevel: data.bitLevel,
23689
23708
  textFormat,
23690
- resourceType: ResourceType.fromValue(data.resourceType),
23709
+ resourceType: (0, import_superenum30.Enum)(ResourceType).fromValue(data.resourceType),
23691
23710
  isCommented: data.isCommented,
23692
23711
  // Properties
23693
23712
  id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
@@ -25012,14 +25031,14 @@ var Builder = class extends BaseBuilder {
25012
25031
  response: data.response ?? "",
25013
25032
  reaction: data.reaction ?? "",
25014
25033
  feedback: data.feedback ?? "",
25015
- item: this.handleJsonText(context, TextLocation2.tag, data.item),
25034
+ item: data.item ?? "",
25016
25035
  lead: this.handleJsonText(context, TextLocation2.tag, data.lead),
25017
25036
  hint: this.handleJsonText(context, TextLocation2.tag, data.hint)
25018
25037
  };
25019
25038
  objectUtils.removeUnwantedProperties(node, {
25020
- ignoreEmptyString: ["response", "reaction", "feedback"],
25039
+ ignoreEmptyString: ["response", "reaction", "feedback", "item"],
25021
25040
  ignoreAllFalse: true,
25022
- ignoreEmptyArrays: ["item"],
25041
+ ignoreEmptyArrays: [],
25023
25042
  ignoreUndefined: ["example"]
25024
25043
  });
25025
25044
  return node;
@@ -26637,14 +26656,17 @@ var StringWriter = class {
26637
26656
  };
26638
26657
 
26639
26658
  // src/BitmarkParserGenerator.ts
26640
- var import_superenum31 = require("@ncoderz/superenum");
26659
+ var import_superenum50 = require("@ncoderz/superenum");
26660
+
26661
+ // src/generator/bitmark/BitmarkGenerator.ts
26662
+ var import_superenum32 = require("@ncoderz/superenum");
26641
26663
 
26642
26664
  // src/model/enum/CardSetVersion.ts
26643
- var import_superenum26 = require("@ncoderz/superenum");
26644
- var CardSetVersion = (0, import_superenum26.superenum)({
26665
+ var import_superenum31 = require("@ncoderz/superenum");
26666
+ var CardSetVersion = {
26645
26667
  v1: 1,
26646
26668
  v2: 2
26647
- });
26669
+ };
26648
26670
 
26649
26671
  // src/generator/bitmark/BitmarkGenerator.ts
26650
26672
  var DEFAULT_OPTIONS2 = {
@@ -26699,7 +26721,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
26699
26721
  this.leaf = this.leaf.bind(this);
26700
26722
  this.write = this.write.bind(this);
26701
26723
  this.bodyBitCallback = this.bodyBitCallback.bind(this);
26702
- this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
26724
+ this.bitmarkVersion = (0, import_superenum32.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
26703
26725
  this.options = {
26704
26726
  ...DEFAULT_OPTIONS2,
26705
26727
  ...options?.bitmarkOptions
@@ -27261,7 +27283,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
27261
27283
  this.inTag = true;
27262
27284
  }
27263
27285
  bodyBitCallback(bodyBit, _index, _route) {
27264
- const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
27286
+ const nodeType = (0, import_superenum32.Enum)(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
27265
27287
  this.ast.walk(bodyBit, nodeType, this, void 0);
27266
27288
  return "";
27267
27289
  }
@@ -27806,6 +27828,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
27806
27828
  between_cardBits(_node, _left, _right, _route) {
27807
27829
  this.writeCardSetCardDivider();
27808
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
+ }
27809
27840
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
27810
27841
  leaf_response(node, route) {
27811
27842
  const parent = this.getParentNode(route);
@@ -28467,8 +28498,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28467
28498
  * Generate the handlers for resources, as they are mostly the same, but not quite
28468
28499
  */
28469
28500
  generateResourceHandlers() {
28470
- for (const tag of ResourceType.keys()) {
28471
- 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;
28472
28503
  const enterFuncName = `enter_${tag}`;
28473
28504
  if (typeof this[enterFuncName] === "function") {
28474
28505
  continue;
@@ -28478,8 +28509,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28478
28509
  if (resource == null) return false;
28479
28510
  const parent = this.getParentNode(route);
28480
28511
  if (parent?.key !== NodeType.resourcesValue) return true;
28481
- const alias = ResourceType.fromValue(parent.value.__typeAlias);
28482
- const type = alias ?? ResourceType.fromValue(parent.value.type);
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);
28483
28514
  if (!type) return false;
28484
28515
  const url = resource.url || resource.src || resource.body || "";
28485
28516
  this.writeNL();
@@ -28493,7 +28524,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28493
28524
  * Generate the handlers for properties, as they are mostly the same, but not quite
28494
28525
  */
28495
28526
  generatePropertyHandlers() {
28496
- for (const propertyConfigKey of PropertyKey.values()) {
28527
+ for (const propertyConfigKey of (0, import_superenum32.Enum)(PropertyKey).values()) {
28497
28528
  const propertyTag = configKeyToPropertyType(propertyConfigKey);
28498
28529
  const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
28499
28530
  for (const funcName of funcNames) {
@@ -28843,7 +28874,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28843
28874
  }
28844
28875
  writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
28845
28876
  if (key && resource) {
28846
- const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
28877
+ const resourceTag = (0, import_superenum32.Enum)(ResourceType).keyFromValue(resource.type) ?? "";
28847
28878
  const resourceData = resource[resourceTag];
28848
28879
  const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
28849
28880
  if (deprecated_writeAsProperty) {
@@ -28928,7 +28959,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28928
28959
  return true;
28929
28960
  }
28930
28961
  isWriteTextFormat(bitsValue, textFormatDefault) {
28931
- const isDefault = TextFormat2.fromValue(bitsValue) === textFormatDefault;
28962
+ const isDefault = (0, import_superenum32.Enum)(TextFormat2).fromValue(bitsValue) === textFormatDefault;
28932
28963
  const writeFormat = !isDefault || this.options.explicitTextFormat;
28933
28964
  return !!writeFormat;
28934
28965
  }
@@ -29020,6 +29051,7 @@ var BitmarkStringGenerator = class {
29020
29051
  };
29021
29052
 
29022
29053
  // src/generator/json/JsonGenerator.ts
29054
+ var import_superenum33 = require("@ncoderz/superenum");
29023
29055
  var MOVE_BODY_RECURSION_LIMIT = 5e3;
29024
29056
  var DEFAULT_OPTIONS3 = {
29025
29057
  // debugGenerationInline: true,
@@ -29056,7 +29088,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29056
29088
  this.exit = this.exit.bind(this);
29057
29089
  this.leaf = this.leaf.bind(this);
29058
29090
  this.bodyBitCallback = this.bodyBitCallback.bind(this);
29059
- this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
29091
+ this.bitmarkVersion = (0, import_superenum33.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
29060
29092
  this.textParserVersion = this.textParser.version();
29061
29093
  this.options = {
29062
29094
  ...DEFAULT_OPTIONS3,
@@ -29410,7 +29442,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29410
29442
  throw new Error("Recursion limit exceeded");
29411
29443
  }
29412
29444
  for (const node of nodes) {
29413
- 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)) {
29414
29446
  const bodyBit = node;
29415
29447
  bodyBit.attrs = {};
29416
29448
  for (const [key, value] of Object.entries(bodyBit)) {
@@ -29697,7 +29729,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29697
29729
  * Generate the handlers for properties, as they are mostly the same, but not quite
29698
29730
  */
29699
29731
  generatePropertyHandlers() {
29700
- for (const propertyConfigKey of PropertyKey.values()) {
29732
+ for (const propertyConfigKey of (0, import_superenum33.Enum)(PropertyKey).values()) {
29701
29733
  const propertyTag = configKeyToPropertyType(propertyConfigKey);
29702
29734
  const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
29703
29735
  for (const funcName of funcNames) {
@@ -29813,7 +29845,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29813
29845
  for (const node of route) {
29814
29846
  if (node.key === NodeType.bitsValue) {
29815
29847
  const n = node.value;
29816
- return TextFormat2.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
29848
+ return (0, import_superenum33.Enum)(TextFormat2).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
29817
29849
  }
29818
29850
  }
29819
29851
  }
@@ -30362,12 +30394,13 @@ var JsonObjectGenerator = class {
30362
30394
  };
30363
30395
 
30364
30396
  // src/info/InfoBuilder.ts
30397
+ var import_superenum34 = require("@ncoderz/superenum");
30365
30398
  var InfoBuilder = class {
30366
30399
  getSupportedBits(options) {
30367
30400
  const includeNonDeprecated = options?.includeNonDeprecated ?? true;
30368
30401
  const includeDeprecated = options?.includeDeprecated ?? false;
30369
30402
  const supportedBits = [];
30370
- for (const bt of BitType.values()) {
30403
+ for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
30371
30404
  if (bt === BitType._error || bt === BitType._comment) continue;
30372
30405
  const bitType = instance2.getBitType(bt);
30373
30406
  const bitConfig = instance2.getBitConfig(bitType);
@@ -30386,7 +30419,7 @@ var InfoBuilder = class {
30386
30419
  }
30387
30420
  getSupportedBitConfigs() {
30388
30421
  const res = [];
30389
- for (const bt of BitType.values()) {
30422
+ for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
30390
30423
  if (bt === BitType._error || bt === BitType._comment) continue;
30391
30424
  const bitType = instance2.getBitType(bt);
30392
30425
  const config = instance2.getBitConfig(bitType);
@@ -30397,22 +30430,22 @@ var InfoBuilder = class {
30397
30430
  };
30398
30431
 
30399
30432
  // src/model/enum/BitmarkParserType.ts
30400
- var import_superenum27 = require("@ncoderz/superenum");
30401
- var BitmarkParserType = (0, import_superenum27.superenum)({
30433
+ var import_superenum35 = require("@ncoderz/superenum");
30434
+ var BitmarkParserType = {
30402
30435
  peggy: "peggy"
30403
- });
30436
+ };
30404
30437
 
30405
30438
  // src/model/info/enum/InfoFormat.ts
30406
- var import_superenum28 = require("@ncoderz/superenum");
30407
- var InfoFormat = (0, import_superenum28.superenum)({
30439
+ var import_superenum36 = require("@ncoderz/superenum");
30440
+ var InfoFormat = {
30408
30441
  text: "text",
30409
30442
  json: "json",
30410
30443
  pojo: "pojo"
30411
- });
30444
+ };
30412
30445
 
30413
30446
  // src/model/info/enum/InfoType.ts
30414
- var import_superenum29 = require("@ncoderz/superenum");
30415
- var InfoType = (0, import_superenum29.superenum)({
30447
+ var import_superenum37 = require("@ncoderz/superenum");
30448
+ var InfoType = {
30416
30449
  list: "list",
30417
30450
  // List non-deprecated bits
30418
30451
  deprecated: "deprecated",
@@ -30421,9 +30454,10 @@ var InfoType = (0, import_superenum29.superenum)({
30421
30454
  // List all bits
30422
30455
  bit: "bit"
30423
30456
  // Get information for a bit
30424
- });
30457
+ };
30425
30458
 
30426
30459
  // src/parser/json/JsonParser.ts
30460
+ var import_superenum38 = require("@ncoderz/superenum");
30427
30461
  var builder = new Builder();
30428
30462
  var JsonParser = class {
30429
30463
  /**
@@ -30525,8 +30559,8 @@ var JsonParser = class {
30525
30559
  const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
30526
30560
  const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
30527
30561
  const bitConfig = instance2.getBitConfig(bitType);
30528
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
30529
- 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;
30530
30564
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
30531
30565
  _textFormat = TextFormat2.bitmarkText;
30532
30566
  }
@@ -30603,7 +30637,7 @@ var JsonParser = class {
30603
30637
  }
30604
30638
  getResourceType(resource) {
30605
30639
  if (resource) {
30606
- const resourceKey = ResourceType.fromValue(resource.type);
30640
+ const resourceKey = (0, import_superenum38.Enum)(ResourceType).fromValue(resource.type);
30607
30641
  return resourceKey;
30608
30642
  }
30609
30643
  return void 0;
@@ -30675,7 +30709,7 @@ var JsonParser = class {
30675
30709
  };
30676
30710
 
30677
30711
  // src/parser/bitmark/peg/BitmarkPegParserTypes.ts
30678
- var import_superenum30 = require("@ncoderz/superenum");
30712
+ var import_superenum39 = require("@ncoderz/superenum");
30679
30713
 
30680
30714
  // src/parser/bitmark/peg/PeggyGrammarLocation.ts
30681
30715
  var PeggyGrammarLocation = class {
@@ -30755,7 +30789,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
30755
30789
  var CARD_DIVIDER_V1 = "===";
30756
30790
  var CARD_SIDE_DIVIDER_V1 = "==";
30757
30791
  var CARD_VARIANT_DIVIDER_V1 = "--";
30758
- var TypeKey = (0, import_superenum30.superenum)({
30792
+ var TypeKey = {
30759
30793
  // Bit header
30760
30794
  TextFormat: "TextFormat",
30761
30795
  ResourceType: "ResourceType",
@@ -30790,14 +30824,15 @@ var TypeKey = (0, import_superenum30.superenum)({
30790
30824
  // Dividers
30791
30825
  PlainTextDivider: "PlainTextDivider",
30792
30826
  FooterDivider: "FooterDivider"
30793
- });
30794
- var ContentDepth = (0, import_superenum30.superenum)({
30827
+ };
30828
+ var ContentDepth = {
30795
30829
  Bit: "Bit",
30796
30830
  Card: "Card",
30797
30831
  Chain: "Chain"
30798
- });
30832
+ };
30799
30833
 
30800
30834
  // src/parser/bitmark/peg/BitmarkPegParserHelper.ts
30835
+ var import_superenum40 = require("@ncoderz/superenum");
30801
30836
  var DEBUG_TRACE_RAW_BIT = true;
30802
30837
  var DEBUG_TRACE_TEXT_FORMAT = false;
30803
30838
  var DEBUG_TRACE_RESOURCE_TYPE = false;
@@ -30887,7 +30922,7 @@ var BitmarkPegParserHelper = class {
30887
30922
  if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
30888
30923
  return {
30889
30924
  type,
30890
- key: Tag.fromValue(type),
30925
+ key: (0, import_superenum40.Enum)(Tag).fromValue(type),
30891
30926
  value,
30892
30927
  parser: {
30893
30928
  text: this.parserText(),
@@ -31282,7 +31317,7 @@ var BitmarkPegParserHelper = class {
31282
31317
  if (!value) return false;
31283
31318
  const { type } = value;
31284
31319
  if (!validType) {
31285
- return !!TypeKey.fromValue(type);
31320
+ return !!(0, import_superenum40.Enum)(TypeKey).fromValue(type);
31286
31321
  }
31287
31322
  if (Array.isArray(validType)) {
31288
31323
  return validType.indexOf(type) >= 0;
@@ -31352,7 +31387,11 @@ var BitmarkPegParserHelper = class {
31352
31387
  }
31353
31388
  };
31354
31389
 
31390
+ // src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
31391
+ var import_superenum49 = require("@ncoderz/superenum");
31392
+
31355
31393
  // src/parser/bitmark/peg/BitmarkPegParserValidator.ts
31394
+ var import_superenum41 = require("@ncoderz/superenum");
31356
31395
  var COMMON_MISTAKE_STRINGS = [
31357
31396
  // Card divider errors
31358
31397
  "----",
@@ -31524,7 +31563,7 @@ var BitmarkPegParserValidator = class {
31524
31563
  const content = dataOrNull[i];
31525
31564
  if (!content) continue;
31526
31565
  const { type, key } = content;
31527
- let typeKey = TypeKey.fromValue(type);
31566
+ let typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(type);
31528
31567
  if (!typeKey) continue;
31529
31568
  let validTypeKey = typeKey;
31530
31569
  if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
@@ -31947,7 +31986,7 @@ var BitmarkPegParserValidator = class {
31947
31986
  } else if (tagValidationData.isResource) {
31948
31987
  res.set(v.configKey, tagValidationData);
31949
31988
  } else {
31950
- const typeKey = TypeKey.fromValue(v.tag);
31989
+ const typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(v.tag);
31951
31990
  if (typeKey) {
31952
31991
  res.set(typeKey, tagValidationData);
31953
31992
  }
@@ -32960,12 +32999,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
32960
32999
  for (const card of cardSet.cards) {
32961
33000
  for (const side of card.sides) {
32962
33001
  for (const content of side.variants) {
32963
- const { __instructionString, reaction, cardBodyStr: feedback, ...tags2 } = content.data;
33002
+ const {
33003
+ __instructionString,
33004
+ __itemString,
33005
+ reaction,
33006
+ cardBodyStr: feedback,
33007
+ ...tags2
33008
+ } = content.data;
32964
33009
  const botResponse = {
32965
33010
  response: __instructionString ?? instance3.EMPTY_STRING,
32966
33011
  reaction: reaction ?? instance3.EMPTY_STRING,
32967
33012
  feedback: feedback ?? instance3.EMPTY_STRING,
32968
- ...tags2
33013
+ ...tags2,
33014
+ item: __itemString ?? instance3.EMPTY_STRING
32969
33015
  };
32970
33016
  if (botResponse) botResponses.push(botResponse);
32971
33017
  }
@@ -33201,6 +33247,9 @@ var FooterContentProcessor = class {
33201
33247
  };
33202
33248
  var instance12 = new FooterContentProcessor();
33203
33249
 
33250
+ // src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
33251
+ var import_superenum42 = require("@ncoderz/superenum");
33252
+
33204
33253
  // src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
33205
33254
  var textParser4 = new TextParser();
33206
33255
  function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
@@ -33236,7 +33285,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
33236
33285
  }
33237
33286
  function buildGap(context, _contentDepth, tagsConfig, content) {
33238
33287
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
33239
- const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33288
+ const gapConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum42.Enum)(Tag).fromValue(content.type));
33240
33289
  const chainContent = [content, ...content.chain ?? []];
33241
33290
  const chainTags = context.bitContentProcessor(
33242
33291
  ContentDepth.Chain,
@@ -33251,6 +33300,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
33251
33300
  return gap;
33252
33301
  }
33253
33302
 
33303
+ // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
33304
+ var import_superenum43 = require("@ncoderz/superenum");
33305
+
33254
33306
  // src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
33255
33307
  function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
33256
33308
  const { textFormat } = context;
@@ -33263,6 +33315,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
33263
33315
  location: TextLocation2.tag
33264
33316
  });
33265
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
+ );
33266
33325
  }
33267
33326
 
33268
33327
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
@@ -33275,7 +33334,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
33275
33334
  }
33276
33335
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33277
33336
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
33278
- const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33337
+ const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum43.Enum)(Tag).fromValue(content.type));
33279
33338
  const chainContent = [content, ...content.chain ?? []];
33280
33339
  const chainTags = context.bitContentProcessor(
33281
33340
  ContentDepth.Chain,
@@ -33284,8 +33343,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33284
33343
  );
33285
33344
  if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
33286
33345
  target.itemLead = chainTags.itemLead;
33346
+ target.__itemLeadString = chainTags.__itemLeadString;
33287
33347
  }
33288
33348
 
33349
+ // src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
33350
+ var import_superenum44 = require("@ncoderz/superenum");
33351
+
33289
33352
  // src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
33290
33353
  function markTagContentProcessor(_context, _contentDepth, content, target) {
33291
33354
  const { value } = content;
@@ -33310,7 +33373,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
33310
33373
  }
33311
33374
  function buildMark(context, _contentDepth, tagsConfig, content) {
33312
33375
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33313
- const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33376
+ const markConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum44.Enum)(Tag).fromValue(content.type));
33314
33377
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33315
33378
  const chainTags = context.bitContentProcessor(
33316
33379
  ContentDepth.Chain,
@@ -33329,6 +33392,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
33329
33392
  return mark;
33330
33393
  }
33331
33394
 
33395
+ // src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
33396
+ var import_superenum47 = require("@ncoderz/superenum");
33397
+
33332
33398
  // src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
33333
33399
  function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33334
33400
  if (contentDepth === ContentDepth.Chain) {
@@ -33503,6 +33569,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
33503
33569
  }
33504
33570
 
33505
33571
  // src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
33572
+ var import_superenum45 = require("@ncoderz/superenum");
33506
33573
  function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33507
33574
  if (contentDepth === ContentDepth.Chain) {
33508
33575
  imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -33521,7 +33588,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
33521
33588
  function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
33522
33589
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
33523
33590
  const { key: tag } = content;
33524
- const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33591
+ const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum45.Enum)(ConfigKey).fromValue(tag));
33525
33592
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33526
33593
  const chainTags = context.bitContentProcessor(
33527
33594
  ContentDepth.Chain,
@@ -33555,12 +33622,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
33555
33622
  }
33556
33623
 
33557
33624
  // src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
33625
+ var import_superenum46 = require("@ncoderz/superenum");
33558
33626
  function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
33559
33627
  const { key: tag } = content;
33560
33628
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33561
33629
  const markConfig = target.markConfig;
33562
33630
  if (!markConfig) return;
33563
- const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33631
+ const markTagConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum46.Enum)(ConfigKey).fromValue(tag));
33564
33632
  const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
33565
33633
  ContentDepth.Chain,
33566
33634
  markTagConfig?.chain,
@@ -33693,7 +33761,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
33693
33761
  const { value } = content;
33694
33762
  const { key: keyIn } = content;
33695
33763
  const isChain = contentDepth === ContentDepth.Chain;
33696
- const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
33764
+ const propertyConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum47.Enum)(PropertyKey).fromValue(keyIn));
33697
33765
  const configKey = propertyConfig ? propertyConfig.configKey : void 0;
33698
33766
  let property = configKeyToPropertyType(keyIn);
33699
33767
  if (configKey === ConfigKey.property_internalComment) {
@@ -33850,12 +33918,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
33850
33918
  }
33851
33919
 
33852
33920
  // src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
33921
+ var import_superenum48 = require("@ncoderz/superenum");
33853
33922
  var resourceBuilder = new ResourceBuilder();
33854
33923
  function buildResources(context, resourceTypeAttachment, resources) {
33855
33924
  const { bitType } = context;
33856
33925
  const filteredResources = [];
33857
33926
  const excessResources = [];
33858
- const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
33927
+ const validatedResourceTypeAttachemnt = (0, import_superenum48.Enum)(ResourceType).fromValue(resourceTypeAttachment);
33859
33928
  const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
33860
33929
  const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
33861
33930
  const countsMin = resourcesConfig.getCountsMin();
@@ -33899,9 +33968,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
33899
33968
  const { type: _ignoreType, key, value, chain } = content;
33900
33969
  const resources = target.resources;
33901
33970
  if (!resources) return;
33902
- const configKey = ConfigKey.fromValue(key);
33971
+ const configKey = (0, import_superenum48.Enum)(ConfigKey).fromValue(key);
33903
33972
  if (!configKey) return;
33904
- const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33973
+ const resourceType = (0, import_superenum48.Enum)(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33905
33974
  const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
33906
33975
  const { posterImage, ...tags2 } = context.bitContentProcessor(
33907
33976
  ContentDepth.Chain,
@@ -34393,14 +34462,14 @@ var BitmarkPegParserProcessor = class {
34393
34462
  );
34394
34463
  bitLevel = instance2.bitLevelMin;
34395
34464
  }
34396
- let textFormat = TextFormat2.fromValue(textFormatAndResourceType.textFormat);
34465
+ let textFormat = (0, import_superenum49.Enum)(TextFormat2).fromValue(textFormatAndResourceType.textFormat);
34397
34466
  const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
34398
34467
  if (isInvalidTextFormat) {
34399
34468
  this.addWarning(
34400
34469
  `Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
34401
34470
  );
34402
34471
  }
34403
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
34472
+ const deprecatedTextFormat = (0, import_superenum49.Enum)(DeprecatedTextFormat).fromValue(
34404
34473
  textFormatAndResourceType.textFormat
34405
34474
  );
34406
34475
  if (deprecatedTextFormat) {
@@ -34410,7 +34479,7 @@ var BitmarkPegParserProcessor = class {
34410
34479
  );
34411
34480
  }
34412
34481
  textFormat = textFormat ?? bitConfig.textFormatDefault;
34413
- const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
34482
+ const resourceType = (0, import_superenum49.Enum)(ResourceType).fromValue(textFormatAndResourceType.resourceType);
34414
34483
  if (textFormatAndResourceType.resourceType && !resourceType) {
34415
34484
  this.addWarning(
34416
34485
  `Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
@@ -34664,6 +34733,13 @@ var BitmarkPegParserProcessor = class {
34664
34733
  if (l > 2) result.pageNumber = result.itemLead[2];
34665
34734
  if (l > 3) result.marginNumber = result.itemLead[l - 1];
34666
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
+ }
34667
34743
  if (inBit) {
34668
34744
  result.body = instance11.process(
34669
34745
  this.context,
@@ -38205,7 +38281,7 @@ var BitmarkParser = class {
38205
38281
  };
38206
38282
 
38207
38283
  // src/BitmarkParserGenerator.ts
38208
- var Input = (0, import_superenum31.superenum)({
38284
+ var Input = {
38209
38285
  /**
38210
38286
  * Input is as a string
38211
38287
  */
@@ -38214,8 +38290,8 @@ var Input = (0, import_superenum31.superenum)({
38214
38290
  * Input is as a file path
38215
38291
  */
38216
38292
  file: "file"
38217
- });
38218
- var Output = (0, import_superenum31.superenum)({
38293
+ };
38294
+ var Output = {
38219
38295
  /**
38220
38296
  * Output bitmark string
38221
38297
  */
@@ -38228,7 +38304,7 @@ var Output = (0, import_superenum31.superenum)({
38228
38304
  * Output AST as a plain JS object, or a file
38229
38305
  */
38230
38306
  ast: "ast"
38231
- });
38307
+ };
38232
38308
  var BitmarkParserGenerator = class {
38233
38309
  constructor() {
38234
38310
  __publicField(this, "ast", new Ast());
@@ -38613,7 +38689,7 @@ var BitmarkParserGenerator = class {
38613
38689
  const opts = Object.assign({}, options);
38614
38690
  const fileOptions = Object.assign({}, opts.fileOptions);
38615
38691
  const jsonOptions = Object.assign({}, opts.jsonOptions);
38616
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38692
+ const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38617
38693
  const textLocation = opts.textLocation ?? TextLocation.body;
38618
38694
  let inStr = input;
38619
38695
  const inputIsString = typeof input === "string";
@@ -38681,7 +38757,7 @@ var BitmarkParserGenerator = class {
38681
38757
  if (!input) return input;
38682
38758
  const opts = Object.assign({}, options);
38683
38759
  const fileOptions = Object.assign({}, opts.fileOptions);
38684
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38760
+ const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38685
38761
  const textLocation = opts.textLocation ?? TextLocation.body;
38686
38762
  let inStr = input;
38687
38763
  const inputIsString = typeof input === "string";
@@ -38734,7 +38810,7 @@ var BitmarkParserGenerator = class {
38734
38810
  if (!input) return input;
38735
38811
  const opts = Object.assign({}, options);
38736
38812
  const fileOptions = Object.assign({}, opts.fileOptions);
38737
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38813
+ const textFormat = (0, import_superenum50.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38738
38814
  const textLocation = opts.textLocation ?? TextLocation.body;
38739
38815
  let inStr = input;
38740
38816
  const inputIsString = typeof input === "string";