import { i as __toESM, n as __commonJSMin, r as __exportAll, t as require_react } from "./react-DMmEJb6B.js"; import { t as require_jsx_runtime } from "./react_jsx-runtime.js"; import { A as unreachable, C as splice, D as codes, E as constants, O as toString$1, S as push, T as types, _ as markdownSpace, a as resolveAll, b as normalizeIdentifier, c as asciiAlpha, d as asciiControl, f as asciiDigit, g as markdownLineEndingOrSpace, h as markdownLineEnding, i as blankLine, k as ok, l as asciiAlphanumeric, m as asciiPunctuation, o as classifyCharacter, p as asciiHexDigit, s as factorySpace, t as visit, u as asciiAtext, w as values, x as combineExtensions } from "./lib-D17qFPzW.js"; //#region ../node_modules/comma-separated-tokens/index.js /** * Serialize an array of strings or numbers to comma-separated tokens. * * @param {Array} values * List of tokens. * @param {Options} [options] * Configuration for `stringify` (optional). * @returns {string} * Comma-separated tokens. */ function stringify$1(values, options) { const settings = options || {}; return (values[values.length - 1] === "" ? [...values, ""] : values).join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim(); } //#endregion //#region ../node_modules/estree-util-is-identifier-name/lib/index.js var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u; var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u; /** @type {Options} */ var emptyOptions$1 = {}; /** * Checks if the given value is a valid identifier name. * * @param {string} name * Identifier to check. * @param {Options | null | undefined} [options] * Configuration (optional). * @returns {boolean} * Whether `name` can be an identifier. */ function name(name, options) { return ((options || emptyOptions$1).jsx ? nameReJsx : nameRe).test(name); } //#endregion //#region ../node_modules/hast-util-whitespace/lib/index.js /** * @typedef {import('hast').Nodes} Nodes */ var re = /[ \t\n\f\r]/g; /** * Check if the given value is *inter-element whitespace*. * * @param {Nodes | string} thing * Thing to check (`Node` or `string`). * @returns {boolean} * Whether the `value` is inter-element whitespace (`boolean`): consisting of * zero or more of space, tab (`\t`), line feed (`\n`), carriage return * (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node, * whose `value` field is checked. */ function whitespace(thing) { return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing); } /** * @param {string} value * @returns {boolean} */ function empty(value) { return value.replace(re, "") === ""; } //#endregion //#region ../node_modules/property-information/lib/util/schema.js /** * @import {Schema as SchemaType, Space} from 'property-information' */ /** @type {SchemaType} */ var Schema = class { /** * @param {SchemaType['property']} property * Property. * @param {SchemaType['normal']} normal * Normal. * @param {Space | undefined} [space] * Space. * @returns * Schema. */ constructor(property, normal, space) { this.normal = normal; this.property = property; if (space) this.space = space; } }; Schema.prototype.normal = {}; Schema.prototype.property = {}; Schema.prototype.space = void 0; //#endregion //#region ../node_modules/property-information/lib/util/merge.js /** * @import {Info, Space} from 'property-information' */ /** * @param {ReadonlyArray} definitions * Definitions. * @param {Space | undefined} [space] * Space. * @returns {Schema} * Schema. */ function merge(definitions, space) { /** @type {Record} */ const property = {}; /** @type {Record} */ const normal = {}; for (const definition of definitions) { Object.assign(property, definition.property); Object.assign(normal, definition.normal); } return new Schema(property, normal, space); } //#endregion //#region ../node_modules/property-information/lib/normalize.js /** * Get the cleaned case insensitive form of an attribute or property. * * @param {string} value * An attribute-like or property-like name. * @returns {string} * Value that can be used to look up the properly cased property on a * `Schema`. */ function normalize$1(value) { return value.toLowerCase(); } //#endregion //#region ../node_modules/property-information/lib/util/info.js /** * @import {Info as InfoType} from 'property-information' */ /** @type {InfoType} */ var Info = class { /** * @param {string} property * Property. * @param {string} attribute * Attribute. * @returns * Info. */ constructor(property, attribute) { this.attribute = attribute; this.property = property; } }; Info.prototype.attribute = ""; Info.prototype.booleanish = false; Info.prototype.boolean = false; Info.prototype.commaOrSpaceSeparated = false; Info.prototype.commaSeparated = false; Info.prototype.defined = false; Info.prototype.mustUseProperty = false; Info.prototype.number = false; Info.prototype.overloadedBoolean = false; Info.prototype.property = ""; Info.prototype.spaceSeparated = false; Info.prototype.space = void 0; //#endregion //#region ../node_modules/property-information/lib/util/types.js var types_exports = /* @__PURE__ */ __exportAll({ boolean: () => boolean, booleanish: () => booleanish, commaOrSpaceSeparated: () => commaOrSpaceSeparated, commaSeparated: () => commaSeparated, number: () => number, overloadedBoolean: () => overloadedBoolean, spaceSeparated: () => spaceSeparated }); var powers = 0; var boolean = increment(); var booleanish = increment(); var overloadedBoolean = increment(); var number = increment(); var spaceSeparated = increment(); var commaSeparated = increment(); var commaOrSpaceSeparated = increment(); function increment() { return 2 ** ++powers; } //#endregion //#region ../node_modules/property-information/lib/util/defined-info.js /** * @import {Space} from 'property-information' */ var checks = Object.keys(types_exports); var DefinedInfo = class extends Info { /** * @constructor * @param {string} property * Property. * @param {string} attribute * Attribute. * @param {number | null | undefined} [mask] * Mask. * @param {Space | undefined} [space] * Space. * @returns * Info. */ constructor(property, attribute, mask, space) { let index = -1; super(property, attribute); mark(this, "space", space); if (typeof mask === "number") while (++index < checks.length) { const check = checks[index]; mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]); } } }; DefinedInfo.prototype.defined = true; /** * @template {keyof DefinedInfo} Key * Key type. * @param {DefinedInfo} values * Info. * @param {Key} key * Key. * @param {DefinedInfo[Key]} value * Value. * @returns {undefined} * Nothing. */ function mark(values, key, value) { if (value) values[key] = value; } //#endregion //#region ../node_modules/property-information/lib/util/create.js /** * @import {Info, Space} from 'property-information' */ /** * @typedef Definition * Definition of a schema. * @property {Record | undefined} [attributes] * Normalzed names to special attribute case. * @property {ReadonlyArray | undefined} [mustUseProperty] * Normalized names that must be set as properties. * @property {Record} properties * Property names to their types. * @property {Space | undefined} [space] * Space. * @property {Transform} transform * Transform a property name. */ /** * @callback Transform * Transform. * @param {Record} attributes * Attributes. * @param {string} property * Property. * @returns {string} * Attribute. */ /** * @param {Definition} definition * Definition. * @returns {Schema} * Schema. */ function create(definition) { /** @type {Record} */ const properties = {}; /** @type {Record} */ const normals = {}; for (const [property, value] of Object.entries(definition.properties)) { const info = new DefinedInfo(property, definition.transform(definition.attributes || {}, property), value, definition.space); if (definition.mustUseProperty && definition.mustUseProperty.includes(property)) info.mustUseProperty = true; properties[property] = info; normals[normalize$1(property)] = property; normals[normalize$1(info.attribute)] = property; } return new Schema(properties, normals, definition.space); } //#endregion //#region ../node_modules/property-information/lib/aria.js var aria = create({ properties: { ariaActiveDescendant: null, ariaAtomic: booleanish, ariaAutoComplete: null, ariaBusy: booleanish, ariaChecked: booleanish, ariaColCount: number, ariaColIndex: number, ariaColSpan: number, ariaControls: spaceSeparated, ariaCurrent: null, ariaDescribedBy: spaceSeparated, ariaDetails: null, ariaDisabled: booleanish, ariaDropEffect: spaceSeparated, ariaErrorMessage: null, ariaExpanded: booleanish, ariaFlowTo: spaceSeparated, ariaGrabbed: booleanish, ariaHasPopup: null, ariaHidden: booleanish, ariaInvalid: null, ariaKeyShortcuts: null, ariaLabel: null, ariaLabelledBy: spaceSeparated, ariaLevel: number, ariaLive: null, ariaModal: booleanish, ariaMultiLine: booleanish, ariaMultiSelectable: booleanish, ariaOrientation: null, ariaOwns: spaceSeparated, ariaPlaceholder: null, ariaPosInSet: number, ariaPressed: booleanish, ariaReadOnly: booleanish, ariaRelevant: null, ariaRequired: booleanish, ariaRoleDescription: spaceSeparated, ariaRowCount: number, ariaRowIndex: number, ariaRowSpan: number, ariaSelected: booleanish, ariaSetSize: number, ariaSort: null, ariaValueMax: number, ariaValueMin: number, ariaValueNow: number, ariaValueText: null, role: null }, transform(_, property) { return property === "role" ? property : "aria-" + property.slice(4).toLowerCase(); } }); //#endregion //#region ../node_modules/property-information/lib/util/case-sensitive-transform.js /** * @param {Record} attributes * Attributes. * @param {string} attribute * Attribute. * @returns {string} * Transformed attribute. */ function caseSensitiveTransform(attributes, attribute) { return attribute in attributes ? attributes[attribute] : attribute; } //#endregion //#region ../node_modules/property-information/lib/util/case-insensitive-transform.js /** * @param {Record} attributes * Attributes. * @param {string} property * Property. * @returns {string} * Transformed property. */ function caseInsensitiveTransform(attributes, property) { return caseSensitiveTransform(attributes, property.toLowerCase()); } //#endregion //#region ../node_modules/property-information/lib/html.js var html$2 = create({ attributes: { acceptcharset: "accept-charset", classname: "class", htmlfor: "for", httpequiv: "http-equiv" }, mustUseProperty: [ "checked", "multiple", "muted", "selected" ], properties: { abbr: null, accept: commaSeparated, acceptCharset: spaceSeparated, accessKey: spaceSeparated, action: null, allow: null, allowFullScreen: boolean, allowPaymentRequest: boolean, allowUserMedia: boolean, alt: null, as: null, async: boolean, autoCapitalize: null, autoComplete: spaceSeparated, autoFocus: boolean, autoPlay: boolean, blocking: spaceSeparated, capture: null, charSet: null, checked: boolean, cite: null, className: spaceSeparated, cols: number, colSpan: null, content: null, contentEditable: booleanish, controls: boolean, controlsList: spaceSeparated, coords: number | commaSeparated, crossOrigin: null, data: null, dateTime: null, decoding: null, default: boolean, defer: boolean, dir: null, dirName: null, disabled: boolean, download: overloadedBoolean, draggable: booleanish, encType: null, enterKeyHint: null, fetchPriority: null, form: null, formAction: null, formEncType: null, formMethod: null, formNoValidate: boolean, formTarget: null, headers: spaceSeparated, height: number, hidden: overloadedBoolean, high: number, href: null, hrefLang: null, htmlFor: spaceSeparated, httpEquiv: spaceSeparated, id: null, imageSizes: null, imageSrcSet: null, inert: boolean, inputMode: null, integrity: null, is: null, isMap: boolean, itemId: null, itemProp: spaceSeparated, itemRef: spaceSeparated, itemScope: boolean, itemType: spaceSeparated, kind: null, label: null, lang: null, language: null, list: null, loading: null, loop: boolean, low: number, manifest: null, max: null, maxLength: number, media: null, method: null, min: null, minLength: number, multiple: boolean, muted: boolean, name: null, nonce: null, noModule: boolean, noValidate: boolean, onAbort: null, onAfterPrint: null, onAuxClick: null, onBeforeMatch: null, onBeforePrint: null, onBeforeToggle: null, onBeforeUnload: null, onBlur: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onContextLost: null, onContextMenu: null, onContextRestored: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnded: null, onError: null, onFocus: null, onFormData: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLanguageChange: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadEnd: null, onLoadStart: null, onMessage: null, onMessageError: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRejectionHandled: null, onReset: null, onResize: null, onScroll: null, onScrollEnd: null, onSecurityPolicyViolation: null, onSeeked: null, onSeeking: null, onSelect: null, onSlotChange: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnhandledRejection: null, onUnload: null, onVolumeChange: null, onWaiting: null, onWheel: null, open: boolean, optimum: number, pattern: null, ping: spaceSeparated, placeholder: null, playsInline: boolean, popover: null, popoverTarget: null, popoverTargetAction: null, poster: null, preload: null, readOnly: boolean, referrerPolicy: null, rel: spaceSeparated, required: boolean, reversed: boolean, rows: number, rowSpan: number, sandbox: spaceSeparated, scope: null, scoped: boolean, seamless: boolean, selected: boolean, shadowRootClonable: boolean, shadowRootDelegatesFocus: boolean, shadowRootMode: null, shape: null, size: number, sizes: null, slot: null, span: number, spellCheck: booleanish, src: null, srcDoc: null, srcLang: null, srcSet: null, start: number, step: null, style: null, tabIndex: number, target: null, title: null, translate: null, type: null, typeMustMatch: boolean, useMap: null, value: booleanish, width: number, wrap: null, writingSuggestions: null, align: null, aLink: null, archive: spaceSeparated, axis: null, background: null, bgColor: null, border: number, borderColor: null, bottomMargin: number, cellPadding: null, cellSpacing: null, char: null, charOff: null, classId: null, clear: null, code: null, codeBase: null, codeType: null, color: null, compact: boolean, declare: boolean, event: null, face: null, frame: null, frameBorder: null, hSpace: number, leftMargin: number, link: null, longDesc: null, lowSrc: null, marginHeight: number, marginWidth: number, noResize: boolean, noHref: boolean, noShade: boolean, noWrap: boolean, object: null, profile: null, prompt: null, rev: null, rightMargin: number, rules: null, scheme: null, scrolling: booleanish, standby: null, summary: null, text: null, topMargin: number, valueType: null, version: null, vAlign: null, vLink: null, vSpace: number, allowTransparency: null, autoCorrect: null, autoSave: null, disablePictureInPicture: boolean, disableRemotePlayback: boolean, prefix: null, property: null, results: number, security: null, unselectable: null }, space: "html", transform: caseInsensitiveTransform }); //#endregion //#region ../node_modules/property-information/lib/svg.js var svg$1 = create({ attributes: { accentHeight: "accent-height", alignmentBaseline: "alignment-baseline", arabicForm: "arabic-form", baselineShift: "baseline-shift", capHeight: "cap-height", className: "class", clipPath: "clip-path", clipRule: "clip-rule", colorInterpolation: "color-interpolation", colorInterpolationFilters: "color-interpolation-filters", colorProfile: "color-profile", colorRendering: "color-rendering", crossOrigin: "crossorigin", dataType: "datatype", dominantBaseline: "dominant-baseline", enableBackground: "enable-background", fillOpacity: "fill-opacity", fillRule: "fill-rule", floodColor: "flood-color", floodOpacity: "flood-opacity", fontFamily: "font-family", fontSize: "font-size", fontSizeAdjust: "font-size-adjust", fontStretch: "font-stretch", fontStyle: "font-style", fontVariant: "font-variant", fontWeight: "font-weight", glyphName: "glyph-name", glyphOrientationHorizontal: "glyph-orientation-horizontal", glyphOrientationVertical: "glyph-orientation-vertical", hrefLang: "hreflang", horizAdvX: "horiz-adv-x", horizOriginX: "horiz-origin-x", horizOriginY: "horiz-origin-y", imageRendering: "image-rendering", letterSpacing: "letter-spacing", lightingColor: "lighting-color", markerEnd: "marker-end", markerMid: "marker-mid", markerStart: "marker-start", navDown: "nav-down", navDownLeft: "nav-down-left", navDownRight: "nav-down-right", navLeft: "nav-left", navNext: "nav-next", navPrev: "nav-prev", navRight: "nav-right", navUp: "nav-up", navUpLeft: "nav-up-left", navUpRight: "nav-up-right", onAbort: "onabort", onActivate: "onactivate", onAfterPrint: "onafterprint", onBeforePrint: "onbeforeprint", onBegin: "onbegin", onCancel: "oncancel", onCanPlay: "oncanplay", onCanPlayThrough: "oncanplaythrough", onChange: "onchange", onClick: "onclick", onClose: "onclose", onCopy: "oncopy", onCueChange: "oncuechange", onCut: "oncut", onDblClick: "ondblclick", onDrag: "ondrag", onDragEnd: "ondragend", onDragEnter: "ondragenter", onDragExit: "ondragexit", onDragLeave: "ondragleave", onDragOver: "ondragover", onDragStart: "ondragstart", onDrop: "ondrop", onDurationChange: "ondurationchange", onEmptied: "onemptied", onEnd: "onend", onEnded: "onended", onError: "onerror", onFocus: "onfocus", onFocusIn: "onfocusin", onFocusOut: "onfocusout", onHashChange: "onhashchange", onInput: "oninput", onInvalid: "oninvalid", onKeyDown: "onkeydown", onKeyPress: "onkeypress", onKeyUp: "onkeyup", onLoad: "onload", onLoadedData: "onloadeddata", onLoadedMetadata: "onloadedmetadata", onLoadStart: "onloadstart", onMessage: "onmessage", onMouseDown: "onmousedown", onMouseEnter: "onmouseenter", onMouseLeave: "onmouseleave", onMouseMove: "onmousemove", onMouseOut: "onmouseout", onMouseOver: "onmouseover", onMouseUp: "onmouseup", onMouseWheel: "onmousewheel", onOffline: "onoffline", onOnline: "ononline", onPageHide: "onpagehide", onPageShow: "onpageshow", onPaste: "onpaste", onPause: "onpause", onPlay: "onplay", onPlaying: "onplaying", onPopState: "onpopstate", onProgress: "onprogress", onRateChange: "onratechange", onRepeat: "onrepeat", onReset: "onreset", onResize: "onresize", onScroll: "onscroll", onSeeked: "onseeked", onSeeking: "onseeking", onSelect: "onselect", onShow: "onshow", onStalled: "onstalled", onStorage: "onstorage", onSubmit: "onsubmit", onSuspend: "onsuspend", onTimeUpdate: "ontimeupdate", onToggle: "ontoggle", onUnload: "onunload", onVolumeChange: "onvolumechange", onWaiting: "onwaiting", onZoom: "onzoom", overlinePosition: "overline-position", overlineThickness: "overline-thickness", paintOrder: "paint-order", panose1: "panose-1", pointerEvents: "pointer-events", referrerPolicy: "referrerpolicy", renderingIntent: "rendering-intent", shapeRendering: "shape-rendering", stopColor: "stop-color", stopOpacity: "stop-opacity", strikethroughPosition: "strikethrough-position", strikethroughThickness: "strikethrough-thickness", strokeDashArray: "stroke-dasharray", strokeDashOffset: "stroke-dashoffset", strokeLineCap: "stroke-linecap", strokeLineJoin: "stroke-linejoin", strokeMiterLimit: "stroke-miterlimit", strokeOpacity: "stroke-opacity", strokeWidth: "stroke-width", tabIndex: "tabindex", textAnchor: "text-anchor", textDecoration: "text-decoration", textRendering: "text-rendering", transformOrigin: "transform-origin", typeOf: "typeof", underlinePosition: "underline-position", underlineThickness: "underline-thickness", unicodeBidi: "unicode-bidi", unicodeRange: "unicode-range", unitsPerEm: "units-per-em", vAlphabetic: "v-alphabetic", vHanging: "v-hanging", vIdeographic: "v-ideographic", vMathematical: "v-mathematical", vectorEffect: "vector-effect", vertAdvY: "vert-adv-y", vertOriginX: "vert-origin-x", vertOriginY: "vert-origin-y", wordSpacing: "word-spacing", writingMode: "writing-mode", xHeight: "x-height", playbackOrder: "playbackorder", timelineBegin: "timelinebegin" }, properties: { about: commaOrSpaceSeparated, accentHeight: number, accumulate: null, additive: null, alignmentBaseline: null, alphabetic: number, amplitude: number, arabicForm: null, ascent: number, attributeName: null, attributeType: null, azimuth: number, bandwidth: null, baselineShift: null, baseFrequency: null, baseProfile: null, bbox: null, begin: null, bias: number, by: null, calcMode: null, capHeight: number, className: spaceSeparated, clip: null, clipPath: null, clipPathUnits: null, clipRule: null, color: null, colorInterpolation: null, colorInterpolationFilters: null, colorProfile: null, colorRendering: null, content: null, contentScriptType: null, contentStyleType: null, crossOrigin: null, cursor: null, cx: null, cy: null, d: null, dataType: null, defaultAction: null, descent: number, diffuseConstant: number, direction: null, display: null, dur: null, divisor: number, dominantBaseline: null, download: boolean, dx: null, dy: null, edgeMode: null, editable: null, elevation: number, enableBackground: null, end: null, event: null, exponent: number, externalResourcesRequired: null, fill: null, fillOpacity: number, fillRule: null, filter: null, filterRes: null, filterUnits: null, floodColor: null, floodOpacity: null, focusable: null, focusHighlight: null, fontFamily: null, fontSize: null, fontSizeAdjust: null, fontStretch: null, fontStyle: null, fontVariant: null, fontWeight: null, format: null, fr: null, from: null, fx: null, fy: null, g1: commaSeparated, g2: commaSeparated, glyphName: commaSeparated, glyphOrientationHorizontal: null, glyphOrientationVertical: null, glyphRef: null, gradientTransform: null, gradientUnits: null, handler: null, hanging: number, hatchContentUnits: null, hatchUnits: null, height: null, href: null, hrefLang: null, horizAdvX: number, horizOriginX: number, horizOriginY: number, id: null, ideographic: number, imageRendering: null, initialVisibility: null, in: null, in2: null, intercept: number, k: number, k1: number, k2: number, k3: number, k4: number, kernelMatrix: commaOrSpaceSeparated, kernelUnitLength: null, keyPoints: null, keySplines: null, keyTimes: null, kerning: null, lang: null, lengthAdjust: null, letterSpacing: null, lightingColor: null, limitingConeAngle: number, local: null, markerEnd: null, markerMid: null, markerStart: null, markerHeight: null, markerUnits: null, markerWidth: null, mask: null, maskContentUnits: null, maskUnits: null, mathematical: null, max: null, media: null, mediaCharacterEncoding: null, mediaContentEncodings: null, mediaSize: number, mediaTime: null, method: null, min: null, mode: null, name: null, navDown: null, navDownLeft: null, navDownRight: null, navLeft: null, navNext: null, navPrev: null, navRight: null, navUp: null, navUpLeft: null, navUpRight: null, numOctaves: null, observer: null, offset: null, onAbort: null, onActivate: null, onAfterPrint: null, onBeforePrint: null, onBegin: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnd: null, onEnded: null, onError: null, onFocus: null, onFocusIn: null, onFocusOut: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadStart: null, onMessage: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onMouseWheel: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRepeat: null, onReset: null, onResize: null, onScroll: null, onSeeked: null, onSeeking: null, onSelect: null, onShow: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnload: null, onVolumeChange: null, onWaiting: null, onZoom: null, opacity: null, operator: null, order: null, orient: null, orientation: null, origin: null, overflow: null, overlay: null, overlinePosition: number, overlineThickness: number, paintOrder: null, panose1: null, path: null, pathLength: number, patternContentUnits: null, patternTransform: null, patternUnits: null, phase: null, ping: spaceSeparated, pitch: null, playbackOrder: null, pointerEvents: null, points: null, pointsAtX: number, pointsAtY: number, pointsAtZ: number, preserveAlpha: null, preserveAspectRatio: null, primitiveUnits: null, propagate: null, property: commaOrSpaceSeparated, r: null, radius: null, referrerPolicy: null, refX: null, refY: null, rel: commaOrSpaceSeparated, rev: commaOrSpaceSeparated, renderingIntent: null, repeatCount: null, repeatDur: null, requiredExtensions: commaOrSpaceSeparated, requiredFeatures: commaOrSpaceSeparated, requiredFonts: commaOrSpaceSeparated, requiredFormats: commaOrSpaceSeparated, resource: null, restart: null, result: null, rotate: null, rx: null, ry: null, scale: null, seed: null, shapeRendering: null, side: null, slope: null, snapshotTime: null, specularConstant: number, specularExponent: number, spreadMethod: null, spacing: null, startOffset: null, stdDeviation: null, stemh: null, stemv: null, stitchTiles: null, stopColor: null, stopOpacity: null, strikethroughPosition: number, strikethroughThickness: number, string: null, stroke: null, strokeDashArray: commaOrSpaceSeparated, strokeDashOffset: null, strokeLineCap: null, strokeLineJoin: null, strokeMiterLimit: number, strokeOpacity: number, strokeWidth: null, style: null, surfaceScale: number, syncBehavior: null, syncBehaviorDefault: null, syncMaster: null, syncTolerance: null, syncToleranceDefault: null, systemLanguage: commaOrSpaceSeparated, tabIndex: number, tableValues: null, target: null, targetX: number, targetY: number, textAnchor: null, textDecoration: null, textRendering: null, textLength: null, timelineBegin: null, title: null, transformBehavior: null, type: null, typeOf: commaOrSpaceSeparated, to: null, transform: null, transformOrigin: null, u1: null, u2: null, underlinePosition: number, underlineThickness: number, unicode: null, unicodeBidi: null, unicodeRange: null, unitsPerEm: number, values: null, vAlphabetic: number, vMathematical: number, vectorEffect: null, vHanging: number, vIdeographic: number, version: null, vertAdvY: number, vertOriginX: number, vertOriginY: number, viewBox: null, viewTarget: null, visibility: null, width: null, widths: null, wordSpacing: null, writingMode: null, x: null, x1: null, x2: null, xChannelSelector: null, xHeight: number, y: null, y1: null, y2: null, yChannelSelector: null, z: null, zoomAndPan: null }, space: "svg", transform: caseSensitiveTransform }); //#endregion //#region ../node_modules/property-information/lib/xlink.js var xlink = create({ properties: { xLinkActuate: null, xLinkArcRole: null, xLinkHref: null, xLinkRole: null, xLinkShow: null, xLinkTitle: null, xLinkType: null }, space: "xlink", transform(_, property) { return "xlink:" + property.slice(5).toLowerCase(); } }); //#endregion //#region ../node_modules/property-information/lib/xmlns.js var xmlns = create({ attributes: { xmlnsxlink: "xmlns:xlink" }, properties: { xmlnsXLink: null, xmlns: null }, space: "xmlns", transform: caseInsensitiveTransform }); //#endregion //#region ../node_modules/property-information/lib/xml.js var xml = create({ properties: { xmlBase: null, xmlLang: null, xmlSpace: null }, space: "xml", transform(_, property) { return "xml:" + property.slice(3).toLowerCase(); } }); //#endregion //#region ../node_modules/property-information/lib/hast-to-react.js /** * Special cases for React (`Record`). * * `hast` is close to `React` but differs in a couple of cases. * To get a React property from a hast property, * check if it is in `hastToReact`. * If it is, use the corresponding value; * otherwise, use the hast property. * * @type {Record} */ var hastToReact = { classId: "classID", dataType: "datatype", itemId: "itemID", strokeDashArray: "strokeDasharray", strokeDashOffset: "strokeDashoffset", strokeLineCap: "strokeLinecap", strokeLineJoin: "strokeLinejoin", strokeMiterLimit: "strokeMiterlimit", typeOf: "typeof", xLinkActuate: "xlinkActuate", xLinkArcRole: "xlinkArcrole", xLinkHref: "xlinkHref", xLinkRole: "xlinkRole", xLinkShow: "xlinkShow", xLinkTitle: "xlinkTitle", xLinkType: "xlinkType", xmlnsXLink: "xmlnsXlink" }; //#endregion //#region ../node_modules/property-information/lib/find.js /** * @import {Schema} from 'property-information' */ var cap$1 = /[A-Z]/g; var dash = /-[a-z]/g; var valid = /^data[-\w.:]+$/i; /** * Look up info on a property. * * In most cases the given `schema` contains info on the property. * All standard, * most legacy, * and some non-standard properties are supported. * For these cases, * the returned `Info` has hints about the value of the property. * * `name` can also be a valid data attribute or property, * in which case an `Info` object with the correctly cased `attribute` and * `property` is returned. * * `name` can be an unknown attribute, * in which case an `Info` object with `attribute` and `property` set to the * given name is returned. * It is not recommended to provide unsupported legacy or recently specced * properties. * * * @param {Schema} schema * Schema; * either the `html` or `svg` export. * @param {string} value * An attribute-like or property-like name; * it will be passed through `normalize` to hopefully find the correct info. * @returns {Info} * Info. */ function find(schema, value) { const normal = normalize$1(value); let property = value; let Type = Info; if (normal in schema.normal) return schema.property[schema.normal[normal]]; if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) { if (value.charAt(4) === "-") { const rest = value.slice(5).replace(dash, camelcase); property = "data" + rest.charAt(0).toUpperCase() + rest.slice(1); } else { const rest = value.slice(4); if (!dash.test(rest)) { let dashes = rest.replace(cap$1, kebab); if (dashes.charAt(0) !== "-") dashes = "-" + dashes; value = "data" + dashes; } } Type = DefinedInfo; } return new Type(property, value); } /** * @param {string} $0 * Value. * @returns {string} * Kebab. */ function kebab($0) { return "-" + $0.toLowerCase(); } /** * @param {string} $0 * Value. * @returns {string} * Camel. */ function camelcase($0) { return $0.charAt(1).toUpperCase(); } //#endregion //#region ../node_modules/property-information/index.js var html$1 = merge([ aria, html$2, xlink, xmlns, xml ], "html"); var svg = merge([ aria, svg$1, xlink, xmlns, xml ], "svg"); //#endregion //#region ../node_modules/space-separated-tokens/index.js /** * Serialize an array of strings as space separated-tokens. * * @param {Array} values * List of tokens. * @returns {string} * Space-separated tokens. */ function stringify(values) { return values.join(" ").trim(); } //#endregion //#region ../node_modules/inline-style-parser/cjs/index.js var require_cjs$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => { var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; var NEWLINE_REGEX = /\n/g; var WHITESPACE_REGEX = /^\s*/; var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; var COLON_REGEX = /^:\s*/; var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; var SEMICOLON_REGEX = /^[;\s]*/; var TRIM_REGEX = /^\s+|\s+$/g; var NEWLINE = "\n"; var FORWARD_SLASH = "/"; var ASTERISK = "*"; var EMPTY_STRING = ""; var TYPE_COMMENT = "comment"; var TYPE_DECLARATION = "declaration"; /** * @param {String} style * @param {Object} [options] * @return {Object[]} * @throws {TypeError} * @throws {Error} */ function index(style, options) { if (typeof style !== "string") throw new TypeError("First argument must be a string"); if (!style) return []; options = options || {}; /** * Positional. */ var lineno = 1; var column = 1; /** * Update lineno and column based on `str`. * * @param {String} str */ function updatePosition(str) { var lines = str.match(NEWLINE_REGEX); if (lines) lineno += lines.length; var i = str.lastIndexOf(NEWLINE); column = ~i ? str.length - i : column + str.length; } /** * Mark position and patch `node.position`. * * @return {Function} */ function position() { var start = { line: lineno, column }; return function(node) { node.position = new Position(start); whitespace(); return node; }; } /** * Store position information for a node. * * @constructor * @property {Object} start * @property {Object} end * @property {undefined|String} source */ function Position(start) { this.start = start; this.end = { line: lineno, column }; this.source = options.source; } /** * Non-enumerable source string. */ Position.prototype.content = style; /** * Error `msg`. * * @param {String} msg * @throws {Error} */ function error(msg) { var err = /* @__PURE__ */ new Error(options.source + ":" + lineno + ":" + column + ": " + msg); err.reason = msg; err.filename = options.source; err.line = lineno; err.column = column; err.source = style; if (options.silent); else throw err; } /** * Match `re` and return captures. * * @param {RegExp} re * @return {undefined|Array} */ function match(re) { var m = re.exec(style); if (!m) return; var str = m[0]; updatePosition(str); style = style.slice(str.length); return m; } /** * Parse whitespace. */ function whitespace() { match(WHITESPACE_REGEX); } /** * Parse comments. * * @param {Object[]} [rules] * @return {Object[]} */ function comments(rules) { var c; rules = rules || []; while (c = comment()) if (c !== false) rules.push(c); return rules; } /** * Parse comment. * * @return {Object} * @throws {Error} */ function comment() { var pos = position(); if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; var i = 2; while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) ++i; i += 2; if (EMPTY_STRING === style.charAt(i - 1)) return error("End of comment missing"); var str = style.slice(2, i - 2); column += 2; updatePosition(str); style = style.slice(i); column += 2; return pos({ type: TYPE_COMMENT, comment: str }); } /** * Parse declaration. * * @return {Object} * @throws {Error} */ function declaration() { var pos = position(); var prop = match(PROPERTY_REGEX); if (!prop) return; comment(); if (!match(COLON_REGEX)) return error("property missing ':'"); var val = match(VALUE_REGEX); var ret = pos({ type: TYPE_DECLARATION, property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING }); match(SEMICOLON_REGEX); return ret; } /** * Parse declarations. * * @return {Object[]} */ function declarations() { var decls = []; comments(decls); var decl; while (decl = declaration()) if (decl !== false) { decls.push(decl); comments(decls); } return decls; } whitespace(); return declarations(); } /** * Trim `str`. * * @param {String} str * @return {String} */ function trim(str) { return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; } module.exports = index; })); //#endregion //#region ../node_modules/style-to-object/cjs/index.js var require_cjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => { var __importDefault = exports && exports.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = StyleToObject; var inline_style_parser_1 = __importDefault(require_cjs$2()); /** * Parses inline style to object. * * @param style - Inline style. * @param iterator - Iterator. * @returns - Style object or null. * * @example Parsing inline style to object: * * ```js * import parse from 'style-to-object'; * parse('line-height: 42;'); // { 'line-height': '42' } * ``` */ function StyleToObject(style, iterator) { let styleObject = null; if (!style || typeof style !== "string") return styleObject; const declarations = (0, inline_style_parser_1.default)(style); const hasIterator = typeof iterator === "function"; declarations.forEach((declaration) => { if (declaration.type !== "declaration") return; const { property, value } = declaration; if (hasIterator) iterator(property, value, declaration); else if (value) { styleObject = styleObject || {}; styleObject[property] = value; } }); return styleObject; } })); //#endregion //#region ../node_modules/style-to-js/cjs/utilities.js var require_utilities = /* @__PURE__ */ __commonJSMin(((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.camelCase = void 0; var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/; var HYPHEN_REGEX = /-([a-z])/g; var NO_HYPHEN_REGEX = /^[^-]+$/; var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/; var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/; /** * Checks whether to skip camelCase. */ var skipCamelCase = function(property) { return !property || NO_HYPHEN_REGEX.test(property) || CUSTOM_PROPERTY_REGEX.test(property); }; /** * Replacer that capitalizes first character. */ var capitalize = function(match, character) { return character.toUpperCase(); }; /** * Replacer that removes beginning hyphen of vendor prefix property. */ var trimHyphen = function(match, prefix) { return "".concat(prefix, "-"); }; /** * CamelCases a CSS property. */ var camelCase = function(property, options) { if (options === void 0) options = {}; if (skipCamelCase(property)) return property; property = property.toLowerCase(); if (options.reactCompat) property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen); else property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen); return property.replace(HYPHEN_REGEX, capitalize); }; exports.camelCase = camelCase; })); //#endregion //#region ../node_modules/style-to-js/cjs/index.js var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => { var style_to_object_1 = (exports && exports.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; })(require_cjs$1()); var utilities_1 = require_utilities(); /** * Parses CSS inline style to JavaScript object (camelCased). */ function StyleToJS(style, options) { var output = {}; if (!style || typeof style !== "string") return output; (0, style_to_object_1.default)(style, function(property, value) { if (property && value) output[(0, utilities_1.camelCase)(property, options)] = value; }); return output; } StyleToJS.default = StyleToJS; module.exports = StyleToJS; })); //#endregion //#region ../node_modules/unist-util-position/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Point} Point * @typedef {import('unist').Position} Position */ /** * @typedef NodeLike * @property {string} type * @property {PositionLike | null | undefined} [position] * * @typedef PositionLike * @property {PointLike | null | undefined} [start] * @property {PointLike | null | undefined} [end] * * @typedef PointLike * @property {number | null | undefined} [line] * @property {number | null | undefined} [column] * @property {number | null | undefined} [offset] */ /** * Get the ending point of `node`. * * @param node * Node. * @returns * Point. */ var pointEnd = point$2("end"); /** * Get the starting point of `node`. * * @param node * Node. * @returns * Point. */ var pointStart = point$2("start"); /** * Get the positional info of `node`. * * @param {'end' | 'start'} type * Side. * @returns * Getter. */ function point$2(type) { return point; /** * Get the point info of `node` at a bound side. * * @param {Node | NodeLike | null | undefined} [node] * @returns {Point | undefined} */ function point(node) { const point = node && node.position && node.position[type] || {}; if (typeof point.line === "number" && point.line > 0 && typeof point.column === "number" && point.column > 0) return { line: point.line, column: point.column, offset: typeof point.offset === "number" && point.offset > -1 ? point.offset : void 0 }; } } /** * Get the positional info of `node`. * * @param {Node | NodeLike | null | undefined} [node] * Node. * @returns {Position | undefined} * Position. */ function position$1(node) { const start = pointStart(node); const end = pointEnd(node); if (start && end) return { start, end }; } //#endregion //#region ../node_modules/unist-util-stringify-position/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Point} Point * @typedef {import('unist').Position} Position */ /** * @typedef NodeLike * @property {string} type * @property {PositionLike | null | undefined} [position] * * @typedef PointLike * @property {number | null | undefined} [line] * @property {number | null | undefined} [column] * @property {number | null | undefined} [offset] * * @typedef PositionLike * @property {PointLike | null | undefined} [start] * @property {PointLike | null | undefined} [end] */ /** * Serialize the positional info of a point, position (start and end points), * or node. * * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value] * Node, position, or point. * @returns {string} * Pretty printed positional info of a node (`string`). * * In the format of a range `ls:cs-le:ce` (when given `node` or `position`) * or a point `l:c` (when given `point`), where `l` stands for line, `c` for * column, `s` for `start`, and `e` for end. * An empty string (`''`) is returned if the given value is neither `node`, * `position`, nor `point`. */ function stringifyPosition(value) { if (!value || typeof value !== "object") return ""; if ("position" in value || "type" in value) return position(value.position); if ("start" in value || "end" in value) return position(value); if ("line" in value || "column" in value) return point$1(value); return ""; } /** * @param {Point | PointLike | null | undefined} point * @returns {string} */ function point$1(point) { return index(point && point.line) + ":" + index(point && point.column); } /** * @param {Position | PositionLike | null | undefined} pos * @returns {string} */ function position(pos) { return point$1(pos && pos.start) + "-" + point$1(pos && pos.end); } /** * @param {number | null | undefined} value * @returns {number} */ function index(value) { return value && typeof value === "number" ? value : 1; } //#endregion //#region ../node_modules/vfile-message/lib/index.js /** * @import {Node, Point, Position} from 'unist' */ /** * @typedef {object & {type: string, position?: Position | undefined}} NodeLike * * @typedef Options * Configuration. * @property {Array | null | undefined} [ancestors] * Stack of (inclusive) ancestor nodes surrounding the message (optional). * @property {Error | null | undefined} [cause] * Original error cause of the message (optional). * @property {Point | Position | null | undefined} [place] * Place of message (optional). * @property {string | null | undefined} [ruleId] * Category of message (optional, example: `'my-rule'`). * @property {string | null | undefined} [source] * Namespace of who sent the message (optional, example: `'my-package'`). */ /** * Message. */ var VFileMessage = class extends Error { /** * Create a message for `reason`. * * > 🪦 **Note**: also has obsolete signatures. * * @overload * @param {string} reason * @param {Options | null | undefined} [options] * @returns * * @overload * @param {string} reason * @param {Node | NodeLike | null | undefined} parent * @param {string | null | undefined} [origin] * @returns * * @overload * @param {string} reason * @param {Point | Position | null | undefined} place * @param {string | null | undefined} [origin] * @returns * * @overload * @param {string} reason * @param {string | null | undefined} [origin] * @returns * * @overload * @param {Error | VFileMessage} cause * @param {Node | NodeLike | null | undefined} parent * @param {string | null | undefined} [origin] * @returns * * @overload * @param {Error | VFileMessage} cause * @param {Point | Position | null | undefined} place * @param {string | null | undefined} [origin] * @returns * * @overload * @param {Error | VFileMessage} cause * @param {string | null | undefined} [origin] * @returns * * @param {Error | VFileMessage | string} causeOrReason * Reason for message, should use markdown. * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace] * Configuration (optional). * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns * Instance of `VFileMessage`. */ constructor(causeOrReason, optionsOrParentOrPlace, origin) { super(); if (typeof optionsOrParentOrPlace === "string") { origin = optionsOrParentOrPlace; optionsOrParentOrPlace = void 0; } /** @type {string} */ let reason = ""; /** @type {Options} */ let options = {}; let legacyCause = false; if (optionsOrParentOrPlace) if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) options = { place: optionsOrParentOrPlace }; else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) options = { place: optionsOrParentOrPlace }; else if ("type" in optionsOrParentOrPlace) options = { ancestors: [optionsOrParentOrPlace], place: optionsOrParentOrPlace.position }; else options = { ...optionsOrParentOrPlace }; if (typeof causeOrReason === "string") reason = causeOrReason; else if (!options.cause && causeOrReason) { legacyCause = true; reason = causeOrReason.message; options.cause = causeOrReason; } if (!options.ruleId && !options.source && typeof origin === "string") { const index = origin.indexOf(":"); if (index === -1) options.ruleId = origin; else { options.source = origin.slice(0, index); options.ruleId = origin.slice(index + 1); } } if (!options.place && options.ancestors && options.ancestors) { const parent = options.ancestors[options.ancestors.length - 1]; if (parent) options.place = parent.position; } const start = options.place && "start" in options.place ? options.place.start : options.place; /** * Stack of ancestor nodes surrounding the message. * * @type {Array | undefined} */ this.ancestors = options.ancestors || void 0; /** * Original error cause of the message. * * @type {Error | undefined} */ this.cause = options.cause || void 0; /** * Starting column of message. * * @type {number | undefined} */ this.column = start ? start.column : void 0; /** * State of problem. * * * `true` — error, file not usable * * `false` — warning, change may be needed * * `undefined` — change likely not needed * * @type {boolean | null | undefined} */ this.fatal = void 0; /** * Path of a file (used throughout the `VFile` ecosystem). * * @type {string | undefined} */ this.file = ""; /** * Reason for message. * * @type {string} */ this.message = reason; /** * Starting line of error. * * @type {number | undefined} */ this.line = start ? start.line : void 0; /** * Serialized positional info of message. * * On normal errors, this would be something like `ParseError`, buit in * `VFile` messages we use this space to show where an error happened. */ this.name = stringifyPosition(options.place) || "1:1"; /** * Place of message. * * @type {Point | Position | undefined} */ this.place = options.place || void 0; /** * Reason for message, should use markdown. * * @type {string} */ this.reason = this.message; /** * Category of message (example: `'my-rule'`). * * @type {string | undefined} */ this.ruleId = options.ruleId || void 0; /** * Namespace of message (example: `'my-package'`). * * @type {string | undefined} */ this.source = options.source || void 0; /** * Stack of message. * * This is used by normal errors to show where something happened in * programming code, irrelevant for `VFile` messages, * * @type {string} */ this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : ""; /** * Specify the source value that’s being reported, which is deemed * incorrect. * * @type {string | undefined} */ this.actual = void 0; /** * Suggest acceptable values that can be used instead of `actual`. * * @type {Array | undefined} */ this.expected = void 0; /** * Long form description of the message (you should use markdown). * * @type {string | undefined} */ this.note = void 0; /** * Link to docs for the message. * * > 👉 **Note**: this must be an absolute URL that can be passed as `x` * > to `new URL(x)`. * * @type {string | undefined} */ this.url = void 0; } }; VFileMessage.prototype.file = ""; VFileMessage.prototype.name = ""; VFileMessage.prototype.reason = ""; VFileMessage.prototype.message = ""; VFileMessage.prototype.stack = ""; VFileMessage.prototype.column = void 0; VFileMessage.prototype.line = void 0; VFileMessage.prototype.ancestors = void 0; VFileMessage.prototype.cause = void 0; VFileMessage.prototype.fatal = void 0; VFileMessage.prototype.place = void 0; VFileMessage.prototype.ruleId = void 0; VFileMessage.prototype.source = void 0; //#endregion //#region ../node_modules/hast-util-to-jsx-runtime/lib/index.js /** * @import {Identifier, Literal, MemberExpression} from 'estree' * @import {Jsx, JsxDev, Options, Props} from 'hast-util-to-jsx-runtime' * @import {Element, Nodes, Parents, Root, Text} from 'hast' * @import {MdxFlowExpressionHast, MdxTextExpressionHast} from 'mdast-util-mdx-expression' * @import {MdxJsxFlowElementHast, MdxJsxTextElementHast} from 'mdast-util-mdx-jsx' * @import {MdxjsEsmHast} from 'mdast-util-mdxjs-esm' * @import {Position} from 'unist' * @import {Child, Create, Field, JsxElement, State, Style} from './types.js' */ var import_cjs = /* @__PURE__ */ __toESM(require_cjs(), 1); var own$3 = {}.hasOwnProperty; /** @type {Map} */ var emptyMap = /* @__PURE__ */ new Map(); var cap = /[A-Z]/g; var tableElements = new Set([ "table", "tbody", "thead", "tfoot", "tr" ]); var tableCellElement = new Set(["td", "th"]); /** * Transform a hast tree to preact, react, solid, svelte, vue, etc., * with an automatic JSX runtime. * * @param {Nodes} tree * Tree to transform. * @param {Options} options * Configuration (required). * @returns {JsxElement} * JSX element. */ function toJsxRuntime(tree, options) { if (!options || options.Fragment === void 0) throw new TypeError("Expected `Fragment` in options"); const filePath = options.filePath || void 0; /** @type {Create} */ let create; if (options.development) { if (typeof options.jsxDEV !== "function") throw new TypeError("Expected `jsxDEV` in options when `development: true`"); create = developmentCreate(filePath, options.jsxDEV); } else { if (typeof options.jsx !== "function") throw new TypeError("Expected `jsx` in production options"); if (typeof options.jsxs !== "function") throw new TypeError("Expected `jsxs` in production options"); create = productionCreate(filePath, options.jsx, options.jsxs); } /** @type {State} */ const state = { Fragment: options.Fragment, ancestors: [], components: options.components || {}, create, elementAttributeNameCase: options.elementAttributeNameCase || "react", evaluater: options.createEvaluater ? options.createEvaluater() : void 0, filePath, ignoreInvalidStyle: options.ignoreInvalidStyle || false, passKeys: options.passKeys !== false, passNode: options.passNode || false, schema: options.space === "svg" ? svg : html$1, stylePropertyNameCase: options.stylePropertyNameCase || "dom", tableCellAlignToStyle: options.tableCellAlignToStyle !== false }; const result = one(state, tree, void 0); if (result && typeof result !== "string") return result; return state.create(tree, state.Fragment, { children: result || void 0 }, void 0); } /** * Transform a node. * * @param {State} state * Info passed around. * @param {Nodes} node * Current node. * @param {string | undefined} key * Key. * @returns {Child | undefined} * Child, optional. */ function one(state, node, key) { if (node.type === "element") return element$1(state, node, key); if (node.type === "mdxFlowExpression" || node.type === "mdxTextExpression") return mdxExpression(state, node); if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") return mdxJsxElement(state, node, key); if (node.type === "mdxjsEsm") return mdxEsm(state, node); if (node.type === "root") return root$1(state, node, key); if (node.type === "text") return text$3(state, node); } /** * Handle element. * * @param {State} state * Info passed around. * @param {Element} node * Current node. * @param {string | undefined} key * Key. * @returns {Child | undefined} * Child, optional. */ function element$1(state, node, key) { const parentSchema = state.schema; let schema = parentSchema; if (node.tagName.toLowerCase() === "svg" && parentSchema.space === "html") { schema = svg; state.schema = schema; } state.ancestors.push(node); const type = findComponentFromName(state, node.tagName, false); const props = createElementProps(state, node); let children = createChildren(state, node); if (tableElements.has(node.tagName)) children = children.filter(function(child) { return typeof child === "string" ? !whitespace(child) : true; }); addNode(state, props, type, node); addChildren(props, children); state.ancestors.pop(); state.schema = parentSchema; return state.create(node, type, props, key); } /** * Handle MDX expression. * * @param {State} state * Info passed around. * @param {MdxFlowExpressionHast | MdxTextExpressionHast} node * Current node. * @returns {Child | undefined} * Child, optional. */ function mdxExpression(state, node) { if (node.data && node.data.estree && state.evaluater) { const expression = node.data.estree.body[0]; ok(expression.type === "ExpressionStatement"); return state.evaluater.evaluateExpression(expression.expression); } crashEstree(state, node.position); } /** * Handle MDX ESM. * * @param {State} state * Info passed around. * @param {MdxjsEsmHast} node * Current node. * @returns {Child | undefined} * Child, optional. */ function mdxEsm(state, node) { if (node.data && node.data.estree && state.evaluater) return state.evaluater.evaluateProgram(node.data.estree); crashEstree(state, node.position); } /** * Handle MDX JSX. * * @param {State} state * Info passed around. * @param {MdxJsxFlowElementHast | MdxJsxTextElementHast} node * Current node. * @param {string | undefined} key * Key. * @returns {Child | undefined} * Child, optional. */ function mdxJsxElement(state, node, key) { const parentSchema = state.schema; let schema = parentSchema; if (node.name === "svg" && parentSchema.space === "html") { schema = svg; state.schema = schema; } state.ancestors.push(node); const type = node.name === null ? state.Fragment : findComponentFromName(state, node.name, true); const props = createJsxElementProps(state, node); const children = createChildren(state, node); addNode(state, props, type, node); addChildren(props, children); state.ancestors.pop(); state.schema = parentSchema; return state.create(node, type, props, key); } /** * Handle root. * * @param {State} state * Info passed around. * @param {Root} node * Current node. * @param {string | undefined} key * Key. * @returns {Child | undefined} * Child, optional. */ function root$1(state, node, key) { /** @type {Props} */ const props = {}; addChildren(props, createChildren(state, node)); return state.create(node, state.Fragment, props, key); } /** * Handle text. * * @param {State} _ * Info passed around. * @param {Text} node * Current node. * @returns {Child | undefined} * Child, optional. */ function text$3(_, node) { return node.value; } /** * Add `node` to props. * * @param {State} state * Info passed around. * @param {Props} props * Props. * @param {unknown} type * Type. * @param {Element | MdxJsxFlowElementHast | MdxJsxTextElementHast} node * Node. * @returns {undefined} * Nothing. */ function addNode(state, props, type, node) { if (typeof type !== "string" && type !== state.Fragment && state.passNode) props.node = node; } /** * Add children to props. * * @param {Props} props * Props. * @param {Array} children * Children. * @returns {undefined} * Nothing. */ function addChildren(props, children) { if (children.length > 0) { const value = children.length > 1 ? children : children[0]; if (value) props.children = value; } } /** * @param {string | undefined} _ * Path to file. * @param {Jsx} jsx * Dynamic. * @param {Jsx} jsxs * Static. * @returns {Create} * Create a production element. */ function productionCreate(_, jsx, jsxs) { return create; /** @type {Create} */ function create(_, type, props, key) { const fn = Array.isArray(props.children) ? jsxs : jsx; return key ? fn(type, props, key) : fn(type, props); } } /** * @param {string | undefined} filePath * Path to file. * @param {JsxDev} jsxDEV * Development. * @returns {Create} * Create a development element. */ function developmentCreate(filePath, jsxDEV) { return create; /** @type {Create} */ function create(node, type, props, key) { const isStaticChildren = Array.isArray(props.children); const point = pointStart(node); return jsxDEV(type, props, key, isStaticChildren, { columnNumber: point ? point.column - 1 : void 0, fileName: filePath, lineNumber: point ? point.line : void 0 }, void 0); } } /** * Create props from an element. * * @param {State} state * Info passed around. * @param {Element} node * Current element. * @returns {Props} * Props. */ function createElementProps(state, node) { /** @type {Props} */ const props = {}; /** @type {string | undefined} */ let alignValue; /** @type {string} */ let prop; for (prop in node.properties) if (prop !== "children" && own$3.call(node.properties, prop)) { const result = createProperty(state, prop, node.properties[prop]); if (result) { const [key, value] = result; if (state.tableCellAlignToStyle && key === "align" && typeof value === "string" && tableCellElement.has(node.tagName)) alignValue = value; else props[key] = value; } } if (alignValue) { const style = props.style || (props.style = {}); style[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue; } return props; } /** * Create props from a JSX element. * * @param {State} state * Info passed around. * @param {MdxJsxFlowElementHast | MdxJsxTextElementHast} node * Current JSX element. * @returns {Props} * Props. */ function createJsxElementProps(state, node) { /** @type {Props} */ const props = {}; for (const attribute of node.attributes) if (attribute.type === "mdxJsxExpressionAttribute") if (attribute.data && attribute.data.estree && state.evaluater) { const expression = attribute.data.estree.body[0]; ok(expression.type === "ExpressionStatement"); const objectExpression = expression.expression; ok(objectExpression.type === "ObjectExpression"); const property = objectExpression.properties[0]; ok(property.type === "SpreadElement"); Object.assign(props, state.evaluater.evaluateExpression(property.argument)); } else crashEstree(state, node.position); else { const name = attribute.name; /** @type {unknown} */ let value; if (attribute.value && typeof attribute.value === "object") if (attribute.value.data && attribute.value.data.estree && state.evaluater) { const expression = attribute.value.data.estree.body[0]; ok(expression.type === "ExpressionStatement"); value = state.evaluater.evaluateExpression(expression.expression); } else crashEstree(state, node.position); else value = attribute.value === null ? true : attribute.value; props[name] = value; } return props; } /** * Create children. * * @param {State} state * Info passed around. * @param {Parents} node * Current element. * @returns {Array} * Children. */ function createChildren(state, node) { /** @type {Array} */ const children = []; let index = -1; /** @type {Map} */ /* c8 ignore next */ const countsByName = state.passKeys ? /* @__PURE__ */ new Map() : emptyMap; while (++index < node.children.length) { const child = node.children[index]; /** @type {string | undefined} */ let key; if (state.passKeys) { const name = child.type === "element" ? child.tagName : child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name : void 0; if (name) { const count = countsByName.get(name) || 0; key = name + "-" + count; countsByName.set(name, count + 1); } } const result = one(state, child, key); if (result !== void 0) children.push(result); } return children; } /** * Handle a property. * * @param {State} state * Info passed around. * @param {string} prop * Key. * @param {Array | boolean | number | string | null | undefined} value * hast property value. * @returns {Field | undefined} * Field for runtime, optional. */ function createProperty(state, prop, value) { const info = find(state.schema, prop); if (value === null || value === void 0 || typeof value === "number" && Number.isNaN(value)) return; if (Array.isArray(value)) value = info.commaSeparated ? stringify$1(value) : stringify(value); if (info.property === "style") { let styleObject = typeof value === "object" ? value : parseStyle(state, String(value)); if (state.stylePropertyNameCase === "css") styleObject = transformStylesToCssCasing(styleObject); return ["style", styleObject]; } return [state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute, value]; } /** * Parse a CSS declaration to an object. * * @param {State} state * Info passed around. * @param {string} value * CSS declarations. * @returns {Style} * Properties. * @throws * Throws `VFileMessage` when CSS cannot be parsed. */ function parseStyle(state, value) { try { return (0, import_cjs.default)(value, { reactCompat: true }); } catch (error) { if (state.ignoreInvalidStyle) return {}; const cause = error; const message = new VFileMessage("Cannot parse `style` attribute", { ancestors: state.ancestors, cause, ruleId: "style", source: "hast-util-to-jsx-runtime" }); message.file = state.filePath || void 0; message.url = "https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute"; throw message; } } /** * Create a JSX name from a string. * * @param {State} state * To do. * @param {string} name * Name. * @param {boolean} allowExpression * Allow member expressions and identifiers. * @returns {unknown} * To do. */ function findComponentFromName(state, name$1, allowExpression) { /** @type {Identifier | Literal | MemberExpression} */ let result; if (!allowExpression) result = { type: "Literal", value: name$1 }; else if (name$1.includes(".")) { const identifiers = name$1.split("."); let index = -1; /** @type {Identifier | Literal | MemberExpression | undefined} */ let node; while (++index < identifiers.length) { /** @type {Identifier | Literal} */ const prop = name(identifiers[index]) ? { type: "Identifier", name: identifiers[index] } : { type: "Literal", value: identifiers[index] }; node = node ? { type: "MemberExpression", object: node, property: prop, computed: Boolean(index && prop.type === "Literal"), optional: false } : prop; } ok(node, "always a result"); result = node; } else result = name(name$1) && !/^[a-z]/.test(name$1) ? { type: "Identifier", name: name$1 } : { type: "Literal", value: name$1 }; if (result.type === "Literal") { const name = result.value; return own$3.call(state.components, name) ? state.components[name] : name; } if (state.evaluater) return state.evaluater.evaluateExpression(result); crashEstree(state); } /** * @param {State} state * @param {Position | undefined} [place] * @returns {never} */ function crashEstree(state, place) { const message = new VFileMessage("Cannot handle MDX estrees without `createEvaluater`", { ancestors: state.ancestors, place, ruleId: "mdx-estree", source: "hast-util-to-jsx-runtime" }); message.file = state.filePath || void 0; message.url = "https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater"; throw message; } /** * Transform a DOM casing style object to a CSS casing style object. * * @param {Style} domCasing * @returns {Style} */ function transformStylesToCssCasing(domCasing) { /** @type {Style} */ const cssCasing = {}; /** @type {string} */ let from; for (from in domCasing) if (own$3.call(domCasing, from)) cssCasing[transformStyleToCssCasing(from)] = domCasing[from]; return cssCasing; } /** * Transform a DOM casing style field to a CSS casing style field. * * @param {string} from * @returns {string} */ function transformStyleToCssCasing(from) { let to = from.replace(cap, toDash); if (to.slice(0, 3) === "ms-") to = "-" + to; return to; } /** * Make `$0` dash cased. * * @param {string} $0 * Capitalized ASCII leter. * @returns {string} * Dash and lower letter. */ function toDash($0) { return "-" + $0.toLowerCase(); } //#endregion //#region ../node_modules/html-url-attributes/lib/index.js /** * HTML URL properties. * * Each key is a property name and each value is a list of tag names it applies * to or `null` if it applies to all elements. * * @type {Record | null>} */ var urlAttributes = { action: ["form"], cite: [ "blockquote", "del", "ins", "q" ], data: ["object"], formAction: ["button", "input"], href: [ "a", "area", "base", "link" ], icon: ["menuitem"], itemId: null, manifest: ["html"], ping: ["a", "area"], poster: ["video"], src: [ "audio", "embed", "iframe", "img", "input", "script", "source", "track", "video" ] }; //#endregion //#region ../node_modules/decode-named-character-reference/index.dom.js var element = document.createElement("i"); /** * @param {string} value * @returns {string | false} */ function decodeNamedCharacterReference(value) { const characterReference = "&" + value + ";"; element.innerHTML = characterReference; const character = element.textContent; if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") return false; return character === characterReference ? false : character; } //#endregion //#region ../node_modules/micromark-util-decode-numeric-character-reference/dev/index.js /** * Turn the number (in string form as either hexa- or plain decimal) coming from * a numeric character reference into a character. * * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes * non-characters and control characters safe. * * @param {string} value * Value to decode. * @param {number} base * Numeric base. * @returns {string} * Character. */ function decodeNumericCharacterReference(value, base) { const code = Number.parseInt(value, base); if (code < codes.ht || code === codes.vt || code > codes.cr && code < codes.space || code > codes.tilde && code < 160 || code > 55295 && code < 57344 || code > 64975 && code < 65008 || (code & 65535) === 65535 || (code & 65535) === 65534 || code > 1114111) return values.replacementCharacter; return String.fromCodePoint(code); } //#endregion //#region ../node_modules/micromark-util-sanitize-uri/dev/index.js /** * Normalize a URL. * * Encode unsafe characters with percent-encoding, skipping already encoded * sequences. * * @param {string} value * URI to normalize. * @returns {string} * Normalized URI. */ function normalizeUri(value) { /** @type {Array} */ const result = []; let index = -1; let start = 0; let skip = 0; while (++index < value.length) { const code = value.charCodeAt(index); /** @type {string} */ let replace = ""; if (code === codes.percentSign && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) skip = 2; else if (code < 128) { if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) replace = String.fromCharCode(code); } else if (code > 55295 && code < 57344) { const next = value.charCodeAt(index + 1); if (code < 56320 && next > 56319 && next < 57344) { replace = String.fromCharCode(code, next); skip = 1; } else replace = values.replacementCharacter; } else replace = String.fromCharCode(code); if (replace) { result.push(value.slice(start, index), encodeURIComponent(replace)); start = index + skip + 1; replace = ""; } if (skip) { index += skip; skip = 0; } } return result.join("") + value.slice(start); } //#endregion //#region ../node_modules/micromark/dev/lib/initialize/content.js /** * @import { * InitialConstruct, * Initializer, * State, * TokenizeContext, * Token * } from 'micromark-util-types' */ /** @type {InitialConstruct} */ var content$1 = { tokenize: initializeContent }; /** * @this {TokenizeContext} * Context. * @type {Initializer} * Content. */ function initializeContent(effects) { const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial); /** @type {Token} */ let previous; return contentStart; /** @type {State} */ function afterContentStartConstruct(code) { ok(code === codes.eof || markdownLineEnding(code), "expected eol or eof"); if (code === codes.eof) { effects.consume(code); return; } effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return factorySpace(effects, contentStart, types.linePrefix); } /** @type {State} */ function paragraphInitial(code) { ok(code !== codes.eof && !markdownLineEnding(code), "expected anything other than a line ending or EOF"); effects.enter(types.paragraph); return lineStart(code); } /** @type {State} */ function lineStart(code) { const token = effects.enter(types.chunkText, { contentType: constants.contentTypeText, previous }); if (previous) previous.next = token; previous = token; return data(code); } /** @type {State} */ function data(code) { if (code === codes.eof) { effects.exit(types.chunkText); effects.exit(types.paragraph); effects.consume(code); return; } if (markdownLineEnding(code)) { effects.consume(code); effects.exit(types.chunkText); return lineStart; } effects.consume(code); return data; } } //#endregion //#region ../node_modules/micromark/dev/lib/initialize/document.js /** * @import { * Construct, * ContainerState, * InitialConstruct, * Initializer, * Point, * State, * TokenizeContext, * Tokenizer, * Token * } from 'micromark-util-types' */ /** * @typedef {[Construct, ContainerState]} StackItem * Construct and its state. */ /** @type {InitialConstruct} */ var document$2 = { tokenize: initializeDocument }; /** @type {Construct} */ var containerConstruct = { tokenize: tokenizeContainer }; /** * @this {TokenizeContext} * Self. * @type {Initializer} * Initializer. */ function initializeDocument(effects) { const self = this; /** @type {Array} */ const stack = []; let continued = 0; /** @type {TokenizeContext | undefined} */ let childFlow; /** @type {Token | undefined} */ let childToken; /** @type {number} */ let lineStartOffset; return start; /** @type {State} */ function start(code) { if (continued < stack.length) { const item = stack[continued]; self.containerState = item[1]; ok(item[0].continuation, "expected `continuation` to be defined on container construct"); return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code); } return checkNewContainers(code); } /** @type {State} */ function documentContinue(code) { ok(self.containerState, "expected `containerState` to be defined after continuation"); continued++; if (self.containerState._closeFlow) { self.containerState._closeFlow = void 0; if (childFlow) closeFlow(); const indexBeforeExits = self.events.length; let indexBeforeFlow = indexBeforeExits; /** @type {Point | undefined} */ let point; while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === types.chunkFlow) { point = self.events[indexBeforeFlow][1].end; break; } ok(point, "could not find previous flow chunk"); exitContainers(continued); let index = indexBeforeExits; while (index < self.events.length) { self.events[index][1].end = { ...point }; index++; } splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); self.events.length = index; return checkNewContainers(code); } return start(code); } /** @type {State} */ function checkNewContainers(code) { if (continued === stack.length) { if (!childFlow) return documentContinued(code); if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) return flowStart(code); self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack); } self.containerState = {}; return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code); } /** @type {State} */ function thereIsANewContainer(code) { if (childFlow) closeFlow(); exitContainers(continued); return documentContinued(code); } /** @type {State} */ function thereIsNoNewContainer(code) { self.parser.lazy[self.now().line] = continued !== stack.length; lineStartOffset = self.now().offset; return flowStart(code); } /** @type {State} */ function documentContinued(code) { self.containerState = {}; return effects.attempt(containerConstruct, containerContinue, flowStart)(code); } /** @type {State} */ function containerContinue(code) { ok(self.currentConstruct, "expected `currentConstruct` to be defined on tokenizer"); ok(self.containerState, "expected `containerState` to be defined on tokenizer"); continued++; stack.push([self.currentConstruct, self.containerState]); return documentContinued(code); } /** @type {State} */ function flowStart(code) { if (code === codes.eof) { if (childFlow) closeFlow(); exitContainers(0); effects.consume(code); return; } childFlow = childFlow || self.parser.flow(self.now()); effects.enter(types.chunkFlow, { _tokenizer: childFlow, contentType: constants.contentTypeFlow, previous: childToken }); return flowContinue(code); } /** @type {State} */ function flowContinue(code) { if (code === codes.eof) { writeToChild(effects.exit(types.chunkFlow), true); exitContainers(0); effects.consume(code); return; } if (markdownLineEnding(code)) { effects.consume(code); writeToChild(effects.exit(types.chunkFlow)); continued = 0; self.interrupt = void 0; return start; } effects.consume(code); return flowContinue; } /** * @param {Token} token * Token. * @param {boolean | undefined} [endOfFile] * Whether the token is at the end of the file (default: `false`). * @returns {undefined} * Nothing. */ function writeToChild(token, endOfFile) { ok(childFlow, "expected `childFlow` to be defined when continuing"); const stream = self.sliceStream(token); if (endOfFile) stream.push(null); token.previous = childToken; if (childToken) childToken.next = token; childToken = token; childFlow.defineSkip(token.start); childFlow.write(stream); if (self.parser.lazy[token.start.line]) { let index = childFlow.events.length; while (index--) if (childFlow.events[index][1].start.offset < lineStartOffset && (!childFlow.events[index][1].end || childFlow.events[index][1].end.offset > lineStartOffset)) return; const indexBeforeExits = self.events.length; let indexBeforeFlow = indexBeforeExits; /** @type {boolean | undefined} */ let seen; /** @type {Point | undefined} */ let point; while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === types.chunkFlow) { if (seen) { point = self.events[indexBeforeFlow][1].end; break; } seen = true; } ok(point, "could not find previous flow chunk"); exitContainers(continued); index = indexBeforeExits; while (index < self.events.length) { self.events[index][1].end = { ...point }; index++; } splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); self.events.length = index; } } /** * @param {number} size * Size. * @returns {undefined} * Nothing. */ function exitContainers(size) { let index = stack.length; while (index-- > size) { const entry = stack[index]; self.containerState = entry[1]; ok(entry[0].exit, "expected `exit` to be defined on container construct"); entry[0].exit.call(self, effects); } stack.length = size; } function closeFlow() { ok(self.containerState, "expected `containerState` to be defined when closing flow"); ok(childFlow, "expected `childFlow` to be defined when closing it"); childFlow.write([codes.eof]); childToken = void 0; childFlow = void 0; self.containerState._closeFlow = void 0; } } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} * Tokenizer. */ function tokenizeContainer(effects, ok$35, nok) { ok(this.parser.constructs.disable.null, "expected `disable.null` to be populated"); return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok$35, nok), types.linePrefix, this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize); } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/attention.js /** * @import { * Code, * Construct, * Event, * Point, * Resolver, * State, * TokenizeContext, * Tokenizer, * Token * } from 'micromark-util-types' */ /** @type {Construct} */ var attention = { name: "attention", resolveAll: resolveAllAttention, tokenize: tokenizeAttention }; /** * Take all events and resolve attention to emphasis or strong. * * @type {Resolver} */ function resolveAllAttention(events, context) { let index = -1; /** @type {number} */ let open; /** @type {Token} */ let group; /** @type {Token} */ let text; /** @type {Token} */ let openingSequence; /** @type {Token} */ let closingSequence; /** @type {number} */ let use; /** @type {Array} */ let nextEvents; /** @type {number} */ let offset; while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) { open = index; while (open--) if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) { if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue; use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; const start = { ...events[open][1].end }; const end = { ...events[index][1].start }; movePoint(start, -use); movePoint(end, use); openingSequence = { type: use > 1 ? types.strongSequence : types.emphasisSequence, start, end: { ...events[open][1].end } }; closingSequence = { type: use > 1 ? types.strongSequence : types.emphasisSequence, start: { ...events[index][1].start }, end }; text = { type: use > 1 ? types.strongText : types.emphasisText, start: { ...events[open][1].end }, end: { ...events[index][1].start } }; group = { type: use > 1 ? types.strong : types.emphasis, start: { ...openingSequence.start }, end: { ...closingSequence.end } }; events[open][1].end = { ...openingSequence.start }; events[index][1].start = { ...closingSequence.end }; nextEvents = []; if (events[open][1].end.offset - events[open][1].start.offset) nextEvents = push(nextEvents, [[ "enter", events[open][1], context ], [ "exit", events[open][1], context ]]); nextEvents = push(nextEvents, [ [ "enter", group, context ], [ "enter", openingSequence, context ], [ "exit", openingSequence, context ], [ "enter", text, context ] ]); ok(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated"); nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context)); nextEvents = push(nextEvents, [ [ "exit", text, context ], [ "enter", closingSequence, context ], [ "exit", closingSequence, context ], [ "exit", group, context ] ]); if (events[index][1].end.offset - events[index][1].start.offset) { offset = 2; nextEvents = push(nextEvents, [[ "enter", events[index][1], context ], [ "exit", events[index][1], context ]]); } else offset = 0; splice(events, open - 1, index - open + 3, nextEvents); index = open + nextEvents.length - offset - 2; break; } } index = -1; while (++index < events.length) if (events[index][1].type === "attentionSequence") events[index][1].type = "data"; return events; } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeAttention(effects, ok$34) { const attentionMarkers = this.parser.constructs.attentionMarkers.null; const previous = this.previous; const before = classifyCharacter(previous); /** @type {NonNullable} */ let marker; return start; /** * Before a sequence. * * ```markdown * > | ** * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.asterisk || code === codes.underscore, "expected asterisk or underscore"); marker = code; effects.enter("attentionSequence"); return inside(code); } /** * In a sequence. * * ```markdown * > | ** * ^^ * ``` * * @type {State} */ function inside(code) { if (code === marker) { effects.consume(code); return inside; } const token = effects.exit("attentionSequence"); const after = classifyCharacter(code); ok(attentionMarkers, "expected `attentionMarkers` to be populated"); const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code); const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous); token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close)); token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open)); return ok$34(code); } } /** * Move a point a bit. * * Note: `move` only works inside lines! It’s not possible to move past other * chunks (replacement characters, tabs, or line endings). * * @param {Point} point * Point. * @param {number} offset * Amount to move. * @returns {undefined} * Nothing. */ function movePoint(point, offset) { point.column += offset; point.offset += offset; point._bufferIndex += offset; } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/autolink.js /** * @import { * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var autolink = { name: "autolink", tokenize: tokenizeAutolink }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeAutolink(effects, ok$33, nok) { let size = 0; return start; /** * Start of an autolink. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.lessThan, "expected `<`"); effects.enter(types.autolink); effects.enter(types.autolinkMarker); effects.consume(code); effects.exit(types.autolinkMarker); effects.enter(types.autolinkProtocol); return open; } /** * After `<`, at protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function open(code) { if (asciiAlpha(code)) { effects.consume(code); return schemeOrEmailAtext; } if (code === codes.atSign) return nok(code); return emailAtext(code); } /** * At second byte of protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function schemeOrEmailAtext(code) { if (code === codes.plusSign || code === codes.dash || code === codes.dot || asciiAlphanumeric(code)) { size = 1; return schemeInsideOrEmailAtext(code); } return emailAtext(code); } /** * In ambiguous protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function schemeInsideOrEmailAtext(code) { if (code === codes.colon) { effects.consume(code); size = 0; return urlInside; } if ((code === codes.plusSign || code === codes.dash || code === codes.dot || asciiAlphanumeric(code)) && size++ < constants.autolinkSchemeSizeMax) { effects.consume(code); return schemeInsideOrEmailAtext; } size = 0; return emailAtext(code); } /** * After protocol, in URL. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function urlInside(code) { if (code === codes.greaterThan) { effects.exit(types.autolinkProtocol); effects.enter(types.autolinkMarker); effects.consume(code); effects.exit(types.autolinkMarker); effects.exit(types.autolink); return ok$33; } if (code === codes.eof || code === codes.space || code === codes.lessThan || asciiControl(code)) return nok(code); effects.consume(code); return urlInside; } /** * In email atext. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailAtext(code) { if (code === codes.atSign) { effects.consume(code); return emailAtSignOrDot; } if (asciiAtext(code)) { effects.consume(code); return emailAtext; } return nok(code); } /** * In label, after at-sign or dot. * * ```markdown * > | ab * ^ ^ * ``` * * @type {State} */ function emailAtSignOrDot(code) { return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); } /** * In label, where `.` and `>` are allowed. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailLabel(code) { if (code === codes.dot) { effects.consume(code); size = 0; return emailAtSignOrDot; } if (code === codes.greaterThan) { effects.exit(types.autolinkProtocol).type = types.autolinkEmail; effects.enter(types.autolinkMarker); effects.consume(code); effects.exit(types.autolinkMarker); effects.exit(types.autolink); return ok$33; } return emailValue(code); } /** * In label, where `.` and `>` are *not* allowed. * * Though, this is also used in `emailLabel` to parse other values. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailValue(code) { if ((code === codes.dash || asciiAlphanumeric(code)) && size++ < constants.autolinkDomainSizeMax) { const next = code === codes.dash ? emailValue : emailLabel; effects.consume(code); return next; } return nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/block-quote.js /** * @import { * Construct, * Exiter, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var blockQuote = { continuation: { tokenize: tokenizeBlockQuoteContinuation }, exit, name: "blockQuote", tokenize: tokenizeBlockQuoteStart }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeBlockQuoteStart(effects, ok$31, nok) { const self = this; return start; /** * Start of block quote. * * ```markdown * > | > a * ^ * ``` * * @type {State} */ function start(code) { if (code === codes.greaterThan) { const state = self.containerState; ok(state, "expected `containerState` to be defined in container"); if (!state.open) { effects.enter(types.blockQuote, { _container: true }); state.open = true; } effects.enter(types.blockQuotePrefix); effects.enter(types.blockQuoteMarker); effects.consume(code); effects.exit(types.blockQuoteMarker); return after; } return nok(code); } /** * After `>`, before optional whitespace. * * ```markdown * > | > a * ^ * ``` * * @type {State} */ function after(code) { if (markdownSpace(code)) { effects.enter(types.blockQuotePrefixWhitespace); effects.consume(code); effects.exit(types.blockQuotePrefixWhitespace); effects.exit(types.blockQuotePrefix); return ok$31; } effects.exit(types.blockQuotePrefix); return ok$31(code); } } /** * Start of block quote continuation. * * ```markdown * | > a * > | > b * ^ * ``` * * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeBlockQuoteContinuation(effects, ok$32, nok) { const self = this; return contStart; /** * Start of block quote continuation. * * Also used to parse the first block quote opening. * * ```markdown * | > a * > | > b * ^ * ``` * * @type {State} */ function contStart(code) { if (markdownSpace(code)) { ok(self.parser.constructs.disable.null, "expected `disable.null` to be populated"); return factorySpace(effects, contBefore, types.linePrefix, self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize)(code); } return contBefore(code); } /** * At `>`, after optional whitespace. * * Also used to parse the first block quote opening. * * ```markdown * | > a * > | > b * ^ * ``` * * @type {State} */ function contBefore(code) { return effects.attempt(blockQuote, ok$32, nok)(code); } } /** @type {Exiter} */ function exit(effects) { effects.exit(types.blockQuote); } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/character-escape.js /** * @import { * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var characterEscape = { name: "characterEscape", tokenize: tokenizeCharacterEscape }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCharacterEscape(effects, ok$30, nok) { return start; /** * Start of character escape. * * ```markdown * > | a\*b * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.backslash, "expected `\\`"); effects.enter(types.characterEscape); effects.enter(types.escapeMarker); effects.consume(code); effects.exit(types.escapeMarker); return inside; } /** * After `\`, at punctuation. * * ```markdown * > | a\*b * ^ * ``` * * @type {State} */ function inside(code) { if (asciiPunctuation(code)) { effects.enter(types.characterEscapeValue); effects.consume(code); effects.exit(types.characterEscapeValue); effects.exit(types.characterEscape); return ok$30; } return nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/character-reference.js /** * @import { * Code, * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var characterReference = { name: "characterReference", tokenize: tokenizeCharacterReference }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCharacterReference(effects, ok$29, nok) { const self = this; let size = 0; /** @type {number} */ let max; /** @type {(code: Code) => boolean} */ let test; return start; /** * Start of character reference. * * ```markdown * > | a&b * ^ * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.ampersand, "expected `&`"); effects.enter(types.characterReference); effects.enter(types.characterReferenceMarker); effects.consume(code); effects.exit(types.characterReferenceMarker); return open; } /** * After `&`, at `#` for numeric references or alphanumeric for named * references. * * ```markdown * > | a&b * ^ * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function open(code) { if (code === codes.numberSign) { effects.enter(types.characterReferenceMarkerNumeric); effects.consume(code); effects.exit(types.characterReferenceMarkerNumeric); return numeric; } effects.enter(types.characterReferenceValue); max = constants.characterReferenceNamedSizeMax; test = asciiAlphanumeric; return value(code); } /** * After `#`, at `x` for hexadecimals or digit for decimals. * * ```markdown * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function numeric(code) { if (code === codes.uppercaseX || code === codes.lowercaseX) { effects.enter(types.characterReferenceMarkerHexadecimal); effects.consume(code); effects.exit(types.characterReferenceMarkerHexadecimal); effects.enter(types.characterReferenceValue); max = constants.characterReferenceHexadecimalSizeMax; test = asciiHexDigit; return value; } effects.enter(types.characterReferenceValue); max = constants.characterReferenceDecimalSizeMax; test = asciiDigit; return value(code); } /** * After markers (`&#x`, `&#`, or `&`), in value, before `;`. * * The character reference kind defines what and how many characters are * allowed. * * ```markdown * > | a&b * ^^^ * > | a{b * ^^^ * > | a b * ^ * ``` * * @type {State} */ function value(code) { if (code === codes.semicolon && size) { const token = effects.exit(types.characterReferenceValue); if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) return nok(code); effects.enter(types.characterReferenceMarker); effects.consume(code); effects.exit(types.characterReferenceMarker); effects.exit(types.characterReference); return ok$29; } if (test(code) && size++ < max) { effects.consume(code); return value; } return nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/code-fenced.js /** * @import { * Code, * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var nonLazyContinuation = { partial: true, tokenize: tokenizeNonLazyContinuation }; /** @type {Construct} */ var codeFenced = { concrete: true, name: "codeFenced", tokenize: tokenizeCodeFenced }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCodeFenced(effects, ok$26, nok) { const self = this; /** @type {Construct} */ const closeStart = { partial: true, tokenize: tokenizeCloseStart }; let initialPrefix = 0; let sizeOpen = 0; /** @type {NonNullable} */ let marker; return start; /** * Start of code. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function start(code) { return beforeSequenceOpen(code); } /** * In opening fence, after prefix, at sequence. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function beforeSequenceOpen(code) { ok(code === codes.graveAccent || code === codes.tilde, "expected `` ` `` or `~`"); const tail = self.events[self.events.length - 1]; initialPrefix = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0; marker = code; effects.enter(types.codeFenced); effects.enter(types.codeFencedFence); effects.enter(types.codeFencedFenceSequence); return sequenceOpen(code); } /** * In opening fence sequence. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === marker) { sizeOpen++; effects.consume(code); return sequenceOpen; } if (sizeOpen < constants.codeFencedSequenceSizeMin) return nok(code); effects.exit(types.codeFencedFenceSequence); return markdownSpace(code) ? factorySpace(effects, infoBefore, types.whitespace)(code) : infoBefore(code); } /** * In opening fence, after the sequence (and optional whitespace), before info. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function infoBefore(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.codeFencedFence); return self.interrupt ? ok$26(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); } effects.enter(types.codeFencedFenceInfo); effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return info(code); } /** * In info. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function info(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.chunkString); effects.exit(types.codeFencedFenceInfo); return infoBefore(code); } if (markdownSpace(code)) { effects.exit(types.chunkString); effects.exit(types.codeFencedFenceInfo); return factorySpace(effects, metaBefore, types.whitespace)(code); } if (code === codes.graveAccent && code === marker) return nok(code); effects.consume(code); return info; } /** * In opening fence, after info and whitespace, before meta. * * ```markdown * > | ~~~js eval * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function metaBefore(code) { if (code === codes.eof || markdownLineEnding(code)) return infoBefore(code); effects.enter(types.codeFencedFenceMeta); effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return meta(code); } /** * In meta. * * ```markdown * > | ~~~js eval * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function meta(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.chunkString); effects.exit(types.codeFencedFenceMeta); return infoBefore(code); } if (code === codes.graveAccent && code === marker) return nok(code); effects.consume(code); return meta; } /** * At eol/eof in code, before a non-lazy closing fence or content. * * ```markdown * > | ~~~js * ^ * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function atNonLazyBreak(code) { ok(markdownLineEnding(code), "expected eol"); return effects.attempt(closeStart, after, contentBefore)(code); } /** * Before code content, not a closing fence, at eol. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function contentBefore(code) { ok(markdownLineEnding(code), "expected eol"); effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return contentStart; } /** * Before code content, not a closing fence. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function contentStart(code) { return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, types.linePrefix, initialPrefix + 1)(code) : beforeContentChunk(code); } /** * Before code content, after optional prefix. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function beforeContentChunk(code) { if (code === codes.eof || markdownLineEnding(code)) return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); effects.enter(types.codeFlowValue); return contentChunk(code); } /** * In code content. * * ```markdown * | ~~~js * > | alert(1) * ^^^^^^^^ * | ~~~ * ``` * * @type {State} */ function contentChunk(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.codeFlowValue); return beforeContentChunk(code); } effects.consume(code); return contentChunk; } /** * After code. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function after(code) { effects.exit(types.codeFenced); return ok$26(code); } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCloseStart(effects, ok$27, nok) { let size = 0; return startBefore; /** * * * @type {State} */ function startBefore(code) { ok(markdownLineEnding(code), "expected eol"); effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return start; } /** * Before closing fence, at optional whitespace. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function start(code) { ok(self.parser.constructs.disable.null, "expected `disable.null` to be populated"); effects.enter(types.codeFencedFence); return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, types.linePrefix, self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize)(code) : beforeSequenceClose(code); } /** * In closing fence, after optional whitespace, at sequence. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function beforeSequenceClose(code) { if (code === marker) { effects.enter(types.codeFencedFenceSequence); return sequenceClose(code); } return nok(code); } /** * In closing fence sequence. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function sequenceClose(code) { if (code === marker) { size++; effects.consume(code); return sequenceClose; } if (size >= sizeOpen) { effects.exit(types.codeFencedFenceSequence); return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, types.whitespace)(code) : sequenceCloseAfter(code); } return nok(code); } /** * After closing fence sequence, after optional whitespace. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function sequenceCloseAfter(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.codeFencedFence); return ok$27(code); } return nok(code); } } } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeNonLazyContinuation(effects, ok$28, nok) { const self = this; return start; /** * * * @type {State} */ function start(code) { if (code === codes.eof) return nok(code); ok(markdownLineEnding(code), "expected eol"); effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return lineStart; } /** * * * @type {State} */ function lineStart(code) { return self.parser.lazy[self.now().line] ? nok(code) : ok$28(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/code-indented.js /** * @import { * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var codeIndented = { name: "codeIndented", tokenize: tokenizeCodeIndented }; /** @type {Construct} */ var furtherStart = { partial: true, tokenize: tokenizeFurtherStart }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCodeIndented(effects, ok$25, nok) { const self = this; return start; /** * Start of code (indented). * * > **Parsing note**: it is not needed to check if this first line is a * > filled line (that it has a non-whitespace character), because blank lines * > are parsed already, so we never run into that. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function start(code) { ok(markdownSpace(code)); effects.enter(types.codeIndented); return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code); } /** * At start, after 1 or 4 spaces. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1]; return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code) : nok(code); } /** * At a break. * * ```markdown * > | aaa * ^ ^ * ``` * * @type {State} */ function atBreak(code) { if (code === codes.eof) return after(code); if (markdownLineEnding(code)) return effects.attempt(furtherStart, atBreak, after)(code); effects.enter(types.codeFlowValue); return inside(code); } /** * In code content. * * ```markdown * > | aaa * ^^^^ * ``` * * @type {State} */ function inside(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.codeFlowValue); return atBreak(code); } effects.consume(code); return inside; } /** @type {State} */ function after(code) { effects.exit(types.codeIndented); return ok$25(code); } } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeFurtherStart(effects, ok, nok) { const self = this; return furtherStart; /** * At eol, trying to parse another indent. * * ```markdown * > | aaa * ^ * | bbb * ``` * * @type {State} */ function furtherStart(code) { if (self.parser.lazy[self.now().line]) return nok(code); if (markdownLineEnding(code)) { effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return furtherStart; } return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code); } /** * At start, after 1 or 4 spaces. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1]; return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/code-text.js /** * @import { * Construct, * Previous, * Resolver, * State, * TokenizeContext, * Tokenizer, * Token * } from 'micromark-util-types' */ /** @type {Construct} */ var codeText = { name: "codeText", previous, resolve: resolveCodeText, tokenize: tokenizeCodeText }; /** @type {Resolver} */ function resolveCodeText(events) { let tailExitIndex = events.length - 4; let headEnterIndex = 3; /** @type {number} */ let index; /** @type {number | undefined} */ let enter; if ((events[headEnterIndex][1].type === types.lineEnding || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === types.lineEnding || events[tailExitIndex][1].type === "space")) { index = headEnterIndex; while (++index < tailExitIndex) if (events[index][1].type === types.codeTextData) { events[headEnterIndex][1].type = types.codeTextPadding; events[tailExitIndex][1].type = types.codeTextPadding; headEnterIndex += 2; tailExitIndex -= 2; break; } } index = headEnterIndex - 1; tailExitIndex++; while (++index <= tailExitIndex) if (enter === void 0) { if (index !== tailExitIndex && events[index][1].type !== types.lineEnding) enter = index; } else if (index === tailExitIndex || events[index][1].type === types.lineEnding) { events[enter][1].type = types.codeTextData; if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end; events.splice(enter + 2, index - enter - 2); tailExitIndex -= index - enter - 2; index = enter + 2; } enter = void 0; } return events; } /** * @this {TokenizeContext} * Context. * @type {Previous} */ function previous(code) { return code !== codes.graveAccent || this.events[this.events.length - 1][1].type === types.characterEscape; } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeCodeText(effects, ok$24, nok) { const self = this; let sizeOpen = 0; /** @type {number} */ let size; /** @type {Token} */ let token; return start; /** * Start of code (text). * * ```markdown * > | `a` * ^ * > | \`a` * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.graveAccent, "expected `` ` ``"); ok(previous.call(self, self.previous), "expected correct previous"); effects.enter(types.codeText); effects.enter(types.codeTextSequence); return sequenceOpen(code); } /** * In opening sequence. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === codes.graveAccent) { effects.consume(code); sizeOpen++; return sequenceOpen; } effects.exit(types.codeTextSequence); return between(code); } /** * Between something and something else. * * ```markdown * > | `a` * ^^ * ``` * * @type {State} */ function between(code) { if (code === codes.eof) return nok(code); if (code === codes.space) { effects.enter("space"); effects.consume(code); effects.exit("space"); return between; } if (code === codes.graveAccent) { token = effects.enter(types.codeTextSequence); size = 0; return sequenceClose(code); } if (markdownLineEnding(code)) { effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return between; } effects.enter(types.codeTextData); return data(code); } /** * In data. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function data(code) { if (code === codes.eof || code === codes.space || code === codes.graveAccent || markdownLineEnding(code)) { effects.exit(types.codeTextData); return between(code); } effects.consume(code); return data; } /** * In closing sequence. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function sequenceClose(code) { if (code === codes.graveAccent) { effects.consume(code); size++; return sequenceClose; } if (size === sizeOpen) { effects.exit(types.codeTextSequence); effects.exit(types.codeText); return ok$24(code); } token.type = types.codeTextData; return data(code); } } //#endregion //#region ../node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js /** * Some of the internal operations of micromark do lots of editing * operations on very large arrays. This runs into problems with two * properties of most circa-2020 JavaScript interpreters: * * - Array-length modifications at the high end of an array (push/pop) are * expected to be common and are implemented in (amortized) time * proportional to the number of elements added or removed, whereas * other operations (shift/unshift and splice) are much less efficient. * - Function arguments are passed on the stack, so adding tens of thousands * of elements to an array with `arr.push(...newElements)` will frequently * cause stack overflows. (see ) * * SpliceBuffers are an implementation of gap buffers, which are a * generalization of the "queue made of two stacks" idea. The splice buffer * maintains a cursor, and moving the cursor has cost proportional to the * distance the cursor moves, but inserting, deleting, or splicing in * new information at the cursor is as efficient as the push/pop operation. * This allows for an efficient sequence of splices (or pushes, pops, shifts, * or unshifts) as long such edits happen at the same part of the array or * generally sweep through the array from the beginning to the end. * * The interface for splice buffers also supports large numbers of inputs by * passing a single array argument rather passing multiple arguments on the * function call stack. * * @template T * Item type. */ var SpliceBuffer = class { /** * @param {ReadonlyArray | null | undefined} [initial] * Initial items (optional). * @returns * Splice buffer. */ constructor(initial) { /** @type {Array} */ this.left = initial ? [...initial] : []; /** @type {Array} */ this.right = []; } /** * Array access; * does not move the cursor. * * @param {number} index * Index. * @return {T} * Item. */ get(index) { if (index < 0 || index >= this.left.length + this.right.length) throw new RangeError("Cannot access index `" + index + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`"); if (index < this.left.length) return this.left[index]; return this.right[this.right.length - index + this.left.length - 1]; } /** * The length of the splice buffer, one greater than the largest index in the * array. */ get length() { return this.left.length + this.right.length; } /** * Remove and return `list[0]`; * moves the cursor to `0`. * * @returns {T | undefined} * Item, optional. */ shift() { this.setCursor(0); return this.right.pop(); } /** * Slice the buffer to get an array; * does not move the cursor. * * @param {number} start * Start. * @param {number | null | undefined} [end] * End (optional). * @returns {Array} * Array of items. */ slice(start, end) { /** @type {number} */ const stop = end === null || end === void 0 ? Number.POSITIVE_INFINITY : end; if (stop < this.left.length) return this.left.slice(start, stop); if (start > this.left.length) return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse(); return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse()); } /** * Mimics the behavior of Array.prototype.splice() except for the change of * interface necessary to avoid segfaults when patching in very large arrays. * * This operation moves cursor is moved to `start` and results in the cursor * placed after any inserted items. * * @param {number} start * Start; * zero-based index at which to start changing the array; * negative numbers count backwards from the end of the array and values * that are out-of bounds are clamped to the appropriate end of the array. * @param {number | null | undefined} [deleteCount=0] * Delete count (default: `0`); * maximum number of elements to delete, starting from start. * @param {Array | null | undefined} [items=[]] * Items to include in place of the deleted items (default: `[]`). * @return {Array} * Any removed items. */ splice(start, deleteCount, items) { /** @type {number} */ const count = deleteCount || 0; this.setCursor(Math.trunc(start)); const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY); if (items) chunkedPush(this.left, items); return removed.reverse(); } /** * Remove and return the highest-numbered item in the array, so * `list[list.length - 1]`; * Moves the cursor to `length`. * * @returns {T | undefined} * Item, optional. */ pop() { this.setCursor(Number.POSITIVE_INFINITY); return this.left.pop(); } /** * Inserts a single item to the high-numbered side of the array; * moves the cursor to `length`. * * @param {T} item * Item. * @returns {undefined} * Nothing. */ push(item) { this.setCursor(Number.POSITIVE_INFINITY); this.left.push(item); } /** * Inserts many items to the high-numbered side of the array. * Moves the cursor to `length`. * * @param {Array} items * Items. * @returns {undefined} * Nothing. */ pushMany(items) { this.setCursor(Number.POSITIVE_INFINITY); chunkedPush(this.left, items); } /** * Inserts a single item to the low-numbered side of the array; * Moves the cursor to `0`. * * @param {T} item * Item. * @returns {undefined} * Nothing. */ unshift(item) { this.setCursor(0); this.right.push(item); } /** * Inserts many items to the low-numbered side of the array; * moves the cursor to `0`. * * @param {Array} items * Items. * @returns {undefined} * Nothing. */ unshiftMany(items) { this.setCursor(0); chunkedPush(this.right, items.reverse()); } /** * Move the cursor to a specific position in the array. Requires * time proportional to the distance moved. * * If `n < 0`, the cursor will end up at the beginning. * If `n > length`, the cursor will end up at the end. * * @param {number} n * Position. * @return {undefined} * Nothing. */ setCursor(n) { if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return; if (n < this.left.length) { const removed = this.left.splice(n, Number.POSITIVE_INFINITY); chunkedPush(this.right, removed.reverse()); } else { const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY); chunkedPush(this.left, removed.reverse()); } } }; /** * Avoid stack overflow by pushing items onto the stack in segments * * @template T * Item type. * @param {Array} list * List to inject into. * @param {ReadonlyArray} right * Items to inject. * @return {undefined} * Nothing. */ function chunkedPush(list, right) { /** @type {number} */ let chunkStart = 0; if (right.length < constants.v8MaxSafeChunkSize) list.push(...right); else while (chunkStart < right.length) { list.push(...right.slice(chunkStart, chunkStart + constants.v8MaxSafeChunkSize)); chunkStart += constants.v8MaxSafeChunkSize; } } //#endregion //#region ../node_modules/micromark-util-subtokenize/dev/index.js /** * @import {Chunk, Event, Token} from 'micromark-util-types' */ /** * Tokenize subcontent. * * @param {Array} eventsArray * List of events. * @returns {boolean} * Whether subtokens were found. */ function subtokenize(eventsArray) { /** @type {Record} */ const jumps = {}; let index = -1; /** @type {Event} */ let event; /** @type {number | undefined} */ let lineIndex; /** @type {number} */ let otherIndex; /** @type {Event} */ let otherEvent; /** @type {Array} */ let parameters; /** @type {Array} */ let subevents; /** @type {boolean | undefined} */ let more; const events = new SpliceBuffer(eventsArray); while (++index < events.length) { while (index in jumps) index = jumps[index]; event = events.get(index); if (index && event[1].type === types.chunkFlow && events.get(index - 1)[1].type === types.listItemPrefix) { ok(event[1]._tokenizer, "expected `_tokenizer` on subtokens"); subevents = event[1]._tokenizer.events; otherIndex = 0; if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.lineEndingBlank) otherIndex += 2; if (otherIndex < subevents.length && subevents[otherIndex][1].type === types.content) while (++otherIndex < subevents.length) { if (subevents[otherIndex][1].type === types.content) break; if (subevents[otherIndex][1].type === types.chunkText) { subevents[otherIndex][1]._isInFirstContentOfListItem = true; otherIndex++; } } } if (event[0] === "enter") { if (event[1].contentType) { Object.assign(jumps, subcontent(events, index)); index = jumps[index]; more = true; } } else if (event[1]._container) { otherIndex = index; lineIndex = void 0; while (otherIndex--) { otherEvent = events.get(otherIndex); if (otherEvent[1].type === types.lineEnding || otherEvent[1].type === types.lineEndingBlank) { if (otherEvent[0] === "enter") { if (lineIndex) events.get(lineIndex)[1].type = types.lineEndingBlank; otherEvent[1].type = types.lineEnding; lineIndex = otherIndex; } } else if (otherEvent[1].type === types.linePrefix || otherEvent[1].type === types.listItemIndent) {} else break; } if (lineIndex) { event[1].end = { ...events.get(lineIndex)[1].start }; parameters = events.slice(lineIndex, index); parameters.unshift(event); events.splice(lineIndex, index - lineIndex + 1, parameters); } } } splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)); return !more; } /** * Tokenize embedded tokens. * * @param {SpliceBuffer} events * Events. * @param {number} eventIndex * Index. * @returns {Record} * Gaps. */ function subcontent(events, eventIndex) { const token = events.get(eventIndex)[1]; const context = events.get(eventIndex)[2]; let startPosition = eventIndex - 1; /** @type {Array} */ const startPositions = []; ok(token.contentType, "expected `contentType` on subtokens"); let tokenizer = token._tokenizer; if (!tokenizer) { tokenizer = context.parser[token.contentType](token.start); if (token._contentTypeTextTrailing) tokenizer._contentTypeTextTrailing = true; } const childEvents = tokenizer.events; /** @type {Array<[number, number]>} */ const jumps = []; /** @type {Record} */ const gaps = {}; /** @type {Array} */ let stream; /** @type {Token | undefined} */ let previous; let index = -1; /** @type {Token | undefined} */ let current = token; let adjust = 0; let start = 0; const breaks = [start]; while (current) { while (events.get(++startPosition)[1] !== current); ok(!previous || current.previous === previous, "expected previous to match"); ok(!previous || previous.next === current, "expected next to match"); startPositions.push(startPosition); if (!current._tokenizer) { stream = context.sliceStream(current); if (!current.next) stream.push(codes.eof); if (previous) tokenizer.defineSkip(current.start); if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = true; tokenizer.write(stream); if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = void 0; } previous = current; current = current.next; } current = token; while (++index < childEvents.length) if (childEvents[index][0] === "exit" && childEvents[index - 1][0] === "enter" && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) { ok(current, "expected a current token"); start = index + 1; breaks.push(start); current._tokenizer = void 0; current.previous = void 0; current = current.next; } tokenizer.events = []; if (current) { current._tokenizer = void 0; current.previous = void 0; ok(!current.next, "expected no next token"); } else breaks.pop(); index = breaks.length; while (index--) { const slice = childEvents.slice(breaks[index], breaks[index + 1]); const start = startPositions.pop(); ok(start !== void 0, "expected a start position when splicing"); jumps.push([start, start + slice.length - 1]); events.splice(start, 2, slice); } jumps.reverse(); index = -1; while (++index < jumps.length) { gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; adjust += jumps[index][1] - jumps[index][0] - 1; } return gaps; } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/content.js /** * @import { * Construct, * Resolver, * State, * TokenizeContext, * Tokenizer, * Token * } from 'micromark-util-types' */ /** * No name because it must not be turned off. * @type {Construct} */ var content = { resolve: resolveContent, tokenize: tokenizeContent }; /** @type {Construct} */ var continuationConstruct = { partial: true, tokenize: tokenizeContinuation }; /** * Content is transparent: it’s parsed right now. That way, definitions are also * parsed right now: before text in paragraphs (specifically, media) are parsed. * * @type {Resolver} */ function resolveContent(events) { subtokenize(events); return events; } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeContent(effects, ok$22) { /** @type {Token | undefined} */ let previous; return chunkStart; /** * Before a content chunk. * * ```markdown * > | abc * ^ * ``` * * @type {State} */ function chunkStart(code) { ok(code !== codes.eof && !markdownLineEnding(code), "expected no eof or eol"); effects.enter(types.content); previous = effects.enter(types.chunkContent, { contentType: constants.contentTypeContent }); return chunkInside(code); } /** * In a content chunk. * * ```markdown * > | abc * ^^^ * ``` * * @type {State} */ function chunkInside(code) { if (code === codes.eof) return contentEnd(code); if (markdownLineEnding(code)) return effects.check(continuationConstruct, contentContinue, contentEnd)(code); effects.consume(code); return chunkInside; } /** * * * @type {State} */ function contentEnd(code) { effects.exit(types.chunkContent); effects.exit(types.content); return ok$22(code); } /** * * * @type {State} */ function contentContinue(code) { ok(markdownLineEnding(code), "expected eol"); effects.consume(code); effects.exit(types.chunkContent); ok(previous, "expected previous token"); previous.next = effects.enter(types.chunkContent, { contentType: constants.contentTypeContent, previous }); previous = previous.next; return chunkInside; } } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeContinuation(effects, ok$23, nok) { const self = this; return startLookahead; /** * * * @type {State} */ function startLookahead(code) { ok(markdownLineEnding(code), "expected a line ending"); effects.exit(types.chunkContent); effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return factorySpace(effects, prefixed, types.linePrefix); } /** * * * @type {State} */ function prefixed(code) { if (code === codes.eof || markdownLineEnding(code)) return nok(code); ok(self.parser.constructs.disable.null, "expected `disable.null` to be populated"); const tail = self.events[self.events.length - 1]; if (!self.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize) return ok$23(code); return effects.interrupt(self.parser.constructs.flow, nok, ok$23)(code); } } //#endregion //#region ../node_modules/micromark-factory-destination/dev/index.js /** * @import {Effects, State, TokenType} from 'micromark-util-types' */ /** * Parse destinations. * * ###### Examples * * ```markdown * * b> * * * a * a\)b * a(b)c * a(b) * ``` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type for whole (`` or `b`). * @param {TokenType} literalType * Type when enclosed (``). * @param {TokenType} literalMarkerType * Type for enclosing (`<` and `>`). * @param {TokenType} rawType * Type when not enclosed (`b`). * @param {TokenType} stringType * Type for the value (`a` or `b`). * @param {number | undefined} [max=Infinity] * Depth of nested parens (inclusive). * @returns {State} * Start state. */ function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) { const limit = max || Number.POSITIVE_INFINITY; let balance = 0; return start; /** * Start of destination. * * ```markdown * > | * ^ * > | aa * ^ * ``` * * @type {State} */ function start(code) { if (code === codes.lessThan) { effects.enter(type); effects.enter(literalType); effects.enter(literalMarkerType); effects.consume(code); effects.exit(literalMarkerType); return enclosedBefore; } if (code === codes.eof || code === codes.space || code === codes.rightParenthesis || asciiControl(code)) return nok(code); effects.enter(type); effects.enter(rawType); effects.enter(stringType); effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return raw(code); } /** * After `<`, at an enclosed destination. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosedBefore(code) { if (code === codes.greaterThan) { effects.enter(literalMarkerType); effects.consume(code); effects.exit(literalMarkerType); effects.exit(literalType); effects.exit(type); return ok; } effects.enter(stringType); effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return enclosed(code); } /** * In enclosed destination. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosed(code) { if (code === codes.greaterThan) { effects.exit(types.chunkString); effects.exit(stringType); return enclosedBefore(code); } if (code === codes.eof || code === codes.lessThan || markdownLineEnding(code)) return nok(code); effects.consume(code); return code === codes.backslash ? enclosedEscape : enclosed; } /** * After `\`, at a special character. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosedEscape(code) { if (code === codes.lessThan || code === codes.greaterThan || code === codes.backslash) { effects.consume(code); return enclosed; } return enclosed(code); } /** * In raw destination. * * ```markdown * > | aa * ^ * ``` * * @type {State} */ function raw(code) { if (!balance && (code === codes.eof || code === codes.rightParenthesis || markdownLineEndingOrSpace(code))) { effects.exit(types.chunkString); effects.exit(stringType); effects.exit(rawType); effects.exit(type); return ok(code); } if (balance < limit && code === codes.leftParenthesis) { effects.consume(code); balance++; return raw; } if (code === codes.rightParenthesis) { effects.consume(code); balance--; return raw; } if (code === codes.eof || code === codes.space || code === codes.leftParenthesis || asciiControl(code)) return nok(code); effects.consume(code); return code === codes.backslash ? rawEscape : raw; } /** * After `\`, at special character. * * ```markdown * > | a\*a * ^ * ``` * * @type {State} */ function rawEscape(code) { if (code === codes.leftParenthesis || code === codes.rightParenthesis || code === codes.backslash) { effects.consume(code); return raw; } return raw(code); } } //#endregion //#region ../node_modules/micromark-factory-label/dev/index.js /** * @import { * Effects, * State, * TokenizeContext, * TokenType * } from 'micromark-util-types' */ /** * Parse labels. * * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. * * ###### Examples * * ```markdown * [a] * [a * b] * [a\]b] * ``` * * @this {TokenizeContext} * Tokenize context. * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type of the whole label (`[a]`). * @param {TokenType} markerType * Type for the markers (`[` and `]`). * @param {TokenType} stringType * Type for the identifier (`a`). * @returns {State} * Start state. */ function factoryLabel(effects, ok$21, nok, type, markerType, stringType) { const self = this; let size = 0; /** @type {boolean} */ let seen; return start; /** * Start of label. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function start(code) { ok(code === codes.leftSquareBracket, "expected `[`"); effects.enter(type); effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.enter(stringType); return atBreak; } /** * In label, at something, before something else. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function atBreak(code) { if (size > constants.linkReferenceSizeMax || code === codes.eof || code === codes.leftSquareBracket || code === codes.rightSquareBracket && !seen || code === codes.caret && !size && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code); if (code === codes.rightSquareBracket) { effects.exit(stringType); effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.exit(type); return ok$21; } if (markdownLineEnding(code)) { effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return atBreak; } effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return labelInside(code); } /** * In label, in text. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function labelInside(code) { if (code === codes.eof || code === codes.leftSquareBracket || code === codes.rightSquareBracket || markdownLineEnding(code) || size++ > constants.linkReferenceSizeMax) { effects.exit(types.chunkString); return atBreak(code); } effects.consume(code); if (!seen) seen = !markdownSpace(code); return code === codes.backslash ? labelEscape : labelInside; } /** * After `\`, at a special character. * * ```markdown * > | [a\*a] * ^ * ``` * * @type {State} */ function labelEscape(code) { if (code === codes.leftSquareBracket || code === codes.backslash || code === codes.rightSquareBracket) { effects.consume(code); size++; return labelInside; } return labelInside(code); } } //#endregion //#region ../node_modules/micromark-factory-title/dev/index.js /** * @import { * Code, * Effects, * State, * TokenType * } from 'micromark-util-types' */ /** * Parse titles. * * ###### Examples * * ```markdown * "a" * 'b' * (c) * "a * b" * 'a * b' * (a\)b) * ``` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type of the whole title (`"a"`, `'b'`, `(c)`). * @param {TokenType} markerType * Type for the markers (`"`, `'`, `(`, and `)`). * @param {TokenType} stringType * Type for the value (`a`). * @returns {State} * Start state. */ function factoryTitle(effects, ok, nok, type, markerType, stringType) { /** @type {NonNullable} */ let marker; return start; /** * Start of title. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function start(code) { if (code === codes.quotationMark || code === codes.apostrophe || code === codes.leftParenthesis) { effects.enter(type); effects.enter(markerType); effects.consume(code); effects.exit(markerType); marker = code === codes.leftParenthesis ? codes.rightParenthesis : code; return begin; } return nok(code); } /** * After opening marker. * * This is also used at the closing marker. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function begin(code) { if (code === marker) { effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.exit(type); return ok; } effects.enter(stringType); return atBreak(code); } /** * At something, before something else. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function atBreak(code) { if (code === marker) { effects.exit(stringType); return begin(marker); } if (code === codes.eof) return nok(code); if (markdownLineEnding(code)) { effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return factorySpace(effects, atBreak, types.linePrefix); } effects.enter(types.chunkString, { contentType: constants.contentTypeString }); return inside(code); } /** * * * @type {State} */ function inside(code) { if (code === marker || code === codes.eof || markdownLineEnding(code)) { effects.exit(types.chunkString); return atBreak(code); } effects.consume(code); return code === codes.backslash ? escape : inside; } /** * After `\`, at a special character. * * ```markdown * > | "a\*b" * ^ * ``` * * @type {State} */ function escape(code) { if (code === marker || code === codes.backslash) { effects.consume(code); return inside; } return inside(code); } } //#endregion //#region ../node_modules/micromark-factory-whitespace/dev/index.js /** * @import {Effects, State} from 'micromark-util-types' */ /** * Parse spaces and tabs. * * There is no `nok` parameter: * * * line endings or spaces in markdown are often optional, in which case this * factory can be used and `ok` will be switched to whether spaces were found * or not * * one line ending or space can be detected with * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @returns {State} * Start state. */ function factoryWhitespace(effects, ok) { /** @type {boolean} */ let seen; return start; /** @type {State} */ function start(code) { if (markdownLineEnding(code)) { effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); seen = true; return start; } if (markdownSpace(code)) return factorySpace(effects, start, seen ? types.linePrefix : types.lineSuffix)(code); return ok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/definition.js /** * @import { * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var definition = { name: "definition", tokenize: tokenizeDefinition }; /** @type {Construct} */ var titleBefore = { partial: true, tokenize: tokenizeTitleBefore }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeDefinition(effects, ok$20, nok) { const self = this; /** @type {string} */ let identifier; return start; /** * At start of a definition. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function start(code) { effects.enter(types.definition); return before(code); } /** * After optional whitespace, at `[`. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function before(code) { ok(code === codes.leftSquareBracket, "expected `[`"); return factoryLabel.call(self, effects, labelAfter, nok, types.definitionLabel, types.definitionLabelMarker, types.definitionLabelString)(code); } /** * After label. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function labelAfter(code) { identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)); if (code === codes.colon) { effects.enter(types.definitionMarker); effects.consume(code); effects.exit(types.definitionMarker); return markerAfter; } return nok(code); } /** * After marker. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function markerAfter(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code); } /** * Before destination. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function destinationBefore(code) { return factoryDestination(effects, destinationAfter, nok, types.definitionDestination, types.definitionDestinationLiteral, types.definitionDestinationLiteralMarker, types.definitionDestinationRaw, types.definitionDestinationString)(code); } /** * After destination. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function destinationAfter(code) { return effects.attempt(titleBefore, after, after)(code); } /** * After definition. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function after(code) { return markdownSpace(code) ? factorySpace(effects, afterWhitespace, types.whitespace)(code) : afterWhitespace(code); } /** * After definition, after optional whitespace. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function afterWhitespace(code) { if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.definition); self.parser.defined.push(identifier); return ok$20(code); } return nok(code); } } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeTitleBefore(effects, ok, nok) { return titleBefore; /** * After destination, at whitespace. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleBefore(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code); } /** * At title. * * ```markdown * | [a]: b * > | "c" * ^ * ``` * * @type {State} */ function beforeMarker(code) { return factoryTitle(effects, titleAfter, nok, types.definitionTitle, types.definitionTitleMarker, types.definitionTitleString)(code); } /** * After title. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleAfter(code) { return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, types.whitespace)(code) : titleAfterOptionalWhitespace(code); } /** * After title, after optional whitespace. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleAfterOptionalWhitespace(code) { return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js /** * @import { * Construct, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var hardBreakEscape = { name: "hardBreakEscape", tokenize: tokenizeHardBreakEscape }; /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeHardBreakEscape(effects, ok$19, nok) { return start; /** * Start of a hard break (escape). * * ```markdown * > | a\ * ^ * | b * ``` * * @type {State} */ function start(code) { ok(code === codes.backslash, "expected `\\`"); effects.enter(types.hardBreakEscape); effects.consume(code); return after; } /** * After `\`, at eol. * * ```markdown * > | a\ * ^ * | b * ``` * * @type {State} */ function after(code) { if (markdownLineEnding(code)) { effects.exit(types.hardBreakEscape); return ok$19(code); } return nok(code); } } //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/heading-atx.js /** * @import { * Construct, * Resolver, * State, * TokenizeContext, * Tokenizer, * Token * } from 'micromark-util-types' */ /** @type {Construct} */ var headingAtx = { name: "headingAtx", resolve: resolveHeadingAtx, tokenize: tokenizeHeadingAtx }; /** @type {Resolver} */ function resolveHeadingAtx(events, context) { let contentEnd = events.length - 2; let contentStart = 3; /** @type {Token} */ let content; /** @type {Token} */ let text; if (events[contentStart][1].type === types.whitespace) contentStart += 2; if (contentEnd - 2 > contentStart && events[contentEnd][1].type === types.whitespace) contentEnd -= 2; if (events[contentEnd][1].type === types.atxHeadingSequence && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === types.whitespace)) contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; if (contentEnd > contentStart) { content = { type: types.atxHeadingText, start: events[contentStart][1].start, end: events[contentEnd][1].end }; text = { type: types.chunkText, start: events[contentStart][1].start, end: events[contentEnd][1].end, contentType: constants.contentTypeText }; splice(events, contentStart, contentEnd - contentStart + 1, [ [ "enter", content, context ], [ "enter", text, context ], [ "exit", text, context ], [ "exit", content, context ] ]); } return events; } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeHeadingAtx(effects, ok$18, nok) { let size = 0; return start; /** * Start of a heading (atx). * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function start(code) { effects.enter(types.atxHeading); return before(code); } /** * After optional whitespace, at `#`. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function before(code) { ok(code === codes.numberSign, "expected `#`"); effects.enter(types.atxHeadingSequence); return sequenceOpen(code); } /** * In opening sequence. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === codes.numberSign && size++ < constants.atxHeadingOpeningFenceSizeMax) { effects.consume(code); return sequenceOpen; } if (code === codes.eof || markdownLineEndingOrSpace(code)) { effects.exit(types.atxHeadingSequence); return atBreak(code); } return nok(code); } /** * After something, before something else. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function atBreak(code) { if (code === codes.numberSign) { effects.enter(types.atxHeadingSequence); return sequenceFurther(code); } if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.atxHeading); return ok$18(code); } if (markdownSpace(code)) return factorySpace(effects, atBreak, types.whitespace)(code); effects.enter(types.atxHeadingText); return data(code); } /** * In further sequence (after whitespace). * * Could be normal “visible” hashes in the heading or a final sequence. * * ```markdown * > | ## aa ## * ^ * ``` * * @type {State} */ function sequenceFurther(code) { if (code === codes.numberSign) { effects.consume(code); return sequenceFurther; } effects.exit(types.atxHeadingSequence); return atBreak(code); } /** * In text. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function data(code) { if (code === codes.eof || code === codes.numberSign || markdownLineEndingOrSpace(code)) { effects.exit(types.atxHeadingText); return atBreak(code); } effects.consume(code); return data; } } //#endregion //#region ../node_modules/micromark-util-html-tag-name/index.js /** * List of lowercase HTML “block” tag names. * * The list, when parsing HTML (flow), results in more relaxed rules (condition * 6). * Because they are known blocks, the HTML-like syntax doesn’t have to be * strictly parsed. * For tag names not in this list, a more strict algorithm (condition 7) is used * to detect whether the HTML-like syntax is seen as HTML (flow) or not. * * This is copied from: * . * * > 👉 **Note**: `search` was added in `CommonMark@0.31`. */ var htmlBlockNames = [ "address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "search", "section", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul" ]; /** * List of lowercase HTML “raw” tag names. * * The list, when parsing HTML (flow), results in HTML that can include lines * without exiting, until a closing tag also in this list is found (condition * 1). * * This module is copied from: * . * * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. */ var htmlRawNames = [ "pre", "script", "style", "textarea" ]; //#endregion //#region ../node_modules/micromark-core-commonmark/dev/lib/html-flow.js /** * @import { * Code, * Construct, * Resolver, * State, * TokenizeContext, * Tokenizer * } from 'micromark-util-types' */ /** @type {Construct} */ var htmlFlow = { concrete: true, name: "htmlFlow", resolveTo: resolveToHtmlFlow, tokenize: tokenizeHtmlFlow }; /** @type {Construct} */ var blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore }; var nonLazyContinuationStart = { partial: true, tokenize: tokenizeNonLazyContinuationStart }; /** @type {Resolver} */ function resolveToHtmlFlow(events) { let index = events.length; while (index--) if (events[index][0] === "enter" && events[index][1].type === types.htmlFlow) break; if (index > 1 && events[index - 2][1].type === types.linePrefix) { events[index][1].start = events[index - 2][1].start; events[index + 1][1].start = events[index - 2][1].start; events.splice(index - 2, 2); } return events; } /** * @this {TokenizeContext} * Context. * @type {Tokenizer} */ function tokenizeHtmlFlow(effects, ok$16, nok) { const self = this; /** @type {number} */ let marker; /** @type {boolean} */ let closingTag; /** @type {string} */ let buffer; /** @type {number} */ let index; /** @type {Code} */ let markerB; return start; /** * Start of HTML (flow). * * ```markdown * > | * ^ * ``` * * @type {State} */ function start(code) { return before(code); } /** * At `<`, after optional whitespace. * * ```markdown * > | * ^ * ``` * * @type {State} */ function before(code) { ok(code === codes.lessThan, "expected `<`"); effects.enter(types.htmlFlow); effects.enter(types.htmlFlowData); effects.consume(code); return open; } /** * After `<`, at tag name or other stuff. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function open(code) { if (code === codes.exclamationMark) { effects.consume(code); return declarationOpen; } if (code === codes.slash) { effects.consume(code); closingTag = true; return tagCloseStart; } if (code === codes.questionMark) { effects.consume(code); marker = constants.htmlInstruction; return self.interrupt ? ok$16 : continuationDeclarationInside; } if (asciiAlpha(code)) { ok(code !== null); effects.consume(code); buffer = String.fromCharCode(code); return tagName; } return nok(code); } /** * After ` | * ^ * > | * ^ * > | &<]]> * ^ * ``` * * @type {State} */ function declarationOpen(code) { if (code === codes.dash) { effects.consume(code); marker = constants.htmlComment; return commentOpenInside; } if (code === codes.leftSquareBracket) { effects.consume(code); marker = constants.htmlCdata; index = 0; return cdataOpenInside; } if (asciiAlpha(code)) { effects.consume(code); marker = constants.htmlDeclaration; return self.interrupt ? ok$16 : continuationDeclarationInside; } return nok(code); } /** * After ` | * ^ * ``` * * @type {State} */ function commentOpenInside(code) { if (code === codes.dash) { effects.consume(code); return self.interrupt ? ok$16 : continuationDeclarationInside; } return nok(code); } /** * After ` | &<]]> * ^^^^^^ * ``` * * @type {State} */ function cdataOpenInside(code) { const value = constants.cdataOpeningString; if (code === value.charCodeAt(index++)) { effects.consume(code); if (index === value.length) return self.interrupt ? ok$16 : continuation; return cdataOpenInside; } return nok(code); } /** * After ` | * ^ * ``` * * @type {State} */ function tagCloseStart(code) { if (asciiAlpha(code)) { ok(code !== null); effects.consume(code); buffer = String.fromCharCode(code); return tagName; } return nok(code); } /** * In tag name. * * ```markdown * > | * ^^ * > | * ^^ * ``` * * @type {State} */ function tagName(code) { if (code === codes.eof || code === codes.slash || code === codes.greaterThan || markdownLineEndingOrSpace(code)) { const slash = code === codes.slash; const name = buffer.toLowerCase(); if (!slash && !closingTag && htmlRawNames.includes(name)) { marker = constants.htmlRaw; return self.interrupt ? ok$16(code) : continuation(code); } if (htmlBlockNames.includes(buffer.toLowerCase())) { marker = constants.htmlBasic; if (slash) { effects.consume(code); return basicSelfClosing; } return self.interrupt ? ok$16(code) : continuation(code); } marker = constants.htmlComplete; return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code); } if (code === codes.dash || asciiAlphanumeric(code)) { effects.consume(code); buffer += String.fromCharCode(code); return tagName; } return nok(code); } /** * After closing slash of a basic tag name. * * ```markdown * > |
* ^ * ``` * * @type {State} */ function basicSelfClosing(code) { if (code === codes.greaterThan) { effects.consume(code); return self.interrupt ? ok$16 : continuation; } return nok(code); } /** * After closing slash of a complete tag name. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeClosingTagAfter(code) { if (markdownSpace(code)) { effects.consume(code); return completeClosingTagAfter; } return completeEnd(code); } /** * At an attribute name. * * At first, this state is used after a complete tag name, after whitespace, * where it expects optional attributes or the end of the tag. * It is also reused after attributes, when expecting more optional * attributes. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeNameBefore(code) { if (code === codes.slash) { effects.consume(code); return completeEnd; } if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { effects.consume(code); return completeAttributeName; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameBefore; } return completeEnd(code); } /** * In attribute name. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeName(code) { if (code === codes.dash || code === codes.dot || code === codes.colon || code === codes.underscore || asciiAlphanumeric(code)) { effects.consume(code); return completeAttributeName; } return completeAttributeNameAfter(code); } /** * After attribute name, at an optional initializer, the end of the tag, or * whitespace. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeNameAfter(code) { if (code === codes.equalsTo) { effects.consume(code); return completeAttributeValueBefore; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameAfter; } return completeAttributeNameBefore(code); } /** * Before unquoted, double quoted, or single quoted attribute value, allowing * whitespace. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeValueBefore(code) { if (code === codes.eof || code === codes.lessThan || code === codes.equalsTo || code === codes.greaterThan || code === codes.graveAccent) return nok(code); if (code === codes.quotationMark || code === codes.apostrophe) { effects.consume(code); markerB = code; return completeAttributeValueQuoted; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeValueBefore; } return completeAttributeValueUnquoted(code); } /** * In double or single quoted attribute value. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeValueQuoted(code) { if (code === markerB) { effects.consume(code); markerB = null; return completeAttributeValueQuotedAfter; } if (code === codes.eof || markdownLineEnding(code)) return nok(code); effects.consume(code); return completeAttributeValueQuoted; } /** * In unquoted attribute value. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAttributeValueUnquoted(code) { if (code === codes.eof || code === codes.quotationMark || code === codes.apostrophe || code === codes.slash || code === codes.lessThan || code === codes.equalsTo || code === codes.greaterThan || code === codes.graveAccent || markdownLineEndingOrSpace(code)) return completeAttributeNameAfter(code); effects.consume(code); return completeAttributeValueUnquoted; } /** * After double or single quoted attribute value, before whitespace or the * end of the tag. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAttributeValueQuotedAfter(code) { if (code === codes.slash || code === codes.greaterThan || markdownSpace(code)) return completeAttributeNameBefore(code); return nok(code); } /** * In certain circumstances of a complete tag where only an `>` is allowed. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeEnd(code) { if (code === codes.greaterThan) { effects.consume(code); return completeAfter; } return nok(code); } /** * After `>` in a complete tag. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAfter(code) { if (code === codes.eof || markdownLineEnding(code)) return continuation(code); if (markdownSpace(code)) { effects.consume(code); return completeAfter; } return nok(code); } /** * In continuation of any HTML kind. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuation(code) { if (code === codes.dash && marker === constants.htmlComment) { effects.consume(code); return continuationCommentInside; } if (code === codes.lessThan && marker === constants.htmlRaw) { effects.consume(code); return continuationRawTagOpen; } if (code === codes.greaterThan && marker === constants.htmlDeclaration) { effects.consume(code); return continuationClose; } if (code === codes.questionMark && marker === constants.htmlInstruction) { effects.consume(code); return continuationDeclarationInside; } if (code === codes.rightSquareBracket && marker === constants.htmlCdata) { effects.consume(code); return continuationCdataInside; } if (markdownLineEnding(code) && (marker === constants.htmlBasic || marker === constants.htmlComplete)) { effects.exit(types.htmlFlowData); return effects.check(blankLineBefore, continuationAfter, continuationStart)(code); } if (code === codes.eof || markdownLineEnding(code)) { effects.exit(types.htmlFlowData); return continuationStart(code); } effects.consume(code); return continuation; } /** * In continuation, at eol. * * ```markdown * > | * ^ * | asd * ``` * * @type {State} */ function continuationStart(code) { return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code); } /** * In continuation, at eol, before non-lazy content. * * ```markdown * > | * ^ * | asd * ``` * * @type {State} */ function continuationStartNonLazy(code) { ok(markdownLineEnding(code)); effects.enter(types.lineEnding); effects.consume(code); effects.exit(types.lineEnding); return continuationBefore; } /** * In continuation, before non-lazy content. * * ```markdown * | * > | asd * ^ * ``` * * @type {State} */ function continuationBefore(code) { if (code === codes.eof || markdownLineEnding(code)) return continuationStart(code); effects.enter(types.htmlFlowData); return continuation(code); } /** * In comment continuation, after one `-`, expecting another. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuationCommentInside(code) { if (code === codes.dash) { effects.consume(code); return continuationDeclarationInside; } return continuation(code); } /** * In raw continuation, after `<`, at `/`. * * ```markdown * > |