(self["webpackChunkweb"] = self["webpackChunkweb"] || []).push([[104],{ /***/ 27856: /***/ (function(module) { /*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */ (function (global, factory) { true ? module.exports = factory() : 0; })(this, (function () { 'use strict'; const { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object; let { freeze, seal, create } = Object; // eslint-disable-line import/no-mutable-exports let { apply, construct } = typeof Reflect !== 'undefined' && Reflect; if (!freeze) { freeze = function freeze(x) { return x; }; } if (!seal) { seal = function seal(x) { return x; }; } if (!apply) { apply = function apply(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!construct) { construct = function construct(Func, args) { return new Func(...args); }; } const arrayForEach = unapply(Array.prototype.forEach); const arrayPop = unapply(Array.prototype.pop); const arrayPush = unapply(Array.prototype.push); const stringToLowerCase = unapply(String.prototype.toLowerCase); const stringToString = unapply(String.prototype.toString); const stringMatch = unapply(String.prototype.match); const stringReplace = unapply(String.prototype.replace); const stringIndexOf = unapply(String.prototype.indexOf); const stringTrim = unapply(String.prototype.trim); const regExpTest = unapply(RegExp.prototype.test); const typeErrorCreate = unconstruct(TypeError); /** * Creates a new function that calls the given function with a specified thisArg and arguments. * * @param {Function} func - The function to be wrapped and called. * @returns {Function} A new function that calls the given function with a specified thisArg and arguments. */ function unapply(func) { return function (thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * * @param {Function} func - The constructor function to be wrapped and called. * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments. */ function unconstruct(func) { return function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } /** * Add properties to a lookup table * * @param {Object} set - The set to which elements will be added. * @param {Array} array - The array containing elements to be added to the set. * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set. * @returns {Object} The modified set with added elements. */ function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } let l = array.length; while (l--) { let element = array[l]; if (typeof element === 'string') { const lcElement = transformCaseFunc(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /** * Shallow clone an object * * @param {Object} object - The object to be cloned. * @returns {Object} A new object that copies the original. */ function clone(object) { const newObject = create(null); for (const [property, value] of entries(object)) { if (getOwnPropertyDescriptor(object, property) !== undefined) { newObject[property] = value; } } return newObject; } /** * This method automatically checks if the prop is function or getter and behaves accordingly. * * @param {Object} object - The object to look up the getter function in its prototype chain. * @param {String} prop - The property name for which to find the getter function. * @returns {Function} The getter function found in the prototype chain or a fallback function. */ function lookupGetter(object, prop) { while (object !== null) { const desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === 'function') { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn('fallback value for', element); return null; } return fallbackValue; } const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace // checks properly in case one wants to add them to // allow-list. const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements, // even those that we disallow by default. const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); const text = freeze(['#text']); const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); const DOCTYPE_NAME = seal(/^html$/i); var EXPRESSIONS = /*#__PURE__*/Object.freeze({ __proto__: null, MUSTACHE_EXPR: MUSTACHE_EXPR, ERB_EXPR: ERB_EXPR, TMPLIT_EXPR: TMPLIT_EXPR, DATA_ATTR: DATA_ATTR, ARIA_ATTR: ARIA_ATTR, IS_ALLOWED_URI: IS_ALLOWED_URI, IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA, ATTR_WHITESPACE: ATTR_WHITESPACE, DOCTYPE_NAME: DOCTYPE_NAME }); const getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix). * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported or creating the policy failed). */ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) { if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. let suffix = null; const ATTR_NAME = 'data-tt-policy-suffix'; if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { suffix = purifyHostElement.getAttribute(ATTR_NAME); } const policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML(html) { return html; }, createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); const DOMPurify = root => createDOMPurify(root); /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '3.0.6'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } let { document } = window; const originalDocument = document; const currentScript = originalDocument.currentScript; const { DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window; const ElementPrototype = Element.prototype; const cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); const getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { const template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } let trustedTypesPolicy; let emptyHTML = ''; const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document; const { importNode } = originalDocument; let hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined; const { MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE } = EXPRESSIONS; let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ let ALLOWED_TAGS = null; const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); /* Allowed attribute names */ let ALLOWED_ATTR = null; const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]); /* * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. */ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ let FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ let FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ let ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ let ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ let ALLOW_UNKNOWN_PROTOCOLS = false; /* Decide if self-closing tags in attributes are allowed. * Usually removed due to a mXSS issue in jQuery 3.0 */ let ALLOW_SELF_CLOSE_IN_ATTR = true; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ let SAFE_FOR_TEMPLATES = false; /* Decide if document with ... should be returned */ let WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ let SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ let FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ let RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ let RETURN_DOM_FRAGMENT = false; /* Try to return a Trusted Type object instead of a string, return a string in * case Trusted Types are not supported */ let RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? * This sanitizes markups named with colliding, clobberable built-in DOM APIs. */ let SANITIZE_DOM = true; /* Achieve full DOM Clobbering protection by isolating the namespace of named * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. * * HTML/DOM spec rules that enable DOM Clobbering: * - Named Access on Window (§7.3.3) * - DOM Tree Accessors (§3.1.5) * - Form Element Parent-Child Relations (§4.10.3) * - Iframe srcdoc / Nested WindowProxies (§4.8.5) * - HTMLCollection (§4.2.10.2) * * Namespace isolation is implemented by prefixing `id` and `name` attributes * with a constant string, i.e., `user-content-` */ let SANITIZE_NAMED_PROPS = false; const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; /* Keep element content when removing element? */ let KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ let IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ let USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ let FORBID_CONTENTS = null; const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ let DATA_URI_TAGS = null; const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ let URI_SAFE_ATTRIBUTES = null; const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; /* Document namespace */ let NAMESPACE = HTML_NAMESPACE; let IS_EMPTY_INPUT = false; /* Allowed XHTML+XML namespaces */ let ALLOWED_NAMESPACES = null; const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); /* Parsing of strict XHTML documents */ let PARSER_MEDIA_TYPE = null; const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; const DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; let transformCaseFunc = null; /* Keep a reference to config to pass to hooks */ let CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ const formElement = document.createElement('form'); const isRegexOrFunction = function isRegexOrFunction(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity const _parseConfig = function _parseConfig() { let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || typeof cfg !== 'object') { cfg = {}; } /* Shield configuration object from prototype pollution */ cfg = clone(cfg); PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase; /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) // eslint-disable-line indent : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) // eslint-disable-line indent : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, [...text]); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } if (cfg.TRUSTED_TYPES_POLICY) { if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); } if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') { throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); } // Overwrite existing TrustedTypes policy. trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`. emptyHTML = trustedTypesPolicy.createHTML(''); } else { // Uninitialized policy, attempt to initialize the internal dompurify policy. if (trustedTypesPolicy === undefined) { trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); } // If creating the internal policy succeeded sign internal variables. if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') { emptyHTML = trustedTypesPolicy.createHTML(''); } } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML // namespace. We need to specify them explicitly // so that they don't get erroneously deleted from // HTML namespace. const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); /* Keep track of all possible SVG and MathML tags * so that we can perform the namespace checks * correctly. */ const ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); const ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); /** * @param {Element} element a DOM element whose namespace is being checked * @returns {boolean} Return false if the element has a * namespace that a spec-compliant parser would never * return. Return true otherwise. */ const _checkValidNamespace = function _checkValidNamespace(element) { let parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode // can be null. We just simulate parent in this case. if (!parent || !parent.tagName) { parent = { namespaceURI: NAMESPACE, tagName: 'template' }; } const tagName = stringToLowerCase(element.tagName); const parentTagName = stringToLowerCase(parent.tagName); if (!ALLOWED_NAMESPACES[element.namespaceURI]) { return false; } if (element.namespaceURI === SVG_NAMESPACE) { // The only way to switch from HTML namespace to SVG // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'svg'; } // The only way to switch from MathML to SVG is via` // svg if parent is either or MathML // text integration points. if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } // We only allow elements that are defined in SVG // spec. All others are disallowed in SVG namespace. return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { // The only way to switch from HTML namespace to MathML // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'math'; } // The only way to switch from SVG to MathML is via // and HTML integration points if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; } // We only allow elements that are defined in MathML // spec. All others are disallowed in MathML namespace. return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { // The only way to switch from SVG to HTML is via // HTML integration points, and from MathML to HTML // is via MathML text integration points if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } // We disallow tags that are specific for MathML // or SVG and should never appear in HTML namespace return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } // For XHTML and XML documents that support custom namespaces if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) { return true; } // The code should never reach this place (this means // that the element somehow got namespace that is not // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES). // Return false just in case. return false; }; /** * _forceRemove * * @param {Node} node a DOM node */ const _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-dom-node-remove node.parentNode.removeChild(node); } catch (_) { node.remove(); } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ const _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes if (name === 'is' && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) {} } else { try { node.setAttribute(name, ''); } catch (_) {} } } }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ const _initDocument = function _initDocument(dirty) { /* Create a HTML document */ let doc = null; let leadingWhitespace = null; if (FORCE_BODY) { dirty = '' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ const matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) { // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) dirty = '' + dirty + ''; } const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* * Use the DOMParser API by default, fallback later if needs be * DOMParser not work for svg when has multiple root element. */ if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_) {} } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; } catch (_) {// Syntax error if dirtyPayload is invalid xml } } const body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); } /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; /** * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. * * @param {Node} root The root element or node to start traversing on. * @return {NodeIterator} The created NodeIterator */ const _createNodeIterator = function _createNodeIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ const _isClobbered = function _isClobbered(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function'); }; /** * Checks whether the given object is a DOM node. * * @param {Node} object object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ const _isNode = function _isNode(object) { return typeof Node === 'function' && object instanceof Node; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ const _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], hook => { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ const _sanitizeElements = function _sanitizeElements(currentNode) { let content = null; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ const tagName = transformCaseFunc(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName, allowedTags: ALLOWED_TAGS }); /* Detect mXSS attempts abusing namespace confusion */ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } /* Remove element if anything forbids its presence */ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { /* Check if we have a custom element to handle */ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { return false; } if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) { return false; } } /* Keep content except for bad-listed elements */ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { const parentNode = getParentNode(currentNode) || currentNode.parentNode; const childNodes = getChildNodes(currentNode) || currentNode.childNodes; if (childNodes && parentNode) { const childCount = childNodes.length; for (let i = childCount - 1; i >= 0; --i) { parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode)); } } } _forceRemove(currentNode); return true; } /* Check whether element has a valid namespace */ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) { _forceRemove(currentNode); return true; } /* Make sure that older browsers don't get fallback-tag mXSS */ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { _forceRemove(currentNode); return true; } /* Sanitize element content to be template-safe */ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) { /* Get the element's text content */ content = currentNode.textContent; arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { content = stringReplace(content, expr, ' '); }); if (currentNode.textContent !== content) { arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() }); currentNode.textContent = content; } } /* Execute a hook if present */ _executeHook('afterSanitizeElements', currentNode, null); return false; }; /** * _isValidAttribute * * @param {string} lcTag Lowercase tag name of containing element. * @param {string} lcName Lowercase attribute name. * @param {string} value Attribute value. * @return {Boolean} Returns true if `value` is valid, otherwise false. */ // eslint-disable-next-line complexity const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) { /* Make sure attribute cannot clobber */ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) { return false; } /* Allow valid data-* attributes: At least one character after "-" (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes) XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804) We don't need to check the value; it's always URI safe. */ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else { return false; } /* Check value is safe. First, is attr inert? If so, is safe */ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) { return false; } else ; return true; }; /** * _isBasicCustomElement * checks if at least one dash is included in tagName, and it's not the first char * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name * * @param {string} tagName name of the tag of the node to sanitize * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false. */ const _isBasicCustomElement = function _isBasicCustomElement(tagName) { return tagName.indexOf('-') > 0; }; /** * _sanitizeAttributes * * @protect attributes * @protect nodeName * @protect removeAttribute * @protect setAttribute * * @param {Node} currentNode to sanitize */ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) { /* Execute a hook if present */ _executeHook('beforeSanitizeAttributes', currentNode, null); const { attributes } = currentNode; /* Check if we have attributes; if not we might have a text node */ if (!attributes) { return; } const hookEvent = { attrName: '', attrValue: '', keepAttr: true, allowedAttributes: ALLOWED_ATTR }; let l = attributes.length; /* Go backwards over all attributes; safely remove bad ones */ while (l--) { const attr = attributes[l]; const { name, namespaceURI, value: attrValue } = attr; const lcName = transformCaseFunc(name); let value = name === 'value' ? attrValue : stringTrim(attrValue); /* Execute a hook if present */ hookEvent.attrName = lcName; hookEvent.attrValue = value; hookEvent.keepAttr = true; hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set _executeHook('uponSanitizeAttribute', currentNode, hookEvent); value = hookEvent.attrValue; /* Did the hooks approve of the attribute? */ if (hookEvent.forceKeepAttr) { continue; } /* Remove attribute */ _removeAttribute(name, currentNode); /* Did the hooks approve of the attribute? */ if (!hookEvent.keepAttr) { continue; } /* Work around a security issue in jQuery 3.0 */ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { _removeAttribute(name, currentNode); continue; } /* Sanitize attribute content to be template-safe */ if (SAFE_FOR_TEMPLATES) { arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { value = stringReplace(value, expr, ' '); }); } /* Is `value` valid for this attribute? */ const lcTag = transformCaseFunc(currentNode.nodeName); if (!_isValidAttribute(lcTag, lcName, value)) { continue; } /* Full DOM Clobbering protection via namespace isolation, * Prefix id and name attributes with `user-content-` */ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) { // Remove the attribute with this value _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value value = SANITIZE_NAMED_PROPS_PREFIX + value; } /* Handle attributes that require Trusted Types */ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') { if (namespaceURI) ; else { switch (trustedTypes.getAttributeType(lcTag, lcName)) { case 'TrustedHTML': { value = trustedTypesPolicy.createHTML(value); break; } case 'TrustedScriptURL': { value = trustedTypesPolicy.createScriptURL(value); break; } } } } /* Handle invalid data-* attribute set by try-catching it */ try { if (namespaceURI) { currentNode.setAttributeNS(namespaceURI, name, value); } else { /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */ currentNode.setAttribute(name, value); } arrayPop(DOMPurify.removed); } catch (_) {} } /* Execute a hook if present */ _executeHook('afterSanitizeAttributes', currentNode, null); }; /** * _sanitizeShadowDOM * * @param {DocumentFragment} fragment to iterate over recursively */ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) { let shadowNode = null; const shadowIterator = _createNodeIterator(fragment); /* Execute a hook if present */ _executeHook('beforeSanitizeShadowDOM', fragment, null); while (shadowNode = shadowIterator.nextNode()) { /* Execute a hook if present */ _executeHook('uponSanitizeShadowNode', shadowNode, null); /* Sanitize tags and elements */ if (_sanitizeElements(shadowNode)) { continue; } /* Deep shadow DOM detected */ if (shadowNode.content instanceof DocumentFragment) { _sanitizeShadowDOM(shadowNode.content); } /* Check attributes, sanitize if necessary */ _sanitizeAttributes(shadowNode); } /* Execute a hook if present */ _executeHook('afterSanitizeShadowDOM', fragment, null); }; /** * Sanitize * Public method providing core sanitation functionality * * @param {String|Node} dirty string or DOM node * @param {Object} cfg object */ // eslint-disable-next-line complexity DOMPurify.sanitize = function (dirty) { let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; let body = null; let importedNode = null; let currentNode = null; let returnNode = null; /* Make sure we have a string to sanitize. DO NOT return early, as this will return the wrong type if the user has requested a DOM object rather than a string */ IS_EMPTY_INPUT = !dirty; if (IS_EMPTY_INPUT) { dirty = ''; } /* Stringify, in case dirty is an object */ if (typeof dirty !== 'string' && !_isNode(dirty)) { if (typeof dirty.toString === 'function') { dirty = dirty.toString(); if (typeof dirty !== 'string') { throw typeErrorCreate('dirty is not a string, aborting'); } } else { throw typeErrorCreate('toString is not a function'); } } /* Return dirty HTML if DOMPurify cannot run */ if (!DOMPurify.isSupported) { return dirty; } /* Assign config vars */ if (!SET_CONFIG) { _parseConfig(cfg); } /* Clean up removed elements */ DOMPurify.removed = []; /* Check if dirty is correctly typed for IN_PLACE */ if (typeof dirty === 'string') { IN_PLACE = false; } if (IN_PLACE) { /* Do some early pre-sanitization to avoid unsafe root nodes */ if (dirty.nodeName) { const tagName = transformCaseFunc(dirty.nodeName); if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place'); } } } else if (dirty instanceof Node) { /* If dirty is a DOM element, append to an empty document to avoid elements being stripped by the parser */ body = _initDocument(''); importedNode = body.ownerDocument.importNode(dirty, true); if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') { /* Node is already a body, use as is */ body = importedNode; } else if (importedNode.nodeName === 'HTML') { body = importedNode; } else { // eslint-disable-next-line unicorn/prefer-dom-node-append body.appendChild(importedNode); } } else { /* Exit directly if we have nothing to do */ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes dirty.indexOf('<') === -1) { return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; } /* Initialize the document to work on */ body = _initDocument(dirty); /* Check we have a DOM node from the data */ if (!body) { return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ''; } } /* Remove first element node (ours) if FORCE_BODY is set */ if (body && FORCE_BODY) { _forceRemove(body.firstChild); } /* Get node iterator */ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); /* Now start iterating over the created document */ while (currentNode = nodeIterator.nextNode()) { /* Sanitize tags and elements */ if (_sanitizeElements(currentNode)) { continue; } /* Shadow DOM detected, sanitize it */ if (currentNode.content instanceof DocumentFragment) { _sanitizeShadowDOM(currentNode.content); } /* Check attributes, sanitize if necessary */ _sanitizeAttributes(currentNode); } /* If we sanitized `dirty` in-place, return it. */ if (IN_PLACE) { return dirty; } /* Return sanitized string or DOM */ if (RETURN_DOM) { if (RETURN_DOM_FRAGMENT) { returnNode = createDocumentFragment.call(body.ownerDocument); while (body.firstChild) { // eslint-disable-next-line unicorn/prefer-dom-node-append returnNode.appendChild(body.firstChild); } } else { returnNode = body; } if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) { /* AdoptNode() is not used because internal state is not reset (e.g. the past names map of a HTMLFormElement), this is safe in theory but we would rather not risk another attack vector. The state that is cloned by importNode() is explicitly defined by the specs. */ returnNode = importNode.call(originalDocument, returnNode, true); } return returnNode; } let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; /* Serialize doctype if allowed */ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { serializedHTML = '\n' + serializedHTML; } /* Sanitize final string template-safe */ if (SAFE_FOR_TEMPLATES) { arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { serializedHTML = stringReplace(serializedHTML, expr, ' '); }); } return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; }; /** * Public method to set the configuration once * setConfig * * @param {Object} cfg configuration object */ DOMPurify.setConfig = function () { let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _parseConfig(cfg); SET_CONFIG = true; }; /** * Public method to remove the configuration * clearConfig * */ DOMPurify.clearConfig = function () { CONFIG = null; SET_CONFIG = false; }; /** * Public method to check if an attribute value is valid. * Uses last set config, if any. Otherwise, uses config defaults. * isValidAttribute * * @param {String} tag Tag name of containing element. * @param {String} attr Attribute name. * @param {String} value Attribute value. * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false. */ DOMPurify.isValidAttribute = function (tag, attr, value) { /* Initialize shared config vars if necessary. */ if (!CONFIG) { _parseConfig({}); } const lcTag = transformCaseFunc(tag); const lcName = transformCaseFunc(attr); return _isValidAttribute(lcTag, lcName, value); }; /** * AddHook * Public method to add DOMPurify hooks * * @param {String} entryPoint entry point for the hook to add * @param {Function} hookFunction function to execute */ DOMPurify.addHook = function (entryPoint, hookFunction) { if (typeof hookFunction !== 'function') { return; } hooks[entryPoint] = hooks[entryPoint] || []; arrayPush(hooks[entryPoint], hookFunction); }; /** * RemoveHook * Public method to remove a DOMPurify hook at a given entryPoint * (pops it from the stack of hooks if more are present) * * @param {String} entryPoint entry point for the hook to remove * @return {Function} removed(popped) hook */ DOMPurify.removeHook = function (entryPoint) { if (hooks[entryPoint]) { return arrayPop(hooks[entryPoint]); } }; /** * RemoveHooks * Public method to remove all DOMPurify hooks at a given entryPoint * * @param {String} entryPoint entry point for the hooks to remove */ DOMPurify.removeHooks = function (entryPoint) { if (hooks[entryPoint]) { hooks[entryPoint] = []; } }; /** * RemoveAllHooks * Public method to remove all DOMPurify hooks */ DOMPurify.removeAllHooks = function () { hooks = {}; }; return DOMPurify; } var purify = createDOMPurify(); return purify; })); //# sourceMappingURL=purify.js.map /***/ }), /***/ 94470: /***/ ((module) => { "use strict"; var hasOwn = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var defineProperty = Object.defineProperty; var gOPD = Object.getOwnPropertyDescriptor; var isArray = function isArray(arr) { if (typeof Array.isArray === 'function') { return Array.isArray(arr); } return toStr.call(arr) === '[object Array]'; }; var isPlainObject = function isPlainObject(obj) { if (!obj || toStr.call(obj) !== '[object Object]') { return false; } var hasOwnConstructor = hasOwn.call(obj, 'constructor'); var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for (key in obj) { /**/ } return typeof key === 'undefined' || hasOwn.call(obj, key); }; // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target var setProperty = function setProperty(target, options) { if (defineProperty && options.name === '__proto__') { defineProperty(target, options.name, { enumerable: true, configurable: true, value: options.newValue, writable: true }); } else { target[options.name] = options.newValue; } }; // Return undefined instead of __proto__ if '__proto__' is not an own property var getProperty = function getProperty(obj, name) { if (name === '__proto__') { if (!hasOwn.call(obj, name)) { return void 0; } else if (gOPD) { // In early versions of node, obj['__proto__'] is buggy when obj has // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. return gOPD(obj, name).value; } } return obj[name]; }; module.exports = function extend() { var options, name, src, copy, copyIsArray, clone; var target = arguments[0]; var i = 1; var length = arguments.length; var deep = false; // Handle a deep copy situation if (typeof target === 'boolean') { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { target = {}; } for (; i < length; ++i) { options = arguments[i]; // Only deal with non-null/undefined values if (options != null) { // Extend the base object for (name in options) { src = getProperty(target, name); copy = getProperty(options, name); // Prevent never-ending loop if (target !== copy) { // Recurse if we're merging plain objects or arrays if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } // Never move original objects, clone them setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); // Don't bring in undefined values } else if (typeof copy !== 'undefined') { setProperty(target, { name: name, newValue: copy }); } } } } } // Return the modified object return target; }; /***/ }), /***/ 8679: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var reactIs = __webpack_require__(21296); /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var REACT_STATICS = { childContextTypes: true, contextType: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, getDerivedStateFromError: true, getDerivedStateFromProps: true, mixins: true, propTypes: true, type: true }; var KNOWN_STATICS = { name: true, length: true, prototype: true, caller: true, callee: true, arguments: true, arity: true }; var FORWARD_REF_STATICS = { '$$typeof': true, render: true, defaultProps: true, displayName: true, propTypes: true }; var MEMO_STATICS = { '$$typeof': true, compare: true, defaultProps: true, displayName: true, propTypes: true, type: true }; var TYPE_STATICS = {}; TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; function getStatics(component) { // React v16.11 and below if (reactIs.isMemo(component)) { return MEMO_STATICS; } // React v16.12 and above return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; } var defineProperty = Object.defineProperty; var getOwnPropertyNames = Object.getOwnPropertyNames; var getOwnPropertySymbols = Object.getOwnPropertySymbols; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var getPrototypeOf = Object.getPrototypeOf; var objectPrototype = Object.prototype; function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components if (objectPrototype) { var inheritedComponent = getPrototypeOf(sourceComponent); if (inheritedComponent && inheritedComponent !== objectPrototype) { hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); } } var keys = getOwnPropertyNames(sourceComponent); if (getOwnPropertySymbols) { keys = keys.concat(getOwnPropertySymbols(sourceComponent)); } var targetStatics = getStatics(targetComponent); var sourceStatics = getStatics(sourceComponent); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { var descriptor = getOwnPropertyDescriptor(sourceComponent, key); try { // Avoid failures from read-only properties defineProperty(targetComponent, key, descriptor); } catch (e) {} } } } return targetComponent; } module.exports = hoistNonReactStatics; /***/ }), /***/ 96103: /***/ ((__unused_webpack_module, exports) => { "use strict"; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; /***/ }), /***/ 21296: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(96103); } else {} /***/ }), /***/ 18139: /***/ ((module) => { // http://www.w3.org/TR/CSS21/grammar.html // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; var NEWLINE_REGEX = /\n/g; var WHITESPACE_REGEX = /^\s*/; // declaration var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; var COLON_REGEX = /^:\s*/; var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; var SEMICOLON_REGEX = /^[;\s]*/; // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill var TRIM_REGEX = /^\s+|\s+$/g; // strings var NEWLINE = '\n'; var FORWARD_SLASH = '/'; var ASTERISK = '*'; var EMPTY_STRING = ''; // types var TYPE_COMMENT = 'comment'; var TYPE_DECLARATION = 'declaration'; /** * @param {String} style * @param {Object} [options] * @return {Object[]} * @throws {TypeError} * @throws {Error} */ module.exports = function(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: 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: column }; this.source = options.source; } /** * Non-enumerable source string. */ Position.prototype.content = style; var errorsList = []; /** * Error `msg`. * * @param {String} msg * @throws {Error} */ function error(msg) { var err = 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) { errorsList.push(err); } 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(); // prop var prop = match(PROPERTY_REGEX); if (!prop) return; comment(); // : if (!match(COLON_REGEX)) return error("property missing ':'"); // val 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); // declarations 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; } /***/ }), /***/ 48738: /***/ ((module) => { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ module.exports = function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } /***/ }), /***/ 34155: /***/ ((module) => { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /***/ 92703: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = __webpack_require__(50414); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ 45697: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(92703)(); } /***/ }), /***/ 50414: /***/ ((module) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ 73935: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; function checkDCE() { /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' ) { return; } if (false) {} try { // Verify that the code above has been dead code eliminated (DCE'd). __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); } catch (err) { // DevTools shouldn't crash React, no matter what. // We should still report in case we break this code. console.error(err); } } if (true) { // DCE check should happen before ReactDOM bundle executes so that // DevTools can report bad minification during injection. checkDCE(); module.exports = __webpack_require__(64448); } else {} /***/ }), /***/ 69921: /***/ ((__unused_webpack_module, exports) => { "use strict"; /** * @license React * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference"); function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p}; exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n}; exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v; /***/ }), /***/ 59864: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(69921); } else {} /***/ }), /***/ 67294: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(72408); } else {} /***/ }), /***/ 96774: /***/ ((module) => { // module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (ret === false || (ret === void 0 && valueA !== valueB)) { return false; } } return true; }; /***/ }), /***/ 57848: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var parse = __webpack_require__(18139); /** * Parses inline style to object. * * @example * // returns { 'line-height': '42' } * StyleToObject('line-height: 42;'); * * @param {String} style - The inline style. * @param {Function} [iterator] - The iterator function. * @return {null|Object} */ function StyleToObject(style, iterator) { var output = null; if (!style || typeof style !== 'string') { return output; } var declaration; var declarations = parse(style); var hasIterator = typeof iterator === 'function'; var property; var value; for (var i = 0, len = declarations.length; i < len; i++) { declaration = declarations[i]; property = declaration.property; value = declaration.value; if (hasIterator) { iterator(property, value, declaration); } else if (value) { output || (output = {}); output[property] = value; } } return output; } module.exports = StyleToObject; module.exports["default"] = StyleToObject; // ESM support /***/ }), /***/ 12788: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "ServerStyleSheet": () => (/* binding */ Je), "StyleSheetConsumer": () => (/* binding */ le), "StyleSheetContext": () => (/* binding */ ue), "StyleSheetManager": () => (/* binding */ ye), "ThemeConsumer": () => (/* binding */ Le), "ThemeContext": () => (/* binding */ Ge), "ThemeProvider": () => (/* binding */ Fe), "__PRIVATE__": () => (/* binding */ Ke), "createGlobalStyle": () => (/* binding */ We), "css": () => (/* binding */ Ce), "default": () => (/* binding */ styled_components_browser_esm), "isStyledComponent": () => (/* binding */ N), "keyframes": () => (/* binding */ Ue), "useTheme": () => (/* binding */ Ze), "version": () => (/* binding */ C), "withTheme": () => (/* binding */ Xe) }); // EXTERNAL MODULE: ./node_modules/react-is/index.js var react_is = __webpack_require__(59864); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/shallowequal/index.js var shallowequal = __webpack_require__(96774); var shallowequal_default = /*#__PURE__*/__webpack_require__.n(shallowequal); ;// CONCATENATED MODULE: ./node_modules/@emotion/stylis/dist/stylis.browser.esm.js function stylis_min (W) { function M(d, c, e, h, a) { for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) { g = e.charCodeAt(l); l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++); if (0 === b + n + v + m) { if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) { switch (g) { case 32: case 9: case 59: case 13: case 10: break; default: f += e.charAt(l); } g = 59; } switch (g) { case 123: f = f.trim(); q = f.charCodeAt(0); k = 1; for (t = ++l; l < B;) { switch (g = e.charCodeAt(l)) { case 123: k++; break; case 125: k--; break; case 47: switch (g = e.charCodeAt(l + 1)) { case 42: case 47: a: { for (u = l + 1; u < J; ++u) { switch (e.charCodeAt(u)) { case 47: if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) { l = u + 1; break a; } break; case 10: if (47 === g) { l = u + 1; break a; } } } l = u; } } break; case 91: g++; case 40: g++; case 34: case 39: for (; l++ < J && e.charCodeAt(l) !== g;) { } } if (0 === k) break; l++; } k = e.substring(t, l); 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0)); switch (q) { case 64: 0 < r && (f = f.replace(N, '')); g = f.charCodeAt(1); switch (g) { case 100: case 109: case 115: case 45: r = c; break; default: r = O; } k = M(c, r, k, g, a + 1); t = k.length; 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = '')); if (0 < t) switch (g) { case 115: f = f.replace(da, ea); case 100: case 109: case 45: k = f + '{' + k + '}'; break; case 107: f = f.replace(fa, '$1 $2'); k = f + '{' + k + '}'; k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k; break; default: k = f + k, 112 === h && (k = (p += k, '')); } else k = ''; break; default: k = M(c, X(c, f, I), k, h, a + 1); } F += k; k = I = r = u = q = 0; f = ''; g = e.charCodeAt(++l); break; case 125: case 59: f = (0 < r ? f.replace(N, '') : f).trim(); if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) { case 0: break; case 64: if (105 === g || 99 === g) { G += f + e.charAt(l); break; } default: 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2))); } I = r = u = q = 0; f = ''; g = e.charCodeAt(++l); } } switch (g) { case 13: case 10: 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00'); 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h); z = 1; D++; break; case 59: case 125: if (0 === b + n + v + m) { z++; break; } default: z++; y = e.charAt(l); switch (g) { case 9: case 32: if (0 === n + m + b) switch (x) { case 44: case 58: case 9: case 32: y = ''; break; default: 32 !== g && (y = ' '); } break; case 0: y = '\\0'; break; case 12: y = '\\f'; break; case 11: y = '\\v'; break; case 38: 0 === n + b + m && (r = I = 1, y = '\f' + y); break; case 108: if (0 === n + b + m + E && 0 < u) switch (l - u) { case 2: 112 === x && 58 === e.charCodeAt(l - 3) && (E = x); case 8: 111 === K && (E = K); } break; case 58: 0 === n + b + m && (u = l); break; case 44: 0 === b + v + n + m && (r = 1, y += '\r'); break; case 34: case 39: 0 === b && (n = n === g ? 0 : 0 === n ? g : n); break; case 91: 0 === n + b + v && m++; break; case 93: 0 === n + b + v && m--; break; case 41: 0 === n + b + m && v--; break; case 40: if (0 === n + b + m) { if (0 === q) switch (2 * x + 3 * K) { case 533: break; default: q = 1; } v++; } break; case 64: 0 === b + v + n + m + u + k && (k = 1); break; case 42: case 47: if (!(0 < n + m + v)) switch (b) { case 0: switch (2 * g + 3 * e.charCodeAt(l + 1)) { case 235: b = 47; break; case 220: t = l, b = 42; } break; case 42: 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0); } } 0 === b && (f += y); } K = x; x = g; l++; } t = p.length; if (0 < t) { r = c; if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F; p = r.join(',') + '{' + p + '}'; if (0 !== w * E) { 2 !== w || L(p, 2) || (E = 0); switch (E) { case 111: p = p.replace(ha, ':-moz-$1') + p; break; case 112: p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p; } E = 0; } } return G + p + F; } function X(d, c, e) { var h = c.trim().split(ia); c = h; var a = h.length, m = d.length; switch (m) { case 0: case 1: var b = 0; for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) { c[b] = Z(d, c[b], e).trim(); } break; default: var v = b = 0; for (c = []; b < a; ++b) { for (var n = 0; n < m; ++n) { c[v++] = Z(d[n] + ' ', h[b], e).trim(); } } } return c; } function Z(d, c, e) { var h = c.charCodeAt(0); 33 > h && (h = (c = c.trim()).charCodeAt(0)); switch (h) { case 38: return c.replace(F, '$1' + d.trim()); case 58: return d.trim() + c.replace(F, '$1' + d.trim()); default: if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim()); } return d + c; } function P(d, c, e, h) { var a = d + ';', m = 2 * c + 3 * e + 4 * h; if (944 === m) { d = a.indexOf(':', 9) + 1; var b = a.substring(d, a.length - 1).trim(); b = a.substring(0, d).trim() + b + ';'; return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b; } if (0 === w || 2 === w && !L(a, 1)) return a; switch (m) { case 1015: return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a; case 951: return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a; case 963: return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a; case 1009: if (100 !== a.charCodeAt(4)) break; case 969: case 942: return '-webkit-' + a + a; case 978: return '-webkit-' + a + '-moz-' + a + a; case 1019: case 983: return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a; case 883: if (45 === a.charCodeAt(8)) return '-webkit-' + a + a; if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a; break; case 932: if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) { case 103: return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a; case 115: return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a; case 98: return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a; } return '-webkit-' + a + '-ms-' + a + a; case 964: return '-webkit-' + a + '-ms-flex-' + a + a; case 1023: if (99 !== a.charCodeAt(8)) break; b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify'); return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a; case 1005: return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a; case 1e3: b = a.substring(13).trim(); c = b.indexOf('-') + 1; switch (b.charCodeAt(0) + b.charCodeAt(c)) { case 226: b = a.replace(G, 'tb'); break; case 232: b = a.replace(G, 'tb-rl'); break; case 220: b = a.replace(G, 'lr'); break; default: return a; } return '-webkit-' + a + '-ms-' + b + a; case 1017: if (-1 === a.indexOf('sticky', 9)) break; case 975: c = (a = d).length - 10; b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim(); switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) { case 203: if (111 > b.charCodeAt(8)) break; case 115: a = a.replace(b, '-webkit-' + b) + ';' + a; break; case 207: case 102: a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a; } return a + ';'; case 938: if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) { case 105: return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a; case 115: return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a; default: return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a; } break; case 973: case 989: if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break; case 931: case 953: if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a; break; case 962: if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a; } return a; } function L(d, c) { var e = d.indexOf(1 === c ? ':' : '{'), h = d.substring(0, 3 !== c ? e : 10); e = d.substring(e + 1, d.length - 1); return R(2 !== c ? h : h.replace(na, '$1'), e, c); } function ea(d, c) { var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2)); return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')'; } function H(d, c, e, h, a, m, b, v, n, q) { for (var g = 0, x = c, w; g < A; ++g) { switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) { case void 0: case !1: case !0: case null: break; default: x = w; } } if (x !== c) return x; } function T(d) { switch (d) { case void 0: case null: A = S.length = 0; break; default: if ('function' === typeof d) S[A++] = d;else if ('object' === typeof d) for (var c = 0, e = d.length; c < e; ++c) { T(d[c]); } else Y = !!d | 0; } return T; } function U(d) { d = d.prefix; void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0); return U; } function B(d, c) { var e = d; 33 > e.charCodeAt(0) && (e = e.trim()); V = e; e = [V]; if (0 < A) { var h = H(-1, c, e, e, D, z, 0, 0, 0, 0); void 0 !== h && 'string' === typeof h && (c = h); } var a = M(O, e, c, 0, 0); 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h)); V = ''; E = 0; z = D = 1; return a; } var ca = /^\0+/g, N = /[\0\r\f]/g, aa = /: */g, ka = /zoo|gra/, ma = /([,: ])(transform)/g, ia = /,\r+?/g, F = /([\t\r\n ])*\f?&/g, fa = /@(k\w+)\s*(\S*)\s*/, Q = /::(place)/g, ha = /:(read-only)/g, G = /[svh]\w+-[tblr]{2}/, da = /\(\s*(.*)\s*\)/g, oa = /([\s\S]*?);/g, ba = /-self|flex-/g, na = /[^]*?(:[rp][el]a[\w-]+)[^]*/, la = /stretch|:\s*\w+\-(?:conte|avail)/, ja = /([^-])(image-set\()/, z = 1, D = 1, E = 0, w = 1, O = [], S = [], A = 0, R = null, Y = 0, V = ''; B.use = T; B.set = U; void 0 !== W && U(W); return B; } /* harmony default export */ const stylis_browser_esm = (stylis_min); ;// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js var unitlessKeys = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; /* harmony default export */ const unitless_browser_esm = (unitlessKeys); ;// CONCATENATED MODULE: ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } /* harmony default export */ const emotion_memoize_esm = (memoize); ;// CONCATENATED MODULE: ./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 var isPropValid = /* #__PURE__ */emotion_memoize_esm(function (prop) { return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91; } /* Z+1 */ ); /* harmony default export */ const emotion_is_prop_valid_esm = (isPropValid); // EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js var hoist_non_react_statics_cjs = __webpack_require__(8679); var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs); ;// CONCATENATED MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js /* provided dependency */ var process = __webpack_require__(34155); function v(){return(v=Object.assign||function(e){for(var t=1;t1?t-1:0),r=1;r0?" Args: "+n.join(", "):"")):0}var T=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&j(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var s=r;s=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,s=r;s=V&&(V=t+1),x.set(e,t),k.set(t,e)},G="style["+A+'][data-styled-version="5.3.9"]',L=new RegExp("^"+A+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),F=function(e,t,n){for(var r,o=n.split(","),s=0,i=o.length;s=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(A))return r}}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(A,"active"),r.setAttribute("data-styled-version","5.3.9");var i=q();return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r},$=function(){function e(e){var t=this.element=H(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(u+=e+",")})),r+=""+a+c+'{content:"'+u+'"}/*!sc*/\n'}}}return r}(this)},e}(),K=/(a)(d)/gi,Q=function(e){return String.fromCharCode(e+(e>25?39:97))};function ee(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Q(t%52)+n;return(Q(t%52)+n).replace(K,"$1-$2")}var te=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},ne=function(e){return te(5381,e)};function re(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var a=n(s,"."+i,void 0,r);t.insertRules(r,i,a)}o.push(i),this.staticRulesId=i}else{for(var c=this.rules.length,u=te(this.baseHash,n.hash),l="",d=0;d>>0);if(!t.hasNameForId(r,m)){var y=n(l,"."+m,void 0,r);t.insertRules(r,m,y)}o.push(m)}}return o.join(" ")},e}(),ie=/^\s*\/\/.*$/gm,ae=[":","[",".","#"];function ce(e){var t,n,r,o,s=void 0===e?E:e,i=s.options,a=void 0===i?E:i,c=s.plugins,u=void 0===c?w:c,l=new stylis_browser_esm(a),d=[],h=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,s,i,a,c,u,l,d){switch(n){case 1:if(0===l&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){d.push(e)})),f=function(e,r,s){return 0===r&&-1!==ae.indexOf(s[n.length])||s.match(o)?e:"."+t};function m(e,s,i,a){void 0===a&&(a="&");var c=e.replace(ie,""),u=s&&i?i+" "+s+" { "+c+" }":c;return t=a,n=s,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),l(i||!s?"":s,u)}return l.use([].concat(u,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,f))},h,function(e){if(-2===e){var t=d;return d=[],t}}])),m.hash=u.length?u.reduce((function(e,t){return t.name||j(15),te(e,t.name)}),5381).toString():"",m}var ue=react.createContext(),le=ue.Consumer,de=react.createContext(),he=(de.Consumer,new Z),pe=ce();function fe(){return (0,react.useContext)(ue)||he}function me(){return (0,react.useContext)(de)||pe}function ye(e){var t=(0,react.useState)(e.stylisPlugins),n=t[0],s=t[1],c=fe(),u=(0,react.useMemo)((function(){var t=c;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=(0,react.useMemo)((function(){return ce({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return (0,react.useEffect)((function(){shallowequal_default()(n,e.stylisPlugins)||s(e.stylisPlugins)}),[e.stylisPlugins]),react.createElement(ue.Provider,{value:u},react.createElement(de.Provider,{value:l}, false?0:e.children))}var ve=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=pe);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return j(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=pe),this.name+e.hash},e}(),ge=/([A-Z])/,Se=/([A-Z])/g,we=/^ms-/,Ee=function(e){return"-"+e.toLowerCase()};function be(e){return ge.test(e)?e.replace(Se,Ee).replace(we,"-ms-"):e}var _e=function(e){return null==e||!1===e||""===e};function Ne(e,n,r,o){if(Array.isArray(e)){for(var s,i=[],a=0,c=e.length;a1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,je=/(^-|-$)/g;function Te(e){return e.replace(De,"-").replace(je,"")}var xe=function(e){return ee(ne(e)>>>0)};function ke(e){return"string"==typeof e&&( true||0)}var Ve=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Be=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function ze(e,t,n){var r=e[n];Ve(t)&&Ve(r)?Me(r,t):e[n]=t}function Me(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(o[n]=e[n]);return o}(t,["componentId"]),s=r&&r+"-"+(ke(e)?e:Te(_(e)));return qe(e,v({},o,{attrs:S,componentId:s}),n)},Object.defineProperty(C,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=o?Me({},e.defaultProps,t):t}}), false&&(0),Object.defineProperty(C,"toString",{value:function(){return"."+C.styledComponentId}}),i&&hoist_non_react_statics_cjs_default()(C,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),C}var He=function(e){return function e(t,r,o){if(void 0===o&&(o=E),!(0,react_is.isValidElementType)(r))return j(1,String(r));var s=function(){return t(r,o,Ce.apply(void 0,arguments))};return s.withConfig=function(n){return e(t,r,v({},o,{},n))},s.attrs=function(n){return e(t,r,v({},o,{attrs:Array.prototype.concat(o.attrs,n).filter(Boolean)}))},s}(qe,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){He[e]=He(e)}));var $e=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=re(e),Z.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,n,r){var o=r(Ne(this.rules,t,n,r).join(""),""),s=this.componentId+e;n.insertRules(s,s,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&Z.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function We(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o1?t-1:0),r=1;r"+t+""},this.getStyleTags=function(){return e.sealed?j(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return j(2);var n=((t={})[A]="",t["data-styled-version"]="5.3.9",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),o=q();return o&&(n.nonce=o),[react.createElement("style",v({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new Z({isServer:!0}),this.sealed=!1}var t=e.prototype;return t.collectStyles=function(e){return this.sealed?j(2):react.createElement(ye,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return j(3)},e}(),Xe=function(e){var t=react.forwardRef((function(t,n){var o=(0,react.useContext)(Ge),i=e.defaultProps,a=Re(t,o,i);return false&&0,react.createElement(e,v({},t,{theme:a,ref:n}))}));return hoist_non_react_statics_cjs_default()(t,e),t.displayName="WithTheme("+_(e)+")",t},Ze=function(){return (0,react.useContext)(Ge)},Ke={StyleSheet:Z,masterSheet:he}; false&&0, false&&(0);/* harmony default export */ const styled_components_browser_esm = (He); //# sourceMappingURL=styled-components.browser.esm.js.map /***/ }), /***/ 70215: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var objectWithoutPropertiesLoose = __webpack_require__(7071); function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /***/ 7071: /***/ ((module) => { function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /***/ 59400: /***/ ((module) => { function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /***/ 73298: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* reexport */ ReactMarkdown), "uriTransformer": () => (/* reexport */ uriTransformer) }); // NAMESPACE OBJECT: ./node_modules/micromark/lib/constructs.js var constructs_namespaceObject = {}; __webpack_require__.r(constructs_namespaceObject); __webpack_require__.d(constructs_namespaceObject, { "attentionMarkers": () => (attentionMarkers), "contentInitial": () => (contentInitial), "disable": () => (disable), "document": () => (constructs_document), "flow": () => (constructs_flow), "flowInitial": () => (flowInitial), "insideSpan": () => (insideSpan), "string": () => (constructs_string), "text": () => (constructs_text) }); // NAMESPACE OBJECT: ./node_modules/property-information/lib/util/types.js var types_namespaceObject = {}; __webpack_require__.r(types_namespaceObject); __webpack_require__.d(types_namespaceObject, { "boolean": () => (types_boolean), "booleanish": () => (booleanish), "commaOrSpaceSeparated": () => (commaOrSpaceSeparated), "commaSeparated": () => (commaSeparated), "number": () => (number), "overloadedBoolean": () => (overloadedBoolean), "spaceSeparated": () => (spaceSeparated) }); ;// CONCATENATED MODULE: ./node_modules/react-markdown/lib/uri-transformer.js const protocols = ['http', 'https', 'mailto', 'tel'] /** * @param {string} uri * @returns {string} */ function uriTransformer(uri) { const url = (uri || '').trim() const first = url.charAt(0) if (first === '#' || first === '/') { return url } const colon = url.indexOf(':') if (colon === -1) { return url } let index = -1 while (++index < protocols.length) { const protocol = protocols[index] if ( colon === protocol.length && url.slice(0, protocol.length).toLowerCase() === protocol ) { return url } } index = url.indexOf('?') if (index !== -1 && colon > index) { return url } index = url.indexOf('#') if (index !== -1 && colon > index) { return url } // eslint-disable-next-line no-script-url return 'javascript:void(0)' } // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/is-buffer/index.js var is_buffer = __webpack_require__(48738); ;// CONCATENATED MODULE: ./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 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] */ /** * Serialize the positional info of a point, position (start and end points), * or node. * * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | 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) { // Nothing. if (!value || typeof value !== 'object') { return '' } // Node. if ('position' in value || 'type' in value) { return position(value.position) } // Position. if ('start' in value || 'end' in value) { return position(value) } // Point. if ('line' in value || 'column' in value) { return point(value) } // ? return '' } /** * @param {Point | PointLike | null | undefined} point * @returns {string} */ function point(point) { return index(point && point.line) + ':' + index(point && point.column) } /** * @param {Position | PositionLike | null | undefined} pos * @returns {string} */ function position(pos) { return point(pos && pos.start) + '-' + point(pos && pos.end) } /** * @param {number | null | undefined} value * @returns {number} */ function index(value) { return value && typeof value === 'number' ? value : 1 } ;// CONCATENATED MODULE: ./node_modules/vfile-message/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Position} Position * @typedef {import('unist').Point} Point * @typedef {object & {type: string, position?: Position | undefined}} NodeLike */ /** * Message. */ class VFileMessage extends Error { /** * Create a message for `reason` at `place` from `origin`. * * When an error is passed in as `reason`, the `stack` is copied. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * * > 👉 **Note**: you should use markdown. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns * Instance of `VFileMessage`. */ // To do: next major: expose `undefined` everywhere instead of `null`. constructor(reason, place, origin) { /** @type {[string | null, string | null]} */ const parts = [null, null] /** @type {Position} */ let position = { // @ts-expect-error: we always follows the structure of `position`. start: {line: null, column: null}, // @ts-expect-error: " end: {line: null, column: null} } super() if (typeof place === 'string') { origin = place place = undefined } if (typeof origin === 'string') { const index = origin.indexOf(':') if (index === -1) { parts[1] = origin } else { parts[0] = origin.slice(0, index) parts[1] = origin.slice(index + 1) } } if (place) { // Node. if ('type' in place || 'position' in place) { if (place.position) { // To do: next major: deep clone. // @ts-expect-error: looks like a position. position = place.position } } // Position. else if ('start' in place || 'end' in place) { // @ts-expect-error: looks like a position. // To do: next major: deep clone. position = place } // Point. else if ('line' in place || 'column' in place) { // To do: next major: deep clone. position.start = place } } // Fields from `Error`. /** * Serialized positional info of error. * * 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(place) || '1:1' /** * Reason for message. * * @type {string} */ this.message = typeof reason === 'object' ? reason.message : reason /** * 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 = '' if (typeof reason === 'object' && reason.stack) { this.stack = reason.stack } /** * Reason for message. * * > 👉 **Note**: you should use markdown. * * @type {string} */ this.reason = this.message /* eslint-disable no-unused-expressions */ /** * State of problem. * * * `true` — marks associated file as no longer processable (error) * * `false` — necessitates a (potential) change (warning) * * `null | undefined` — for things that might not need changing (info) * * @type {boolean | null | undefined} */ this.fatal /** * Starting line of error. * * @type {number | null} */ this.line = position.start.line /** * Starting column of error. * * @type {number | null} */ this.column = position.start.column /** * Full unist position. * * @type {Position | null} */ this.position = position /** * Namespace of message (example: `'my-package'`). * * @type {string | null} */ this.source = parts[0] /** * Category of message (example: `'my-rule'`). * * @type {string | null} */ this.ruleId = parts[1] /** * Path of a file (used throughout the `VFile` ecosystem). * * @type {string | null} */ this.file // The following fields are “well known”. // Not standard. // Feel free to add other non-standard fields to your messages. /** * Specify the source value that’s being reported, which is deemed * incorrect. * * @type {string | null} */ this.actual /** * Suggest acceptable values that can be used instead of `actual`. * * @type {Array | null} */ this.expected /** * 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 | null} */ this.url /** * Long form description of the message (you should use markdown). * * @type {string | null} */ this.note /* eslint-enable no-unused-expressions */ } } VFileMessage.prototype.file = '' VFileMessage.prototype.name = '' VFileMessage.prototype.reason = '' VFileMessage.prototype.message = '' VFileMessage.prototype.stack = '' VFileMessage.prototype.fatal = null VFileMessage.prototype.column = null VFileMessage.prototype.line = null VFileMessage.prototype.source = null VFileMessage.prototype.ruleId = null VFileMessage.prototype.position = null ;// CONCATENATED MODULE: ./node_modules/vfile/lib/minpath.browser.js // A derivative work based on: // . // Which is licensed: // // MIT License // // Copyright (c) 2013 James Halliday // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // A derivative work based on: // // Parts of that are extracted from Node’s internal `path` module: // . // Which is licensed: // // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. const path = {basename, dirname, extname, join, sep: '/'} /* eslint-disable max-depth, complexity */ /** * Get the basename from a path. * * @param {string} path * File path. * @param {string | undefined} [ext] * Extension to strip. * @returns {string} * Stem or basename. */ function basename(path, ext) { if (ext !== undefined && typeof ext !== 'string') { throw new TypeError('"ext" argument must be a string') } assertPath(path) let start = 0 let end = -1 let index = path.length /** @type {boolean | undefined} */ let seenNonSlash if (ext === undefined || ext.length === 0 || ext.length > path.length) { while (index--) { if (path.charCodeAt(index) === 47 /* `/` */) { // If we reached a path separator that was not part of a set of path // separators at the end of the string, stop now. if (seenNonSlash) { start = index + 1 break } } else if (end < 0) { // We saw the first non-path separator, mark this as the end of our // path component. seenNonSlash = true end = index + 1 } } return end < 0 ? '' : path.slice(start, end) } if (ext === path) { return '' } let firstNonSlashEnd = -1 let extIndex = ext.length - 1 while (index--) { if (path.charCodeAt(index) === 47 /* `/` */) { // If we reached a path separator that was not part of a set of path // separators at the end of the string, stop now. if (seenNonSlash) { start = index + 1 break } } else { if (firstNonSlashEnd < 0) { // We saw the first non-path separator, remember this index in case // we need it if the extension ends up not matching. seenNonSlash = true firstNonSlashEnd = index + 1 } if (extIndex > -1) { // Try to match the explicit extension. if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) { if (extIndex < 0) { // We matched the extension, so mark this as the end of our path // component end = index } } else { // Extension does not match, so our result is the entire path // component extIndex = -1 end = firstNonSlashEnd } } } } if (start === end) { end = firstNonSlashEnd } else if (end < 0) { end = path.length } return path.slice(start, end) } /** * Get the dirname from a path. * * @param {string} path * File path. * @returns {string} * File path. */ function dirname(path) { assertPath(path) if (path.length === 0) { return '.' } let end = -1 let index = path.length /** @type {boolean | undefined} */ let unmatchedSlash // Prefix `--` is important to not run on `0`. while (--index) { if (path.charCodeAt(index) === 47 /* `/` */) { if (unmatchedSlash) { end = index break } } else if (!unmatchedSlash) { // We saw the first non-path separator unmatchedSlash = true } } return end < 0 ? path.charCodeAt(0) === 47 /* `/` */ ? '/' : '.' : end === 1 && path.charCodeAt(0) === 47 /* `/` */ ? '//' : path.slice(0, end) } /** * Get an extname from a path. * * @param {string} path * File path. * @returns {string} * Extname. */ function extname(path) { assertPath(path) let index = path.length let end = -1 let startPart = 0 let startDot = -1 // Track the state of characters (if any) we see before our first dot and // after any path separator we find. let preDotState = 0 /** @type {boolean | undefined} */ let unmatchedSlash while (index--) { const code = path.charCodeAt(index) if (code === 47 /* `/` */) { // If we reached a path separator that was not part of a set of path // separators at the end of the string, stop now. if (unmatchedSlash) { startPart = index + 1 break } continue } if (end < 0) { // We saw the first non-path separator, mark this as the end of our // extension. unmatchedSlash = true end = index + 1 } if (code === 46 /* `.` */) { // If this is our first dot, mark it as the start of our extension. if (startDot < 0) { startDot = index } else if (preDotState !== 1) { preDotState = 1 } } else if (startDot > -1) { // We saw a non-dot and non-path separator before our dot, so we should // have a good chance at having a non-empty extension. preDotState = -1 } } if ( startDot < 0 || end < 0 || // We saw a non-dot character immediately before the dot. preDotState === 0 || // The (right-most) trimmed path component is exactly `..`. (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) ) { return '' } return path.slice(startDot, end) } /** * Join segments from a path. * * @param {Array} segments * Path segments. * @returns {string} * File path. */ function join(...segments) { let index = -1 /** @type {string | undefined} */ let joined while (++index < segments.length) { assertPath(segments[index]) if (segments[index]) { joined = joined === undefined ? segments[index] : joined + '/' + segments[index] } } return joined === undefined ? '.' : normalize(joined) } /** * Normalize a basic file path. * * @param {string} path * File path. * @returns {string} * File path. */ // Note: `normalize` is not exposed as `path.normalize`, so some code is // manually removed from it. function normalize(path) { assertPath(path) const absolute = path.charCodeAt(0) === 47 /* `/` */ // Normalize the path according to POSIX rules. let value = normalizeString(path, !absolute) if (value.length === 0 && !absolute) { value = '.' } if (value.length > 0 && path.charCodeAt(path.length - 1) === 47 /* / */) { value += '/' } return absolute ? '/' + value : value } /** * Resolve `.` and `..` elements in a path with directory names. * * @param {string} path * File path. * @param {boolean} allowAboveRoot * Whether `..` can move above root. * @returns {string} * File path. */ function normalizeString(path, allowAboveRoot) { let result = '' let lastSegmentLength = 0 let lastSlash = -1 let dots = 0 let index = -1 /** @type {number | undefined} */ let code /** @type {number} */ let lastSlashIndex while (++index <= path.length) { if (index < path.length) { code = path.charCodeAt(index) } else if (code === 47 /* `/` */) { break } else { code = 47 /* `/` */ } if (code === 47 /* `/` */) { if (lastSlash === index - 1 || dots === 1) { // Empty. } else if (lastSlash !== index - 1 && dots === 2) { if ( result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 /* `.` */ || result.charCodeAt(result.length - 2) !== 46 /* `.` */ ) { if (result.length > 2) { lastSlashIndex = result.lastIndexOf('/') if (lastSlashIndex !== result.length - 1) { if (lastSlashIndex < 0) { result = '' lastSegmentLength = 0 } else { result = result.slice(0, lastSlashIndex) lastSegmentLength = result.length - 1 - result.lastIndexOf('/') } lastSlash = index dots = 0 continue } } else if (result.length > 0) { result = '' lastSegmentLength = 0 lastSlash = index dots = 0 continue } } if (allowAboveRoot) { result = result.length > 0 ? result + '/..' : '..' lastSegmentLength = 2 } } else { if (result.length > 0) { result += '/' + path.slice(lastSlash + 1, index) } else { result = path.slice(lastSlash + 1, index) } lastSegmentLength = index - lastSlash - 1 } lastSlash = index dots = 0 } else if (code === 46 /* `.` */ && dots > -1) { dots++ } else { dots = -1 } } return result } /** * Make sure `path` is a string. * * @param {string} path * File path. * @returns {asserts path is string} * Nothing. */ function assertPath(path) { if (typeof path !== 'string') { throw new TypeError( 'Path must be a string. Received ' + JSON.stringify(path) ) } } /* eslint-enable max-depth, complexity */ ;// CONCATENATED MODULE: ./node_modules/vfile/lib/minproc.browser.js // Somewhat based on: // . // But I don’t think one tiny line of code can be copyrighted. 😅 const proc = {cwd} function cwd() { return '/' } ;// CONCATENATED MODULE: ./node_modules/vfile/lib/minurl.shared.js /** * @typedef URL * @property {string} hash * @property {string} host * @property {string} hostname * @property {string} href * @property {string} origin * @property {string} password * @property {string} pathname * @property {string} port * @property {string} protocol * @property {string} search * @property {any} searchParams * @property {string} username * @property {() => string} toString * @property {() => string} toJSON */ /** * Check if `fileUrlOrPath` looks like a URL. * * @param {unknown} fileUrlOrPath * File path or URL. * @returns {fileUrlOrPath is URL} * Whether it’s a URL. */ // From: function isUrl(fileUrlOrPath) { return ( fileUrlOrPath !== null && typeof fileUrlOrPath === 'object' && // @ts-expect-error: indexable. fileUrlOrPath.href && // @ts-expect-error: indexable. fileUrlOrPath.origin ) } ;// CONCATENATED MODULE: ./node_modules/vfile/lib/minurl.browser.js /// // See: /** * @param {string | URL} path * File URL. * @returns {string} * File URL. */ function urlToPath(path) { if (typeof path === 'string') { path = new URL(path) } else if (!isUrl(path)) { /** @type {NodeJS.ErrnoException} */ const error = new TypeError( 'The "path" argument must be of type string or an instance of URL. Received `' + path + '`' ) error.code = 'ERR_INVALID_ARG_TYPE' throw error } if (path.protocol !== 'file:') { /** @type {NodeJS.ErrnoException} */ const error = new TypeError('The URL must be of scheme file') error.code = 'ERR_INVALID_URL_SCHEME' throw error } return getPathFromURLPosix(path) } /** * Get a path from a POSIX URL. * * @param {URL} url * URL. * @returns {string} * File path. */ function getPathFromURLPosix(url) { if (url.hostname !== '') { /** @type {NodeJS.ErrnoException} */ const error = new TypeError( 'File URL host must be "localhost" or empty on darwin' ) error.code = 'ERR_INVALID_FILE_URL_HOST' throw error } const pathname = url.pathname let index = -1 while (++index < pathname.length) { if ( pathname.charCodeAt(index) === 37 /* `%` */ && pathname.charCodeAt(index + 1) === 50 /* `2` */ ) { const third = pathname.charCodeAt(index + 2) if (third === 70 /* `F` */ || third === 102 /* `f` */) { /** @type {NodeJS.ErrnoException} */ const error = new TypeError( 'File URL path must not include encoded / characters' ) error.code = 'ERR_INVALID_FILE_URL_PATH' throw error } } } return decodeURIComponent(pathname) } ;// CONCATENATED MODULE: ./node_modules/vfile/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Position} Position * @typedef {import('unist').Point} Point * @typedef {import('./minurl.shared.js').URL} URL * @typedef {import('../index.js').Data} Data * @typedef {import('../index.js').Value} Value */ /** * @typedef {Record & {type: string, position?: Position | undefined}} NodeLike * * @typedef {'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'} BufferEncoding * Encodings supported by the buffer class. * * This is a copy of the types from Node, copied to prevent Node globals from * being needed. * Copied from: * * @typedef {Options | URL | Value | VFile} Compatible * Things that can be passed to the constructor. * * @typedef VFileCoreOptions * Set multiple values. * @property {Value | null | undefined} [value] * Set `value`. * @property {string | null | undefined} [cwd] * Set `cwd`. * @property {Array | null | undefined} [history] * Set `history`. * @property {URL | string | null | undefined} [path] * Set `path`. * @property {string | null | undefined} [basename] * Set `basename`. * @property {string | null | undefined} [stem] * Set `stem`. * @property {string | null | undefined} [extname] * Set `extname`. * @property {string | null | undefined} [dirname] * Set `dirname`. * @property {Data | null | undefined} [data] * Set `data`. * * @typedef Map * Raw source map. * * See: * . * @property {number} version * Which version of the source map spec this map is following. * @property {Array} sources * An array of URLs to the original source files. * @property {Array} names * An array of identifiers which can be referenced by individual mappings. * @property {string | undefined} [sourceRoot] * The URL root from which all sources are relative. * @property {Array | undefined} [sourcesContent] * An array of contents of the original source files. * @property {string} mappings * A string of base64 VLQs which contain the actual mappings. * @property {string} file * The generated file this source map is associated with. * * @typedef {{[key: string]: unknown} & VFileCoreOptions} Options * Configuration. * * A bunch of keys that will be shallow copied over to the new file. * * @typedef {Record} ReporterSettings * Configuration for reporters. */ /** * @template {ReporterSettings} Settings * Options type. * @callback Reporter * Type for a reporter. * @param {Array} files * Files to report. * @param {Settings} options * Configuration. * @returns {string} * Report. */ /** * Order of setting (least specific to most), we need this because otherwise * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a * stem can be set. * * @type {Array<'basename' | 'dirname' | 'extname' | 'history' | 'path' | 'stem'>} */ const order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname'] class VFile { /** * Create a new virtual file. * * `options` is treated as: * * * `string` or `Buffer` — `{value: options}` * * `URL` — `{path: options}` * * `VFile` — shallow copies its data over to the new file * * `object` — all fields are shallow copied over to the new file * * Path related fields are set in the following order (least specific to * most specific): `history`, `path`, `basename`, `stem`, `extname`, * `dirname`. * * You cannot set `dirname` or `extname` without setting either `history`, * `path`, `basename`, or `stem` too. * * @param {Compatible | null | undefined} [value] * File value. * @returns * New instance. */ constructor(value) { /** @type {Options | VFile} */ let options if (!value) { options = {} } else if (typeof value === 'string' || buffer(value)) { options = {value} } else if (isUrl(value)) { options = {path: value} } else { options = value } /** * Place to store custom information (default: `{}`). * * It’s OK to store custom data directly on the file but moving it to * `data` is recommended. * * @type {Data} */ this.data = {} /** * List of messages associated with the file. * * @type {Array} */ this.messages = [] /** * List of filepaths the file moved between. * * The first is the original path and the last is the current path. * * @type {Array} */ this.history = [] /** * Base of `path` (default: `process.cwd()` or `'/'` in browsers). * * @type {string} */ this.cwd = proc.cwd() /* eslint-disable no-unused-expressions */ /** * Raw value. * * @type {Value} */ this.value // The below are non-standard, they are “well-known”. // As in, used in several tools. /** * Whether a file was saved to disk. * * This is used by vfile reporters. * * @type {boolean} */ this.stored /** * Custom, non-string, compiled, representation. * * This is used by unified to store non-string results. * One example is when turning markdown into React nodes. * * @type {unknown} */ this.result /** * Source map. * * This type is equivalent to the `RawSourceMap` type from the `source-map` * module. * * @type {Map | null | undefined} */ this.map /* eslint-enable no-unused-expressions */ // Set path related properties in the correct order. let index = -1 while (++index < order.length) { const prop = order[index] // Note: we specifically use `in` instead of `hasOwnProperty` to accept // `vfile`s too. if ( prop in options && options[prop] !== undefined && options[prop] !== null ) { // @ts-expect-error: TS doesn’t understand basic reality. this[prop] = prop === 'history' ? [...options[prop]] : options[prop] } } /** @type {string} */ let prop // Set non-path related properties. for (prop in options) { // @ts-expect-error: fine to set other things. if (!order.includes(prop)) { // @ts-expect-error: fine to set other things. this[prop] = options[prop] } } } /** * Get the full path (example: `'~/index.min.js'`). * * @returns {string} */ get path() { return this.history[this.history.length - 1] } /** * Set the full path (example: `'~/index.min.js'`). * * Cannot be nullified. * You can set a file URL (a `URL` object with a `file:` protocol) which will * be turned into a path with `url.fileURLToPath`. * * @param {string | URL} path */ set path(path) { if (isUrl(path)) { path = urlToPath(path) } assertNonEmpty(path, 'path') if (this.path !== path) { this.history.push(path) } } /** * Get the parent path (example: `'~'`). */ get dirname() { return typeof this.path === 'string' ? path.dirname(this.path) : undefined } /** * Set the parent path (example: `'~'`). * * Cannot be set if there’s no `path` yet. */ set dirname(dirname) { lib_assertPath(this.basename, 'dirname') this.path = path.join(dirname || '', this.basename) } /** * Get the basename (including extname) (example: `'index.min.js'`). */ get basename() { return typeof this.path === 'string' ? path.basename(this.path) : undefined } /** * Set basename (including extname) (`'index.min.js'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be nullified (use `file.path = file.dirname` instead). */ set basename(basename) { assertNonEmpty(basename, 'basename') assertPart(basename, 'basename') this.path = path.join(this.dirname || '', basename) } /** * Get the extname (including dot) (example: `'.js'`). */ get extname() { return typeof this.path === 'string' ? path.extname(this.path) : undefined } /** * Set the extname (including dot) (example: `'.js'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be set if there’s no `path` yet. */ set extname(extname) { assertPart(extname, 'extname') lib_assertPath(this.dirname, 'extname') if (extname) { if (extname.charCodeAt(0) !== 46 /* `.` */) { throw new Error('`extname` must start with `.`') } if (extname.includes('.', 1)) { throw new Error('`extname` cannot contain multiple dots') } } this.path = path.join(this.dirname, this.stem + (extname || '')) } /** * Get the stem (basename w/o extname) (example: `'index.min'`). */ get stem() { return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined } /** * Set the stem (basename w/o extname) (example: `'index.min'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be nullified (use `file.path = file.dirname` instead). */ set stem(stem) { assertNonEmpty(stem, 'stem') assertPart(stem, 'stem') this.path = path.join(this.dirname || '', stem + (this.extname || '')) } /** * Serialize the file. * * @param {BufferEncoding | null | undefined} [encoding='utf8'] * Character encoding to understand `value` as when it’s a `Buffer` * (default: `'utf8'`). * @returns {string} * Serialized file. */ toString(encoding) { return (this.value || '').toString(encoding || undefined) } /** * Create a warning message associated with the file. * * Its `fatal` is set to `false` and `file` is set to the current file path. * Its added to `file.messages`. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {VFileMessage} * Message. */ message(reason, place, origin) { const message = new VFileMessage(reason, place, origin) if (this.path) { message.name = this.path + ':' + message.name message.file = this.path } message.fatal = false this.messages.push(message) return message } /** * Create an info message associated with the file. * * Its `fatal` is set to `null` and `file` is set to the current file path. * Its added to `file.messages`. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {VFileMessage} * Message. */ info(reason, place, origin) { const message = this.message(reason, place, origin) message.fatal = null return message } /** * Create a fatal error associated with the file. * * Its `fatal` is set to `true` and `file` is set to the current file path. * Its added to `file.messages`. * * > 👉 **Note**: a fatal error means that a file is no longer processable. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {never} * Message. * @throws {VFileMessage} * Message. */ fail(reason, place, origin) { const message = this.message(reason, place, origin) message.fatal = true throw message } } /** * Assert that `part` is not a path (as in, does not contain `path.sep`). * * @param {string | null | undefined} part * File path part. * @param {string} name * Part name. * @returns {void} * Nothing. */ function assertPart(part, name) { if (part && part.includes(path.sep)) { throw new Error( '`' + name + '` cannot be a path: did not expect `' + path.sep + '`' ) } } /** * Assert that `part` is not empty. * * @param {string | undefined} part * Thing. * @param {string} name * Part name. * @returns {asserts part is string} * Nothing. */ function assertNonEmpty(part, name) { if (!part) { throw new Error('`' + name + '` cannot be empty') } } /** * Assert `path` exists. * * @param {string | undefined} path * Path. * @param {string} name * Dependency name. * @returns {asserts path is string} * Nothing. */ function lib_assertPath(path, name) { if (!path) { throw new Error('Setting `' + name + '` requires `path` to be set too') } } /** * Assert `value` is a buffer. * * @param {unknown} value * thing. * @returns {value is Buffer} * Whether `value` is a Node.js buffer. */ function buffer(value) { return is_buffer(value) } ;// CONCATENATED MODULE: ./node_modules/bail/index.js /** * Throw a given error. * * @param {Error|null|undefined} [error] * Maybe error. * @returns {asserts error is null|undefined} */ function bail(error) { if (error) { throw error } } // EXTERNAL MODULE: ./node_modules/extend/index.js var extend = __webpack_require__(94470); ;// CONCATENATED MODULE: ./node_modules/unified/node_modules/is-plain-obj/index.js function isPlainObject(value) { if (typeof value !== 'object' || value === null) { return false; } const prototype = Object.getPrototypeOf(value); return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); } ;// CONCATENATED MODULE: ./node_modules/trough/index.js /** * @typedef {(error?: Error|null|undefined, ...output: Array) => void} Callback * @typedef {(...input: Array) => any} Middleware * * @typedef {(...input: Array) => void} Run * Call all middleware. * @typedef {(fn: Middleware) => Pipeline} Use * Add `fn` (middleware) to the list. * @typedef {{run: Run, use: Use}} Pipeline * Middleware. */ /** * Create new middleware. * * @returns {Pipeline} */ function trough() { /** @type {Array} */ const fns = [] /** @type {Pipeline} */ const pipeline = {run, use} return pipeline /** @type {Run} */ function run(...values) { let middlewareIndex = -1 /** @type {Callback} */ const callback = values.pop() if (typeof callback !== 'function') { throw new TypeError('Expected function as last argument, not ' + callback) } next(null, ...values) /** * Run the next `fn`, or we’re done. * * @param {Error|null|undefined} error * @param {Array} output */ function next(error, ...output) { const fn = fns[++middlewareIndex] let index = -1 if (error) { callback(error) return } // Copy non-nullish input into values. while (++index < values.length) { if (output[index] === null || output[index] === undefined) { output[index] = values[index] } } // Save the newly created `output` for the next call. values = output // Next or done. if (fn) { wrap(fn, next)(...output) } else { callback(null, ...output) } } } /** @type {Use} */ function use(middelware) { if (typeof middelware !== 'function') { throw new TypeError( 'Expected `middelware` to be a function, not ' + middelware ) } fns.push(middelware) return pipeline } } /** * Wrap `middleware`. * Can be sync or async; return a promise, receive a callback, or return new * values and errors. * * @param {Middleware} middleware * @param {Callback} callback */ function wrap(middleware, callback) { /** @type {boolean} */ let called return wrapped /** * Call `middleware`. * @this {any} * @param {Array} parameters * @returns {void} */ function wrapped(...parameters) { const fnExpectsCallback = middleware.length > parameters.length /** @type {any} */ let result if (fnExpectsCallback) { parameters.push(done) } try { result = middleware.apply(this, parameters) } catch (error) { const exception = /** @type {Error} */ (error) // Well, this is quite the pickle. // `middleware` received a callback and called it synchronously, but that // threw an error. // The only thing left to do is to throw the thing instead. if (fnExpectsCallback && called) { throw exception } return done(exception) } if (!fnExpectsCallback) { if (result instanceof Promise) { result.then(then, done) } else if (result instanceof Error) { done(result) } else { then(result) } } } /** * Call `callback`, only once. * @type {Callback} */ function done(error, ...output) { if (!called) { called = true callback(error, ...output) } } /** * Call `done` with one value. * * @param {any} [value] */ function then(value) { done(null, value) } } ;// CONCATENATED MODULE: ./node_modules/unified/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('vfile').VFileCompatible} VFileCompatible * @typedef {import('vfile').VFileValue} VFileValue * @typedef {import('..').Processor} Processor * @typedef {import('..').Plugin} Plugin * @typedef {import('..').Preset} Preset * @typedef {import('..').Pluggable} Pluggable * @typedef {import('..').PluggableList} PluggableList * @typedef {import('..').Transformer} Transformer * @typedef {import('..').Parser} Parser * @typedef {import('..').Compiler} Compiler * @typedef {import('..').RunCallback} RunCallback * @typedef {import('..').ProcessCallback} ProcessCallback * * @typedef Context * @property {Node} tree * @property {VFile} file */ // Expose a frozen processor. const unified = base().freeze() const own = {}.hasOwnProperty // Function to create the first processor. /** * @returns {Processor} */ function base() { const transformers = trough() /** @type {Processor['attachers']} */ const attachers = [] /** @type {Record} */ let namespace = {} /** @type {boolean|undefined} */ let frozen let freezeIndex = -1 // Data management. // @ts-expect-error: overloads are handled. processor.data = data processor.Parser = undefined processor.Compiler = undefined // Lock. processor.freeze = freeze // Plugins. processor.attachers = attachers // @ts-expect-error: overloads are handled. processor.use = use // API. processor.parse = parse processor.stringify = stringify // @ts-expect-error: overloads are handled. processor.run = run processor.runSync = runSync // @ts-expect-error: overloads are handled. processor.process = process processor.processSync = processSync // Expose. return processor // Create a new processor based on the processor in the current scope. /** @type {Processor} */ function processor() { const destination = base() let index = -1 while (++index < attachers.length) { destination.use(...attachers[index]) } destination.data(extend(true, {}, namespace)) return destination } /** * @param {string|Record} [key] * @param {unknown} [value] * @returns {unknown} */ function data(key, value) { if (typeof key === 'string') { // Set `key`. if (arguments.length === 2) { assertUnfrozen('data', frozen) namespace[key] = value return processor } // Get `key`. return (own.call(namespace, key) && namespace[key]) || null } // Set space. if (key) { assertUnfrozen('data', frozen) namespace = key return processor } // Get space. return namespace } /** @type {Processor['freeze']} */ function freeze() { if (frozen) { return processor } while (++freezeIndex < attachers.length) { const [attacher, ...options] = attachers[freezeIndex] if (options[0] === false) { continue } if (options[0] === true) { options[0] = undefined } /** @type {Transformer|void} */ const transformer = attacher.call(processor, ...options) if (typeof transformer === 'function') { transformers.use(transformer) } } frozen = true freezeIndex = Number.POSITIVE_INFINITY return processor } /** * @param {Pluggable|null|undefined} [value] * @param {...unknown} options * @returns {Processor} */ function use(value, ...options) { /** @type {Record|undefined} */ let settings assertUnfrozen('use', frozen) if (value === null || value === undefined) { // Empty. } else if (typeof value === 'function') { addPlugin(value, ...options) } else if (typeof value === 'object') { if (Array.isArray(value)) { addList(value) } else { addPreset(value) } } else { throw new TypeError('Expected usable value, not `' + value + '`') } if (settings) { namespace.settings = Object.assign(namespace.settings || {}, settings) } return processor /** * @param {import('..').Pluggable} value * @returns {void} */ function add(value) { if (typeof value === 'function') { addPlugin(value) } else if (typeof value === 'object') { if (Array.isArray(value)) { const [plugin, ...options] = value addPlugin(plugin, ...options) } else { addPreset(value) } } else { throw new TypeError('Expected usable value, not `' + value + '`') } } /** * @param {Preset} result * @returns {void} */ function addPreset(result) { addList(result.plugins) if (result.settings) { settings = Object.assign(settings || {}, result.settings) } } /** * @param {PluggableList|null|undefined} [plugins] * @returns {void} */ function addList(plugins) { let index = -1 if (plugins === null || plugins === undefined) { // Empty. } else if (Array.isArray(plugins)) { while (++index < plugins.length) { const thing = plugins[index] add(thing) } } else { throw new TypeError('Expected a list of plugins, not `' + plugins + '`') } } /** * @param {Plugin} plugin * @param {...unknown} [value] * @returns {void} */ function addPlugin(plugin, value) { let index = -1 /** @type {Processor['attachers'][number]|undefined} */ let entry while (++index < attachers.length) { if (attachers[index][0] === plugin) { entry = attachers[index] break } } if (entry) { if (isPlainObject(entry[1]) && isPlainObject(value)) { value = extend(true, entry[1], value) } entry[1] = value } else { // @ts-expect-error: fine. attachers.push([...arguments]) } } } /** @type {Processor['parse']} */ function parse(doc) { processor.freeze() const file = vfile(doc) const Parser = processor.Parser assertParser('parse', Parser) if (newable(Parser, 'parse')) { // @ts-expect-error: `newable` checks this. return new Parser(String(file), file).parse() } // @ts-expect-error: `newable` checks this. return Parser(String(file), file) // eslint-disable-line new-cap } /** @type {Processor['stringify']} */ function stringify(node, doc) { processor.freeze() const file = vfile(doc) const Compiler = processor.Compiler assertCompiler('stringify', Compiler) assertNode(node) if (newable(Compiler, 'compile')) { // @ts-expect-error: `newable` checks this. return new Compiler(node, file).compile() } // @ts-expect-error: `newable` checks this. return Compiler(node, file) // eslint-disable-line new-cap } /** * @param {Node} node * @param {VFileCompatible|RunCallback} [doc] * @param {RunCallback} [callback] * @returns {Promise|void} */ function run(node, doc, callback) { assertNode(node) processor.freeze() if (!callback && typeof doc === 'function') { callback = doc doc = undefined } if (!callback) { return new Promise(executor) } executor(null, callback) /** * @param {null|((node: Node) => void)} resolve * @param {(error: Error) => void} reject * @returns {void} */ function executor(resolve, reject) { // @ts-expect-error: `doc` can’t be a callback anymore, we checked. transformers.run(node, vfile(doc), done) /** * @param {Error|null} error * @param {Node} tree * @param {VFile} file * @returns {void} */ function done(error, tree, file) { tree = tree || node if (error) { reject(error) } else if (resolve) { resolve(tree) } else { // @ts-expect-error: `callback` is defined if `resolve` is not. callback(null, tree, file) } } } } /** @type {Processor['runSync']} */ function runSync(node, file) { /** @type {Node|undefined} */ let result /** @type {boolean|undefined} */ let complete processor.run(node, file, done) assertDone('runSync', 'run', complete) // @ts-expect-error: we either bailed on an error or have a tree. return result /** * @param {Error|null} [error] * @param {Node} [tree] * @returns {void} */ function done(error, tree) { bail(error) result = tree complete = true } } /** * @param {VFileCompatible} doc * @param {ProcessCallback} [callback] * @returns {Promise|undefined} */ function process(doc, callback) { processor.freeze() assertParser('process', processor.Parser) assertCompiler('process', processor.Compiler) if (!callback) { return new Promise(executor) } executor(null, callback) /** * @param {null|((file: VFile) => void)} resolve * @param {(error?: Error|null|undefined) => void} reject * @returns {void} */ function executor(resolve, reject) { const file = vfile(doc) processor.run(processor.parse(file), file, (error, tree, file) => { if (error || !tree || !file) { done(error) } else { /** @type {unknown} */ const result = processor.stringify(tree, file) if (result === undefined || result === null) { // Empty. } else if (looksLikeAVFileValue(result)) { file.value = result } else { file.result = result } done(error, file) } }) /** * @param {Error|null|undefined} [error] * @param {VFile|undefined} [file] * @returns {void} */ function done(error, file) { if (error || !file) { reject(error) } else if (resolve) { resolve(file) } else { // @ts-expect-error: `callback` is defined if `resolve` is not. callback(null, file) } } } } /** @type {Processor['processSync']} */ function processSync(doc) { /** @type {boolean|undefined} */ let complete processor.freeze() assertParser('processSync', processor.Parser) assertCompiler('processSync', processor.Compiler) const file = vfile(doc) processor.process(file, done) assertDone('processSync', 'process', complete) return file /** * @param {Error|null|undefined} [error] * @returns {void} */ function done(error) { complete = true bail(error) } } } /** * Check if `value` is a constructor. * * @param {unknown} value * @param {string} name * @returns {boolean} */ function newable(value, name) { return ( typeof value === 'function' && // Prototypes do exist. // type-coverage:ignore-next-line value.prototype && // A function with keys in its prototype is probably a constructor. // Classes’ prototype methods are not enumerable, so we check if some value // exists in the prototype. // type-coverage:ignore-next-line (keys(value.prototype) || name in value.prototype) ) } /** * Check if `value` is an object with keys. * * @param {Record} value * @returns {boolean} */ function keys(value) { /** @type {string} */ let key for (key in value) { if (own.call(value, key)) { return true } } return false } /** * Assert a parser is available. * * @param {string} name * @param {unknown} value * @returns {asserts value is Parser} */ function assertParser(name, value) { if (typeof value !== 'function') { throw new TypeError('Cannot `' + name + '` without `Parser`') } } /** * Assert a compiler is available. * * @param {string} name * @param {unknown} value * @returns {asserts value is Compiler} */ function assertCompiler(name, value) { if (typeof value !== 'function') { throw new TypeError('Cannot `' + name + '` without `Compiler`') } } /** * Assert the processor is not frozen. * * @param {string} name * @param {unknown} frozen * @returns {asserts frozen is false} */ function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( 'Cannot call `' + name + '` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.' ) } } /** * Assert `node` is a unist node. * * @param {unknown} node * @returns {asserts node is Node} */ function assertNode(node) { // `isPlainObj` unfortunately uses `any` instead of `unknown`. // type-coverage:ignore-next-line if (!isPlainObject(node) || typeof node.type !== 'string') { throw new TypeError('Expected node, got `' + node + '`') // Fine. } } /** * Assert that `complete` is `true`. * * @param {string} name * @param {string} asyncName * @param {unknown} complete * @returns {asserts complete is true} */ function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( '`' + name + '` finished async. Use `' + asyncName + '` instead' ) } } /** * @param {VFileCompatible} [value] * @returns {VFile} */ function vfile(value) { return looksLikeAVFile(value) ? value : new VFile(value) } /** * @param {VFileCompatible} [value] * @returns {value is VFile} */ function looksLikeAVFile(value) { return Boolean( value && typeof value === 'object' && 'message' in value && 'messages' in value ) } /** * @param {unknown} [value] * @returns {value is VFileValue} */ function looksLikeAVFileValue(value) { return typeof value === 'string' || is_buffer(value) } ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-string/lib/index.js /** * @typedef {import('mdast').Root|import('mdast').Content} Node * * @typedef Options * Configuration (optional). * @property {boolean | null | undefined} [includeImageAlt=true] * Whether to use `alt` for `image`s. */ /** * Get the text content of a node or list of nodes. * * Prefers the node’s plain-text fields, otherwise serializes its children, * and if the given value is an array, serialize the nodes in it. * * @param {unknown} value * Thing to serialize, typically `Node`. * @param {Options | null | undefined} [options] * Configuration (optional). * @returns {string} * Serialized `value`. */ function lib_toString(value, options) { const includeImageAlt = (options || {}).includeImageAlt return one( value, typeof includeImageAlt === 'boolean' ? includeImageAlt : true ) } /** * One node or several nodes. * * @param {unknown} value * Thing to serialize. * @param {boolean} includeImageAlt * Include image `alt`s. * @returns {string} * Serialized node. */ function one(value, includeImageAlt) { return ( (node(value) && (('value' in value && value.value) || (includeImageAlt && 'alt' in value && value.alt) || ('children' in value && lib_all(value.children, includeImageAlt)))) || (Array.isArray(value) && lib_all(value, includeImageAlt)) || '' ) } /** * Serialize a list of nodes. * * @param {Array} values * Thing to serialize. * @param {boolean} includeImageAlt * Include image `alt`s. * @returns {string} * Serialized nodes. */ function lib_all(values, includeImageAlt) { /** @type {Array} */ const result = [] let index = -1 while (++index < values.length) { result[index] = one(values[index], includeImageAlt) } return result.join('') } /** * Check if `value` looks like a node. * * @param {unknown} value * Thing. * @returns {value is Node} * Whether `value` is a node. */ function node(value) { return Boolean(value && typeof value === 'object') } ;// CONCATENATED MODULE: ./node_modules/micromark-util-chunked/index.js /** * Like `Array#splice`, but smarter for giant arrays. * * `Array#splice` takes all items to be inserted as individual argument which * causes a stack overflow in V8 when trying to insert 100k items for instance. * * Otherwise, this does not return the removed items, and takes `items` as an * array instead of rest parameters. * * @template {unknown} T * @param {T[]} list * @param {number} start * @param {number} remove * @param {T[]} items * @returns {void} */ function splice(list, start, remove, items) { const end = list.length let chunkStart = 0 /** @type {unknown[]} */ let parameters // Make start between zero and `end` (included). if (start < 0) { start = -start > end ? 0 : end + start } else { start = start > end ? end : start } remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items. if (items.length < 10000) { parameters = Array.from(items) parameters.unshift(start, remove) // @ts-expect-error Hush, it’s fine. ;[].splice.apply(list, parameters) } else { // Delete `remove` items starting from `start` if (remove) [].splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows. while (chunkStart < items.length) { parameters = items.slice(chunkStart, chunkStart + 10000) parameters.unshift(start, 0) // @ts-expect-error Hush, it’s fine. ;[].splice.apply(list, parameters) chunkStart += 10000 start += 10000 } } } /** * Append `items` (an array) at the end of `list` (another array). * When `list` was empty, returns `items` instead. * * This prevents a potentially expensive operation when `list` is empty, * and adds items in batches to prevent V8 from hanging. * * @template {unknown} T * @param {T[]} list * @param {T[]} items * @returns {T[]} */ function push(list, items) { if (list.length > 0) { splice(list, list.length, 0, items) return list } return items } ;// CONCATENATED MODULE: ./node_modules/micromark-util-combine-extensions/index.js /** * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension * @typedef {import('micromark-util-types').Extension} Extension * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension */ const micromark_util_combine_extensions_hasOwnProperty = {}.hasOwnProperty /** * Combine several syntax extensions into one. * * @param {Extension[]} extensions List of syntax extensions. * @returns {NormalizedExtension} A single combined extension. */ function combineExtensions(extensions) { /** @type {NormalizedExtension} */ const all = {} let index = -1 while (++index < extensions.length) { syntaxExtension(all, extensions[index]) } return all } /** * Merge `extension` into `all`. * * @param {NormalizedExtension} all Extension to merge into. * @param {Extension} extension Extension to merge. * @returns {void} */ function syntaxExtension(all, extension) { /** @type {string} */ let hook for (hook in extension) { const maybe = micromark_util_combine_extensions_hasOwnProperty.call(all, hook) ? all[hook] : undefined const left = maybe || (all[hook] = {}) const right = extension[hook] /** @type {string} */ let code for (code in right) { if (!micromark_util_combine_extensions_hasOwnProperty.call(left, code)) left[code] = [] const value = right[code] constructs( // @ts-expect-error Looks like a list. left[code], Array.isArray(value) ? value : value ? [value] : [] ) } } } /** * Merge `list` into `existing` (both lists of constructs). * Mutates `existing`. * * @param {unknown[]} existing * @param {unknown[]} list * @returns {void} */ function constructs(existing, list) { let index = -1 /** @type {unknown[]} */ const before = [] while (++index < list.length) { // @ts-expect-error Looks like an object. ;(list[index].add === 'after' ? existing : before).push(list[index]) } splice(existing, 0, 0, before) } /** * Combine several HTML extensions into one. * * @param {HtmlExtension[]} htmlExtensions List of HTML extensions. * @returns {HtmlExtension} A single combined extension. */ function combineHtmlExtensions(htmlExtensions) { /** @type {HtmlExtension} */ const handlers = {} let index = -1 while (++index < htmlExtensions.length) { htmlExtension(handlers, htmlExtensions[index]) } return handlers } /** * Merge `extension` into `all`. * * @param {HtmlExtension} all Extension to merge into. * @param {HtmlExtension} extension Extension to merge. * @returns {void} */ function htmlExtension(all, extension) { /** @type {string} */ let hook for (hook in extension) { const maybe = micromark_util_combine_extensions_hasOwnProperty.call(all, hook) ? all[hook] : undefined const left = maybe || (all[hook] = {}) const right = extension[hook] /** @type {string} */ let type if (right) { for (type in right) { left[type] = right[type] } } } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-character/lib/unicode-punctuation-regex.js // This module is generated by `script/`. // // CommonMark handles attention (emphasis, strong) markers based on what comes // before or after them. // One such difference is if those characters are Unicode punctuation. // This script is generated from the Unicode data. const unicodePunctuationRegex = /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ ;// CONCATENATED MODULE: ./node_modules/micromark-util-character/index.js /** * @typedef {import('micromark-util-types').Code} Code */ /** * Check whether the character code represents an ASCII alpha (`a` through `z`, * case insensitive). * * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. * * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) * to U+005A (`Z`). * * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) * to U+007A (`z`). */ const asciiAlpha = regexCheck(/[A-Za-z]/) /** * Check whether the character code represents an ASCII digit (`0` through `9`). * * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to * U+0039 (`9`). */ const asciiDigit = regexCheck(/\d/) /** * Check whether the character code represents an ASCII hex digit (`a` through * `f`, case insensitive, or `0` through `9`). * * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex * digit, or an ASCII lower hex digit. * * An **ASCII upper hex digit** is a character in the inclusive range U+0041 * (`A`) to U+0046 (`F`). * * An **ASCII lower hex digit** is a character in the inclusive range U+0061 * (`a`) to U+0066 (`f`). */ const asciiHexDigit = regexCheck(/[\dA-Fa-f]/) /** * Check whether the character code represents an ASCII alphanumeric (`a` * through `z`, case insensitive, or `0` through `9`). * * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha * (see `asciiAlpha`). */ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) /** * Check whether the character code represents ASCII punctuation. * * An **ASCII punctuation** is a character in the inclusive ranges U+0021 * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). */ const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) /** * Check whether the character code represents an ASCII atext. * * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE * (`{`) to U+007E TILDE (`~`). * * See: * **\[RFC5322]**: * [Internet Message Format](https://tools.ietf.org/html/rfc5322). * P. Resnick. * IETF. */ const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) /** * Check whether a character code is an ASCII control character. * * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) * to U+001F (US), or U+007F (DEL). * * @param {Code} code * @returns {code is number} */ function asciiControl(code) { return ( // Special whitespace codes (which have negative values), C0 and Control // character DEL code !== null && (code < 32 || code === 127) ) } /** * Check whether a character code is a markdown line ending (see * `markdownLineEnding`) or markdown space (see `markdownSpace`). * * @param {Code} code * @returns {code is number} */ function markdownLineEndingOrSpace(code) { return code !== null && (code < 0 || code === 32) } /** * Check whether a character code is a markdown line ending. * * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). * * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE * RETURN (CR) are replaced by these virtual characters depending on whether * they occurred together. * * @param {Code} code * @returns {code is number} */ function markdownLineEnding(code) { return code !== null && code < -2 } /** * Check whether a character code is a markdown space. * * A **markdown space** is the concrete character U+0020 SPACE (SP) and the * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). * * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL * SPACE (VS) characters, depending on the column at which the tab occurred. * * @param {Code} code * @returns {code is number} */ function markdownSpace(code) { return code === -2 || code === -1 || code === 32 } /** * Check whether the character code represents Unicode whitespace. * * Note that this does handle micromark specific markdown whitespace characters. * See `markdownLineEndingOrSpace` to check that. * * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). * * See: * **\[UNICODE]**: * [The Unicode Standard](https://www.unicode.org/versions/). * Unicode Consortium. */ const unicodeWhitespace = regexCheck(/\s/) /** * Check whether the character code represents Unicode punctuation. * * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII * punctuation (see `asciiPunctuation`). * * See: * **\[UNICODE]**: * [The Unicode Standard](https://www.unicode.org/versions/). * Unicode Consortium. */ // Size note: removing ASCII from the regex and using `asciiPunctuation` here // In fact adds to the bundle size. const unicodePunctuation = regexCheck(unicodePunctuationRegex) /** * Create a code check from a regex. * * @param {RegExp} regex * @returns {(code: Code) => code is number} */ function regexCheck(regex) { return check /** * Check whether a code matches the bound regex. * * @param {Code} code Character code * @returns {code is number} Whether the character code matches the bound regex */ function check(code) { return code !== null && regex.test(String.fromCharCode(code)) } } ;// CONCATENATED MODULE: ./node_modules/micromark-factory-space/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State */ /** * @param {Effects} effects * @param {State} ok * @param {string} type * @param {number} [max=Infinity] * @returns {State} */ function factorySpace(effects, ok, type, max) { const limit = max ? max - 1 : Number.POSITIVE_INFINITY let size = 0 return start /** @type {State} */ function start(code) { if (markdownSpace(code)) { effects.enter(type) return prefix(code) } return ok(code) } /** @type {State} */ function prefix(code) { if (markdownSpace(code) && size++ < limit) { effects.consume(code) return prefix } effects.exit(type) return ok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/initialize/content.js /** * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State */ /** @type {InitialConstruct} */ const content = { tokenize: initializeContent } /** @type {Initializer} */ function initializeContent(effects) { const contentStart = effects.attempt( this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial ) /** @type {Token} */ let previous return contentStart /** @type {State} */ function afterContentStartConstruct(code) { if (code === null) { effects.consume(code) return } effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace(effects, contentStart, 'linePrefix') } /** @type {State} */ function paragraphInitial(code) { effects.enter('paragraph') return lineStart(code) } /** @type {State} */ function lineStart(code) { const token = effects.enter('chunkText', { contentType: 'text', previous }) if (previous) { previous.next = token } previous = token return data(code) } /** @type {State} */ function data(code) { if (code === null) { effects.exit('chunkText') effects.exit('paragraph') effects.consume(code) return } if (markdownLineEnding(code)) { effects.consume(code) effects.exit('chunkText') return lineStart } // Data. effects.consume(code) return data } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/initialize/document.js /** * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Point} Point */ /** * @typedef {Record} StackState * @typedef {[Construct, StackState]} StackItem */ /** @type {InitialConstruct} */ const document_document = { tokenize: initializeDocument } /** @type {Construct} */ const containerConstruct = { tokenize: tokenizeContainer } /** @type {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) { // First we iterate through the open blocks, starting with the root // document, and descending through last children down to the last open // block. // Each block imposes a condition that the line must satisfy if the block is // to remain open. // For example, a block quote requires a `>` character. // A paragraph requires a non-blank line. // In this phase we may match all or just some of the open blocks. // But we cannot close unmatched blocks yet, because we may have a lazy // continuation line. if (continued < stack.length) { const item = stack[continued] self.containerState = item[1] return effects.attempt( item[0].continuation, documentContinue, checkNewContainers )(code) } // Done. return checkNewContainers(code) } /** @type {State} */ function documentContinue(code) { continued++ // Note: this field is called `_closeFlow` but it also closes containers. // Perhaps a good idea to rename it but it’s already used in the wild by // extensions. if (self.containerState._closeFlow) { self.containerState._closeFlow = undefined if (childFlow) { closeFlow() } // Note: this algorithm for moving events around is similar to the // algorithm when dealing with lazy lines in `writeToChild`. const indexBeforeExits = self.events.length let indexBeforeFlow = indexBeforeExits /** @type {Point|undefined} */ let point // Find the flow chunk. while (indexBeforeFlow--) { if ( self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === 'chunkFlow' ) { point = self.events[indexBeforeFlow][1].end break } } exitContainers(continued) // Fix positions. let index = indexBeforeExits while (index < self.events.length) { self.events[index][1].end = Object.assign({}, point) index++ } // Inject the exits earlier (they’re still also at the end). splice( self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits) ) // Discard the duplicate exits. self.events.length = index return checkNewContainers(code) } return start(code) } /** @type {State} */ function checkNewContainers(code) { // Next, after consuming the continuation markers for existing blocks, we // look for new block starts (e.g. `>` for a block quote). // If we encounter a new block start, we close any blocks unmatched in // step 1 before creating the new block as a child of the last matched // block. if (continued === stack.length) { // No need to `check` whether there’s a container, of `exitContainers` // would be moot. // We can instead immediately `attempt` to parse one. if (!childFlow) { return documentContinued(code) } // If we have concrete content, such as block HTML or fenced code, // we can’t have containers “pierce” into them, so we can immediately // start. if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { return flowStart(code) } // If we do have flow, it could still be a blank line, // but we’d be interrupting it w/ a new container if there’s a current // construct. self.interrupt = Boolean( childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack ) } // Check if there is a new container. 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) { // Try new containers. self.containerState = {} return effects.attempt( containerConstruct, containerContinue, flowStart )(code) } /** @type {State} */ function containerContinue(code) { continued++ stack.push([self.currentConstruct, self.containerState]) // Try another. return documentContinued(code) } /** @type {State} */ function flowStart(code) { if (code === null) { if (childFlow) closeFlow() exitContainers(0) effects.consume(code) return } childFlow = childFlow || self.parser.flow(self.now()) effects.enter('chunkFlow', { contentType: 'flow', previous: childToken, _tokenizer: childFlow }) return flowContinue(code) } /** @type {State} */ function flowContinue(code) { if (code === null) { writeToChild(effects.exit('chunkFlow'), true) exitContainers(0) effects.consume(code) return } if (markdownLineEnding(code)) { effects.consume(code) writeToChild(effects.exit('chunkFlow')) // Get ready for the next line. continued = 0 self.interrupt = undefined return start } effects.consume(code) return flowContinue } /** * @param {Token} token * @param {boolean} [eof] * @returns {void} */ function writeToChild(token, eof) { const stream = self.sliceStream(token) if (eof) stream.push(null) token.previous = childToken if (childToken) childToken.next = token childToken = token childFlow.defineSkip(token.start) childFlow.write(stream) // Alright, so we just added a lazy line: // // ```markdown // > a // b. // // Or: // // > ~~~c // d // // Or: // // > | e | // f // ``` // // The construct in the second example (fenced code) does not accept lazy // lines, so it marked itself as done at the end of its first line, and // then the content construct parses `d`. // Most constructs in markdown match on the first line: if the first line // forms a construct, a non-lazy line can’t “unmake” it. // // The construct in the third example is potentially a GFM table, and // those are *weird*. // It *could* be a table, from the first line, if the following line // matches a condition. // In this case, that second line is lazy, which “unmakes” the first line // and turns the whole into one content block. // // We’ve now parsed the non-lazy and the lazy line, and can figure out // whether the lazy line started a new flow block. // If it did, we exit the current containers between the two flow blocks. if (self.parser.lazy[token.start.line]) { let index = childFlow.events.length while (index--) { if ( // The token starts before the line ending… childFlow.events[index][1].start.offset < lineStartOffset && // …and either is not ended yet… (!childFlow.events[index][1].end || // …or ends after it. childFlow.events[index][1].end.offset > lineStartOffset) ) { // Exit: there’s still something open, which means it’s a lazy line // part of something. return } } // Note: this algorithm for moving events around is similar to the // algorithm when closing flow in `documentContinue`. const indexBeforeExits = self.events.length let indexBeforeFlow = indexBeforeExits /** @type {boolean|undefined} */ let seen /** @type {Point|undefined} */ let point // Find the previous chunk (the one before the lazy line). while (indexBeforeFlow--) { if ( self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === 'chunkFlow' ) { if (seen) { point = self.events[indexBeforeFlow][1].end break } seen = true } } exitContainers(continued) // Fix positions. index = indexBeforeExits while (index < self.events.length) { self.events[index][1].end = Object.assign({}, point) index++ } // Inject the exits earlier (they’re still also at the end). splice( self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits) ) // Discard the duplicate exits. self.events.length = index } } /** * @param {number} size * @returns {void} */ function exitContainers(size) { let index = stack.length // Exit open containers. while (index-- > size) { const entry = stack[index] self.containerState = entry[1] entry[0].exit.call(self, effects) } stack.length = size } function closeFlow() { childFlow.write([null]) childToken = undefined childFlow = undefined self.containerState._closeFlow = undefined } } /** @type {Tokenizer} */ function tokenizeContainer(effects, ok, nok) { return factorySpace( effects, effects.attempt(this.parser.constructs.document, ok, nok), 'linePrefix', this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/blank-line.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const blankLine = { tokenize: tokenizeBlankLine, partial: true } /** @type {Tokenizer} */ function tokenizeBlankLine(effects, ok, nok) { return factorySpace(effects, afterWhitespace, 'linePrefix') /** @type {State} */ function afterWhitespace(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-subtokenize/index.js /** * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Event} Event */ /** * Tokenize subcontent. * * @param {Event[]} events * @returns {boolean} */ function subtokenize(events) { /** @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 {Event[]} */ let parameters /** @type {Event[]} */ let subevents /** @type {boolean|undefined} */ let more while (++index < events.length) { while (index in jumps) { index = jumps[index] } event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text // is in the first content of a list item. if ( index && event[1].type === 'chunkFlow' && events[index - 1][1].type === 'listItemPrefix' ) { subevents = event[1]._tokenizer.events otherIndex = 0 if ( otherIndex < subevents.length && subevents[otherIndex][1].type === 'lineEndingBlank' ) { otherIndex += 2 } if ( otherIndex < subevents.length && subevents[otherIndex][1].type === 'content' ) { while (++otherIndex < subevents.length) { if (subevents[otherIndex][1].type === 'content') { break } if (subevents[otherIndex][1].type === 'chunkText') { subevents[otherIndex][1]._isInFirstContentOfListItem = true otherIndex++ } } } } // Enter. if (event[0] === 'enter') { if (event[1].contentType) { Object.assign(jumps, subcontent(events, index)) index = jumps[index] more = true } } // Exit. else if (event[1]._container) { otherIndex = index lineIndex = undefined while (otherIndex--) { otherEvent = events[otherIndex] if ( otherEvent[1].type === 'lineEnding' || otherEvent[1].type === 'lineEndingBlank' ) { if (otherEvent[0] === 'enter') { if (lineIndex) { events[lineIndex][1].type = 'lineEndingBlank' } otherEvent[1].type = 'lineEnding' lineIndex = otherIndex } } else { break } } if (lineIndex) { // Fix position. event[1].end = Object.assign({}, events[lineIndex][1].start) // Switch container exit w/ line endings. parameters = events.slice(lineIndex, index) parameters.unshift(event) splice(events, lineIndex, index - lineIndex + 1, parameters) } } } return !more } /** * Tokenize embedded tokens. * * @param {Event[]} events * @param {number} eventIndex * @returns {Record} */ function subcontent(events, eventIndex) { const token = events[eventIndex][1] const context = events[eventIndex][2] let startPosition = eventIndex - 1 /** @type {number[]} */ const startPositions = [] const tokenizer = token._tokenizer || context.parser[token.contentType](token.start) const childEvents = tokenizer.events /** @type {[number, number][]} */ const jumps = [] /** @type {Record} */ const gaps = {} /** @type {Chunk[]} */ 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] // Loop forward through the linked tokens to pass them in order to the // subtokenizer. while (current) { // Find the position of the event for this token. while (events[++startPosition][1] !== current) { // Empty. } startPositions.push(startPosition) if (!current._tokenizer) { stream = context.sliceStream(current) if (!current.next) { stream.push(null) } if (previous) { tokenizer.defineSkip(current.start) } if (current._isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = true } tokenizer.write(stream) if (current._isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = undefined } } // Unravel the next token. previous = current current = current.next } // Now, loop back through all events (and linked tokens), to figure out which // parts belong where. current = token while (++index < childEvents.length) { if ( // Find a void token that includes a break. 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 ) { start = index + 1 breaks.push(start) // Help GC. current._tokenizer = undefined current.previous = undefined current = current.next } } // Help GC. tokenizer.events = [] // If there’s one more token (which is the cases for lines that end in an // EOF), that’s perfect: the last point we found starts it. // If there isn’t then make sure any remaining content is added to it. if (current) { // Help GC. current._tokenizer = undefined current.previous = undefined } else { breaks.pop() } // Now splice the events from the subtokenizer into the current events, // moving back to front so that splice indices aren’t affected. index = breaks.length while (index--) { const slice = childEvents.slice(breaks[index], breaks[index + 1]) const start = startPositions.pop() jumps.unshift([start, start + slice.length - 1]) splice(events, start, 2, slice) } 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 } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/content.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State */ /** * No name because it must not be turned off. * @type {Construct} */ const content_content = { tokenize: tokenizeContent, resolve: resolveContent } /** @type {Construct} */ const continuationConstruct = { tokenize: tokenizeContinuation, partial: true } /** * 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 } /** @type {Tokenizer} */ function tokenizeContent(effects, ok) { /** @type {Token} */ let previous return start /** @type {State} */ function start(code) { effects.enter('content') previous = effects.enter('chunkContent', { contentType: 'content' }) return data(code) } /** @type {State} */ function data(code) { if (code === null) { return contentEnd(code) } if (markdownLineEnding(code)) { return effects.check( continuationConstruct, contentContinue, contentEnd )(code) } // Data. effects.consume(code) return data } /** @type {State} */ function contentEnd(code) { effects.exit('chunkContent') effects.exit('content') return ok(code) } /** @type {State} */ function contentContinue(code) { effects.consume(code) effects.exit('chunkContent') previous.next = effects.enter('chunkContent', { contentType: 'content', previous }) previous = previous.next return data } } /** @type {Tokenizer} */ function tokenizeContinuation(effects, ok, nok) { const self = this return startLookahead /** @type {State} */ function startLookahead(code) { effects.exit('chunkContent') effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace(effects, prefixed, 'linePrefix') } /** @type {State} */ function prefixed(code) { if (code === null || markdownLineEnding(code)) { return nok(code) } const tail = self.events[self.events.length - 1] if ( !self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === 'linePrefix' && tail[2].sliceSerialize(tail[1], true).length >= 4 ) { return ok(code) } return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/initialize/flow.js /** * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').State} State */ /** @type {InitialConstruct} */ const flow = { tokenize: initializeFlow } /** @type {Initializer} */ function initializeFlow(effects) { const self = this const initial = effects.attempt( // Try to parse a blank line. blankLine, atBlankEnding, // Try to parse initial flow (essentially, only code). effects.attempt( this.parser.constructs.flowInitial, afterConstruct, factorySpace( effects, effects.attempt( this.parser.constructs.flow, afterConstruct, effects.attempt(content_content, afterConstruct) ), 'linePrefix' ) ) ) return initial /** @type {State} */ function atBlankEnding(code) { if (code === null) { effects.consume(code) return } effects.enter('lineEndingBlank') effects.consume(code) effects.exit('lineEndingBlank') self.currentConstruct = undefined return initial } /** @type {State} */ function afterConstruct(code) { if (code === null) { effects.consume(code) return } effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') self.currentConstruct = undefined return initial } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/initialize/text.js /** * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ const resolver = { resolveAll: createResolver() } const string = initializeFactory('string') const text_text = initializeFactory('text') /** * @param {'string'|'text'} field * @returns {InitialConstruct} */ function initializeFactory(field) { return { tokenize: initializeText, resolveAll: createResolver( field === 'text' ? resolveAllLineSuffixes : undefined ) } /** @type {Initializer} */ function initializeText(effects) { const self = this const constructs = this.parser.constructs[field] const text = effects.attempt(constructs, start, notText) return start /** @type {State} */ function start(code) { return atBreak(code) ? text(code) : notText(code) } /** @type {State} */ function notText(code) { if (code === null) { effects.consume(code) return } effects.enter('data') effects.consume(code) return data } /** @type {State} */ function data(code) { if (atBreak(code)) { effects.exit('data') return text(code) } // Data. effects.consume(code) return data } /** * @param {Code} code * @returns {boolean} */ function atBreak(code) { if (code === null) { return true } const list = constructs[code] let index = -1 if (list) { while (++index < list.length) { const item = list[index] if (!item.previous || item.previous.call(self, self.previous)) { return true } } } return false } } } /** * @param {Resolver} [extraResolver] * @returns {Resolver} */ function createResolver(extraResolver) { return resolveAllText /** @type {Resolver} */ function resolveAllText(events, context) { let index = -1 /** @type {number|undefined} */ let enter // A rather boring computation (to merge adjacent `data` events) which // improves mm performance by 29%. while (++index <= events.length) { if (enter === undefined) { if (events[index] && events[index][1].type === 'data') { enter = index index++ } } else if (!events[index] || events[index][1].type !== 'data') { // Don’t do anything if there is one data token. if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end events.splice(enter + 2, index - enter - 2) index = enter + 2 } enter = undefined } } return extraResolver ? extraResolver(events, context) : events } } /** * A rather ugly set of instructions which again looks at chunks in the input * stream. * The reason to do this here is that it is *much* faster to parse in reverse. * And that we can’t hook into `null` to split the line suffix before an EOF. * To do: figure out if we can make this into a clean utility, or even in core. * As it will be useful for GFMs literal autolink extension (and maybe even * tables?) * * @type {Resolver} */ function resolveAllLineSuffixes(events, context) { let eventIndex = 0 // Skip first. while (++eventIndex <= events.length) { if ( (eventIndex === events.length || events[eventIndex][1].type === 'lineEnding') && events[eventIndex - 1][1].type === 'data' ) { const data = events[eventIndex - 1][1] const chunks = context.sliceStream(data) let index = chunks.length let bufferIndex = -1 let size = 0 /** @type {boolean|undefined} */ let tabs while (index--) { const chunk = chunks[index] if (typeof chunk === 'string') { bufferIndex = chunk.length while (chunk.charCodeAt(bufferIndex - 1) === 32) { size++ bufferIndex-- } if (bufferIndex) break bufferIndex = -1 } // Number else if (chunk === -2) { tabs = true size++ } else if (chunk === -1) { // Empty } else { // Replacement character, exit. index++ break } } if (size) { const token = { type: eventIndex === events.length || tabs || size < 2 ? 'lineSuffix' : 'hardBreakTrailing', start: { line: data.end.line, column: data.end.column - size, offset: data.end.offset - size, _index: data.start._index + index, _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex }, end: Object.assign({}, data.end) } data.end = Object.assign({}, token.start) if (data.start.offset === data.end.offset) { Object.assign(data, token) } else { events.splice( eventIndex, 0, ['enter', token, context], ['exit', token, context] ) eventIndex += 2 } } eventIndex++ } } return events } ;// CONCATENATED MODULE: ./node_modules/micromark-util-resolve-all/index.js /** * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Resolver} Resolver */ /** * Call all `resolveAll`s. * * @param {{resolveAll?: Resolver}[]} constructs * @param {Event[]} events * @param {TokenizeContext} context * @returns {Event[]} */ function resolveAll(constructs, events, context) { /** @type {Resolver[]} */ const called = [] let index = -1 while (++index < constructs.length) { const resolve = constructs[index].resolveAll if (resolve && !called.includes(resolve)) { events = resolve(events, context) called.push(resolve) } } return events } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/create-tokenizer.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Point} Point * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').ParseContext} ParseContext */ /** * @typedef Info * @property {() => void} restore * @property {number} from * * @callback ReturnHandle * Handle a successful run. * @param {Construct} construct * @param {Info} info * @returns {void} */ /** * Create a tokenizer. * Tokenizers deal with one type of data (e.g., containers, flow, text). * The parser is the object dealing with it all. * `initialize` works like other constructs, except that only its `tokenize` * function is used, in which case it doesn’t receive an `ok` or `nok`. * `from` can be given to set the point before the first character, although * when further lines are indented, they must be set with `defineSkip`. * * @param {ParseContext} parser * @param {InitialConstruct} initialize * @param {Omit} [from] * @returns {TokenizeContext} */ function createTokenizer(parser, initialize, from) { /** @type {Point} */ let point = Object.assign( from ? Object.assign({}, from) : { line: 1, column: 1, offset: 0 }, { _index: 0, _bufferIndex: -1 } ) /** @type {Record} */ const columnStart = {} /** @type {Array} */ const resolveAllConstructs = [] /** @type {Array} */ let chunks = [] /** @type {Array} */ let stack = [] /** @type {boolean|undefined} */ let consumed = true /** * Tools used for tokenizing. * * @type {Effects} */ const effects = { consume, enter, exit, attempt: constructFactory(onsuccessfulconstruct), check: constructFactory(onsuccessfulcheck), interrupt: constructFactory(onsuccessfulcheck, { interrupt: true }) } /** * State and tools for resolving and serializing. * * @type {TokenizeContext} */ const context = { previous: null, code: null, containerState: {}, events: [], parser, sliceStream, sliceSerialize, now, defineSkip, write } /** * The state function. * * @type {State|void} */ let state = initialize.tokenize.call(context, effects) /** * Track which character we expect to be consumed, to catch bugs. * * @type {Code} */ let expectedCode if (initialize.resolveAll) { resolveAllConstructs.push(initialize) } return context /** @type {TokenizeContext['write']} */ function write(slice) { chunks = push(chunks, slice) main() // Exit if we’re not done, resolve might change stuff. if (chunks[chunks.length - 1] !== null) { return [] } addResult(initialize, 0) // Otherwise, resolve, and exit. context.events = resolveAll(resolveAllConstructs, context.events, context) return context.events } // // Tools. // /** @type {TokenizeContext['sliceSerialize']} */ function sliceSerialize(token, expandTabs) { return serializeChunks(sliceStream(token), expandTabs) } /** @type {TokenizeContext['sliceStream']} */ function sliceStream(token) { return sliceChunks(chunks, token) } /** @type {TokenizeContext['now']} */ function now() { return Object.assign({}, point) } /** @type {TokenizeContext['defineSkip']} */ function defineSkip(value) { columnStart[value.line] = value.column accountForPotentialSkip() } // // State management. // /** * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by * `consume`). * Here is where we walk through the chunks, which either include strings of * several characters, or numerical character codes. * The reason to do this in a loop instead of a call is so the stack can * drain. * * @returns {void} */ function main() { /** @type {number} */ let chunkIndex while (point._index < chunks.length) { const chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it. if (typeof chunk === 'string') { chunkIndex = point._index if (point._bufferIndex < 0) { point._bufferIndex = 0 } while ( point._index === chunkIndex && point._bufferIndex < chunk.length ) { go(chunk.charCodeAt(point._bufferIndex)) } } else { go(chunk) } } } /** * Deal with one code. * * @param {Code} code * @returns {void} */ function go(code) { consumed = undefined expectedCode = code state = state(code) } /** @type {Effects['consume']} */ function consume(code) { if (markdownLineEnding(code)) { point.line++ point.column = 1 point.offset += code === -3 ? 2 : 1 accountForPotentialSkip() } else if (code !== -1) { point.column++ point.offset++ } // Not in a string chunk. if (point._bufferIndex < 0) { point._index++ } else { point._bufferIndex++ // At end of string chunk. // @ts-expect-error Points w/ non-negative `_bufferIndex` reference // strings. if (point._bufferIndex === chunks[point._index].length) { point._bufferIndex = -1 point._index++ } } // Expose the previous character. context.previous = code // Mark as consumed. consumed = true } /** @type {Effects['enter']} */ function enter(type, fields) { /** @type {Token} */ // @ts-expect-error Patch instead of assign required fields to help GC. const token = fields || {} token.type = type token.start = now() context.events.push(['enter', token, context]) stack.push(token) return token } /** @type {Effects['exit']} */ function exit(type) { const token = stack.pop() token.end = now() context.events.push(['exit', token, context]) return token } /** * Use results. * * @type {ReturnHandle} */ function onsuccessfulconstruct(construct, info) { addResult(construct, info.from) } /** * Discard results. * * @type {ReturnHandle} */ function onsuccessfulcheck(_, info) { info.restore() } /** * Factory to attempt/check/interrupt. * * @param {ReturnHandle} onreturn * @param {Record} [fields] */ function constructFactory(onreturn, fields) { return hook /** * Handle either an object mapping codes to constructs, a list of * constructs, or a single construct. * * @param {Construct|Array|ConstructRecord} constructs * @param {State} returnState * @param {State} [bogusState] * @returns {State} */ function hook(constructs, returnState, bogusState) { /** @type {Array} */ let listOfConstructs /** @type {number} */ let constructIndex /** @type {Construct} */ let currentConstruct /** @type {Info} */ let info return Array.isArray(constructs) ? /* c8 ignore next 1 */ handleListOfConstructs(constructs) : 'tokenize' in constructs // @ts-expect-error Looks like a construct. ? handleListOfConstructs([constructs]) : handleMapOfConstructs(constructs) /** * Handle a list of construct. * * @param {ConstructRecord} map * @returns {State} */ function handleMapOfConstructs(map) { return start /** @type {State} */ function start(code) { const def = code !== null && map[code] const all = code !== null && map.null const list = [ // To do: add more extension tests. /* c8 ignore next 2 */ ...(Array.isArray(def) ? def : def ? [def] : []), ...(Array.isArray(all) ? all : all ? [all] : []) ] return handleListOfConstructs(list)(code) } } /** * Handle a list of construct. * * @param {Array} list * @returns {State} */ function handleListOfConstructs(list) { listOfConstructs = list constructIndex = 0 if (list.length === 0) { return bogusState } return handleConstruct(list[constructIndex]) } /** * Handle a single construct. * * @param {Construct} construct * @returns {State} */ function handleConstruct(construct) { return start /** @type {State} */ function start(code) { // To do: not needed to store if there is no bogus state, probably? // Currently doesn’t work because `inspect` in document does a check // w/o a bogus, which doesn’t make sense. But it does seem to help perf // by not storing. info = store() currentConstruct = construct if (!construct.partial) { context.currentConstruct = construct } if ( construct.name && context.parser.constructs.disable.null.includes(construct.name) ) { return nok(code) } return construct.tokenize.call( // If we do have fields, create an object w/ `context` as its // prototype. // This allows a “live binding”, which is needed for `interrupt`. fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok )(code) } } /** @type {State} */ function ok(code) { consumed = true onreturn(currentConstruct, info) return returnState } /** @type {State} */ function nok(code) { consumed = true info.restore() if (++constructIndex < listOfConstructs.length) { return handleConstruct(listOfConstructs[constructIndex]) } return bogusState } } } /** * @param {Construct} construct * @param {number} from * @returns {void} */ function addResult(construct, from) { if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { resolveAllConstructs.push(construct) } if (construct.resolve) { splice( context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context) ) } if (construct.resolveTo) { context.events = construct.resolveTo(context.events, context) } } /** * Store state. * * @returns {Info} */ function store() { const startPoint = now() const startPrevious = context.previous const startCurrentConstruct = context.currentConstruct const startEventsIndex = context.events.length const startStack = Array.from(stack) return { restore, from: startEventsIndex } /** * Restore state. * * @returns {void} */ function restore() { point = startPoint context.previous = startPrevious context.currentConstruct = startCurrentConstruct context.events.length = startEventsIndex stack = startStack accountForPotentialSkip() } } /** * Move the current point a bit forward in the line when it’s on a column * skip. * * @returns {void} */ function accountForPotentialSkip() { if (point.line in columnStart && point.column < 2) { point.column = columnStart[point.line] point.offset += columnStart[point.line] - 1 } } } /** * Get the chunks from a slice of chunks in the range of a token. * * @param {Array} chunks * @param {Pick} token * @returns {Array} */ function sliceChunks(chunks, token) { const startIndex = token.start._index const startBufferIndex = token.start._bufferIndex const endIndex = token.end._index const endBufferIndex = token.end._bufferIndex /** @type {Array} */ let view if (startIndex === endIndex) { // @ts-expect-error `_bufferIndex` is used on string chunks. view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] } else { view = chunks.slice(startIndex, endIndex) if (startBufferIndex > -1) { // @ts-expect-error `_bufferIndex` is used on string chunks. view[0] = view[0].slice(startBufferIndex) } if (endBufferIndex > 0) { // @ts-expect-error `_bufferIndex` is used on string chunks. view.push(chunks[endIndex].slice(0, endBufferIndex)) } } return view } /** * Get the string value of a slice of chunks. * * @param {Array} chunks * @param {boolean} [expandTabs=false] * @returns {string} */ function serializeChunks(chunks, expandTabs) { let index = -1 /** @type {Array} */ const result = [] /** @type {boolean|undefined} */ let atTab while (++index < chunks.length) { const chunk = chunks[index] /** @type {string} */ let value if (typeof chunk === 'string') { value = chunk } else switch (chunk) { case -5: { value = '\r' break } case -4: { value = '\n' break } case -3: { value = '\r' + '\n' break } case -2: { value = expandTabs ? ' ' : '\t' break } case -1: { if (!expandTabs && atTab) continue value = ' ' break } default: { // Currently only replacement character. value = String.fromCharCode(chunk) } } atTab = chunk === -2 result.push(value) } return result.join('') } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/thematic-break.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const thematicBreak = { name: 'thematicBreak', tokenize: tokenizeThematicBreak } /** @type {Tokenizer} */ function tokenizeThematicBreak(effects, ok, nok) { let size = 0 /** @type {NonNullable} */ let marker return start /** @type {State} */ function start(code) { effects.enter('thematicBreak') marker = code return atBreak(code) } /** @type {State} */ function atBreak(code) { if (code === marker) { effects.enter('thematicBreakSequence') return sequence(code) } if (markdownSpace(code)) { return factorySpace(effects, atBreak, 'whitespace')(code) } if (size < 3 || (code !== null && !markdownLineEnding(code))) { return nok(code) } effects.exit('thematicBreak') return ok(code) } /** @type {State} */ function sequence(code) { if (code === marker) { effects.consume(code) size++ return sequence } effects.exit('thematicBreakSequence') return atBreak(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/list.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Exiter} Exiter * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** * @typedef {Record & {marker: Code, type: string, size: number}} ListContainerState * @typedef {TokenizeContext & {containerState: ListContainerState}} TokenizeContextWithState */ /** @type {Construct} */ const list = { name: 'list', tokenize: tokenizeListStart, continuation: { tokenize: tokenizeListContinuation }, exit: tokenizeListEnd } /** @type {Construct} */ const listItemPrefixWhitespaceConstruct = { tokenize: tokenizeListItemPrefixWhitespace, partial: true } /** @type {Construct} */ const indentConstruct = { tokenize: tokenizeIndent, partial: true } /** * @type {Tokenizer} * @this {TokenizeContextWithState} */ function tokenizeListStart(effects, ok, nok) { const self = this const tail = self.events[self.events.length - 1] let initialSize = tail && tail[1].type === 'linePrefix' ? tail[2].sliceSerialize(tail[1], true).length : 0 let size = 0 return start /** @type {State} */ function start(code) { const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? 'listUnordered' : 'listOrdered') if ( kind === 'listUnordered' ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code) ) { if (!self.containerState.type) { self.containerState.type = kind effects.enter(kind, { _container: true }) } if (kind === 'listUnordered') { effects.enter('listItemPrefix') return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code) } if (!self.interrupt || code === 49) { effects.enter('listItemPrefix') effects.enter('listItemValue') return inside(code) } } return nok(code) } /** @type {State} */ function inside(code) { if (asciiDigit(code) && ++size < 10) { effects.consume(code) return inside } if ( (!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46) ) { effects.exit('listItemValue') return atMarker(code) } return nok(code) } /** * @type {State} **/ function atMarker(code) { effects.enter('listItemMarker') effects.consume(code) effects.exit('listItemMarker') self.containerState.marker = self.containerState.marker || code return effects.check( blankLine, // Can’t be empty when interrupting. self.interrupt ? nok : onBlank, effects.attempt( listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix ) ) } /** @type {State} */ function onBlank(code) { self.containerState.initialBlankLine = true initialSize++ return endOfPrefix(code) } /** @type {State} */ function otherPrefix(code) { if (markdownSpace(code)) { effects.enter('listItemPrefixWhitespace') effects.consume(code) effects.exit('listItemPrefixWhitespace') return endOfPrefix } return nok(code) } /** @type {State} */ function endOfPrefix(code) { self.containerState.size = initialSize + self.sliceSerialize(effects.exit('listItemPrefix'), true).length return ok(code) } } /** * @type {Tokenizer} * @this {TokenizeContextWithState} */ function tokenizeListContinuation(effects, ok, nok) { const self = this self.containerState._closeFlow = undefined return effects.check(blankLine, onBlank, notBlank) /** @type {State} */ function onBlank(code) { self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine // We have a blank line. // Still, try to consume at most the items size. return factorySpace( effects, ok, 'listItemIndent', self.containerState.size + 1 )(code) } /** @type {State} */ function notBlank(code) { if (self.containerState.furtherBlankLines || !markdownSpace(code)) { self.containerState.furtherBlankLines = undefined self.containerState.initialBlankLine = undefined return notInCurrentItem(code) } self.containerState.furtherBlankLines = undefined self.containerState.initialBlankLine = undefined return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) } /** @type {State} */ function notInCurrentItem(code) { // While we do continue, we signal that the flow should be closed. self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting. self.interrupt = undefined return factorySpace( effects, effects.attempt(list, ok, nok), 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) } } /** * @type {Tokenizer} * @this {TokenizeContextWithState} */ function tokenizeIndent(effects, ok, nok) { const self = this return factorySpace( effects, afterPrefix, 'listItemIndent', self.containerState.size + 1 ) /** @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1] return tail && tail[1].type === 'listItemIndent' && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code) } } /** * @type {Exiter} * @this {TokenizeContextWithState} */ function tokenizeListEnd(effects) { effects.exit(this.containerState.type) } /** * @type {Tokenizer} * @this {TokenizeContextWithState} */ function tokenizeListItemPrefixWhitespace(effects, ok, nok) { const self = this return factorySpace( effects, afterPrefix, 'listItemPrefixWhitespace', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1 ) /** @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1] return !markdownSpace(code) && tail && tail[1].type === 'listItemPrefixWhitespace' ? ok(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/block-quote.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Exiter} Exiter * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const blockQuote = { name: 'blockQuote', tokenize: tokenizeBlockQuoteStart, continuation: { tokenize: tokenizeBlockQuoteContinuation }, exit } /** @type {Tokenizer} */ function tokenizeBlockQuoteStart(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { if (code === 62) { const state = self.containerState if (!state.open) { effects.enter('blockQuote', { _container: true }) state.open = true } effects.enter('blockQuotePrefix') effects.enter('blockQuoteMarker') effects.consume(code) effects.exit('blockQuoteMarker') return after } return nok(code) } /** @type {State} */ function after(code) { if (markdownSpace(code)) { effects.enter('blockQuotePrefixWhitespace') effects.consume(code) effects.exit('blockQuotePrefixWhitespace') effects.exit('blockQuotePrefix') return ok } effects.exit('blockQuotePrefix') return ok(code) } } /** @type {Tokenizer} */ function tokenizeBlockQuoteContinuation(effects, ok, nok) { return factorySpace( effects, effects.attempt(blockQuote, ok, nok), 'linePrefix', this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) } /** @type {Exiter} */ function exit(effects) { effects.exit('blockQuote') } ;// CONCATENATED MODULE: ./node_modules/micromark-factory-destination/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State */ /** * @param {Effects} effects * @param {State} ok * @param {State} nok * @param {string} type * @param {string} literalType * @param {string} literalMarkerType * @param {string} rawType * @param {string} stringType * @param {number} [max=Infinity] * @returns {State} */ // eslint-disable-next-line max-params function factoryDestination( effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max ) { const limit = max || Number.POSITIVE_INFINITY let balance = 0 return start /** @type {State} */ function start(code) { if (code === 60) { effects.enter(type) effects.enter(literalType) effects.enter(literalMarkerType) effects.consume(code) effects.exit(literalMarkerType) return destinationEnclosedBefore } if (code === null || code === 41 || asciiControl(code)) { return nok(code) } effects.enter(type) effects.enter(rawType) effects.enter(stringType) effects.enter('chunkString', { contentType: 'string' }) return destinationRaw(code) } /** @type {State} */ function destinationEnclosedBefore(code) { if (code === 62) { effects.enter(literalMarkerType) effects.consume(code) effects.exit(literalMarkerType) effects.exit(literalType) effects.exit(type) return ok } effects.enter(stringType) effects.enter('chunkString', { contentType: 'string' }) return destinationEnclosed(code) } /** @type {State} */ function destinationEnclosed(code) { if (code === 62) { effects.exit('chunkString') effects.exit(stringType) return destinationEnclosedBefore(code) } if (code === null || code === 60 || markdownLineEnding(code)) { return nok(code) } effects.consume(code) return code === 92 ? destinationEnclosedEscape : destinationEnclosed } /** @type {State} */ function destinationEnclosedEscape(code) { if (code === 60 || code === 62 || code === 92) { effects.consume(code) return destinationEnclosed } return destinationEnclosed(code) } /** @type {State} */ function destinationRaw(code) { if (code === 40) { if (++balance > limit) return nok(code) effects.consume(code) return destinationRaw } if (code === 41) { if (!balance--) { effects.exit('chunkString') effects.exit(stringType) effects.exit(rawType) effects.exit(type) return ok(code) } effects.consume(code) return destinationRaw } if (code === null || markdownLineEndingOrSpace(code)) { if (balance) return nok(code) effects.exit('chunkString') effects.exit(stringType) effects.exit(rawType) effects.exit(type) return ok(code) } if (asciiControl(code)) return nok(code) effects.consume(code) return code === 92 ? destinationRawEscape : destinationRaw } /** @type {State} */ function destinationRawEscape(code) { if (code === 40 || code === 41 || code === 92) { effects.consume(code) return destinationRaw } return destinationRaw(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-factory-label/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').State} State */ /** * @this {TokenizeContext} * @param {Effects} effects * @param {State} ok * @param {State} nok * @param {string} type * @param {string} markerType * @param {string} stringType * @returns {State} */ // eslint-disable-next-line max-params function factoryLabel(effects, ok, nok, type, markerType, stringType) { const self = this let size = 0 /** @type {boolean} */ let data return start /** @type {State} */ function start(code) { effects.enter(type) effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.enter(stringType) return atBreak } /** @type {State} */ function atBreak(code) { if ( code === null || code === 91 || (code === 93 && !data) || /* To do: remove in the future once we’ve switched from * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, * which doesn’t need this */ /* Hidden footnotes hook */ /* c8 ignore next 3 */ (code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) || size > 999 ) { return nok(code) } if (code === 93) { effects.exit(stringType) effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.exit(type) return ok } if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return atBreak } effects.enter('chunkString', { contentType: 'string' }) return label(code) } /** @type {State} */ function label(code) { if ( code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999 ) { effects.exit('chunkString') return atBreak(code) } effects.consume(code) data = data || !markdownSpace(code) return code === 92 ? labelEscape : label } /** @type {State} */ function labelEscape(code) { if (code === 91 || code === 92 || code === 93) { effects.consume(code) size++ return label } return label(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-factory-title/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** * @param {Effects} effects * @param {State} ok * @param {State} nok * @param {string} type * @param {string} markerType * @param {string} stringType * @returns {State} */ // eslint-disable-next-line max-params function factoryTitle(effects, ok, nok, type, markerType, stringType) { /** @type {NonNullable} */ let marker return start /** @type {State} */ function start(code) { effects.enter(type) effects.enter(markerType) effects.consume(code) effects.exit(markerType) marker = code === 40 ? 41 : code return atFirstTitleBreak } /** @type {State} */ function atFirstTitleBreak(code) { if (code === marker) { effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.exit(type) return ok } effects.enter(stringType) return atTitleBreak(code) } /** @type {State} */ function atTitleBreak(code) { if (code === marker) { effects.exit(stringType) return atFirstTitleBreak(marker) } if (code === null) { return nok(code) } // Note: blank lines can’t exist in content. if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace(effects, atTitleBreak, 'linePrefix') } effects.enter('chunkString', { contentType: 'string' }) return title(code) } /** @type {State} */ function title(code) { if (code === marker || code === null || markdownLineEnding(code)) { effects.exit('chunkString') return atTitleBreak(code) } effects.consume(code) return code === 92 ? titleEscape : title } /** @type {State} */ function titleEscape(code) { if (code === marker || code === 92) { effects.consume(code) return title } return title(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-factory-whitespace/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State */ /** * @param {Effects} effects * @param {State} ok */ function factoryWhitespace(effects, ok) { /** @type {boolean} */ let seen return start /** @type {State} */ function start(code) { if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') seen = true return start } if (markdownSpace(code)) { return factorySpace( effects, start, seen ? 'linePrefix' : 'lineSuffix' )(code) } return ok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-normalize-identifier/index.js /** * Normalize an identifier (such as used in definitions). * * @param {string} value * @returns {string} */ function normalizeIdentifier(value) { return ( value // Collapse Markdown whitespace. .replace(/[\t\n\r ]+/g, ' ') // Trim. .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase // counterpart is uppercased will result in a different uppercase // character. // Hence, to get that form, we perform both lower- and uppercase. // Upper case makes sure keys will not interact with default prototypal // methods: no method is uppercase. .toLowerCase() .toUpperCase() ) } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/definition.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const definition = { name: 'definition', tokenize: tokenizeDefinition } /** @type {Construct} */ const titleConstruct = { tokenize: tokenizeTitle, partial: true } /** @type {Tokenizer} */ function tokenizeDefinition(effects, ok, nok) { const self = this /** @type {string} */ let identifier return start /** @type {State} */ function start(code) { effects.enter('definition') return factoryLabel.call( self, effects, labelAfter, nok, 'definitionLabel', 'definitionLabelMarker', 'definitionLabelString' )(code) } /** @type {State} */ function labelAfter(code) { identifier = normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) if (code === 58) { effects.enter('definitionMarker') effects.consume(code) effects.exit('definitionMarker') // Note: blank lines can’t exist in content. return factoryWhitespace( effects, factoryDestination( effects, effects.attempt( titleConstruct, factorySpace(effects, after, 'whitespace'), factorySpace(effects, after, 'whitespace') ), nok, 'definitionDestination', 'definitionDestinationLiteral', 'definitionDestinationLiteralMarker', 'definitionDestinationRaw', 'definitionDestinationString' ) ) } return nok(code) } /** @type {State} */ function after(code) { if (code === null || markdownLineEnding(code)) { effects.exit('definition') if (!self.parser.defined.includes(identifier)) { self.parser.defined.push(identifier) } return ok(code) } return nok(code) } } /** @type {Tokenizer} */ function tokenizeTitle(effects, ok, nok) { return start /** @type {State} */ function start(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, before)(code) : nok(code) } /** @type {State} */ function before(code) { if (code === 34 || code === 39 || code === 40) { return factoryTitle( effects, factorySpace(effects, after, 'whitespace'), nok, 'definitionTitle', 'definitionTitleMarker', 'definitionTitleString' )(code) } return nok(code) } /** @type {State} */ function after(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/code-indented.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const codeIndented = { name: 'codeIndented', tokenize: tokenizeCodeIndented } /** @type {Construct} */ const indentedContent = { tokenize: tokenizeIndentedContent, partial: true } /** @type {Tokenizer} */ function tokenizeCodeIndented(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { effects.enter('codeIndented') return factorySpace(effects, afterStartPrefix, 'linePrefix', 4 + 1)(code) } /** @type {State} */ function afterStartPrefix(code) { const tail = self.events[self.events.length - 1] return tail && tail[1].type === 'linePrefix' && tail[2].sliceSerialize(tail[1], true).length >= 4 ? afterPrefix(code) : nok(code) } /** @type {State} */ function afterPrefix(code) { if (code === null) { return after(code) } if (markdownLineEnding(code)) { return effects.attempt(indentedContent, afterPrefix, after)(code) } effects.enter('codeFlowValue') return content(code) } /** @type {State} */ function content(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue') return afterPrefix(code) } effects.consume(code) return content } /** @type {State} */ function after(code) { effects.exit('codeIndented') return ok(code) } } /** @type {Tokenizer} */ function tokenizeIndentedContent(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { // If this is a lazy line, it can’t be code. if (self.parser.lazy[self.now().line]) { return nok(code) } if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return start } return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) } /** @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1] return tail && tail[1].type === 'linePrefix' && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? start(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/heading-atx.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const headingAtx = { name: 'headingAtx', tokenize: tokenizeHeadingAtx, resolve: resolveHeadingAtx } /** @type {Resolver} */ function resolveHeadingAtx(events, context) { let contentEnd = events.length - 2 let contentStart = 3 /** @type {Token} */ let content /** @type {Token} */ let text // Prefix whitespace, part of the opening. if (events[contentStart][1].type === 'whitespace') { contentStart += 2 } // Suffix whitespace, part of the closing. if ( contentEnd - 2 > contentStart && events[contentEnd][1].type === 'whitespace' ) { contentEnd -= 2 } if ( events[contentEnd][1].type === 'atxHeadingSequence' && (contentStart === contentEnd - 1 || (contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === 'whitespace')) ) { contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 } if (contentEnd > contentStart) { content = { type: 'atxHeadingText', start: events[contentStart][1].start, end: events[contentEnd][1].end } text = { type: 'chunkText', start: events[contentStart][1].start, end: events[contentEnd][1].end, // @ts-expect-error Constants are fine to assign. contentType: 'text' } splice(events, contentStart, contentEnd - contentStart + 1, [ ['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context] ]) } return events } /** @type {Tokenizer} */ function tokenizeHeadingAtx(effects, ok, nok) { const self = this let size = 0 return start /** @type {State} */ function start(code) { effects.enter('atxHeading') effects.enter('atxHeadingSequence') return fenceOpenInside(code) } /** @type {State} */ function fenceOpenInside(code) { if (code === 35 && size++ < 6) { effects.consume(code) return fenceOpenInside } if (code === null || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingSequence') return self.interrupt ? ok(code) : headingBreak(code) } return nok(code) } /** @type {State} */ function headingBreak(code) { if (code === 35) { effects.enter('atxHeadingSequence') return sequence(code) } if (code === null || markdownLineEnding(code)) { effects.exit('atxHeading') return ok(code) } if (markdownSpace(code)) { return factorySpace(effects, headingBreak, 'whitespace')(code) } effects.enter('atxHeadingText') return data(code) } /** @type {State} */ function sequence(code) { if (code === 35) { effects.consume(code) return sequence } effects.exit('atxHeadingSequence') return headingBreak(code) } /** @type {State} */ function data(code) { if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingText') return headingBreak(code) } effects.consume(code) return data } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/setext-underline.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const setextUnderline = { name: 'setextUnderline', tokenize: tokenizeSetextUnderline, resolveTo: resolveToSetextUnderline } /** @type {Resolver} */ function resolveToSetextUnderline(events, context) { let index = events.length /** @type {number|undefined} */ let content /** @type {number|undefined} */ let text /** @type {number|undefined} */ let definition // Find the opening of the content. // It’ll always exist: we don’t tokenize if it isn’t there. while (index--) { if (events[index][0] === 'enter') { if (events[index][1].type === 'content') { content = index break } if (events[index][1].type === 'paragraph') { text = index } } // Exit else { if (events[index][1].type === 'content') { // Remove the content end (if needed we’ll add it later) events.splice(index, 1) } if (!definition && events[index][1].type === 'definition') { definition = index } } } const heading = { type: 'setextHeading', start: Object.assign({}, events[text][1].start), end: Object.assign({}, events[events.length - 1][1].end) } // Change the paragraph to setext heading text. events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content, // but we need move it. if (definition) { events.splice(text, 0, ['enter', heading, context]) events.splice(definition + 1, 0, ['exit', events[content][1], context]) events[content][1].end = Object.assign({}, events[definition][1].end) } else { events[content][1] = heading } // Add the heading exit at the end. events.push(['exit', heading, context]) return events } /** @type {Tokenizer} */ function tokenizeSetextUnderline(effects, ok, nok) { const self = this let index = self.events.length /** @type {NonNullable} */ let marker /** @type {boolean} */ let paragraph // Find an opening. while (index--) { // Skip enter/exit of line ending, line prefix, and content. // We can now either have a definition or a paragraph. if ( self.events[index][1].type !== 'lineEnding' && self.events[index][1].type !== 'linePrefix' && self.events[index][1].type !== 'content' ) { paragraph = self.events[index][1].type === 'paragraph' break } } return start /** @type {State} */ function start(code) { if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { effects.enter('setextHeadingLine') effects.enter('setextHeadingLineSequence') marker = code return closingSequence(code) } return nok(code) } /** @type {State} */ function closingSequence(code) { if (code === marker) { effects.consume(code) return closingSequence } effects.exit('setextHeadingLineSequence') return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code) } /** @type {State} */ function closingSequenceEnd(code) { if (code === null || markdownLineEnding(code)) { effects.exit('setextHeadingLine') return ok(code) } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-html-tag-name/index.js /** * List of lowercase HTML tag names which when parsing HTML (flow), result * 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: * . */ const 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', 'section', 'summary', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul' ] /** * List of lowercase HTML tag names which when parsing HTML (flow), result in * HTML that can include lines w/o exiting, until a closing tag also in this * list is found (condition 1). * * This module is copied from: * . * * Note that `textarea` was added in `CommonMark@0.30`. */ const htmlRawNames = ['pre', 'script', 'style', 'textarea'] ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/html-flow.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const htmlFlow = { name: 'htmlFlow', tokenize: tokenizeHtmlFlow, resolveTo: resolveToHtmlFlow, concrete: true } /** @type {Construct} */ const nextBlankConstruct = { tokenize: tokenizeNextBlank, partial: true } /** @type {Resolver} */ function resolveToHtmlFlow(events) { let index = events.length while (index--) { if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { break } } if (index > 1 && events[index - 2][1].type === 'linePrefix') { // Add the prefix start to the HTML token. events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token. events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix. events.splice(index - 2, 2) } return events } /** @type {Tokenizer} */ function tokenizeHtmlFlow(effects, ok, nok) { const self = this /** @type {number} */ let kind /** @type {boolean} */ let startTag /** @type {string} */ let buffer /** @type {number} */ let index /** @type {Code} */ let marker return start /** @type {State} */ function start(code) { effects.enter('htmlFlow') effects.enter('htmlFlowData') effects.consume(code) return open } /** @type {State} */ function open(code) { if (code === 33) { effects.consume(code) return declarationStart } if (code === 47) { effects.consume(code) return tagCloseStart } if (code === 63) { effects.consume(code) kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?` // right now, so we do need to search for `>`, similar to declarations. return self.interrupt ? ok : continuationDeclarationInside } if (asciiAlpha(code)) { effects.consume(code) buffer = String.fromCharCode(code) startTag = true return tagName } return nok(code) } /** @type {State} */ function declarationStart(code) { if (code === 45) { effects.consume(code) kind = 2 return commentOpenInside } if (code === 91) { effects.consume(code) kind = 5 buffer = 'CDATA[' index = 0 return cdataOpenInside } if (asciiAlpha(code)) { effects.consume(code) kind = 4 return self.interrupt ? ok : continuationDeclarationInside } return nok(code) } /** @type {State} */ function commentOpenInside(code) { if (code === 45) { effects.consume(code) return self.interrupt ? ok : continuationDeclarationInside } return nok(code) } /** @type {State} */ function cdataOpenInside(code) { if (code === buffer.charCodeAt(index++)) { effects.consume(code) return index === buffer.length ? self.interrupt ? ok : continuation : cdataOpenInside } return nok(code) } /** @type {State} */ function tagCloseStart(code) { if (asciiAlpha(code)) { effects.consume(code) buffer = String.fromCharCode(code) return tagName } return nok(code) } /** @type {State} */ function tagName(code) { if ( code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code) ) { if ( code !== 47 && startTag && htmlRawNames.includes(buffer.toLowerCase()) ) { kind = 1 return self.interrupt ? ok(code) : continuation(code) } if (htmlBlockNames.includes(buffer.toLowerCase())) { kind = 6 if (code === 47) { effects.consume(code) return basicSelfClosing } return self.interrupt ? ok(code) : continuation(code) } kind = 7 // Do not support complete HTML when interrupting return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : startTag ? completeAttributeNameBefore(code) : completeClosingTagAfter(code) } if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) buffer += String.fromCharCode(code) return tagName } return nok(code) } /** @type {State} */ function basicSelfClosing(code) { if (code === 62) { effects.consume(code) return self.interrupt ? ok : continuation } return nok(code) } /** @type {State} */ function completeClosingTagAfter(code) { if (markdownSpace(code)) { effects.consume(code) return completeClosingTagAfter } return completeEnd(code) } /** @type {State} */ function completeAttributeNameBefore(code) { if (code === 47) { effects.consume(code) return completeEnd } if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code) return completeAttributeName } if (markdownSpace(code)) { effects.consume(code) return completeAttributeNameBefore } return completeEnd(code) } /** @type {State} */ function completeAttributeName(code) { if ( code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code) ) { effects.consume(code) return completeAttributeName } return completeAttributeNameAfter(code) } /** @type {State} */ function completeAttributeNameAfter(code) { if (code === 61) { effects.consume(code) return completeAttributeValueBefore } if (markdownSpace(code)) { effects.consume(code) return completeAttributeNameAfter } return completeAttributeNameBefore(code) } /** @type {State} */ function completeAttributeValueBefore(code) { if ( code === null || code === 60 || code === 61 || code === 62 || code === 96 ) { return nok(code) } if (code === 34 || code === 39) { effects.consume(code) marker = code return completeAttributeValueQuoted } if (markdownSpace(code)) { effects.consume(code) return completeAttributeValueBefore } marker = null return completeAttributeValueUnquoted(code) } /** @type {State} */ function completeAttributeValueQuoted(code) { if (code === null || markdownLineEnding(code)) { return nok(code) } if (code === marker) { effects.consume(code) return completeAttributeValueQuotedAfter } effects.consume(code) return completeAttributeValueQuoted } /** @type {State} */ function completeAttributeValueUnquoted(code) { if ( code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code) ) { return completeAttributeNameAfter(code) } effects.consume(code) return completeAttributeValueUnquoted } /** @type {State} */ function completeAttributeValueQuotedAfter(code) { if (code === 47 || code === 62 || markdownSpace(code)) { return completeAttributeNameBefore(code) } return nok(code) } /** @type {State} */ function completeEnd(code) { if (code === 62) { effects.consume(code) return completeAfter } return nok(code) } /** @type {State} */ function completeAfter(code) { if (markdownSpace(code)) { effects.consume(code) return completeAfter } return code === null || markdownLineEnding(code) ? continuation(code) : nok(code) } /** @type {State} */ function continuation(code) { if (code === 45 && kind === 2) { effects.consume(code) return continuationCommentInside } if (code === 60 && kind === 1) { effects.consume(code) return continuationRawTagOpen } if (code === 62 && kind === 4) { effects.consume(code) return continuationClose } if (code === 63 && kind === 3) { effects.consume(code) return continuationDeclarationInside } if (code === 93 && kind === 5) { effects.consume(code) return continuationCharacterDataInside } if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { return effects.check( nextBlankConstruct, continuationClose, continuationAtLineEnding )(code) } if (code === null || markdownLineEnding(code)) { return continuationAtLineEnding(code) } effects.consume(code) return continuation } /** @type {State} */ function continuationAtLineEnding(code) { effects.exit('htmlFlowData') return htmlContinueStart(code) } /** @type {State} */ function htmlContinueStart(code) { if (code === null) { return done(code) } if (markdownLineEnding(code)) { return effects.attempt( { tokenize: htmlLineEnd, partial: true }, htmlContinueStart, done )(code) } effects.enter('htmlFlowData') return continuation(code) } /** @type {Tokenizer} */ function htmlLineEnd(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return lineStart } /** @type {State} */ function lineStart(code) { return self.parser.lazy[self.now().line] ? nok(code) : ok(code) } } /** @type {State} */ function continuationCommentInside(code) { if (code === 45) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** @type {State} */ function continuationRawTagOpen(code) { if (code === 47) { effects.consume(code) buffer = '' return continuationRawEndTag } return continuation(code) } /** @type {State} */ function continuationRawEndTag(code) { if (code === 62 && htmlRawNames.includes(buffer.toLowerCase())) { effects.consume(code) return continuationClose } if (asciiAlpha(code) && buffer.length < 8) { effects.consume(code) buffer += String.fromCharCode(code) return continuationRawEndTag } return continuation(code) } /** @type {State} */ function continuationCharacterDataInside(code) { if (code === 93) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** @type {State} */ function continuationDeclarationInside(code) { if (code === 62) { effects.consume(code) return continuationClose } // More dashes. if (code === 45 && kind === 2) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** @type {State} */ function continuationClose(code) { if (code === null || markdownLineEnding(code)) { effects.exit('htmlFlowData') return done(code) } effects.consume(code) return continuationClose } /** @type {State} */ function done(code) { effects.exit('htmlFlow') return ok(code) } } /** @type {Tokenizer} */ function tokenizeNextBlank(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.exit('htmlFlowData') effects.enter('lineEndingBlank') effects.consume(code) effects.exit('lineEndingBlank') return effects.attempt(blankLine, ok, nok) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/code-fenced.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const codeFenced = { name: 'codeFenced', tokenize: tokenizeCodeFenced, concrete: true } /** @type {Tokenizer} */ function tokenizeCodeFenced(effects, ok, nok) { const self = this /** @type {Construct} */ const closingFenceConstruct = { tokenize: tokenizeClosingFence, partial: true } /** @type {Construct} */ const nonLazyLine = { tokenize: tokenizeNonLazyLine, partial: true } const tail = this.events[this.events.length - 1] const initialPrefix = tail && tail[1].type === 'linePrefix' ? tail[2].sliceSerialize(tail[1], true).length : 0 let sizeOpen = 0 /** @type {NonNullable} */ let marker return start /** @type {State} */ function start(code) { effects.enter('codeFenced') effects.enter('codeFencedFence') effects.enter('codeFencedFenceSequence') marker = code return sequenceOpen(code) } /** @type {State} */ function sequenceOpen(code) { if (code === marker) { effects.consume(code) sizeOpen++ return sequenceOpen } effects.exit('codeFencedFenceSequence') return sizeOpen < 3 ? nok(code) : factorySpace(effects, infoOpen, 'whitespace')(code) } /** @type {State} */ function infoOpen(code) { if (code === null || markdownLineEnding(code)) { return openAfter(code) } effects.enter('codeFencedFenceInfo') effects.enter('chunkString', { contentType: 'string' }) return info(code) } /** @type {State} */ function info(code) { if (code === null || markdownLineEndingOrSpace(code)) { effects.exit('chunkString') effects.exit('codeFencedFenceInfo') return factorySpace(effects, infoAfter, 'whitespace')(code) } if (code === 96 && code === marker) return nok(code) effects.consume(code) return info } /** @type {State} */ function infoAfter(code) { if (code === null || markdownLineEnding(code)) { return openAfter(code) } effects.enter('codeFencedFenceMeta') effects.enter('chunkString', { contentType: 'string' }) return meta(code) } /** @type {State} */ function meta(code) { if (code === null || markdownLineEnding(code)) { effects.exit('chunkString') effects.exit('codeFencedFenceMeta') return openAfter(code) } if (code === 96 && code === marker) return nok(code) effects.consume(code) return meta } /** @type {State} */ function openAfter(code) { effects.exit('codeFencedFence') return self.interrupt ? ok(code) : contentStart(code) } /** @type {State} */ function contentStart(code) { if (code === null) { return after(code) } if (markdownLineEnding(code)) { return effects.attempt( nonLazyLine, effects.attempt( closingFenceConstruct, after, initialPrefix ? factorySpace( effects, contentStart, 'linePrefix', initialPrefix + 1 ) : contentStart ), after )(code) } effects.enter('codeFlowValue') return contentContinue(code) } /** @type {State} */ function contentContinue(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue') return contentStart(code) } effects.consume(code) return contentContinue } /** @type {State} */ function after(code) { effects.exit('codeFenced') return ok(code) } /** @type {Tokenizer} */ function tokenizeNonLazyLine(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return lineStart } /** @type {State} */ function lineStart(code) { return self.parser.lazy[self.now().line] ? nok(code) : ok(code) } } /** @type {Tokenizer} */ function tokenizeClosingFence(effects, ok, nok) { let size = 0 return factorySpace( effects, closingSequenceStart, 'linePrefix', this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) /** @type {State} */ function closingSequenceStart(code) { effects.enter('codeFencedFence') effects.enter('codeFencedFenceSequence') return closingSequence(code) } /** @type {State} */ function closingSequence(code) { if (code === marker) { effects.consume(code) size++ return closingSequence } if (size < sizeOpen) return nok(code) effects.exit('codeFencedFenceSequence') return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) } /** @type {State} */ function closingSequenceEnd(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFencedFence') return ok(code) } return nok(code) } } } ;// CONCATENATED MODULE: ./node_modules/decode-named-character-reference/index.dom.js /// /* eslint-env browser */ const index_dom_element = document.createElement('i') /** * @param {string} value * @returns {string|false} */ function decodeNamedCharacterReference(value) { const characterReference = '&' + value + ';' index_dom_element.innerHTML = characterReference const char = index_dom_element.textContent // Some named character references do not require the closing semicolon // (`¬`, for instance), which leads to situations where parsing the assumed // named reference of `¬it;` will result in the string `¬it;`. // When we encounter a trailing semicolon after parsing, and the character // reference to decode was not a semicolon (`;`), we can assume that the // matching was not complete. // @ts-expect-error: TypeScript is wrong that `textContent` on elements can // yield `null`. if (char.charCodeAt(char.length - 1) === 59 /* `;` */ && value !== 'semi') { return false } // If the decoded string is equal to the input, the character reference was // not valid. // @ts-expect-error: TypeScript is wrong that `textContent` on elements can // yield `null`. return char === characterReference ? false : char } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/character-reference.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const characterReference = { name: 'characterReference', tokenize: tokenizeCharacterReference } /** @type {Tokenizer} */ function tokenizeCharacterReference(effects, ok, nok) { const self = this let size = 0 /** @type {number} */ let max /** @type {(code: Code) => code is number} */ let test return start /** @type {State} */ function start(code) { effects.enter('characterReference') effects.enter('characterReferenceMarker') effects.consume(code) effects.exit('characterReferenceMarker') return open } /** @type {State} */ function open(code) { if (code === 35) { effects.enter('characterReferenceMarkerNumeric') effects.consume(code) effects.exit('characterReferenceMarkerNumeric') return numeric } effects.enter('characterReferenceValue') max = 31 test = asciiAlphanumeric return value(code) } /** @type {State} */ function numeric(code) { if (code === 88 || code === 120) { effects.enter('characterReferenceMarkerHexadecimal') effects.consume(code) effects.exit('characterReferenceMarkerHexadecimal') effects.enter('characterReferenceValue') max = 6 test = asciiHexDigit return value } effects.enter('characterReferenceValue') max = 7 test = asciiDigit return value(code) } /** @type {State} */ function value(code) { /** @type {Token} */ let token if (code === 59 && size) { token = effects.exit('characterReferenceValue') if ( test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token)) ) { return nok(code) } effects.enter('characterReferenceMarker') effects.consume(code) effects.exit('characterReferenceMarker') effects.exit('characterReference') return ok } if (test(code) && size++ < max) { effects.consume(code) return value } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/character-escape.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const characterEscape = { name: 'characterEscape', tokenize: tokenizeCharacterEscape } /** @type {Tokenizer} */ function tokenizeCharacterEscape(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.enter('characterEscape') effects.enter('escapeMarker') effects.consume(code) effects.exit('escapeMarker') return open } /** @type {State} */ function open(code) { if (asciiPunctuation(code)) { effects.enter('characterEscapeValue') effects.consume(code) effects.exit('characterEscapeValue') effects.exit('characterEscape') return ok } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/line-ending.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const lineEnding = { name: 'lineEnding', tokenize: tokenizeLineEnding } /** @type {Tokenizer} */ function tokenizeLineEnding(effects, ok) { return start /** @type {State} */ function start(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace(effects, ok, 'linePrefix') } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/label-end.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const labelEnd = { name: 'labelEnd', tokenize: tokenizeLabelEnd, resolveTo: resolveToLabelEnd, resolveAll: resolveAllLabelEnd } /** @type {Construct} */ const resourceConstruct = { tokenize: tokenizeResource } /** @type {Construct} */ const fullReferenceConstruct = { tokenize: tokenizeFullReference } /** @type {Construct} */ const collapsedReferenceConstruct = { tokenize: tokenizeCollapsedReference } /** @type {Resolver} */ function resolveAllLabelEnd(events) { let index = -1 /** @type {Token} */ let token while (++index < events.length) { token = events[index][1] if ( token.type === 'labelImage' || token.type === 'labelLink' || token.type === 'labelEnd' ) { // Remove the marker. events.splice(index + 1, token.type === 'labelImage' ? 4 : 2) token.type = 'data' index++ } } return events } /** @type {Resolver} */ function resolveToLabelEnd(events, context) { let index = events.length let offset = 0 /** @type {Token} */ let token /** @type {number|undefined} */ let open /** @type {number|undefined} */ let close /** @type {Event[]} */ let media // Find an opening. while (index--) { token = events[index][1] if (open) { // If we see another link, or inactive link label, we’ve been here before. if ( token.type === 'link' || (token.type === 'labelLink' && token._inactive) ) { break } // Mark other link openings as inactive, as we can’t have links in // links. if (events[index][0] === 'enter' && token.type === 'labelLink') { token._inactive = true } } else if (close) { if ( events[index][0] === 'enter' && (token.type === 'labelImage' || token.type === 'labelLink') && !token._balanced ) { open = index if (token.type !== 'labelLink') { offset = 2 break } } } else if (token.type === 'labelEnd') { close = index } } const group = { type: events[open][1].type === 'labelLink' ? 'link' : 'image', start: Object.assign({}, events[open][1].start), end: Object.assign({}, events[events.length - 1][1].end) } const label = { type: 'label', start: Object.assign({}, events[open][1].start), end: Object.assign({}, events[close][1].end) } const text = { type: 'labelText', start: Object.assign({}, events[open + offset + 2][1].end), end: Object.assign({}, events[close - 2][1].start) } media = [ ['enter', group, context], ['enter', label, context] ] // Opening marker. media = push(media, events.slice(open + 1, open + offset + 3)) // Text open. media = push(media, [['enter', text, context]]) // Between. media = push( media, resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context ) ) // Text close, marker close, label close. media = push(media, [ ['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context] ]) // Reference, resource, or so. media = push(media, events.slice(close + 1)) // Media close. media = push(media, [['exit', group, context]]) splice(events, open, events.length, media) return events } /** @type {Tokenizer} */ function tokenizeLabelEnd(effects, ok, nok) { const self = this let index = self.events.length /** @type {Token} */ let labelStart /** @type {boolean} */ let defined // Find an opening. while (index--) { if ( (self.events[index][1].type === 'labelImage' || self.events[index][1].type === 'labelLink') && !self.events[index][1]._balanced ) { labelStart = self.events[index][1] break } } return start /** @type {State} */ function start(code) { if (!labelStart) { return nok(code) } // It’s a balanced bracket, but contains a link. if (labelStart._inactive) return balanced(code) defined = self.parser.defined.includes( normalizeIdentifier( self.sliceSerialize({ start: labelStart.end, end: self.now() }) ) ) effects.enter('labelEnd') effects.enter('labelMarker') effects.consume(code) effects.exit('labelMarker') effects.exit('labelEnd') return afterLabelEnd } /** @type {State} */ function afterLabelEnd(code) { // Resource: `[asd](fgh)`. if (code === 40) { return effects.attempt( resourceConstruct, ok, defined ? ok : balanced )(code) } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? if (code === 91) { return effects.attempt( fullReferenceConstruct, ok, defined ? effects.attempt(collapsedReferenceConstruct, ok, balanced) : balanced )(code) } // Shortcut reference: `[asd]`? return defined ? ok(code) : balanced(code) } /** @type {State} */ function balanced(code) { labelStart._balanced = true return nok(code) } } /** @type {Tokenizer} */ function tokenizeResource(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.enter('resource') effects.enter('resourceMarker') effects.consume(code) effects.exit('resourceMarker') return factoryWhitespace(effects, open) } /** @type {State} */ function open(code) { if (code === 41) { return end(code) } return factoryDestination( effects, destinationAfter, nok, 'resourceDestination', 'resourceDestinationLiteral', 'resourceDestinationLiteralMarker', 'resourceDestinationRaw', 'resourceDestinationString', 32 )(code) } /** @type {State} */ function destinationAfter(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, between)(code) : end(code) } /** @type {State} */ function between(code) { if (code === 34 || code === 39 || code === 40) { return factoryTitle( effects, factoryWhitespace(effects, end), nok, 'resourceTitle', 'resourceTitleMarker', 'resourceTitleString' )(code) } return end(code) } /** @type {State} */ function end(code) { if (code === 41) { effects.enter('resourceMarker') effects.consume(code) effects.exit('resourceMarker') effects.exit('resource') return ok } return nok(code) } } /** @type {Tokenizer} */ function tokenizeFullReference(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { return factoryLabel.call( self, effects, afterLabel, nok, 'reference', 'referenceMarker', 'referenceString' )(code) } /** @type {State} */ function afterLabel(code) { return self.parser.defined.includes( normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) ) ? ok(code) : nok(code) } } /** @type {Tokenizer} */ function tokenizeCollapsedReference(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.enter('reference') effects.enter('referenceMarker') effects.consume(code) effects.exit('referenceMarker') return open } /** @type {State} */ function open(code) { if (code === 93) { effects.enter('referenceMarker') effects.consume(code) effects.exit('referenceMarker') effects.exit('reference') return ok } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/label-start-image.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const labelStartImage = { name: 'labelStartImage', tokenize: tokenizeLabelStartImage, resolveAll: labelEnd.resolveAll } /** @type {Tokenizer} */ function tokenizeLabelStartImage(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { effects.enter('labelImage') effects.enter('labelImageMarker') effects.consume(code) effects.exit('labelImageMarker') return open } /** @type {State} */ function open(code) { if (code === 91) { effects.enter('labelMarker') effects.consume(code) effects.exit('labelMarker') effects.exit('labelImage') return after } return nok(code) } /** @type {State} */ function after(code) { /* To do: remove in the future once we’ve switched from * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, * which doesn’t need this */ /* Hidden footnotes hook */ /* c8 ignore next 3 */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-classify-character/index.js /** * @typedef {import('micromark-util-types').Code} Code */ /** * Classify whether a character code represents whitespace, punctuation, or * something else. * * Used for attention (emphasis, strong), whose sequences can open or close * based on the class of surrounding characters. * * Note that eof (`null`) is seen as whitespace. * * @param {Code} code * @returns {number|undefined} */ function classifyCharacter(code) { if ( code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) ) { return 1 } if (unicodePunctuation(code)) { return 2 } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/attention.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Point} Point */ /** @type {Construct} */ const attention = { name: 'attention', tokenize: tokenizeAttention, resolveAll: resolveAllAttention } /** * 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 {Event[]} */ let nextEvents /** @type {number} */ let offset // Walk through all events. // // Note: performance of this is fine on an mb of normal markdown, but it’s // a bottleneck for malicious stuff. while (++index < events.length) { // Find a token that can close. if ( events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close ) { open = index // Now walk back to find an opener. while (open--) { // Find a token that can open the closer. if ( events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open && // If the markers are the same: context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0) ) { // If the opening can close or the closing can open, // and the close size *is not* a multiple of three, // but the sum of the opening and closing size *is* multiple of three, // then don’t match. 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 } // Number of markers to use from the sequence. 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 = Object.assign({}, events[open][1].end) const end = Object.assign({}, events[index][1].start) movePoint(start, -use) movePoint(end, use) openingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start, end: Object.assign({}, events[open][1].end) } closingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start: Object.assign({}, events[index][1].start), end } text = { type: use > 1 ? 'strongText' : 'emphasisText', start: Object.assign({}, events[open][1].end), end: Object.assign({}, events[index][1].start) } group = { type: use > 1 ? 'strong' : 'emphasis', start: Object.assign({}, openingSequence.start), end: Object.assign({}, closingSequence.end) } events[open][1].end = Object.assign({}, openingSequence.start) events[index][1].start = Object.assign({}, closingSequence.end) nextEvents = [] // If there are more markers in the opening, add them before. if (events[open][1].end.offset - events[open][1].start.offset) { nextEvents = push(nextEvents, [ ['enter', events[open][1], context], ['exit', events[open][1], context] ]) } // Opening. nextEvents = push(nextEvents, [ ['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context] ]) // Between. nextEvents = push( nextEvents, resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) ) // Closing. nextEvents = push(nextEvents, [ ['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context] ]) // If there are more markers in the closing, add them after. 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 } } } } // Remove remaining sequences. index = -1 while (++index < events.length) { if (events[index][1].type === 'attentionSequence') { events[index][1].type = 'data' } } return events } /** @type {Tokenizer} */ function tokenizeAttention(effects, ok) { const attentionMarkers = this.parser.constructs.attentionMarkers.null const previous = this.previous const before = classifyCharacter(previous) /** @type {NonNullable} */ let marker return start /** @type {State} */ function start(code) { effects.enter('attentionSequence') marker = code return sequence(code) } /** @type {State} */ function sequence(code) { if (code === marker) { effects.consume(code) return sequence } const token = effects.exit('attentionSequence') const after = classifyCharacter(code) const open = !after || (after === 2 && before) || attentionMarkers.includes(code) const close = !before || (before === 2 && after) || attentionMarkers.includes(previous) token._open = Boolean(marker === 42 ? open : open && (before || !close)) token._close = Boolean(marker === 42 ? close : close && (after || !open)) return ok(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 * @param {number} offset * @returns {void} */ function movePoint(point, offset) { point.column += offset point.offset += offset point._bufferIndex += offset } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/autolink.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const autolink = { name: 'autolink', tokenize: tokenizeAutolink } /** @type {Tokenizer} */ function tokenizeAutolink(effects, ok, nok) { let size = 1 return start /** @type {State} */ function start(code) { effects.enter('autolink') effects.enter('autolinkMarker') effects.consume(code) effects.exit('autolinkMarker') effects.enter('autolinkProtocol') return open } /** @type {State} */ function open(code) { if (asciiAlpha(code)) { effects.consume(code) return schemeOrEmailAtext } return asciiAtext(code) ? emailAtext(code) : nok(code) } /** @type {State} */ function schemeOrEmailAtext(code) { return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) ? schemeInsideOrEmailAtext(code) : emailAtext(code) } /** @type {State} */ function schemeInsideOrEmailAtext(code) { if (code === 58) { effects.consume(code) return urlInside } if ( (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32 ) { effects.consume(code) return schemeInsideOrEmailAtext } return emailAtext(code) } /** @type {State} */ function urlInside(code) { if (code === 62) { effects.exit('autolinkProtocol') return end(code) } if (code === null || code === 32 || code === 60 || asciiControl(code)) { return nok(code) } effects.consume(code) return urlInside } /** @type {State} */ function emailAtext(code) { if (code === 64) { effects.consume(code) size = 0 return emailAtSignOrDot } if (asciiAtext(code)) { effects.consume(code) return emailAtext } return nok(code) } /** @type {State} */ function emailAtSignOrDot(code) { return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) } /** @type {State} */ function emailLabel(code) { if (code === 46) { effects.consume(code) size = 0 return emailAtSignOrDot } if (code === 62) { // Exit, then change the type. effects.exit('autolinkProtocol').type = 'autolinkEmail' return end(code) } return emailValue(code) } /** @type {State} */ function emailValue(code) { if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { effects.consume(code) return code === 45 ? emailValue : emailLabel } return nok(code) } /** @type {State} */ function end(code) { effects.enter('autolinkMarker') effects.consume(code) effects.exit('autolinkMarker') effects.exit('autolink') return ok } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/html-text.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Code} Code */ /** @type {Construct} */ const htmlText = { name: 'htmlText', tokenize: tokenizeHtmlText } /** @type {Tokenizer} */ function tokenizeHtmlText(effects, ok, nok) { const self = this /** @type {NonNullable|undefined} */ let marker /** @type {string} */ let buffer /** @type {number} */ let index /** @type {State} */ let returnState return start /** @type {State} */ function start(code) { effects.enter('htmlText') effects.enter('htmlTextData') effects.consume(code) return open } /** @type {State} */ function open(code) { if (code === 33) { effects.consume(code) return declarationOpen } if (code === 47) { effects.consume(code) return tagCloseStart } if (code === 63) { effects.consume(code) return instruction } if (asciiAlpha(code)) { effects.consume(code) return tagOpen } return nok(code) } /** @type {State} */ function declarationOpen(code) { if (code === 45) { effects.consume(code) return commentOpen } if (code === 91) { effects.consume(code) buffer = 'CDATA[' index = 0 return cdataOpen } if (asciiAlpha(code)) { effects.consume(code) return declaration } return nok(code) } /** @type {State} */ function commentOpen(code) { if (code === 45) { effects.consume(code) return commentStart } return nok(code) } /** @type {State} */ function commentStart(code) { if (code === null || code === 62) { return nok(code) } if (code === 45) { effects.consume(code) return commentStartDash } return comment(code) } /** @type {State} */ function commentStartDash(code) { if (code === null || code === 62) { return nok(code) } return comment(code) } /** @type {State} */ function comment(code) { if (code === null) { return nok(code) } if (code === 45) { effects.consume(code) return commentClose } if (markdownLineEnding(code)) { returnState = comment return atLineEnding(code) } effects.consume(code) return comment } /** @type {State} */ function commentClose(code) { if (code === 45) { effects.consume(code) return end } return comment(code) } /** @type {State} */ function cdataOpen(code) { if (code === buffer.charCodeAt(index++)) { effects.consume(code) return index === buffer.length ? cdata : cdataOpen } return nok(code) } /** @type {State} */ function cdata(code) { if (code === null) { return nok(code) } if (code === 93) { effects.consume(code) return cdataClose } if (markdownLineEnding(code)) { returnState = cdata return atLineEnding(code) } effects.consume(code) return cdata } /** @type {State} */ function cdataClose(code) { if (code === 93) { effects.consume(code) return cdataEnd } return cdata(code) } /** @type {State} */ function cdataEnd(code) { if (code === 62) { return end(code) } if (code === 93) { effects.consume(code) return cdataEnd } return cdata(code) } /** @type {State} */ function declaration(code) { if (code === null || code === 62) { return end(code) } if (markdownLineEnding(code)) { returnState = declaration return atLineEnding(code) } effects.consume(code) return declaration } /** @type {State} */ function instruction(code) { if (code === null) { return nok(code) } if (code === 63) { effects.consume(code) return instructionClose } if (markdownLineEnding(code)) { returnState = instruction return atLineEnding(code) } effects.consume(code) return instruction } /** @type {State} */ function instructionClose(code) { return code === 62 ? end(code) : instruction(code) } /** @type {State} */ function tagCloseStart(code) { if (asciiAlpha(code)) { effects.consume(code) return tagClose } return nok(code) } /** @type {State} */ function tagClose(code) { if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) return tagClose } return tagCloseBetween(code) } /** @type {State} */ function tagCloseBetween(code) { if (markdownLineEnding(code)) { returnState = tagCloseBetween return atLineEnding(code) } if (markdownSpace(code)) { effects.consume(code) return tagCloseBetween } return end(code) } /** @type {State} */ function tagOpen(code) { if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) return tagOpen } if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } /** @type {State} */ function tagOpenBetween(code) { if (code === 47) { effects.consume(code) return end } if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code) return tagOpenAttributeName } if (markdownLineEnding(code)) { returnState = tagOpenBetween return atLineEnding(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenBetween } return end(code) } /** @type {State} */ function tagOpenAttributeName(code) { if ( code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code) ) { effects.consume(code) return tagOpenAttributeName } return tagOpenAttributeNameAfter(code) } /** @type {State} */ function tagOpenAttributeNameAfter(code) { if (code === 61) { effects.consume(code) return tagOpenAttributeValueBefore } if (markdownLineEnding(code)) { returnState = tagOpenAttributeNameAfter return atLineEnding(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenAttributeNameAfter } return tagOpenBetween(code) } /** @type {State} */ function tagOpenAttributeValueBefore(code) { if ( code === null || code === 60 || code === 61 || code === 62 || code === 96 ) { return nok(code) } if (code === 34 || code === 39) { effects.consume(code) marker = code return tagOpenAttributeValueQuoted } if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueBefore return atLineEnding(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenAttributeValueBefore } effects.consume(code) marker = undefined return tagOpenAttributeValueUnquoted } /** @type {State} */ function tagOpenAttributeValueQuoted(code) { if (code === marker) { effects.consume(code) return tagOpenAttributeValueQuotedAfter } if (code === null) { return nok(code) } if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueQuoted return atLineEnding(code) } effects.consume(code) return tagOpenAttributeValueQuoted } /** @type {State} */ function tagOpenAttributeValueQuotedAfter(code) { if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } /** @type {State} */ function tagOpenAttributeValueUnquoted(code) { if ( code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96 ) { return nok(code) } if (code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } effects.consume(code) return tagOpenAttributeValueUnquoted } // We can’t have blank lines in content, so no need to worry about empty // tokens. /** @type {State} */ function atLineEnding(code) { effects.exit('htmlTextData') effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace( effects, afterPrefix, 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) } /** @type {State} */ function afterPrefix(code) { effects.enter('htmlTextData') return returnState(code) } /** @type {State} */ function end(code) { if (code === 62) { effects.consume(code) effects.exit('htmlTextData') effects.exit('htmlText') return ok } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/label-start-link.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const labelStartLink = { name: 'labelStartLink', tokenize: tokenizeLabelStartLink, resolveAll: labelEnd.resolveAll } /** @type {Tokenizer} */ function tokenizeLabelStartLink(effects, ok, nok) { const self = this return start /** @type {State} */ function start(code) { effects.enter('labelLink') effects.enter('labelMarker') effects.consume(code) effects.exit('labelMarker') effects.exit('labelLink') return after } /** @type {State} */ function after(code) { /* To do: remove in the future once we’ve switched from * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, * which doesn’t need this */ /* Hidden footnotes hook. */ /* c8 ignore next 3 */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/hard-break-escape.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const hardBreakEscape = { name: 'hardBreakEscape', tokenize: tokenizeHardBreakEscape } /** @type {Tokenizer} */ function tokenizeHardBreakEscape(effects, ok, nok) { return start /** @type {State} */ function start(code) { effects.enter('hardBreakEscape') effects.enter('escapeMarker') effects.consume(code) return open } /** @type {State} */ function open(code) { if (markdownLineEnding(code)) { effects.exit('escapeMarker') effects.exit('hardBreakEscape') return ok(code) } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-core-commonmark/lib/code-text.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer * @typedef {import('micromark-util-types').Previous} Previous * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').State} State */ /** @type {Construct} */ const codeText = { name: 'codeText', tokenize: tokenizeCodeText, resolve: resolveCodeText, previous } /** @type {Resolver} */ function resolveCodeText(events) { let tailExitIndex = events.length - 4 let headEnterIndex = 3 /** @type {number} */ let index /** @type {number|undefined} */ let enter // If we start and end with an EOL or a space. if ( (events[headEnterIndex][1].type === 'lineEnding' || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === 'lineEnding' || events[tailExitIndex][1].type === 'space') ) { index = headEnterIndex // And we have data. while (++index < tailExitIndex) { if (events[index][1].type === 'codeTextData') { // Then we have padding. events[headEnterIndex][1].type = 'codeTextPadding' events[tailExitIndex][1].type = 'codeTextPadding' headEnterIndex += 2 tailExitIndex -= 2 break } } } // Merge adjacent spaces and data. index = headEnterIndex - 1 tailExitIndex++ while (++index <= tailExitIndex) { if (enter === undefined) { if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { enter = index } } else if ( index === tailExitIndex || events[index][1].type === 'lineEnding' ) { events[enter][1].type = '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 = undefined } } return events } /** @type {Previous} */ function previous(code) { // If there is a previous code, there will always be a tail. return ( code !== 96 || this.events[this.events.length - 1][1].type === 'characterEscape' ) } /** @type {Tokenizer} */ function tokenizeCodeText(effects, ok, nok) { const self = this let sizeOpen = 0 /** @type {number} */ let size /** @type {Token} */ let token return start /** @type {State} */ function start(code) { effects.enter('codeText') effects.enter('codeTextSequence') return openingSequence(code) } /** @type {State} */ function openingSequence(code) { if (code === 96) { effects.consume(code) sizeOpen++ return openingSequence } effects.exit('codeTextSequence') return gap(code) } /** @type {State} */ function gap(code) { // EOF. if (code === null) { return nok(code) } // Closing fence? // Could also be data. if (code === 96) { token = effects.enter('codeTextSequence') size = 0 return closingSequence(code) } // Tabs don’t work, and virtual spaces don’t make sense. if (code === 32) { effects.enter('space') effects.consume(code) effects.exit('space') return gap } if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return gap } // Data. effects.enter('codeTextData') return data(code) } // In code. /** @type {State} */ function data(code) { if ( code === null || code === 32 || code === 96 || markdownLineEnding(code) ) { effects.exit('codeTextData') return gap(code) } effects.consume(code) return data } // Closing fence. /** @type {State} */ function closingSequence(code) { // More. if (code === 96) { effects.consume(code) size++ return closingSequence } // Done! if (size === sizeOpen) { effects.exit('codeTextSequence') effects.exit('codeText') return ok(code) } // More or less accents: mark as data. token.type = 'codeTextData' return data(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/constructs.js /** * @typedef {import('micromark-util-types').Extension} Extension */ /** @type {Extension['document']} */ const constructs_document = { [42]: list, [43]: list, [45]: list, [48]: list, [49]: list, [50]: list, [51]: list, [52]: list, [53]: list, [54]: list, [55]: list, [56]: list, [57]: list, [62]: blockQuote } /** @type {Extension['contentInitial']} */ const contentInitial = { [91]: definition } /** @type {Extension['flowInitial']} */ const flowInitial = { [-2]: codeIndented, [-1]: codeIndented, [32]: codeIndented } /** @type {Extension['flow']} */ const constructs_flow = { [35]: headingAtx, [42]: thematicBreak, [45]: [setextUnderline, thematicBreak], [60]: htmlFlow, [61]: setextUnderline, [95]: thematicBreak, [96]: codeFenced, [126]: codeFenced } /** @type {Extension['string']} */ const constructs_string = { [38]: characterReference, [92]: characterEscape } /** @type {Extension['text']} */ const constructs_text = { [-5]: lineEnding, [-4]: lineEnding, [-3]: lineEnding, [33]: labelStartImage, [38]: characterReference, [42]: attention, [60]: [autolink, htmlText], [91]: labelStartLink, [92]: [hardBreakEscape, characterEscape], [93]: labelEnd, [95]: attention, [96]: codeText } /** @type {Extension['insideSpan']} */ const insideSpan = { null: [attention, resolver] } /** @type {Extension['attentionMarkers']} */ const attentionMarkers = { null: [42, 95] } /** @type {Extension['disable']} */ const disable = { null: [] } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/parse.js /** * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension * @typedef {import('micromark-util-types').ParseOptions} ParseOptions * @typedef {import('micromark-util-types').ParseContext} ParseContext * @typedef {import('micromark-util-types').Create} Create */ /** * @param {ParseOptions} [options] * @returns {ParseContext} */ function parse(options = {}) { /** @type {FullNormalizedExtension} */ // @ts-expect-error `defaultConstructs` is full, so the result will be too. const constructs = combineExtensions( // @ts-expect-error Same as above. [constructs_namespaceObject].concat(options.extensions || []) ) /** @type {ParseContext} */ const parser = { defined: [], lazy: {}, constructs, content: create(content), document: create(document_document), flow: create(flow), string: create(string), text: create(text_text) } return parser /** * @param {InitialConstruct} initial */ function create(initial) { return creator /** @type {Create} */ function creator(from) { return createTokenizer(parser, initial, from) } } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/preprocess.js /** * @typedef {import('micromark-util-types').Encoding} Encoding * @typedef {import('micromark-util-types').Value} Value * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Code} Code */ /** * @callback Preprocessor * @param {Value} value * @param {Encoding} [encoding] * @param {boolean} [end=false] * @returns {Array} */ const search = /[\0\t\n\r]/g /** * @returns {Preprocessor} */ function preprocess() { let column = 1 let buffer = '' /** @type {boolean|undefined} */ let start = true /** @type {boolean|undefined} */ let atCarriageReturn return preprocessor /** @type {Preprocessor} */ function preprocessor(value, encoding, end) { /** @type {Array} */ const chunks = [] /** @type {RegExpMatchArray|null} */ let match /** @type {number} */ let next /** @type {number} */ let startPosition /** @type {number} */ let endPosition /** @type {Code} */ let code // @ts-expect-error `Buffer` does allow an encoding. value = buffer + value.toString(encoding) startPosition = 0 buffer = '' if (start) { if (value.charCodeAt(0) === 65279) { startPosition++ } start = undefined } while (startPosition < value.length) { search.lastIndex = startPosition match = search.exec(value) endPosition = match && match.index !== undefined ? match.index : value.length code = value.charCodeAt(endPosition) if (!match) { buffer = value.slice(startPosition) break } if (code === 10 && startPosition === endPosition && atCarriageReturn) { chunks.push(-3) atCarriageReturn = undefined } else { if (atCarriageReturn) { chunks.push(-5) atCarriageReturn = undefined } if (startPosition < endPosition) { chunks.push(value.slice(startPosition, endPosition)) column += endPosition - startPosition } switch (code) { case 0: { chunks.push(65533) column++ break } case 9: { next = Math.ceil(column / 4) * 4 chunks.push(-2) while (column++ < next) chunks.push(-1) break } case 10: { chunks.push(-4) column = 1 break } default: { atCarriageReturn = true column = 1 } } } startPosition = endPosition + 1 } if (end) { if (atCarriageReturn) chunks.push(-5) if (buffer) chunks.push(buffer) chunks.push(null) } return chunks } } ;// CONCATENATED MODULE: ./node_modules/micromark/lib/postprocess.js /** * @typedef {import('micromark-util-types').Event} Event */ /** * @param {Array} events * @returns {Array} */ function postprocess(events) { while (!subtokenize(events)) { // Empty } return events } ;// CONCATENATED MODULE: ./node_modules/micromark-util-decode-numeric-character-reference/index.js /** * Turn the number (in string form as either hexa- or plain decimal) coming from * a numeric character reference into a character. * * @param {string} value * Value to decode. * @param {number} base * Numeric base. * @returns {string} */ function decodeNumericCharacterReference(value, base) { const code = Number.parseInt(value, base) if ( // C0 except for HT, LF, FF, CR, space code < 9 || code === 11 || (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. (code > 126 && code < 160) || // Lone high surrogates and low surrogates. (code > 55295 && code < 57344) || // Noncharacters. (code > 64975 && code < 65008) || (code & 65535) === 65535 || (code & 65535) === 65534 || // Out of range code > 1114111 ) { return '\uFFFD' } return String.fromCharCode(code) } ;// CONCATENATED MODULE: ./node_modules/micromark-util-decode-string/index.js const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi /** * Utility to decode markdown strings (which occur in places such as fenced * code info strings, destinations, labels, and titles). * The “string” content type allows character escapes and -references. * This decodes those. * * @param {string} value * @returns {string} */ function decodeString(value) { return value.replace(characterEscapeOrReference, decode) } /** * @param {string} $0 * @param {string} $1 * @param {string} $2 * @returns {string} */ function decode($0, $1, $2) { if ($1) { // Escape. return $1 } // Reference. const head = $2.charCodeAt(0) if (head === 35) { const head = $2.charCodeAt(1) const hex = head === 120 || head === 88 return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10) } return decodeNamedCharacterReference($2) || $0 } ;// CONCATENATED MODULE: ./node_modules/mdast-util-from-markdown/lib/index.js /** * @typedef {import('micromark-util-types').Encoding} Encoding * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').ParseOptions} ParseOptions * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Value} Value * * @typedef {import('unist').Parent} UnistParent * @typedef {import('unist').Point} Point * * @typedef {import('mdast').PhrasingContent} PhrasingContent * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent * @typedef {import('mdast').Content} Content * @typedef {import('mdast').Break} Break * @typedef {import('mdast').Blockquote} Blockquote * @typedef {import('mdast').Code} Code * @typedef {import('mdast').Definition} Definition * @typedef {import('mdast').Emphasis} Emphasis * @typedef {import('mdast').Heading} Heading * @typedef {import('mdast').HTML} HTML * @typedef {import('mdast').Image} Image * @typedef {import('mdast').ImageReference} ImageReference * @typedef {import('mdast').InlineCode} InlineCode * @typedef {import('mdast').Link} Link * @typedef {import('mdast').LinkReference} LinkReference * @typedef {import('mdast').List} List * @typedef {import('mdast').ListItem} ListItem * @typedef {import('mdast').Paragraph} Paragraph * @typedef {import('mdast').Root} Root * @typedef {import('mdast').Strong} Strong * @typedef {import('mdast').Text} Text * @typedef {import('mdast').ThematicBreak} ThematicBreak * @typedef {import('mdast').ReferenceType} ReferenceType * @typedef {import('../index.js').CompileData} CompileData */ /** * @typedef {Root | Content} Node * @typedef {Extract} Parent * * @typedef {Omit & {type: 'fragment', children: Array}} Fragment */ /** * @callback Transform * Extra transform, to change the AST afterwards. * @param {Root} tree * Tree to transform. * @returns {Root | undefined | null | void} * New tree or nothing (in which case the current tree is used). * * @callback Handle * Handle a token. * @param {CompileContext} this * Context. * @param {Token} token * Current token. * @returns {void} * Nothing. * * @typedef {Record} Handles * Token types mapping to handles * * @callback OnEnterError * Handle the case where the `right` token is open, but it is closed (by the * `left` token) or because we reached the end of the document. * @param {Omit} this * Context. * @param {Token | undefined} left * Left token. * @param {Token} right * Right token. * @returns {void} * Nothing. * * @callback OnExitError * Handle the case where the `right` token is open but it is closed by * exiting the `left` token. * @param {Omit} this * Context. * @param {Token} left * Left token. * @param {Token} right * Right token. * @returns {void} * Nothing. * * @typedef {[Token, OnEnterError | undefined]} TokenTuple * Open token on the stack, with an optional error handler for when * that token isn’t closed properly. */ /** * @typedef Config * Configuration. * * We have our defaults, but extensions will add more. * @property {Array} canContainEols * Token types where line endings are used. * @property {Handles} enter * Opening handles. * @property {Handles} exit * Closing handles. * @property {Array} transforms * Tree transforms. * * @typedef {Partial} Extension * Change how markdown tokens from micromark are turned into mdast. * * @typedef CompileContext * mdast compiler context. * @property {Array} stack * Stack of nodes. * @property {Array} tokenStack * Stack of tokens. * @property {(key: Key) => CompileData[Key]} getData * Get data from the key/value store. * @property {(key: Key, value?: CompileData[Key]) => void} setData * Set data into the key/value store. * @property {(this: CompileContext) => void} buffer * Capture some of the output data. * @property {(this: CompileContext) => string} resume * Stop capturing and access the output data. * @property {(this: CompileContext, node: Kind, token: Token, onError?: OnEnterError) => Kind} enter * Enter a token. * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit * Exit a token. * @property {TokenizeContext['sliceSerialize']} sliceSerialize * Get the string value of a token. * @property {Config} config * Configuration. * * @typedef FromMarkdownOptions * Configuration for how to build mdast. * @property {Array> | null | undefined} [mdastExtensions] * Extensions for this utility to change how tokens are turned into a tree. * * @typedef {ParseOptions & FromMarkdownOptions} Options * Configuration. */ // To do: micromark: create a registry of tokens? // To do: next major: don’t return given `Node` from `enter`. // To do: next major: remove setter/getter. const lib_own = {}.hasOwnProperty /** * @param value * Markdown to parse. * @param encoding * Character encoding for when `value` is `Buffer`. * @param options * Configuration. * @returns * mdast tree. */ const fromMarkdown = /** * @type {( * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) & * ((value: Value, options?: Options | null | undefined) => Root) * )} */ /** * @param {Value} value * @param {Encoding | Options | null | undefined} [encoding] * @param {Options | null | undefined} [options] * @returns {Root} */ function (value, encoding, options) { if (typeof encoding !== 'string') { options = encoding encoding = undefined } return compiler(options)( postprocess( // @ts-expect-error: micromark types need to accept `null`. parse(options).document().write(preprocess()(value, encoding, true)) ) ) } /** * Note this compiler only understand complete buffering, not streaming. * * @param {Options | null | undefined} [options] */ function compiler(options) { /** @type {Config} */ const config = { transforms: [], canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'], enter: { autolink: opener(link), autolinkProtocol: onenterdata, autolinkEmail: onenterdata, atxHeading: opener(heading), blockQuote: opener(blockQuote), characterEscape: onenterdata, characterReference: onenterdata, codeFenced: opener(codeFlow), codeFencedFenceInfo: buffer, codeFencedFenceMeta: buffer, codeIndented: opener(codeFlow, buffer), codeText: opener(codeText, buffer), codeTextData: onenterdata, data: onenterdata, codeFlowValue: onenterdata, definition: opener(definition), definitionDestinationString: buffer, definitionLabelString: buffer, definitionTitleString: buffer, emphasis: opener(emphasis), hardBreakEscape: opener(hardBreak), hardBreakTrailing: opener(hardBreak), htmlFlow: opener(html, buffer), htmlFlowData: onenterdata, htmlText: opener(html, buffer), htmlTextData: onenterdata, image: opener(image), label: buffer, link: opener(link), listItem: opener(listItem), listItemValue: onenterlistitemvalue, listOrdered: opener(list, onenterlistordered), listUnordered: opener(list), paragraph: opener(paragraph), reference: onenterreference, referenceString: buffer, resourceDestinationString: buffer, resourceTitleString: buffer, setextHeading: opener(heading), strong: opener(strong), thematicBreak: opener(thematicBreak) }, exit: { atxHeading: closer(), atxHeadingSequence: onexitatxheadingsequence, autolink: closer(), autolinkEmail: onexitautolinkemail, autolinkProtocol: onexitautolinkprotocol, blockQuote: closer(), characterEscapeValue: onexitdata, characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, characterReferenceMarkerNumeric: onexitcharacterreferencemarker, characterReferenceValue: onexitcharacterreferencevalue, codeFenced: closer(onexitcodefenced), codeFencedFence: onexitcodefencedfence, codeFencedFenceInfo: onexitcodefencedfenceinfo, codeFencedFenceMeta: onexitcodefencedfencemeta, codeFlowValue: onexitdata, codeIndented: closer(onexitcodeindented), codeText: closer(onexitcodetext), codeTextData: onexitdata, data: onexitdata, definition: closer(), definitionDestinationString: onexitdefinitiondestinationstring, definitionLabelString: onexitdefinitionlabelstring, definitionTitleString: onexitdefinitiontitlestring, emphasis: closer(), hardBreakEscape: closer(onexithardbreak), hardBreakTrailing: closer(onexithardbreak), htmlFlow: closer(onexithtmlflow), htmlFlowData: onexitdata, htmlText: closer(onexithtmltext), htmlTextData: onexitdata, image: closer(onexitimage), label: onexitlabel, labelText: onexitlabeltext, lineEnding: onexitlineending, link: closer(onexitlink), listItem: closer(), listOrdered: closer(), listUnordered: closer(), paragraph: closer(), referenceString: onexitreferencestring, resourceDestinationString: onexitresourcedestinationstring, resourceTitleString: onexitresourcetitlestring, resource: onexitresource, setextHeading: closer(onexitsetextheading), setextHeadingLineSequence: onexitsetextheadinglinesequence, setextHeadingText: onexitsetextheadingtext, strong: closer(), thematicBreak: closer() } } configure(config, (options || {}).mdastExtensions || []) /** @type {CompileData} */ const data = {} return compile /** * Turn micromark events into an mdast tree. * * @param {Array} events * Events. * @returns {Root} * mdast tree. */ function compile(events) { /** @type {Root} */ let tree = { type: 'root', children: [] } /** @type {Omit} */ const context = { stack: [tree], tokenStack: [], config, enter, exit, buffer, resume, setData, getData } /** @type {Array} */ const listStack = [] let index = -1 while (++index < events.length) { // We preprocess lists to add `listItem` tokens, and to infer whether // items the list itself are spread out. if ( events[index][1].type === 'listOrdered' || events[index][1].type === 'listUnordered' ) { if (events[index][0] === 'enter') { listStack.push(index) } else { const tail = listStack.pop() index = prepareList(events, tail, index) } } } index = -1 while (++index < events.length) { const handler = config[events[index][0]] if (lib_own.call(handler, events[index][1].type)) { handler[events[index][1].type].call( Object.assign( { sliceSerialize: events[index][2].sliceSerialize }, context ), events[index][1] ) } } // Handle tokens still being open. if (context.tokenStack.length > 0) { const tail = context.tokenStack[context.tokenStack.length - 1] const handler = tail[1] || defaultOnError handler.call(context, undefined, tail[0]) } // Figure out `root` position. tree.position = { start: lib_point( events.length > 0 ? events[0][1].start : { line: 1, column: 1, offset: 0 } ), end: lib_point( events.length > 0 ? events[events.length - 2][1].end : { line: 1, column: 1, offset: 0 } ) } // Call transforms. index = -1 while (++index < config.transforms.length) { tree = config.transforms[index](tree) || tree } return tree } /** * @param {Array} events * @param {number} start * @param {number} length * @returns {number} */ function prepareList(events, start, length) { let index = start - 1 let containerBalance = -1 let listSpread = false /** @type {Token | undefined} */ let listItem /** @type {number | undefined} */ let lineIndex /** @type {number | undefined} */ let firstBlankLineIndex /** @type {boolean | undefined} */ let atMarker while (++index <= length) { const event = events[index] if ( event[1].type === 'listUnordered' || event[1].type === 'listOrdered' || event[1].type === 'blockQuote' ) { if (event[0] === 'enter') { containerBalance++ } else { containerBalance-- } atMarker = undefined } else if (event[1].type === 'lineEndingBlank') { if (event[0] === 'enter') { if ( listItem && !atMarker && !containerBalance && !firstBlankLineIndex ) { firstBlankLineIndex = index } atMarker = undefined } } else if ( event[1].type === 'linePrefix' || event[1].type === 'listItemValue' || event[1].type === 'listItemMarker' || event[1].type === 'listItemPrefix' || event[1].type === 'listItemPrefixWhitespace' ) { // Empty. } else { atMarker = undefined } if ( (!containerBalance && event[0] === 'enter' && event[1].type === 'listItemPrefix') || (containerBalance === -1 && event[0] === 'exit' && (event[1].type === 'listUnordered' || event[1].type === 'listOrdered')) ) { if (listItem) { let tailIndex = index lineIndex = undefined while (tailIndex--) { const tailEvent = events[tailIndex] if ( tailEvent[1].type === 'lineEnding' || tailEvent[1].type === 'lineEndingBlank' ) { if (tailEvent[0] === 'exit') continue if (lineIndex) { events[lineIndex][1].type = 'lineEndingBlank' listSpread = true } tailEvent[1].type = 'lineEnding' lineIndex = tailIndex } else if ( tailEvent[1].type === 'linePrefix' || tailEvent[1].type === 'blockQuotePrefix' || tailEvent[1].type === 'blockQuotePrefixWhitespace' || tailEvent[1].type === 'blockQuoteMarker' || tailEvent[1].type === 'listItemIndent' ) { // Empty } else { break } } if ( firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex) ) { // @ts-expect-error Patched. listItem._spread = true } // Fix position. listItem.end = Object.assign( {}, lineIndex ? events[lineIndex][1].start : event[1].end ) events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]) index++ length++ } // Create a new list item. if (event[1].type === 'listItemPrefix') { listItem = { type: 'listItem', // @ts-expect-error Patched _spread: false, start: Object.assign({}, event[1].start) } // @ts-expect-error: `listItem` is most definitely defined, TS... events.splice(index, 0, ['enter', listItem, event[2]]) index++ length++ firstBlankLineIndex = undefined atMarker = true } } } // @ts-expect-error Patched. events[start][1]._spread = listSpread return length } /** * Set data. * * @template {keyof CompileData} Key * Field type. * @param {Key} key * Key of field. * @param {CompileData[Key]} [value] * New value. * @returns {void} * Nothing. */ function setData(key, value) { data[key] = value } /** * Get data. * * @template {keyof CompileData} Key * Field type. * @param {Key} key * Key of field. * @returns {CompileData[Key]} * Value. */ function getData(key) { return data[key] } /** * Create an opener handle. * * @param {(token: Token) => Node} create * Create a node. * @param {Handle} [and] * Optional function to also run. * @returns {Handle} * Handle. */ function opener(create, and) { return open /** * @this {CompileContext} * @param {Token} token * @returns {void} */ function open(token) { enter.call(this, create(token), token) if (and) and.call(this, token) } } /** * @this {CompileContext} * @returns {void} */ function buffer() { this.stack.push({ type: 'fragment', children: [] }) } /** * @template {Node} Kind * Node type. * @this {CompileContext} * Context. * @param {Kind} node * Node to enter. * @param {Token} token * Corresponding token. * @param {OnEnterError | undefined} [errorHandler] * Handle the case where this token is open, but it is closed by something else. * @returns {Kind} * The given node. */ function enter(node, token, errorHandler) { const parent = this.stack[this.stack.length - 1] // @ts-expect-error: Assume `Node` can exist as a child of `parent`. parent.children.push(node) this.stack.push(node) this.tokenStack.push([token, errorHandler]) // @ts-expect-error: `end` will be patched later. node.position = { start: lib_point(token.start) } return node } /** * Create a closer handle. * * @param {Handle} [and] * Optional function to also run. * @returns {Handle} * Handle. */ function closer(and) { return close /** * @this {CompileContext} * @param {Token} token * @returns {void} */ function close(token) { if (and) and.call(this, token) exit.call(this, token) } } /** * @this {CompileContext} * Context. * @param {Token} token * Corresponding token. * @param {OnExitError | undefined} [onExitError] * Handle the case where another token is open. * @returns {Node} * The closed node. */ function exit(token, onExitError) { const node = this.stack.pop() const open = this.tokenStack.pop() if (!open) { throw new Error( 'Cannot close `' + token.type + '` (' + stringifyPosition({ start: token.start, end: token.end }) + '): it’s not open' ) } else if (open[0].type !== token.type) { if (onExitError) { onExitError.call(this, token, open[0]) } else { const handler = open[1] || defaultOnError handler.call(this, token, open[0]) } } node.position.end = lib_point(token.end) return node } /** * @this {CompileContext} * @returns {string} */ function resume() { return lib_toString(this.stack.pop()) } // // Handlers. // /** * @this {CompileContext} * @type {Handle} */ function onenterlistordered() { setData('expectingFirstListItemValue', true) } /** * @this {CompileContext} * @type {Handle} */ function onenterlistitemvalue(token) { if (getData('expectingFirstListItemValue')) { const ancestor = this.stack[this.stack.length - 2] ancestor.start = Number.parseInt(this.sliceSerialize(token), 10) setData('expectingFirstListItemValue') } } /** * @this {CompileContext} * @type {Handle} */ function onexitcodefencedfenceinfo() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.lang = data } /** * @this {CompileContext} * @type {Handle} */ function onexitcodefencedfencemeta() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.meta = data } /** * @this {CompileContext} * @type {Handle} */ function onexitcodefencedfence() { // Exit if this is the closing fence. if (getData('flowCodeInside')) return this.buffer() setData('flowCodeInside', true) } /** * @this {CompileContext} * @type {Handle} */ function onexitcodefenced() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, '') setData('flowCodeInside') } /** * @this {CompileContext} * @type {Handle} */ function onexitcodeindented() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.value = data.replace(/(\r?\n|\r)$/g, '') } /** * @this {CompileContext} * @type {Handle} */ function onexitdefinitionlabelstring(token) { const label = this.resume() const node = this.stack[this.stack.length - 1] node.label = label node.identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase() } /** * @this {CompileContext} * @type {Handle} */ function onexitdefinitiontitlestring() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.title = data } /** * @this {CompileContext} * @type {Handle} */ function onexitdefinitiondestinationstring() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.url = data } /** * @this {CompileContext} * @type {Handle} */ function onexitatxheadingsequence(token) { const node = this.stack[this.stack.length - 1] if (!node.depth) { const depth = this.sliceSerialize(token).length node.depth = depth } } /** * @this {CompileContext} * @type {Handle} */ function onexitsetextheadingtext() { setData('setextHeadingSlurpLineEnding', true) } /** * @this {CompileContext} * @type {Handle} */ function onexitsetextheadinglinesequence(token) { const node = this.stack[this.stack.length - 1] node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 } /** * @this {CompileContext} * @type {Handle} */ function onexitsetextheading() { setData('setextHeadingSlurpLineEnding') } /** * @this {CompileContext} * @type {Handle} */ function onenterdata(token) { const node = this.stack[this.stack.length - 1] let tail = node.children[node.children.length - 1] if (!tail || tail.type !== 'text') { // Add a new text node. tail = text() // @ts-expect-error: we’ll add `end` later. tail.position = { start: lib_point(token.start) } // @ts-expect-error: Assume `parent` accepts `text`. node.children.push(tail) } this.stack.push(tail) } /** * @this {CompileContext} * @type {Handle} */ function onexitdata(token) { const tail = this.stack.pop() tail.value += this.sliceSerialize(token) tail.position.end = lib_point(token.end) } /** * @this {CompileContext} * @type {Handle} */ function onexitlineending(token) { const context = this.stack[this.stack.length - 1] // If we’re at a hard break, include the line ending in there. if (getData('atHardBreak')) { const tail = context.children[context.children.length - 1] tail.position.end = lib_point(token.end) setData('atHardBreak') return } if ( !getData('setextHeadingSlurpLineEnding') && config.canContainEols.includes(context.type) ) { onenterdata.call(this, token) onexitdata.call(this, token) } } /** * @this {CompileContext} * @type {Handle} */ function onexithardbreak() { setData('atHardBreak', true) } /** * @this {CompileContext} * @type {Handle} */ function onexithtmlflow() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.value = data } /** * @this {CompileContext} * @type {Handle} */ function onexithtmltext() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.value = data } /** * @this {CompileContext} * @type {Handle} */ function onexitcodetext() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.value = data } /** * @this {CompileContext} * @type {Handle} */ function onexitlink() { const node = this.stack[this.stack.length - 1] // Note: there are also `identifier` and `label` fields on this link node! // These are used / cleaned here. // To do: clean. if (getData('inReference')) { /** @type {ReferenceType} */ const referenceType = getData('referenceType') || 'shortcut' node.type += 'Reference' // @ts-expect-error: mutate. node.referenceType = referenceType // @ts-expect-error: mutate. delete node.url delete node.title } else { // @ts-expect-error: mutate. delete node.identifier // @ts-expect-error: mutate. delete node.label } setData('referenceType') } /** * @this {CompileContext} * @type {Handle} */ function onexitimage() { const node = this.stack[this.stack.length - 1] // Note: there are also `identifier` and `label` fields on this link node! // These are used / cleaned here. // To do: clean. if (getData('inReference')) { /** @type {ReferenceType} */ const referenceType = getData('referenceType') || 'shortcut' node.type += 'Reference' // @ts-expect-error: mutate. node.referenceType = referenceType // @ts-expect-error: mutate. delete node.url delete node.title } else { // @ts-expect-error: mutate. delete node.identifier // @ts-expect-error: mutate. delete node.label } setData('referenceType') } /** * @this {CompileContext} * @type {Handle} */ function onexitlabeltext(token) { const string = this.sliceSerialize(token) const ancestor = this.stack[this.stack.length - 2] // @ts-expect-error: stash this on the node, as it might become a reference // later. ancestor.label = decodeString(string) // @ts-expect-error: same as above. ancestor.identifier = normalizeIdentifier(string).toLowerCase() } /** * @this {CompileContext} * @type {Handle} */ function onexitlabel() { const fragment = this.stack[this.stack.length - 1] const value = this.resume() const node = this.stack[this.stack.length - 1] // Assume a reference. setData('inReference', true) if (node.type === 'link') { /** @type {Array} */ // @ts-expect-error: Assume static phrasing content. const children = fragment.children node.children = children } else { node.alt = value } } /** * @this {CompileContext} * @type {Handle} */ function onexitresourcedestinationstring() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.url = data } /** * @this {CompileContext} * @type {Handle} */ function onexitresourcetitlestring() { const data = this.resume() const node = this.stack[this.stack.length - 1] node.title = data } /** * @this {CompileContext} * @type {Handle} */ function onexitresource() { setData('inReference') } /** * @this {CompileContext} * @type {Handle} */ function onenterreference() { setData('referenceType', 'collapsed') } /** * @this {CompileContext} * @type {Handle} */ function onexitreferencestring(token) { const label = this.resume() const node = this.stack[this.stack.length - 1] // @ts-expect-error: stash this on the node, as it might become a reference // later. node.label = label // @ts-expect-error: same as above. node.identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase() setData('referenceType', 'full') } /** * @this {CompileContext} * @type {Handle} */ function onexitcharacterreferencemarker(token) { setData('characterReferenceType', token.type) } /** * @this {CompileContext} * @type {Handle} */ function onexitcharacterreferencevalue(token) { const data = this.sliceSerialize(token) const type = getData('characterReferenceType') /** @type {string} */ let value if (type) { value = decodeNumericCharacterReference( data, type === 'characterReferenceMarkerNumeric' ? 10 : 16 ) setData('characterReferenceType') } else { const result = decodeNamedCharacterReference(data) value = result } const tail = this.stack.pop() tail.value += value tail.position.end = lib_point(token.end) } /** * @this {CompileContext} * @type {Handle} */ function onexitautolinkprotocol(token) { onexitdata.call(this, token) const node = this.stack[this.stack.length - 1] node.url = this.sliceSerialize(token) } /** * @this {CompileContext} * @type {Handle} */ function onexitautolinkemail(token) { onexitdata.call(this, token) const node = this.stack[this.stack.length - 1] node.url = 'mailto:' + this.sliceSerialize(token) } // // Creaters. // /** @returns {Blockquote} */ function blockQuote() { return { type: 'blockquote', children: [] } } /** @returns {Code} */ function codeFlow() { return { type: 'code', lang: null, meta: null, value: '' } } /** @returns {InlineCode} */ function codeText() { return { type: 'inlineCode', value: '' } } /** @returns {Definition} */ function definition() { return { type: 'definition', identifier: '', label: null, title: null, url: '' } } /** @returns {Emphasis} */ function emphasis() { return { type: 'emphasis', children: [] } } /** @returns {Heading} */ function heading() { // @ts-expect-error `depth` will be set later. return { type: 'heading', depth: undefined, children: [] } } /** @returns {Break} */ function hardBreak() { return { type: 'break' } } /** @returns {HTML} */ function html() { return { type: 'html', value: '' } } /** @returns {Image} */ function image() { return { type: 'image', title: null, url: '', alt: null } } /** @returns {Link} */ function link() { return { type: 'link', title: null, url: '', children: [] } } /** * @param {Token} token * @returns {List} */ function list(token) { return { type: 'list', ordered: token.type === 'listOrdered', start: null, // @ts-expect-error Patched. spread: token._spread, children: [] } } /** * @param {Token} token * @returns {ListItem} */ function listItem(token) { return { type: 'listItem', // @ts-expect-error Patched. spread: token._spread, checked: null, children: [] } } /** @returns {Paragraph} */ function paragraph() { return { type: 'paragraph', children: [] } } /** @returns {Strong} */ function strong() { return { type: 'strong', children: [] } } /** @returns {Text} */ function text() { return { type: 'text', value: '' } } /** @returns {ThematicBreak} */ function thematicBreak() { return { type: 'thematicBreak' } } } /** * Copy a point-like value. * * @param {Point} d * Point-like value. * @returns {Point} * unist point. */ function lib_point(d) { return { line: d.line, column: d.column, offset: d.offset } } /** * @param {Config} combined * @param {Array>} extensions * @returns {void} */ function configure(combined, extensions) { let index = -1 while (++index < extensions.length) { const value = extensions[index] if (Array.isArray(value)) { configure(combined, value) } else { extension(combined, value) } } } /** * @param {Config} combined * @param {Extension} extension * @returns {void} */ function extension(combined, extension) { /** @type {keyof Extension} */ let key for (key in extension) { if (lib_own.call(extension, key)) { if (key === 'canContainEols') { const right = extension[key] if (right) { combined[key].push(...right) } } else if (key === 'transforms') { const right = extension[key] if (right) { combined[key].push(...right) } } else if (key === 'enter' || key === 'exit') { const right = extension[key] if (right) { Object.assign(combined[key], right) } } } } } /** @type {OnEnterError} */ function defaultOnError(left, right) { if (left) { throw new Error( 'Cannot close `' + left.type + '` (' + stringifyPosition({ start: left.start, end: left.end }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({ start: right.start, end: right.end }) + ') is open' ) } else { throw new Error( 'Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({ start: right.start, end: right.end }) + ') is still open' ) } } ;// CONCATENATED MODULE: ./node_modules/remark-parse/lib/index.js /** * @typedef {import('mdast').Root} Root * @typedef {import('mdast-util-from-markdown').Options} Options */ /** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */ function remarkParse(options) { /** @type {import('unified').ParserFunction} */ const parser = (doc) => { // Assume options. const settings = /** @type {Options} */ (this.data('settings')) return fromMarkdown( doc, Object.assign({}, settings, options, { // Note: these options are not in the readme. // The goal is for them to be set by plugins on `data` instead of being // passed by users. extensions: this.data('micromarkExtensions') || [], mdastExtensions: this.data('fromMarkdownExtensions') || [] }) ) } Object.assign(this, {Parser: parser}) } ;// CONCATENATED MODULE: ./node_modules/remark-parse/index.js /* harmony default export */ const remark_parse = (remarkParse); ;// CONCATENATED MODULE: ./node_modules/micromark-util-sanitize-uri/index.js /** * Make a value safe for injection as a URL. * * This encodes unsafe characters with percent-encoding and skips already * encoded sequences (see `normalizeUri` below). * Further unsafe characters are encoded as character references (see * `micromark-util-encode`). * * Then, a regex of allowed protocols can be given, in which case the URL is * sanitized. * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, * or `/^https?$/i` for `img[src]`. * If the URL includes an unknown protocol (one not matched by `protocol`, such * as a dangerous example, `javascript:`), the value is ignored. * * @param {string|undefined} url * @param {RegExp} [protocol] * @returns {string} */ function sanitizeUri(url, protocol) { const value = encode(normalizeUri(url || '')) if (!protocol) { return value } const colon = value.indexOf(':') const questionMark = value.indexOf('?') const numberSign = value.indexOf('#') const slash = value.indexOf('/') if ( // If there is no protocol, it’s relative. colon < 0 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. (slash > -1 && colon > slash) || (questionMark > -1 && colon > questionMark) || (numberSign > -1 && colon > numberSign) || // It is a protocol, it should be allowed. protocol.test(value.slice(0, colon)) ) { return value } return '' } /** * Normalize a URL (such as used in definitions). * * Encode unsafe characters with percent-encoding, skipping already encoded * sequences. * * @param {string} value * @returns {string} */ 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 = '' // A correct percent encoded value. if ( code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2)) ) { skip = 2 } // ASCII. else if (code < 128) { if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { replace = String.fromCharCode(code) } } // Astral. else if (code > 55295 && code < 57344) { const next = value.charCodeAt(index + 1) // A correct surrogate pair. if (code < 56320 && next > 56319 && next < 57344) { replace = String.fromCharCode(code, next) skip = 1 } // Lone surrogate. else { replace = '\uFFFD' } } // Unicode. 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) } ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/footer.js /** * @typedef {import('hast').Element} Element * @typedef {import('hast').ElementContent} ElementContent * * @typedef {import('./state.js').State} State */ /** * Generate a hast footer for called footnote definitions. * * @param {State} state * Info passed around. * @returns {Element | undefined} * `section` element or `undefined`. */ function footer(state) { /** @type {Array} */ const listItems = [] let index = -1 while (++index < state.footnoteOrder.length) { const def = state.footnoteById[state.footnoteOrder[index]] if (!def) { continue } const content = state.all(def) const id = String(def.identifier).toUpperCase() const safeId = normalizeUri(id.toLowerCase()) let referenceIndex = 0 /** @type {Array} */ const backReferences = [] while (++referenceIndex <= state.footnoteCounts[id]) { /** @type {Element} */ const backReference = { type: 'element', tagName: 'a', properties: { href: '#' + state.clobberPrefix + 'fnref-' + safeId + (referenceIndex > 1 ? '-' + referenceIndex : ''), dataFootnoteBackref: true, className: ['data-footnote-backref'], ariaLabel: state.footnoteBackLabel }, children: [{type: 'text', value: '↩'}] } if (referenceIndex > 1) { backReference.children.push({ type: 'element', tagName: 'sup', children: [{type: 'text', value: String(referenceIndex)}] }) } if (backReferences.length > 0) { backReferences.push({type: 'text', value: ' '}) } backReferences.push(backReference) } const tail = content[content.length - 1] if (tail && tail.type === 'element' && tail.tagName === 'p') { const tailTail = tail.children[tail.children.length - 1] if (tailTail && tailTail.type === 'text') { tailTail.value += ' ' } else { tail.children.push({type: 'text', value: ' '}) } tail.children.push(...backReferences) } else { content.push(...backReferences) } /** @type {Element} */ const listItem = { type: 'element', tagName: 'li', properties: {id: state.clobberPrefix + 'fn-' + safeId}, children: state.wrap(content, true) } state.patch(def, listItem) listItems.push(listItem) } if (listItems.length === 0) { return } return { type: 'element', tagName: 'section', properties: {dataFootnotes: true, className: ['footnotes']}, children: [ { type: 'element', tagName: state.footnoteLabelTagName, properties: { // To do: use structured clone. ...JSON.parse(JSON.stringify(state.footnoteLabelProperties)), id: 'footnote-label' }, children: [{type: 'text', value: state.footnoteLabel}] }, {type: 'text', value: '\n'}, { type: 'element', tagName: 'ol', properties: {}, children: state.wrap(listItems, true) }, {type: 'text', value: '\n'} ] } } ;// CONCATENATED MODULE: ./node_modules/unist-util-is/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Parent} Parent */ /** * @typedef {Record} Props * @typedef {null | undefined | string | Props | TestFunctionAnything | Array} Test * Check for an arbitrary node, unaware of TypeScript inferral. * * @callback TestFunctionAnything * Check if a node passes a test, unaware of TypeScript inferral. * @param {unknown} this * The given context. * @param {Node} node * A node. * @param {number | null | undefined} [index] * The node’s position in its parent. * @param {Parent | null | undefined} [parent] * The node’s parent. * @returns {boolean | void} * Whether this node passes the test. */ /** * @template {Node} Kind * Node type. * @typedef {Kind['type'] | Partial | TestFunctionPredicate | Array | TestFunctionPredicate>} PredicateTest * Check for a node that can be inferred by TypeScript. */ /** * Check if a node passes a certain test. * * @template {Node} Kind * Node type. * @callback TestFunctionPredicate * Complex test function for a node that can be inferred by TypeScript. * @param {Node} node * A node. * @param {number | null | undefined} [index] * The node’s position in its parent. * @param {Parent | null | undefined} [parent] * The node’s parent. * @returns {node is Kind} * Whether this node passes the test. */ /** * @callback AssertAnything * Check that an arbitrary value is a node, unaware of TypeScript inferral. * @param {unknown} [node] * Anything (typically a node). * @param {number | null | undefined} [index] * The node’s position in its parent. * @param {Parent | null | undefined} [parent] * The node’s parent. * @returns {boolean} * Whether this is a node and passes a test. */ /** * Check if a node is a node and passes a certain node test. * * @template {Node} Kind * Node type. * @callback AssertPredicate * Check that an arbitrary value is a specific node, aware of TypeScript. * @param {unknown} [node] * Anything (typically a node). * @param {number | null | undefined} [index] * The node’s position in its parent. * @param {Parent | null | undefined} [parent] * The node’s parent. * @returns {node is Kind} * Whether this is a node and passes a test. */ /** * Check if `node` is a `Node` and whether it passes the given test. * * @param node * Thing to check, typically `Node`. * @param test * A check for a specific node. * @param index * The node’s position in its parent. * @param parent * The node’s parent. * @returns * Whether `node` is a node and passes a test. */ const is = /** * @type {( * (() => false) & * ((node: unknown, test: PredicateTest, index: number, parent: Parent, context?: unknown) => node is Kind) & * ((node: unknown, test: PredicateTest, index?: null | undefined, parent?: null | undefined, context?: unknown) => node is Kind) & * ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) & * ((node: unknown, test?: Test, index?: null | undefined, parent?: null | undefined, context?: unknown) => boolean) * )} */ ( /** * @param {unknown} [node] * @param {Test} [test] * @param {number | null | undefined} [index] * @param {Parent | null | undefined} [parent] * @param {unknown} [context] * @returns {boolean} */ // eslint-disable-next-line max-params function is(node, test, index, parent, context) { const check = convert(test) if ( index !== undefined && index !== null && (typeof index !== 'number' || index < 0 || index === Number.POSITIVE_INFINITY) ) { throw new Error('Expected positive finite index') } if ( parent !== undefined && parent !== null && (!is(parent) || !parent.children) ) { throw new Error('Expected parent node') } if ( (parent === undefined || parent === null) !== (index === undefined || index === null) ) { throw new Error('Expected both parent and index') } // @ts-expect-error Looks like a node. return node && node.type && typeof node.type === 'string' ? Boolean(check.call(context, node, index, parent)) : false } ) /** * Generate an assertion from a test. * * Useful if you’re going to test many nodes, for example when creating a * utility where something else passes a compatible test. * * The created function is a bit faster because it expects valid input only: * a `node`, `index`, and `parent`. * * @param test * * when nullish, checks if `node` is a `Node`. * * when `string`, works like passing `(node) => node.type === test`. * * when `function` checks if function passed the node is true. * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values. * * when `array`, checks if any one of the subtests pass. * @returns * An assertion. */ const convert = /** * @type {( * ((test: PredicateTest) => AssertPredicate) & * ((test?: Test) => AssertAnything) * )} */ ( /** * @param {Test} [test] * @returns {AssertAnything} */ function (test) { if (test === undefined || test === null) { return ok } if (typeof test === 'string') { return typeFactory(test) } if (typeof test === 'object') { return Array.isArray(test) ? anyFactory(test) : propsFactory(test) } if (typeof test === 'function') { return castFactory(test) } throw new Error('Expected function, string, or object as test') } ) /** * @param {Array} tests * @returns {AssertAnything} */ function anyFactory(tests) { /** @type {Array} */ const checks = [] let index = -1 while (++index < tests.length) { checks[index] = convert(tests[index]) } return castFactory(any) /** * @this {unknown} * @param {Array} parameters * @returns {boolean} */ function any(...parameters) { let index = -1 while (++index < checks.length) { if (checks[index].call(this, ...parameters)) return true } return false } } /** * Turn an object into a test for a node with a certain fields. * * @param {Props} check * @returns {AssertAnything} */ function propsFactory(check) { return castFactory(all) /** * @param {Node} node * @returns {boolean} */ function all(node) { /** @type {string} */ let key for (key in check) { // @ts-expect-error: hush, it sure works as an index. if (node[key] !== check[key]) return false } return true } } /** * Turn a string into a test for a node with a certain type. * * @param {string} check * @returns {AssertAnything} */ function typeFactory(check) { return castFactory(type) /** * @param {Node} node */ function type(node) { return node && node.type === check } } /** * Turn a custom test into a test for a node that passes that test. * * @param {TestFunctionAnything} check * @returns {AssertAnything} */ function castFactory(check) { return assertion /** * @this {unknown} * @param {unknown} node * @param {Array} parameters * @returns {boolean} */ function assertion(node, ...parameters) { return Boolean( node && typeof node === 'object' && 'type' in node && // @ts-expect-error: fine. Boolean(check.call(this, node, ...parameters)) ) } } function ok() { return true } ;// CONCATENATED MODULE: ./node_modules/unist-util-visit-parents/lib/color.browser.js /** * @param {string} d * @returns {string} */ function color(d) { return d } ;// CONCATENATED MODULE: ./node_modules/unist-util-visit-parents/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Parent} Parent * @typedef {import('unist-util-is').Test} Test */ /** * @typedef {boolean | 'skip'} Action * Union of the action types. * * @typedef {number} Index * Move to the sibling at `index` next (after node itself is completely * traversed). * * Useful if mutating the tree, such as removing the node the visitor is * currently on, or any of its previous siblings. * Results less than 0 or greater than or equal to `children.length` stop * traversing the parent. * * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple * List with one or two values, the first an action, the second an index. * * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult * Any value that can be returned from a visitor. */ /** * @template {Node} [Visited=Node] * Visited node type. * @template {Parent} [Ancestor=Parent] * Ancestor type. * @callback Visitor * Handle a node (matching `test`, if given). * * Visitors are free to transform `node`. * They can also transform the parent of node (the last of `ancestors`). * * Replacing `node` itself, if `SKIP` is not returned, still causes its * descendants to be walked (which is a bug). * * When adding or removing previous siblings of `node` (or next siblings, in * case of reverse), the `Visitor` should return a new `Index` to specify the * sibling to traverse after `node` is traversed. * Adding or removing next siblings of `node` (or previous siblings, in case * of reverse) is handled as expected without needing to return a new `Index`. * * Removing the children property of an ancestor still results in them being * traversed. * @param {Visited} node * Found node. * @param {Array} ancestors * Ancestors of `node`. * @returns {VisitorResult} * What to do next. * * An `Index` is treated as a tuple of `[CONTINUE, Index]`. * An `Action` is treated as a tuple of `[Action]`. * * Passing a tuple back only makes sense if the `Action` is `SKIP`. * When the `Action` is `EXIT`, that action can be returned. * When the `Action` is `CONTINUE`, `Index` can be returned. */ /** * @template {Node} [Tree=Node] * Tree type. * @template {Test} [Check=string] * Test type. * @typedef {Visitor, Check>, Extract, Parent>>} BuildVisitor * Build a typed `Visitor` function from a tree and a test. * * It will infer which values are passed as `node` and which as `parents`. */ /** * Continue traversing as normal. */ const CONTINUE = true /** * Stop traversing immediately. */ const EXIT = false /** * Do not traverse this node’s children. */ const SKIP = 'skip' /** * Visit nodes, with ancestral information. * * This algorithm performs *depth-first* *tree traversal* in *preorder* * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**). * * You can choose for which nodes `visitor` is called by passing a `test`. * For complex tests, you should test yourself in `visitor`, as it will be * faster and will have improved type information. * * Walking the tree is an intensive task. * Make use of the return values of the visitor when possible. * Instead of walking a tree multiple times, walk it once, use `unist-util-is` * to check if a node matches, and then perform different operations. * * You can change the tree. * See `Visitor` for more info. * * @param tree * Tree to traverse. * @param test * `unist-util-is`-compatible test * @param visitor * Handle each node. * @param reverse * Traverse in reverse preorder (NRL) instead of the default preorder (NLR). * @returns * Nothing. */ const visitParents = /** * @type {( * ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) & * ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) * )} */ ( /** * @param {Node} tree * @param {Test} test * @param {Visitor} visitor * @param {boolean | null | undefined} [reverse] * @returns {void} */ function (tree, test, visitor, reverse) { if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor // @ts-expect-error no visitor given, so `visitor` is test. visitor = test test = null } const is = convert(test) const step = reverse ? -1 : 1 factory(tree, undefined, [])() /** * @param {Node} node * @param {number | undefined} index * @param {Array} parents */ function factory(node, index, parents) { /** @type {Record} */ // @ts-expect-error: hush const value = node && typeof node === 'object' ? node : {} if (typeof value.type === 'string') { const name = // `hast` typeof value.tagName === 'string' ? value.tagName : // `xast` typeof value.name === 'string' ? value.name : undefined Object.defineProperty(visit, 'name', { value: 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')' }) } return visit function visit() { /** @type {ActionTuple} */ let result = [] /** @type {ActionTuple} */ let subresult /** @type {number} */ let offset /** @type {Array} */ let grandparents if (!test || is(node, index, parents[parents.length - 1] || null)) { result = toResult(visitor(node, parents)) if (result[0] === EXIT) { return result } } // @ts-expect-error looks like a parent. if (node.children && result[0] !== SKIP) { // @ts-expect-error looks like a parent. offset = (reverse ? node.children.length : -1) + step // @ts-expect-error looks like a parent. grandparents = parents.concat(node) // @ts-expect-error looks like a parent. while (offset > -1 && offset < node.children.length) { // @ts-expect-error looks like a parent. subresult = factory(node.children[offset], offset, grandparents)() if (subresult[0] === EXIT) { return subresult } offset = typeof subresult[1] === 'number' ? subresult[1] : offset + step } } return result } } } ) /** * Turn a return value into a clean result. * * @param {VisitorResult} value * Valid return values from visitors. * @returns {ActionTuple} * Clean result. */ function toResult(value) { if (Array.isArray(value)) { return value } if (typeof value === 'number') { return [CONTINUE, value] } return [value] } ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/lib/index.js /** * @typedef {import('unist').Node} Node * @typedef {import('unist').Parent} Parent * @typedef {import('unist-util-is').Test} Test * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult */ /** * Check if `Child` can be a child of `Ancestor`. * * Returns the ancestor when `Child` can be a child of `Ancestor`, or returns * `never`. * * @template {Node} Ancestor * Node type. * @template {Node} Child * Node type. * @typedef {( * Ancestor extends Parent * ? Child extends Ancestor['children'][number] * ? Ancestor * : never * : never * )} ParentsOf */ /** * @template {Node} [Visited=Node] * Visited node type. * @template {Parent} [Ancestor=Parent] * Ancestor type. * @callback Visitor * Handle a node (matching `test`, if given). * * Visitors are free to transform `node`. * They can also transform `parent`. * * Replacing `node` itself, if `SKIP` is not returned, still causes its * descendants to be walked (which is a bug). * * When adding or removing previous siblings of `node` (or next siblings, in * case of reverse), the `Visitor` should return a new `Index` to specify the * sibling to traverse after `node` is traversed. * Adding or removing next siblings of `node` (or previous siblings, in case * of reverse) is handled as expected without needing to return a new `Index`. * * Removing the children property of `parent` still results in them being * traversed. * @param {Visited} node * Found node. * @param {Visited extends Node ? number | null : never} index * Index of `node` in `parent`. * @param {Ancestor extends Node ? Ancestor | null : never} parent * Parent of `node`. * @returns {VisitorResult} * What to do next. * * An `Index` is treated as a tuple of `[CONTINUE, Index]`. * An `Action` is treated as a tuple of `[Action]`. * * Passing a tuple back only makes sense if the `Action` is `SKIP`. * When the `Action` is `EXIT`, that action can be returned. * When the `Action` is `CONTINUE`, `Index` can be returned. */ /** * Build a typed `Visitor` function from a node and all possible parents. * * It will infer which values are passed as `node` and which as `parent`. * * @template {Node} Visited * Node type. * @template {Parent} Ancestor * Parent type. * @typedef {Visitor>} BuildVisitorFromMatch */ /** * Build a typed `Visitor` function from a list of descendants and a test. * * It will infer which values are passed as `node` and which as `parent`. * * @template {Node} Descendant * Node type. * @template {Test} Check * Test type. * @typedef {( * BuildVisitorFromMatch< * import('unist-util-visit-parents/complex-types.js').Matches, * Extract * > * )} BuildVisitorFromDescendants */ /** * Build a typed `Visitor` function from a tree and a test. * * It will infer which values are passed as `node` and which as `parent`. * * @template {Node} [Tree=Node] * Node type. * @template {Test} [Check=string] * Test type. * @typedef {( * BuildVisitorFromDescendants< * import('unist-util-visit-parents/complex-types.js').InclusiveDescendant, * Check * > * )} BuildVisitor */ /** * Visit nodes. * * This algorithm performs *depth-first* *tree traversal* in *preorder* * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**). * * You can choose for which nodes `visitor` is called by passing a `test`. * For complex tests, you should test yourself in `visitor`, as it will be * faster and will have improved type information. * * Walking the tree is an intensive task. * Make use of the return values of the visitor when possible. * Instead of walking a tree multiple times, walk it once, use `unist-util-is` * to check if a node matches, and then perform different operations. * * You can change the tree. * See `Visitor` for more info. * * @param tree * Tree to traverse. * @param test * `unist-util-is`-compatible test * @param visitor * Handle each node. * @param reverse * Traverse in reverse preorder (NRL) instead of the default preorder (NLR). * @returns * Nothing. */ const visit = /** * @type {( * ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) & * ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) * )} */ ( /** * @param {Node} tree * @param {Test} test * @param {Visitor} visitor * @param {boolean | null | undefined} [reverse] * @returns {void} */ function (tree, test, visitor, reverse) { if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor visitor = test test = null } visitParents(tree, test, overload, reverse) /** * @param {Node} node * @param {Array} parents */ function overload(node, parents) { const parent = parents[parents.length - 1] return visitor( node, parent ? parent.children.indexOf(node) : null, parent ) } } ) ;// CONCATENATED MODULE: ./node_modules/unist-util-position/lib/index.js /** * @typedef {import('unist').Position} Position * @typedef {import('unist').Node} Node * @typedef {import('unist').Point} Point */ /** * @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 starting point of `node`. * * @param node * Node. * @returns * Point. */ const pointStart = unist_util_position_lib_point('start') /** * Get the ending point of `node`. * * @param node * Node. * @returns * Point. */ const pointEnd = unist_util_position_lib_point('end') /** * Get the positional info of `node`. * * @param {NodeLike | Node | null | undefined} [node] * Node. * @returns {Position} * Position. */ function lib_position(node) { return {start: pointStart(node), end: pointEnd(node)} } /** * Get the positional info of `node`. * * @param {'start' | 'end'} type * Side. * @returns * Getter. */ function unist_util_position_lib_point(type) { return point /** * Get the point info of `node` at a bound side. * * @param {NodeLike | Node | null | undefined} [node] * @returns {Point} */ function point(node) { const point = (node && node.position && node.position[type]) || {} // To do: next major: don’t return points when invalid. return { // @ts-expect-error: in practice, null is allowed. line: point.line || null, // @ts-expect-error: in practice, null is allowed. column: point.column || null, // @ts-expect-error: in practice, null is allowed. offset: point.offset > -1 ? point.offset : null } } } ;// CONCATENATED MODULE: ./node_modules/unist-util-generated/lib/index.js /** * @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] * * @typedef NodeLike * @property {PositionLike | null | undefined} [position] */ /** * Check if `node` is generated. * * @param {NodeLike | null | undefined} [node] * Node to check. * @returns {boolean} * Whether `node` is generated (does not have positional info). */ function generated(node) { return ( !node || !node.position || !node.position.start || !node.position.start.line || !node.position.start.column || !node.position.end || !node.position.end.line || !node.position.end.column ) } ;// CONCATENATED MODULE: ./node_modules/mdast-util-definitions/lib/index.js /** * @typedef {import('mdast').Root} Root * @typedef {import('mdast').Content} Content * @typedef {import('mdast').Definition} Definition */ /** * @typedef {Root | Content} Node * * @callback GetDefinition * Get a definition by identifier. * @param {string | null | undefined} [identifier] * Identifier of definition. * @returns {Definition | null} * Definition corresponding to `identifier` or `null`. */ const mdast_util_definitions_lib_own = {}.hasOwnProperty /** * Find definitions in `tree`. * * Uses CommonMark precedence, which means that earlier definitions are * preferred over duplicate later definitions. * * @param {Node} tree * Tree to check. * @returns {GetDefinition} * Getter. */ function definitions(tree) { /** @type {Record} */ const cache = Object.create(null) if (!tree || !tree.type) { throw new Error('mdast-util-definitions expected node') } visit(tree, 'definition', (definition) => { const id = clean(definition.identifier) if (id && !mdast_util_definitions_lib_own.call(cache, id)) { cache[id] = definition } }) return definition /** @type {GetDefinition} */ function definition(identifier) { const id = clean(identifier) // To do: next major: return `undefined` when not found. return id && mdast_util_definitions_lib_own.call(cache, id) ? cache[id] : null } } /** * @param {string | null | undefined} [value] * @returns {string} */ function clean(value) { return String(value || '').toUpperCase() } ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/blockquote.js /** * @typedef {import('hast').Element} Element * @typedef {import('mdast').Blockquote} Blockquote * @typedef {import('../state.js').State} State */ /** * Turn an mdast `blockquote` node into hast. * * @param {State} state * Info passed around. * @param {Blockquote} node * mdast node. * @returns {Element} * hast node. */ function blockquote(state, node) { /** @type {Element} */ const result = { type: 'element', tagName: 'blockquote', properties: {}, children: state.wrap(state.all(node), true) } state.patch(node, result) return state.applyData(node, result) } ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/break.js /** * @typedef {import('hast').Element} Element * @typedef {import('hast').Text} Text * @typedef {import('mdast').Break} Break * @typedef {import('../state.js').State} State */ /** * Turn an mdast `break` node into hast. * * @param {State} state * Info passed around. * @param {Break} node * mdast node. * @returns {Array} * hast element content. */ function hardBreak(state, node) { /** @type {Element} */ const result = {type: 'element', tagName: 'br', properties: {}, children: []} state.patch(node, result) return [state.applyData(node, result), {type: 'text', value: '\n'}] } ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/code.js /** * @typedef {import('hast').Element} Element * @typedef {import('hast').Properties} Properties * @typedef {import('mdast').Code} Code * @typedef {import('../state.js').State} State */ /** * Turn an mdast `code` node into hast. * * @param {State} state * Info passed around. * @param {Code} node * mdast node. * @returns {Element} * hast node. */ function code(state, node) { const value = node.value ? node.value + '\n' : '' // To do: next major, use `node.lang` w/o regex, the splitting’s been going // on for years in remark now. const lang = node.lang ? node.lang.match(/^[^ \t]+(?=[ \t]|$)/) : null /** @type {Properties} */ const properties = {} if (lang) { properties.className = ['language-' + lang] } // Create ``. /** @type {Element} */ let result = { type: 'element', tagName: 'code', properties, children: [{type: 'text', value}] } if (node.meta) { result.data = {meta: node.meta} } state.patch(node, result) result = state.applyData(node, result) // Create `
`.
  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}
  state.patch(node, result)
  return result
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/delete.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Delete} Delete
 * @typedef {import('../state.js').State} State

 */

/**
 * Turn an mdast `delete` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Delete} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function strikethrough(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'del',
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Emphasis} Emphasis
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `emphasis` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Emphasis} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function emphasis(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'em',
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
/**
 * @typedef {import('mdast').FootnoteReference} FootnoteReference
 * @typedef {import('hast').Element} Element
 * @typedef {import('../state.js').State} State
 */



/**
 * Turn an mdast `footnoteReference` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {FootnoteReference} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function footnoteReference(state, node) {
  const id = String(node.identifier).toUpperCase()
  const safeId = normalizeUri(id.toLowerCase())
  const index = state.footnoteOrder.indexOf(id)
  /** @type {number} */
  let counter

  if (index === -1) {
    state.footnoteOrder.push(id)
    state.footnoteCounts[id] = 1
    counter = state.footnoteOrder.length
  } else {
    state.footnoteCounts[id]++
    counter = index + 1
  }

  const reuseCounter = state.footnoteCounts[id]

  /** @type {Element} */
  const link = {
    type: 'element',
    tagName: 'a',
    properties: {
      href: '#' + state.clobberPrefix + 'fn-' + safeId,
      id:
        state.clobberPrefix +
        'fnref-' +
        safeId +
        (reuseCounter > 1 ? '-' + reuseCounter : ''),
      dataFootnoteRef: true,
      ariaDescribedBy: ['footnote-label']
    },
    children: [{type: 'text', value: String(counter)}]
  }
  state.patch(node, link)

  /** @type {Element} */
  const sup = {
    type: 'element',
    tagName: 'sup',
    properties: {},
    children: [link]
  }
  state.patch(node, sup)
  return state.applyData(node, sup)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/footnote.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Footnote} Footnote
 * @typedef {import('../state.js').State} State
 */



// To do: when both:
// * 
// * 
// …are archived, remove this (also from mdast).
// These inline notes are not used in GFM.

/**
 * Turn an mdast `footnote` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Footnote} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function footnote(state, node) {
  const footnoteById = state.footnoteById
  let no = 1

  while (no in footnoteById) no++

  const identifier = String(no)

  footnoteById[identifier] = {
    type: 'footnoteDefinition',
    identifier,
    children: [{type: 'paragraph', children: node.children}],
    position: node.position
  }

  return footnoteReference(state, {
    type: 'footnoteReference',
    identifier,
    position: node.position
  })
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/heading.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Heading} Heading
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `heading` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Heading} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function heading(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'h' + node.depth,
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/html.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').HTML} Html
 * @typedef {import('../state.js').State} State
 * @typedef {import('../../index.js').Raw} Raw
 */

/**
 * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
 * nothing).
 *
 * @param {State} state
 *   Info passed around.
 * @param {Html} node
 *   mdast node.
 * @returns {Raw | Element | null}
 *   hast node.
 */
function html(state, node) {
  if (state.dangerous) {
    /** @type {Raw} */
    const result = {type: 'raw', value: node.value}
    state.patch(node, result)
    return state.applyData(node, result)
  }

  // To do: next major: return `undefined`.
  return null
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/revert.js
/**
 * @typedef {import('hast').ElementContent} ElementContent
 *
 * @typedef {import('mdast').Content} Content
 * @typedef {import('mdast').Reference} Reference
 * @typedef {import('mdast').Root} Root
 *
 * @typedef {import('./state.js').State} State
 */

/**
 * @typedef {Root | Content} Nodes
 * @typedef {Extract} References
 */

// To do: next major: always return array.

/**
 * Return the content of a reference without definition as plain text.
 *
 * @param {State} state
 *   Info passed around.
 * @param {References} node
 *   Reference node (image, link).
 * @returns {ElementContent | Array}
 *   hast content.
 */
function revert(state, node) {
  const subtype = node.referenceType
  let suffix = ']'

  if (subtype === 'collapsed') {
    suffix += '[]'
  } else if (subtype === 'full') {
    suffix += '[' + (node.label || node.identifier) + ']'
  }

  if (node.type === 'imageReference') {
    return {type: 'text', value: '![' + node.alt + suffix}
  }

  const contents = state.all(node)
  const head = contents[0]

  if (head && head.type === 'text') {
    head.value = '[' + head.value
  } else {
    contents.unshift({type: 'text', value: '['})
  }

  const tail = contents[contents.length - 1]

  if (tail && tail.type === 'text') {
    tail.value += suffix
  } else {
    contents.push({type: 'text', value: suffix})
  }

  return contents
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
/**
 * @typedef {import('hast').ElementContent} ElementContent
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').ImageReference} ImageReference
 * @typedef {import('../state.js').State} State
 */




/**
 * Turn an mdast `imageReference` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {ImageReference} node
 *   mdast node.
 * @returns {ElementContent | Array}
 *   hast node.
 */
function imageReference(state, node) {
  const def = state.definition(node.identifier)

  if (!def) {
    return revert(state, node)
  }

  /** @type {Properties} */
  const properties = {src: normalizeUri(def.url || ''), alt: node.alt}

  if (def.title !== null && def.title !== undefined) {
    properties.title = def.title
  }

  /** @type {Element} */
  const result = {type: 'element', tagName: 'img', properties, children: []}
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/image.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').Image} Image
 * @typedef {import('../state.js').State} State
 */



/**
 * Turn an mdast `image` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Image} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function image_image(state, node) {
  /** @type {Properties} */
  const properties = {src: normalizeUri(node.url)}

  if (node.alt !== null && node.alt !== undefined) {
    properties.alt = node.alt
  }

  if (node.title !== null && node.title !== undefined) {
    properties.title = node.title
  }

  /** @type {Element} */
  const result = {type: 'element', tagName: 'img', properties, children: []}
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').Text} Text
 * @typedef {import('mdast').InlineCode} InlineCode
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `inlineCode` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {InlineCode} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function inlineCode(state, node) {
  /** @type {Text} */
  const text = {type: 'text', value: node.value.replace(/\r?\n|\r/g, ' ')}
  state.patch(node, text)

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'code',
    properties: {},
    children: [text]
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').ElementContent} ElementContent
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').LinkReference} LinkReference
 * @typedef {import('../state.js').State} State
 */




/**
 * Turn an mdast `linkReference` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {LinkReference} node
 *   mdast node.
 * @returns {ElementContent | Array}
 *   hast node.
 */
function linkReference(state, node) {
  const def = state.definition(node.identifier)

  if (!def) {
    return revert(state, node)
  }

  /** @type {Properties} */
  const properties = {href: normalizeUri(def.url || '')}

  if (def.title !== null && def.title !== undefined) {
    properties.title = def.title
  }

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'a',
    properties,
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/link.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').Link} Link
 * @typedef {import('../state.js').State} State
 */



/**
 * Turn an mdast `link` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Link} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function link_link(state, node) {
  /** @type {Properties} */
  const properties = {href: normalizeUri(node.url)}

  if (node.title !== null && node.title !== undefined) {
    properties.title = node.title
  }

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'a',
    properties,
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/list-item.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').ElementContent} ElementContent
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').Content} Content
 * @typedef {import('mdast').ListItem} ListItem
 * @typedef {import('mdast').Parent} Parent
 * @typedef {import('mdast').Root} Root
 * @typedef {import('../state.js').State} State
 */

/**
 * @typedef {Root | Content} Nodes
 * @typedef {Extract} Parents
 */

/**
 * Turn an mdast `listItem` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {ListItem} node
 *   mdast node.
 * @param {Parents | null | undefined} parent
 *   Parent of `node`.
 * @returns {Element}
 *   hast node.
 */
function listItem(state, node, parent) {
  const results = state.all(node)
  const loose = parent ? listLoose(parent) : listItemLoose(node)
  /** @type {Properties} */
  const properties = {}
  /** @type {Array} */
  const children = []

  if (typeof node.checked === 'boolean') {
    const head = results[0]
    /** @type {Element} */
    let paragraph

    if (head && head.type === 'element' && head.tagName === 'p') {
      paragraph = head
    } else {
      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}
      results.unshift(paragraph)
    }

    if (paragraph.children.length > 0) {
      paragraph.children.unshift({type: 'text', value: ' '})
    }

    paragraph.children.unshift({
      type: 'element',
      tagName: 'input',
      properties: {type: 'checkbox', checked: node.checked, disabled: true},
      children: []
    })

    // According to github-markdown-css, this class hides bullet.
    // See: .
    properties.className = ['task-list-item']
  }

  let index = -1

  while (++index < results.length) {
    const child = results[index]

    // Add eols before nodes, except if this is a loose, first paragraph.
    if (
      loose ||
      index !== 0 ||
      child.type !== 'element' ||
      child.tagName !== 'p'
    ) {
      children.push({type: 'text', value: '\n'})
    }

    if (child.type === 'element' && child.tagName === 'p' && !loose) {
      children.push(...child.children)
    } else {
      children.push(child)
    }
  }

  const tail = results[results.length - 1]

  // Add a final eol.
  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {
    children.push({type: 'text', value: '\n'})
  }

  /** @type {Element} */
  const result = {type: 'element', tagName: 'li', properties, children}
  state.patch(node, result)
  return state.applyData(node, result)
}

/**
 * @param {Parents} node
 * @return {Boolean}
 */
function listLoose(node) {
  let loose = false
  if (node.type === 'list') {
    loose = node.spread || false
    const children = node.children
    let index = -1

    while (!loose && ++index < children.length) {
      loose = listItemLoose(children[index])
    }
  }

  return loose
}

/**
 * @param {ListItem} node
 * @return {Boolean}
 */
function listItemLoose(node) {
  const spread = node.spread

  return spread === undefined || spread === null
    ? node.children.length > 1
    : spread
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/list.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('mdast').List} List
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `list` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {List} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function list_list(state, node) {
  /** @type {Properties} */
  const properties = {}
  const results = state.all(node)
  let index = -1

  if (typeof node.start === 'number' && node.start !== 1) {
    properties.start = node.start
  }

  // Like GitHub, add a class for custom styling.
  while (++index < results.length) {
    const child = results[index]

    if (
      child.type === 'element' &&
      child.tagName === 'li' &&
      child.properties &&
      Array.isArray(child.properties.className) &&
      child.properties.className.includes('task-list-item')
    ) {
      properties.className = ['contains-task-list']
      break
    }
  }

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: node.ordered ? 'ol' : 'ul',
    properties,
    children: state.wrap(results, true)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Paragraph} Paragraph
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `paragraph` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Paragraph} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function paragraph(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'p',
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/root.js
/**
 * @typedef {import('hast').Root} HastRoot
 * @typedef {import('hast').Element} HastElement
 * @typedef {import('mdast').Root} MdastRoot
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `root` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdastRoot} node
 *   mdast node.
 * @returns {HastRoot | HastElement}
 *   hast node.
 */
function root(state, node) {
  /** @type {HastRoot} */
  const result = {type: 'root', children: state.wrap(state.all(node))}
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/strong.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Strong} Strong
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `strong` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Strong} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function strong(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'strong',
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/table.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').Table} Table
 * @typedef {import('../state.js').State} State
 */



/**
 * Turn an mdast `table` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Table} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function table(state, node) {
  const rows = state.all(node)
  const firstRow = rows.shift()
  /** @type {Array} */
  const tableContent = []

  if (firstRow) {
    /** @type {Element} */
    const head = {
      type: 'element',
      tagName: 'thead',
      properties: {},
      children: state.wrap([firstRow], true)
    }
    state.patch(node.children[0], head)
    tableContent.push(head)
  }

  if (rows.length > 0) {
    /** @type {Element} */
    const body = {
      type: 'element',
      tagName: 'tbody',
      properties: {},
      children: state.wrap(rows, true)
    }

    const start = pointStart(node.children[1])
    const end = pointEnd(node.children[node.children.length - 1])
    if (start.line && end.line) body.position = {start, end}
    tableContent.push(body)
  }

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'table',
    properties: {},
    children: state.wrap(tableContent, true)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/table-row.js
/**
 * @typedef {import('hast').Properties} Properties
 * @typedef {import('hast').Element} Element
 * @typedef {import('hast').ElementContent} ElementContent
 * @typedef {import('mdast').Content} Content
 * @typedef {import('mdast').Parent} Parent
 * @typedef {import('mdast').Root} Root
 * @typedef {import('mdast').TableRow} TableRow
 * @typedef {import('../state.js').State} State
 */

/**
 * @typedef {Root | Content} Nodes
 * @typedef {Extract} Parents
 */

/**
 * Turn an mdast `tableRow` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {TableRow} node
 *   mdast node.
 * @param {Parents | null | undefined} parent
 *   Parent of `node`.
 * @returns {Element}
 *   hast node.
 */
function tableRow(state, node, parent) {
  const siblings = parent ? parent.children : undefined
  // Generate a body row when without parent.
  const rowIndex = siblings ? siblings.indexOf(node) : 1
  const tagName = rowIndex === 0 ? 'th' : 'td'
  const align = parent && parent.type === 'table' ? parent.align : undefined
  const length = align ? align.length : node.children.length
  let cellIndex = -1
  /** @type {Array} */
  const cells = []

  while (++cellIndex < length) {
    // Note: can also be undefined.
    const cell = node.children[cellIndex]
    /** @type {Properties} */
    const properties = {}
    const alignValue = align ? align[cellIndex] : undefined

    if (alignValue) {
      properties.align = alignValue
    }

    /** @type {Element} */
    let result = {type: 'element', tagName, properties, children: []}

    if (cell) {
      result.children = state.all(cell)
      state.patch(cell, result)
      result = state.applyData(node, result)
    }

    cells.push(result)
  }

  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'tr',
    properties: {},
    children: state.wrap(cells, true)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').TableCell} TableCell
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `tableCell` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {TableCell} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function tableCell(state, node) {
  // Note: this function is normally not called: see `table-row` for how rows
  // and their cells are compiled.
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'td', // Assume body cell.
    properties: {},
    children: state.all(node)
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/trim-lines/index.js
const tab = 9 /* `\t` */
const space = 32 /* ` ` */

/**
 * Remove initial and final spaces and tabs at the line breaks in `value`.
 * Does not trim initial and final spaces and tabs of the value itself.
 *
 * @param {string} value
 *   Value to trim.
 * @returns {string}
 *   Trimmed value.
 */
function trimLines(value) {
  const source = String(value)
  const search = /\r?\n|\r/g
  let match = search.exec(source)
  let last = 0
  /** @type {Array} */
  const lines = []

  while (match) {
    lines.push(
      trimLine(source.slice(last, match.index), last > 0, true),
      match[0]
    )

    last = match.index + match[0].length
    match = search.exec(source)
  }

  lines.push(trimLine(source.slice(last), last > 0, false))

  return lines.join('')
}

/**
 * @param {string} value
 *   Line to trim.
 * @param {boolean} start
 *   Whether to trim the start of the line.
 * @param {boolean} end
 *   Whether to trim the end of the line.
 * @returns {string}
 *   Trimmed line.
 */
function trimLine(value, start, end) {
  let startIndex = 0
  let endIndex = value.length

  if (start) {
    let code = value.codePointAt(startIndex)

    while (code === tab || code === space) {
      startIndex++
      code = value.codePointAt(startIndex)
    }
  }

  if (end) {
    let code = value.codePointAt(endIndex - 1)

    while (code === tab || code === space) {
      endIndex--
      code = value.codePointAt(endIndex - 1)
    }
  }

  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/text.js
/**
 * @typedef {import('hast').Element} HastElement
 * @typedef {import('hast').Text} HastText
 * @typedef {import('mdast').Text} MdastText
 * @typedef {import('../state.js').State} State
 */



/**
 * Turn an mdast `text` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdastText} node
 *   mdast node.
 * @returns {HastText | HastElement}
 *   hast node.
 */
function handlers_text_text(state, node) {
  /** @type {HastText} */
  const result = {type: 'text', value: trimLines(String(node.value))}
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
/**
 * @typedef {import('hast').Element} Element
 * @typedef {import('mdast').ThematicBreak} ThematicBreak
 * @typedef {import('../state.js').State} State
 */

/**
 * Turn an mdast `thematicBreak` node into hast.
 *
 * @param {State} state
 *   Info passed around.
 * @param {ThematicBreak} node
 *   mdast node.
 * @returns {Element}
 *   hast node.
 */
function thematic_break_thematicBreak(state, node) {
  /** @type {Element} */
  const result = {
    type: 'element',
    tagName: 'hr',
    properties: {},
    children: []
  }
  state.patch(node, result)
  return state.applyData(node, result)
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/index.js

























/**
 * Default handlers for nodes.
 */
const handlers = {
  blockquote: blockquote,
  break: hardBreak,
  code: code,
  delete: strikethrough,
  emphasis: emphasis,
  footnoteReference: footnoteReference,
  footnote: footnote,
  heading: heading,
  html: html,
  imageReference: imageReference,
  image: image_image,
  inlineCode: inlineCode,
  linkReference: linkReference,
  link: link_link,
  listItem: listItem,
  list: list_list,
  paragraph: paragraph,
  root: root,
  strong: strong,
  table: table,
  tableCell: tableCell,
  tableRow: tableRow,
  text: handlers_text_text,
  thematicBreak: thematic_break_thematicBreak,
  toml: ignore,
  yaml: ignore,
  definition: ignore,
  footnoteDefinition: ignore
}

// Return nothing for nodes that are ignored.
function ignore() {
  // To do: next major: return `undefined`.
  return null
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/state.js
/**
 * @typedef {import('hast').Content} HastContent
 * @typedef {import('hast').Element} HastElement
 * @typedef {import('hast').ElementContent} HastElementContent
 * @typedef {import('hast').Properties} HastProperties
 * @typedef {import('hast').Root} HastRoot
 * @typedef {import('hast').Text} HastText
 *
 * @typedef {import('mdast').Content} MdastContent
 * @typedef {import('mdast').Definition} MdastDefinition
 * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition
 * @typedef {import('mdast').Parent} MdastParent
 * @typedef {import('mdast').Root} MdastRoot
 */

/**
 * @typedef {HastRoot | HastContent} HastNodes
 * @typedef {MdastRoot | MdastContent} MdastNodes
 * @typedef {Extract} MdastParents
 *
 * @typedef EmbeddedHastFields
 *   hast fields.
 * @property {string | null | undefined} [hName]
 *   Generate a specific element with this tag name instead.
 * @property {HastProperties | null | undefined} [hProperties]
 *   Generate an element with these properties instead.
 * @property {Array | null | undefined} [hChildren]
 *   Generate an element with this content instead.
 *
 * @typedef {Record & EmbeddedHastFields} MdastData
 *   mdast data with embedded hast fields.
 *
 * @typedef {MdastNodes & {data?: MdastData | null | undefined}} MdastNodeWithData
 *   mdast node with embedded hast data.
 *
 * @typedef PointLike
 *   Point-like value.
 * @property {number | null | undefined} [line]
 *   Line.
 * @property {number | null | undefined} [column]
 *   Column.
 * @property {number | null | undefined} [offset]
 *   Offset.
 *
 * @typedef PositionLike
 *   Position-like value.
 * @property {PointLike | null | undefined} [start]
 *   Point-like value.
 * @property {PointLike | null | undefined} [end]
 *   Point-like value.
 *
 * @callback Handler
 *   Handle a node.
 * @param {State} state
 *   Info passed around.
 * @param {any} node
 *   mdast node to handle.
 * @param {MdastParents | null | undefined} parent
 *   Parent of `node`.
 * @returns {HastElementContent | Array | null | undefined}
 *   hast node.
 *
 * @callback HFunctionProps
 *   Signature of `state` for when props are passed.
 * @param {MdastNodes | PositionLike | null | undefined} node
 *   mdast node or unist position.
 * @param {string} tagName
 *   HTML tag name.
 * @param {HastProperties} props
 *   Properties.
 * @param {Array | null | undefined} [children]
 *   hast content.
 * @returns {HastElement}
 *   Compiled element.
 *
 * @callback HFunctionNoProps
 *   Signature of `state` for when no props are passed.
 * @param {MdastNodes | PositionLike | null | undefined} node
 *   mdast node or unist position.
 * @param {string} tagName
 *   HTML tag name.
 * @param {Array | null | undefined} [children]
 *   hast content.
 * @returns {HastElement}
 *   Compiled element.
 *
 * @typedef HFields
 *   Info on `state`.
 * @property {boolean} dangerous
 *   Whether HTML is allowed.
 * @property {string} clobberPrefix
 *   Prefix to use to prevent DOM clobbering.
 * @property {string} footnoteLabel
 *   Label to use to introduce the footnote section.
 * @property {string} footnoteLabelTagName
 *   HTML used for the footnote label.
 * @property {HastProperties} footnoteLabelProperties
 *   Properties on the HTML tag used for the footnote label.
 * @property {string} footnoteBackLabel
 *   Label to use from backreferences back to their footnote call.
 * @property {(identifier: string) => MdastDefinition | null} definition
 *   Definition cache.
 * @property {Record} footnoteById
 *   Footnote definitions by their identifier.
 * @property {Array} footnoteOrder
 *   Identifiers of order when footnote calls first appear in tree order.
 * @property {Record} footnoteCounts
 *   Counts for how often the same footnote was called.
 * @property {Handlers} handlers
 *   Applied handlers.
 * @property {Handler} unknownHandler
 *   Handler for any none not in `passThrough` or otherwise handled.
 * @property {(from: MdastNodes, node: HastNodes) => void} patch
 *   Copy a node’s positional info.
 * @property {(from: MdastNodes, to: Type) => Type | HastElement} applyData
 *   Honor the `data` of `from`, and generate an element instead of `node`.
 * @property {(node: MdastNodes, parent: MdastParents | null | undefined) => HastElementContent | Array | null | undefined} one
 *   Transform an mdast node to hast.
 * @property {(node: MdastNodes) => Array} all
 *   Transform the children of an mdast parent to hast.
 * @property {(nodes: Array, loose?: boolean | null | undefined) => Array} wrap
 *   Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.
 * @property {(left: MdastNodeWithData | PositionLike | null | undefined, right: HastElementContent) => HastElementContent} augment
 *   Like `state` but lower-level and usable on non-elements.
 *   Deprecated: use `patch` and `applyData`.
 * @property {Array} passThrough
 *   List of node types to pass through untouched (except for their children).
 *
 * @typedef Options
 *   Configuration (optional).
 * @property {boolean | null | undefined} [allowDangerousHtml=false]
 *   Whether to persist raw HTML in markdown in the hast tree.
 * @property {string | null | undefined} [clobberPrefix='user-content-']
 *   Prefix to use before the `id` attribute on footnotes to prevent it from
 *   *clobbering*.
 * @property {string | null | undefined} [footnoteBackLabel='Back to content']
 *   Label to use from backreferences back to their footnote call (affects
 *   screen readers).
 * @property {string | null | undefined} [footnoteLabel='Footnotes']
 *   Label to use for the footnotes section (affects screen readers).
 * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]
 *   Properties to use on the footnote label (note that `id: 'footnote-label'`
 *   is always added as footnote calls use it with `aria-describedby` to
 *   provide an accessible label).
 * @property {string | null | undefined} [footnoteLabelTagName='h2']
 *   Tag name to use for the footnote label.
 * @property {Handlers | null | undefined} [handlers]
 *   Extra handlers for nodes.
 * @property {Array | null | undefined} [passThrough]
 *   List of custom mdast node types to pass through (keep) in hast (note that
 *   the node itself is passed, but eventual children are transformed).
 * @property {Handler | null | undefined} [unknownHandler]
 *   Handler for all unknown nodes.
 *
 * @typedef {Record} Handlers
 *   Handle nodes.
 *
 * @typedef {HFunctionProps & HFunctionNoProps & HFields} State
 *   Info passed around.
 */







const state_own = {}.hasOwnProperty

/**
 * Create `state` from an mdast tree.
 *
 * @param {MdastNodes} tree
 *   mdast node to transform.
 * @param {Options | null | undefined} [options]
 *   Configuration.
 * @returns {State}
 *   `state` function.
 */
function createState(tree, options) {
  const settings = options || {}
  const dangerous = settings.allowDangerousHtml || false
  /** @type {Record} */
  const footnoteById = {}

  // To do: next major: add `options` to state, remove:
  // `dangerous`, `clobberPrefix`, `footnoteLabel`, `footnoteLabelTagName`,
  // `footnoteLabelProperties`, `footnoteBackLabel`, `passThrough`,
  // `unknownHandler`.

  // To do: next major: move to `state.options.allowDangerousHtml`.
  state.dangerous = dangerous
  // To do: next major: move to `state.options`.
  state.clobberPrefix =
    settings.clobberPrefix === undefined || settings.clobberPrefix === null
      ? 'user-content-'
      : settings.clobberPrefix
  // To do: next major: move to `state.options`.
  state.footnoteLabel = settings.footnoteLabel || 'Footnotes'
  // To do: next major: move to `state.options`.
  state.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'
  // To do: next major: move to `state.options`.
  state.footnoteLabelProperties = settings.footnoteLabelProperties || {
    className: ['sr-only']
  }
  // To do: next major: move to `state.options`.
  state.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'
  // To do: next major: move to `state.options`.
  state.unknownHandler = settings.unknownHandler
  // To do: next major: move to `state.options`.
  state.passThrough = settings.passThrough

  state.handlers = {...handlers, ...settings.handlers}

  // To do: next major: replace utility with `definitionById` object, so we
  // only walk once (as we need footnotes too).
  state.definition = definitions(tree)
  state.footnoteById = footnoteById
  /** @type {Array} */
  state.footnoteOrder = []
  /** @type {Record} */
  state.footnoteCounts = {}

  state.patch = patch
  state.applyData = applyData
  state.one = oneBound
  state.all = allBound
  state.wrap = state_wrap
  // To do: next major: remove `augment`.
  state.augment = augment

  visit(tree, 'footnoteDefinition', (definition) => {
    const id = String(definition.identifier).toUpperCase()

    // Mimick CM behavior of link definitions.
    // See: .
    if (!state_own.call(footnoteById, id)) {
      footnoteById[id] = definition
    }
  })

  // @ts-expect-error Hush, it’s fine!
  return state

  /**
   * Finalise the created `right`, a hast node, from `left`, an mdast node.
   *
   * @param {MdastNodeWithData | PositionLike | null | undefined} left
   * @param {HastElementContent} right
   * @returns {HastElementContent}
   */
  /* c8 ignore start */
  // To do: next major: remove.
  function augment(left, right) {
    // Handle `data.hName`, `data.hProperties, `data.hChildren`.
    if (left && 'data' in left && left.data) {
      /** @type {MdastData} */
      const data = left.data

      if (data.hName) {
        if (right.type !== 'element') {
          right = {
            type: 'element',
            tagName: '',
            properties: {},
            children: []
          }
        }

        right.tagName = data.hName
      }

      if (right.type === 'element' && data.hProperties) {
        right.properties = {...right.properties, ...data.hProperties}
      }

      if ('children' in right && right.children && data.hChildren) {
        right.children = data.hChildren
      }
    }

    if (left) {
      const ctx = 'type' in left ? left : {position: left}

      if (!generated(ctx)) {
        // @ts-expect-error: fine.
        right.position = {start: pointStart(ctx), end: pointEnd(ctx)}
      }
    }

    return right
  }
  /* c8 ignore stop */

  /**
   * Create an element for `node`.
   *
   * @type {HFunctionProps}
   */
  /* c8 ignore start */
  // To do: next major: remove.
  function state(node, tagName, props, children) {
    if (Array.isArray(props)) {
      children = props
      props = {}
    }

    // @ts-expect-error augmenting an element yields an element.
    return augment(node, {
      type: 'element',
      tagName,
      properties: props || {},
      children: children || []
    })
  }
  /* c8 ignore stop */

  /**
   * Transform an mdast node into a hast node.
   *
   * @param {MdastNodes} node
   *   mdast node.
   * @param {MdastParents | null | undefined} [parent]
   *   Parent of `node`.
   * @returns {HastElementContent | Array | null | undefined}
   *   Resulting hast node.
   */
  function oneBound(node, parent) {
    // @ts-expect-error: that’s a state :)
    return state_one(state, node, parent)
  }

  /**
   * Transform the children of an mdast node into hast nodes.
   *
   * @param {MdastNodes} parent
   *   mdast node to compile
   * @returns {Array}
   *   Resulting hast nodes.
   */
  function allBound(parent) {
    // @ts-expect-error: that’s a state :)
    return state_all(state, parent)
  }
}

/**
 * Copy a node’s positional info.
 *
 * @param {MdastNodes} from
 *   mdast node to copy from.
 * @param {HastNodes} to
 *   hast node to copy into.
 * @returns {void}
 *   Nothing.
 */
function patch(from, to) {
  if (from.position) to.position = lib_position(from)
}

/**
 * Honor the `data` of `from` and maybe generate an element instead of `to`.
 *
 * @template {HastNodes} Type
 *   Node type.
 * @param {MdastNodes} from
 *   mdast node to use data from.
 * @param {Type} to
 *   hast node to change.
 * @returns {Type | HastElement}
 *   Nothing.
 */
function applyData(from, to) {
  /** @type {Type | HastElement} */
  let result = to

  // Handle `data.hName`, `data.hProperties, `data.hChildren`.
  if (from && from.data) {
    const hName = from.data.hName
    const hChildren = from.data.hChildren
    const hProperties = from.data.hProperties

    if (typeof hName === 'string') {
      // Transforming the node resulted in an element with a different name
      // than wanted:
      if (result.type === 'element') {
        result.tagName = hName
      }
      // Transforming the node resulted in a non-element, which happens for
      // raw, text, and root nodes (unless custom handlers are passed).
      // The intent is likely to keep the content around (otherwise: pass
      // `hChildren`).
      else {
        result = {
          type: 'element',
          tagName: hName,
          properties: {},
          children: []
        }

        // To do: next major: take the children from the `root`, or inject the
        // raw/text/comment or so into the element?
        // if ('children' in node) {
        //   // @ts-expect-error: assume `children` are allowed in elements.
        //   result.children = node.children
        // } else {
        //   // @ts-expect-error: assume `node` is allowed in elements.
        //   result.children.push(node)
        // }
      }
    }

    if (result.type === 'element' && hProperties) {
      result.properties = {...result.properties, ...hProperties}
    }

    if (
      'children' in result &&
      result.children &&
      hChildren !== null &&
      hChildren !== undefined
    ) {
      // @ts-expect-error: assume valid children are defined.
      result.children = hChildren
    }
  }

  return result
}

/**
 * Transform an mdast node into a hast node.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdastNodes} node
 *   mdast node.
 * @param {MdastParents | null | undefined} [parent]
 *   Parent of `node`.
 * @returns {HastElementContent | Array | null | undefined}
 *   Resulting hast node.
 */
// To do: next major: do not expose, keep bound.
function state_one(state, node, parent) {
  const type = node && node.type

  // Fail on non-nodes.
  if (!type) {
    throw new Error('Expected node, got `' + node + '`')
  }

  if (state_own.call(state.handlers, type)) {
    return state.handlers[type](state, node, parent)
  }

  if (state.passThrough && state.passThrough.includes(type)) {
    // To do: next major: deep clone.
    // @ts-expect-error: types of passed through nodes are expected to be added manually.
    return 'children' in node ? {...node, children: state_all(state, node)} : node
  }

  if (state.unknownHandler) {
    return state.unknownHandler(state, node, parent)
  }

  return defaultUnknownHandler(state, node)
}

/**
 * Transform the children of an mdast node into hast nodes.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdastNodes} parent
 *   mdast node to compile
 * @returns {Array}
 *   Resulting hast nodes.
 */
// To do: next major: do not expose, keep bound.
function state_all(state, parent) {
  /** @type {Array} */
  const values = []

  if ('children' in parent) {
    const nodes = parent.children
    let index = -1
    while (++index < nodes.length) {
      const result = state_one(state, nodes[index], parent)

      // To do: see if we van clean this? Can we merge texts?
      if (result) {
        if (index && nodes[index - 1].type === 'break') {
          if (!Array.isArray(result) && result.type === 'text') {
            result.value = result.value.replace(/^\s+/, '')
          }

          if (!Array.isArray(result) && result.type === 'element') {
            const head = result.children[0]

            if (head && head.type === 'text') {
              head.value = head.value.replace(/^\s+/, '')
            }
          }
        }

        if (Array.isArray(result)) {
          values.push(...result)
        } else {
          values.push(result)
        }
      }
    }
  }

  return values
}

/**
 * Transform an unknown node.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdastNodes} node
 *   Unknown mdast node.
 * @returns {HastText | HastElement}
 *   Resulting hast node.
 */
function defaultUnknownHandler(state, node) {
  const data = node.data || {}
  /** @type {HastText | HastElement} */
  const result =
    'value' in node &&
    !(state_own.call(data, 'hProperties') || state_own.call(data, 'hChildren'))
      ? {type: 'text', value: node.value}
      : {
          type: 'element',
          tagName: 'div',
          properties: {},
          children: state_all(state, node)
        }

  state.patch(node, result)
  return state.applyData(node, result)
}

/**
 * Wrap `nodes` with line endings between each node.
 *
 * @template {HastContent} Type
 *   Node type.
 * @param {Array} nodes
 *   List of nodes to wrap.
 * @param {boolean | null | undefined} [loose=false]
 *   Whether to add line endings at start and end.
 * @returns {Array}
 *   Wrapped nodes.
 */
function state_wrap(nodes, loose) {
  /** @type {Array} */
  const result = []
  let index = -1

  if (loose) {
    result.push({type: 'text', value: '\n'})
  }

  while (++index < nodes.length) {
    if (index) result.push({type: 'text', value: '\n'})
    result.push(nodes[index])
  }

  if (loose && nodes.length > 0) {
    result.push({type: 'text', value: '\n'})
  }

  return result
}

;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/index.js
/**
 * @typedef {import('hast').Content} HastContent
 * @typedef {import('hast').Root} HastRoot
 *
 * @typedef {import('mdast').Content} MdastContent
 * @typedef {import('mdast').Root} MdastRoot
 *
 * @typedef {import('./state.js').Options} Options
 */

/**
 * @typedef {HastRoot | HastContent} HastNodes
 * @typedef {MdastRoot | MdastContent} MdastNodes
 */




/**
 * Transform mdast to hast.
 *
 * ##### Notes
 *
 * ###### HTML
 *
 * Raw HTML is available in mdast as `html` nodes and can be embedded in hast
 * as semistandard `raw` nodes.
 * Most utilities ignore `raw` nodes but two notable ones don’t:
 *
 * *   `hast-util-to-html` also has an option `allowDangerousHtml` which will
 *     output the raw HTML.
 *     This is typically discouraged as noted by the option name but is useful
 *     if you completely trust authors
 * *   `hast-util-raw` can handle the raw embedded HTML strings by parsing them
 *     into standard hast nodes (`element`, `text`, etc).
 *     This is a heavy task as it needs a full HTML parser, but it is the only
 *     way to support untrusted content
 *
 * ###### Footnotes
 *
 * Many options supported here relate to footnotes.
 * Footnotes are not specified by CommonMark, which we follow by default.
 * They are supported by GitHub, so footnotes can be enabled in markdown with
 * `mdast-util-gfm`.
 *
 * The options `footnoteBackLabel` and `footnoteLabel` define natural language
 * that explains footnotes, which is hidden for sighted users but shown to
 * assistive technology.
 * When your page is not in English, you must define translated values.
 *
 * Back references use ARIA attributes, but the section label itself uses a
 * heading that is hidden with an `sr-only` class.
 * To show it to sighted users, define different attributes in
 * `footnoteLabelProperties`.
 *
 * ###### Clobbering
 *
 * Footnotes introduces a problem, as it links footnote calls to footnote
 * definitions on the page through `id` attributes generated from user content,
 * which results in DOM clobbering.
 *
 * DOM clobbering is this:
 *
 * ```html
 * 

* * ``` * * Elements by their ID are made available by browsers on the `window` object, * which is a security risk. * Using a prefix solves this problem. * * More information on how to handle clobbering and the prefix is explained in * Example: headings (DOM clobbering) in `rehype-sanitize`. * * ###### Unknown nodes * * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`. * The default behavior for unknown nodes is: * * * when the node has a `value` (and doesn’t have `data.hName`, * `data.hProperties`, or `data.hChildren`, see later), create a hast `text` * node * * otherwise, create a `
` element (which could be changed with * `data.hName`), with its children mapped from mdast to hast as well * * This behavior can be changed by passing an `unknownHandler`. * * @param {MdastNodes} tree * mdast tree. * @param {Options | null | undefined} [options] * Configuration. * @returns {HastNodes | null | undefined} * hast tree. */ // To do: next major: always return a single `root`. function toHast(tree, options) { const state = createState(tree, options) const node = state.one(tree, null) const foot = footer(state) if (foot) { // @ts-expect-error If there’s a footer, there were definitions, meaning block // content. // So assume `node` is a parent node. node.children.push({type: 'text', value: '\n'}, foot) } // To do: next major: always return root? return Array.isArray(node) ? {type: 'root', children: node} : node } ;// CONCATENATED MODULE: ./node_modules/remark-rehype/lib/index.js /** * @typedef {import('hast').Root} HastRoot * @typedef {import('mdast').Root} MdastRoot * @typedef {import('mdast-util-to-hast').Options} Options * @typedef {import('unified').Processor} Processor * * @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree */ // Note: the `` overload doesn’t seem to work :'( /** * Plugin that turns markdown into HTML to support rehype. * * * If a destination processor is given, that processor runs with a new HTML * (hast) tree (bridge-mode). * As the given processor runs with a hast tree, and rehype plugins support * hast, that means rehype plugins can be used with the given processor. * The hast tree is discarded in the end. * It’s highly unlikely that you want to do this. * * The common case is to not pass a destination processor, in which case the * current processor continues running with a new HTML (hast) tree * (mutate-mode). * As the current processor continues with a hast tree, and rehype plugins * support hast, that means rehype plugins can be used after * `remark-rehype`. * It’s likely that this is what you want to do. * * @param destination * Optional unified processor. * @param options * Options passed to `mdast-util-to-hast`. */ const remarkRehype = /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */ ( function (destination, options) { return destination && 'run' in destination ? bridge(destination, options) : mutate(destination || options) } ) /* harmony default export */ const lib = (remarkRehype); /** * Bridge-mode. * Runs the destination with the new hast tree. * * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>} */ function bridge(destination, options) { return (node, file, next) => { destination.run(toHast(node, options), file, (error) => { next(error) }) } } /** * Mutate-mode. * Further plugins run on the hast tree. * * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>} */ function mutate(options) { // @ts-expect-error: assume a corresponding node is returned by `toHast`. return (node) => toHast(node, options) } // EXTERNAL MODULE: ./node_modules/prop-types/index.js var prop_types = __webpack_require__(45697); ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/schema.js /** * @typedef {import('./info.js').Info} Info * @typedef {Record} Properties * @typedef {Record} Normal */ class Schema { /** * @constructor * @param {Properties} property * @param {Normal} normal * @param {string} [space] */ constructor(property, normal, space) { this.property = property this.normal = normal if (space) { this.space = space } } } /** @type {Properties} */ Schema.prototype.property = {} /** @type {Normal} */ Schema.prototype.normal = {} /** @type {string|null} */ Schema.prototype.space = null ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/merge.js /** * @typedef {import('./schema.js').Properties} Properties * @typedef {import('./schema.js').Normal} Normal */ /** * @param {Schema[]} definitions * @param {string} [space] * @returns {Schema} */ function merge(definitions, space) { /** @type {Properties} */ const property = {} /** @type {Normal} */ const normal = {} let index = -1 while (++index < definitions.length) { Object.assign(property, definitions[index].property) Object.assign(normal, definitions[index].normal) } return new Schema(property, normal, space) } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/normalize.js /** * @param {string} value * @returns {string} */ function normalize_normalize(value) { return value.toLowerCase() } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/info.js class Info { /** * @constructor * @param {string} property * @param {string} attribute */ constructor(property, attribute) { /** @type {string} */ this.property = property /** @type {string} */ this.attribute = attribute } } /** @type {string|null} */ Info.prototype.space = null Info.prototype.boolean = false Info.prototype.booleanish = false Info.prototype.overloadedBoolean = false Info.prototype.number = false Info.prototype.commaSeparated = false Info.prototype.spaceSeparated = false Info.prototype.commaOrSpaceSeparated = false Info.prototype.mustUseProperty = false Info.prototype.defined = false ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/types.js let powers = 0 const types_boolean = increment() const booleanish = increment() const overloadedBoolean = increment() const number = increment() const spaceSeparated = increment() const commaSeparated = increment() const commaOrSpaceSeparated = increment() function increment() { return 2 ** ++powers } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/defined-info.js /** @type {Array} */ // @ts-expect-error: hush. const checks = Object.keys(types_namespaceObject) class DefinedInfo extends Info { /** * @constructor * @param {string} property * @param {string} attribute * @param {number|null} [mask] * @param {string} [space] */ 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_namespaceObject[check]) === types_namespaceObject[check]) } } } } DefinedInfo.prototype.defined = true /** * @param {DefinedInfo} values * @param {string} key * @param {unknown} value */ function mark(values, key, value) { if (value) { // @ts-expect-error: assume `value` matches the expected value of `key`. values[key] = value } } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/create.js /** * @typedef {import('./schema.js').Properties} Properties * @typedef {import('./schema.js').Normal} Normal * * @typedef {Record} Attributes * * @typedef {Object} Definition * @property {Record} properties * @property {(attributes: Attributes, property: string) => string} transform * @property {string} [space] * @property {Attributes} [attributes] * @property {Array} [mustUseProperty] */ const create_own = {}.hasOwnProperty /** * @param {Definition} definition * @returns {Schema} */ function create(definition) { /** @type {Properties} */ const property = {} /** @type {Normal} */ const normal = {} /** @type {string} */ let prop for (prop in definition.properties) { if (create_own.call(definition.properties, prop)) { const value = definition.properties[prop] const info = new DefinedInfo( prop, definition.transform(definition.attributes || {}, prop), value, definition.space ) if ( definition.mustUseProperty && definition.mustUseProperty.includes(prop) ) { info.mustUseProperty = true } property[prop] = info normal[normalize_normalize(prop)] = prop normal[normalize_normalize(info.attribute)] = prop } } return new Schema(property, normal, definition.space) } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/xlink.js const xlink = create({ space: 'xlink', transform(_, prop) { return 'xlink:' + prop.slice(5).toLowerCase() }, properties: { xLinkActuate: null, xLinkArcRole: null, xLinkHref: null, xLinkRole: null, xLinkShow: null, xLinkTitle: null, xLinkType: null } }) ;// CONCATENATED MODULE: ./node_modules/property-information/lib/xml.js const xml = create({ space: 'xml', transform(_, prop) { return 'xml:' + prop.slice(3).toLowerCase() }, properties: {xmlLang: null, xmlBase: null, xmlSpace: null} }) ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/case-sensitive-transform.js /** * @param {Record} attributes * @param {string} attribute * @returns {string} */ function caseSensitiveTransform(attributes, attribute) { return attribute in attributes ? attributes[attribute] : attribute } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/util/case-insensitive-transform.js /** * @param {Record} attributes * @param {string} property * @returns {string} */ function caseInsensitiveTransform(attributes, property) { return caseSensitiveTransform(attributes, property.toLowerCase()) } ;// CONCATENATED MODULE: ./node_modules/property-information/lib/xmlns.js const xmlns = create({ space: 'xmlns', attributes: {xmlnsxlink: 'xmlns:xlink'}, transform: caseInsensitiveTransform, properties: {xmlns: null, xmlnsXLink: null} }) ;// CONCATENATED MODULE: ./node_modules/property-information/lib/aria.js const aria = create({ transform(_, prop) { return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase() }, 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 } }) ;// CONCATENATED MODULE: ./node_modules/property-information/lib/html.js const html_html = create({ space: 'html', attributes: { acceptcharset: 'accept-charset', classname: 'class', htmlfor: 'for', httpequiv: 'http-equiv' }, transform: caseInsensitiveTransform, mustUseProperty: ['checked', 'multiple', 'muted', 'selected'], properties: { // Standard Properties. abbr: null, accept: commaSeparated, acceptCharset: spaceSeparated, accessKey: spaceSeparated, action: null, allow: null, allowFullScreen: types_boolean, allowPaymentRequest: types_boolean, allowUserMedia: types_boolean, alt: null, as: null, async: types_boolean, autoCapitalize: null, autoComplete: spaceSeparated, autoFocus: types_boolean, autoPlay: types_boolean, capture: types_boolean, charSet: null, checked: types_boolean, cite: null, className: spaceSeparated, cols: number, colSpan: null, content: null, contentEditable: booleanish, controls: types_boolean, controlsList: spaceSeparated, coords: number | commaSeparated, crossOrigin: null, data: null, dateTime: null, decoding: null, default: types_boolean, defer: types_boolean, dir: null, dirName: null, disabled: types_boolean, download: overloadedBoolean, draggable: booleanish, encType: null, enterKeyHint: null, form: null, formAction: null, formEncType: null, formMethod: null, formNoValidate: types_boolean, formTarget: null, headers: spaceSeparated, height: number, hidden: types_boolean, high: number, href: null, hrefLang: null, htmlFor: spaceSeparated, httpEquiv: spaceSeparated, id: null, imageSizes: null, imageSrcSet: null, inputMode: null, integrity: null, is: null, isMap: types_boolean, itemId: null, itemProp: spaceSeparated, itemRef: spaceSeparated, itemScope: types_boolean, itemType: spaceSeparated, kind: null, label: null, lang: null, language: null, list: null, loading: null, loop: types_boolean, low: number, manifest: null, max: null, maxLength: number, media: null, method: null, min: null, minLength: number, multiple: types_boolean, muted: types_boolean, name: null, nonce: null, noModule: types_boolean, noValidate: types_boolean, onAbort: null, onAfterPrint: null, onAuxClick: null, onBeforeMatch: null, onBeforePrint: 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: types_boolean, optimum: number, pattern: null, ping: spaceSeparated, placeholder: null, playsInline: types_boolean, poster: null, preload: null, readOnly: types_boolean, referrerPolicy: null, rel: spaceSeparated, required: types_boolean, reversed: types_boolean, rows: number, rowSpan: number, sandbox: spaceSeparated, scope: null, scoped: types_boolean, seamless: types_boolean, selected: types_boolean, 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: types_boolean, useMap: null, value: booleanish, width: number, wrap: null, // Legacy. // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis align: null, // Several. Use CSS `text-align` instead, aLink: null, // ``. Use CSS `a:active {color}` instead archive: spaceSeparated, // ``. List of URIs to archives axis: null, // `` and ``. Use `scope` on `` background: null, // ``. Use CSS `background-image` instead bgColor: null, // `` and table elements. Use CSS `background-color` instead border: number, // ``. Use CSS `border-width` instead, borderColor: null, // `
`. Use CSS `border-color` instead, bottomMargin: number, // `` cellPadding: null, // `
` cellSpacing: null, // `
` char: null, // Several table elements. When `align=char`, sets the character to align on charOff: null, // Several table elements. When `char`, offsets the alignment classId: null, // `` clear: null, // `
`. Use CSS `clear` instead code: null, // `` codeBase: null, // `` codeType: null, // `` color: null, // `` and `
`. Use CSS instead compact: types_boolean, // Lists. Use CSS to reduce space between items instead declare: types_boolean, // `` event: null, // `