@jentic/arazzo-parser 1.0.0-alpha.14 → 1.0.0-alpha.16

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.
@@ -1748,6 +1748,7 @@ const predicates = {
1748
1748
  isCommentElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isCommentElement,
1749
1749
  isParseResultElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement,
1750
1750
  isSourceMapElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isSourceMapElement,
1751
+ hasElementStyle: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementStyle,
1751
1752
  hasElementSourceMap: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap,
1752
1753
  includesSymbols: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesSymbols,
1753
1754
  includesClasses: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses
@@ -1819,7 +1820,19 @@ const resolveSpecification = specification => {
1819
1820
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val) && (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])('$ref', val) && (0,ramda__WEBPACK_IMPORTED_MODULE_3__["default"])(ramda_adjunct__WEBPACK_IMPORTED_MODULE_4__["default"], '$ref', val)) {
1820
1821
  const $ref = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(['$ref'], val);
1821
1822
  const pointer = (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"])('#/', $ref);
1822
- return (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
1823
+ const resolved = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
1824
+ // merge extra properties (e.g. alias) from the $ref object into the resolved value
1825
+ const {
1826
+ $ref: _,
1827
+ ...rest
1828
+ } = val;
1829
+ if (Object.keys(rest).length > 0 && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(resolved)) {
1830
+ return {
1831
+ ...resolved,
1832
+ ...rest
1833
+ };
1834
+ }
1835
+ return resolved;
1823
1836
  }
1824
1837
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val)) {
1825
1838
  return traverse(val, root, newPath);
@@ -2442,20 +2455,22 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
2442
2455
  "use strict";
2443
2456
  __webpack_require__.r(__webpack_exports__);
2444
2457
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2445
- /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
2446
- /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]),
2447
- /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
2458
+ /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
2459
+ /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
2460
+ /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
2448
2461
  /* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
2449
2462
  /* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
2450
2463
  /* harmony export */ });
2451
- /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61009);
2452
- /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80084);
2453
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25035);
2454
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62823);
2455
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6361);
2456
- /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(93399);
2457
- /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(67177);
2458
- /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(18301);
2464
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
2465
+ /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(61009);
2466
+ /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80084);
2467
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25035);
2468
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(62823);
2469
+ /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6361);
2470
+ /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(93399);
2471
+ /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(67177);
2472
+ /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(18301);
2473
+
2459
2474
 
2460
2475
 
2461
2476
 
@@ -2488,9 +2503,9 @@ const cloneDeepElement = (element, options) => {
2488
2503
  } = element;
2489
2504
  if (Array.isArray(content)) {
2490
2505
  copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
2491
- } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
2506
+ } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
2492
2507
  copy.content = cloneDeepElement(content, passThroughOptions);
2493
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2508
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
2494
2509
  copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
2495
2510
  } else {
2496
2511
  copy.content = content;
@@ -2514,7 +2529,7 @@ const cloneDeepKeyValuePair = (kvp, options) => {
2514
2529
  } = kvp;
2515
2530
  const keyCopy = key !== undefined ? cloneDeepElement(key, passThroughOptions) : undefined;
2516
2531
  const valueCopy = value !== undefined ? cloneDeepElement(value, passThroughOptions) : undefined;
2517
- const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](keyCopy, valueCopy);
2532
+ const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](keyCopy, valueCopy);
2518
2533
  visited.set(kvp, copy);
2519
2534
  return copy;
2520
2535
  };
@@ -2530,7 +2545,7 @@ const cloneDeepObjectSlice = (slice, options) => {
2530
2545
  return visited.get(slice);
2531
2546
  }
2532
2547
  const items = [...slice].map(element => cloneDeepElement(element, passThroughOptions));
2533
- const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
2548
+ const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
2534
2549
  visited.set(slice, copy);
2535
2550
  return copy;
2536
2551
  };
@@ -2541,16 +2556,16 @@ const cloneDeepObjectSlice = (slice, options) => {
2541
2556
  * @public
2542
2557
  */
2543
2558
  const cloneDeep = (value, options = {}) => {
2544
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2559
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
2545
2560
  return cloneDeepKeyValuePair(value, options);
2546
2561
  }
2547
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
2562
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2548
2563
  return cloneDeepObjectSlice(value, options);
2549
2564
  }
2550
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
2565
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
2551
2566
  return cloneDeepElement(value, options);
2552
2567
  }
2553
- throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]("Value provided to cloneDeep function couldn't be cloned", {
2568
+ throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
2554
2569
  value
2555
2570
  });
2556
2571
  };
@@ -2566,11 +2581,11 @@ const cloneShallowKeyValuePair = keyValuePair => {
2566
2581
  key,
2567
2582
  value
2568
2583
  } = keyValuePair;
2569
- return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](key, value);
2584
+ return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](key, value);
2570
2585
  };
2571
2586
  const cloneShallowObjectSlice = objectSlice => {
2572
2587
  const items = [...objectSlice];
2573
- return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
2588
+ return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
2574
2589
  };
2575
2590
  const cloneShallowElement = element => {
2576
2591
  const Ctor = element.constructor;
@@ -2582,17 +2597,20 @@ const cloneShallowElement = element => {
2582
2597
  if (!element.isAttributesEmpty) {
2583
2598
  copy.attributes = cloneDeep(element.attributes);
2584
2599
  }
2585
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap)(element)) {
2586
- _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"].transfer(element, copy);
2600
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
2601
+ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
2602
+ }
2603
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
2604
+ copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
2587
2605
  }
2588
2606
  const {
2589
2607
  content
2590
2608
  } = element;
2591
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
2609
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
2592
2610
  copy.content = cloneShallowElement(content);
2593
2611
  } else if (Array.isArray(content)) {
2594
2612
  copy.content = [...content];
2595
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2613
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
2596
2614
  copy.content = cloneShallowKeyValuePair(content);
2597
2615
  } else {
2598
2616
  copy.content = content;
@@ -2607,16 +2625,16 @@ const cloneShallowElement = element => {
2607
2625
  * @public
2608
2626
  */
2609
2627
  const cloneShallow = value => {
2610
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2628
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
2611
2629
  return cloneShallowKeyValuePair(value);
2612
2630
  }
2613
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
2631
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
2614
2632
  return cloneShallowObjectSlice(value);
2615
2633
  }
2616
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
2634
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
2617
2635
  return cloneShallowElement(value);
2618
2636
  }
2619
- throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneShallow function couldn't be cloned", {
2637
+ throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
2620
2638
  value
2621
2639
  });
2622
2640
  };
@@ -3043,6 +3061,66 @@ function unpackSourceMap(packed) {
3043
3061
 
3044
3062
  /***/ },
3045
3063
 
3064
+ /***/ 41821
3065
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3066
+
3067
+ "use strict";
3068
+ __webpack_require__.r(__webpack_exports__);
3069
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3070
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
3071
+ /* harmony export */ });
3072
+ /* harmony import */ var _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32420);
3073
+
3074
+ /**
3075
+ * Shape with optional style property.
3076
+ * @public
3077
+ */
3078
+ /**
3079
+ * StyleElement stores format-specific style information for round-trip preservation.
3080
+ *
3081
+ * The style data is stored as a plain object with format-specific namespaces
3082
+ * (e.g., `yaml`, `json`). This element exists only during serialization/deserialization
3083
+ * (refract format) - in memory, style lives directly on `element.style`.
3084
+ *
3085
+ * Follows the same pattern as SourceMapElement with __mappings__.
3086
+ *
3087
+ * @public
3088
+ */
3089
+ class StyleElement extends _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
3090
+ constructor(content, meta, attributes) {
3091
+ super(content, meta, attributes);
3092
+ this.element = '__styles__';
3093
+ }
3094
+
3095
+ /**
3096
+ * Transfers style property from one element to another.
3097
+ */
3098
+ static transfer(from, to) {
3099
+ to.style = from.style;
3100
+ }
3101
+
3102
+ /**
3103
+ * Creates a StyleElement from an element's style property.
3104
+ * Returns undefined if the element has no style.
3105
+ */
3106
+ static from(source) {
3107
+ if (!source.style) {
3108
+ return undefined;
3109
+ }
3110
+ return new StyleElement(source.style);
3111
+ }
3112
+
3113
+ /**
3114
+ * Restores the style property on the target element from this StyleElement.
3115
+ */
3116
+ applyTo(target) {
3117
+ target.style = this.toValue();
3118
+ }
3119
+ }
3120
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleElement);
3121
+
3122
+ /***/ },
3123
+
3046
3124
  /***/ 74918
3047
3125
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3048
3126
 
@@ -3107,6 +3185,7 @@ const isSourceMapElement = element => element instanceof _elements_SourceMap_mjs
3107
3185
  __webpack_require__.r(__webpack_exports__);
3108
3186
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3109
3187
  /* harmony export */ hasElementSourceMap: () => (/* binding */ hasElementSourceMap),
3188
+ /* harmony export */ hasElementStyle: () => (/* binding */ hasElementStyle),
3110
3189
  /* harmony export */ includesClasses: () => (/* binding */ includesClasses),
3111
3190
  /* harmony export */ includesSymbols: () => (/* binding */ includesSymbols),
3112
3191
  /* harmony export */ isAnnotationElement: () => (/* reexport safe */ _elements_mjs__WEBPACK_IMPORTED_MODULE_1__.isAnnotationElement),
@@ -3131,6 +3210,14 @@ __webpack_require__.r(__webpack_exports__);
3131
3210
 
3132
3211
 
3133
3212
 
3213
+ /**
3214
+ * Checks if an element has format-specific style information.
3215
+ * @public
3216
+ */
3217
+ const hasElementStyle = element => {
3218
+ return element.style !== undefined;
3219
+ };
3220
+
3134
3221
  /**
3135
3222
  * Checks if an element has complete source position information.
3136
3223
  * Returns true only if all 6 position properties are numbers.
@@ -3672,6 +3759,12 @@ class Element {
3672
3759
  */
3673
3760
  parent;
3674
3761
 
3762
+ /**
3763
+ * Format-specific style information for round-trip preservation.
3764
+ * Each format owns its own namespace (e.g., `yaml`, `json`).
3765
+ */
3766
+ style;
3767
+
3675
3768
  // ============================================================================
3676
3769
  // Source Position (LSP-compatible, TextDocument-compatible, UTF-16 code units)
3677
3770
  // web-tree-sitter automatically provides position data in UTF-16 code units.
@@ -4561,17 +4654,18 @@ __webpack_require__.r(__webpack_exports__);
4561
4654
  /* harmony export */ CollectionElement: () => (/* reexport safe */ _primitives_CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
4562
4655
  /* harmony export */ CommentElement: () => (/* reexport safe */ _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]),
4563
4656
  /* harmony export */ Element: () => (/* reexport safe */ _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
4564
- /* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
4657
+ /* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__["default"]),
4565
4658
  /* harmony export */ LinkElement: () => (/* reexport safe */ _elements_LinkElement_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
4566
4659
  /* harmony export */ MemberElement: () => (/* reexport safe */ _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
4567
4660
  /* harmony export */ NullElement: () => (/* reexport safe */ _primitives_NullElement_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
4568
4661
  /* harmony export */ NumberElement: () => (/* reexport safe */ _primitives_NumberElement_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
4569
4662
  /* harmony export */ ObjectElement: () => (/* reexport safe */ _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
4570
- /* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
4663
+ /* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
4571
4664
  /* harmony export */ ParseResultElement: () => (/* reexport safe */ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]),
4572
4665
  /* harmony export */ RefElement: () => (/* reexport safe */ _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]),
4573
4666
  /* harmony export */ SourceMapElement: () => (/* reexport safe */ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]),
4574
4667
  /* harmony export */ StringElement: () => (/* reexport safe */ _primitives_StringElement_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
4668
+ /* harmony export */ StyleElement: () => (/* reexport safe */ _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
4575
4669
  /* harmony export */ refract: () => (/* binding */ refract)
4576
4670
  /* harmony export */ });
4577
4671
  /* harmony import */ var _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38335);
@@ -4589,8 +4683,10 @@ __webpack_require__.r(__webpack_exports__);
4589
4683
  /* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(77093);
4590
4684
  /* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(52728);
4591
4685
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(6361);
4592
- /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(61009);
4593
- /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(80084);
4686
+ /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(41821);
4687
+ /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(61009);
4688
+ /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(80084);
4689
+
4594
4690
 
4595
4691
 
4596
4692
 
@@ -4677,6 +4773,8 @@ __webpack_require__.r(__webpack_exports__);
4677
4773
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
4678
4774
  /* harmony export */ });
4679
4775
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6361);
4776
+ /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41821);
4777
+
4680
4778
 
4681
4779
  /**
4682
4780
  * Serialized representation of an Element in JSON Refract format.
@@ -4735,6 +4833,17 @@ class JSONSerialiser {
4735
4833
  payload.meta.__mappings__ = this.serialise(sourceMap);
4736
4834
  }
4737
4835
  }
4836
+
4837
+ // Serialize style as __styles__ in meta (skip for StyleElement itself)
4838
+ if (!(element instanceof _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])) {
4839
+ const styleElement = _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].from(element);
4840
+ if (styleElement) {
4841
+ if (!payload.meta) {
4842
+ payload.meta = {};
4843
+ }
4844
+ payload.meta.__styles__ = this.serialise(styleElement);
4845
+ }
4846
+ }
4738
4847
  const content = this.serialiseContent(element.content);
4739
4848
  if (content !== undefined) {
4740
4849
  payload.content = content;
@@ -4755,15 +4864,18 @@ class JSONSerialiser {
4755
4864
  element.element = value.element;
4756
4865
  }
4757
4866
 
4758
- // Extract __mappings__ without mutating input, filter remaining meta
4867
+ // Extract __mappings__ and __styles__ without mutating input, filter remaining meta
4759
4868
  let mappingsDoc;
4869
+ let stylesDoc;
4760
4870
  let metaToDeserialize = value.meta;
4761
- if (value.meta?.__mappings__) {
4871
+ if (value.meta?.__mappings__ || value.meta?.__styles__) {
4762
4872
  const {
4763
4873
  __mappings__,
4874
+ __styles__,
4764
4875
  ...rest
4765
4876
  } = value.meta;
4766
4877
  mappingsDoc = __mappings__;
4878
+ stylesDoc = __styles__;
4767
4879
  metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
4768
4880
  }
4769
4881
  if (metaToDeserialize) {
@@ -4775,6 +4887,12 @@ class JSONSerialiser {
4775
4887
  const sourceMap = this.deserialise(mappingsDoc);
4776
4888
  sourceMap.applyTo(element);
4777
4889
  }
4890
+
4891
+ // Restore style from __styles__
4892
+ if (stylesDoc) {
4893
+ const styleElement = this.deserialise(stylesDoc);
4894
+ styleElement.applyTo(element);
4895
+ }
4778
4896
  if (value.attributes) {
4779
4897
  this.deserialiseObject(value.attributes, element.attributes);
4780
4898
  }
@@ -7473,6 +7591,7 @@ __webpack_require__.r(__webpack_exports__);
7473
7591
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80151);
7474
7592
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32420);
7475
7593
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6361);
7594
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41821);
7476
7595
 
7477
7596
 
7478
7597
 
@@ -7500,6 +7619,7 @@ class Visitor {
7500
7619
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
7501
7620
  }
7502
7621
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
7622
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
7503
7623
  }
7504
7624
  }
7505
7625
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -10996,7 +11116,7 @@ const specification = {
10996
11116
  fixedFields: {
10997
11117
  // core vocabulary
10998
11118
  id: {
10999
- $visitor: _visitors_FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_0__["default"],
11119
+ $ref: '#/visitors/value',
11000
11120
  alias: 'idField'
11001
11121
  },
11002
11122
  $schema: {
@@ -11278,6 +11398,7 @@ __webpack_require__.r(__webpack_exports__);
11278
11398
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80151);
11279
11399
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32420);
11280
11400
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6361);
11401
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41821);
11281
11402
 
11282
11403
 
11283
11404
 
@@ -11305,6 +11426,7 @@ class Visitor {
11305
11426
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
11306
11427
  }
11307
11428
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
11429
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
11308
11430
  }
11309
11431
  }
11310
11432
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -16707,6 +16829,7 @@ __webpack_require__.r(__webpack_exports__);
16707
16829
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80151);
16708
16830
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32420);
16709
16831
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6361);
16832
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41821);
16710
16833
 
16711
16834
 
16712
16835
 
@@ -16734,6 +16857,7 @@ class Visitor {
16734
16857
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
16735
16858
  }
16736
16859
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
16860
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
16737
16861
  }
16738
16862
  }
16739
16863
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -18952,10 +19076,10 @@ class Encoding extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__["
18952
19076
  set headers(headers) {
18953
19077
  this.set('headers', headers);
18954
19078
  }
18955
- get style() {
19079
+ get styleField() {
18956
19080
  return this.get('style');
18957
19081
  }
18958
- set style(style) {
19082
+ set styleField(style) {
18959
19083
  this.set('style', style);
18960
19084
  }
18961
19085
  get explode() {
@@ -19102,10 +19226,10 @@ class Header extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__["de
19102
19226
  set allowEmptyValue(allowEmptyValue) {
19103
19227
  this.set('allowEmptyValue', allowEmptyValue);
19104
19228
  }
19105
- get style() {
19229
+ get styleField() {
19106
19230
  return this.get('style');
19107
19231
  }
19108
- set style(style) {
19232
+ set styleField(style) {
19109
19233
  this.set('style', style);
19110
19234
  }
19111
19235
  get explode() {
@@ -19721,10 +19845,10 @@ class Parameter extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__[
19721
19845
  set allowEmptyValue(allowEmptyValue) {
19722
19846
  this.set('allowEmptyValue', allowEmptyValue);
19723
19847
  }
19724
- get style() {
19848
+ get styleField() {
19725
19849
  return this.get('style');
19726
19850
  }
19727
- set style(style) {
19851
+ set styleField(style) {
19728
19852
  this.set('style', style);
19729
19853
  }
19730
19854
  get explode() {
@@ -22592,7 +22716,8 @@ const specification = {
22592
22716
  $ref: '#/visitors/value'
22593
22717
  },
22594
22718
  style: {
22595
- $ref: '#/visitors/value'
22719
+ $ref: '#/visitors/value',
22720
+ alias: 'styleField'
22596
22721
  },
22597
22722
  explode: {
22598
22723
  $ref: '#/visitors/value'
@@ -22648,7 +22773,8 @@ const specification = {
22648
22773
  },
22649
22774
  headers: _visitors_open_api_3_0_encoding_HeadersVisitor_mjs__WEBPACK_IMPORTED_MODULE_60__["default"],
22650
22775
  style: {
22651
- $ref: '#/visitors/value'
22776
+ $ref: '#/visitors/value',
22777
+ alias: 'styleField'
22652
22778
  },
22653
22779
  explode: {
22654
22780
  $ref: '#/visitors/value'
@@ -22738,7 +22864,8 @@ const specification = {
22738
22864
  $ref: '#/visitors/value'
22739
22865
  },
22740
22866
  style: {
22741
- $ref: '#/visitors/value'
22867
+ $ref: '#/visitors/value',
22868
+ alias: 'styleField'
22742
22869
  },
22743
22870
  explode: {
22744
22871
  $ref: '#/visitors/value'
@@ -23160,6 +23287,7 @@ __webpack_require__.r(__webpack_exports__);
23160
23287
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80151);
23161
23288
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32420);
23162
23289
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6361);
23290
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41821);
23163
23291
 
23164
23292
 
23165
23293
 
@@ -23187,6 +23315,7 @@ class Visitor {
23187
23315
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
23188
23316
  }
23189
23317
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
23318
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
23190
23319
  }
23191
23320
  }
23192
23321
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -34778,16 +34907,21 @@ const detect = async (source, {
34778
34907
  */
34779
34908
  const parse = async (source, {
34780
34909
  sourceMap = false,
34910
+ style = false,
34781
34911
  strict = false
34782
34912
  } = {}) => {
34783
34913
  if (strict && sourceMap) {
34784
34914
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
34785
34915
  }
34916
+ if (strict && style) {
34917
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
34918
+ }
34786
34919
  if (strict) {
34787
34920
  return _native_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
34788
34921
  }
34789
34922
  return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
34790
- sourceMap
34923
+ sourceMap,
34924
+ style
34791
34925
  });
34792
34926
  };
34793
34927
 
@@ -34918,12 +35052,14 @@ const detect = async source => {
34918
35052
  * @public
34919
35053
  */
34920
35054
  const parse = async (source, {
34921
- sourceMap = false
35055
+ sourceMap = false,
35056
+ style = false
34922
35057
  } = {}) => {
34923
35058
  const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
34924
35059
  try {
34925
35060
  return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
34926
- sourceMap
35061
+ sourceMap,
35062
+ style
34927
35063
  });
34928
35064
  } finally {
34929
35065
  cst.delete();
@@ -35026,6 +35162,24 @@ const maybeAddSourceMap = (info, element, ctx) => {
35026
35162
  element.endCharacter = info.endPosition.column;
35027
35163
  element.endOffset = info.endIndex;
35028
35164
  };
35165
+
35166
+ // build json style object for an element
35167
+ const buildJsonStyle = (ctx, extras) => {
35168
+ const jsonStyle = {
35169
+ indent: ctx.indent
35170
+ };
35171
+ if (extras) Object.assign(jsonStyle, extras);
35172
+ return {
35173
+ json: jsonStyle
35174
+ };
35175
+ };
35176
+
35177
+ // detect indent from an object's first pair child position
35178
+ // called during transformChildren when we encounter the first pair
35179
+ const detectIndent = (objectColumn, firstPairColumn) => {
35180
+ const diff = firstPairColumn - objectColumn;
35181
+ return diff > 0 ? diff : 2;
35182
+ };
35029
35183
  const transform = (cursor, transformerMap, ctx) => {
35030
35184
  const info = getCursorInfo(cursor);
35031
35185
 
@@ -35089,11 +35243,27 @@ const createTransformers = transformerMap => ({
35089
35243
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
35090
35244
  maybeAddSourceMap(info, element, ctx);
35091
35245
 
35246
+ // Detect indent from first pair if style is enabled and not yet detected
35247
+ if (ctx.style && ctx.indent === 0) {
35248
+ if (cursor.gotoFirstChild()) {
35249
+ do {
35250
+ if (cursor.nodeType === 'pair') {
35251
+ ctx.indent = detectIndent(info.startPosition.column, cursor.startPosition.column);
35252
+ break;
35253
+ }
35254
+ } while (cursor.gotoNextSibling());
35255
+ cursor.gotoParent();
35256
+ }
35257
+ }
35258
+
35092
35259
  // Transform children (pairs)
35093
35260
  const children = transformChildren(cursor, transformerMap, ctx);
35094
35261
  for (const child of children) {
35095
35262
  element.push(child);
35096
35263
  }
35264
+ if (ctx.style) {
35265
+ element.style = buildJsonStyle(ctx);
35266
+ }
35097
35267
  return element;
35098
35268
  },
35099
35269
  array(cursor, ctx) {
@@ -35106,6 +35276,9 @@ const createTransformers = transformerMap => ({
35106
35276
  for (const child of children) {
35107
35277
  element.push(child);
35108
35278
  }
35279
+ if (ctx.style) {
35280
+ element.style = buildJsonStyle(ctx);
35281
+ }
35109
35282
  return element;
35110
35283
  },
35111
35284
  pair(cursor, ctx) {
@@ -35147,30 +35320,47 @@ const createTransformers = transformerMap => ({
35147
35320
  });
35148
35321
  }
35149
35322
  }
35323
+ if (ctx.style) {
35324
+ element.style = buildJsonStyle(ctx);
35325
+ }
35150
35326
  maybeAddSourceMap(info, element, ctx);
35151
35327
  return element;
35152
35328
  },
35153
35329
  number(cursor, ctx) {
35154
35330
  const info = getCursorInfo(cursor);
35155
35331
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"](Number(info.text));
35332
+ if (ctx.style) {
35333
+ element.style = buildJsonStyle(ctx, {
35334
+ rawContent: info.text
35335
+ });
35336
+ }
35156
35337
  maybeAddSourceMap(info, element, ctx);
35157
35338
  return element;
35158
35339
  },
35159
35340
  null(cursor, ctx) {
35160
35341
  const info = getCursorInfo(cursor);
35161
35342
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__["default"]();
35343
+ if (ctx.style) {
35344
+ element.style = buildJsonStyle(ctx);
35345
+ }
35162
35346
  maybeAddSourceMap(info, element, ctx);
35163
35347
  return element;
35164
35348
  },
35165
35349
  true(cursor, ctx) {
35166
35350
  const info = getCursorInfo(cursor);
35167
35351
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](true);
35352
+ if (ctx.style) {
35353
+ element.style = buildJsonStyle(ctx);
35354
+ }
35168
35355
  maybeAddSourceMap(info, element, ctx);
35169
35356
  return element;
35170
35357
  },
35171
35358
  false(cursor, ctx) {
35172
35359
  const info = getCursorInfo(cursor);
35173
35360
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](false);
35361
+ if (ctx.style) {
35362
+ element.style = buildJsonStyle(ctx);
35363
+ }
35174
35364
  maybeAddSourceMap(info, element, ctx);
35175
35365
  return element;
35176
35366
  },
@@ -35201,11 +35391,14 @@ Object.assign(transformers, createTransformers(transformers));
35201
35391
  * @public
35202
35392
  */
35203
35393
  const analyze = (cst, {
35204
- sourceMap = false
35394
+ sourceMap = false,
35395
+ style = false
35205
35396
  } = {}) => {
35206
35397
  const cursor = cst.walk();
35207
35398
  const ctx = {
35208
35399
  sourceMap,
35400
+ style,
35401
+ indent: 0,
35209
35402
  annotations: []
35210
35403
  };
35211
35404
  const result = transform(cursor, transformers, ctx);
@@ -39804,16 +39997,21 @@ const detect = async (source, {
39804
39997
  */
39805
39998
  const parse = async (source, {
39806
39999
  sourceMap = false,
40000
+ style = false,
39807
40001
  strict = false
39808
40002
  } = {}) => {
39809
40003
  if (strict && sourceMap) {
39810
40004
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
39811
40005
  }
40006
+ if (strict && style) {
40007
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
40008
+ }
39812
40009
  if (strict) {
39813
40010
  return _yaml_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
39814
40011
  }
39815
40012
  return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
39816
- sourceMap
40013
+ sourceMap,
40014
+ style
39817
40015
  });
39818
40016
  };
39819
40017
 
@@ -39888,12 +40086,14 @@ const detect = async source => {
39888
40086
  * @public
39889
40087
  */
39890
40088
  const parse = async (source, {
39891
- sourceMap = false
40089
+ sourceMap = false,
40090
+ style = false
39892
40091
  } = {}) => {
39893
40092
  const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
39894
40093
  try {
39895
40094
  return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
39896
- sourceMap
40095
+ sourceMap,
40096
+ style
39897
40097
  });
39898
40098
  } finally {
39899
40099
  cst.delete();
@@ -39967,18 +40167,20 @@ __webpack_require__.r(__webpack_exports__);
39967
40167
  /* harmony import */ var _ast_Error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51315);
39968
40168
  /* harmony import */ var _ast_Literal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(91412);
39969
40169
  /* harmony import */ var _ast_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(70887);
39970
- /* harmony import */ var _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1652);
39971
- /* harmony import */ var _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(81655);
39972
- /* harmony import */ var _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(107);
39973
- /* harmony import */ var _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(58739);
39974
- /* harmony import */ var _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3979);
39975
- /* harmony import */ var _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(56444);
39976
- /* harmony import */ var _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(85114);
39977
- /* harmony import */ var _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(27136);
39978
- /* harmony import */ var _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(67807);
39979
- /* harmony import */ var _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(37912);
39980
- /* harmony import */ var _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(31864);
39981
- /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2995);
40170
+ /* harmony import */ var _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(81636);
40171
+ /* harmony import */ var _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1652);
40172
+ /* harmony import */ var _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(81655);
40173
+ /* harmony import */ var _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(107);
40174
+ /* harmony import */ var _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(58739);
40175
+ /* harmony import */ var _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3979);
40176
+ /* harmony import */ var _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(56444);
40177
+ /* harmony import */ var _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(85114);
40178
+ /* harmony import */ var _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(27136);
40179
+ /* harmony import */ var _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(67807);
40180
+ /* harmony import */ var _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(37912);
40181
+ /* harmony import */ var _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(31864);
40182
+ /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(2995);
40183
+
39982
40184
 
39983
40185
 
39984
40186
 
@@ -40018,16 +40220,16 @@ const toPositionProps = info => ({
40018
40220
  endOffset: info.endIndex
40019
40221
  });
40020
40222
  const toYamlAnchor = info => {
40021
- return new _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]({
40223
+ return new _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]({
40022
40224
  name: info.text,
40023
40225
  ...toPositionProps(info)
40024
40226
  });
40025
40227
  };
40026
40228
  const toYamlTag = (info, tagInfo) => {
40027
40229
  const explicitName = tagInfo?.text || (info.type === 'plain_scalar' ? '?' : '!');
40028
- const kind = info.type.endsWith('mapping') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Mapping : info.type.endsWith('sequence') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Sequence : _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar;
40230
+ const kind = info.type.endsWith('mapping') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Mapping : info.type.endsWith('sequence') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Sequence : _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar;
40029
40231
  const positionProps = tagInfo ? toPositionProps(tagInfo) : undefined;
40030
- return new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40232
+ return new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40031
40233
  explicitName,
40032
40234
  kind,
40033
40235
  ...positionProps
@@ -40075,12 +40277,29 @@ const processChildren = (cursor, ctx, transformerMap) => {
40075
40277
  return results;
40076
40278
  };
40077
40279
 
40280
+ // strip leading '# ' (or bare '#') from comment text, keeping only the content
40281
+ const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#\s?/, '')).join('\n');
40282
+
40283
+ // find the first YamlNode in a TransformResult (which may be an array from block_node)
40284
+ const findYamlNode = result => {
40285
+ if (result instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return result;
40286
+ if (Array.isArray(result)) {
40287
+ for (const item of result.flat()) {
40288
+ if (item instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return item;
40289
+ }
40290
+ }
40291
+ return null;
40292
+ };
40078
40293
  // Helper to process key-value pair children
40079
40294
  const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
40080
40295
  let key = null;
40081
40296
  let value = null;
40082
40297
  const errors = [];
40298
+ const commentsBetweenKeyValue = [];
40299
+ const commentsAfterValue = [];
40083
40300
  let siblings = {};
40301
+ let seenKey = false;
40302
+ let seenValue = false;
40084
40303
  if (cursor.gotoFirstChild()) {
40085
40304
  do {
40086
40305
  const info = getCursorInfo(cursor);
@@ -40095,12 +40314,25 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
40095
40314
  siblings.anchor = info;
40096
40315
  continue;
40097
40316
  }
40317
+
40318
+ // collect comment nodes (extras placed by tree-sitter between key/value)
40319
+ if (info.type === 'comment') {
40320
+ const commentText = stripCommentHash(info.text);
40321
+ if (seenValue) {
40322
+ commentsAfterValue.push(commentText);
40323
+ } else if (seenKey) {
40324
+ commentsBetweenKeyValue.push(commentText);
40325
+ }
40326
+ continue;
40327
+ }
40098
40328
  if (fieldName === 'key') {
40099
40329
  key = transform(cursor, ctx, transformerMap, siblings);
40100
40330
  siblings = {};
40331
+ seenKey = true;
40101
40332
  } else if (fieldName === 'value') {
40102
40333
  value = transform(cursor, ctx, transformerMap, siblings);
40103
40334
  siblings = {};
40335
+ seenValue = true;
40104
40336
  } else if (info.type === 'ERROR') {
40105
40337
  const errorResult = transform(cursor, ctx, transformerMap, siblings);
40106
40338
  if (errorResult !== null) {
@@ -40113,7 +40345,9 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
40113
40345
  return {
40114
40346
  key,
40115
40347
  value,
40116
- errors
40348
+ errors,
40349
+ commentsBetweenKeyValue,
40350
+ commentsAfterValue
40117
40351
  };
40118
40352
  };
40119
40353
  const transform = (cursor, ctx, transformerMap, siblings = {}) => {
@@ -40142,7 +40376,7 @@ const createTransformers = transformerMap => ({
40142
40376
  stream(cursor, ctx) {
40143
40377
  const info = getCursorInfo(cursor);
40144
40378
  const children = processChildren(cursor, ctx, transformerMap);
40145
- const stream = new _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
40379
+ const stream = new _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40146
40380
  children: children.filter(c => c !== null),
40147
40381
  ...toPositionProps(info),
40148
40382
  isMissing: info.isMissing
@@ -40165,7 +40399,7 @@ const createTransformers = transformerMap => ({
40165
40399
  } while (cursor.gotoNextSibling());
40166
40400
  cursor.gotoParent();
40167
40401
  }
40168
- return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
40402
+ return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
40169
40403
  ...toPositionProps(info),
40170
40404
  name: '%YAML',
40171
40405
  parameters: {
@@ -40184,7 +40418,7 @@ const createTransformers = transformerMap => ({
40184
40418
  } while (cursor.gotoNextSibling());
40185
40419
  cursor.gotoParent();
40186
40420
  }
40187
- const tagDirective = new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
40421
+ const tagDirective = new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
40188
40422
  ...toPositionProps(info),
40189
40423
  name: '%TAG',
40190
40424
  parameters: {
@@ -40206,7 +40440,7 @@ const createTransformers = transformerMap => ({
40206
40440
  } while (cursor.gotoNextSibling());
40207
40441
  cursor.gotoParent();
40208
40442
  }
40209
- return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
40443
+ return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
40210
40444
  ...toPositionProps(info),
40211
40445
  name: children[0],
40212
40446
  parameters: {
@@ -40218,7 +40452,7 @@ const createTransformers = transformerMap => ({
40218
40452
  document(cursor, ctx) {
40219
40453
  const info = getCursorInfo(cursor);
40220
40454
  const children = processChildren(cursor, ctx, transformerMap);
40221
- return new _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
40455
+ return new _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
40222
40456
  children: children.flat().filter(c => c !== null),
40223
40457
  ...toPositionProps(info),
40224
40458
  isMissing: info.isMissing
@@ -40250,7 +40484,7 @@ const createTransformers = transformerMap => ({
40250
40484
 
40251
40485
  // No kind node - create empty scalar
40252
40486
  if (lastChildInfo) {
40253
- const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40487
+ const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40254
40488
  content: '',
40255
40489
  anchor: siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined,
40256
40490
  tag: toYamlTag(lastChildInfo, siblings.tag),
@@ -40260,8 +40494,8 @@ const createTransformers = transformerMap => ({
40260
40494
  endLine: lastChildInfo.endPosition.row,
40261
40495
  endCharacter: lastChildInfo.endPosition.column,
40262
40496
  endOffset: lastChildInfo.endIndex,
40263
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40264
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40497
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40498
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40265
40499
  });
40266
40500
  registerAnchor(emptyScalarNode, ctx);
40267
40501
  return emptyScalarNode;
@@ -40273,13 +40507,13 @@ const createTransformers = transformerMap => ({
40273
40507
  const tag = toYamlTag(info, siblings.tag);
40274
40508
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40275
40509
  const children = processChildren(cursor, ctx, transformerMap);
40276
- const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
40510
+ const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40277
40511
  children: children.filter(c => c !== null),
40278
40512
  ...toPositionProps(info),
40279
40513
  anchor,
40280
40514
  tag,
40281
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
40282
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.NextLine,
40515
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
40516
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine,
40283
40517
  isMissing: info.isMissing
40284
40518
  });
40285
40519
  registerAnchor(mappingNode, ctx);
@@ -40290,13 +40524,15 @@ const createTransformers = transformerMap => ({
40290
40524
  const {
40291
40525
  key,
40292
40526
  value,
40293
- errors
40527
+ errors,
40528
+ commentsBetweenKeyValue,
40529
+ commentsAfterValue
40294
40530
  } = processKeyValuePairChildren(cursor, ctx, transformerMap);
40295
40531
  const children = [];
40296
40532
 
40297
40533
  // Handle empty key
40298
40534
  if (key === null) {
40299
- const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40535
+ const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40300
40536
  content: '',
40301
40537
  startLine: info.startPosition.row,
40302
40538
  startCharacter: info.startPosition.column,
@@ -40304,12 +40540,12 @@ const createTransformers = transformerMap => ({
40304
40540
  endLine: info.startPosition.row,
40305
40541
  endCharacter: info.startPosition.column,
40306
40542
  endOffset: info.startIndex,
40307
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40543
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40308
40544
  explicitName: '?',
40309
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
40545
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
40310
40546
  }),
40311
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40312
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40547
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40548
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40313
40549
  });
40314
40550
  children.push(emptyKey);
40315
40551
  } else {
@@ -40318,7 +40554,7 @@ const createTransformers = transformerMap => ({
40318
40554
 
40319
40555
  // Handle empty value
40320
40556
  if (value === null) {
40321
- const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40557
+ const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40322
40558
  content: '',
40323
40559
  startLine: info.endPosition.row,
40324
40560
  startCharacter: info.endPosition.column,
@@ -40326,22 +40562,37 @@ const createTransformers = transformerMap => ({
40326
40562
  endLine: info.endPosition.row,
40327
40563
  endCharacter: info.endPosition.column,
40328
40564
  endOffset: info.endIndex,
40329
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40565
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40330
40566
  explicitName: '?',
40331
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
40567
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
40332
40568
  }),
40333
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40334
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40569
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40570
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40335
40571
  });
40336
40572
  children.push(emptyValue);
40337
40573
  } else {
40338
40574
  children.push(value);
40339
40575
  }
40576
+
40577
+ // attach comments found between key and value to the value node
40578
+ if (commentsBetweenKeyValue.length > 0) {
40579
+ const valueNode = findYamlNode(value);
40580
+ if (valueNode) {
40581
+ valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
40582
+ }
40583
+ }
40584
+ // attach comments found after value to the value node
40585
+ if (commentsAfterValue.length > 0) {
40586
+ const valueNode = findYamlNode(value);
40587
+ if (valueNode) {
40588
+ valueNode.comment = commentsAfterValue.join('\n');
40589
+ }
40590
+ }
40340
40591
  children.push(...errors);
40341
- return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
40592
+ return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
40342
40593
  children: children.flat().filter(c => c !== null),
40343
40594
  ...toPositionProps(info),
40344
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
40595
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
40345
40596
  isMissing: info.isMissing
40346
40597
  });
40347
40598
  },
@@ -40350,13 +40601,13 @@ const createTransformers = transformerMap => ({
40350
40601
  const tag = toYamlTag(info, siblings.tag);
40351
40602
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40352
40603
  const children = processChildren(cursor, ctx, transformerMap);
40353
- const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
40604
+ const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40354
40605
  children: children.flat().filter(c => c !== null),
40355
40606
  ...toPositionProps(info),
40356
40607
  anchor,
40357
40608
  tag,
40358
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40359
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Explicit,
40609
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40610
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit,
40360
40611
  isMissing: info.isMissing
40361
40612
  });
40362
40613
  registerAnchor(mappingNode, ctx);
@@ -40367,13 +40618,15 @@ const createTransformers = transformerMap => ({
40367
40618
  const {
40368
40619
  key,
40369
40620
  value,
40370
- errors
40621
+ errors,
40622
+ commentsBetweenKeyValue,
40623
+ commentsAfterValue
40371
40624
  } = processKeyValuePairChildren(cursor, ctx, transformerMap);
40372
40625
  const children = [];
40373
40626
 
40374
40627
  // Handle empty key
40375
40628
  if (key === null) {
40376
- const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40629
+ const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40377
40630
  content: '',
40378
40631
  startLine: info.startPosition.row,
40379
40632
  startCharacter: info.startPosition.column,
@@ -40381,12 +40634,12 @@ const createTransformers = transformerMap => ({
40381
40634
  endLine: info.startPosition.row,
40382
40635
  endCharacter: info.startPosition.column,
40383
40636
  endOffset: info.startIndex,
40384
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40637
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40385
40638
  explicitName: '?',
40386
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
40639
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
40387
40640
  }),
40388
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40389
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40641
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40642
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40390
40643
  });
40391
40644
  children.push(emptyKey);
40392
40645
  } else {
@@ -40395,7 +40648,7 @@ const createTransformers = transformerMap => ({
40395
40648
 
40396
40649
  // Handle empty value
40397
40650
  if (value === null) {
40398
- const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40651
+ const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40399
40652
  content: '',
40400
40653
  startLine: info.endPosition.row,
40401
40654
  startCharacter: info.endPosition.column,
@@ -40403,22 +40656,37 @@ const createTransformers = transformerMap => ({
40403
40656
  endLine: info.endPosition.row,
40404
40657
  endCharacter: info.endPosition.column,
40405
40658
  endOffset: info.endIndex,
40406
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40659
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40407
40660
  explicitName: '?',
40408
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
40661
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
40409
40662
  }),
40410
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40411
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40663
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40664
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40412
40665
  });
40413
40666
  children.push(emptyValue);
40414
40667
  } else {
40415
40668
  children.push(value);
40416
40669
  }
40670
+
40671
+ // attach comments found between key and value to the value node
40672
+ if (commentsBetweenKeyValue.length > 0) {
40673
+ const valueNode = findYamlNode(value);
40674
+ if (valueNode) {
40675
+ valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
40676
+ }
40677
+ }
40678
+ // attach comments found after value to the value node
40679
+ if (commentsAfterValue.length > 0) {
40680
+ const valueNode = findYamlNode(value);
40681
+ if (valueNode) {
40682
+ valueNode.comment = commentsAfterValue.join('\n');
40683
+ }
40684
+ }
40417
40685
  children.push(...errors);
40418
- return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
40686
+ return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
40419
40687
  children: children.flat().filter(c => c !== null),
40420
40688
  ...toPositionProps(info),
40421
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40689
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40422
40690
  isMissing: info.isMissing
40423
40691
  });
40424
40692
  },
@@ -40427,13 +40695,13 @@ const createTransformers = transformerMap => ({
40427
40695
  const tag = toYamlTag(info, siblings.tag);
40428
40696
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40429
40697
  const children = processChildren(cursor, ctx, transformerMap);
40430
- const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40698
+ const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
40431
40699
  children: children.flat(Infinity).filter(c => c !== null),
40432
40700
  ...toPositionProps(info),
40433
40701
  anchor,
40434
40702
  tag,
40435
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
40436
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.NextLine
40703
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
40704
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine
40437
40705
  });
40438
40706
  registerAnchor(sequenceNode, ctx);
40439
40707
  return ctx.schema.resolve(sequenceNode);
@@ -40444,11 +40712,11 @@ const createTransformers = transformerMap => ({
40444
40712
 
40445
40713
  // If only one child (the "-" literal), create empty node
40446
40714
  if (children.length === 0) {
40447
- const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40715
+ const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40448
40716
  content: '',
40449
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
40717
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
40450
40718
  explicitName: '?',
40451
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
40719
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
40452
40720
  }),
40453
40721
  startLine: info.endPosition.row,
40454
40722
  startCharacter: info.endPosition.column,
@@ -40456,8 +40724,8 @@ const createTransformers = transformerMap => ({
40456
40724
  endLine: info.endPosition.row,
40457
40725
  endCharacter: info.endPosition.column,
40458
40726
  endOffset: info.endIndex,
40459
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40460
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40727
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40728
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40461
40729
  });
40462
40730
  return [emptyScalarNode];
40463
40731
  }
@@ -40468,13 +40736,13 @@ const createTransformers = transformerMap => ({
40468
40736
  const tag = toYamlTag(info, siblings.tag);
40469
40737
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40470
40738
  const children = processChildren(cursor, ctx, transformerMap);
40471
- const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40739
+ const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
40472
40740
  children: children.flat().filter(c => c !== null),
40473
40741
  ...toPositionProps(info),
40474
40742
  anchor,
40475
40743
  tag,
40476
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40477
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Explicit
40744
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40745
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit
40478
40746
  });
40479
40747
  registerAnchor(sequenceNode, ctx);
40480
40748
  return ctx.schema.resolve(sequenceNode);
@@ -40483,14 +40751,15 @@ const createTransformers = transformerMap => ({
40483
40751
  const info = getCursorInfo(cursor);
40484
40752
  const tag = toYamlTag(info, siblings.tag);
40485
40753
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40486
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40754
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40487
40755
  content: info.text,
40488
40756
  anchor,
40489
40757
  tag,
40490
40758
  ...toPositionProps(info),
40491
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40492
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
40759
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40760
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
40493
40761
  });
40762
+ scalarNode.rawContent = info.text;
40494
40763
  registerAnchor(scalarNode, ctx);
40495
40764
  return ctx.schema.resolve(scalarNode);
40496
40765
  },
@@ -40498,14 +40767,15 @@ const createTransformers = transformerMap => ({
40498
40767
  const info = getCursorInfo(cursor);
40499
40768
  const tag = toYamlTag(info, siblings.tag);
40500
40769
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40501
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40770
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40502
40771
  content: info.text,
40503
40772
  anchor,
40504
40773
  tag,
40505
40774
  ...toPositionProps(info),
40506
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40507
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.SingleQuoted
40775
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40776
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.SingleQuoted
40508
40777
  });
40778
+ scalarNode.rawContent = info.text;
40509
40779
  registerAnchor(scalarNode, ctx);
40510
40780
  return ctx.schema.resolve(scalarNode);
40511
40781
  },
@@ -40513,14 +40783,15 @@ const createTransformers = transformerMap => ({
40513
40783
  const info = getCursorInfo(cursor);
40514
40784
  const tag = toYamlTag(info, siblings.tag);
40515
40785
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40516
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40786
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40517
40787
  content: info.text,
40518
40788
  anchor,
40519
40789
  tag,
40520
40790
  ...toPositionProps(info),
40521
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
40522
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.DoubleQuoted
40791
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
40792
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.DoubleQuoted
40523
40793
  });
40794
+ scalarNode.rawContent = info.text;
40524
40795
  registerAnchor(scalarNode, ctx);
40525
40796
  return ctx.schema.resolve(scalarNode);
40526
40797
  },
@@ -40528,27 +40799,29 @@ const createTransformers = transformerMap => ({
40528
40799
  const info = getCursorInfo(cursor);
40529
40800
  const tag = toYamlTag(info, siblings.tag);
40530
40801
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
40531
- const style = info.text.startsWith('|') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Literal : info.text.startsWith('>') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Folded : _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain;
40532
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
40802
+ const style = info.text.startsWith('|') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Literal : info.text.startsWith('>') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Folded : _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain;
40803
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
40533
40804
  content: info.text,
40534
40805
  anchor,
40535
40806
  tag,
40536
40807
  ...toPositionProps(info),
40537
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
40808
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
40538
40809
  style
40539
40810
  });
40811
+ scalarNode.rawContent = info.text;
40540
40812
  registerAnchor(scalarNode, ctx);
40541
40813
  return ctx.schema.resolve(scalarNode);
40542
40814
  },
40543
40815
  comment(cursor) {
40544
40816
  const info = getCursorInfo(cursor);
40545
- return new _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]({
40546
- content: info.text
40817
+ return new _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
40818
+ content: info.text,
40819
+ ...toPositionProps(info)
40547
40820
  });
40548
40821
  },
40549
40822
  alias(cursor, ctx) {
40550
40823
  const info = getCursorInfo(cursor);
40551
- const alias = new _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]({
40824
+ const alias = new _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]({
40552
40825
  content: info.text
40553
40826
  });
40554
40827
  return ctx.referenceManager.resolveAlias(alias);
@@ -40630,6 +40903,147 @@ const maybeAddSourceMap = (node, element, ctx) => {
40630
40903
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"].transfer(node, element);
40631
40904
  };
40632
40905
 
40906
+ // find the first descendant matching a type path through the AST
40907
+ const findFirst = (node, path) => {
40908
+ if (path.length === 0) return node;
40909
+ const [type, ...rest] = path;
40910
+ for (const child of node.children || []) {
40911
+ if (child.type !== type) continue;
40912
+ const found = findFirst(child, rest);
40913
+ if (found) return found;
40914
+ }
40915
+ return undefined;
40916
+ };
40917
+
40918
+ // detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
40919
+ const detectIndent = node => {
40920
+ const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
40921
+ if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
40922
+ return nested.startCharacter;
40923
+ }
40924
+ return 2;
40925
+ };
40926
+
40927
+ // strip leading '#' from each line of comment text; yaml library adds '#' during stringification
40928
+ const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#/, '')).join('\n');
40929
+
40930
+ // collect comment texts from raw AST children, indexed by position relative to non-comment siblings
40931
+
40932
+ // is the comment on the same line as the previous non-comment sibling?
40933
+ const isInlineComment = (child, lastEndLine, pending) => {
40934
+ return pending.length === 0 && lastEndLine !== undefined && child.startLine === lastEndLine;
40935
+ };
40936
+
40937
+ /**
40938
+ * @param children - raw AST children of a mapping/sequence
40939
+ * @param containerStartCol - the start column of the container node;
40940
+ * trailing comments whose startCharacter is less than this are out-of-scope
40941
+ * (tree-sitter may place them inside a nested block they don't belong to)
40942
+ */
40943
+ const collectComments = (children, containerStartCol) => {
40944
+ const before = new Map();
40945
+ const after = new Map();
40946
+ const pending = [];
40947
+ let lastNonCommentEndLine;
40948
+ let elementIdx = 0;
40949
+ for (const child of children) {
40950
+ if (child?.type === 'comment') {
40951
+ const text = stripCommentHash(child.content || '');
40952
+ if (elementIdx > 0 && isInlineComment(child, lastNonCommentEndLine, pending)) {
40953
+ after.set(elementIdx - 1, text);
40954
+ } else {
40955
+ pending.push({
40956
+ text,
40957
+ startLine: child.startLine,
40958
+ startCharacter: child.startCharacter
40959
+ });
40960
+ }
40961
+ continue;
40962
+ }
40963
+
40964
+ // non-comment node: attach any pending comments as commentBefore
40965
+ if (pending.length > 0) {
40966
+ before.set(elementIdx, pending.map(c => c.text).join('\n'));
40967
+ pending.length = 0;
40968
+ }
40969
+ lastNonCommentEndLine = child.endLine;
40970
+ elementIdx++;
40971
+ }
40972
+
40973
+ // remaining pending comments are trailing — split into in-scope and out-of-scope
40974
+ let trailing = null;
40975
+ const outOfScope = [];
40976
+ for (const c of pending) {
40977
+ if (containerStartCol !== undefined && c.startCharacter !== undefined && c.startCharacter < containerStartCol) {
40978
+ outOfScope.push(c.text);
40979
+ } else {
40980
+ trailing = trailing ? `${trailing}\n${c.text}` : c.text;
40981
+ }
40982
+ }
40983
+ return {
40984
+ before,
40985
+ after,
40986
+ trailing,
40987
+ outOfScope
40988
+ };
40989
+ };
40990
+
40991
+ // set a yaml style property on an element, initializing style.yaml if needed
40992
+ const setYamlStyleProp = (element, key, value) => {
40993
+ if (!element.style) element.style = {};
40994
+ const yaml = element.style.yaml ?? {};
40995
+ yaml[key] = value;
40996
+ element.style.yaml = yaml;
40997
+ };
40998
+
40999
+ // apply collected comments to transformed ApiDOM elements
41000
+ const applyComments = (elements, comments) => {
41001
+ comments.before.forEach((text, idx) => {
41002
+ if (elements[idx]) setYamlStyleProp(elements[idx], 'commentBefore', text);
41003
+ });
41004
+ comments.after.forEach((text, idx) => {
41005
+ if (elements[idx]) setYamlStyleProp(elements[idx], 'comment', text);
41006
+ });
41007
+ };
41008
+
41009
+ // detect flow collection padding from node positions
41010
+ // gap of 1 between container start and first child start → no padding: [x
41011
+ // gap of 2+ → padding: [ x
41012
+ // gap of 1 between container start and first child start → no padding: {x
41013
+ // gap of 2+ → padding: { x
41014
+ const detectFlowPadding = node => {
41015
+ const firstChild = (node.children || [])[0];
41016
+ if (firstChild && typeof node.startCharacter === 'number' && typeof firstChild.startCharacter === 'number') {
41017
+ return firstChild.startCharacter - node.startCharacter > 1;
41018
+ }
41019
+ return true;
41020
+ };
41021
+
41022
+ // build yaml style object for an element
41023
+ const buildYamlStyle = (node, ctx, extras) => {
41024
+ const yamlStyle = {
41025
+ styleGroup: node.styleGroup,
41026
+ indent: ctx.indent
41027
+ };
41028
+ if (ctx.flowCollectionPadding !== null) {
41029
+ yamlStyle.flowCollectionPadding = ctx.flowCollectionPadding;
41030
+ }
41031
+ if (node.comment) {
41032
+ yamlStyle.comment = node.comment;
41033
+ }
41034
+ if (node.commentBefore) {
41035
+ yamlStyle.commentBefore = node.commentBefore;
41036
+ }
41037
+ if (extras) {
41038
+ for (const [key, value] of Object.entries(extras)) {
41039
+ if (value !== undefined) yamlStyle[key] = value;
41040
+ }
41041
+ }
41042
+ return {
41043
+ yaml: yamlStyle
41044
+ };
41045
+ };
41046
+
40633
41047
  // Transform a single node based on its type
40634
41048
  const transform = (node, ctx) => {
40635
41049
  if (node === null || node === undefined) {
@@ -40665,22 +41079,58 @@ const transform = (node, ctx) => {
40665
41079
  // Transform children array and flatten results
40666
41080
  const transformChildren = (children, ctx) => {
40667
41081
  const results = [];
41082
+ let pendingPromoted = [];
40668
41083
  for (const child of children) {
40669
41084
  const result = transform(child, ctx);
40670
41085
  if (result === null) {
41086
+ // collect any promoted comments generated during this null transform
41087
+ if (ctx.style && ctx.promotedComments.length > 0) {
41088
+ pendingPromoted.push(...ctx.promotedComments);
41089
+ ctx.promotedComments = [];
41090
+ }
40671
41091
  continue;
40672
41092
  }
41093
+
41094
+ // apply promoted comments from PREVIOUS children as commentBefore on this element
41095
+ if (ctx.style && pendingPromoted.length > 0) {
41096
+ const target = Array.isArray(result) ? result[0] : result;
41097
+ if (target) {
41098
+ if (!target.style) target.style = {};
41099
+ const yaml = target.style.yaml ?? {};
41100
+ const existing = yaml.commentBefore;
41101
+ const promoted = pendingPromoted.join('\n');
41102
+ yaml.commentBefore = existing ? `${promoted}\n${existing}` : promoted;
41103
+ target.style.yaml = yaml;
41104
+ }
41105
+ pendingPromoted = [];
41106
+ }
41107
+
41108
+ // collect any promoted comments generated by this child's transform
41109
+ // (these will be applied to the NEXT sibling)
41110
+ if (ctx.style && ctx.promotedComments.length > 0) {
41111
+ pendingPromoted.push(...ctx.promotedComments);
41112
+ ctx.promotedComments = [];
41113
+ }
40673
41114
  if (Array.isArray(result)) {
40674
41115
  results.push(...result);
40675
41116
  } else {
40676
41117
  results.push(result);
40677
41118
  }
40678
41119
  }
41120
+
41121
+ // if promoted comments remain after all children, propagate up to parent scope
41122
+ if (pendingPromoted.length > 0) {
41123
+ ctx.promotedComments.push(...pendingPromoted);
41124
+ }
40679
41125
  return results;
40680
41126
  };
40681
41127
 
40682
41128
  // Stream: Wraps transformed children in ParseResultElement
40683
41129
  const transformStream = (node, ctx) => {
41130
+ // detect indent from the stream structure (only needed for style preservation)
41131
+ if (ctx.style) {
41132
+ ctx.indent = detectIndent(node);
41133
+ }
40684
41134
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
40685
41135
 
40686
41136
  // Transform all children
@@ -40726,12 +41176,35 @@ const transformDocument = (node, ctx) => {
40726
41176
  return transformChildren(node.children || [], ctx);
40727
41177
  };
40728
41178
 
41179
+ // shared logic for transformMapping and transformSequence
41180
+ const transformCollection = (element, node, ctx) => {
41181
+ const typedNode = node;
41182
+ const children = node.children || [];
41183
+ if (ctx.style) {
41184
+ if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Flow) {
41185
+ ctx.flowCollectionPadding = detectFlowPadding(typedNode);
41186
+ }
41187
+ const comments = collectComments(children, typedNode.startCharacter);
41188
+ const childElements = transformChildren(children, ctx);
41189
+ // bypass content setter to avoid re-refracting already-transformed elements
41190
+ element._content = childElements; // eslint-disable-line @typescript-eslint/no-explicit-any
41191
+ applyComments(childElements, comments);
41192
+ element.style = buildYamlStyle(node, ctx, {
41193
+ comment: comments.trailing
41194
+ });
41195
+ if (comments.outOfScope.length > 0) {
41196
+ ctx.promotedComments.push(...comments.outOfScope);
41197
+ }
41198
+ } else {
41199
+ element._content = transformChildren(children, ctx); // eslint-disable-line @typescript-eslint/no-explicit-any
41200
+ }
41201
+ maybeAddSourceMap(typedNode, element, ctx);
41202
+ };
41203
+
40729
41204
  // Mapping: Transforms to ObjectElement
40730
41205
  const transformMapping = (node, ctx) => {
40731
41206
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"]();
40732
- // @ts-ignore
40733
- element._content = transformChildren(node.children || [], ctx);
40734
- maybeAddSourceMap(node, element, ctx);
41207
+ transformCollection(element, node, ctx);
40735
41208
  return element;
40736
41209
  };
40737
41210
 
@@ -40765,9 +41238,7 @@ const transformKeyValuePair = (node, ctx) => {
40765
41238
  // Sequence: Transforms to ArrayElement
40766
41239
  const transformSequence = (node, ctx) => {
40767
41240
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]();
40768
- // @ts-ignore
40769
- element._content = transformChildren(node.children || [], ctx);
40770
- maybeAddSourceMap(node, element, ctx);
41241
+ transformCollection(element, node, ctx);
40771
41242
  return element;
40772
41243
  };
40773
41244
 
@@ -40780,6 +41251,15 @@ const transformScalar = (node, ctx) => {
40780
41251
  element.classes.push('yaml-e-node');
40781
41252
  element.classes.push('yaml-e-scalar');
40782
41253
  }
41254
+ if (ctx.style) {
41255
+ const extras = {
41256
+ scalarStyle: node.style
41257
+ };
41258
+ if (node.rawContent !== undefined) {
41259
+ extras.rawContent = node.rawContent;
41260
+ }
41261
+ element.style = buildYamlStyle(node, ctx, extras);
41262
+ }
40783
41263
  maybeAddSourceMap(node, element, ctx);
40784
41264
  return element;
40785
41265
  };
@@ -40844,13 +41324,18 @@ const transformRootError = (node, ctx) => {
40844
41324
  * @public
40845
41325
  */
40846
41326
  const transformYamlAstToApiDOM = (yamlAst, {
40847
- sourceMap = false
41327
+ sourceMap = false,
41328
+ style = false
40848
41329
  } = {}) => {
40849
41330
  const ctx = {
40850
41331
  sourceMap,
41332
+ style,
40851
41333
  namespace: new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__["default"](),
40852
41334
  annotations: [],
40853
- processedDocumentCount: 0
41335
+ processedDocumentCount: 0,
41336
+ indent: 2,
41337
+ flowCollectionPadding: null,
41338
+ promotedComments: []
40854
41339
  };
40855
41340
  const rootNode = yamlAst.rootNode;
40856
41341
 
@@ -41449,6 +41934,8 @@ class YamlNode extends _Node_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
41449
41934
  tag;
41450
41935
  style;
41451
41936
  styleGroup;
41937
+ comment;
41938
+ commentBefore;
41452
41939
  constructor({
41453
41940
  anchor,
41454
41941
  tag,
@@ -41488,6 +41975,7 @@ __webpack_require__.r(__webpack_exports__);
41488
41975
  class YamlScalar extends _YamlNode_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
41489
41976
  static type = 'scalar';
41490
41977
  content;
41978
+ rawContent;
41491
41979
  constructor({
41492
41980
  content,
41493
41981
  ...rest
@@ -42285,7 +42773,8 @@ __webpack_require__.r(__webpack_exports__);
42285
42773
  * @public
42286
42774
  */
42287
42775
  const analyze = (cst, {
42288
- sourceMap = false
42776
+ sourceMap = false,
42777
+ style = false
42289
42778
  } = {}) => {
42290
42779
  const cursor = cst.walk();
42291
42780
  const schema = new _ast_schemas_json_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]();
@@ -42300,7 +42789,8 @@ const analyze = (cst, {
42300
42789
 
42301
42790
  // Pass 2: YAML AST -> ApiDOM (direct transformation)
42302
42791
  return (0,_YamlAstTransformer_mjs__WEBPACK_IMPORTED_MODULE_3__.transformYamlAstToApiDOM)(yamlAst, {
42303
- sourceMap
42792
+ sourceMap,
42793
+ style
42304
42794
  });
42305
42795
  };
42306
42796
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (analyze);
@@ -43741,6 +44231,11 @@ class Parser {
43741
44231
  */
43742
44232
  sourceMap;
43743
44233
 
44234
+ /**
44235
+ * Whether to capture format-specific style information for round-trip preservation.
44236
+ */
44237
+ style;
44238
+
43744
44239
  /**
43745
44240
  * Whether to use strict parsing (native JSON.parse/YAML instead of tree-sitter).
43746
44241
  */
@@ -43759,6 +44254,7 @@ class Parser {
43759
44254
  name,
43760
44255
  allowEmpty = true,
43761
44256
  sourceMap = false,
44257
+ style = false,
43762
44258
  strict = true,
43763
44259
  fileExtensions = [],
43764
44260
  mediaTypes = []
@@ -43766,6 +44262,7 @@ class Parser {
43766
44262
  this.name = name;
43767
44263
  this.allowEmpty = allowEmpty;
43768
44264
  this.sourceMap = sourceMap;
44265
+ this.style = style;
43769
44266
  this.strict = strict;
43770
44267
  this.fileExtensions = fileExtensions;
43771
44268
  this.mediaTypes = mediaTypes;
@@ -43829,7 +44326,7 @@ class ArazzoJSON1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
43829
44326
  async parse(file, options) {
43830
44327
  const source = file.toString();
43831
44328
  try {
43832
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44329
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
43833
44330
  const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_json_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
43834
44331
  const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
43835
44332
  if (shouldParseSourceDescriptions) {
@@ -44141,7 +44638,7 @@ class ArazzoYAML1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
44141
44638
  async parse(file, options) {
44142
44639
  const source = file.toString();
44143
44640
  try {
44144
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44641
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44145
44642
  const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_yaml_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44146
44643
  const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
44147
44644
  if (shouldParseSourceDescriptions) {
@@ -44231,7 +44728,7 @@ class OpenAPIJSON2Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defau
44231
44728
  async parse(file) {
44232
44729
  const source = file.toString();
44233
44730
  try {
44234
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44731
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44235
44732
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44236
44733
  } catch (error) {
44237
44734
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -44295,7 +44792,7 @@ class OpenAPIJSON3_0Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["def
44295
44792
  async parse(file) {
44296
44793
  const source = file.toString();
44297
44794
  try {
44298
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44795
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44299
44796
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_3_0__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44300
44797
  } catch (error) {
44301
44798
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -44359,7 +44856,7 @@ class OpenAPIJSON3_1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["def
44359
44856
  async parse(file) {
44360
44857
  const source = file.toString();
44361
44858
  try {
44362
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44859
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44363
44860
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_3_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44364
44861
  } catch (error) {
44365
44862
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -44423,7 +44920,7 @@ class OpenAPIYAML2Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defau
44423
44920
  async parse(file) {
44424
44921
  const source = file.toString();
44425
44922
  try {
44426
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44923
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44427
44924
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44428
44925
  } catch (error) {
44429
44926
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -44487,7 +44984,7 @@ class OpenAPIYAML3_0Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["def
44487
44984
  async parse(file) {
44488
44985
  const source = file.toString();
44489
44986
  try {
44490
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
44987
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44491
44988
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_3_0__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44492
44989
  } catch (error) {
44493
44990
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -44551,7 +45048,7 @@ class OpenAPIYAML3_1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["def
44551
45048
  async parse(file) {
44552
45049
  const source = file.toString();
44553
45050
  try {
44554
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
45051
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
44555
45052
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_3_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
44556
45053
  } catch (error) {
44557
45054
  throw new _errors_ParserError_mjs__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -63149,6 +63646,53 @@ var both = /*#__PURE__*/(0,_internal_curry2_js__WEBPACK_IMPORTED_MODULE_0__["def
63149
63646
 
63150
63647
  /***/ },
63151
63648
 
63649
+ /***/ 8138
63650
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
63651
+
63652
+ "use strict";
63653
+ __webpack_require__.r(__webpack_exports__);
63654
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
63655
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
63656
+ /* harmony export */ });
63657
+ /* harmony import */ var _internal_clone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8575);
63658
+ /* harmony import */ var _internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18938);
63659
+
63660
+
63661
+
63662
+ /**
63663
+ * Creates a deep copy of the source that can be used in place of the source
63664
+ * object without retaining any references to it.
63665
+ * The source object may contain (nested) `Array`s and `Object`s,
63666
+ * `Number`s, `String`s, `Boolean`s and `Date`s.
63667
+ * `Function`s are assigned by reference rather than copied.
63668
+ *
63669
+ * Dispatches to a `clone` method if present.
63670
+ *
63671
+ * Note that if the source object has multiple nodes that share a reference,
63672
+ * the returned object will have the same structure, but the references will
63673
+ * be pointed to the location within the cloned value.
63674
+ *
63675
+ * @func
63676
+ * @memberOf R
63677
+ * @since v0.1.0
63678
+ * @category Object
63679
+ * @sig {*} -> {*}
63680
+ * @param {*} value The object or array to clone
63681
+ * @return {*} A deeply cloned copy of `val`
63682
+ * @example
63683
+ *
63684
+ * const objects = [{}, {}, {}];
63685
+ * const objectsClone = R.clone(objects);
63686
+ * objects === objectsClone; //=> false
63687
+ * objects[0] === objectsClone[0]; //=> false
63688
+ */
63689
+ var clone = /*#__PURE__*/(0,_internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__["default"])(function clone(value) {
63690
+ return value != null && typeof value.clone === 'function' ? value.clone() : (0,_internal_clone_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value, true);
63691
+ });
63692
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
63693
+
63694
+ /***/ },
63695
+
63152
63696
  /***/ 68199
63153
63697
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
63154
63698
 
@@ -64875,6 +65419,132 @@ function _checkForMethod(methodname, fn) {
64875
65419
 
64876
65420
  /***/ },
64877
65421
 
65422
+ /***/ 8575
65423
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
65424
+
65425
+ "use strict";
65426
+ __webpack_require__.r(__webpack_exports__);
65427
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
65428
+ /* harmony export */ "default": () => (/* binding */ _clone)
65429
+ /* harmony export */ });
65430
+ /* harmony import */ var _cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31254);
65431
+ /* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60963);
65432
+
65433
+
65434
+
65435
+ /**
65436
+ * Copies an object.
65437
+ *
65438
+ * @private
65439
+ * @param {*} value The value to be copied
65440
+ * @param {Boolean} deep Whether or not to perform deep cloning.
65441
+ * @return {*} The copied value.
65442
+ */
65443
+ function _clone(value, deep, map) {
65444
+ map || (map = new _ObjectMap());
65445
+
65446
+ // this avoids the slower switch with a quick if decision removing some milliseconds in each run.
65447
+ if (_isPrimitive(value)) {
65448
+ return value;
65449
+ }
65450
+ var copy = function copy(copiedValue) {
65451
+ // Check for circular and same references on the object graph and return its corresponding clone.
65452
+ var cachedCopy = map.get(value);
65453
+ if (cachedCopy) {
65454
+ return cachedCopy;
65455
+ }
65456
+ map.set(value, copiedValue);
65457
+ for (var key in value) {
65458
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
65459
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
65460
+ }
65461
+ }
65462
+ return copiedValue;
65463
+ };
65464
+ switch ((0,_type_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) {
65465
+ case 'Object':
65466
+ return copy(Object.create(Object.getPrototypeOf(value)));
65467
+ case 'Array':
65468
+ return copy(Array(value.length));
65469
+ case 'Date':
65470
+ return new Date(value.valueOf());
65471
+ case 'RegExp':
65472
+ return (0,_cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value);
65473
+ case 'Int8Array':
65474
+ case 'Uint8Array':
65475
+ case 'Uint8ClampedArray':
65476
+ case 'Int16Array':
65477
+ case 'Uint16Array':
65478
+ case 'Int32Array':
65479
+ case 'Uint32Array':
65480
+ case 'Float32Array':
65481
+ case 'Float64Array':
65482
+ case 'BigInt64Array':
65483
+ case 'BigUint64Array':
65484
+ return value.slice();
65485
+ default:
65486
+ return value;
65487
+ }
65488
+ }
65489
+ function _isPrimitive(param) {
65490
+ var type = typeof param;
65491
+ return param == null || type != 'object' && type != 'function';
65492
+ }
65493
+ var _ObjectMap = /*#__PURE__*/function () {
65494
+ function _ObjectMap() {
65495
+ this.map = {};
65496
+ this.length = 0;
65497
+ }
65498
+ _ObjectMap.prototype.set = function (key, value) {
65499
+ var hashedKey = this.hash(key);
65500
+ var bucket = this.map[hashedKey];
65501
+ if (!bucket) {
65502
+ this.map[hashedKey] = bucket = [];
65503
+ }
65504
+ bucket.push([key, value]);
65505
+ this.length += 1;
65506
+ };
65507
+ _ObjectMap.prototype.hash = function (key) {
65508
+ var hashedKey = [];
65509
+ for (var value in key) {
65510
+ hashedKey.push(Object.prototype.toString.call(key[value]));
65511
+ }
65512
+ return hashedKey.join();
65513
+ };
65514
+ _ObjectMap.prototype.get = function (key) {
65515
+ /**
65516
+ * depending on the number of objects to be cloned is faster to just iterate over the items in the map just because the hash function is so costly,
65517
+ * on my tests this number is 180, anything above that using the hash function is faster.
65518
+ */
65519
+ if (this.length <= 180) {
65520
+ for (var p in this.map) {
65521
+ var bucket = this.map[p];
65522
+ for (var i = 0; i < bucket.length; i += 1) {
65523
+ var element = bucket[i];
65524
+ if (element[0] === key) {
65525
+ return element[1];
65526
+ }
65527
+ }
65528
+ }
65529
+ return;
65530
+ }
65531
+ var hashedKey = this.hash(key);
65532
+ var bucket = this.map[hashedKey];
65533
+ if (!bucket) {
65534
+ return;
65535
+ }
65536
+ for (var i = 0; i < bucket.length; i += 1) {
65537
+ var element = bucket[i];
65538
+ if (element[0] === key) {
65539
+ return element[1];
65540
+ }
65541
+ }
65542
+ };
65543
+ return _ObjectMap;
65544
+ }();
65545
+
65546
+ /***/ },
65547
+
64878
65548
  /***/ 31254
64879
65549
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
64880
65550