@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.
package/dist/index.js CHANGED
@@ -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 TextFormat = superenum6({
687
+ import "@ncoderz/superenum";
688
+ var TextFormat = {
685
689
  // plain text
686
690
  plainText: "text",
687
691
  latex: "latex",
@@ -693,11 +697,11 @@ var TextFormat = 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 TextLocation = superenum21({
11433
+ import "@ncoderz/superenum";
11434
+ var TextLocation = {
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 Breakscape2 = class {
11682
11698
  var instance3 = new Breakscape2();
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 = TextFormat.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
23638
+ const deprecatedTextFormat = Enum7(DeprecatedTextFormat).fromValue(data.textFormat);
23639
+ let textFormat = Enum7(TextFormat).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
23621
23640
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
23622
23641
  textFormat = TextFormat.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, TextLocation.tag, data.item),
24987
+ item: data.item ?? "",
24969
24988
  lead: this.handleJsonText(context, TextLocation.tag, data.lead),
24970
24989
  hint: this.handleJsonText(context, TextLocation.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 Enum23 } 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, TextFormat.plainText, TextLocation.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 = TextFormat.fromValue(bitsValue) === textFormatDefault;
28915
+ const isDefault = Enum8(TextFormat).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 TextFormat.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
29801
+ return Enum9(TextFormat).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 = TextFormat.fromValue(bit.format) ?? bitConfig.textFormatDefault;
30515
+ const deprecatedTextFormat = Enum11(DeprecatedTextFormat).fromValue(bit.format);
30516
+ let _textFormat = Enum11(TextFormat).fromValue(bit.format) ?? bitConfig.textFormatDefault;
30483
30517
  if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
30484
30518
  _textFormat = TextFormat.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 ENABLE_DEBUG = true;
30755
30790
  var DEBUG_DATA = true;
30756
30791
  var DEBUG_DATA_INCLUDE_PARSER = false;
@@ -30844,7 +30879,7 @@ var BitmarkPegParserHelper = class {
30844
30879
  if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
30845
30880
  return {
30846
30881
  type,
30847
- key: Tag.fromValue(type),
30882
+ key: Enum12(Tag).fromValue(type),
30848
30883
  value,
30849
30884
  parser: {
30850
30885
  text: this.parserText(),
@@ -31239,7 +31274,7 @@ var BitmarkPegParserHelper = class {
31239
31274
  if (!value) return false;
31240
31275
  const { type } = value;
31241
31276
  if (!validType) {
31242
- return !!TypeKey.fromValue(type);
31277
+ return !!Enum12(TypeKey).fromValue(type);
31243
31278
  }
31244
31279
  if (Array.isArray(validType)) {
31245
31280
  return validType.indexOf(type) >= 0;
@@ -31323,7 +31358,11 @@ var BitmarkPegParserHelper = class {
31323
31358
  }
31324
31359
  };
31325
31360
 
31361
+ // src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
31362
+ import { Enum as Enum21 } from "@ncoderz/superenum";
31363
+
31326
31364
  // src/parser/bitmark/peg/BitmarkPegParserValidator.ts
31365
+ import { Enum as Enum13 } from "@ncoderz/superenum";
31327
31366
  var COMMON_MISTAKE_STRINGS = [
31328
31367
  // Card divider errors
31329
31368
  "----",
@@ -31495,7 +31534,7 @@ var BitmarkPegParserValidator = class {
31495
31534
  const content = dataOrNull[i];
31496
31535
  if (!content) continue;
31497
31536
  const { type, key } = content;
31498
- let typeKey = TypeKey.fromValue(type);
31537
+ let typeKey = Enum13(TypeKey).fromValue(type);
31499
31538
  if (!typeKey) continue;
31500
31539
  let validTypeKey = typeKey;
31501
31540
  if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
@@ -31918,7 +31957,7 @@ var BitmarkPegParserValidator = class {
31918
31957
  } else if (tagValidationData.isResource) {
31919
31958
  res.set(v.configKey, tagValidationData);
31920
31959
  } else {
31921
- const typeKey = TypeKey.fromValue(v.tag);
31960
+ const typeKey = Enum13(TypeKey).fromValue(v.tag);
31922
31961
  if (typeKey) {
31923
31962
  res.set(typeKey, tagValidationData);
31924
31963
  }
@@ -32931,12 +32970,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
32931
32970
  for (const card of cardSet.cards) {
32932
32971
  for (const side of card.sides) {
32933
32972
  for (const content of side.variants) {
32934
- const { __instructionString, reaction, cardBodyStr: feedback, ...tags2 } = content.data;
32973
+ const {
32974
+ __instructionString,
32975
+ __itemString,
32976
+ reaction,
32977
+ cardBodyStr: feedback,
32978
+ ...tags2
32979
+ } = content.data;
32935
32980
  const botResponse = {
32936
32981
  response: __instructionString ?? instance3.EMPTY_STRING,
32937
32982
  reaction: reaction ?? instance3.EMPTY_STRING,
32938
32983
  feedback: feedback ?? instance3.EMPTY_STRING,
32939
- ...tags2
32984
+ ...tags2,
32985
+ item: __itemString ?? instance3.EMPTY_STRING
32940
32986
  };
32941
32987
  if (botResponse) botResponses.push(botResponse);
32942
32988
  }
@@ -33172,6 +33218,9 @@ var FooterContentProcessor = class {
33172
33218
  };
33173
33219
  var instance12 = new FooterContentProcessor();
33174
33220
 
33221
+ // src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
33222
+ import { Enum as Enum14 } from "@ncoderz/superenum";
33223
+
33175
33224
  // src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
33176
33225
  var textParser4 = new TextParser();
33177
33226
  function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
@@ -33207,7 +33256,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
33207
33256
  }
33208
33257
  function buildGap(context, _contentDepth, tagsConfig, content) {
33209
33258
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
33210
- const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33259
+ const gapConfig = instance2.getTagConfigForTag(tagsConfig, Enum14(Tag).fromValue(content.type));
33211
33260
  const chainContent = [content, ...content.chain ?? []];
33212
33261
  const chainTags = context.bitContentProcessor(
33213
33262
  ContentDepth.Chain,
@@ -33222,6 +33271,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
33222
33271
  return gap;
33223
33272
  }
33224
33273
 
33274
+ // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
33275
+ import { Enum as Enum15 } from "@ncoderz/superenum";
33276
+
33225
33277
  // src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
33226
33278
  function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
33227
33279
  const { textFormat } = context;
@@ -33234,6 +33286,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
33234
33286
  location: TextLocation.tag
33235
33287
  });
33236
33288
  target.itemLead.push(text);
33289
+ if (!target.__itemLeadString) target.__itemLeadString = [];
33290
+ target.__itemLeadString.push(
33291
+ instance3.unbreakscape(trimmedStringValue, {
33292
+ format: TextFormat.bitmarkText,
33293
+ location: TextLocation.tag
33294
+ })
33295
+ );
33237
33296
  }
33238
33297
 
33239
33298
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
@@ -33246,7 +33305,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
33246
33305
  }
33247
33306
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33248
33307
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
33249
- const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33308
+ const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum15(Tag).fromValue(content.type));
33250
33309
  const chainContent = [content, ...content.chain ?? []];
33251
33310
  const chainTags = context.bitContentProcessor(
33252
33311
  ContentDepth.Chain,
@@ -33255,8 +33314,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
33255
33314
  );
33256
33315
  if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
33257
33316
  target.itemLead = chainTags.itemLead;
33317
+ target.__itemLeadString = chainTags.__itemLeadString;
33258
33318
  }
33259
33319
 
33320
+ // src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
33321
+ import { Enum as Enum16 } from "@ncoderz/superenum";
33322
+
33260
33323
  // src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
33261
33324
  function markTagContentProcessor(_context, _contentDepth, content, target) {
33262
33325
  const { value } = content;
@@ -33281,7 +33344,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
33281
33344
  }
33282
33345
  function buildMark(context, _contentDepth, tagsConfig, content) {
33283
33346
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33284
- const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
33347
+ const markConfig = instance2.getTagConfigForTag(tagsConfig, Enum16(Tag).fromValue(content.type));
33285
33348
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33286
33349
  const chainTags = context.bitContentProcessor(
33287
33350
  ContentDepth.Chain,
@@ -33300,6 +33363,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
33300
33363
  return mark;
33301
33364
  }
33302
33365
 
33366
+ // src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
33367
+ import { Enum as Enum19 } from "@ncoderz/superenum";
33368
+
33303
33369
  // src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
33304
33370
  function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33305
33371
  if (contentDepth === ContentDepth.Chain) {
@@ -33474,6 +33540,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
33474
33540
  }
33475
33541
 
33476
33542
  // src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
33543
+ import { Enum as Enum17 } from "@ncoderz/superenum";
33477
33544
  function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
33478
33545
  if (contentDepth === ContentDepth.Chain) {
33479
33546
  imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -33492,7 +33559,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
33492
33559
  function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
33493
33560
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
33494
33561
  const { key: tag } = content;
33495
- const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33562
+ const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, Enum17(ConfigKey).fromValue(tag));
33496
33563
  const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
33497
33564
  const chainTags = context.bitContentProcessor(
33498
33565
  ContentDepth.Chain,
@@ -33526,12 +33593,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
33526
33593
  }
33527
33594
 
33528
33595
  // src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
33596
+ import { Enum as Enum18 } from "@ncoderz/superenum";
33529
33597
  function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
33530
33598
  const { key: tag } = content;
33531
33599
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
33532
33600
  const markConfig = target.markConfig;
33533
33601
  if (!markConfig) return;
33534
- const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
33602
+ const markTagConfig = instance2.getTagConfigForTag(tagsConfig, Enum18(ConfigKey).fromValue(tag));
33535
33603
  const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
33536
33604
  ContentDepth.Chain,
33537
33605
  markTagConfig?.chain,
@@ -33664,7 +33732,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
33664
33732
  const { value } = content;
33665
33733
  const { key: keyIn } = content;
33666
33734
  const isChain = contentDepth === ContentDepth.Chain;
33667
- const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
33735
+ const propertyConfig = instance2.getTagConfigForTag(tagsConfig, Enum19(PropertyKey).fromValue(keyIn));
33668
33736
  const configKey = propertyConfig ? propertyConfig.configKey : void 0;
33669
33737
  let property = configKeyToPropertyType(keyIn);
33670
33738
  if (configKey === ConfigKey.property_internalComment) {
@@ -33821,12 +33889,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
33821
33889
  }
33822
33890
 
33823
33891
  // src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
33892
+ import { Enum as Enum20 } from "@ncoderz/superenum";
33824
33893
  var resourceBuilder = new ResourceBuilder();
33825
33894
  function buildResources(context, resourceTypeAttachment, resources) {
33826
33895
  const { bitType } = context;
33827
33896
  const filteredResources = [];
33828
33897
  const excessResources = [];
33829
- const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
33898
+ const validatedResourceTypeAttachemnt = Enum20(ResourceType).fromValue(resourceTypeAttachment);
33830
33899
  const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
33831
33900
  const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
33832
33901
  const countsMin = resourcesConfig.getCountsMin();
@@ -33870,9 +33939,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
33870
33939
  const { type: _ignoreType, key, value, chain } = content;
33871
33940
  const resources = target.resources;
33872
33941
  if (!resources) return;
33873
- const configKey = ConfigKey.fromValue(key);
33942
+ const configKey = Enum20(ConfigKey).fromValue(key);
33874
33943
  if (!configKey) return;
33875
- const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33944
+ const resourceType = Enum20(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
33876
33945
  const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
33877
33946
  const { posterImage, ...tags2 } = context.bitContentProcessor(
33878
33947
  ContentDepth.Chain,
@@ -34368,14 +34437,14 @@ var BitmarkPegParserProcessor = class {
34368
34437
  );
34369
34438
  bitLevel = instance2.bitLevelMin;
34370
34439
  }
34371
- let textFormat = TextFormat.fromValue(textFormatAndResourceType.textFormat);
34440
+ let textFormat = Enum21(TextFormat).fromValue(textFormatAndResourceType.textFormat);
34372
34441
  const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
34373
34442
  if (isInvalidTextFormat) {
34374
34443
  this.addWarning(
34375
34444
  `Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
34376
34445
  );
34377
34446
  }
34378
- const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
34447
+ const deprecatedTextFormat = Enum21(DeprecatedTextFormat).fromValue(
34379
34448
  textFormatAndResourceType.textFormat
34380
34449
  );
34381
34450
  if (deprecatedTextFormat) {
@@ -34385,7 +34454,7 @@ var BitmarkPegParserProcessor = class {
34385
34454
  );
34386
34455
  }
34387
34456
  textFormat = textFormat ?? bitConfig.textFormatDefault;
34388
- const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
34457
+ const resourceType = Enum21(ResourceType).fromValue(textFormatAndResourceType.resourceType);
34389
34458
  if (textFormatAndResourceType.resourceType && !resourceType) {
34390
34459
  this.addWarning(
34391
34460
  `Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
@@ -34639,6 +34708,13 @@ var BitmarkPegParserProcessor = class {
34639
34708
  if (l > 2) result.pageNumber = result.itemLead[2];
34640
34709
  if (l > 3) result.marginNumber = result.itemLead[l - 1];
34641
34710
  }
34711
+ if (result.__itemLeadString) {
34712
+ const l = result.__itemLeadString.length;
34713
+ if (l > 0) result.__itemString = result.__itemLeadString[0];
34714
+ if (l > 1) result.__leadString = result.__itemLeadString[1];
34715
+ if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
34716
+ if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
34717
+ }
34642
34718
  if (inBit) {
34643
34719
  result.body = instance11.process(
34644
34720
  this.context,
@@ -38527,6 +38603,7 @@ var JsonFileGenerator = class {
38527
38603
 
38528
38604
  // src/info/ConfigBuilder.ts
38529
38605
  import path3 from "path";
38606
+ import { Enum as Enum22 } from "@ncoderz/superenum";
38530
38607
  import fs3 from "fs-extra";
38531
38608
  var ConfigBuilder = class {
38532
38609
  build(options) {
@@ -38536,7 +38613,7 @@ var ConfigBuilder = class {
38536
38613
  const groupConfigs = [];
38537
38614
  const bitGroupConfigKeys = [];
38538
38615
  const bitGroupConfigs = [];
38539
- for (const bt of BitType.values()) {
38616
+ for (const bt of Enum22(BitType).values()) {
38540
38617
  const bitType = instance2.getBitType(bt);
38541
38618
  const _bitConfig = BITS[bitType];
38542
38619
  if (_bitConfig) {
@@ -38818,7 +38895,7 @@ var ConfigBuilder = class {
38818
38895
  buildFlat(options) {
38819
38896
  const opts = Object.assign({}, options);
38820
38897
  const bitConfigs = [];
38821
- for (const bt of BitType.values()) {
38898
+ for (const bt of Enum22(BitType).values()) {
38822
38899
  const bitType = instance2.getBitType(bt);
38823
38900
  const bitConfig = instance2.getBitConfig(bitType);
38824
38901
  if (bitConfig) bitConfigs.push(bitConfig);
@@ -38929,7 +39006,7 @@ var ConfigBuilder = class {
38929
39006
  };
38930
39007
 
38931
39008
  // src/BitmarkParserGenerator.ts
38932
- var Input = superenum30({
39009
+ var Input = {
38933
39010
  /**
38934
39011
  * Input is as a string
38935
39012
  */
@@ -38938,8 +39015,8 @@ var Input = superenum30({
38938
39015
  * Input is as a file path
38939
39016
  */
38940
39017
  file: "file"
38941
- });
38942
- var Output = superenum30({
39018
+ };
39019
+ var Output = {
38943
39020
  /**
38944
39021
  * Output bitmark string
38945
39022
  */
@@ -38952,7 +39029,7 @@ var Output = superenum30({
38952
39029
  * Output AST as a plain JS object, or a file
38953
39030
  */
38954
39031
  ast: "ast"
38955
- });
39032
+ };
38956
39033
  var BitmarkParserGenerator = class {
38957
39034
  constructor() {
38958
39035
  __publicField(this, "ast", new Ast());
@@ -39337,7 +39414,7 @@ var BitmarkParserGenerator = class {
39337
39414
  const opts = Object.assign({}, options);
39338
39415
  const fileOptions = Object.assign({}, opts.fileOptions);
39339
39416
  const jsonOptions = Object.assign({}, opts.jsonOptions);
39340
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39417
+ const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39341
39418
  const textLocation = opts.textLocation ?? TextLocation.body;
39342
39419
  let inStr = input;
39343
39420
  const inputIsString = typeof input === "string";
@@ -39405,7 +39482,7 @@ var BitmarkParserGenerator = class {
39405
39482
  if (!input) return input;
39406
39483
  const opts = Object.assign({}, options);
39407
39484
  const fileOptions = Object.assign({}, opts.fileOptions);
39408
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39485
+ const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39409
39486
  const textLocation = opts.textLocation ?? TextLocation.body;
39410
39487
  let inStr = input;
39411
39488
  const inputIsString = typeof input === "string";
@@ -39458,7 +39535,7 @@ var BitmarkParserGenerator = class {
39458
39535
  if (!input) return input;
39459
39536
  const opts = Object.assign({}, options);
39460
39537
  const fileOptions = Object.assign({}, opts.fileOptions);
39461
- const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39538
+ const textFormat = Enum23(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
39462
39539
  const textLocation = opts.textLocation ?? TextLocation.body;
39463
39540
  let inStr = input;
39464
39541
  const inputIsString = typeof input === "string";