@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.
@@ -2,9 +2,12 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
 
5
+ // src/config/Config.ts
6
+ import { Enum as Enum3 } from "@ncoderz/superenum";
7
+
5
8
  // src/model/enum/BitType.ts
6
- import { superenum } from "@ncoderz/superenum";
7
- var BitType = superenum({
9
+ import "@ncoderz/superenum";
10
+ var BitType = {
8
11
  _error: "_error",
9
12
  // Used for error handling to indicate a bit type that is not supported or a bit parse error
10
13
  _comment: "_comment",
@@ -606,6 +609,7 @@ var BitType = superenum({
606
609
  vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
607
610
  vendorJupyterIpynb: "vendor-jupyter-ipynb",
608
611
  vendorJupyterOutput: "vendor-jupyter-output",
612
+ vendorLearndashEmbed: "vendor-learndash-embed",
609
613
  vendorPadletEmbed: "vendor-padlet-embed",
610
614
  vendorStripePricingTable: "vendor-stripe-pricing-table",
611
615
  vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
@@ -624,27 +628,27 @@ var BitType = superenum({
624
628
  warningCollapsible: "warning-collapsible",
625
629
  websiteLink: "website-link",
626
630
  workbookArticle: "workbook-article"
627
- });
631
+ };
628
632
 
629
633
  // src/model/enum/Count.ts
630
- import { superenum as superenum2 } from "@ncoderz/superenum";
631
- var Count = superenum2({
634
+ import "@ncoderz/superenum";
635
+ var Count = {
632
636
  infinity: "infinity"
633
- });
637
+ };
634
638
 
635
639
  // src/model/enum/ExampleType.ts
636
- import { superenum as superenum3 } from "@ncoderz/superenum";
637
- var ExampleType = superenum3({
640
+ import "@ncoderz/superenum";
641
+ var ExampleType = {
638
642
  none: "none",
639
643
  // Example is not allowed
640
644
  string: "string",
641
645
  // Example is a string value
642
646
  boolean: "boolean"
643
647
  // Example is a boolean value
644
- });
648
+ };
645
649
 
646
650
  // src/model/enum/Tag.ts
647
- import { superenum as superenum4 } from "@ncoderz/superenum";
651
+ import "@ncoderz/superenum";
648
652
  var tags = {
649
653
  tag_title: "#",
650
654
  tag_anchor: "\u25BC",
@@ -660,11 +664,11 @@ var tags = {
660
664
  tag_mark: "=",
661
665
  tag_resource: "&"
662
666
  };
663
- var Tag = superenum4(tags);
667
+ var Tag = tags;
664
668
 
665
669
  // src/model/enum/TagFormat.ts
666
- import { superenum as superenum5 } from "@ncoderz/superenum";
667
- var TagFormat = superenum5({
670
+ import "@ncoderz/superenum";
671
+ var TagFormat = {
668
672
  none: "none",
669
673
  // The property does not have a value
670
674
  plainText: "plainText",
@@ -677,11 +681,11 @@ var TagFormat = superenum5({
677
681
  // If the value is treated as a boolean
678
682
  invertedBoolean: "invertedBoolean"
679
683
  // If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
680
- });
684
+ };
681
685
 
682
686
  // src/model/enum/TextFormat.ts
683
- import { superenum as superenum6 } from "@ncoderz/superenum";
684
- var TextFormat2 = superenum6({
687
+ import "@ncoderz/superenum";
688
+ var TextFormat2 = {
685
689
  // plain text
686
690
  plainText: "text",
687
691
  latex: "latex",
@@ -693,11 +697,11 @@ var TextFormat2 = superenum6({
693
697
  // bitmarkText
694
698
  // bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
695
699
  bitmarkText: "bitmark++"
696
- });
700
+ };
697
701
 
698
702
  // src/model/config/enum/CardSetConfigKey.ts
699
- import { superenum as superenum7 } from "@ncoderz/superenum";
700
- var CardSetConfigKey = superenum7({
703
+ import "@ncoderz/superenum";
704
+ var CardSetConfigKey = {
701
705
  flashcard: "flashcard",
702
706
  definitionList: "definitionList",
703
707
  elements: "elements",
@@ -719,22 +723,22 @@ var CardSetConfigKey = superenum7({
719
723
  // DEPRECATED - TO BE REMOVED IN THE FUTURE
720
724
  // captionDefinitionsList: 'captionDefinitionsList',
721
725
  bookReferenceList: "bookReferenceList"
722
- });
726
+ };
723
727
 
724
728
  // src/model/config/enum/GroupConfigType.ts
725
- import { superenum as superenum8 } from "@ncoderz/superenum";
726
- var GroupConfigType = superenum8({
729
+ import "@ncoderz/superenum";
730
+ var GroupConfigType = {
727
731
  standard: "standard",
728
732
  // Any ordinary group
729
733
  resource: "resource",
730
734
  // A resource group
731
735
  comboResource: "comboResource"
732
736
  // A combo resource group
733
- });
737
+ };
734
738
 
735
739
  // src/model/enum/BitTagConfigKeyType.ts
736
- import { superenum as superenum9 } from "@ncoderz/superenum";
737
- var BitTagConfigKeyType = superenum9({
740
+ import "@ncoderz/superenum";
741
+ var BitTagConfigKeyType = {
738
742
  unknown: "unknown",
739
743
  // Unknown tag type, used for error handling
740
744
  tag: "tag",
@@ -746,7 +750,7 @@ var BitTagConfigKeyType = superenum9({
746
750
  //
747
751
  group: "group"
748
752
  // A reusable group of tags
749
- });
753
+ };
750
754
 
751
755
  // src/model/config/AbstractTagConfig.ts
752
756
  var AbstractTagConfig = class {
@@ -1059,10 +1063,10 @@ ${this.cardSet.toString(opts)}`;
1059
1063
  };
1060
1064
 
1061
1065
  // src/model/config/enum/ConfigKey.ts
1062
- import { superenum as superenum14 } from "@ncoderz/superenum";
1066
+ import { Enum } from "@ncoderz/superenum";
1063
1067
 
1064
1068
  // src/model/enum/GroupKey.ts
1065
- import { superenum as superenum10 } from "@ncoderz/superenum";
1069
+ import "@ncoderz/superenum";
1066
1070
  var groupKeys = {
1067
1071
  group_standardAllBits: "group_standardAllBits",
1068
1072
  group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
@@ -1115,10 +1119,9 @@ var groupKeys = {
1115
1119
  group_previewImages: "group_previewImages",
1116
1120
  group_previewVideos: "group_previewVideos"
1117
1121
  };
1118
- var GroupKey = superenum10(groupKeys);
1119
1122
 
1120
1123
  // src/model/enum/PropertyKey.ts
1121
- import { superenum as superenum11 } from "@ncoderz/superenum";
1124
+ import "@ncoderz/superenum";
1122
1125
  var propertyKeys = {
1123
1126
  property_action: "@action",
1124
1127
  property_activityType: "@activityType",
@@ -1390,10 +1393,10 @@ var propertyKeys = {
1390
1393
  property_y: "@y",
1391
1394
  property_zoomDisabled: "@zoomDisabled"
1392
1395
  };
1393
- var PropertyKey = superenum11(propertyKeys);
1396
+ var PropertyKey = propertyKeys;
1394
1397
 
1395
1398
  // src/model/enum/ResourceKey.ts
1396
- import { superenum as superenum12 } from "@ncoderz/superenum";
1399
+ import "@ncoderz/superenum";
1397
1400
  var resourceKeys = {
1398
1401
  resource_image: "&image",
1399
1402
  resource_imageResponsive: "&imageResponsive",
@@ -1429,10 +1432,9 @@ var resourceKeys = {
1429
1432
  resource_previewVideo: "&previewVideo",
1430
1433
  resource_coverImage: "&coverImage"
1431
1434
  };
1432
- var ResourceKey = superenum12(resourceKeys);
1433
1435
 
1434
1436
  // src/model/enum/ResourceType.ts
1435
- import { superenum as superenum13 } from "@ncoderz/superenum";
1437
+ import "@ncoderz/superenum";
1436
1438
 
1437
1439
  // src/utils/StringUtils.ts
1438
1440
  var StringUtils = class {
@@ -1623,7 +1625,7 @@ var StringUtils = class {
1623
1625
  var stringUtils = new StringUtils();
1624
1626
 
1625
1627
  // src/model/enum/ResourceType.ts
1626
- var ResourceType = superenum13({
1628
+ var ResourceType = {
1627
1629
  unknown: "unknown",
1628
1630
  image: "image",
1629
1631
  imageResponsive: "image-responsive",
@@ -1659,13 +1661,13 @@ var ResourceType = superenum13({
1659
1661
  previewImage: "previewImage",
1660
1662
  previewVideo: "previewVideo",
1661
1663
  coverImage: "coverImage"
1662
- });
1664
+ };
1663
1665
  function resourceTypeToConfigKey(type) {
1664
1666
  return `&${stringUtils.kebabToCamel(type)}`;
1665
1667
  }
1666
1668
 
1667
1669
  // src/model/config/enum/ConfigKey.ts
1668
- var ConfigKey = superenum14({
1670
+ var ConfigKey = {
1669
1671
  // Internal
1670
1672
  _unknown: "_unknown",
1671
1673
  // Tags
@@ -1676,7 +1678,7 @@ var ConfigKey = superenum14({
1676
1678
  ...propertyKeys,
1677
1679
  // Groups
1678
1680
  ...groupKeys
1679
- });
1681
+ };
1680
1682
  function typeFromConfigKey(tagKey) {
1681
1683
  if (!tagKey) return BitTagConfigKeyType.unknown;
1682
1684
  if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
@@ -1688,7 +1690,7 @@ function configKeyToPropertyType(configKey) {
1688
1690
  return configKey.replace(/^@/, "");
1689
1691
  }
1690
1692
  function configKeyToResourceType(configKey) {
1691
- return ResourceType.fromKey(configKey.replace(/^&/, ""));
1693
+ return Enum(ResourceType).fromKey(configKey.replace(/^&/, ""));
1692
1694
  }
1693
1695
 
1694
1696
  // src/model/config/ResourcesConfig.ts
@@ -2080,6 +2082,9 @@ var ObjectUtils = class {
2080
2082
  };
2081
2083
  var objectUtils = new ObjectUtils();
2082
2084
 
2085
+ // src/config/ConfigHydrator.ts
2086
+ import { Enum as Enum2 } from "@ncoderz/superenum";
2087
+
2083
2088
  // src/config/raw/cardSets.ts
2084
2089
  var CARDSETS = {
2085
2090
  [CardSetConfigKey.definitionList]: {
@@ -4318,9 +4323,9 @@ var ConfigHydrator = class {
4318
4323
  }
4319
4324
  hydrateTagConfig(_tag) {
4320
4325
  const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
4321
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4326
+ const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4322
4327
  if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
4323
- const tag = Tag.fromValue(configKey);
4328
+ const tag = Enum2(Tag).fromValue(configKey);
4324
4329
  if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
4325
4330
  let chain;
4326
4331
  if (_chain) {
@@ -4351,7 +4356,7 @@ var ConfigHydrator = class {
4351
4356
  defaultValue,
4352
4357
  jsonKey
4353
4358
  } = _tag;
4354
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4359
+ const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4355
4360
  if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
4356
4361
  const tag = _configKey.substring(1);
4357
4362
  let chain;
@@ -4377,7 +4382,7 @@ var ConfigHydrator = class {
4377
4382
  }
4378
4383
  hydrateResourceTagConfig(_tag) {
4379
4384
  const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
4380
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4385
+ const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4381
4386
  if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
4382
4387
  const tag = _configKey.substring(1);
4383
4388
  let chain;
@@ -4401,7 +4406,7 @@ var ConfigHydrator = class {
4401
4406
  }
4402
4407
  hydrateTagGroupConfig(_tag) {
4403
4408
  const { key: _configKey } = _tag;
4404
- const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
4409
+ const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4405
4410
  if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
4406
4411
  const _groupConfig = GROUPS[configKey];
4407
4412
  if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
@@ -9861,6 +9866,11 @@ var BITS = {
9861
9866
  minCount: 1
9862
9867
  }
9863
9868
  ]
9869
+ },
9870
+ [BitType.vendorLearndashEmbed]: {
9871
+ since: "5.0.0",
9872
+ baseBitType: BitType.nonProductionPrototypeIframe,
9873
+ description: "Learndash embed bit, used to embed Learndash content in an iframe"
9864
9874
  }
9865
9875
  };
9866
9876
 
@@ -9883,7 +9893,7 @@ var Config = class {
9883
9893
  */
9884
9894
  getBitType(bitType) {
9885
9895
  if (bitType?.startsWith("|")) bitType = bitType.substring(1);
9886
- return BitType.fromValue(bitType) ?? BitType._error;
9896
+ return Enum3(BitType).fromValue(bitType) ?? BitType._error;
9887
9897
  }
9888
9898
  /**
9889
9899
  * Check if a bit type is and instance of the given root bit type.
@@ -10203,15 +10213,15 @@ var instance2 = new Config();
10203
10213
  // src/generated/package_info.ts
10204
10214
  var PACKAGE_INFO = {
10205
10215
  "name": "@gmb/bitmark-parser-generator",
10206
- "version": "4.20.0",
10216
+ "version": "5.0.0",
10207
10217
  "author": "Get More Brain Ltd",
10208
10218
  "license": "ISC",
10209
10219
  "description": "A bitmark parser and generator using Peggy.js"
10210
10220
  };
10211
10221
 
10212
10222
  // src/utils/env/Environment.ts
10213
- import { superenum as superenum15 } from "@ncoderz/superenum";
10214
- var Environment = superenum15({
10223
+ import "@ncoderz/superenum";
10224
+ var Environment = {
10215
10225
  unknown: "",
10216
10226
  node: "node",
10217
10227
  chrome: "chrome",
@@ -10219,18 +10229,18 @@ var Environment = superenum15({
10219
10229
  firefox: "firefox",
10220
10230
  edge: "edge",
10221
10231
  ie: "ie"
10222
- });
10232
+ };
10223
10233
 
10224
10234
  // src/utils/env/Os.ts
10225
- import { superenum as superenum16 } from "@ncoderz/superenum";
10226
- var Os = superenum16({
10235
+ import "@ncoderz/superenum";
10236
+ var Os = {
10227
10237
  unknown: "",
10228
10238
  macos: "macos",
10229
10239
  windows: "windows",
10230
10240
  linux: "linux",
10231
10241
  android: "android",
10232
10242
  ios: "ios"
10233
- });
10243
+ };
10234
10244
 
10235
10245
  // src/utils/env/userAgent.ts
10236
10246
  function parseUserAgent() {
@@ -10438,8 +10448,11 @@ function init() {
10438
10448
  initialised = true;
10439
10449
  }
10440
10450
 
10451
+ // src/ast/Ast.ts
10452
+ import { Enum as Enum4 } from "@ncoderz/superenum";
10453
+
10441
10454
  // src/model/enum/BodyBitType.ts
10442
- import { superenum as superenum17 } from "@ncoderz/superenum";
10455
+ import "@ncoderz/superenum";
10443
10456
  var BodyBitTypeRaw = {
10444
10457
  text: "text",
10445
10458
  gap: "gap",
@@ -10447,11 +10460,11 @@ var BodyBitTypeRaw = {
10447
10460
  select: "select",
10448
10461
  highlight: "highlight"
10449
10462
  };
10450
- var BodyBitType = superenum17(BodyBitTypeRaw);
10463
+ var BodyBitType = BodyBitTypeRaw;
10451
10464
 
10452
10465
  // src/model/enum/TextMarkType.ts
10453
- import { superenum as superenum18 } from "@ncoderz/superenum";
10454
- var TextMarkType = superenum18({
10466
+ import "@ncoderz/superenum";
10467
+ var TextMarkType = {
10455
10468
  // Styles
10456
10469
  bold: "bold",
10457
10470
  light: "light",
@@ -10498,11 +10511,11 @@ var TextMarkType = superenum18({
10498
10511
  duration: "duration",
10499
10512
  color: "color",
10500
10513
  comment: "comment"
10501
- });
10514
+ };
10502
10515
 
10503
10516
  // src/model/enum/TextNodeType.ts
10504
- import { superenum as superenum19 } from "@ncoderz/superenum";
10505
- var TextNodeType = superenum19({
10517
+ import "@ncoderz/superenum";
10518
+ var TextNodeType = {
10506
10519
  // Text
10507
10520
  text: "text",
10508
10521
  // Blocks
@@ -10530,11 +10543,11 @@ var TextNodeType = superenum19({
10530
10543
  select: "select",
10531
10544
  highlight: "highlight",
10532
10545
  mark: "mark"
10533
- });
10546
+ };
10534
10547
 
10535
10548
  // src/model/ast/NodeType.ts
10536
- import { superenum as superenum20 } from "@ncoderz/superenum";
10537
- var NodeType = superenum20({
10549
+ import "@ncoderz/superenum";
10550
+ var NodeType = {
10538
10551
  unknown: "unknown",
10539
10552
  // unknown
10540
10553
  __isDefaultExample: "__isDefaultExample",
@@ -11217,7 +11230,7 @@ var NodeType = superenum20({
11217
11230
  y: "y",
11218
11231
  yValue: "yValue",
11219
11232
  zoomDisabled: "zoomDisabled"
11220
- });
11233
+ };
11221
11234
 
11222
11235
  // src/ast/Ast.ts
11223
11236
  var Ast = class {
@@ -11400,7 +11413,7 @@ var Ast = class {
11400
11413
  if (isParentArray && parentKey) {
11401
11414
  astKey = `${parentKey}Value`;
11402
11415
  }
11403
- return NodeType.fromKey(astKey) || `unknown(${astKey})`;
11416
+ return Enum4(NodeType).fromKey(astKey) || `unknown(${astKey})`;
11404
11417
  }
11405
11418
  isArray(x) {
11406
11419
  return Array.isArray(x);
@@ -11413,16 +11426,19 @@ var Ast = class {
11413
11426
  }
11414
11427
  };
11415
11428
 
11429
+ // src/ast/Builder.ts
11430
+ import { Enum as Enum7 } from "@ncoderz/superenum";
11431
+
11416
11432
  // src/model/enum/TextLocation.ts
11417
- import { superenum as superenum21 } from "@ncoderz/superenum";
11418
- var TextLocation2 = superenum21({
11433
+ import "@ncoderz/superenum";
11434
+ var TextLocation2 = {
11419
11435
  tag: "tag",
11420
11436
  body: "body"
11421
- });
11437
+ };
11422
11438
 
11423
11439
  // src/model/enum/BodyTextFormat.ts
11424
- import { superenum as superenum22 } from "@ncoderz/superenum";
11425
- var BodyTextFormat = superenum22({
11440
+ import "@ncoderz/superenum";
11441
+ var BodyTextFormat = {
11426
11442
  plainText: "text",
11427
11443
  // plain text
11428
11444
  latex: "latex",
@@ -11433,7 +11449,7 @@ var BodyTextFormat = superenum22({
11433
11449
  // xml
11434
11450
  // bitmark++ text
11435
11451
  bitmarkPlusPlus: "bitmark++"
11436
- });
11452
+ };
11437
11453
 
11438
11454
  // src/breakscaping/RegexConfigs.ts
11439
11455
  var REGEX_MARKS = /([*`_!=])(?=\1)/;
@@ -11682,11 +11698,11 @@ var Breakscape3 = class {
11682
11698
  var instance3 = new Breakscape3();
11683
11699
 
11684
11700
  // src/model/enum/DeprecatedTextFormat.ts
11685
- import { superenum as superenum23 } from "@ncoderz/superenum";
11686
- var DeprecatedTextFormat = superenum23({
11701
+ import "@ncoderz/superenum";
11702
+ var DeprecatedTextFormat = {
11687
11703
  bitmarkMinusMinus: "bitmark--"
11688
11704
  // bitmark-- text format, deprecated
11689
- });
11705
+ };
11690
11706
 
11691
11707
  // src/parser/json/TableUtils.ts
11692
11708
  function isTableBasicFormat(table) {
@@ -11845,14 +11861,14 @@ var ArrayUtils = class {
11845
11861
  var instance4 = new ArrayUtils();
11846
11862
 
11847
11863
  // src/generator/text/TextGenerator.ts
11848
- import "@ncoderz/superenum";
11864
+ import { Enum as Enum5 } from "@ncoderz/superenum";
11849
11865
 
11850
11866
  // src/model/enum/BitmarkVersion.ts
11851
- import { superenum as superenum24 } from "@ncoderz/superenum";
11852
- var BitmarkVersion = superenum24({
11867
+ import "@ncoderz/superenum";
11868
+ var BitmarkVersion = {
11853
11869
  v2: 2,
11854
11870
  v3: 3
11855
- });
11871
+ };
11856
11872
  var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
11857
11873
 
11858
11874
  // src/generator/AstWalkerGenerator.ts
@@ -12039,7 +12055,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12039
12055
  __publicField(this, "preTextIndexTemp", -1);
12040
12056
  __publicField(this, "havePreText", false);
12041
12057
  __publicField(this, "preTextIndex", -1);
12042
- this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
12058
+ this.bitmarkVersion = Enum5(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
12043
12059
  this.options = {
12044
12060
  ...DEFAULT_OPTIONS,
12045
12061
  ...options
@@ -22224,6 +22240,9 @@ var BitUtils = class {
22224
22240
  };
22225
22241
  var instance7 = new BitUtils();
22226
22242
 
22243
+ // src/ast/ResourceBuilder.ts
22244
+ import { Enum as Enum6 } from "@ncoderz/superenum";
22245
+
22227
22246
  // src/utils/UrlUtils.ts
22228
22247
  var UrlUtils = class {
22229
22248
  fileExtensionFromUrl(url) {
@@ -22463,11 +22482,11 @@ var ResourceBuilder = class extends BaseBuilder {
22463
22482
  const nodes = [];
22464
22483
  if (!Array.isArray(resource)) resource = [resource];
22465
22484
  for (const thisResource of resource) {
22466
- let type = ResourceType.fromValue(thisResource.type);
22485
+ let type = Enum6(ResourceType).fromValue(thisResource.type);
22467
22486
  if (!type) return void 0;
22468
- const resourceKey = ResourceType.keyFromValue(type);
22487
+ const resourceKey = Enum6(ResourceType).keyFromValue(type);
22469
22488
  if (!resourceKey) return void 0;
22470
- const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
22489
+ const __typeAlias = Enum6(ResourceType).fromValue(thisResource.__typeAlias);
22471
22490
  type = __typeAlias ?? type;
22472
22491
  let data;
22473
22492
  if (type === ResourceType.imageResponsive) {
@@ -22503,7 +22522,7 @@ var ResourceBuilder = class extends BaseBuilder {
22503
22522
  }
22504
22523
  resourceFromResourceDataJson(context, type, data) {
22505
22524
  if (!data) return void 0;
22506
- type = ResourceType.fromValue(type);
22525
+ type = Enum6(ResourceType).fromValue(type);
22507
22526
  if (!type) return void 0;
22508
22527
  const dataAsString = stringUtils.isString(data) ? data : void 0;
22509
22528
  const url = data.url || data.src || data.body || dataAsString;
@@ -23616,8 +23635,8 @@ var Builder = class extends BaseBuilder {
23616
23635
  data = structuredClone(data);
23617
23636
  const bitType = data.bitType;
23618
23637
  const bitConfig = instance2.getBitConfig(bitType);
23619
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
23620
- let textFormat = TextFormat2.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
23638
+ const deprecatedTextFormat = Enum7(DeprecatedTextFormat).fromValue(data.textFormat);
23639
+ let textFormat = Enum7(TextFormat2).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
23621
23640
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
23622
23641
  textFormat = TextFormat2.bitmarkText;
23623
23642
  }
@@ -23640,7 +23659,7 @@ var Builder = class extends BaseBuilder {
23640
23659
  bitType,
23641
23660
  bitLevel: data.bitLevel,
23642
23661
  textFormat,
23643
- resourceType: ResourceType.fromValue(data.resourceType),
23662
+ resourceType: Enum7(ResourceType).fromValue(data.resourceType),
23644
23663
  isCommented: data.isCommented,
23645
23664
  // Properties
23646
23665
  id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
@@ -24965,14 +24984,14 @@ var Builder = class extends BaseBuilder {
24965
24984
  response: data.response ?? "",
24966
24985
  reaction: data.reaction ?? "",
24967
24986
  feedback: data.feedback ?? "",
24968
- item: this.handleJsonText(context, TextLocation2.tag, data.item),
24987
+ item: data.item ?? "",
24969
24988
  lead: this.handleJsonText(context, TextLocation2.tag, data.lead),
24970
24989
  hint: this.handleJsonText(context, TextLocation2.tag, data.hint)
24971
24990
  };
24972
24991
  objectUtils.removeUnwantedProperties(node, {
24973
- ignoreEmptyString: ["response", "reaction", "feedback"],
24992
+ ignoreEmptyString: ["response", "reaction", "feedback", "item"],
24974
24993
  ignoreAllFalse: true,
24975
- ignoreEmptyArrays: ["item"],
24994
+ ignoreEmptyArrays: [],
24976
24995
  ignoreUndefined: ["example"]
24977
24996
  });
24978
24997
  return node;
@@ -26590,14 +26609,17 @@ var StringWriter = class {
26590
26609
  };
26591
26610
 
26592
26611
  // src/BitmarkParserGenerator.ts
26593
- import { superenum as superenum30 } from "@ncoderz/superenum";
26612
+ import { Enum as Enum22 } from "@ncoderz/superenum";
26613
+
26614
+ // src/generator/bitmark/BitmarkGenerator.ts
26615
+ import { Enum as Enum8 } from "@ncoderz/superenum";
26594
26616
 
26595
26617
  // src/model/enum/CardSetVersion.ts
26596
- import { superenum as superenum25 } from "@ncoderz/superenum";
26597
- var CardSetVersion = superenum25({
26618
+ import "@ncoderz/superenum";
26619
+ var CardSetVersion = {
26598
26620
  v1: 1,
26599
26621
  v2: 2
26600
- });
26622
+ };
26601
26623
 
26602
26624
  // src/generator/bitmark/BitmarkGenerator.ts
26603
26625
  var DEFAULT_OPTIONS2 = {
@@ -26652,7 +26674,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
26652
26674
  this.leaf = this.leaf.bind(this);
26653
26675
  this.write = this.write.bind(this);
26654
26676
  this.bodyBitCallback = this.bodyBitCallback.bind(this);
26655
- this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
26677
+ this.bitmarkVersion = Enum8(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
26656
26678
  this.options = {
26657
26679
  ...DEFAULT_OPTIONS2,
26658
26680
  ...options?.bitmarkOptions
@@ -27214,7 +27236,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
27214
27236
  this.inTag = true;
27215
27237
  }
27216
27238
  bodyBitCallback(bodyBit, _index, _route) {
27217
- const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
27239
+ const nodeType = Enum8(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
27218
27240
  this.ast.walk(bodyBit, nodeType, this, void 0);
27219
27241
  return "";
27220
27242
  }
@@ -27759,6 +27781,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
27759
27781
  between_cardBits(_node, _left, _right, _route) {
27760
27782
  this.writeCardSetCardDivider();
27761
27783
  }
27784
+ // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> item
27785
+ leaf_item(node, route) {
27786
+ const parent = this.getParentNode(route);
27787
+ if (parent?.key !== NodeType.botResponsesValue) return;
27788
+ this.writeNL();
27789
+ this.writeOPC();
27790
+ this.writeTextOrValue(node.value, TextFormat2.plainText, TextLocation2.tag);
27791
+ this.writeCL();
27792
+ }
27762
27793
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
27763
27794
  leaf_response(node, route) {
27764
27795
  const parent = this.getParentNode(route);
@@ -28420,8 +28451,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28420
28451
  * Generate the handlers for resources, as they are mostly the same, but not quite
28421
28452
  */
28422
28453
  generateResourceHandlers() {
28423
- for (const tag of ResourceType.keys()) {
28424
- if (tag === ResourceType.keyFromValue(ResourceType.unknown)) continue;
28454
+ for (const tag of Enum8(ResourceType).keys()) {
28455
+ if (tag === Enum8(ResourceType).keyFromValue(ResourceType.unknown)) continue;
28425
28456
  const enterFuncName = `enter_${tag}`;
28426
28457
  if (typeof this[enterFuncName] === "function") {
28427
28458
  continue;
@@ -28431,8 +28462,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28431
28462
  if (resource == null) return false;
28432
28463
  const parent = this.getParentNode(route);
28433
28464
  if (parent?.key !== NodeType.resourcesValue) return true;
28434
- const alias = ResourceType.fromValue(parent.value.__typeAlias);
28435
- const type = alias ?? ResourceType.fromValue(parent.value.type);
28465
+ const alias = Enum8(ResourceType).fromValue(parent?.value.__typeAlias);
28466
+ const type = alias ?? Enum8(ResourceType).fromValue(parent?.value.type);
28436
28467
  if (!type) return false;
28437
28468
  const url = resource.url || resource.src || resource.body || "";
28438
28469
  this.writeNL();
@@ -28446,7 +28477,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28446
28477
  * Generate the handlers for properties, as they are mostly the same, but not quite
28447
28478
  */
28448
28479
  generatePropertyHandlers() {
28449
- for (const propertyConfigKey of PropertyKey.values()) {
28480
+ for (const propertyConfigKey of Enum8(PropertyKey).values()) {
28450
28481
  const propertyTag = configKeyToPropertyType(propertyConfigKey);
28451
28482
  const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
28452
28483
  for (const funcName of funcNames) {
@@ -28796,7 +28827,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28796
28827
  }
28797
28828
  writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
28798
28829
  if (key && resource) {
28799
- const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
28830
+ const resourceTag = Enum8(ResourceType).keyFromValue(resource.type) ?? "";
28800
28831
  const resourceData = resource[resourceTag];
28801
28832
  const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
28802
28833
  if (deprecated_writeAsProperty) {
@@ -28881,7 +28912,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28881
28912
  return true;
28882
28913
  }
28883
28914
  isWriteTextFormat(bitsValue, textFormatDefault) {
28884
- const isDefault = TextFormat2.fromValue(bitsValue) === textFormatDefault;
28915
+ const isDefault = Enum8(TextFormat2).fromValue(bitsValue) === textFormatDefault;
28885
28916
  const writeFormat = !isDefault || this.options.explicitTextFormat;
28886
28917
  return !!writeFormat;
28887
28918
  }
@@ -28973,6 +29004,7 @@ var BitmarkStringGenerator = class {
28973
29004
  };
28974
29005
 
28975
29006
  // src/generator/json/JsonGenerator.ts
29007
+ import { Enum as Enum9 } from "@ncoderz/superenum";
28976
29008
  var MOVE_BODY_RECURSION_LIMIT = 5e3;
28977
29009
  var DEFAULT_OPTIONS3 = {
28978
29010
  // debugGenerationInline: true,
@@ -29009,7 +29041,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29009
29041
  this.exit = this.exit.bind(this);
29010
29042
  this.leaf = this.leaf.bind(this);
29011
29043
  this.bodyBitCallback = this.bodyBitCallback.bind(this);
29012
- this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
29044
+ this.bitmarkVersion = Enum9(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
29013
29045
  this.textParserVersion = this.textParser.version();
29014
29046
  this.options = {
29015
29047
  ...DEFAULT_OPTIONS3,
@@ -29363,7 +29395,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29363
29395
  throw new Error("Recursion limit exceeded");
29364
29396
  }
29365
29397
  for (const node of nodes) {
29366
- if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
29398
+ if (node.type !== BodyBitType.text && Enum9(BodyBitType).values().includes(node.type)) {
29367
29399
  const bodyBit = node;
29368
29400
  bodyBit.attrs = {};
29369
29401
  for (const [key, value] of Object.entries(bodyBit)) {
@@ -29650,7 +29682,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29650
29682
  * Generate the handlers for properties, as they are mostly the same, but not quite
29651
29683
  */
29652
29684
  generatePropertyHandlers() {
29653
- for (const propertyConfigKey of PropertyKey.values()) {
29685
+ for (const propertyConfigKey of Enum9(PropertyKey).values()) {
29654
29686
  const propertyTag = configKeyToPropertyType(propertyConfigKey);
29655
29687
  const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
29656
29688
  for (const funcName of funcNames) {
@@ -29766,7 +29798,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
29766
29798
  for (const node of route) {
29767
29799
  if (node.key === NodeType.bitsValue) {
29768
29800
  const n = node.value;
29769
- return TextFormat2.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
29801
+ return Enum9(TextFormat2).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
29770
29802
  }
29771
29803
  }
29772
29804
  }
@@ -30315,12 +30347,13 @@ var JsonObjectGenerator = class {
30315
30347
  };
30316
30348
 
30317
30349
  // src/info/InfoBuilder.ts
30350
+ import { Enum as Enum10 } from "@ncoderz/superenum";
30318
30351
  var InfoBuilder = class {
30319
30352
  getSupportedBits(options) {
30320
30353
  const includeNonDeprecated = options?.includeNonDeprecated ?? true;
30321
30354
  const includeDeprecated = options?.includeDeprecated ?? false;
30322
30355
  const supportedBits = [];
30323
- for (const bt of BitType.values()) {
30356
+ for (const bt of Enum10(BitType).values()) {
30324
30357
  if (bt === BitType._error || bt === BitType._comment) continue;
30325
30358
  const bitType = instance2.getBitType(bt);
30326
30359
  const bitConfig = instance2.getBitConfig(bitType);
@@ -30339,7 +30372,7 @@ var InfoBuilder = class {
30339
30372
  }
30340
30373
  getSupportedBitConfigs() {
30341
30374
  const res = [];
30342
- for (const bt of BitType.values()) {
30375
+ for (const bt of Enum10(BitType).values()) {
30343
30376
  if (bt === BitType._error || bt === BitType._comment) continue;
30344
30377
  const bitType = instance2.getBitType(bt);
30345
30378
  const config = instance2.getBitConfig(bitType);
@@ -30350,22 +30383,22 @@ var InfoBuilder = class {
30350
30383
  };
30351
30384
 
30352
30385
  // src/model/enum/BitmarkParserType.ts
30353
- import { superenum as superenum26 } from "@ncoderz/superenum";
30354
- var BitmarkParserType = superenum26({
30386
+ import "@ncoderz/superenum";
30387
+ var BitmarkParserType = {
30355
30388
  peggy: "peggy"
30356
- });
30389
+ };
30357
30390
 
30358
30391
  // src/model/info/enum/InfoFormat.ts
30359
- import { superenum as superenum27 } from "@ncoderz/superenum";
30360
- var InfoFormat = superenum27({
30392
+ import "@ncoderz/superenum";
30393
+ var InfoFormat = {
30361
30394
  text: "text",
30362
30395
  json: "json",
30363
30396
  pojo: "pojo"
30364
- });
30397
+ };
30365
30398
 
30366
30399
  // src/model/info/enum/InfoType.ts
30367
- import { superenum as superenum28 } from "@ncoderz/superenum";
30368
- var InfoType = superenum28({
30400
+ import "@ncoderz/superenum";
30401
+ var InfoType = {
30369
30402
  list: "list",
30370
30403
  // List non-deprecated bits
30371
30404
  deprecated: "deprecated",
@@ -30374,9 +30407,10 @@ var InfoType = superenum28({
30374
30407
  // List all bits
30375
30408
  bit: "bit"
30376
30409
  // Get information for a bit
30377
- });
30410
+ };
30378
30411
 
30379
30412
  // src/parser/json/JsonParser.ts
30413
+ import { Enum as Enum11 } from "@ncoderz/superenum";
30380
30414
  var builder = new Builder();
30381
30415
  var JsonParser = class {
30382
30416
  /**
@@ -30478,8 +30512,8 @@ var JsonParser = class {
30478
30512
  const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
30479
30513
  const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
30480
30514
  const bitConfig = instance2.getBitConfig(bitType);
30481
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
30482
- let _textFormat = TextFormat2.fromValue(bit.format) ?? bitConfig.textFormatDefault;
30515
+ const deprecatedTextFormat = Enum11(DeprecatedTextFormat).fromValue(bit.format);
30516
+ let _textFormat = Enum11(TextFormat2).fromValue(bit.format) ?? bitConfig.textFormatDefault;
30483
30517
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
30484
30518
  _textFormat = TextFormat2.bitmarkText;
30485
30519
  }
@@ -30556,7 +30590,7 @@ var JsonParser = class {
30556
30590
  }
30557
30591
  getResourceType(resource) {
30558
30592
  if (resource) {
30559
- const resourceKey = ResourceType.fromValue(resource.type);
30593
+ const resourceKey = Enum11(ResourceType).fromValue(resource.type);
30560
30594
  return resourceKey;
30561
30595
  }
30562
30596
  return void 0;
@@ -30628,7 +30662,7 @@ var JsonParser = class {
30628
30662
  };
30629
30663
 
30630
30664
  // src/parser/bitmark/peg/BitmarkPegParserTypes.ts
30631
- import { superenum as superenum29 } from "@ncoderz/superenum";
30665
+ import "@ncoderz/superenum";
30632
30666
 
30633
30667
  // src/parser/bitmark/peg/PeggyGrammarLocation.ts
30634
30668
  var PeggyGrammarLocation = class {
@@ -30708,7 +30742,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
30708
30742
  var CARD_DIVIDER_V1 = "===";
30709
30743
  var CARD_SIDE_DIVIDER_V1 = "==";
30710
30744
  var CARD_VARIANT_DIVIDER_V1 = "--";
30711
- var TypeKey = superenum29({
30745
+ var TypeKey = {
30712
30746
  // Bit header
30713
30747
  TextFormat: "TextFormat",
30714
30748
  ResourceType: "ResourceType",
@@ -30743,14 +30777,15 @@ var TypeKey = superenum29({
30743
30777
  // Dividers
30744
30778
  PlainTextDivider: "PlainTextDivider",
30745
30779
  FooterDivider: "FooterDivider"
30746
- });
30747
- var ContentDepth = superenum29({
30780
+ };
30781
+ var ContentDepth = {
30748
30782
  Bit: "Bit",
30749
30783
  Card: "Card",
30750
30784
  Chain: "Chain"
30751
- });
30785
+ };
30752
30786
 
30753
30787
  // src/parser/bitmark/peg/BitmarkPegParserHelper.ts
30788
+ import { Enum as Enum12 } from "@ncoderz/superenum";
30754
30789
  var DEBUG_TRACE_RAW_BIT = true;
30755
30790
  var DEBUG_TRACE_TEXT_FORMAT = false;
30756
30791
  var DEBUG_TRACE_RESOURCE_TYPE = false;
@@ -30840,7 +30875,7 @@ var BitmarkPegParserHelper = class {
30840
30875
  if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
30841
30876
  return {
30842
30877
  type,
30843
- key: Tag.fromValue(type),
30878
+ key: Enum12(Tag).fromValue(type),
30844
30879
  value,
30845
30880
  parser: {
30846
30881
  text: this.parserText(),
@@ -31235,7 +31270,7 @@ var BitmarkPegParserHelper = class {
31235
31270
  if (!value) return false;
31236
31271
  const { type } = value;
31237
31272
  if (!validType) {
31238
- return !!TypeKey.fromValue(type);
31273
+ return !!Enum12(TypeKey).fromValue(type);
31239
31274
  }
31240
31275
  if (Array.isArray(validType)) {
31241
31276
  return validType.indexOf(type) >= 0;
@@ -31305,7 +31340,11 @@ var BitmarkPegParserHelper = class {
31305
31340
  }
31306
31341
  };
31307
31342
 
31343
+ // src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
31344
+ import { Enum as Enum21 } from "@ncoderz/superenum";
31345
+
31308
31346
  // src/parser/bitmark/peg/BitmarkPegParserValidator.ts
31347
+ import { Enum as Enum13 } from "@ncoderz/superenum";
31309
31348
  var COMMON_MISTAKE_STRINGS = [
31310
31349
  // Card divider errors
31311
31350
  "----",
@@ -31477,7 +31516,7 @@ var BitmarkPegParserValidator = class {
31477
31516
  const content = dataOrNull[i];
31478
31517
  if (!content) continue;
31479
31518
  const { type, key } = content;
31480
- let typeKey = TypeKey.fromValue(type);
31519
+ let typeKey = Enum13(TypeKey).fromValue(type);
31481
31520
  if (!typeKey) continue;
31482
31521
  let validTypeKey = typeKey;
31483
31522
  if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
@@ -31900,7 +31939,7 @@ var BitmarkPegParserValidator = class {
31900
31939
  } else if (tagValidationData.isResource) {
31901
31940
  res.set(v.configKey, tagValidationData);
31902
31941
  } else {
31903
- const typeKey = TypeKey.fromValue(v.tag);
31942
+ const typeKey = Enum13(TypeKey).fromValue(v.tag);
31904
31943
  if (typeKey) {
31905
31944
  res.set(typeKey, tagValidationData);
31906
31945
  }
@@ -32913,12 +32952,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
32913
32952
  for (const card of cardSet.cards) {
32914
32953
  for (const side of card.sides) {
32915
32954
  for (const content of side.variants) {
32916
- const { __instructionString, reaction, cardBodyStr: feedback, ...tags2 } = content.data;
32955
+ const {
32956
+ __instructionString,
32957
+ __itemString,
32958
+ reaction,
32959
+ cardBodyStr: feedback,
32960
+ ...tags2
32961
+ } = content.data;
32917
32962
  const botResponse = {
32918
32963
  response: __instructionString ?? instance3.EMPTY_STRING,
32919
32964
  reaction: reaction ?? instance3.EMPTY_STRING,
32920
32965
  feedback: feedback ?? instance3.EMPTY_STRING,
32921
- ...tags2
32966
+ ...tags2,
32967
+ item: __itemString ?? instance3.EMPTY_STRING
32922
32968
  };
32923
32969
  if (botResponse) botResponses.push(botResponse);
32924
32970
  }
@@ -33154,6 +33200,9 @@ var FooterContentProcessor = class {
33154
33200
  };
33155
33201
  var instance12 = new FooterContentProcessor();
33156
33202
 
33203
+ // src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
33204
+ import { Enum as Enum14 } from "@ncoderz/superenum";
33205
+
33157
33206
  // src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
33158
33207
  var textParser4 = new TextParser();
33159
33208
  function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
@@ -33189,7 +33238,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
33189
33238
  }
33190
33239
  function buildGap(context, _contentDepth, tagsConfig, content) {
33191
33240
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
33192
- const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33241
+ const gapConfig = instance2.getTagConfigForTag(tagsConfig, Enum14(Tag).fromValue(content.type));
33193
33242
  const chainContent = [content, ...content.chain ?? []];
33194
33243
  const chainTags = context.bitContentProcessor(
33195
33244
  ContentDepth.Chain,
@@ -33204,6 +33253,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
33204
33253
  return gap;
33205
33254
  }
33206
33255
 
33256
+ // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
33257
+ import { Enum as Enum15 } from "@ncoderz/superenum";
33258
+
33207
33259
  // src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
33208
33260
  function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
33209
33261
  const { textFormat } = context;
@@ -33216,6 +33268,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
33216
33268
  location: TextLocation2.tag
33217
33269
  });
33218
33270
  target.itemLead.push(text);
33271
+ if (!target.__itemLeadString) target.__itemLeadString = [];
33272
+ target.__itemLeadString.push(
33273
+ instance3.unbreakscape(trimmedStringValue, {
33274
+ format: TextFormat2.bitmarkText,
33275
+ location: TextLocation2.tag
33276
+ })
33277
+ );
33219
33278
  }
33220
33279
 
33221
33280
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
@@ -33228,7 +33287,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
33228
33287
  }
33229
33288
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33230
33289
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
33231
- const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33290
+ const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum15(Tag).fromValue(content.type));
33232
33291
  const chainContent = [content, ...content.chain ?? []];
33233
33292
  const chainTags = context.bitContentProcessor(
33234
33293
  ContentDepth.Chain,
@@ -33237,8 +33296,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33237
33296
  );
33238
33297
  if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
33239
33298
  target.itemLead = chainTags.itemLead;
33299
+ target.__itemLeadString = chainTags.__itemLeadString;
33240
33300
  }
33241
33301
 
33302
+ // src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
33303
+ import { Enum as Enum16 } from "@ncoderz/superenum";
33304
+
33242
33305
  // src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
33243
33306
  function markTagContentProcessor(_context, _contentDepth, content, target) {
33244
33307
  const { value } = content;
@@ -33263,7 +33326,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
33263
33326
  }
33264
33327
  function buildMark(context, _contentDepth, tagsConfig, content) {
33265
33328
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33266
- const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33329
+ const markConfig = instance2.getTagConfigForTag(tagsConfig, Enum16(Tag).fromValue(content.type));
33267
33330
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33268
33331
  const chainTags = context.bitContentProcessor(
33269
33332
  ContentDepth.Chain,
@@ -33282,6 +33345,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
33282
33345
  return mark;
33283
33346
  }
33284
33347
 
33348
+ // src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
33349
+ import { Enum as Enum19 } from "@ncoderz/superenum";
33350
+
33285
33351
  // src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
33286
33352
  function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33287
33353
  if (contentDepth === ContentDepth.Chain) {
@@ -33456,6 +33522,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
33456
33522
  }
33457
33523
 
33458
33524
  // src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
33525
+ import { Enum as Enum17 } from "@ncoderz/superenum";
33459
33526
  function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33460
33527
  if (contentDepth === ContentDepth.Chain) {
33461
33528
  imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -33474,7 +33541,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
33474
33541
  function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
33475
33542
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
33476
33543
  const { key: tag } = content;
33477
- const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33544
+ const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, Enum17(ConfigKey).fromValue(tag));
33478
33545
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33479
33546
  const chainTags = context.bitContentProcessor(
33480
33547
  ContentDepth.Chain,
@@ -33508,12 +33575,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
33508
33575
  }
33509
33576
 
33510
33577
  // src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
33578
+ import { Enum as Enum18 } from "@ncoderz/superenum";
33511
33579
  function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
33512
33580
  const { key: tag } = content;
33513
33581
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33514
33582
  const markConfig = target.markConfig;
33515
33583
  if (!markConfig) return;
33516
- const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33584
+ const markTagConfig = instance2.getTagConfigForTag(tagsConfig, Enum18(ConfigKey).fromValue(tag));
33517
33585
  const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
33518
33586
  ContentDepth.Chain,
33519
33587
  markTagConfig?.chain,
@@ -33646,7 +33714,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
33646
33714
  const { value } = content;
33647
33715
  const { key: keyIn } = content;
33648
33716
  const isChain = contentDepth === ContentDepth.Chain;
33649
- const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
33717
+ const propertyConfig = instance2.getTagConfigForTag(tagsConfig, Enum19(PropertyKey).fromValue(keyIn));
33650
33718
  const configKey = propertyConfig ? propertyConfig.configKey : void 0;
33651
33719
  let property = configKeyToPropertyType(keyIn);
33652
33720
  if (configKey === ConfigKey.property_internalComment) {
@@ -33803,12 +33871,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
33803
33871
  }
33804
33872
 
33805
33873
  // src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
33874
+ import { Enum as Enum20 } from "@ncoderz/superenum";
33806
33875
  var resourceBuilder = new ResourceBuilder();
33807
33876
  function buildResources(context, resourceTypeAttachment, resources) {
33808
33877
  const { bitType } = context;
33809
33878
  const filteredResources = [];
33810
33879
  const excessResources = [];
33811
- const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
33880
+ const validatedResourceTypeAttachemnt = Enum20(ResourceType).fromValue(resourceTypeAttachment);
33812
33881
  const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
33813
33882
  const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
33814
33883
  const countsMin = resourcesConfig.getCountsMin();
@@ -33852,9 +33921,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
33852
33921
  const { type: _ignoreType, key, value, chain } = content;
33853
33922
  const resources = target.resources;
33854
33923
  if (!resources) return;
33855
- const configKey = ConfigKey.fromValue(key);
33924
+ const configKey = Enum20(ConfigKey).fromValue(key);
33856
33925
  if (!configKey) return;
33857
- const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33926
+ const resourceType = Enum20(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33858
33927
  const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
33859
33928
  const { posterImage, ...tags2 } = context.bitContentProcessor(
33860
33929
  ContentDepth.Chain,
@@ -34346,14 +34415,14 @@ var BitmarkPegParserProcessor = class {
34346
34415
  );
34347
34416
  bitLevel = instance2.bitLevelMin;
34348
34417
  }
34349
- let textFormat = TextFormat2.fromValue(textFormatAndResourceType.textFormat);
34418
+ let textFormat = Enum21(TextFormat2).fromValue(textFormatAndResourceType.textFormat);
34350
34419
  const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
34351
34420
  if (isInvalidTextFormat) {
34352
34421
  this.addWarning(
34353
34422
  `Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
34354
34423
  );
34355
34424
  }
34356
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
34425
+ const deprecatedTextFormat = Enum21(DeprecatedTextFormat).fromValue(
34357
34426
  textFormatAndResourceType.textFormat
34358
34427
  );
34359
34428
  if (deprecatedTextFormat) {
@@ -34363,7 +34432,7 @@ var BitmarkPegParserProcessor = class {
34363
34432
  );
34364
34433
  }
34365
34434
  textFormat = textFormat ?? bitConfig.textFormatDefault;
34366
- const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
34435
+ const resourceType = Enum21(ResourceType).fromValue(textFormatAndResourceType.resourceType);
34367
34436
  if (textFormatAndResourceType.resourceType && !resourceType) {
34368
34437
  this.addWarning(
34369
34438
  `Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
@@ -34617,6 +34686,13 @@ var BitmarkPegParserProcessor = class {
34617
34686
  if (l > 2) result.pageNumber = result.itemLead[2];
34618
34687
  if (l > 3) result.marginNumber = result.itemLead[l - 1];
34619
34688
  }
34689
+ if (result.__itemLeadString) {
34690
+ const l = result.__itemLeadString.length;
34691
+ if (l > 0) result.__itemString = result.__itemLeadString[0];
34692
+ if (l > 1) result.__leadString = result.__itemLeadString[1];
34693
+ if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
34694
+ if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
34695
+ }
34620
34696
  if (inBit) {
34621
34697
  result.body = instance11.process(
34622
34698
  this.context,
@@ -38158,7 +38234,7 @@ var BitmarkParser = class {
38158
38234
  };
38159
38235
 
38160
38236
  // src/BitmarkParserGenerator.ts
38161
- var Input = superenum30({
38237
+ var Input = {
38162
38238
  /**
38163
38239
  * Input is as a string
38164
38240
  */
@@ -38167,8 +38243,8 @@ var Input = superenum30({
38167
38243
  * Input is as a file path
38168
38244
  */
38169
38245
  file: "file"
38170
- });
38171
- var Output = superenum30({
38246
+ };
38247
+ var Output = {
38172
38248
  /**
38173
38249
  * Output bitmark string
38174
38250
  */
@@ -38181,7 +38257,7 @@ var Output = superenum30({
38181
38257
  * Output AST as a plain JS object, or a file
38182
38258
  */
38183
38259
  ast: "ast"
38184
- });
38260
+ };
38185
38261
  var BitmarkParserGenerator = class {
38186
38262
  constructor() {
38187
38263
  __publicField(this, "ast", new Ast());
@@ -38566,7 +38642,7 @@ var BitmarkParserGenerator = class {
38566
38642
  const opts = Object.assign({}, options);
38567
38643
  const fileOptions = Object.assign({}, opts.fileOptions);
38568
38644
  const jsonOptions = Object.assign({}, opts.jsonOptions);
38569
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38645
+ const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38570
38646
  const textLocation = opts.textLocation ?? TextLocation.body;
38571
38647
  let inStr = input;
38572
38648
  const inputIsString = typeof input === "string";
@@ -38634,7 +38710,7 @@ var BitmarkParserGenerator = class {
38634
38710
  if (!input) return input;
38635
38711
  const opts = Object.assign({}, options);
38636
38712
  const fileOptions = Object.assign({}, opts.fileOptions);
38637
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38713
+ const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38638
38714
  const textLocation = opts.textLocation ?? TextLocation.body;
38639
38715
  let inStr = input;
38640
38716
  const inputIsString = typeof input === "string";
@@ -38687,7 +38763,7 @@ var BitmarkParserGenerator = class {
38687
38763
  if (!input) return input;
38688
38764
  const opts = Object.assign({}, options);
38689
38765
  const fileOptions = Object.assign({}, opts.fileOptions);
38690
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38766
+ const textFormat = Enum22(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
38691
38767
  const textLocation = opts.textLocation ?? TextLocation.body;
38692
38768
  let inStr = input;
38693
38769
  const inputIsString = typeof input === "string";