@tamagui/code-to-html 1.7.8 β 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/highlightLine.js +781 -945
- package/dist/esm/highlightLine.js.map +4 -4
- package/dist/esm/highlightLine.mjs +781 -945
- package/dist/esm/highlightLine.mjs.map +4 -4
- package/dist/esm/highlightWord.js +768 -932
- package/dist/esm/highlightWord.js.map +4 -4
- package/dist/esm/highlightWord.mjs +768 -932
- package/dist/esm/highlightWord.mjs.map +4 -4
- package/dist/esm/index.js +807 -975
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/index.mjs +807 -975
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +2 -2
|
@@ -7,9 +7,9 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
9
|
};
|
|
10
|
-
var __export = (target,
|
|
11
|
-
for (var name in
|
|
12
|
-
__defProp(target, name, { get:
|
|
10
|
+
var __export = (target, all3) => {
|
|
11
|
+
for (var name in all3)
|
|
12
|
+
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
13
13
|
};
|
|
14
14
|
var __copyProps = (to, from, except, desc) => {
|
|
15
15
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -2604,10 +2604,10 @@ var require_open_element_stack = __commonJS({
|
|
|
2604
2604
|
this.treeAdapter = treeAdapter;
|
|
2605
2605
|
}
|
|
2606
2606
|
//Index of element
|
|
2607
|
-
_indexOf(
|
|
2607
|
+
_indexOf(element3) {
|
|
2608
2608
|
let idx = -1;
|
|
2609
2609
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
2610
|
-
if (this.items[i] ===
|
|
2610
|
+
if (this.items[i] === element3) {
|
|
2611
2611
|
idx = i;
|
|
2612
2612
|
break;
|
|
2613
2613
|
}
|
|
@@ -2624,8 +2624,8 @@ var require_open_element_stack = __commonJS({
|
|
|
2624
2624
|
this.currentTmplContent = this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : null;
|
|
2625
2625
|
}
|
|
2626
2626
|
//Mutations
|
|
2627
|
-
push(
|
|
2628
|
-
this.items[++this.stackTop] =
|
|
2627
|
+
push(element3) {
|
|
2628
|
+
this.items[++this.stackTop] = element3;
|
|
2629
2629
|
this._updateCurrentElement();
|
|
2630
2630
|
if (this._isInTemplate()) {
|
|
2631
2631
|
this.tmplCount++;
|
|
@@ -2662,11 +2662,11 @@ var require_open_element_stack = __commonJS({
|
|
|
2662
2662
|
}
|
|
2663
2663
|
}
|
|
2664
2664
|
}
|
|
2665
|
-
popUntilElementPopped(
|
|
2665
|
+
popUntilElementPopped(element3) {
|
|
2666
2666
|
while (this.stackTop > -1) {
|
|
2667
2667
|
const poppedElement = this.current;
|
|
2668
2668
|
this.pop();
|
|
2669
|
-
if (poppedElement ===
|
|
2669
|
+
if (poppedElement === element3) {
|
|
2670
2670
|
break;
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
@@ -2710,9 +2710,9 @@ var require_open_element_stack = __commonJS({
|
|
|
2710
2710
|
this.pop();
|
|
2711
2711
|
}
|
|
2712
2712
|
}
|
|
2713
|
-
remove(
|
|
2713
|
+
remove(element3) {
|
|
2714
2714
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
2715
|
-
if (this.items[i] ===
|
|
2715
|
+
if (this.items[i] === element3) {
|
|
2716
2716
|
this.items.splice(i, 1);
|
|
2717
2717
|
this.stackTop--;
|
|
2718
2718
|
this._updateCurrentElement();
|
|
@@ -2722,14 +2722,14 @@ var require_open_element_stack = __commonJS({
|
|
|
2722
2722
|
}
|
|
2723
2723
|
//Search
|
|
2724
2724
|
tryPeekProperlyNestedBodyElement() {
|
|
2725
|
-
const
|
|
2726
|
-
return
|
|
2725
|
+
const element3 = this.items[1];
|
|
2726
|
+
return element3 && this.treeAdapter.getTagName(element3) === $.BODY ? element3 : null;
|
|
2727
2727
|
}
|
|
2728
|
-
contains(
|
|
2729
|
-
return this._indexOf(
|
|
2728
|
+
contains(element3) {
|
|
2729
|
+
return this._indexOf(element3) > -1;
|
|
2730
2730
|
}
|
|
2731
|
-
getCommonAncestor(
|
|
2732
|
-
let elementIdx = this._indexOf(
|
|
2731
|
+
getCommonAncestor(element3) {
|
|
2732
|
+
let elementIdx = this._indexOf(element3);
|
|
2733
2733
|
return --elementIdx >= 0 ? this.items[elementIdx] : null;
|
|
2734
2734
|
}
|
|
2735
2735
|
isRootHtmlElementCurrent() {
|
|
@@ -2883,9 +2883,9 @@ var require_formatting_element_list = __commonJS({
|
|
|
2883
2883
|
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
|
2884
2884
|
break;
|
|
2885
2885
|
}
|
|
2886
|
-
const
|
|
2887
|
-
const elementAttrs = this.treeAdapter.getAttrList(
|
|
2888
|
-
const isCandidate = this.treeAdapter.getTagName(
|
|
2886
|
+
const element3 = entry.element;
|
|
2887
|
+
const elementAttrs = this.treeAdapter.getAttrList(element3);
|
|
2888
|
+
const isCandidate = this.treeAdapter.getTagName(element3) === neTagName && this.treeAdapter.getNamespaceURI(element3) === neNamespaceURI && elementAttrs.length === neAttrsLength;
|
|
2889
2889
|
if (isCandidate) {
|
|
2890
2890
|
candidates.push({ idx: i, attrs: elementAttrs });
|
|
2891
2891
|
}
|
|
@@ -2927,16 +2927,16 @@ var require_formatting_element_list = __commonJS({
|
|
|
2927
2927
|
this.entries.push({ type: FormattingElementList.MARKER_ENTRY });
|
|
2928
2928
|
this.length++;
|
|
2929
2929
|
}
|
|
2930
|
-
pushElement(
|
|
2931
|
-
this._ensureNoahArkCondition(
|
|
2930
|
+
pushElement(element3, token) {
|
|
2931
|
+
this._ensureNoahArkCondition(element3);
|
|
2932
2932
|
this.entries.push({
|
|
2933
2933
|
type: FormattingElementList.ELEMENT_ENTRY,
|
|
2934
|
-
element:
|
|
2934
|
+
element: element3,
|
|
2935
2935
|
token
|
|
2936
2936
|
});
|
|
2937
2937
|
this.length++;
|
|
2938
2938
|
}
|
|
2939
|
-
insertElementAfterBookmark(
|
|
2939
|
+
insertElementAfterBookmark(element3, token) {
|
|
2940
2940
|
let bookmarkIdx = this.length - 1;
|
|
2941
2941
|
for (; bookmarkIdx >= 0; bookmarkIdx--) {
|
|
2942
2942
|
if (this.entries[bookmarkIdx] === this.bookmark) {
|
|
@@ -2945,7 +2945,7 @@ var require_formatting_element_list = __commonJS({
|
|
|
2945
2945
|
}
|
|
2946
2946
|
this.entries.splice(bookmarkIdx + 1, 0, {
|
|
2947
2947
|
type: FormattingElementList.ELEMENT_ENTRY,
|
|
2948
|
-
element:
|
|
2948
|
+
element: element3,
|
|
2949
2949
|
token
|
|
2950
2950
|
});
|
|
2951
2951
|
this.length++;
|
|
@@ -2981,10 +2981,10 @@ var require_formatting_element_list = __commonJS({
|
|
|
2981
2981
|
}
|
|
2982
2982
|
return null;
|
|
2983
2983
|
}
|
|
2984
|
-
getElementEntry(
|
|
2984
|
+
getElementEntry(element3) {
|
|
2985
2985
|
for (let i = this.length - 1; i >= 0; i--) {
|
|
2986
2986
|
const entry = this.entries[i];
|
|
2987
|
-
if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element ===
|
|
2987
|
+
if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element3) {
|
|
2988
2988
|
return entry;
|
|
2989
2989
|
}
|
|
2990
2990
|
}
|
|
@@ -3224,9 +3224,9 @@ var require_open_element_stack_mixin = __commonJS({
|
|
|
3224
3224
|
}
|
|
3225
3225
|
orig.popAllUpToHtmlElement.call(this);
|
|
3226
3226
|
},
|
|
3227
|
-
remove(
|
|
3227
|
+
remove(element3) {
|
|
3228
3228
|
mxn.onItemPop(this.current);
|
|
3229
|
-
orig.remove.call(this,
|
|
3229
|
+
orig.remove.call(this, element3);
|
|
3230
3230
|
}
|
|
3231
3231
|
};
|
|
3232
3232
|
}
|
|
@@ -3255,20 +3255,20 @@ var require_parser_mixin = __commonJS({
|
|
|
3255
3255
|
this.lastFosterParentingLocation = null;
|
|
3256
3256
|
this.currentToken = null;
|
|
3257
3257
|
}
|
|
3258
|
-
_setStartLocation(
|
|
3258
|
+
_setStartLocation(element3) {
|
|
3259
3259
|
let loc = null;
|
|
3260
3260
|
if (this.lastStartTagToken) {
|
|
3261
3261
|
loc = Object.assign({}, this.lastStartTagToken.location);
|
|
3262
3262
|
loc.startTag = this.lastStartTagToken.location;
|
|
3263
3263
|
}
|
|
3264
|
-
this.treeAdapter.setNodeSourceCodeLocation(
|
|
3264
|
+
this.treeAdapter.setNodeSourceCodeLocation(element3, loc);
|
|
3265
3265
|
}
|
|
3266
|
-
_setEndLocation(
|
|
3267
|
-
const loc = this.treeAdapter.getNodeSourceCodeLocation(
|
|
3266
|
+
_setEndLocation(element3, closingToken) {
|
|
3267
|
+
const loc = this.treeAdapter.getNodeSourceCodeLocation(element3);
|
|
3268
3268
|
if (loc) {
|
|
3269
3269
|
if (closingToken.location) {
|
|
3270
3270
|
const ctLoc = closingToken.location;
|
|
3271
|
-
const tn = this.treeAdapter.getTagName(
|
|
3271
|
+
const tn = this.treeAdapter.getTagName(element3);
|
|
3272
3272
|
const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName;
|
|
3273
3273
|
const endLoc = {};
|
|
3274
3274
|
if (isClosingEndTag) {
|
|
@@ -3281,7 +3281,7 @@ var require_parser_mixin = __commonJS({
|
|
|
3281
3281
|
endLoc.endCol = ctLoc.startCol;
|
|
3282
3282
|
endLoc.endOffset = ctLoc.startOffset;
|
|
3283
3283
|
}
|
|
3284
|
-
this.treeAdapter.updateNodeSourceCodeLocation(
|
|
3284
|
+
this.treeAdapter.updateNodeSourceCodeLocation(element3, endLoc);
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
3287
|
}
|
|
@@ -3295,8 +3295,8 @@ var require_parser_mixin = __commonJS({
|
|
|
3295
3295
|
const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
|
3296
3296
|
mxn.posTracker = tokenizerMixin.posTracker;
|
|
3297
3297
|
Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, {
|
|
3298
|
-
onItemPop: function(
|
|
3299
|
-
mxn._setEndLocation(
|
|
3298
|
+
onItemPop: function(element3) {
|
|
3299
|
+
mxn._setEndLocation(element3, mxn.currentToken);
|
|
3300
3300
|
}
|
|
3301
3301
|
});
|
|
3302
3302
|
},
|
|
@@ -3317,9 +3317,9 @@ var require_parser_mixin = __commonJS({
|
|
|
3317
3317
|
const requireExplicitUpdate = token.type === Tokenizer.END_TAG_TOKEN && (token.tagName === $.HTML || token.tagName === $.BODY && this.openElements.hasInScope($.BODY));
|
|
3318
3318
|
if (requireExplicitUpdate) {
|
|
3319
3319
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
3320
|
-
const
|
|
3321
|
-
if (this.treeAdapter.getTagName(
|
|
3322
|
-
mxn._setEndLocation(
|
|
3320
|
+
const element3 = this.openElements.items[i];
|
|
3321
|
+
if (this.treeAdapter.getTagName(element3) === token.tagName) {
|
|
3322
|
+
mxn._setEndLocation(element3, token);
|
|
3323
3323
|
break;
|
|
3324
3324
|
}
|
|
3325
3325
|
}
|
|
@@ -3339,10 +3339,10 @@ var require_parser_mixin = __commonJS({
|
|
|
3339
3339
|
}
|
|
3340
3340
|
},
|
|
3341
3341
|
//Elements
|
|
3342
|
-
_attachElementToTree(
|
|
3343
|
-
mxn._setStartLocation(
|
|
3342
|
+
_attachElementToTree(element3) {
|
|
3343
|
+
mxn._setStartLocation(element3);
|
|
3344
3344
|
mxn.lastStartTagToken = null;
|
|
3345
|
-
orig._attachElementToTree.call(this,
|
|
3345
|
+
orig._attachElementToTree.call(this, element3);
|
|
3346
3346
|
},
|
|
3347
3347
|
_appendElement(token, namespaceURI) {
|
|
3348
3348
|
mxn.lastStartTagToken = token;
|
|
@@ -3617,22 +3617,22 @@ var require_default = __commonJS({
|
|
|
3617
3617
|
node.parentNode = null;
|
|
3618
3618
|
}
|
|
3619
3619
|
};
|
|
3620
|
-
exports.insertText = function(parentNode,
|
|
3620
|
+
exports.insertText = function(parentNode, text2) {
|
|
3621
3621
|
if (parentNode.childNodes.length) {
|
|
3622
3622
|
const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
|
|
3623
3623
|
if (prevNode.nodeName === "#text") {
|
|
3624
|
-
prevNode.value +=
|
|
3624
|
+
prevNode.value += text2;
|
|
3625
3625
|
return;
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
|
-
appendChild(parentNode, createTextNode(
|
|
3628
|
+
appendChild(parentNode, createTextNode(text2));
|
|
3629
3629
|
};
|
|
3630
|
-
exports.insertTextBefore = function(parentNode,
|
|
3630
|
+
exports.insertTextBefore = function(parentNode, text2, referenceNode) {
|
|
3631
3631
|
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
|
3632
3632
|
if (prevNode && prevNode.nodeName === "#text") {
|
|
3633
|
-
prevNode.value +=
|
|
3633
|
+
prevNode.value += text2;
|
|
3634
3634
|
} else {
|
|
3635
|
-
insertBefore(parentNode, createTextNode(
|
|
3635
|
+
insertBefore(parentNode, createTextNode(text2), referenceNode);
|
|
3636
3636
|
}
|
|
3637
3637
|
};
|
|
3638
3638
|
exports.adoptAttributes = function(recipient, attrs) {
|
|
@@ -3655,14 +3655,14 @@ var require_default = __commonJS({
|
|
|
3655
3655
|
exports.getParentNode = function(node) {
|
|
3656
3656
|
return node.parentNode;
|
|
3657
3657
|
};
|
|
3658
|
-
exports.getAttrList = function(
|
|
3659
|
-
return
|
|
3658
|
+
exports.getAttrList = function(element3) {
|
|
3659
|
+
return element3.attrs;
|
|
3660
3660
|
};
|
|
3661
|
-
exports.getTagName = function(
|
|
3662
|
-
return
|
|
3661
|
+
exports.getTagName = function(element3) {
|
|
3662
|
+
return element3.tagName;
|
|
3663
3663
|
};
|
|
3664
|
-
exports.getNamespaceURI = function(
|
|
3665
|
-
return
|
|
3664
|
+
exports.getNamespaceURI = function(element3) {
|
|
3665
|
+
return element3.namespaceURI;
|
|
3666
3666
|
};
|
|
3667
3667
|
exports.getTextNodeContent = function(textNode) {
|
|
3668
3668
|
return textNode.value;
|
|
@@ -4100,7 +4100,7 @@ var require_parser = __commonJS({
|
|
|
4100
4100
|
var Mixin = require_mixin();
|
|
4101
4101
|
var defaultTreeAdapter = require_default();
|
|
4102
4102
|
var mergeOptions = require_merge_options();
|
|
4103
|
-
var
|
|
4103
|
+
var doctype2 = require_doctype();
|
|
4104
4104
|
var foreignContent = require_foreign_content();
|
|
4105
4105
|
var ERR = require_error_codes();
|
|
4106
4106
|
var unicode = require_unicode();
|
|
@@ -4544,27 +4544,27 @@ var require_parser = __commonJS({
|
|
|
4544
4544
|
const systemId = token.systemId || "";
|
|
4545
4545
|
this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
|
|
4546
4546
|
}
|
|
4547
|
-
_attachElementToTree(
|
|
4547
|
+
_attachElementToTree(element3) {
|
|
4548
4548
|
if (this._shouldFosterParentOnInsertion()) {
|
|
4549
|
-
this._fosterParentElement(
|
|
4549
|
+
this._fosterParentElement(element3);
|
|
4550
4550
|
} else {
|
|
4551
4551
|
const parent = this.openElements.currentTmplContent || this.openElements.current;
|
|
4552
|
-
this.treeAdapter.appendChild(parent,
|
|
4552
|
+
this.treeAdapter.appendChild(parent, element3);
|
|
4553
4553
|
}
|
|
4554
4554
|
}
|
|
4555
4555
|
_appendElement(token, namespaceURI) {
|
|
4556
|
-
const
|
|
4557
|
-
this._attachElementToTree(
|
|
4556
|
+
const element3 = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
4557
|
+
this._attachElementToTree(element3);
|
|
4558
4558
|
}
|
|
4559
4559
|
_insertElement(token, namespaceURI) {
|
|
4560
|
-
const
|
|
4561
|
-
this._attachElementToTree(
|
|
4562
|
-
this.openElements.push(
|
|
4560
|
+
const element3 = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
4561
|
+
this._attachElementToTree(element3);
|
|
4562
|
+
this.openElements.push(element3);
|
|
4563
4563
|
}
|
|
4564
4564
|
_insertFakeElement(tagName) {
|
|
4565
|
-
const
|
|
4566
|
-
this._attachElementToTree(
|
|
4567
|
-
this.openElements.push(
|
|
4565
|
+
const element3 = this.treeAdapter.createElement(tagName, NS.HTML, []);
|
|
4566
|
+
this._attachElementToTree(element3);
|
|
4567
|
+
this.openElements.push(element3);
|
|
4568
4568
|
}
|
|
4569
4569
|
_insertTemplate(token) {
|
|
4570
4570
|
const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
|
|
@@ -4574,9 +4574,9 @@ var require_parser = __commonJS({
|
|
|
4574
4574
|
this.openElements.push(tmpl);
|
|
4575
4575
|
}
|
|
4576
4576
|
_insertFakeRootElement() {
|
|
4577
|
-
const
|
|
4578
|
-
this.treeAdapter.appendChild(this.openElements.current,
|
|
4579
|
-
this.openElements.push(
|
|
4577
|
+
const element3 = this.treeAdapter.createElement($.HTML, NS.HTML, []);
|
|
4578
|
+
this.treeAdapter.appendChild(this.openElements.current, element3);
|
|
4579
|
+
this.openElements.push(element3);
|
|
4580
4580
|
}
|
|
4581
4581
|
_appendCommentNode(token, parent) {
|
|
4582
4582
|
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
|
@@ -4651,10 +4651,10 @@ var require_parser = __commonJS({
|
|
|
4651
4651
|
}
|
|
4652
4652
|
}
|
|
4653
4653
|
//Integration points
|
|
4654
|
-
_isIntegrationPoint(
|
|
4655
|
-
const tn = this.treeAdapter.getTagName(
|
|
4656
|
-
const ns = this.treeAdapter.getNamespaceURI(
|
|
4657
|
-
const attrs = this.treeAdapter.getAttrList(
|
|
4654
|
+
_isIntegrationPoint(element3, foreignNS) {
|
|
4655
|
+
const tn = this.treeAdapter.getTagName(element3);
|
|
4656
|
+
const ns = this.treeAdapter.getNamespaceURI(element3);
|
|
4657
|
+
const attrs = this.treeAdapter.getAttrList(element3);
|
|
4658
4658
|
return foreignContent.isIntegrationPoint(tn, ns, attrs, foreignNS);
|
|
4659
4659
|
}
|
|
4660
4660
|
//Active formatting elements reconstruction
|
|
@@ -4692,14 +4692,14 @@ var require_parser = __commonJS({
|
|
|
4692
4692
|
//Insertion modes
|
|
4693
4693
|
_resetInsertionMode() {
|
|
4694
4694
|
for (let i = this.openElements.stackTop, last = false; i >= 0; i--) {
|
|
4695
|
-
let
|
|
4695
|
+
let element3 = this.openElements.items[i];
|
|
4696
4696
|
if (i === 0) {
|
|
4697
4697
|
last = true;
|
|
4698
4698
|
if (this.fragmentContext) {
|
|
4699
|
-
|
|
4699
|
+
element3 = this.fragmentContext;
|
|
4700
4700
|
}
|
|
4701
4701
|
}
|
|
4702
|
-
const tn = this.treeAdapter.getTagName(
|
|
4702
|
+
const tn = this.treeAdapter.getTagName(element3);
|
|
4703
4703
|
const newInsertionMode = INSERTION_MODE_RESET_MAP[tn];
|
|
4704
4704
|
if (newInsertionMode) {
|
|
4705
4705
|
this.insertionMode = newInsertionMode;
|
|
@@ -4751,8 +4751,8 @@ var require_parser = __commonJS({
|
|
|
4751
4751
|
this.currentTmplInsertionMode = this.tmplInsertionModeStack[this.tmplInsertionModeStackTop];
|
|
4752
4752
|
}
|
|
4753
4753
|
//Foster parenting
|
|
4754
|
-
_isElementCausesFosterParenting(
|
|
4755
|
-
const tn = this.treeAdapter.getTagName(
|
|
4754
|
+
_isElementCausesFosterParenting(element3) {
|
|
4755
|
+
const tn = this.treeAdapter.getTagName(element3);
|
|
4756
4756
|
return tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR;
|
|
4757
4757
|
}
|
|
4758
4758
|
_shouldFosterParentOnInsertion() {
|
|
@@ -4785,12 +4785,12 @@ var require_parser = __commonJS({
|
|
|
4785
4785
|
}
|
|
4786
4786
|
return location2;
|
|
4787
4787
|
}
|
|
4788
|
-
_fosterParentElement(
|
|
4788
|
+
_fosterParentElement(element3) {
|
|
4789
4789
|
const location2 = this._findFosterParentingLocation();
|
|
4790
4790
|
if (location2.beforeElement) {
|
|
4791
|
-
this.treeAdapter.insertBefore(location2.parent,
|
|
4791
|
+
this.treeAdapter.insertBefore(location2.parent, element3, location2.beforeElement);
|
|
4792
4792
|
} else {
|
|
4793
|
-
this.treeAdapter.appendChild(location2.parent,
|
|
4793
|
+
this.treeAdapter.appendChild(location2.parent, element3);
|
|
4794
4794
|
}
|
|
4795
4795
|
}
|
|
4796
4796
|
_fosterParentText(chars) {
|
|
@@ -4802,9 +4802,9 @@ var require_parser = __commonJS({
|
|
|
4802
4802
|
}
|
|
4803
4803
|
}
|
|
4804
4804
|
//Special elements
|
|
4805
|
-
_isSpecialElement(
|
|
4806
|
-
const tn = this.treeAdapter.getTagName(
|
|
4807
|
-
const ns = this.treeAdapter.getNamespaceURI(
|
|
4805
|
+
_isSpecialElement(element3) {
|
|
4806
|
+
const tn = this.treeAdapter.getTagName(element3);
|
|
4807
|
+
const ns = this.treeAdapter.getNamespaceURI(element3);
|
|
4808
4808
|
return HTML.SPECIAL_ELEMENTS[ns][tn];
|
|
4809
4809
|
}
|
|
4810
4810
|
};
|
|
@@ -4826,12 +4826,12 @@ var require_parser = __commonJS({
|
|
|
4826
4826
|
function aaObtainFurthestBlock(p2, formattingElementEntry) {
|
|
4827
4827
|
let furthestBlock = null;
|
|
4828
4828
|
for (let i = p2.openElements.stackTop; i >= 0; i--) {
|
|
4829
|
-
const
|
|
4830
|
-
if (
|
|
4829
|
+
const element3 = p2.openElements.items[i];
|
|
4830
|
+
if (element3 === formattingElementEntry.element) {
|
|
4831
4831
|
break;
|
|
4832
4832
|
}
|
|
4833
|
-
if (p2._isSpecialElement(
|
|
4834
|
-
furthestBlock =
|
|
4833
|
+
if (p2._isSpecialElement(element3)) {
|
|
4834
|
+
furthestBlock = element3;
|
|
4835
4835
|
}
|
|
4836
4836
|
}
|
|
4837
4837
|
if (!furthestBlock) {
|
|
@@ -4843,24 +4843,24 @@ var require_parser = __commonJS({
|
|
|
4843
4843
|
function aaInnerLoop(p2, furthestBlock, formattingElement) {
|
|
4844
4844
|
let lastElement = furthestBlock;
|
|
4845
4845
|
let nextElement = p2.openElements.getCommonAncestor(furthestBlock);
|
|
4846
|
-
for (let i = 0,
|
|
4847
|
-
nextElement = p2.openElements.getCommonAncestor(
|
|
4848
|
-
const elementEntry = p2.activeFormattingElements.getElementEntry(
|
|
4846
|
+
for (let i = 0, element3 = nextElement; element3 !== formattingElement; i++, element3 = nextElement) {
|
|
4847
|
+
nextElement = p2.openElements.getCommonAncestor(element3);
|
|
4848
|
+
const elementEntry = p2.activeFormattingElements.getElementEntry(element3);
|
|
4849
4849
|
const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
|
|
4850
4850
|
const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
|
|
4851
4851
|
if (shouldRemoveFromOpenElements) {
|
|
4852
4852
|
if (counterOverflow) {
|
|
4853
4853
|
p2.activeFormattingElements.removeEntry(elementEntry);
|
|
4854
4854
|
}
|
|
4855
|
-
p2.openElements.remove(
|
|
4855
|
+
p2.openElements.remove(element3);
|
|
4856
4856
|
} else {
|
|
4857
|
-
|
|
4857
|
+
element3 = aaRecreateElementFromEntry(p2, elementEntry);
|
|
4858
4858
|
if (lastElement === furthestBlock) {
|
|
4859
4859
|
p2.activeFormattingElements.bookmark = elementEntry;
|
|
4860
4860
|
}
|
|
4861
4861
|
p2.treeAdapter.detachNode(lastElement);
|
|
4862
|
-
p2.treeAdapter.appendChild(
|
|
4863
|
-
lastElement =
|
|
4862
|
+
p2.treeAdapter.appendChild(element3, lastElement);
|
|
4863
|
+
lastElement = element3;
|
|
4864
4864
|
}
|
|
4865
4865
|
}
|
|
4866
4866
|
return lastElement;
|
|
@@ -4936,8 +4936,8 @@ var require_parser = __commonJS({
|
|
|
4936
4936
|
}
|
|
4937
4937
|
function doctypeInInitialMode(p2, token) {
|
|
4938
4938
|
p2._setDocumentType(token);
|
|
4939
|
-
const mode = token.forceQuirks ? HTML.DOCUMENT_MODE.QUIRKS :
|
|
4940
|
-
if (!
|
|
4939
|
+
const mode = token.forceQuirks ? HTML.DOCUMENT_MODE.QUIRKS : doctype2.getDocumentMode(token);
|
|
4940
|
+
if (!doctype2.isConforming(token)) {
|
|
4941
4941
|
p2._err(ERR.nonConformingDoctype);
|
|
4942
4942
|
}
|
|
4943
4943
|
p2.treeAdapter.setDocumentMode(p2.document, mode);
|
|
@@ -5192,8 +5192,8 @@ var require_parser = __commonJS({
|
|
|
5192
5192
|
p2.framesetOk = false;
|
|
5193
5193
|
const tn = token.tagName;
|
|
5194
5194
|
for (let i = p2.openElements.stackTop; i >= 0; i--) {
|
|
5195
|
-
const
|
|
5196
|
-
const elementTn = p2.treeAdapter.getTagName(
|
|
5195
|
+
const element3 = p2.openElements.items[i];
|
|
5196
|
+
const elementTn = p2.treeAdapter.getTagName(element3);
|
|
5197
5197
|
let closeTn = null;
|
|
5198
5198
|
if (tn === $.LI && elementTn === $.LI) {
|
|
5199
5199
|
closeTn = $.LI;
|
|
@@ -5205,7 +5205,7 @@ var require_parser = __commonJS({
|
|
|
5205
5205
|
p2.openElements.popUntilTagNamePopped(closeTn);
|
|
5206
5206
|
break;
|
|
5207
5207
|
}
|
|
5208
|
-
if (elementTn !== $.ADDRESS && elementTn !== $.DIV && elementTn !== $.P && p2._isSpecialElement(
|
|
5208
|
+
if (elementTn !== $.ADDRESS && elementTn !== $.DIV && elementTn !== $.P && p2._isSpecialElement(element3)) {
|
|
5209
5209
|
break;
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
@@ -5640,13 +5640,13 @@ var require_parser = __commonJS({
|
|
|
5640
5640
|
function genericEndTagInBody(p2, token) {
|
|
5641
5641
|
const tn = token.tagName;
|
|
5642
5642
|
for (let i = p2.openElements.stackTop; i > 0; i--) {
|
|
5643
|
-
const
|
|
5644
|
-
if (p2.treeAdapter.getTagName(
|
|
5643
|
+
const element3 = p2.openElements.items[i];
|
|
5644
|
+
if (p2.treeAdapter.getTagName(element3) === tn) {
|
|
5645
5645
|
p2.openElements.generateImpliedEndTagsWithExclusion(tn);
|
|
5646
|
-
p2.openElements.popUntilElementPopped(
|
|
5646
|
+
p2.openElements.popUntilElementPopped(element3);
|
|
5647
5647
|
break;
|
|
5648
5648
|
}
|
|
5649
|
-
if (p2._isSpecialElement(
|
|
5649
|
+
if (p2._isSpecialElement(element3)) {
|
|
5650
5650
|
break;
|
|
5651
5651
|
}
|
|
5652
5652
|
}
|
|
@@ -6325,13 +6325,13 @@ var require_parser = __commonJS({
|
|
|
6325
6325
|
}
|
|
6326
6326
|
function endTagInForeignContent(p2, token) {
|
|
6327
6327
|
for (let i = p2.openElements.stackTop; i > 0; i--) {
|
|
6328
|
-
const
|
|
6329
|
-
if (p2.treeAdapter.getNamespaceURI(
|
|
6328
|
+
const element3 = p2.openElements.items[i];
|
|
6329
|
+
if (p2.treeAdapter.getNamespaceURI(element3) === NS.HTML) {
|
|
6330
6330
|
p2._processToken(token);
|
|
6331
6331
|
break;
|
|
6332
6332
|
}
|
|
6333
|
-
if (p2.treeAdapter.getTagName(
|
|
6334
|
-
p2.openElements.popUntilElementPopped(
|
|
6333
|
+
if (p2.treeAdapter.getTagName(element3).toLowerCase() === token.tagName) {
|
|
6334
|
+
p2.openElements.popUntilElementPopped(element3);
|
|
6335
6335
|
break;
|
|
6336
6336
|
}
|
|
6337
6337
|
}
|
|
@@ -7668,460 +7668,25 @@ var htmlVoidElements = [
|
|
|
7668
7668
|
"wbr"
|
|
7669
7669
|
];
|
|
7670
7670
|
|
|
7671
|
-
// ../../node_modules/
|
|
7672
|
-
var isElement = (
|
|
7673
|
-
/**
|
|
7674
|
-
* Check if a node is an element and passes a test.
|
|
7675
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
7676
|
-
*
|
|
7677
|
-
* @type {(
|
|
7678
|
-
* (() => false) &
|
|
7679
|
-
* (<T extends Element = Element>(node: unknown, test?: PredicateTest<T>, index?: number, parent?: Parent, context?: unknown) => node is T) &
|
|
7680
|
-
* ((node: unknown, test: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
|
|
7681
|
-
* )}
|
|
7682
|
-
*/
|
|
7683
|
-
/**
|
|
7684
|
-
* Check if a node passes a test.
|
|
7685
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
7686
|
-
*
|
|
7687
|
-
* @param {unknown} [node] Node to check
|
|
7688
|
-
* @param {Test} [test] When nullish, checks if `node` is a `Node`.
|
|
7689
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
7690
|
-
* When `function` checks if function passed the node is true.
|
|
7691
|
-
* When `array`, checks any one of the subtests pass.
|
|
7692
|
-
* @param {number} [index] Position of `node` in `parent`
|
|
7693
|
-
* @param {Parent} [parent] Parent of `node`
|
|
7694
|
-
* @param {unknown} [context] Context object to invoke `test` with
|
|
7695
|
-
* @returns {boolean} Whether test passed and `node` is an `Element` (object with `type` set to `element` and `tagName` set to a non-empty string).
|
|
7696
|
-
*/
|
|
7697
|
-
// eslint-disable-next-line max-params
|
|
7698
|
-
function(node, test, index2, parent, context) {
|
|
7699
|
-
const check = convertElement(test);
|
|
7700
|
-
if (index2 !== void 0 && index2 !== null && (typeof index2 !== "number" || index2 < 0 || index2 === Number.POSITIVE_INFINITY)) {
|
|
7701
|
-
throw new Error("Expected positive finite index for child node");
|
|
7702
|
-
}
|
|
7703
|
-
if (parent !== void 0 && parent !== null && (!parent.type || !parent.children)) {
|
|
7704
|
-
throw new Error("Expected parent node");
|
|
7705
|
-
}
|
|
7706
|
-
if (!node || !node.type || typeof node.type !== "string") {
|
|
7707
|
-
return false;
|
|
7708
|
-
}
|
|
7709
|
-
if ((parent === void 0 || parent === null) !== (index2 === void 0 || index2 === null)) {
|
|
7710
|
-
throw new Error("Expected both parent and index");
|
|
7711
|
-
}
|
|
7712
|
-
return check.call(context, node, index2, parent);
|
|
7713
|
-
}
|
|
7714
|
-
);
|
|
7715
|
-
var convertElement = (
|
|
7716
|
-
/**
|
|
7717
|
-
* @type {(
|
|
7718
|
-
* (<T extends Element>(test: T['tagName']|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
7719
|
-
* ((test?: Test) => AssertAnything)
|
|
7720
|
-
* )}
|
|
7721
|
-
*/
|
|
7722
|
-
/**
|
|
7723
|
-
* Generate an assertion from a check.
|
|
7724
|
-
* @param {Test} [test]
|
|
7725
|
-
* When nullish, checks if `node` is a `Node`.
|
|
7726
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
7727
|
-
* When `function` checks if function passed the node is true.
|
|
7728
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
7729
|
-
* When `array`, checks any one of the subtests pass.
|
|
7730
|
-
* @returns {AssertAnything}
|
|
7731
|
-
*/
|
|
7732
|
-
function(test) {
|
|
7733
|
-
if (test === void 0 || test === null) {
|
|
7734
|
-
return element;
|
|
7735
|
-
}
|
|
7736
|
-
if (typeof test === "string") {
|
|
7737
|
-
return tagNameFactory(test);
|
|
7738
|
-
}
|
|
7739
|
-
if (typeof test === "object") {
|
|
7740
|
-
return anyFactory(test);
|
|
7741
|
-
}
|
|
7742
|
-
if (typeof test === "function") {
|
|
7743
|
-
return castFactory(test);
|
|
7744
|
-
}
|
|
7745
|
-
throw new Error("Expected function, string, or array as test");
|
|
7746
|
-
}
|
|
7747
|
-
);
|
|
7748
|
-
function anyFactory(tests) {
|
|
7749
|
-
const checks2 = [];
|
|
7750
|
-
let index2 = -1;
|
|
7751
|
-
while (++index2 < tests.length) {
|
|
7752
|
-
checks2[index2] = convertElement(tests[index2]);
|
|
7753
|
-
}
|
|
7754
|
-
return castFactory(any);
|
|
7755
|
-
function any(...parameters) {
|
|
7756
|
-
let index3 = -1;
|
|
7757
|
-
while (++index3 < checks2.length) {
|
|
7758
|
-
if (checks2[index3].call(this, ...parameters)) {
|
|
7759
|
-
return true;
|
|
7760
|
-
}
|
|
7761
|
-
}
|
|
7762
|
-
return false;
|
|
7763
|
-
}
|
|
7764
|
-
}
|
|
7765
|
-
function tagNameFactory(check) {
|
|
7766
|
-
return tagName;
|
|
7767
|
-
function tagName(node) {
|
|
7768
|
-
return element(node) && node.tagName === check;
|
|
7769
|
-
}
|
|
7770
|
-
}
|
|
7771
|
-
function castFactory(check) {
|
|
7772
|
-
return assertion;
|
|
7773
|
-
function assertion(node, ...parameters) {
|
|
7774
|
-
return element(node) && Boolean(check.call(this, node, ...parameters));
|
|
7775
|
-
}
|
|
7776
|
-
}
|
|
7777
|
-
function element(node) {
|
|
7778
|
-
return Boolean(
|
|
7779
|
-
node && typeof node === "object" && // @ts-expect-error Looks like a node.
|
|
7780
|
-
node.type === "element" && // @ts-expect-error Looks like an element.
|
|
7781
|
-
typeof node.tagName === "string"
|
|
7782
|
-
);
|
|
7783
|
-
}
|
|
7784
|
-
|
|
7785
|
-
// ../../node_modules/unist-util-is/index.js
|
|
7786
|
-
var convert = (
|
|
7787
|
-
/**
|
|
7788
|
-
* @type {(
|
|
7789
|
-
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
7790
|
-
* ((test?: Test) => AssertAnything)
|
|
7791
|
-
* )}
|
|
7792
|
-
*/
|
|
7793
|
-
/**
|
|
7794
|
-
* Generate an assertion from a check.
|
|
7795
|
-
* @param {Test} [test]
|
|
7796
|
-
* When nullish, checks if `node` is a `Node`.
|
|
7797
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
7798
|
-
* When `function` checks if function passed the node is true.
|
|
7799
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
7800
|
-
* When `array`, checks any one of the subtests pass.
|
|
7801
|
-
* @returns {AssertAnything}
|
|
7802
|
-
*/
|
|
7803
|
-
function(test) {
|
|
7804
|
-
if (test === void 0 || test === null) {
|
|
7805
|
-
return ok;
|
|
7806
|
-
}
|
|
7807
|
-
if (typeof test === "string") {
|
|
7808
|
-
return typeFactory(test);
|
|
7809
|
-
}
|
|
7810
|
-
if (typeof test === "object") {
|
|
7811
|
-
return Array.isArray(test) ? anyFactory2(test) : propsFactory(test);
|
|
7812
|
-
}
|
|
7813
|
-
if (typeof test === "function") {
|
|
7814
|
-
return castFactory2(test);
|
|
7815
|
-
}
|
|
7816
|
-
throw new Error("Expected function, string, or object as test");
|
|
7817
|
-
}
|
|
7818
|
-
);
|
|
7819
|
-
function anyFactory2(tests) {
|
|
7820
|
-
const checks2 = [];
|
|
7821
|
-
let index2 = -1;
|
|
7822
|
-
while (++index2 < tests.length) {
|
|
7823
|
-
checks2[index2] = convert(tests[index2]);
|
|
7824
|
-
}
|
|
7825
|
-
return castFactory2(any);
|
|
7826
|
-
function any(...parameters) {
|
|
7827
|
-
let index3 = -1;
|
|
7828
|
-
while (++index3 < checks2.length) {
|
|
7829
|
-
if (checks2[index3].call(this, ...parameters))
|
|
7830
|
-
return true;
|
|
7831
|
-
}
|
|
7832
|
-
return false;
|
|
7833
|
-
}
|
|
7834
|
-
}
|
|
7835
|
-
function propsFactory(check) {
|
|
7836
|
-
return castFactory2(all2);
|
|
7837
|
-
function all2(node) {
|
|
7838
|
-
let key2;
|
|
7839
|
-
for (key2 in check) {
|
|
7840
|
-
if (node[key2] !== check[key2])
|
|
7841
|
-
return false;
|
|
7842
|
-
}
|
|
7843
|
-
return true;
|
|
7844
|
-
}
|
|
7845
|
-
}
|
|
7846
|
-
function typeFactory(check) {
|
|
7847
|
-
return castFactory2(type);
|
|
7848
|
-
function type(node) {
|
|
7849
|
-
return node && node.type === check;
|
|
7850
|
-
}
|
|
7851
|
-
}
|
|
7852
|
-
function castFactory2(check) {
|
|
7853
|
-
return assertion;
|
|
7854
|
-
function assertion(...parameters) {
|
|
7855
|
-
return Boolean(check.call(this, ...parameters));
|
|
7856
|
-
}
|
|
7857
|
-
}
|
|
7858
|
-
function ok() {
|
|
7859
|
-
return true;
|
|
7860
|
-
}
|
|
7861
|
-
|
|
7862
|
-
// ../../node_modules/hast-util-to-html/lib/omission/util/comment.js
|
|
7863
|
-
var comment = convert("comment");
|
|
7864
|
-
|
|
7865
|
-
// ../../node_modules/hast-util-whitespace/index.js
|
|
7866
|
-
function whitespace(thing) {
|
|
7867
|
-
var value = (
|
|
7868
|
-
// @ts-ignore looks like a node.
|
|
7869
|
-
thing && typeof thing === "object" && thing.type === "text" ? (
|
|
7870
|
-
// @ts-ignore looks like a text.
|
|
7871
|
-
thing.value || ""
|
|
7872
|
-
) : thing
|
|
7873
|
-
);
|
|
7874
|
-
return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === "";
|
|
7875
|
-
}
|
|
7876
|
-
|
|
7877
|
-
// ../../node_modules/hast-util-to-html/lib/omission/util/siblings.js
|
|
7878
|
-
var siblingAfter = siblings(1);
|
|
7879
|
-
var siblingBefore = siblings(-1);
|
|
7880
|
-
function siblings(increment2) {
|
|
7881
|
-
return sibling;
|
|
7882
|
-
function sibling(parent, index2, includeWhitespace) {
|
|
7883
|
-
const siblings2 = parent && parent.children;
|
|
7884
|
-
let offset = index2 + increment2;
|
|
7885
|
-
let next = siblings2 && siblings2[offset];
|
|
7886
|
-
if (!includeWhitespace) {
|
|
7887
|
-
while (next && whitespace(next)) {
|
|
7888
|
-
offset += increment2;
|
|
7889
|
-
next = siblings2[offset];
|
|
7890
|
-
}
|
|
7891
|
-
}
|
|
7892
|
-
return next;
|
|
7893
|
-
}
|
|
7894
|
-
}
|
|
7895
|
-
|
|
7896
|
-
// ../../node_modules/hast-util-to-html/lib/omission/util/whitespace-start.js
|
|
7897
|
-
var isText = convert("text");
|
|
7898
|
-
function whitespaceStart(node) {
|
|
7899
|
-
return isText(node) && whitespace(node.value.charAt(0));
|
|
7900
|
-
}
|
|
7901
|
-
|
|
7902
|
-
// ../../node_modules/hast-util-to-html/lib/omission/omission.js
|
|
7671
|
+
// ../../node_modules/zwitch/index.js
|
|
7903
7672
|
var own2 = {}.hasOwnProperty;
|
|
7904
|
-
function
|
|
7905
|
-
|
|
7906
|
-
function
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
var closing = omission({
|
|
7913
|
-
html: html3,
|
|
7914
|
-
head: headOrColgroupOrCaption,
|
|
7915
|
-
body,
|
|
7916
|
-
p,
|
|
7917
|
-
li,
|
|
7918
|
-
dt,
|
|
7919
|
-
dd,
|
|
7920
|
-
rt: rubyElement,
|
|
7921
|
-
rp: rubyElement,
|
|
7922
|
-
optgroup,
|
|
7923
|
-
option,
|
|
7924
|
-
menuitem,
|
|
7925
|
-
colgroup: headOrColgroupOrCaption,
|
|
7926
|
-
caption: headOrColgroupOrCaption,
|
|
7927
|
-
thead,
|
|
7928
|
-
tbody,
|
|
7929
|
-
tfoot,
|
|
7930
|
-
tr,
|
|
7931
|
-
td: cells,
|
|
7932
|
-
th: cells
|
|
7933
|
-
});
|
|
7934
|
-
function headOrColgroupOrCaption(_, index2, parent) {
|
|
7935
|
-
const next = siblingAfter(parent, index2, true);
|
|
7936
|
-
return !next || !comment(next) && !whitespaceStart(next);
|
|
7937
|
-
}
|
|
7938
|
-
function html3(_, index2, parent) {
|
|
7939
|
-
const next = siblingAfter(parent, index2);
|
|
7940
|
-
return !next || !comment(next);
|
|
7941
|
-
}
|
|
7942
|
-
function body(_, index2, parent) {
|
|
7943
|
-
const next = siblingAfter(parent, index2);
|
|
7944
|
-
return !next || !comment(next);
|
|
7945
|
-
}
|
|
7946
|
-
function p(_, index2, parent) {
|
|
7947
|
-
const next = siblingAfter(parent, index2);
|
|
7948
|
-
return next ? isElement(next, [
|
|
7949
|
-
"address",
|
|
7950
|
-
"article",
|
|
7951
|
-
"aside",
|
|
7952
|
-
"blockquote",
|
|
7953
|
-
"details",
|
|
7954
|
-
"div",
|
|
7955
|
-
"dl",
|
|
7956
|
-
"fieldset",
|
|
7957
|
-
"figcaption",
|
|
7958
|
-
"figure",
|
|
7959
|
-
"footer",
|
|
7960
|
-
"form",
|
|
7961
|
-
"h1",
|
|
7962
|
-
"h2",
|
|
7963
|
-
"h3",
|
|
7964
|
-
"h4",
|
|
7965
|
-
"h5",
|
|
7966
|
-
"h6",
|
|
7967
|
-
"header",
|
|
7968
|
-
"hgroup",
|
|
7969
|
-
"hr",
|
|
7970
|
-
"main",
|
|
7971
|
-
"menu",
|
|
7972
|
-
"nav",
|
|
7973
|
-
"ol",
|
|
7974
|
-
"p",
|
|
7975
|
-
"pre",
|
|
7976
|
-
"section",
|
|
7977
|
-
"table",
|
|
7978
|
-
"ul"
|
|
7979
|
-
]) : !parent || // Confusing parent.
|
|
7980
|
-
!isElement(parent, [
|
|
7981
|
-
"a",
|
|
7982
|
-
"audio",
|
|
7983
|
-
"del",
|
|
7984
|
-
"ins",
|
|
7985
|
-
"map",
|
|
7986
|
-
"noscript",
|
|
7987
|
-
"video"
|
|
7988
|
-
]);
|
|
7989
|
-
}
|
|
7990
|
-
function li(_, index2, parent) {
|
|
7991
|
-
const next = siblingAfter(parent, index2);
|
|
7992
|
-
return !next || isElement(next, "li");
|
|
7993
|
-
}
|
|
7994
|
-
function dt(_, index2, parent) {
|
|
7995
|
-
const next = siblingAfter(parent, index2);
|
|
7996
|
-
return next && isElement(next, ["dt", "dd"]);
|
|
7997
|
-
}
|
|
7998
|
-
function dd(_, index2, parent) {
|
|
7999
|
-
const next = siblingAfter(parent, index2);
|
|
8000
|
-
return !next || isElement(next, ["dt", "dd"]);
|
|
8001
|
-
}
|
|
8002
|
-
function rubyElement(_, index2, parent) {
|
|
8003
|
-
const next = siblingAfter(parent, index2);
|
|
8004
|
-
return !next || isElement(next, ["rp", "rt"]);
|
|
8005
|
-
}
|
|
8006
|
-
function optgroup(_, index2, parent) {
|
|
8007
|
-
const next = siblingAfter(parent, index2);
|
|
8008
|
-
return !next || isElement(next, "optgroup");
|
|
8009
|
-
}
|
|
8010
|
-
function option(_, index2, parent) {
|
|
8011
|
-
const next = siblingAfter(parent, index2);
|
|
8012
|
-
return !next || isElement(next, ["option", "optgroup"]);
|
|
8013
|
-
}
|
|
8014
|
-
function menuitem(_, index2, parent) {
|
|
8015
|
-
const next = siblingAfter(parent, index2);
|
|
8016
|
-
return !next || isElement(next, ["menuitem", "hr", "menu"]);
|
|
8017
|
-
}
|
|
8018
|
-
function thead(_, index2, parent) {
|
|
8019
|
-
const next = siblingAfter(parent, index2);
|
|
8020
|
-
return next && isElement(next, ["tbody", "tfoot"]);
|
|
8021
|
-
}
|
|
8022
|
-
function tbody(_, index2, parent) {
|
|
8023
|
-
const next = siblingAfter(parent, index2);
|
|
8024
|
-
return !next || isElement(next, ["tbody", "tfoot"]);
|
|
8025
|
-
}
|
|
8026
|
-
function tfoot(_, index2, parent) {
|
|
8027
|
-
return !siblingAfter(parent, index2);
|
|
8028
|
-
}
|
|
8029
|
-
function tr(_, index2, parent) {
|
|
8030
|
-
const next = siblingAfter(parent, index2);
|
|
8031
|
-
return !next || isElement(next, "tr");
|
|
8032
|
-
}
|
|
8033
|
-
function cells(_, index2, parent) {
|
|
8034
|
-
const next = siblingAfter(parent, index2);
|
|
8035
|
-
return !next || isElement(next, ["td", "th"]);
|
|
8036
|
-
}
|
|
8037
|
-
|
|
8038
|
-
// ../../node_modules/hast-util-to-html/lib/omission/opening.js
|
|
8039
|
-
var opening = omission({
|
|
8040
|
-
html: html4,
|
|
8041
|
-
head,
|
|
8042
|
-
body: body2,
|
|
8043
|
-
colgroup,
|
|
8044
|
-
tbody: tbody2
|
|
8045
|
-
});
|
|
8046
|
-
function html4(node) {
|
|
8047
|
-
const head2 = siblingAfter(node, -1);
|
|
8048
|
-
return !head2 || !comment(head2);
|
|
8049
|
-
}
|
|
8050
|
-
function head(node) {
|
|
8051
|
-
const children = node.children;
|
|
8052
|
-
const seen = [];
|
|
8053
|
-
let index2 = -1;
|
|
8054
|
-
let child;
|
|
8055
|
-
while (++index2 < children.length) {
|
|
8056
|
-
child = children[index2];
|
|
8057
|
-
if (isElement(child, ["title", "base"])) {
|
|
8058
|
-
if (seen.includes(child.tagName))
|
|
8059
|
-
return false;
|
|
8060
|
-
seen.push(child.tagName);
|
|
8061
|
-
}
|
|
8062
|
-
}
|
|
8063
|
-
return children.length > 0;
|
|
8064
|
-
}
|
|
8065
|
-
function body2(node) {
|
|
8066
|
-
const head2 = siblingAfter(node, -1, true);
|
|
8067
|
-
return !head2 || !comment(head2) && !whitespaceStart(head2) && !isElement(head2, ["meta", "link", "script", "style", "template"]);
|
|
8068
|
-
}
|
|
8069
|
-
function colgroup(node, index2, parent) {
|
|
8070
|
-
const previous = siblingBefore(parent, index2);
|
|
8071
|
-
const head2 = siblingAfter(node, -1, true);
|
|
8072
|
-
if (isElement(previous, "colgroup") && closing(previous, parent.children.indexOf(previous), parent)) {
|
|
8073
|
-
return false;
|
|
8074
|
-
}
|
|
8075
|
-
return head2 && isElement(head2, "col");
|
|
8076
|
-
}
|
|
8077
|
-
function tbody2(node, index2, parent) {
|
|
8078
|
-
const previous = siblingBefore(parent, index2);
|
|
8079
|
-
const head2 = siblingAfter(node, -1);
|
|
8080
|
-
if (isElement(previous, ["thead", "tbody"]) && closing(previous, parent.children.indexOf(previous), parent)) {
|
|
8081
|
-
return false;
|
|
8082
|
-
}
|
|
8083
|
-
return head2 && isElement(head2, "tr");
|
|
8084
|
-
}
|
|
8085
|
-
|
|
8086
|
-
// ../../node_modules/hast-util-to-html/lib/omission/index.js
|
|
8087
|
-
var omission2 = { opening, closing };
|
|
8088
|
-
|
|
8089
|
-
// ../../node_modules/space-separated-tokens/index.js
|
|
8090
|
-
function parse(value) {
|
|
8091
|
-
const input = String(value || "").trim();
|
|
8092
|
-
return input ? input.split(/[ \t\n\r\f]+/g) : [];
|
|
8093
|
-
}
|
|
8094
|
-
function stringify(values) {
|
|
8095
|
-
return values.join(" ").trim();
|
|
8096
|
-
}
|
|
8097
|
-
|
|
8098
|
-
// ../../node_modules/comma-separated-tokens/index.js
|
|
8099
|
-
function parse2(value) {
|
|
8100
|
-
const tokens = [];
|
|
8101
|
-
const input = String(value || "");
|
|
8102
|
-
let index2 = input.indexOf(",");
|
|
8103
|
-
let start = 0;
|
|
8104
|
-
let end = false;
|
|
8105
|
-
while (!end) {
|
|
8106
|
-
if (index2 === -1) {
|
|
8107
|
-
index2 = input.length;
|
|
8108
|
-
end = true;
|
|
7673
|
+
function zwitch(key2, options) {
|
|
7674
|
+
const settings = options || {};
|
|
7675
|
+
function one3(value, ...parameters) {
|
|
7676
|
+
let fn = one3.invalid;
|
|
7677
|
+
const handlers = one3.handlers;
|
|
7678
|
+
if (value && own2.call(value, key2)) {
|
|
7679
|
+
const id = String(value[key2]);
|
|
7680
|
+
fn = own2.call(handlers, id) ? handlers[id] : one3.unknown;
|
|
8109
7681
|
}
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
tokens.push(token);
|
|
7682
|
+
if (fn) {
|
|
7683
|
+
return fn.call(this, value, ...parameters);
|
|
8113
7684
|
}
|
|
8114
|
-
start = index2 + 1;
|
|
8115
|
-
index2 = input.indexOf(",", start);
|
|
8116
7685
|
}
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
8122
|
-
return input.join(
|
|
8123
|
-
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
8124
|
-
).trim();
|
|
7686
|
+
one3.handlers = settings.handlers || {};
|
|
7687
|
+
one3.invalid = settings.invalid;
|
|
7688
|
+
one3.unknown = settings.unknown;
|
|
7689
|
+
return one3;
|
|
8125
7690
|
}
|
|
8126
7691
|
|
|
8127
7692
|
// ../../node_modules/stringify-entities/lib/core.js
|
|
@@ -8138,17 +7703,17 @@ function core(value, options) {
|
|
|
8138
7703
|
/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,
|
|
8139
7704
|
basic
|
|
8140
7705
|
);
|
|
8141
|
-
function surrogate(pair, index2,
|
|
7706
|
+
function surrogate(pair, index2, all3) {
|
|
8142
7707
|
return options.format(
|
|
8143
7708
|
(pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536,
|
|
8144
|
-
|
|
7709
|
+
all3.charCodeAt(index2 + 2),
|
|
8145
7710
|
options
|
|
8146
7711
|
);
|
|
8147
7712
|
}
|
|
8148
|
-
function basic(character, index2,
|
|
7713
|
+
function basic(character, index2, all3) {
|
|
8149
7714
|
return options.format(
|
|
8150
7715
|
character.charCodeAt(0),
|
|
8151
|
-
|
|
7716
|
+
all3.charCodeAt(index2 + 1),
|
|
8152
7717
|
options
|
|
8153
7718
|
);
|
|
8154
7719
|
}
|
|
@@ -8561,61 +8126,295 @@ for (key in characterEntitiesHtml4) {
|
|
|
8561
8126
|
characters[characterEntitiesHtml4[key]] = key;
|
|
8562
8127
|
}
|
|
8563
8128
|
}
|
|
8564
|
-
function toNamed(code, next, omit, attribute) {
|
|
8565
|
-
const character = String.fromCharCode(code);
|
|
8566
|
-
if (own3.call(characters, character)) {
|
|
8567
|
-
const name = characters[character];
|
|
8568
|
-
const value = "&" + name;
|
|
8569
|
-
if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && /[^\da-z]/i.test(String.fromCharCode(next)))) {
|
|
8570
|
-
return value;
|
|
8571
|
-
}
|
|
8572
|
-
return value + ";";
|
|
8573
|
-
}
|
|
8574
|
-
return "";
|
|
8129
|
+
function toNamed(code, next, omit, attribute) {
|
|
8130
|
+
const character = String.fromCharCode(code);
|
|
8131
|
+
if (own3.call(characters, character)) {
|
|
8132
|
+
const name = characters[character];
|
|
8133
|
+
const value = "&" + name;
|
|
8134
|
+
if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && /[^\da-z]/i.test(String.fromCharCode(next)))) {
|
|
8135
|
+
return value;
|
|
8136
|
+
}
|
|
8137
|
+
return value + ";";
|
|
8138
|
+
}
|
|
8139
|
+
return "";
|
|
8140
|
+
}
|
|
8141
|
+
|
|
8142
|
+
// ../../node_modules/stringify-entities/lib/util/format-smart.js
|
|
8143
|
+
function formatSmart(code, next, options) {
|
|
8144
|
+
let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons);
|
|
8145
|
+
let named;
|
|
8146
|
+
if (options.useNamedReferences || options.useShortestReferences) {
|
|
8147
|
+
named = toNamed(
|
|
8148
|
+
code,
|
|
8149
|
+
next,
|
|
8150
|
+
options.omitOptionalSemicolons,
|
|
8151
|
+
options.attribute
|
|
8152
|
+
);
|
|
8153
|
+
}
|
|
8154
|
+
if ((options.useShortestReferences || !named) && options.useShortestReferences) {
|
|
8155
|
+
const decimal = toDecimal(code, next, options.omitOptionalSemicolons);
|
|
8156
|
+
if (decimal.length < numeric.length) {
|
|
8157
|
+
numeric = decimal;
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
return named && (!options.useShortestReferences || named.length < numeric.length) ? named : numeric;
|
|
8161
|
+
}
|
|
8162
|
+
|
|
8163
|
+
// ../../node_modules/stringify-entities/lib/index.js
|
|
8164
|
+
function stringifyEntities(value, options) {
|
|
8165
|
+
return core(value, Object.assign({ format: formatSmart }, options));
|
|
8166
|
+
}
|
|
8167
|
+
|
|
8168
|
+
// ../../node_modules/hast-util-to-html/lib/handle/comment.js
|
|
8169
|
+
function comment(node, _1, _2, state) {
|
|
8170
|
+
return state.settings.bogusComments ? "<?" + stringifyEntities(
|
|
8171
|
+
node.value,
|
|
8172
|
+
Object.assign({}, state.settings.characterReferences, { subset: [">"] })
|
|
8173
|
+
) + ">" : "<!--" + node.value.replace(/^>|^->|<!--|-->|--!>|<!-$/g, encode) + "-->";
|
|
8174
|
+
function encode($0) {
|
|
8175
|
+
return stringifyEntities(
|
|
8176
|
+
$0,
|
|
8177
|
+
Object.assign({}, state.settings.characterReferences, {
|
|
8178
|
+
subset: ["<", ">"]
|
|
8179
|
+
})
|
|
8180
|
+
);
|
|
8181
|
+
}
|
|
8182
|
+
}
|
|
8183
|
+
|
|
8184
|
+
// ../../node_modules/hast-util-to-html/lib/handle/doctype.js
|
|
8185
|
+
function doctype(_1, _2, _3, state) {
|
|
8186
|
+
return "<!" + (state.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state.settings.tightDoctype ? "" : " ") + "html>";
|
|
8187
|
+
}
|
|
8188
|
+
|
|
8189
|
+
// ../../node_modules/ccount/index.js
|
|
8190
|
+
function ccount(value, character) {
|
|
8191
|
+
const source = String(value);
|
|
8192
|
+
if (typeof character !== "string") {
|
|
8193
|
+
throw new TypeError("Expected character");
|
|
8194
|
+
}
|
|
8195
|
+
let count = 0;
|
|
8196
|
+
let index2 = source.indexOf(character);
|
|
8197
|
+
while (index2 !== -1) {
|
|
8198
|
+
count++;
|
|
8199
|
+
index2 = source.indexOf(character, index2 + character.length);
|
|
8200
|
+
}
|
|
8201
|
+
return count;
|
|
8202
|
+
}
|
|
8203
|
+
|
|
8204
|
+
// ../../node_modules/comma-separated-tokens/index.js
|
|
8205
|
+
function parse(value) {
|
|
8206
|
+
const tokens = [];
|
|
8207
|
+
const input = String(value || "");
|
|
8208
|
+
let index2 = input.indexOf(",");
|
|
8209
|
+
let start = 0;
|
|
8210
|
+
let end = false;
|
|
8211
|
+
while (!end) {
|
|
8212
|
+
if (index2 === -1) {
|
|
8213
|
+
index2 = input.length;
|
|
8214
|
+
end = true;
|
|
8215
|
+
}
|
|
8216
|
+
const token = input.slice(start, index2).trim();
|
|
8217
|
+
if (token || !end) {
|
|
8218
|
+
tokens.push(token);
|
|
8219
|
+
}
|
|
8220
|
+
start = index2 + 1;
|
|
8221
|
+
index2 = input.indexOf(",", start);
|
|
8222
|
+
}
|
|
8223
|
+
return tokens;
|
|
8224
|
+
}
|
|
8225
|
+
function stringify(values, options) {
|
|
8226
|
+
const settings = options || {};
|
|
8227
|
+
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
8228
|
+
return input.join(
|
|
8229
|
+
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
8230
|
+
).trim();
|
|
8231
|
+
}
|
|
8232
|
+
|
|
8233
|
+
// ../../node_modules/space-separated-tokens/index.js
|
|
8234
|
+
function parse2(value) {
|
|
8235
|
+
const input = String(value || "").trim();
|
|
8236
|
+
return input ? input.split(/[ \t\n\r\f]+/g) : [];
|
|
8237
|
+
}
|
|
8238
|
+
function stringify2(values) {
|
|
8239
|
+
return values.join(" ").trim();
|
|
8240
|
+
}
|
|
8241
|
+
|
|
8242
|
+
// ../../node_modules/hast-util-whitespace/index.js
|
|
8243
|
+
function whitespace(thing) {
|
|
8244
|
+
const value = (
|
|
8245
|
+
// @ts-expect-error looks like a node.
|
|
8246
|
+
thing && typeof thing === "object" && thing.type === "text" ? (
|
|
8247
|
+
// @ts-expect-error looks like a text.
|
|
8248
|
+
thing.value || ""
|
|
8249
|
+
) : thing
|
|
8250
|
+
);
|
|
8251
|
+
return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === "";
|
|
8252
|
+
}
|
|
8253
|
+
|
|
8254
|
+
// ../../node_modules/hast-util-to-html/lib/omission/util/siblings.js
|
|
8255
|
+
var siblingAfter = siblings(1);
|
|
8256
|
+
var siblingBefore = siblings(-1);
|
|
8257
|
+
function siblings(increment2) {
|
|
8258
|
+
return sibling;
|
|
8259
|
+
function sibling(parent, index2, includeWhitespace) {
|
|
8260
|
+
const siblings2 = parent ? parent.children : [];
|
|
8261
|
+
let offset = (index2 || 0) + increment2;
|
|
8262
|
+
let next = siblings2 && siblings2[offset];
|
|
8263
|
+
if (!includeWhitespace) {
|
|
8264
|
+
while (next && whitespace(next)) {
|
|
8265
|
+
offset += increment2;
|
|
8266
|
+
next = siblings2[offset];
|
|
8267
|
+
}
|
|
8268
|
+
}
|
|
8269
|
+
return next;
|
|
8270
|
+
}
|
|
8271
|
+
}
|
|
8272
|
+
|
|
8273
|
+
// ../../node_modules/hast-util-to-html/lib/omission/omission.js
|
|
8274
|
+
var own4 = {}.hasOwnProperty;
|
|
8275
|
+
function omission(handlers) {
|
|
8276
|
+
return omit;
|
|
8277
|
+
function omit(node, index2, parent) {
|
|
8278
|
+
return own4.call(handlers, node.tagName) && handlers[node.tagName](node, index2, parent);
|
|
8279
|
+
}
|
|
8280
|
+
}
|
|
8281
|
+
|
|
8282
|
+
// ../../node_modules/hast-util-to-html/lib/omission/closing.js
|
|
8283
|
+
var closing = omission({
|
|
8284
|
+
html: html3,
|
|
8285
|
+
head: headOrColgroupOrCaption,
|
|
8286
|
+
body,
|
|
8287
|
+
p,
|
|
8288
|
+
li,
|
|
8289
|
+
dt,
|
|
8290
|
+
dd,
|
|
8291
|
+
rt: rubyElement,
|
|
8292
|
+
rp: rubyElement,
|
|
8293
|
+
optgroup,
|
|
8294
|
+
option,
|
|
8295
|
+
menuitem,
|
|
8296
|
+
colgroup: headOrColgroupOrCaption,
|
|
8297
|
+
caption: headOrColgroupOrCaption,
|
|
8298
|
+
thead,
|
|
8299
|
+
tbody,
|
|
8300
|
+
tfoot,
|
|
8301
|
+
tr,
|
|
8302
|
+
td: cells,
|
|
8303
|
+
th: cells
|
|
8304
|
+
});
|
|
8305
|
+
function headOrColgroupOrCaption(_, index2, parent) {
|
|
8306
|
+
const next = siblingAfter(parent, index2, true);
|
|
8307
|
+
return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
|
|
8308
|
+
}
|
|
8309
|
+
function html3(_, index2, parent) {
|
|
8310
|
+
const next = siblingAfter(parent, index2);
|
|
8311
|
+
return !next || next.type !== "comment";
|
|
8312
|
+
}
|
|
8313
|
+
function body(_, index2, parent) {
|
|
8314
|
+
const next = siblingAfter(parent, index2);
|
|
8315
|
+
return !next || next.type !== "comment";
|
|
8316
|
+
}
|
|
8317
|
+
function p(_, index2, parent) {
|
|
8318
|
+
const next = siblingAfter(parent, index2);
|
|
8319
|
+
return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || // Confusing parent.
|
|
8320
|
+
!(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video"));
|
|
8321
|
+
}
|
|
8322
|
+
function li(_, index2, parent) {
|
|
8323
|
+
const next = siblingAfter(parent, index2);
|
|
8324
|
+
return !next || next.type === "element" && next.tagName === "li";
|
|
8325
|
+
}
|
|
8326
|
+
function dt(_, index2, parent) {
|
|
8327
|
+
const next = siblingAfter(parent, index2);
|
|
8328
|
+
return next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
|
|
8329
|
+
}
|
|
8330
|
+
function dd(_, index2, parent) {
|
|
8331
|
+
const next = siblingAfter(parent, index2);
|
|
8332
|
+
return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
|
|
8333
|
+
}
|
|
8334
|
+
function rubyElement(_, index2, parent) {
|
|
8335
|
+
const next = siblingAfter(parent, index2);
|
|
8336
|
+
return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt");
|
|
8337
|
+
}
|
|
8338
|
+
function optgroup(_, index2, parent) {
|
|
8339
|
+
const next = siblingAfter(parent, index2);
|
|
8340
|
+
return !next || next.type === "element" && next.tagName === "optgroup";
|
|
8341
|
+
}
|
|
8342
|
+
function option(_, index2, parent) {
|
|
8343
|
+
const next = siblingAfter(parent, index2);
|
|
8344
|
+
return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup");
|
|
8345
|
+
}
|
|
8346
|
+
function menuitem(_, index2, parent) {
|
|
8347
|
+
const next = siblingAfter(parent, index2);
|
|
8348
|
+
return !next || next.type === "element" && (next.tagName === "menuitem" || next.tagName === "hr" || next.tagName === "menu");
|
|
8349
|
+
}
|
|
8350
|
+
function thead(_, index2, parent) {
|
|
8351
|
+
const next = siblingAfter(parent, index2);
|
|
8352
|
+
return next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
|
|
8353
|
+
}
|
|
8354
|
+
function tbody(_, index2, parent) {
|
|
8355
|
+
const next = siblingAfter(parent, index2);
|
|
8356
|
+
return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
|
|
8357
|
+
}
|
|
8358
|
+
function tfoot(_, index2, parent) {
|
|
8359
|
+
return !siblingAfter(parent, index2);
|
|
8360
|
+
}
|
|
8361
|
+
function tr(_, index2, parent) {
|
|
8362
|
+
const next = siblingAfter(parent, index2);
|
|
8363
|
+
return !next || next.type === "element" && next.tagName === "tr";
|
|
8364
|
+
}
|
|
8365
|
+
function cells(_, index2, parent) {
|
|
8366
|
+
const next = siblingAfter(parent, index2);
|
|
8367
|
+
return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th");
|
|
8575
8368
|
}
|
|
8576
8369
|
|
|
8577
|
-
// ../../node_modules/
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8370
|
+
// ../../node_modules/hast-util-to-html/lib/omission/opening.js
|
|
8371
|
+
var opening = omission({
|
|
8372
|
+
html: html4,
|
|
8373
|
+
head,
|
|
8374
|
+
body: body2,
|
|
8375
|
+
colgroup,
|
|
8376
|
+
tbody: tbody2
|
|
8377
|
+
});
|
|
8378
|
+
function html4(node) {
|
|
8379
|
+
const head2 = siblingAfter(node, -1);
|
|
8380
|
+
return !head2 || head2.type !== "comment";
|
|
8381
|
+
}
|
|
8382
|
+
function head(node) {
|
|
8383
|
+
const children = node.children;
|
|
8384
|
+
const seen = [];
|
|
8385
|
+
let index2 = -1;
|
|
8386
|
+
while (++index2 < children.length) {
|
|
8387
|
+
const child = children[index2];
|
|
8388
|
+
if (child.type === "element" && (child.tagName === "title" || child.tagName === "base")) {
|
|
8389
|
+
if (seen.includes(child.tagName))
|
|
8390
|
+
return false;
|
|
8391
|
+
seen.push(child.tagName);
|
|
8593
8392
|
}
|
|
8594
8393
|
}
|
|
8595
|
-
return
|
|
8394
|
+
return children.length > 0;
|
|
8596
8395
|
}
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
return core(value, Object.assign({ format: formatSmart }, options));
|
|
8396
|
+
function body2(node) {
|
|
8397
|
+
const head2 = siblingAfter(node, -1, true);
|
|
8398
|
+
return !head2 || head2.type !== "comment" && !(head2.type === "text" && whitespace(head2.value.charAt(0))) && !(head2.type === "element" && (head2.tagName === "meta" || head2.tagName === "link" || head2.tagName === "script" || head2.tagName === "style" || head2.tagName === "template"));
|
|
8601
8399
|
}
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
throw new TypeError("Expected character");
|
|
8400
|
+
function colgroup(node, index2, parent) {
|
|
8401
|
+
const previous = siblingBefore(parent, index2);
|
|
8402
|
+
const head2 = siblingAfter(node, -1, true);
|
|
8403
|
+
if (parent && previous && previous.type === "element" && previous.tagName === "colgroup" && closing(previous, parent.children.indexOf(previous), parent)) {
|
|
8404
|
+
return false;
|
|
8608
8405
|
}
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8406
|
+
return head2 && head2.type === "element" && head2.tagName === "col";
|
|
8407
|
+
}
|
|
8408
|
+
function tbody2(node, index2, parent) {
|
|
8409
|
+
const previous = siblingBefore(parent, index2);
|
|
8410
|
+
const head2 = siblingAfter(node, -1);
|
|
8411
|
+
if (parent && previous && previous.type === "element" && (previous.tagName === "thead" || previous.tagName === "tbody") && closing(previous, parent.children.indexOf(previous), parent)) {
|
|
8412
|
+
return false;
|
|
8614
8413
|
}
|
|
8615
|
-
return
|
|
8414
|
+
return head2 && head2.type === "element" && head2.tagName === "tr";
|
|
8616
8415
|
}
|
|
8617
8416
|
|
|
8618
|
-
// ../../node_modules/hast-util-to-html/lib/
|
|
8417
|
+
// ../../node_modules/hast-util-to-html/lib/handle/element.js
|
|
8619
8418
|
var constants = {
|
|
8620
8419
|
// See: <https://html.spec.whatwg.org/#attribute-name-state>.
|
|
8621
8420
|
name: [
|
|
@@ -8639,92 +8438,27 @@ var constants = {
|
|
|
8639
8438
|
['\0"&'.split(""), "\0\"&'`".split("")]
|
|
8640
8439
|
]
|
|
8641
8440
|
};
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
node.value,
|
|
8647
|
-
Object.assign({}, ctx.entities, { subset: [">"] })
|
|
8648
|
-
) + ">" : "<!--" + node.value.replace(/^>|^->|<!--|-->|--!>|<!-$/g, encode) + "-->";
|
|
8649
|
-
function encode($0) {
|
|
8650
|
-
return stringifyEntities(
|
|
8651
|
-
$0,
|
|
8652
|
-
Object.assign({}, ctx.entities, { subset: ["<", ">"] })
|
|
8653
|
-
);
|
|
8654
|
-
}
|
|
8655
|
-
}
|
|
8656
|
-
|
|
8657
|
-
// ../../node_modules/hast-util-to-html/lib/doctype.js
|
|
8658
|
-
function doctype(ctx) {
|
|
8659
|
-
return "<!" + (ctx.upperDoctype ? "DOCTYPE" : "doctype") + (ctx.tightDoctype ? "" : " ") + "html>";
|
|
8660
|
-
}
|
|
8661
|
-
|
|
8662
|
-
// ../../node_modules/hast-util-to-html/lib/text.js
|
|
8663
|
-
function text(ctx, node, _, parent) {
|
|
8664
|
-
return parent && parent.type === "element" && // @ts-expect-error: hush.
|
|
8665
|
-
(parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
|
|
8666
|
-
node.value,
|
|
8667
|
-
Object.assign({}, ctx.entities, { subset: ["<", "&"] })
|
|
8668
|
-
);
|
|
8669
|
-
}
|
|
8670
|
-
|
|
8671
|
-
// ../../node_modules/hast-util-to-html/lib/raw.js
|
|
8672
|
-
function raw(ctx, node, index2, parent) {
|
|
8673
|
-
return ctx.dangerous ? node.value : text(ctx, node, index2, parent);
|
|
8674
|
-
}
|
|
8675
|
-
|
|
8676
|
-
// ../../node_modules/hast-util-to-html/lib/tree.js
|
|
8677
|
-
var handlers = {
|
|
8678
|
-
comment: comment2,
|
|
8679
|
-
doctype,
|
|
8680
|
-
element: element2,
|
|
8681
|
-
// @ts-ignore `raw` is nonstandard
|
|
8682
|
-
raw,
|
|
8683
|
-
// @ts-ignore `root` is a parent.
|
|
8684
|
-
root: all,
|
|
8685
|
-
text
|
|
8686
|
-
};
|
|
8687
|
-
var own4 = {}.hasOwnProperty;
|
|
8688
|
-
function one(ctx, node, index2, parent) {
|
|
8689
|
-
if (!node || !node.type) {
|
|
8690
|
-
throw new Error("Expected node, not `" + node + "`");
|
|
8691
|
-
}
|
|
8692
|
-
if (!own4.call(handlers, node.type)) {
|
|
8693
|
-
throw new Error("Cannot compile unknown node `" + node.type + "`");
|
|
8694
|
-
}
|
|
8695
|
-
return handlers[node.type](ctx, node, index2, parent);
|
|
8696
|
-
}
|
|
8697
|
-
function all(ctx, parent) {
|
|
8698
|
-
const results = [];
|
|
8699
|
-
const children = parent && parent.children || [];
|
|
8700
|
-
let index2 = -1;
|
|
8701
|
-
while (++index2 < children.length) {
|
|
8702
|
-
results[index2] = one(ctx, children[index2], index2, parent);
|
|
8703
|
-
}
|
|
8704
|
-
return results.join("");
|
|
8705
|
-
}
|
|
8706
|
-
function element2(ctx, node, index2, parent) {
|
|
8707
|
-
const schema = ctx.schema;
|
|
8708
|
-
const omit = schema.space === "svg" ? void 0 : ctx.omit;
|
|
8709
|
-
let selfClosing = schema.space === "svg" ? ctx.closeEmpty : ctx.voids.includes(node.tagName.toLowerCase());
|
|
8441
|
+
function element(node, index2, parent, state) {
|
|
8442
|
+
const schema = state.schema;
|
|
8443
|
+
const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags;
|
|
8444
|
+
let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node.tagName.toLowerCase());
|
|
8710
8445
|
const parts = [];
|
|
8711
8446
|
let last;
|
|
8712
8447
|
if (schema.space === "html" && node.tagName === "svg") {
|
|
8713
|
-
|
|
8448
|
+
state.schema = svg2;
|
|
8714
8449
|
}
|
|
8715
|
-
const attrs = serializeAttributes(
|
|
8716
|
-
const content = all(
|
|
8717
|
-
ctx,
|
|
8450
|
+
const attrs = serializeAttributes(state, node.properties);
|
|
8451
|
+
const content = state.all(
|
|
8718
8452
|
schema.space === "html" && node.tagName === "template" ? node.content : node
|
|
8719
8453
|
);
|
|
8720
|
-
|
|
8454
|
+
state.schema = schema;
|
|
8721
8455
|
if (content)
|
|
8722
8456
|
selfClosing = false;
|
|
8723
|
-
if (attrs || !omit || !
|
|
8457
|
+
if (attrs || !omit || !opening(node, index2, parent)) {
|
|
8724
8458
|
parts.push("<", node.tagName, attrs ? " " + attrs : "");
|
|
8725
|
-
if (selfClosing && (schema.space === "svg" ||
|
|
8459
|
+
if (selfClosing && (schema.space === "svg" || state.settings.closeSelfClosing)) {
|
|
8726
8460
|
last = attrs.charAt(attrs.length - 1);
|
|
8727
|
-
if (!
|
|
8461
|
+
if (!state.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
|
|
8728
8462
|
parts.push(" ");
|
|
8729
8463
|
}
|
|
8730
8464
|
parts.push("/");
|
|
@@ -8732,35 +8466,37 @@ function element2(ctx, node, index2, parent) {
|
|
|
8732
8466
|
parts.push(">");
|
|
8733
8467
|
}
|
|
8734
8468
|
parts.push(content);
|
|
8735
|
-
if (!selfClosing && (!omit || !
|
|
8469
|
+
if (!selfClosing && (!omit || !closing(node, index2, parent))) {
|
|
8736
8470
|
parts.push("</" + node.tagName + ">");
|
|
8737
8471
|
}
|
|
8738
8472
|
return parts.join("");
|
|
8739
8473
|
}
|
|
8740
|
-
function serializeAttributes(
|
|
8474
|
+
function serializeAttributes(state, props) {
|
|
8741
8475
|
const values = [];
|
|
8742
8476
|
let index2 = -1;
|
|
8743
8477
|
let key2;
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8478
|
+
if (props) {
|
|
8479
|
+
for (key2 in props) {
|
|
8480
|
+
if (props[key2] !== void 0 && props[key2] !== null) {
|
|
8481
|
+
const value = serializeAttribute(state, key2, props[key2]);
|
|
8482
|
+
if (value)
|
|
8483
|
+
values.push(value);
|
|
8484
|
+
}
|
|
8751
8485
|
}
|
|
8752
8486
|
}
|
|
8753
8487
|
while (++index2 < values.length) {
|
|
8754
|
-
last =
|
|
8488
|
+
const last = state.settings.tightAttributes ? values[index2].charAt(values[index2].length - 1) : null;
|
|
8755
8489
|
if (index2 !== values.length - 1 && last !== '"' && last !== "'") {
|
|
8756
8490
|
values[index2] += " ";
|
|
8757
8491
|
}
|
|
8758
8492
|
}
|
|
8759
8493
|
return values.join("");
|
|
8760
8494
|
}
|
|
8761
|
-
function serializeAttribute(
|
|
8762
|
-
const info = find(
|
|
8763
|
-
|
|
8495
|
+
function serializeAttribute(state, key2, value) {
|
|
8496
|
+
const info = find(state.schema, key2);
|
|
8497
|
+
const x = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
|
|
8498
|
+
const y = state.settings.allowDangerousCharacters ? 0 : 1;
|
|
8499
|
+
let quote = state.quote;
|
|
8764
8500
|
let result;
|
|
8765
8501
|
if (info.overloadedBoolean && (value === info.attribute || value === "")) {
|
|
8766
8502
|
value = true;
|
|
@@ -8772,40 +8508,36 @@ function serializeAttribute(ctx, key2, value) {
|
|
|
8772
8508
|
}
|
|
8773
8509
|
const name = stringifyEntities(
|
|
8774
8510
|
info.attribute,
|
|
8775
|
-
Object.assign({},
|
|
8511
|
+
Object.assign({}, state.settings.characterReferences, {
|
|
8776
8512
|
// Always encode without parse errors in non-HTML.
|
|
8777
|
-
subset: constants.name[
|
|
8513
|
+
subset: constants.name[x][y]
|
|
8778
8514
|
})
|
|
8779
8515
|
);
|
|
8780
8516
|
if (value === true)
|
|
8781
8517
|
return name;
|
|
8782
|
-
value =
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
padLeft: !ctx.tightLists
|
|
8787
|
-
})
|
|
8788
|
-
) : String(value);
|
|
8789
|
-
if (ctx.collapseEmpty && !value)
|
|
8518
|
+
value = Array.isArray(value) ? (info.commaSeparated ? stringify : stringify2)(value, {
|
|
8519
|
+
padLeft: !state.settings.tightCommaSeparatedLists
|
|
8520
|
+
}) : String(value);
|
|
8521
|
+
if (state.settings.collapseEmptyAttributes && !value)
|
|
8790
8522
|
return name;
|
|
8791
|
-
if (
|
|
8523
|
+
if (state.settings.preferUnquoted) {
|
|
8792
8524
|
result = stringifyEntities(
|
|
8793
8525
|
value,
|
|
8794
|
-
Object.assign({},
|
|
8795
|
-
subset: constants.unquoted[
|
|
8526
|
+
Object.assign({}, state.settings.characterReferences, {
|
|
8527
|
+
subset: constants.unquoted[x][y],
|
|
8796
8528
|
attribute: true
|
|
8797
8529
|
})
|
|
8798
8530
|
);
|
|
8799
8531
|
}
|
|
8800
8532
|
if (result !== value) {
|
|
8801
|
-
if (
|
|
8802
|
-
quote =
|
|
8533
|
+
if (state.settings.quoteSmart && ccount(value, quote) > ccount(value, state.alternative)) {
|
|
8534
|
+
quote = state.alternative;
|
|
8803
8535
|
}
|
|
8804
8536
|
result = quote + stringifyEntities(
|
|
8805
8537
|
value,
|
|
8806
|
-
Object.assign({},
|
|
8538
|
+
Object.assign({}, state.settings.characterReferences, {
|
|
8807
8539
|
// Always encode without parse errors in non-HTML.
|
|
8808
|
-
subset: (quote === "'" ? constants.single : constants.double)[
|
|
8540
|
+
subset: (quote === "'" ? constants.single : constants.double)[x][y],
|
|
8809
8541
|
attribute: true
|
|
8810
8542
|
})
|
|
8811
8543
|
) + quote;
|
|
@@ -8813,96 +8545,132 @@ function serializeAttribute(ctx, key2, value) {
|
|
|
8813
8545
|
return name + (result ? "=" + result : result);
|
|
8814
8546
|
}
|
|
8815
8547
|
|
|
8548
|
+
// ../../node_modules/hast-util-to-html/lib/handle/text.js
|
|
8549
|
+
function text(node, _, parent, state) {
|
|
8550
|
+
return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
|
|
8551
|
+
node.value,
|
|
8552
|
+
Object.assign({}, state.settings.characterReferences, {
|
|
8553
|
+
subset: ["<", "&"]
|
|
8554
|
+
})
|
|
8555
|
+
);
|
|
8556
|
+
}
|
|
8557
|
+
|
|
8558
|
+
// ../../node_modules/hast-util-to-html/lib/handle/raw.js
|
|
8559
|
+
function raw(node, index2, parent, state) {
|
|
8560
|
+
return state.settings.allowDangerousHtml ? node.value : text(node, index2, parent, state);
|
|
8561
|
+
}
|
|
8562
|
+
|
|
8563
|
+
// ../../node_modules/hast-util-to-html/lib/handle/root.js
|
|
8564
|
+
function root(node, _1, _2, state) {
|
|
8565
|
+
return state.all(node);
|
|
8566
|
+
}
|
|
8567
|
+
|
|
8568
|
+
// ../../node_modules/hast-util-to-html/lib/handle/index.js
|
|
8569
|
+
var handle = zwitch("type", {
|
|
8570
|
+
invalid,
|
|
8571
|
+
unknown,
|
|
8572
|
+
handlers: { comment, doctype, element, raw, root, text }
|
|
8573
|
+
});
|
|
8574
|
+
function invalid(node) {
|
|
8575
|
+
throw new Error("Expected node, not `" + node + "`");
|
|
8576
|
+
}
|
|
8577
|
+
function unknown(node) {
|
|
8578
|
+
throw new Error("Cannot compile unknown node `" + node.type + "`");
|
|
8579
|
+
}
|
|
8580
|
+
|
|
8816
8581
|
// ../../node_modules/hast-util-to-html/lib/index.js
|
|
8817
|
-
function toHtml(
|
|
8818
|
-
const
|
|
8582
|
+
function toHtml(tree, options) {
|
|
8583
|
+
const options_ = options || {};
|
|
8584
|
+
const quote = options_.quote || '"';
|
|
8819
8585
|
const alternative = quote === '"' ? "'" : '"';
|
|
8820
8586
|
if (quote !== '"' && quote !== "'") {
|
|
8821
8587
|
throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
|
|
8822
8588
|
}
|
|
8823
|
-
const
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8589
|
+
const state = {
|
|
8590
|
+
one,
|
|
8591
|
+
all,
|
|
8592
|
+
settings: {
|
|
8593
|
+
omitOptionalTags: options_.omitOptionalTags || false,
|
|
8594
|
+
allowParseErrors: options_.allowParseErrors || false,
|
|
8595
|
+
allowDangerousCharacters: options_.allowDangerousCharacters || false,
|
|
8596
|
+
quoteSmart: options_.quoteSmart || false,
|
|
8597
|
+
preferUnquoted: options_.preferUnquoted || false,
|
|
8598
|
+
tightAttributes: options_.tightAttributes || false,
|
|
8599
|
+
upperDoctype: options_.upperDoctype || false,
|
|
8600
|
+
tightDoctype: options_.tightDoctype || false,
|
|
8601
|
+
bogusComments: options_.bogusComments || false,
|
|
8602
|
+
tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,
|
|
8603
|
+
tightSelfClosing: options_.tightSelfClosing || false,
|
|
8604
|
+
collapseEmptyAttributes: options_.collapseEmptyAttributes || false,
|
|
8605
|
+
allowDangerousHtml: options_.allowDangerousHtml || false,
|
|
8606
|
+
voids: options_.voids || htmlVoidElements,
|
|
8607
|
+
characterReferences: options_.characterReferences || options_.entities || {},
|
|
8608
|
+
closeSelfClosing: options_.closeSelfClosing || false,
|
|
8609
|
+
closeEmptyElements: options_.closeEmptyElements || false
|
|
8610
|
+
},
|
|
8611
|
+
schema: options_.space === "svg" ? svg2 : html2,
|
|
8828
8612
|
quote,
|
|
8829
|
-
alternative
|
|
8830
|
-
smart: options.quoteSmart,
|
|
8831
|
-
unquoted: options.preferUnquoted,
|
|
8832
|
-
tight: options.tightAttributes,
|
|
8833
|
-
upperDoctype: options.upperDoctype,
|
|
8834
|
-
tightDoctype: options.tightDoctype,
|
|
8835
|
-
bogusComments: options.bogusComments,
|
|
8836
|
-
tightLists: options.tightCommaSeparatedLists,
|
|
8837
|
-
tightClose: options.tightSelfClosing,
|
|
8838
|
-
collapseEmpty: options.collapseEmptyAttributes,
|
|
8839
|
-
dangerous: options.allowDangerousHtml,
|
|
8840
|
-
voids: options.voids || htmlVoidElements.concat(),
|
|
8841
|
-
entities: options.entities || {},
|
|
8842
|
-
close: options.closeSelfClosing,
|
|
8843
|
-
closeEmpty: options.closeEmptyElements
|
|
8613
|
+
alternative
|
|
8844
8614
|
};
|
|
8845
|
-
return one(
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
null,
|
|
8850
|
-
null
|
|
8615
|
+
return state.one(
|
|
8616
|
+
Array.isArray(tree) ? { type: "root", children: tree } : tree,
|
|
8617
|
+
void 0,
|
|
8618
|
+
void 0
|
|
8851
8619
|
);
|
|
8852
8620
|
}
|
|
8621
|
+
function one(node, index2, parent) {
|
|
8622
|
+
return handle(node, index2, parent, this);
|
|
8623
|
+
}
|
|
8624
|
+
function all(parent) {
|
|
8625
|
+
const results = [];
|
|
8626
|
+
const children = parent && parent.children || [];
|
|
8627
|
+
let index2 = -1;
|
|
8628
|
+
while (++index2 < children.length) {
|
|
8629
|
+
results[index2] = this.one(children[index2], index2, parent);
|
|
8630
|
+
}
|
|
8631
|
+
return results.join("");
|
|
8632
|
+
}
|
|
8853
8633
|
|
|
8854
8634
|
// ../../node_modules/rehype-parse/lib/index.js
|
|
8855
8635
|
var import_parser = __toESM(require_parser(), 1);
|
|
8856
8636
|
|
|
8857
|
-
// ../../node_modules/hast-util-parse-selector/index.js
|
|
8637
|
+
// ../../node_modules/hast-util-parse-selector/lib/index.js
|
|
8858
8638
|
var search = /[#.]/g;
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
search.lastIndex = start;
|
|
8879
|
-
match = search.exec(value);
|
|
8880
|
-
subvalue = value.slice(start, match ? match.index : value.length);
|
|
8881
|
-
if (subvalue) {
|
|
8882
|
-
if (!previous) {
|
|
8883
|
-
defaultTagName = subvalue;
|
|
8884
|
-
} else if (previous === "#") {
|
|
8885
|
-
props.id = subvalue;
|
|
8886
|
-
} else if (Array.isArray(props.className)) {
|
|
8887
|
-
props.className.push(subvalue);
|
|
8888
|
-
} else {
|
|
8889
|
-
props.className = [subvalue];
|
|
8890
|
-
}
|
|
8891
|
-
start += subvalue.length;
|
|
8892
|
-
}
|
|
8893
|
-
if (match) {
|
|
8894
|
-
previous = match[0];
|
|
8895
|
-
start++;
|
|
8639
|
+
function parseSelector(selector, defaultTagName) {
|
|
8640
|
+
const value = selector || "";
|
|
8641
|
+
const props = {};
|
|
8642
|
+
let start = 0;
|
|
8643
|
+
let previous;
|
|
8644
|
+
let tagName;
|
|
8645
|
+
while (start < value.length) {
|
|
8646
|
+
search.lastIndex = start;
|
|
8647
|
+
const match = search.exec(value);
|
|
8648
|
+
const subvalue = value.slice(start, match ? match.index : value.length);
|
|
8649
|
+
if (subvalue) {
|
|
8650
|
+
if (!previous) {
|
|
8651
|
+
tagName = subvalue;
|
|
8652
|
+
} else if (previous === "#") {
|
|
8653
|
+
props.id = subvalue;
|
|
8654
|
+
} else if (Array.isArray(props.className)) {
|
|
8655
|
+
props.className.push(subvalue);
|
|
8656
|
+
} else {
|
|
8657
|
+
props.className = [subvalue];
|
|
8896
8658
|
}
|
|
8659
|
+
start += subvalue.length;
|
|
8660
|
+
}
|
|
8661
|
+
if (match) {
|
|
8662
|
+
previous = match[0];
|
|
8663
|
+
start++;
|
|
8897
8664
|
}
|
|
8898
|
-
return {
|
|
8899
|
-
type: "element",
|
|
8900
|
-
tagName: defaultTagName,
|
|
8901
|
-
properties: props,
|
|
8902
|
-
children: []
|
|
8903
|
-
};
|
|
8904
8665
|
}
|
|
8905
|
-
|
|
8666
|
+
return {
|
|
8667
|
+
type: "element",
|
|
8668
|
+
// @ts-expect-error: fine.
|
|
8669
|
+
tagName: tagName || defaultTagName || "div",
|
|
8670
|
+
properties: props,
|
|
8671
|
+
children: []
|
|
8672
|
+
};
|
|
8673
|
+
}
|
|
8906
8674
|
|
|
8907
8675
|
// ../../node_modules/hastscript/lib/core.js
|
|
8908
8676
|
var buttonTypes = /* @__PURE__ */ new Set(["menu", "submit", "reset", "button"]);
|
|
@@ -8913,7 +8681,7 @@ function core2(schema, defaultTagName, caseSensitive) {
|
|
|
8913
8681
|
/**
|
|
8914
8682
|
* @type {{
|
|
8915
8683
|
* (): Root
|
|
8916
|
-
* (selector: null|undefined, ...children: Array<HChild>): Root
|
|
8684
|
+
* (selector: null | undefined, ...children: Array<HChild>): Root
|
|
8917
8685
|
* (selector: string, properties?: HProperties, ...children: Array<HChild>): Element
|
|
8918
8686
|
* (selector: string, ...children: Array<HChild>): Element
|
|
8919
8687
|
* }}
|
|
@@ -8921,8 +8689,8 @@ function core2(schema, defaultTagName, caseSensitive) {
|
|
|
8921
8689
|
/**
|
|
8922
8690
|
* Hyperscript compatible DSL for creating virtual hast trees.
|
|
8923
8691
|
*
|
|
8924
|
-
* @param {string|null} [selector]
|
|
8925
|
-
* @param {HProperties|HChild} [properties]
|
|
8692
|
+
* @param {string | null} [selector]
|
|
8693
|
+
* @param {HProperties | HChild} [properties]
|
|
8926
8694
|
* @param {Array<HChild>} children
|
|
8927
8695
|
* @returns {HResult}
|
|
8928
8696
|
*/
|
|
@@ -8990,11 +8758,11 @@ function addProperty(schema, properties, key2, value) {
|
|
|
8990
8758
|
result = value;
|
|
8991
8759
|
} else if (typeof value === "string") {
|
|
8992
8760
|
if (info.spaceSeparated) {
|
|
8993
|
-
result = parse(value);
|
|
8994
|
-
} else if (info.commaSeparated) {
|
|
8995
8761
|
result = parse2(value);
|
|
8762
|
+
} else if (info.commaSeparated) {
|
|
8763
|
+
result = parse(value);
|
|
8996
8764
|
} else if (info.commaOrSpaceSeparated) {
|
|
8997
|
-
result = parse(
|
|
8765
|
+
result = parse2(parse(value).join(" "));
|
|
8998
8766
|
} else {
|
|
8999
8767
|
result = parsePrimitive(info, info.property, value);
|
|
9000
8768
|
}
|
|
@@ -9015,20 +8783,20 @@ function addProperty(schema, properties, key2, value) {
|
|
|
9015
8783
|
}
|
|
9016
8784
|
properties[info.property] = result;
|
|
9017
8785
|
}
|
|
9018
|
-
function addChild(
|
|
8786
|
+
function addChild(nodes, value) {
|
|
9019
8787
|
let index2 = -1;
|
|
9020
8788
|
if (value === void 0 || value === null) {
|
|
9021
8789
|
} else if (typeof value === "string" || typeof value === "number") {
|
|
9022
|
-
|
|
8790
|
+
nodes.push({ type: "text", value: String(value) });
|
|
9023
8791
|
} else if (Array.isArray(value)) {
|
|
9024
8792
|
while (++index2 < value.length) {
|
|
9025
|
-
addChild(
|
|
8793
|
+
addChild(nodes, value[index2]);
|
|
9026
8794
|
}
|
|
9027
8795
|
} else if (typeof value === "object" && "type" in value) {
|
|
9028
8796
|
if (value.type === "root") {
|
|
9029
|
-
addChild(
|
|
8797
|
+
addChild(nodes, value.children);
|
|
9030
8798
|
} else {
|
|
9031
|
-
|
|
8799
|
+
nodes.push(value);
|
|
9032
8800
|
}
|
|
9033
8801
|
} else {
|
|
9034
8802
|
throw new Error("Expected node, nodes, or string, got `" + value + "`");
|
|
@@ -9113,24 +8881,24 @@ var svgCaseSensitiveTagNames = [
|
|
|
9113
8881
|
// ../../node_modules/hastscript/lib/svg.js
|
|
9114
8882
|
var s = core2(svg2, "g", svgCaseSensitiveTagNames);
|
|
9115
8883
|
|
|
9116
|
-
// ../../node_modules/vfile-location/index.js
|
|
8884
|
+
// ../../node_modules/vfile-location/lib/index.js
|
|
9117
8885
|
function location(file) {
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
8886
|
+
const value = String(file);
|
|
8887
|
+
const indices = [];
|
|
8888
|
+
const search2 = /\r?\n|\r/g;
|
|
9121
8889
|
while (search2.test(value)) {
|
|
9122
8890
|
indices.push(search2.lastIndex);
|
|
9123
8891
|
}
|
|
9124
8892
|
indices.push(value.length + 1);
|
|
9125
8893
|
return { toPoint, toOffset };
|
|
9126
8894
|
function toPoint(offset) {
|
|
9127
|
-
|
|
9128
|
-
if (offset > -1 && offset < indices[indices.length - 1]) {
|
|
8895
|
+
let index2 = -1;
|
|
8896
|
+
if (typeof offset === "number" && offset > -1 && offset < indices[indices.length - 1]) {
|
|
9129
8897
|
while (++index2 < indices.length) {
|
|
9130
8898
|
if (indices[index2] > offset) {
|
|
9131
8899
|
return {
|
|
9132
8900
|
line: index2 + 1,
|
|
9133
|
-
column: offset - (indices[index2 - 1]
|
|
8901
|
+
column: offset - (index2 > 0 ? indices[index2 - 1] : 0) + 1,
|
|
9134
8902
|
offset
|
|
9135
8903
|
};
|
|
9136
8904
|
}
|
|
@@ -9139,13 +8907,15 @@ function location(file) {
|
|
|
9139
8907
|
return { line: void 0, column: void 0, offset: void 0 };
|
|
9140
8908
|
}
|
|
9141
8909
|
function toOffset(point3) {
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
var offset;
|
|
8910
|
+
const line = point3 && point3.line;
|
|
8911
|
+
const column = point3 && point3.column;
|
|
9145
8912
|
if (typeof line === "number" && typeof column === "number" && !Number.isNaN(line) && !Number.isNaN(column) && line - 1 in indices) {
|
|
9146
|
-
offset = (indices[line - 2] || 0) + column - 1 || 0;
|
|
8913
|
+
const offset = (indices[line - 2] || 0) + column - 1 || 0;
|
|
8914
|
+
if (offset > -1 && offset < indices[indices.length - 1]) {
|
|
8915
|
+
return offset;
|
|
8916
|
+
}
|
|
9147
8917
|
}
|
|
9148
|
-
return
|
|
8918
|
+
return -1;
|
|
9149
8919
|
}
|
|
9150
8920
|
}
|
|
9151
8921
|
|
|
@@ -9161,125 +8931,160 @@ var webNamespaces = {
|
|
|
9161
8931
|
|
|
9162
8932
|
// ../../node_modules/hast-util-from-parse5/lib/index.js
|
|
9163
8933
|
var own6 = {}.hasOwnProperty;
|
|
9164
|
-
var
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
"#text": text2,
|
|
9168
|
-
"#comment": comment3,
|
|
9169
|
-
"#documentType": doctype2
|
|
9170
|
-
};
|
|
9171
|
-
function fromParse5(ast, options = {}) {
|
|
8934
|
+
var proto = Object.prototype;
|
|
8935
|
+
function fromParse5(tree, options) {
|
|
8936
|
+
const options_ = options || {};
|
|
9172
8937
|
let settings;
|
|
9173
8938
|
let file;
|
|
9174
|
-
if (isFile(
|
|
9175
|
-
file =
|
|
8939
|
+
if (isFile(options_)) {
|
|
8940
|
+
file = options_;
|
|
9176
8941
|
settings = {};
|
|
9177
8942
|
} else {
|
|
9178
|
-
file =
|
|
9179
|
-
settings =
|
|
8943
|
+
file = options_.file || void 0;
|
|
8944
|
+
settings = options_;
|
|
9180
8945
|
}
|
|
9181
|
-
return
|
|
8946
|
+
return one2(
|
|
9182
8947
|
{
|
|
9183
8948
|
schema: settings.space === "svg" ? svg2 : html2,
|
|
9184
8949
|
file,
|
|
9185
8950
|
verbose: settings.verbose,
|
|
9186
8951
|
location: false
|
|
9187
8952
|
},
|
|
9188
|
-
|
|
8953
|
+
tree
|
|
9189
8954
|
);
|
|
9190
8955
|
}
|
|
9191
|
-
function
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
8956
|
+
function one2(state, node) {
|
|
8957
|
+
let result;
|
|
8958
|
+
switch (node.nodeName) {
|
|
8959
|
+
case "#comment": {
|
|
8960
|
+
const reference = (
|
|
8961
|
+
/** @type {P5Comment} */
|
|
8962
|
+
node
|
|
8963
|
+
);
|
|
8964
|
+
result = { type: "comment", value: reference.data };
|
|
8965
|
+
patch(state, reference, result);
|
|
8966
|
+
return result;
|
|
8967
|
+
}
|
|
8968
|
+
case "#document":
|
|
8969
|
+
case "#document-fragment": {
|
|
8970
|
+
const reference = (
|
|
8971
|
+
/** @type {P5Document | P5DocumentFragment} */
|
|
8972
|
+
node
|
|
8973
|
+
);
|
|
8974
|
+
const quirksMode = "mode" in reference ? reference.mode === "quirks" || reference.mode === "limited-quirks" : false;
|
|
8975
|
+
result = {
|
|
8976
|
+
type: "root",
|
|
8977
|
+
children: all2(state, node.childNodes),
|
|
8978
|
+
data: { quirksMode }
|
|
8979
|
+
};
|
|
8980
|
+
if (state.file && state.location) {
|
|
8981
|
+
const doc = String(state.file);
|
|
8982
|
+
const loc = location(doc);
|
|
8983
|
+
const start = loc.toPoint(0);
|
|
8984
|
+
const end = loc.toPoint(doc.length);
|
|
8985
|
+
result.position = { start, end };
|
|
8986
|
+
}
|
|
8987
|
+
return result;
|
|
8988
|
+
}
|
|
8989
|
+
case "#documentType": {
|
|
8990
|
+
const reference = (
|
|
8991
|
+
/** @type {P5DocumentType} */
|
|
8992
|
+
node
|
|
8993
|
+
);
|
|
8994
|
+
result = { type: "doctype" };
|
|
8995
|
+
patch(state, reference, result);
|
|
8996
|
+
return result;
|
|
8997
|
+
}
|
|
8998
|
+
case "#text": {
|
|
8999
|
+
const reference = (
|
|
9000
|
+
/** @type {P5Text} */
|
|
9001
|
+
node
|
|
9002
|
+
);
|
|
9003
|
+
result = { type: "text", value: reference.value };
|
|
9004
|
+
patch(state, reference, result);
|
|
9005
|
+
return result;
|
|
9006
|
+
}
|
|
9007
|
+
default: {
|
|
9008
|
+
const reference = (
|
|
9009
|
+
/** @type {P5Element} */
|
|
9010
|
+
node
|
|
9011
|
+
);
|
|
9012
|
+
result = element2(state, reference);
|
|
9013
|
+
return result;
|
|
9207
9014
|
}
|
|
9208
9015
|
}
|
|
9209
|
-
ctx.schema = schema;
|
|
9210
|
-
return result;
|
|
9211
9016
|
}
|
|
9212
|
-
function
|
|
9017
|
+
function all2(state, nodes) {
|
|
9213
9018
|
let index2 = -1;
|
|
9214
9019
|
const result = [];
|
|
9215
|
-
while (++index2 <
|
|
9216
|
-
result[index2] =
|
|
9217
|
-
}
|
|
9218
|
-
return result;
|
|
9219
|
-
}
|
|
9220
|
-
function root(ctx, ast, children) {
|
|
9221
|
-
const result = {
|
|
9222
|
-
type: "root",
|
|
9223
|
-
children,
|
|
9224
|
-
data: { quirksMode: ast.mode === "quirks" || ast.mode === "limited-quirks" }
|
|
9225
|
-
};
|
|
9226
|
-
if (ctx.file && ctx.location) {
|
|
9227
|
-
const doc = String(ctx.file);
|
|
9228
|
-
const loc = location(doc);
|
|
9229
|
-
result.position = {
|
|
9230
|
-
start: loc.toPoint(0),
|
|
9231
|
-
end: loc.toPoint(doc.length)
|
|
9232
|
-
};
|
|
9020
|
+
while (++index2 < nodes.length) {
|
|
9021
|
+
result[index2] = one2(state, nodes[index2]);
|
|
9233
9022
|
}
|
|
9234
9023
|
return result;
|
|
9235
9024
|
}
|
|
9236
|
-
function
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
function text2(_, ast) {
|
|
9240
|
-
return { type: "text", value: ast.value };
|
|
9241
|
-
}
|
|
9242
|
-
function comment3(_, ast) {
|
|
9243
|
-
return { type: "comment", value: ast.data };
|
|
9244
|
-
}
|
|
9245
|
-
function element3(ctx, ast, children) {
|
|
9246
|
-
const fn = ctx.schema.space === "svg" ? s : h;
|
|
9025
|
+
function element2(state, node) {
|
|
9026
|
+
const schema = state.schema;
|
|
9027
|
+
state.schema = node.namespaceURI === webNamespaces.svg ? svg2 : html2;
|
|
9247
9028
|
let index2 = -1;
|
|
9248
9029
|
const props = {};
|
|
9249
|
-
while (++index2 <
|
|
9250
|
-
const attribute =
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9030
|
+
while (++index2 < node.attrs.length) {
|
|
9031
|
+
const attribute = node.attrs[index2];
|
|
9032
|
+
const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
|
|
9033
|
+
if (!own6.call(proto, name)) {
|
|
9034
|
+
props[name] = attribute.value;
|
|
9035
|
+
}
|
|
9036
|
+
}
|
|
9037
|
+
const fn = state.schema.space === "svg" ? s : h;
|
|
9038
|
+
const result = fn(node.tagName, props, all2(state, node.childNodes));
|
|
9039
|
+
patch(state, node, result);
|
|
9040
|
+
if (result.tagName === "template") {
|
|
9041
|
+
const reference = (
|
|
9042
|
+
/** @type {P5Template} */
|
|
9043
|
+
node
|
|
9044
|
+
);
|
|
9045
|
+
const pos = reference.sourceCodeLocation;
|
|
9256
9046
|
const startTag = pos && pos.startTag && position(pos.startTag);
|
|
9257
9047
|
const endTag = pos && pos.endTag && position(pos.endTag);
|
|
9258
|
-
const content =
|
|
9259
|
-
if (startTag && endTag &&
|
|
9048
|
+
const content = one2(state, reference.content);
|
|
9049
|
+
if (startTag && endTag && state.file) {
|
|
9260
9050
|
content.position = { start: startTag.end, end: endTag.start };
|
|
9261
9051
|
}
|
|
9262
9052
|
result.content = content;
|
|
9263
9053
|
}
|
|
9054
|
+
state.schema = schema;
|
|
9264
9055
|
return result;
|
|
9265
9056
|
}
|
|
9266
|
-
function
|
|
9057
|
+
function patch(state, from, to) {
|
|
9058
|
+
if ("sourceCodeLocation" in from && from.sourceCodeLocation && state.file) {
|
|
9059
|
+
const position3 = createLocation(state, to, from.sourceCodeLocation);
|
|
9060
|
+
if (position3) {
|
|
9061
|
+
state.location = true;
|
|
9062
|
+
to.position = position3;
|
|
9063
|
+
}
|
|
9064
|
+
}
|
|
9065
|
+
}
|
|
9066
|
+
function createLocation(state, node, location2) {
|
|
9267
9067
|
const result = position(location2);
|
|
9268
9068
|
if (node.type === "element") {
|
|
9269
9069
|
const tail = node.children[node.children.length - 1];
|
|
9270
9070
|
if (result && !location2.endTag && tail && tail.position && tail.position.end) {
|
|
9271
9071
|
result.end = Object.assign({}, tail.position.end);
|
|
9272
9072
|
}
|
|
9273
|
-
if (
|
|
9073
|
+
if (state.verbose) {
|
|
9274
9074
|
const props = {};
|
|
9275
9075
|
let key2;
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9076
|
+
if (location2.attrs) {
|
|
9077
|
+
for (key2 in location2.attrs) {
|
|
9078
|
+
if (own6.call(location2.attrs, key2)) {
|
|
9079
|
+
props[find(state.schema, key2).property] = position(
|
|
9080
|
+
location2.attrs[key2]
|
|
9081
|
+
);
|
|
9082
|
+
}
|
|
9279
9083
|
}
|
|
9280
9084
|
}
|
|
9281
9085
|
node.data = {
|
|
9282
9086
|
position: {
|
|
9087
|
+
// @ts-expect-error: assume not `undefined`.
|
|
9283
9088
|
opening: position(location2.startTag),
|
|
9284
9089
|
closing: location2.endTag ? position(location2.endTag) : null,
|
|
9285
9090
|
properties: props
|
|
@@ -9300,10 +9105,10 @@ function position(loc) {
|
|
|
9300
9105
|
column: loc.endCol,
|
|
9301
9106
|
offset: loc.endOffset
|
|
9302
9107
|
});
|
|
9303
|
-
return start || end ? { start, end } :
|
|
9108
|
+
return start || end ? { start, end } : void 0;
|
|
9304
9109
|
}
|
|
9305
9110
|
function point(point3) {
|
|
9306
|
-
return point3.line && point3.column ? point3 :
|
|
9111
|
+
return point3.line && point3.column ? point3 : void 0;
|
|
9307
9112
|
}
|
|
9308
9113
|
function isFile(value) {
|
|
9309
9114
|
return "messages" in value;
|
|
@@ -9736,7 +9541,7 @@ function wrap(middleware, callback) {
|
|
|
9736
9541
|
// ../../node_modules/vfile/lib/index.js
|
|
9737
9542
|
var import_is_buffer = __toESM(require_is_buffer2(), 1);
|
|
9738
9543
|
|
|
9739
|
-
// ../../node_modules/unist-util-stringify-position/index.js
|
|
9544
|
+
// ../../node_modules/unist-util-stringify-position/lib/index.js
|
|
9740
9545
|
function stringifyPosition(value) {
|
|
9741
9546
|
if (!value || typeof value !== "object") {
|
|
9742
9547
|
return "";
|
|
@@ -9762,21 +9567,26 @@ function index(value) {
|
|
|
9762
9567
|
return value && typeof value === "number" ? value : 1;
|
|
9763
9568
|
}
|
|
9764
9569
|
|
|
9765
|
-
// ../../node_modules/vfile-message/index.js
|
|
9570
|
+
// ../../node_modules/vfile-message/lib/index.js
|
|
9766
9571
|
var VFileMessage = class extends Error {
|
|
9767
9572
|
/**
|
|
9768
9573
|
* Create a message for `reason` at `place` from `origin`.
|
|
9769
9574
|
*
|
|
9770
9575
|
* When an error is passed in as `reason`, the `stack` is copied.
|
|
9771
9576
|
*
|
|
9772
|
-
* @param {string|Error|VFileMessage} reason
|
|
9773
|
-
* Reason for message.
|
|
9774
|
-
*
|
|
9775
|
-
*
|
|
9776
|
-
*
|
|
9777
|
-
*
|
|
9778
|
-
*
|
|
9577
|
+
* @param {string | Error | VFileMessage} reason
|
|
9578
|
+
* Reason for message, uses the stack and message of the error if given.
|
|
9579
|
+
*
|
|
9580
|
+
* > π **Note**: you should use markdown.
|
|
9581
|
+
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
|
|
9582
|
+
* Place in file where the message occurred.
|
|
9583
|
+
* @param {string | null | undefined} [origin]
|
|
9584
|
+
* Place in code where the message originates (example:
|
|
9585
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
9586
|
+
* @returns
|
|
9587
|
+
* Instance of `VFileMessage`.
|
|
9779
9588
|
*/
|
|
9589
|
+
// To do: next major: expose `undefined` everywhere instead of `null`.
|
|
9780
9590
|
constructor(reason, place, origin) {
|
|
9781
9591
|
const parts = [null, null];
|
|
9782
9592
|
let position3 = {
|
|
@@ -9852,10 +9662,10 @@ import { default as default3 } from "process";
|
|
|
9852
9662
|
import { fileURLToPath } from "url";
|
|
9853
9663
|
|
|
9854
9664
|
// ../../node_modules/vfile/lib/minurl.shared.js
|
|
9855
|
-
function isUrl(
|
|
9856
|
-
return
|
|
9857
|
-
|
|
9858
|
-
|
|
9665
|
+
function isUrl(fileUrlOrPath) {
|
|
9666
|
+
return fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && // @ts-expect-error: indexable.
|
|
9667
|
+
fileUrlOrPath.href && // @ts-expect-error: indexable.
|
|
9668
|
+
fileUrlOrPath.origin;
|
|
9859
9669
|
}
|
|
9860
9670
|
|
|
9861
9671
|
// ../../node_modules/vfile/lib/index.js
|
|
@@ -9864,25 +9674,30 @@ var VFile = class {
|
|
|
9864
9674
|
/**
|
|
9865
9675
|
* Create a new virtual file.
|
|
9866
9676
|
*
|
|
9867
|
-
*
|
|
9868
|
-
*
|
|
9869
|
-
*
|
|
9870
|
-
*
|
|
9677
|
+
* `options` is treated as:
|
|
9678
|
+
*
|
|
9679
|
+
* * `string` or `Buffer` β `{value: options}`
|
|
9680
|
+
* * `URL` β `{path: options}`
|
|
9681
|
+
* * `VFile` β shallow copies its data over to the new file
|
|
9682
|
+
* * `object` β all fields are shallow copied over to the new file
|
|
9871
9683
|
*
|
|
9872
9684
|
* Path related fields are set in the following order (least specific to
|
|
9873
9685
|
* most specific): `history`, `path`, `basename`, `stem`, `extname`,
|
|
9874
9686
|
* `dirname`.
|
|
9875
9687
|
*
|
|
9876
|
-
*
|
|
9877
|
-
*
|
|
9688
|
+
* You cannot set `dirname` or `extname` without setting either `history`,
|
|
9689
|
+
* `path`, `basename`, or `stem` too.
|
|
9878
9690
|
*
|
|
9879
|
-
* @param {Compatible} [value]
|
|
9691
|
+
* @param {Compatible | null | undefined} [value]
|
|
9692
|
+
* File value.
|
|
9693
|
+
* @returns
|
|
9694
|
+
* New instance.
|
|
9880
9695
|
*/
|
|
9881
9696
|
constructor(value) {
|
|
9882
9697
|
let options;
|
|
9883
9698
|
if (!value) {
|
|
9884
9699
|
options = {};
|
|
9885
|
-
} else if (typeof value === "string" || (
|
|
9700
|
+
} else if (typeof value === "string" || buffer(value)) {
|
|
9886
9701
|
options = { value };
|
|
9887
9702
|
} else if (isUrl(value)) {
|
|
9888
9703
|
options = { path: value };
|
|
@@ -9900,18 +9715,20 @@ var VFile = class {
|
|
|
9900
9715
|
let index2 = -1;
|
|
9901
9716
|
while (++index2 < order.length) {
|
|
9902
9717
|
const prop2 = order[index2];
|
|
9903
|
-
if (prop2 in options && options[prop2] !== void 0) {
|
|
9718
|
+
if (prop2 in options && options[prop2] !== void 0 && options[prop2] !== null) {
|
|
9904
9719
|
this[prop2] = prop2 === "history" ? [...options[prop2]] : options[prop2];
|
|
9905
9720
|
}
|
|
9906
9721
|
}
|
|
9907
9722
|
let prop;
|
|
9908
9723
|
for (prop in options) {
|
|
9909
|
-
if (!order.includes(prop))
|
|
9724
|
+
if (!order.includes(prop)) {
|
|
9910
9725
|
this[prop] = options[prop];
|
|
9726
|
+
}
|
|
9911
9727
|
}
|
|
9912
9728
|
}
|
|
9913
9729
|
/**
|
|
9914
9730
|
* Get the full path (example: `'~/index.min.js'`).
|
|
9731
|
+
*
|
|
9915
9732
|
* @returns {string}
|
|
9916
9733
|
*/
|
|
9917
9734
|
get path() {
|
|
@@ -9919,10 +9736,12 @@ var VFile = class {
|
|
|
9919
9736
|
}
|
|
9920
9737
|
/**
|
|
9921
9738
|
* Set the full path (example: `'~/index.min.js'`).
|
|
9739
|
+
*
|
|
9922
9740
|
* Cannot be nullified.
|
|
9923
9741
|
* You can set a file URL (a `URL` object with a `file:` protocol) which will
|
|
9924
9742
|
* be turned into a path with `url.fileURLToPath`.
|
|
9925
|
-
*
|
|
9743
|
+
*
|
|
9744
|
+
* @param {string | URL} path
|
|
9926
9745
|
*/
|
|
9927
9746
|
set path(path) {
|
|
9928
9747
|
if (isUrl(path)) {
|
|
@@ -9941,6 +9760,7 @@ var VFile = class {
|
|
|
9941
9760
|
}
|
|
9942
9761
|
/**
|
|
9943
9762
|
* Set the parent path (example: `'~'`).
|
|
9763
|
+
*
|
|
9944
9764
|
* Cannot be set if thereβs no `path` yet.
|
|
9945
9765
|
*/
|
|
9946
9766
|
set dirname(dirname) {
|
|
@@ -9955,6 +9775,7 @@ var VFile = class {
|
|
|
9955
9775
|
}
|
|
9956
9776
|
/**
|
|
9957
9777
|
* Set basename (including extname) (`'index.min.js'`).
|
|
9778
|
+
*
|
|
9958
9779
|
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
9959
9780
|
* on windows).
|
|
9960
9781
|
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
@@ -9972,6 +9793,7 @@ var VFile = class {
|
|
|
9972
9793
|
}
|
|
9973
9794
|
/**
|
|
9974
9795
|
* Set the extname (including dot) (example: `'.js'`).
|
|
9796
|
+
*
|
|
9975
9797
|
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
9976
9798
|
* on windows).
|
|
9977
9799
|
* Cannot be set if thereβs no `path` yet.
|
|
@@ -9997,6 +9819,7 @@ var VFile = class {
|
|
|
9997
9819
|
}
|
|
9998
9820
|
/**
|
|
9999
9821
|
* Set the stem (basename w/o extname) (example: `'index.min'`).
|
|
9822
|
+
*
|
|
10000
9823
|
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
10001
9824
|
* on windows).
|
|
10002
9825
|
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
@@ -10009,26 +9832,28 @@ var VFile = class {
|
|
|
10009
9832
|
/**
|
|
10010
9833
|
* Serialize the file.
|
|
10011
9834
|
*
|
|
10012
|
-
* @param {BufferEncoding} [encoding='utf8']
|
|
10013
|
-
*
|
|
10014
|
-
*
|
|
9835
|
+
* @param {BufferEncoding | null | undefined} [encoding='utf8']
|
|
9836
|
+
* Character encoding to understand `value` as when itβs a `Buffer`
|
|
9837
|
+
* (default: `'utf8'`).
|
|
10015
9838
|
* @returns {string}
|
|
10016
9839
|
* Serialized file.
|
|
10017
9840
|
*/
|
|
10018
9841
|
toString(encoding) {
|
|
10019
|
-
return (this.value || "").toString(encoding);
|
|
9842
|
+
return (this.value || "").toString(encoding || void 0);
|
|
10020
9843
|
}
|
|
10021
9844
|
/**
|
|
10022
|
-
*
|
|
10023
|
-
*
|
|
10024
|
-
* `
|
|
9845
|
+
* Create a warning message associated with the file.
|
|
9846
|
+
*
|
|
9847
|
+
* Its `fatal` is set to `false` and `file` is set to the current file path.
|
|
9848
|
+
* Its added to `file.messages`.
|
|
10025
9849
|
*
|
|
10026
|
-
* @param {string|Error|VFileMessage} reason
|
|
10027
|
-
*
|
|
10028
|
-
* @param {Node|NodeLike|Position|Point} [place]
|
|
10029
|
-
* Place where the message occurred
|
|
10030
|
-
* @param {string} [origin]
|
|
10031
|
-
*
|
|
9850
|
+
* @param {string | Error | VFileMessage} reason
|
|
9851
|
+
* Reason for message, uses the stack and message of the error if given.
|
|
9852
|
+
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
|
|
9853
|
+
* Place in file where the message occurred.
|
|
9854
|
+
* @param {string | null | undefined} [origin]
|
|
9855
|
+
* Place in code where the message originates (example:
|
|
9856
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
10032
9857
|
* @returns {VFileMessage}
|
|
10033
9858
|
* Message.
|
|
10034
9859
|
*/
|
|
@@ -10043,15 +9868,18 @@ var VFile = class {
|
|
|
10043
9868
|
return message;
|
|
10044
9869
|
}
|
|
10045
9870
|
/**
|
|
10046
|
-
*
|
|
10047
|
-
* `fatal` is set to `null`.
|
|
9871
|
+
* Create an info message associated with the file.
|
|
10048
9872
|
*
|
|
10049
|
-
*
|
|
10050
|
-
*
|
|
10051
|
-
*
|
|
10052
|
-
*
|
|
10053
|
-
*
|
|
10054
|
-
*
|
|
9873
|
+
* Its `fatal` is set to `null` and `file` is set to the current file path.
|
|
9874
|
+
* Its added to `file.messages`.
|
|
9875
|
+
*
|
|
9876
|
+
* @param {string | Error | VFileMessage} reason
|
|
9877
|
+
* Reason for message, uses the stack and message of the error if given.
|
|
9878
|
+
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
|
|
9879
|
+
* Place in file where the message occurred.
|
|
9880
|
+
* @param {string | null | undefined} [origin]
|
|
9881
|
+
* Place in code where the message originates (example:
|
|
9882
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
10055
9883
|
* @returns {VFileMessage}
|
|
10056
9884
|
* Message.
|
|
10057
9885
|
*/
|
|
@@ -10061,19 +9889,24 @@ var VFile = class {
|
|
|
10061
9889
|
return message;
|
|
10062
9890
|
}
|
|
10063
9891
|
/**
|
|
10064
|
-
*
|
|
10065
|
-
*
|
|
9892
|
+
* Create a fatal error associated with the file.
|
|
9893
|
+
*
|
|
9894
|
+
* Its `fatal` is set to `true` and `file` is set to the current file path.
|
|
9895
|
+
* Its added to `file.messages`.
|
|
10066
9896
|
*
|
|
10067
9897
|
* > π **Note**: a fatal error means that a file is no longer processable.
|
|
10068
9898
|
*
|
|
10069
|
-
* @param {string|Error|VFileMessage} reason
|
|
10070
|
-
*
|
|
10071
|
-
* @param {Node|NodeLike|Position|Point} [place]
|
|
10072
|
-
* Place where the message occurred
|
|
10073
|
-
* @param {string} [origin]
|
|
10074
|
-
*
|
|
9899
|
+
* @param {string | Error | VFileMessage} reason
|
|
9900
|
+
* Reason for message, uses the stack and message of the error if given.
|
|
9901
|
+
* @param {Node | NodeLike | Position | Point | null | undefined} [place]
|
|
9902
|
+
* Place in file where the message occurred.
|
|
9903
|
+
* @param {string | null | undefined} [origin]
|
|
9904
|
+
* Place in code where the message originates (example:
|
|
9905
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
10075
9906
|
* @returns {never}
|
|
10076
9907
|
* Message.
|
|
9908
|
+
* @throws {VFileMessage}
|
|
9909
|
+
* Message.
|
|
10077
9910
|
*/
|
|
10078
9911
|
fail(reason, place, origin) {
|
|
10079
9912
|
const message = this.message(reason, place, origin);
|
|
@@ -10098,6 +9931,9 @@ function assertPath(path, name) {
|
|
|
10098
9931
|
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
|
10099
9932
|
}
|
|
10100
9933
|
}
|
|
9934
|
+
function buffer(value) {
|
|
9935
|
+
return (0, import_is_buffer.default)(value);
|
|
9936
|
+
}
|
|
10101
9937
|
|
|
10102
9938
|
// ../../node_modules/unified/lib/index.js
|
|
10103
9939
|
var unified = base2().freeze();
|
|
@@ -10449,12 +10285,12 @@ var wrapLines = function wrapLines2(ast, linesToHighlight) {
|
|
|
10449
10285
|
const highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0;
|
|
10450
10286
|
const allLines = Array.from(new Set(ast.map((x) => x.lineNumber)));
|
|
10451
10287
|
let i = 0;
|
|
10452
|
-
const wrapped = allLines.reduce((
|
|
10288
|
+
const wrapped = allLines.reduce((nodes, marker) => {
|
|
10453
10289
|
const line = marker;
|
|
10454
10290
|
const children = [];
|
|
10455
10291
|
for (; i < ast.length; i++) {
|
|
10456
10292
|
if (ast[i].lineNumber < line) {
|
|
10457
|
-
|
|
10293
|
+
nodes.push(ast[i]);
|
|
10458
10294
|
continue;
|
|
10459
10295
|
}
|
|
10460
10296
|
if (ast[i].lineNumber === line) {
|
|
@@ -10465,7 +10301,7 @@ var wrapLines = function wrapLines2(ast, linesToHighlight) {
|
|
|
10465
10301
|
break;
|
|
10466
10302
|
}
|
|
10467
10303
|
}
|
|
10468
|
-
|
|
10304
|
+
nodes.push({
|
|
10469
10305
|
type: "element",
|
|
10470
10306
|
tagName: "div",
|
|
10471
10307
|
properties: {
|
|
@@ -10476,7 +10312,7 @@ var wrapLines = function wrapLines2(ast, linesToHighlight) {
|
|
|
10476
10312
|
children,
|
|
10477
10313
|
lineNumber: line
|
|
10478
10314
|
});
|
|
10479
|
-
return
|
|
10315
|
+
return nodes;
|
|
10480
10316
|
}, []);
|
|
10481
10317
|
return wrapped;
|
|
10482
10318
|
};
|