"use strict"; exports.id = 693; exports.ids = [693]; exports.modules = { /***/ 54511: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { // EXPORTS __webpack_require__.d(__webpack_exports__, { a: () => (/* binding */ createText), c: () => (/* binding */ computeDimensionOfText) }); // NAMESPACE OBJECT: ./node_modules/mermaid/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) }); // EXTERNAL MODULE: ./node_modules/mermaid/dist/mermaid-934d9bea.js + 8 modules var mermaid_934d9bea = __webpack_require__(85322); ;// CONCATENATED MODULE: ./node_modules/mermaid/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. * @property {boolean | null | undefined} [includeHtml=true] * Whether to use `value` of HTML. */ /** @type {Options} */ const emptyOptions = {} /** * 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 settings = options || emptyOptions const includeImageAlt = typeof settings.includeImageAlt === 'boolean' ? settings.includeImageAlt : true const includeHtml = typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true return one(value, includeImageAlt, includeHtml) } /** * One node or several nodes. * * @param {unknown} value * Thing to serialize. * @param {boolean} includeImageAlt * Include image `alt`s. * @param {boolean} includeHtml * Include HTML. * @returns {string} * Serialized node. */ function one(value, includeImageAlt, includeHtml) { if (node(value)) { if ('value' in value) { return value.type === 'html' && !includeHtml ? '' : value.value } if (includeImageAlt && 'alt' in value && value.alt) { return value.alt } if ('children' in value) { return lib_all(value.children, includeImageAlt, includeHtml) } } if (Array.isArray(value)) { return lib_all(value, includeImageAlt, includeHtml) } return '' } /** * Serialize a list of nodes. * * @param {Array} values * Thing to serialize. * @param {boolean} includeImageAlt * Include image `alt`s. * @param {boolean} includeHtml * Include HTML. * @returns {string} * Serialized nodes. */ function lib_all(values, includeImageAlt, includeHtml) { /** @type {Array} */ const result = [] let index = -1 while (++index < values.length) { result[index] = one(values[index], includeImageAlt, includeHtml) } 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/mermaid/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 * Item type. * @param {Array} list * List to operate on. * @param {number} start * Index to remove/insert at (can be negative). * @param {number} remove * Number of items to remove. * @param {Array} items * Items to inject into `list`. * @returns {void} * Nothing. */ function splice(list, start, remove, items) { const end = list.length let chunkStart = 0 /** @type {Array} */ 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. list.splice(...parameters) } else { // Delete `remove` items starting from `start` if (remove) list.splice(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. list.splice(...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 * Item type. * @param {Array} list * List to operate on. * @param {Array} items * Items to add to `list`. * @returns {Array} * Either `list` or `items`. */ function push(list, items) { if (list.length > 0) { splice(list, list.length, 0, items) return list } return items } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-combine-extensions/index.js /** * @typedef {import('micromark-util-types').Extension} Extension * @typedef {import('micromark-util-types').Handles} Handles * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension */ const micromark_util_combine_extensions_hasOwnProperty = {}.hasOwnProperty /** * Combine multiple syntax extensions into one. * * @param {Array} 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 {keyof Extension} */ let hook for (hook in extension) { const maybe = micromark_util_combine_extensions_hasOwnProperty.call(all, hook) ? all[hook] : undefined /** @type {Record} */ const left = maybe || (all[hook] = {}) /** @type {Record | undefined} */ const right = extension[hook] /** @type {string} */ let code if (right) { 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 {Array} existing * @param {Array} list * @returns {void} */ function constructs(existing, list) { let index = -1 /** @type {Array} */ 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 multiple HTML extensions into one. * * @param {Array} htmlExtensions * List of HTML extensions. * @returns {HtmlExtension} * A single combined HTML 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 {keyof HtmlExtension} */ 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 {keyof Handles} */ let type if (right) { for (type in right) { // @ts-expect-error assume document vs regular handler are managed correctly. left[type] = right[type] } } } } ;// CONCATENATED MODULE: ./node_modules/mermaid/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. /** * Regular expression that matches a unicode punctuation character. */ const unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\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\u1B7D\u1B7E\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-\u2E5D\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/mermaid/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`). * * @param code * Code. * @returns * Whether it matches. */ const asciiAlpha = regexCheck(/[A-Za-z]/) /** * 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`). * * @param code * Code. * @returns * Whether it matches. */ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) /** * 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. * * @param code * Code. * @returns * Whether it matches. */ 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 * Code. * @returns {boolean} * Whether it matches. */ function asciiControl(code) { return ( // Special whitespace codes (which have negative values), C0 and Control // character DEL code !== null && (code < 32 || code === 127) ) } /** * 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`). * * @param code * Code. * @returns * Whether it matches. */ 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`). * * @param code * Code. * @returns * Whether it matches. */ const asciiHexDigit = regexCheck(/[\dA-Fa-f]/) /** * 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 (`~`). * * @param code * Code. * @returns * Whether it matches. */ const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) /** * 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 * Code. * @returns {boolean} * Whether it matches. */ function markdownLineEnding(code) { return code !== null && code < -2 } /** * Check whether a character code is a markdown line ending (see * `markdownLineEnding`) or markdown space (see `markdownSpace`). * * @param {Code} code * Code. * @returns {boolean} * Whether it matches. */ function markdownLineEndingOrSpace(code) { return code !== null && (code < 0 || code === 32) } /** * 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 * Code. * @returns {boolean} * Whether it matches. */ function markdownSpace(code) { return code === -2 || code === -1 || code === 32 } // Size note: removing ASCII from the regex and using `asciiPunctuation` here // In fact adds to the bundle size. /** * 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. * * @param code * Code. * @returns * Whether it matches. */ const unicodePunctuation = regexCheck(unicodePunctuationRegex) /** * 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. * * @param code * Code. * @returns * Whether it matches. */ const unicodeWhitespace = regexCheck(/\s/) /** * Create a code check from a regex. * * @param {RegExp} regex * @returns {(code: Code) => boolean} */ function regexCheck(regex) { return check /** * Check whether a code matches the bound regex. * * @param {Code} code * Character code. * @returns {boolean} * Whether the character code matches the bound regex. */ function check(code) { return code !== null && regex.test(String.fromCharCode(code)) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-factory-space/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenType} TokenType */ // To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`. /** * Parse spaces and tabs. * * There is no `nok` parameter: * * * spaces in markdown are often optional, in which case this factory can be * used and `ok` will be switched to whether spaces were found or not * * one line ending or space can be detected with `markdownSpace(code)` right * before using `factorySpace` * * ###### Examples * * Where `␉` represents a tab (plus how much it expands) and `␠` represents a * single space. * * ```markdown * ␉ * ␠␠␠␠ * ␉␠ * ``` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {TokenType} type * Type (`' \t'`). * @param {number | undefined} [max=Infinity] * Max (exclusive). * @returns * Start 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/mermaid/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').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext */ /** @type {InitialConstruct} */ const content = { tokenize: initializeContent } /** * @this {TokenizeContext} * @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/mermaid/node_modules/micromark/lib/initialize/document.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').ContainerState} ContainerState * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').Point} Point * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** * @typedef {[Construct, ContainerState]} StackItem */ /** @type {InitialConstruct} */ const document_document = { tokenize: initializeDocument } /** @type {Construct} */ const containerConstruct = { tokenize: tokenizeContainer } /** * @this {TokenizeContext} * @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. // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer // needed in micromark-extension-gfm-table@1.0.6). 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 | undefined} [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 } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeContainer(effects, ok, nok) { // Always populated by defaults. 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/mermaid/node_modules/micromark-core-commonmark/lib/blank-line.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const blankLine = { tokenize: tokenizeBlankLine, partial: true } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeBlankLine(effects, ok, nok) { return start /** * Start of blank line. * * > 👉 **Note**: `␠` represents a space character. * * ```markdown * > | ␠␠␊ * ^ * > | ␊ * ^ * ``` * * @type {State} */ function start(code) { return markdownSpace(code) ? factorySpace(effects, after, 'linePrefix')(code) : after(code) } /** * At eof/eol, after optional whitespace. * * > 👉 **Note**: `␠` represents a space character. * * ```markdown * > | ␠␠␊ * ^ * > | ␊ * ^ * ``` * * @type {State} */ function after(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/micromark-util-subtokenize/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 * Item type. * @param {Array} list * List to operate on. * @param {number} start * Index to remove/insert at (can be negative). * @param {number} remove * Number of items to remove. * @param {Array} items * Items to inject into `list`. * @returns {void} * Nothing. */ function micromark_util_chunked_splice(list, start, remove, items) { const end = list.length let chunkStart = 0 /** @type {Array} */ 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. list.splice(...parameters) } else { // Delete `remove` items starting from `start` if (remove) list.splice(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. list.splice(...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 * Item type. * @param {Array} list * List to operate on. * @param {Array} items * Items to add to `list`. * @returns {Array} * Either `list` or `items`. */ function micromark_util_chunked_push(list, items) { if (list.length > 0) { micromark_util_chunked_splice(list, list.length, 0, items) return list } return items } ;// CONCATENATED MODULE: ./node_modules/micromark-util-subtokenize/index.js /** * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Token} Token */ /** * Tokenize subcontent. * * @param {Array} events * List of events. * @returns {boolean} * Whether subtokens were found. */ 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 {Array} */ let parameters /** @type {Array} */ 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) micromark_util_chunked_splice(events, lineIndex, index - lineIndex + 1, parameters) } } } return !more } /** * Tokenize embedded tokens. * * @param {Array} 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 {Array} */ const startPositions = [] const tokenizer = token._tokenizer || context.parser[token.contentType](token.start) const childEvents = tokenizer.events /** @type {Array<[number, number]>} */ const jumps = [] /** @type {Record} */ const gaps = {} /** @type {Array} */ let stream /** @type {Token | undefined} */ let previous let index = -1 /** @type {Token | undefined} */ let current = token let adjust = 0 let start = 0 const breaks = [start] // 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]) micromark_util_chunked_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/mermaid/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').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** * 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 } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeContent(effects, ok) { /** @type {Token | undefined} */ let previous return chunkStart /** * Before a content chunk. * * ```markdown * > | abc * ^ * ``` * * @type {State} */ function chunkStart(code) { effects.enter('content') previous = effects.enter('chunkContent', { contentType: 'content' }) return chunkInside(code) } /** * In a content chunk. * * ```markdown * > | abc * ^^^ * ``` * * @type {State} */ function chunkInside(code) { if (code === null) { return contentEnd(code) } // To do: in `markdown-rs`, each line is parsed on its own, and everything // is stitched together resolving. if (markdownLineEnding(code)) { return effects.check( continuationConstruct, contentContinue, contentEnd )(code) } // Data. effects.consume(code) return chunkInside } /** * * * @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 chunkInside } } /** * @this {TokenizeContext} * @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) } // Always populated by defaults. 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/mermaid/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 * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext */ /** @type {InitialConstruct} */ const flow = { tokenize: initializeFlow } /** * @this {TokenizeContext} * @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/mermaid/node_modules/micromark/lib/initialize/text.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').Initializer} Initializer * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext */ 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 ) } /** * @this {TokenizeContext} * @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) { // Always populated by defaults. while (++index < list.length) { const item = list[index] if (!item.previous || item.previous.call(self, self.previous)) { return true } } } return false } } } /** * @param {Resolver | undefined} [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/mermaid/node_modules/micromark-util-resolve-all/index.js /** * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext */ /** * Call all `resolveAll`s. * * @param {Array<{resolveAll?: Resolver | undefined}>} constructs * List of constructs, optionally with `resolveAll`s. * @param {Array} events * List of events. * @param {TokenizeContext} context * Context used by `tokenize`. * @returns {Array} * Changed events. */ function resolveAll(constructs, events, context) { /** @type {Array} */ 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/mermaid/node_modules/micromark/lib/create-tokenizer.js /** * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').ParseContext} ParseContext * @typedef {import('micromark-util-types').Point} Point * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenType} TokenType * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext */ /** * @callback Restore * @returns {void} * * @typedef Info * @property {Restore} 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 | undefined} [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() { // This is a hot path, so we clone manually instead of `Object.assign({}, point)` const {line, column, offset, _index, _bufferIndex} = point return { line, column, offset, _index, _bufferIndex } } /** @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 {{interrupt?: boolean | undefined} | undefined} [fields] */ function constructFactory(onreturn, fields) { return hook /** * Handle either an object mapping codes to constructs, a list of * constructs, or a single construct. * * @param {Array | Construct | ConstructRecord} constructs * @param {State} returnState * @param {State | undefined} [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 } // Always populated by defaults. 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) { const head = view[0] if (typeof head === 'string') { view[0] = head.slice(startBufferIndex) } else { view.shift() } } 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 | undefined} [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/mermaid/node_modules/micromark-core-commonmark/lib/thematic-break.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const thematicBreak = { name: 'thematicBreak', tokenize: tokenizeThematicBreak } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeThematicBreak(effects, ok, nok) { let size = 0 /** @type {NonNullable} */ let marker return start /** * Start of thematic break. * * ```markdown * > | *** * ^ * ``` * * @type {State} */ function start(code) { effects.enter('thematicBreak') // To do: parse indent like `markdown-rs`. return before(code) } /** * After optional whitespace, at marker. * * ```markdown * > | *** * ^ * ``` * * @type {State} */ function before(code) { marker = code return atBreak(code) } /** * After something, before something else. * * ```markdown * > | *** * ^ * ``` * * @type {State} */ function atBreak(code) { if (code === marker) { effects.enter('thematicBreakSequence') return sequence(code) } if (size >= 3 && (code === null || markdownLineEnding(code))) { effects.exit('thematicBreak') return ok(code) } return nok(code) } /** * In sequence. * * ```markdown * > | *** * ^ * ``` * * @type {State} */ function sequence(code) { if (code === marker) { effects.consume(code) size++ return sequence } effects.exit('thematicBreakSequence') return markdownSpace(code) ? factorySpace(effects, atBreak, 'whitespace')(code) : atBreak(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/list.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').ContainerState} ContainerState * @typedef {import('micromark-util-types').Exiter} Exiter * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @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 } // To do: `markdown-rs` parses list items on their own and later stitches them // together. /** * @type {Tokenizer} * @this {TokenizeContext} */ 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 {TokenizeContext} */ 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 // Always populated by defaults. return factorySpace( effects, effects.attempt(list, ok, nok), 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) } } /** * @type {Tokenizer} * @this {TokenizeContext} */ 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 {TokenizeContext} */ function tokenizeListEnd(effects) { effects.exit(this.containerState.type) } /** * @type {Tokenizer} * @this {TokenizeContext} */ function tokenizeListItemPrefixWhitespace(effects, ok, nok) { const self = this // Always populated by defaults. 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/mermaid/node_modules/micromark-core-commonmark/lib/block-quote.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Exiter} Exiter * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const blockQuote = { name: 'blockQuote', tokenize: tokenizeBlockQuoteStart, continuation: { tokenize: tokenizeBlockQuoteContinuation }, exit } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeBlockQuoteStart(effects, ok, nok) { const self = this return start /** * Start of block quote. * * ```markdown * > | > a * ^ * ``` * * @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) } /** * After `>`, before optional whitespace. * * ```markdown * > | > a * ^ * ``` * * @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) } } /** * Start of block quote continuation. * * ```markdown * | > a * > | > b * ^ * ``` * * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeBlockQuoteContinuation(effects, ok, nok) { const self = this return contStart /** * Start of block quote continuation. * * Also used to parse the first block quote opening. * * ```markdown * | > a * > | > b * ^ * ``` * * @type {State} */ function contStart(code) { if (markdownSpace(code)) { // Always populated by defaults. return factorySpace( effects, contBefore, 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) } return contBefore(code) } /** * At `>`, after optional whitespace. * * Also used to parse the first block quote opening. * * ```markdown * | > a * > | > b * ^ * ``` * * @type {State} */ function contBefore(code) { return effects.attempt(blockQuote, ok, nok)(code) } } /** @type {Exiter} */ function exit(effects) { effects.exit('blockQuote') } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-factory-destination/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenType} TokenType */ /** * Parse destinations. * * ###### Examples * * ```markdown * * b> * * * a * a\)b * a(b)c * a(b) * ``` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type for whole (`` or `b`). * @param {TokenType} literalType * Type when enclosed (``). * @param {TokenType} literalMarkerType * Type for enclosing (`<` and `>`). * @param {TokenType} rawType * Type when not enclosed (`b`). * @param {TokenType} stringType * Type for the value (`a` or `b`). * @param {number | undefined} [max=Infinity] * Depth of nested parens (inclusive). * @returns {State} * Start state. */ // 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 /** * Start of destination. * * ```markdown * > | * ^ * > | aa * ^ * ``` * * @type {State} */ function start(code) { if (code === 60) { effects.enter(type) effects.enter(literalType) effects.enter(literalMarkerType) effects.consume(code) effects.exit(literalMarkerType) return enclosedBefore } // ASCII control, space, closing paren. if (code === null || code === 32 || code === 41 || asciiControl(code)) { return nok(code) } effects.enter(type) effects.enter(rawType) effects.enter(stringType) effects.enter('chunkString', { contentType: 'string' }) return raw(code) } /** * After `<`, at an enclosed destination. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosedBefore(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 enclosed(code) } /** * In enclosed destination. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosed(code) { if (code === 62) { effects.exit('chunkString') effects.exit(stringType) return enclosedBefore(code) } if (code === null || code === 60 || markdownLineEnding(code)) { return nok(code) } effects.consume(code) return code === 92 ? enclosedEscape : enclosed } /** * After `\`, at a special character. * * ```markdown * > | * ^ * ``` * * @type {State} */ function enclosedEscape(code) { if (code === 60 || code === 62 || code === 92) { effects.consume(code) return enclosed } return enclosed(code) } /** * In raw destination. * * ```markdown * > | aa * ^ * ``` * * @type {State} */ function raw(code) { if ( !balance && (code === null || code === 41 || markdownLineEndingOrSpace(code)) ) { effects.exit('chunkString') effects.exit(stringType) effects.exit(rawType) effects.exit(type) return ok(code) } if (balance < limit && code === 40) { effects.consume(code) balance++ return raw } if (code === 41) { effects.consume(code) balance-- return raw } // ASCII control (but *not* `\0`) and space and `(`. // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it // doesn’t. if (code === null || code === 32 || code === 40 || asciiControl(code)) { return nok(code) } effects.consume(code) return code === 92 ? rawEscape : raw } /** * After `\`, at special character. * * ```markdown * > | a\*a * ^ * ``` * * @type {State} */ function rawEscape(code) { if (code === 40 || code === 41 || code === 92) { effects.consume(code) return raw } return raw(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-factory-label/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').TokenType} TokenType */ /** * Parse labels. * * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. * * ###### Examples * * ```markdown * [a] * [a * b] * [a\]b] * ``` * * @this {TokenizeContext} * Tokenize context. * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type of the whole label (`[a]`). * @param {TokenType} markerType * Type for the markers (`[` and `]`). * @param {TokenType} stringType * Type for the identifier (`a`). * @returns {State} * Start state. */ // eslint-disable-next-line max-params function factoryLabel(effects, ok, nok, type, markerType, stringType) { const self = this let size = 0 /** @type {boolean} */ let seen return start /** * Start of label. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function start(code) { effects.enter(type) effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.enter(stringType) return atBreak } /** * In label, at something, before something else. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function atBreak(code) { if ( size > 999 || code === null || code === 91 || (code === 93 && !seen) || // 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) ) { return nok(code) } if (code === 93) { effects.exit(stringType) effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.exit(type) return ok } // To do: indent? Link chunks and EOLs together? if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return atBreak } effects.enter('chunkString', { contentType: 'string' }) return labelInside(code) } /** * In label, in text. * * ```markdown * > | [a] * ^ * ``` * * @type {State} */ function labelInside(code) { if ( code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999 ) { effects.exit('chunkString') return atBreak(code) } effects.consume(code) if (!seen) seen = !markdownSpace(code) return code === 92 ? labelEscape : labelInside } /** * After `\`, at a special character. * * ```markdown * > | [a\*a] * ^ * ``` * * @type {State} */ function labelEscape(code) { if (code === 91 || code === 92 || code === 93) { effects.consume(code) size++ return labelInside } return labelInside(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-factory-title/index.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenType} TokenType */ /** * Parse titles. * * ###### Examples * * ```markdown * "a" * 'b' * (c) * "a * b" * 'a * b' * (a\)b) * ``` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @param {State} nok * State switched to when unsuccessful. * @param {TokenType} type * Type of the whole title (`"a"`, `'b'`, `(c)`). * @param {TokenType} markerType * Type for the markers (`"`, `'`, `(`, and `)`). * @param {TokenType} stringType * Type for the value (`a`). * @returns {State} * Start state. */ // eslint-disable-next-line max-params function factoryTitle(effects, ok, nok, type, markerType, stringType) { /** @type {NonNullable} */ let marker return start /** * Start of title. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function start(code) { if (code === 34 || code === 39 || code === 40) { effects.enter(type) effects.enter(markerType) effects.consume(code) effects.exit(markerType) marker = code === 40 ? 41 : code return begin } return nok(code) } /** * After opening marker. * * This is also used at the closing marker. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function begin(code) { if (code === marker) { effects.enter(markerType) effects.consume(code) effects.exit(markerType) effects.exit(type) return ok } effects.enter(stringType) return atBreak(code) } /** * At something, before something else. * * ```markdown * > | "a" * ^ * ``` * * @type {State} */ function atBreak(code) { if (code === marker) { effects.exit(stringType) return begin(marker) } if (code === null) { return nok(code) } // Note: blank lines can’t exist in content. if (markdownLineEnding(code)) { // To do: use `space_or_tab_eol_with_options`, connect. effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return factorySpace(effects, atBreak, 'linePrefix') } effects.enter('chunkString', { contentType: 'string' }) return inside(code) } /** * * * @type {State} */ function inside(code) { if (code === marker || code === null || markdownLineEnding(code)) { effects.exit('chunkString') return atBreak(code) } effects.consume(code) return code === 92 ? escape : inside } /** * After `\`, at a special character. * * ```markdown * > | "a\*b" * ^ * ``` * * @type {State} */ function escape(code) { if (code === marker || code === 92) { effects.consume(code) return inside } return inside(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-factory-whitespace/index.js /** * @typedef {import('micromark-util-types').Effects} Effects * @typedef {import('micromark-util-types').State} State */ /** * Parse spaces and tabs. * * There is no `nok` parameter: * * * line endings or spaces in markdown are often optional, in which case this * factory can be used and `ok` will be switched to whether spaces were found * or not * * one line ending or space can be detected with * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` * * @param {Effects} effects * Context. * @param {State} ok * State switched to when successful. * @returns * Start state. */ 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/mermaid/node_modules/micromark-util-normalize-identifier/index.js /** * Normalize an identifier (as found in references, definitions). * * Collapses markdown whitespace, trim, and then lower- and uppercase. * * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different * uppercase character (U+0398 (`Θ`)). * So, to get a canonical form, we perform both lower- and uppercase. * * Using uppercase last makes sure keys will never interact with default * prototypal values (such as `constructor`): nothing in the prototype of * `Object` is uppercase. * * @param {string} value * Identifier to normalize. * @returns {string} * Normalized identifier. */ 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/mermaid/node_modules/micromark-core-commonmark/lib/definition.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const definition = { name: 'definition', tokenize: tokenizeDefinition } /** @type {Construct} */ const titleBefore = { tokenize: tokenizeTitleBefore, partial: true } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeDefinition(effects, ok, nok) { const self = this /** @type {string} */ let identifier return start /** * At start of a definition. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function start(code) { // Do not interrupt paragraphs (but do follow definitions). // To do: do `interrupt` the way `markdown-rs` does. // To do: parse whitespace the way `markdown-rs` does. effects.enter('definition') return before(code) } /** * After optional whitespace, at `[`. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function before(code) { // To do: parse whitespace the way `markdown-rs` does. return factoryLabel.call( self, effects, labelAfter, // Note: we don’t need to reset the way `markdown-rs` does. nok, 'definitionLabel', 'definitionLabelMarker', 'definitionLabelString' )(code) } /** * After label. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function labelAfter(code) { identifier = normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) if (code === 58) { effects.enter('definitionMarker') effects.consume(code) effects.exit('definitionMarker') return markerAfter } return nok(code) } /** * After marker. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function markerAfter(code) { // Note: whitespace is optional. return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code) } /** * Before destination. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function destinationBefore(code) { return factoryDestination( effects, destinationAfter, // Note: we don’t need to reset the way `markdown-rs` does. nok, 'definitionDestination', 'definitionDestinationLiteral', 'definitionDestinationLiteralMarker', 'definitionDestinationRaw', 'definitionDestinationString' )(code) } /** * After destination. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function destinationAfter(code) { return effects.attempt(titleBefore, after, after)(code) } /** * After definition. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function after(code) { return markdownSpace(code) ? factorySpace(effects, afterWhitespace, 'whitespace')(code) : afterWhitespace(code) } /** * After definition, after optional whitespace. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function afterWhitespace(code) { if (code === null || markdownLineEnding(code)) { effects.exit('definition') // Note: we don’t care about uniqueness. // It’s likely that that doesn’t happen very frequently. // It is more likely that it wastes precious time. self.parser.defined.push(identifier) // To do: `markdown-rs` interrupt. // // You’d be interrupting. // tokenizer.interrupt = true return ok(code) } return nok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeTitleBefore(effects, ok, nok) { return titleBefore /** * After destination, at whitespace. * * ```markdown * > | [a]: b * ^ * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleBefore(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code) } /** * At title. * * ```markdown * | [a]: b * > | "c" * ^ * ``` * * @type {State} */ function beforeMarker(code) { return factoryTitle( effects, titleAfter, nok, 'definitionTitle', 'definitionTitleMarker', 'definitionTitleString' )(code) } /** * After title. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleAfter(code) { return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, 'whitespace')(code) : titleAfterOptionalWhitespace(code) } /** * After title, after optional whitespace. * * ```markdown * > | [a]: b "c" * ^ * ``` * * @type {State} */ function titleAfterOptionalWhitespace(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/code-indented.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const codeIndented = { name: 'codeIndented', tokenize: tokenizeCodeIndented } /** @type {Construct} */ const furtherStart = { tokenize: tokenizeFurtherStart, partial: true } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCodeIndented(effects, ok, nok) { const self = this return start /** * Start of code (indented). * * > **Parsing note**: it is not needed to check if this first line is a * > filled line (that it has a non-whitespace character), because blank lines * > are parsed already, so we never run into that. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function start(code) { // To do: manually check if interrupting like `markdown-rs`. effects.enter('codeIndented') // To do: use an improved `space_or_tab` function like `markdown-rs`, // so that we can drop the next state. return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) } /** * At start, after 1 or 4 spaces. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1] return tail && tail[1].type === 'linePrefix' && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code) } /** * At a break. * * ```markdown * > | aaa * ^ ^ * ``` * * @type {State} */ function atBreak(code) { if (code === null) { return after(code) } if (markdownLineEnding(code)) { return effects.attempt(furtherStart, atBreak, after)(code) } effects.enter('codeFlowValue') return inside(code) } /** * In code content. * * ```markdown * > | aaa * ^^^^ * ``` * * @type {State} */ function inside(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue') return atBreak(code) } effects.consume(code) return inside } /** @type {State} */ function after(code) { effects.exit('codeIndented') // To do: allow interrupting like `markdown-rs`. // Feel free to interrupt. // tokenizer.interrupt = false return ok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeFurtherStart(effects, ok, nok) { const self = this return furtherStart /** * At eol, trying to parse another indent. * * ```markdown * > | aaa * ^ * | bbb * ``` * * @type {State} */ function furtherStart(code) { // To do: improve `lazy` / `pierce` handling. // 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 furtherStart } // To do: the code here in `micromark-js` is a bit different from // `markdown-rs` because there it can attempt spaces. // We can’t yet. // // To do: use an improved `space_or_tab` function like `markdown-rs`, // so that we can drop the next state. return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) } /** * At start, after 1 or 4 spaces. * * ```markdown * > | aaa * ^ * ``` * * @type {State} */ function afterPrefix(code) { const tail = self.events[self.events.length - 1] return tail && tail[1].type === 'linePrefix' && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/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').State} State * @typedef {import('micromark-util-types').Token} Token * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @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, contentType: 'text' } splice(events, contentStart, contentEnd - contentStart + 1, [ ['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context] ]) } return events } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeHeadingAtx(effects, ok, nok) { let size = 0 return start /** * Start of a heading (atx). * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function start(code) { // To do: parse indent like `markdown-rs`. effects.enter('atxHeading') return before(code) } /** * After optional whitespace, at `#`. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function before(code) { effects.enter('atxHeadingSequence') return sequenceOpen(code) } /** * In opening sequence. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === 35 && size++ < 6) { effects.consume(code) return sequenceOpen } // Always at least one `#`. if (code === null || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingSequence') return atBreak(code) } return nok(code) } /** * After something, before something else. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function atBreak(code) { if (code === 35) { effects.enter('atxHeadingSequence') return sequenceFurther(code) } if (code === null || markdownLineEnding(code)) { effects.exit('atxHeading') // To do: interrupt like `markdown-rs`. // // Feel free to interrupt. // tokenizer.interrupt = false return ok(code) } if (markdownSpace(code)) { return factorySpace(effects, atBreak, 'whitespace')(code) } // To do: generate `data` tokens, add the `text` token later. // Needs edit map, see: `markdown.rs`. effects.enter('atxHeadingText') return data(code) } /** * In further sequence (after whitespace). * * Could be normal “visible” hashes in the heading or a final sequence. * * ```markdown * > | ## aa ## * ^ * ``` * * @type {State} */ function sequenceFurther(code) { if (code === 35) { effects.consume(code) return sequenceFurther } effects.exit('atxHeadingSequence') return atBreak(code) } /** * In text. * * ```markdown * > | ## aa * ^ * ``` * * @type {State} */ function data(code) { if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingText') return atBreak(code) } effects.consume(code) return data } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/setext-underline.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const setextUnderline = { name: 'setextUnderline', tokenize: tokenizeSetextUnderline, resolveTo: resolveToSetextUnderline } /** @type {Resolver} */ function resolveToSetextUnderline(events, context) { // To do: resolve like `markdown-rs`. 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 } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeSetextUnderline(effects, ok, nok) { const self = this /** @type {NonNullable} */ let marker return start /** * At start of heading (setext) underline. * * ```markdown * | aa * > | == * ^ * ``` * * @type {State} */ function start(code) { let index = self.events.length /** @type {boolean | undefined} */ 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 } } // To do: handle lazy/pierce like `markdown-rs`. // To do: parse indent like `markdown-rs`. if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { effects.enter('setextHeadingLine') marker = code return before(code) } return nok(code) } /** * After optional whitespace, at `-` or `=`. * * ```markdown * | aa * > | == * ^ * ``` * * @type {State} */ function before(code) { effects.enter('setextHeadingLineSequence') return inside(code) } /** * In sequence. * * ```markdown * | aa * > | == * ^ * ``` * * @type {State} */ function inside(code) { if (code === marker) { effects.consume(code) return inside } effects.exit('setextHeadingLineSequence') return markdownSpace(code) ? factorySpace(effects, after, 'lineSuffix')(code) : after(code) } /** * After sequence, after optional whitespace. * * ```markdown * | aa * > | == * ^ * ``` * * @type {State} */ function after(code) { if (code === null || markdownLineEnding(code)) { effects.exit('setextHeadingLine') return ok(code) } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-html-tag-name/index.js /** * List of lowercase HTML “block” tag names. * * The list, when parsing HTML (flow), results in more relaxed rules (condition * 6). * Because they are known blocks, the HTML-like syntax doesn’t have to be * strictly parsed. * For tag names not in this list, a more strict algorithm (condition 7) is used * to detect whether the HTML-like syntax is seen as HTML (flow) or not. * * This is copied from: * . * * > 👉 **Note**: `search` was added in `CommonMark@0.31`. */ 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', 'search', 'section', 'summary', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul' ] /** * List of lowercase HTML “raw” tag names. * * The list, when parsing HTML (flow), results in HTML that can include lines * without exiting, until a closing tag also in this list is found (condition * 1). * * This module is copied from: * . * * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. */ const htmlRawNames = ['pre', 'script', 'style', 'textarea'] ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/html-flow.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const htmlFlow = { name: 'htmlFlow', tokenize: tokenizeHtmlFlow, resolveTo: resolveToHtmlFlow, concrete: true } /** @type {Construct} */ const blankLineBefore = { tokenize: tokenizeBlankLineBefore, partial: true } const nonLazyContinuationStart = { tokenize: tokenizeNonLazyContinuationStart, 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 } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeHtmlFlow(effects, ok, nok) { const self = this /** @type {number} */ let marker /** @type {boolean} */ let closingTag /** @type {string} */ let buffer /** @type {number} */ let index /** @type {Code} */ let markerB return start /** * Start of HTML (flow). * * ```markdown * > | * ^ * ``` * * @type {State} */ function start(code) { // To do: parse indent like `markdown-rs`. return before(code) } /** * At `<`, after optional whitespace. * * ```markdown * > | * ^ * ``` * * @type {State} */ function before(code) { effects.enter('htmlFlow') effects.enter('htmlFlowData') effects.consume(code) return open } /** * After `<`, at tag name or other stuff. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function open(code) { if (code === 33) { effects.consume(code) return declarationOpen } if (code === 47) { effects.consume(code) closingTag = true return tagCloseStart } if (code === 63) { effects.consume(code) marker = 3 // To do: // tokenizer.concrete = true // To do: use `markdown-rs` style interrupt. // 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 } // ASCII alphabetical. if (asciiAlpha(code)) { effects.consume(code) // @ts-expect-error: not null. buffer = String.fromCharCode(code) return tagName } return nok(code) } /** * After ` | * ^ * > | * ^ * > | &<]]> * ^ * ``` * * @type {State} */ function declarationOpen(code) { if (code === 45) { effects.consume(code) marker = 2 return commentOpenInside } if (code === 91) { effects.consume(code) marker = 5 index = 0 return cdataOpenInside } // ASCII alphabetical. if (asciiAlpha(code)) { effects.consume(code) marker = 4 // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok : continuationDeclarationInside } return nok(code) } /** * After ` | * ^ * ``` * * @type {State} */ function commentOpenInside(code) { if (code === 45) { effects.consume(code) // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok : continuationDeclarationInside } return nok(code) } /** * After ` | &<]]> * ^^^^^^ * ``` * * @type {State} */ function cdataOpenInside(code) { const value = 'CDATA[' if (code === value.charCodeAt(index++)) { effects.consume(code) if (index === value.length) { // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok : continuation } return cdataOpenInside } return nok(code) } /** * After ` | * ^ * ``` * * @type {State} */ function tagCloseStart(code) { if (asciiAlpha(code)) { effects.consume(code) // @ts-expect-error: not null. buffer = String.fromCharCode(code) return tagName } return nok(code) } /** * In tag name. * * ```markdown * > | * ^^ * > | * ^^ * ``` * * @type {State} */ function tagName(code) { if ( code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code) ) { const slash = code === 47 const name = buffer.toLowerCase() if (!slash && !closingTag && htmlRawNames.includes(name)) { marker = 1 // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok(code) : continuation(code) } if (htmlBlockNames.includes(buffer.toLowerCase())) { marker = 6 if (slash) { effects.consume(code) return basicSelfClosing } // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok(code) : continuation(code) } marker = 7 // Do not support complete HTML when interrupting. return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code) } // ASCII alphanumerical and `-`. if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) buffer += String.fromCharCode(code) return tagName } return nok(code) } /** * After closing slash of a basic tag name. * * ```markdown * > |
* ^ * ``` * * @type {State} */ function basicSelfClosing(code) { if (code === 62) { effects.consume(code) // // Do not form containers. // tokenizer.concrete = true return self.interrupt ? ok : continuation } return nok(code) } /** * After closing slash of a complete tag name. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeClosingTagAfter(code) { if (markdownSpace(code)) { effects.consume(code) return completeClosingTagAfter } return completeEnd(code) } /** * At an attribute name. * * At first, this state is used after a complete tag name, after whitespace, * where it expects optional attributes or the end of the tag. * It is also reused after attributes, when expecting more optional * attributes. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeNameBefore(code) { if (code === 47) { effects.consume(code) return completeEnd } // ASCII alphanumerical and `:` and `_`. if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code) return completeAttributeName } if (markdownSpace(code)) { effects.consume(code) return completeAttributeNameBefore } return completeEnd(code) } /** * In attribute name. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeName(code) { // ASCII alphanumerical and `-`, `.`, `:`, and `_`. if ( code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code) ) { effects.consume(code) return completeAttributeName } return completeAttributeNameAfter(code) } /** * After attribute name, at an optional initializer, the end of the tag, or * whitespace. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeNameAfter(code) { if (code === 61) { effects.consume(code) return completeAttributeValueBefore } if (markdownSpace(code)) { effects.consume(code) return completeAttributeNameAfter } return completeAttributeNameBefore(code) } /** * Before unquoted, double quoted, or single quoted attribute value, allowing * whitespace. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeValueBefore(code) { if ( code === null || code === 60 || code === 61 || code === 62 || code === 96 ) { return nok(code) } if (code === 34 || code === 39) { effects.consume(code) markerB = code return completeAttributeValueQuoted } if (markdownSpace(code)) { effects.consume(code) return completeAttributeValueBefore } return completeAttributeValueUnquoted(code) } /** * In double or single quoted attribute value. * * ```markdown * > | * ^ * > | * ^ * ``` * * @type {State} */ function completeAttributeValueQuoted(code) { if (code === markerB) { effects.consume(code) markerB = null return completeAttributeValueQuotedAfter } if (code === null || markdownLineEnding(code)) { return nok(code) } effects.consume(code) return completeAttributeValueQuoted } /** * In unquoted attribute value. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAttributeValueUnquoted(code) { if ( code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code) ) { return completeAttributeNameAfter(code) } effects.consume(code) return completeAttributeValueUnquoted } /** * After double or single quoted attribute value, before whitespace or the * end of the tag. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAttributeValueQuotedAfter(code) { if (code === 47 || code === 62 || markdownSpace(code)) { return completeAttributeNameBefore(code) } return nok(code) } /** * In certain circumstances of a complete tag where only an `>` is allowed. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeEnd(code) { if (code === 62) { effects.consume(code) return completeAfter } return nok(code) } /** * After `>` in a complete tag. * * ```markdown * > | * ^ * ``` * * @type {State} */ function completeAfter(code) { if (code === null || markdownLineEnding(code)) { // // Do not form containers. // tokenizer.concrete = true return continuation(code) } if (markdownSpace(code)) { effects.consume(code) return completeAfter } return nok(code) } /** * In continuation of any HTML kind. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuation(code) { if (code === 45 && marker === 2) { effects.consume(code) return continuationCommentInside } if (code === 60 && marker === 1) { effects.consume(code) return continuationRawTagOpen } if (code === 62 && marker === 4) { effects.consume(code) return continuationClose } if (code === 63 && marker === 3) { effects.consume(code) return continuationDeclarationInside } if (code === 93 && marker === 5) { effects.consume(code) return continuationCdataInside } if (markdownLineEnding(code) && (marker === 6 || marker === 7)) { effects.exit('htmlFlowData') return effects.check( blankLineBefore, continuationAfter, continuationStart )(code) } if (code === null || markdownLineEnding(code)) { effects.exit('htmlFlowData') return continuationStart(code) } effects.consume(code) return continuation } /** * In continuation, at eol. * * ```markdown * > | * ^ * | asd * ``` * * @type {State} */ function continuationStart(code) { return effects.check( nonLazyContinuationStart, continuationStartNonLazy, continuationAfter )(code) } /** * In continuation, at eol, before non-lazy content. * * ```markdown * > | * ^ * | asd * ``` * * @type {State} */ function continuationStartNonLazy(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return continuationBefore } /** * In continuation, before non-lazy content. * * ```markdown * | * > | asd * ^ * ``` * * @type {State} */ function continuationBefore(code) { if (code === null || markdownLineEnding(code)) { return continuationStart(code) } effects.enter('htmlFlowData') return continuation(code) } /** * In comment continuation, after one `-`, expecting another. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuationCommentInside(code) { if (code === 45) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** * In raw continuation, after `<`, at `/`. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuationRawTagOpen(code) { if (code === 47) { effects.consume(code) buffer = '' return continuationRawEndTag } return continuation(code) } /** * In raw continuation, after ` | * ^^^^^^ * ``` * * @type {State} */ function continuationRawEndTag(code) { if (code === 62) { const name = buffer.toLowerCase() if (htmlRawNames.includes(name)) { effects.consume(code) return continuationClose } return continuation(code) } if (asciiAlpha(code) && buffer.length < 8) { effects.consume(code) // @ts-expect-error: not null. buffer += String.fromCharCode(code) return continuationRawEndTag } return continuation(code) } /** * In cdata continuation, after `]`, expecting `]>`. * * ```markdown * > | &<]]> * ^ * ``` * * @type {State} */ function continuationCdataInside(code) { if (code === 93) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** * In declaration or instruction continuation, at `>`. * * ```markdown * > | * ^ * > | * ^ * > | * ^ * > | * ^ * > | &<]]> * ^ * ``` * * @type {State} */ function continuationDeclarationInside(code) { if (code === 62) { effects.consume(code) return continuationClose } // More dashes. if (code === 45 && marker === 2) { effects.consume(code) return continuationDeclarationInside } return continuation(code) } /** * In closed continuation: everything we get until the eol/eof is part of it. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuationClose(code) { if (code === null || markdownLineEnding(code)) { effects.exit('htmlFlowData') return continuationAfter(code) } effects.consume(code) return continuationClose } /** * Done. * * ```markdown * > | * ^ * ``` * * @type {State} */ function continuationAfter(code) { effects.exit('htmlFlow') // // Feel free to interrupt. // tokenizer.interrupt = false // // No longer concrete. // tokenizer.concrete = false return ok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeNonLazyContinuationStart(effects, ok, nok) { const self = this return start /** * At eol, before continuation. * * ```markdown * > | * ```js * ^ * | b * ``` * * @type {State} */ function start(code) { if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return after } return nok(code) } /** * A continuation. * * ```markdown * | * ```js * > | b * ^ * ``` * * @type {State} */ function after(code) { return self.parser.lazy[self.now().line] ? nok(code) : ok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeBlankLineBefore(effects, ok, nok) { return start /** * Before eol, expecting blank line. * * ```markdown * > |
* ^ * | * ``` * * @type {State} */ function start(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return effects.attempt(blankLine, ok, nok) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/code-fenced.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const nonLazyContinuation = { tokenize: tokenizeNonLazyContinuation, partial: true } /** @type {Construct} */ const codeFenced = { name: 'codeFenced', tokenize: tokenizeCodeFenced, concrete: true } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCodeFenced(effects, ok, nok) { const self = this /** @type {Construct} */ const closeStart = { tokenize: tokenizeCloseStart, partial: true } let initialPrefix = 0 let sizeOpen = 0 /** @type {NonNullable} */ let marker return start /** * Start of code. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function start(code) { // To do: parse whitespace like `markdown-rs`. return beforeSequenceOpen(code) } /** * In opening fence, after prefix, at sequence. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function beforeSequenceOpen(code) { const tail = self.events[self.events.length - 1] initialPrefix = tail && tail[1].type === 'linePrefix' ? tail[2].sliceSerialize(tail[1], true).length : 0 marker = code effects.enter('codeFenced') effects.enter('codeFencedFence') effects.enter('codeFencedFenceSequence') return sequenceOpen(code) } /** * In opening fence sequence. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === marker) { sizeOpen++ effects.consume(code) return sequenceOpen } if (sizeOpen < 3) { return nok(code) } effects.exit('codeFencedFenceSequence') return markdownSpace(code) ? factorySpace(effects, infoBefore, 'whitespace')(code) : infoBefore(code) } /** * In opening fence, after the sequence (and optional whitespace), before info. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function infoBefore(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFencedFence') return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) } effects.enter('codeFencedFenceInfo') effects.enter('chunkString', { contentType: 'string' }) return info(code) } /** * In info. * * ```markdown * > | ~~~js * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function info(code) { if (code === null || markdownLineEnding(code)) { effects.exit('chunkString') effects.exit('codeFencedFenceInfo') return infoBefore(code) } if (markdownSpace(code)) { effects.exit('chunkString') effects.exit('codeFencedFenceInfo') return factorySpace(effects, metaBefore, 'whitespace')(code) } if (code === 96 && code === marker) { return nok(code) } effects.consume(code) return info } /** * In opening fence, after info and whitespace, before meta. * * ```markdown * > | ~~~js eval * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function metaBefore(code) { if (code === null || markdownLineEnding(code)) { return infoBefore(code) } effects.enter('codeFencedFenceMeta') effects.enter('chunkString', { contentType: 'string' }) return meta(code) } /** * In meta. * * ```markdown * > | ~~~js eval * ^ * | alert(1) * | ~~~ * ``` * * @type {State} */ function meta(code) { if (code === null || markdownLineEnding(code)) { effects.exit('chunkString') effects.exit('codeFencedFenceMeta') return infoBefore(code) } if (code === 96 && code === marker) { return nok(code) } effects.consume(code) return meta } /** * At eol/eof in code, before a non-lazy closing fence or content. * * ```markdown * > | ~~~js * ^ * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function atNonLazyBreak(code) { return effects.attempt(closeStart, after, contentBefore)(code) } /** * Before code content, not a closing fence, at eol. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function contentBefore(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return contentStart } /** * Before code content, not a closing fence. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function contentStart(code) { return initialPrefix > 0 && markdownSpace(code) ? factorySpace( effects, beforeContentChunk, 'linePrefix', initialPrefix + 1 )(code) : beforeContentChunk(code) } /** * Before code content, after optional prefix. * * ```markdown * | ~~~js * > | alert(1) * ^ * | ~~~ * ``` * * @type {State} */ function beforeContentChunk(code) { if (code === null || markdownLineEnding(code)) { return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) } effects.enter('codeFlowValue') return contentChunk(code) } /** * In code content. * * ```markdown * | ~~~js * > | alert(1) * ^^^^^^^^ * | ~~~ * ``` * * @type {State} */ function contentChunk(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue') return beforeContentChunk(code) } effects.consume(code) return contentChunk } /** * After code. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function after(code) { effects.exit('codeFenced') return ok(code) } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCloseStart(effects, ok, nok) { let size = 0 return startBefore /** * * * @type {State} */ function startBefore(code) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return start } /** * Before closing fence, at optional whitespace. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function start(code) { // Always populated by defaults. // To do: `enter` here or in next state? effects.enter('codeFencedFence') return markdownSpace(code) ? factorySpace( effects, beforeSequenceClose, 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) : beforeSequenceClose(code) } /** * In closing fence, after optional whitespace, at sequence. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function beforeSequenceClose(code) { if (code === marker) { effects.enter('codeFencedFenceSequence') return sequenceClose(code) } return nok(code) } /** * In closing fence sequence. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function sequenceClose(code) { if (code === marker) { size++ effects.consume(code) return sequenceClose } if (size >= sizeOpen) { effects.exit('codeFencedFenceSequence') return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code) : sequenceCloseAfter(code) } return nok(code) } /** * After closing fence sequence, after optional whitespace. * * ```markdown * | ~~~js * | alert(1) * > | ~~~ * ^ * ``` * * @type {State} */ function sequenceCloseAfter(code) { if (code === null || markdownLineEnding(code)) { effects.exit('codeFencedFence') return ok(code) } return nok(code) } } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeNonLazyContinuation(effects, ok, nok) { const self = this return start /** * * * @type {State} */ function start(code) { if (code === null) { return nok(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) } } ;// CONCATENATED MODULE: ./node_modules/character-entities/index.js /** * Map of named character references. * * @type {Record} */ const characterEntities = { AElig: 'Æ', AMP: '&', Aacute: 'Á', Abreve: 'Ă', Acirc: 'Â', Acy: 'А', Afr: '𝔄', Agrave: 'À', Alpha: 'Α', Amacr: 'Ā', And: '⩓', Aogon: 'Ą', Aopf: '𝔸', ApplyFunction: '⁡', Aring: 'Å', Ascr: '𝒜', Assign: '≔', Atilde: 'Ã', Auml: 'Ä', Backslash: '∖', Barv: '⫧', Barwed: '⌆', Bcy: 'Б', Because: '∵', Bernoullis: 'ℬ', Beta: 'Β', Bfr: '𝔅', Bopf: '𝔹', Breve: '˘', Bscr: 'ℬ', Bumpeq: '≎', CHcy: 'Ч', COPY: '©', Cacute: 'Ć', Cap: '⋒', CapitalDifferentialD: 'ⅅ', Cayleys: 'ℭ', Ccaron: 'Č', Ccedil: 'Ç', Ccirc: 'Ĉ', Cconint: '∰', Cdot: 'Ċ', Cedilla: '¸', CenterDot: '·', Cfr: 'ℭ', Chi: 'Χ', CircleDot: '⊙', CircleMinus: '⊖', CirclePlus: '⊕', CircleTimes: '⊗', ClockwiseContourIntegral: '∲', CloseCurlyDoubleQuote: '”', CloseCurlyQuote: '’', Colon: '∷', Colone: '⩴', Congruent: '≡', Conint: '∯', ContourIntegral: '∮', Copf: 'ℂ', Coproduct: '∐', CounterClockwiseContourIntegral: '∳', Cross: '⨯', Cscr: '𝒞', Cup: '⋓', CupCap: '≍', DD: 'ⅅ', DDotrahd: '⤑', DJcy: 'Ђ', DScy: 'Ѕ', DZcy: 'Џ', Dagger: '‡', Darr: '↡', Dashv: '⫤', Dcaron: 'Ď', Dcy: 'Д', Del: '∇', Delta: 'Δ', Dfr: '𝔇', DiacriticalAcute: '´', DiacriticalDot: '˙', DiacriticalDoubleAcute: '˝', DiacriticalGrave: '`', DiacriticalTilde: '˜', Diamond: '⋄', DifferentialD: 'ⅆ', Dopf: '𝔻', Dot: '¨', DotDot: '⃜', DotEqual: '≐', DoubleContourIntegral: '∯', DoubleDot: '¨', DoubleDownArrow: '⇓', DoubleLeftArrow: '⇐', DoubleLeftRightArrow: '⇔', DoubleLeftTee: '⫤', DoubleLongLeftArrow: '⟸', DoubleLongLeftRightArrow: '⟺', DoubleLongRightArrow: '⟹', DoubleRightArrow: '⇒', DoubleRightTee: '⊨', DoubleUpArrow: '⇑', DoubleUpDownArrow: '⇕', DoubleVerticalBar: '∥', DownArrow: '↓', DownArrowBar: '⤓', DownArrowUpArrow: '⇵', DownBreve: '̑', DownLeftRightVector: '⥐', DownLeftTeeVector: '⥞', DownLeftVector: '↽', DownLeftVectorBar: '⥖', DownRightTeeVector: '⥟', DownRightVector: '⇁', DownRightVectorBar: '⥗', DownTee: '⊤', DownTeeArrow: '↧', Downarrow: '⇓', Dscr: '𝒟', Dstrok: 'Đ', ENG: 'Ŋ', ETH: 'Ð', Eacute: 'É', Ecaron: 'Ě', Ecirc: 'Ê', Ecy: 'Э', Edot: 'Ė', Efr: '𝔈', Egrave: 'È', Element: '∈', Emacr: 'Ē', EmptySmallSquare: '◻', EmptyVerySmallSquare: '▫', Eogon: 'Ę', Eopf: '𝔼', Epsilon: 'Ε', Equal: '⩵', EqualTilde: '≂', Equilibrium: '⇌', Escr: 'ℰ', Esim: '⩳', Eta: 'Η', Euml: 'Ë', Exists: '∃', ExponentialE: 'ⅇ', Fcy: 'Ф', Ffr: '𝔉', FilledSmallSquare: '◼', FilledVerySmallSquare: '▪', Fopf: '𝔽', ForAll: '∀', Fouriertrf: 'ℱ', Fscr: 'ℱ', GJcy: 'Ѓ', GT: '>', Gamma: 'Γ', Gammad: 'Ϝ', Gbreve: 'Ğ', Gcedil: 'Ģ', Gcirc: 'Ĝ', Gcy: 'Г', Gdot: 'Ġ', Gfr: '𝔊', Gg: '⋙', Gopf: '𝔾', GreaterEqual: '≥', GreaterEqualLess: '⋛', GreaterFullEqual: '≧', GreaterGreater: '⪢', GreaterLess: '≷', GreaterSlantEqual: '⩾', GreaterTilde: '≳', Gscr: '𝒢', Gt: '≫', HARDcy: 'Ъ', Hacek: 'ˇ', Hat: '^', Hcirc: 'Ĥ', Hfr: 'ℌ', HilbertSpace: 'ℋ', Hopf: 'ℍ', HorizontalLine: '─', Hscr: 'ℋ', Hstrok: 'Ħ', HumpDownHump: '≎', HumpEqual: '≏', IEcy: 'Е', IJlig: 'IJ', IOcy: 'Ё', Iacute: 'Í', Icirc: 'Î', Icy: 'И', Idot: 'İ', Ifr: 'ℑ', Igrave: 'Ì', Im: 'ℑ', Imacr: 'Ī', ImaginaryI: 'ⅈ', Implies: '⇒', Int: '∬', Integral: '∫', Intersection: '⋂', InvisibleComma: '⁣', InvisibleTimes: '⁢', Iogon: 'Į', Iopf: '𝕀', Iota: 'Ι', Iscr: 'ℐ', Itilde: 'Ĩ', Iukcy: 'І', Iuml: 'Ï', Jcirc: 'Ĵ', Jcy: 'Й', Jfr: '𝔍', Jopf: '𝕁', Jscr: '𝒥', Jsercy: 'Ј', Jukcy: 'Є', KHcy: 'Х', KJcy: 'Ќ', Kappa: 'Κ', Kcedil: 'Ķ', Kcy: 'К', Kfr: '𝔎', Kopf: '𝕂', Kscr: '𝒦', LJcy: 'Љ', LT: '<', Lacute: 'Ĺ', Lambda: 'Λ', Lang: '⟪', Laplacetrf: 'ℒ', Larr: '↞', Lcaron: 'Ľ', Lcedil: 'Ļ', Lcy: 'Л', LeftAngleBracket: '⟨', LeftArrow: '←', LeftArrowBar: '⇤', LeftArrowRightArrow: '⇆', LeftCeiling: '⌈', LeftDoubleBracket: '⟦', LeftDownTeeVector: '⥡', LeftDownVector: '⇃', LeftDownVectorBar: '⥙', LeftFloor: '⌊', LeftRightArrow: '↔', LeftRightVector: '⥎', LeftTee: '⊣', LeftTeeArrow: '↤', LeftTeeVector: '⥚', LeftTriangle: '⊲', LeftTriangleBar: '⧏', LeftTriangleEqual: '⊴', LeftUpDownVector: '⥑', LeftUpTeeVector: '⥠', LeftUpVector: '↿', LeftUpVectorBar: '⥘', LeftVector: '↼', LeftVectorBar: '⥒', Leftarrow: '⇐', Leftrightarrow: '⇔', LessEqualGreater: '⋚', LessFullEqual: '≦', LessGreater: '≶', LessLess: '⪡', LessSlantEqual: '⩽', LessTilde: '≲', Lfr: '𝔏', Ll: '⋘', Lleftarrow: '⇚', Lmidot: 'Ŀ', LongLeftArrow: '⟵', LongLeftRightArrow: '⟷', LongRightArrow: '⟶', Longleftarrow: '⟸', Longleftrightarrow: '⟺', Longrightarrow: '⟹', Lopf: '𝕃', LowerLeftArrow: '↙', LowerRightArrow: '↘', Lscr: 'ℒ', Lsh: '↰', Lstrok: 'Ł', Lt: '≪', Map: '⤅', Mcy: 'М', MediumSpace: ' ', Mellintrf: 'ℳ', Mfr: '𝔐', MinusPlus: '∓', Mopf: '𝕄', Mscr: 'ℳ', Mu: 'Μ', NJcy: 'Њ', Nacute: 'Ń', Ncaron: 'Ň', Ncedil: 'Ņ', Ncy: 'Н', NegativeMediumSpace: '​', NegativeThickSpace: '​', NegativeThinSpace: '​', NegativeVeryThinSpace: '​', NestedGreaterGreater: '≫', NestedLessLess: '≪', NewLine: '\n', Nfr: '𝔑', NoBreak: '⁠', NonBreakingSpace: ' ', Nopf: 'ℕ', Not: '⫬', NotCongruent: '≢', NotCupCap: '≭', NotDoubleVerticalBar: '∦', NotElement: '∉', NotEqual: '≠', NotEqualTilde: '≂̸', NotExists: '∄', NotGreater: '≯', NotGreaterEqual: '≱', NotGreaterFullEqual: '≧̸', NotGreaterGreater: '≫̸', NotGreaterLess: '≹', NotGreaterSlantEqual: '⩾̸', NotGreaterTilde: '≵', NotHumpDownHump: '≎̸', NotHumpEqual: '≏̸', NotLeftTriangle: '⋪', NotLeftTriangleBar: '⧏̸', NotLeftTriangleEqual: '⋬', NotLess: '≮', NotLessEqual: '≰', NotLessGreater: '≸', NotLessLess: '≪̸', NotLessSlantEqual: '⩽̸', NotLessTilde: '≴', NotNestedGreaterGreater: '⪢̸', NotNestedLessLess: '⪡̸', NotPrecedes: '⊀', NotPrecedesEqual: '⪯̸', NotPrecedesSlantEqual: '⋠', NotReverseElement: '∌', NotRightTriangle: '⋫', NotRightTriangleBar: '⧐̸', NotRightTriangleEqual: '⋭', NotSquareSubset: '⊏̸', NotSquareSubsetEqual: '⋢', NotSquareSuperset: '⊐̸', NotSquareSupersetEqual: '⋣', NotSubset: '⊂⃒', NotSubsetEqual: '⊈', NotSucceeds: '⊁', NotSucceedsEqual: '⪰̸', NotSucceedsSlantEqual: '⋡', NotSucceedsTilde: '≿̸', NotSuperset: '⊃⃒', NotSupersetEqual: '⊉', NotTilde: '≁', NotTildeEqual: '≄', NotTildeFullEqual: '≇', NotTildeTilde: '≉', NotVerticalBar: '∤', Nscr: '𝒩', Ntilde: 'Ñ', Nu: 'Ν', OElig: 'Œ', Oacute: 'Ó', Ocirc: 'Ô', Ocy: 'О', Odblac: 'Ő', Ofr: '𝔒', Ograve: 'Ò', Omacr: 'Ō', Omega: 'Ω', Omicron: 'Ο', Oopf: '𝕆', OpenCurlyDoubleQuote: '“', OpenCurlyQuote: '‘', Or: '⩔', Oscr: '𝒪', Oslash: 'Ø', Otilde: 'Õ', Otimes: '⨷', Ouml: 'Ö', OverBar: '‾', OverBrace: '⏞', OverBracket: '⎴', OverParenthesis: '⏜', PartialD: '∂', Pcy: 'П', Pfr: '𝔓', Phi: 'Φ', Pi: 'Π', PlusMinus: '±', Poincareplane: 'ℌ', Popf: 'ℙ', Pr: '⪻', Precedes: '≺', PrecedesEqual: '⪯', PrecedesSlantEqual: '≼', PrecedesTilde: '≾', Prime: '″', Product: '∏', Proportion: '∷', Proportional: '∝', Pscr: '𝒫', Psi: 'Ψ', QUOT: '"', Qfr: '𝔔', Qopf: 'ℚ', Qscr: '𝒬', RBarr: '⤐', REG: '®', Racute: 'Ŕ', Rang: '⟫', Rarr: '↠', Rarrtl: '⤖', Rcaron: 'Ř', Rcedil: 'Ŗ', Rcy: 'Р', Re: 'ℜ', ReverseElement: '∋', ReverseEquilibrium: '⇋', ReverseUpEquilibrium: '⥯', Rfr: 'ℜ', Rho: 'Ρ', RightAngleBracket: '⟩', RightArrow: '→', RightArrowBar: '⇥', RightArrowLeftArrow: '⇄', RightCeiling: '⌉', RightDoubleBracket: '⟧', RightDownTeeVector: '⥝', RightDownVector: '⇂', RightDownVectorBar: '⥕', RightFloor: '⌋', RightTee: '⊢', RightTeeArrow: '↦', RightTeeVector: '⥛', RightTriangle: '⊳', RightTriangleBar: '⧐', RightTriangleEqual: '⊵', RightUpDownVector: '⥏', RightUpTeeVector: '⥜', RightUpVector: '↾', RightUpVectorBar: '⥔', RightVector: '⇀', RightVectorBar: '⥓', Rightarrow: '⇒', Ropf: 'ℝ', RoundImplies: '⥰', Rrightarrow: '⇛', Rscr: 'ℛ', Rsh: '↱', RuleDelayed: '⧴', SHCHcy: 'Щ', SHcy: 'Ш', SOFTcy: 'Ь', Sacute: 'Ś', Sc: '⪼', Scaron: 'Š', Scedil: 'Ş', Scirc: 'Ŝ', Scy: 'С', Sfr: '𝔖', ShortDownArrow: '↓', ShortLeftArrow: '←', ShortRightArrow: '→', ShortUpArrow: '↑', Sigma: 'Σ', SmallCircle: '∘', Sopf: '𝕊', Sqrt: '√', Square: '□', SquareIntersection: '⊓', SquareSubset: '⊏', SquareSubsetEqual: '⊑', SquareSuperset: '⊐', SquareSupersetEqual: '⊒', SquareUnion: '⊔', Sscr: '𝒮', Star: '⋆', Sub: '⋐', Subset: '⋐', SubsetEqual: '⊆', Succeeds: '≻', SucceedsEqual: '⪰', SucceedsSlantEqual: '≽', SucceedsTilde: '≿', SuchThat: '∋', Sum: '∑', Sup: '⋑', Superset: '⊃', SupersetEqual: '⊇', Supset: '⋑', THORN: 'Þ', TRADE: '™', TSHcy: 'Ћ', TScy: 'Ц', Tab: '\t', Tau: 'Τ', Tcaron: 'Ť', Tcedil: 'Ţ', Tcy: 'Т', Tfr: '𝔗', Therefore: '∴', Theta: 'Θ', ThickSpace: '  ', ThinSpace: ' ', Tilde: '∼', TildeEqual: '≃', TildeFullEqual: '≅', TildeTilde: '≈', Topf: '𝕋', TripleDot: '⃛', Tscr: '𝒯', Tstrok: 'Ŧ', Uacute: 'Ú', Uarr: '↟', Uarrocir: '⥉', Ubrcy: 'Ў', Ubreve: 'Ŭ', Ucirc: 'Û', Ucy: 'У', Udblac: 'Ű', Ufr: '𝔘', Ugrave: 'Ù', Umacr: 'Ū', UnderBar: '_', UnderBrace: '⏟', UnderBracket: '⎵', UnderParenthesis: '⏝', Union: '⋃', UnionPlus: '⊎', Uogon: 'Ų', Uopf: '𝕌', UpArrow: '↑', UpArrowBar: '⤒', UpArrowDownArrow: '⇅', UpDownArrow: '↕', UpEquilibrium: '⥮', UpTee: '⊥', UpTeeArrow: '↥', Uparrow: '⇑', Updownarrow: '⇕', UpperLeftArrow: '↖', UpperRightArrow: '↗', Upsi: 'ϒ', Upsilon: 'Υ', Uring: 'Ů', Uscr: '𝒰', Utilde: 'Ũ', Uuml: 'Ü', VDash: '⊫', Vbar: '⫫', Vcy: 'В', Vdash: '⊩', Vdashl: '⫦', Vee: '⋁', Verbar: '‖', Vert: '‖', VerticalBar: '∣', VerticalLine: '|', VerticalSeparator: '❘', VerticalTilde: '≀', VeryThinSpace: ' ', Vfr: '𝔙', Vopf: '𝕍', Vscr: '𝒱', Vvdash: '⊪', Wcirc: 'Ŵ', Wedge: '⋀', Wfr: '𝔚', Wopf: '𝕎', Wscr: '𝒲', Xfr: '𝔛', Xi: 'Ξ', Xopf: '𝕏', Xscr: '𝒳', YAcy: 'Я', YIcy: 'Ї', YUcy: 'Ю', Yacute: 'Ý', Ycirc: 'Ŷ', Ycy: 'Ы', Yfr: '𝔜', Yopf: '𝕐', Yscr: '𝒴', Yuml: 'Ÿ', ZHcy: 'Ж', Zacute: 'Ź', Zcaron: 'Ž', Zcy: 'З', Zdot: 'Ż', ZeroWidthSpace: '​', Zeta: 'Ζ', Zfr: 'ℨ', Zopf: 'ℤ', Zscr: '𝒵', aacute: 'á', abreve: 'ă', ac: '∾', acE: '∾̳', acd: '∿', acirc: 'â', acute: '´', acy: 'а', aelig: 'æ', af: '⁡', afr: '𝔞', agrave: 'à', alefsym: 'ℵ', aleph: 'ℵ', alpha: 'α', amacr: 'ā', amalg: '⨿', amp: '&', and: '∧', andand: '⩕', andd: '⩜', andslope: '⩘', andv: '⩚', ang: '∠', ange: '⦤', angle: '∠', angmsd: '∡', angmsdaa: '⦨', angmsdab: '⦩', angmsdac: '⦪', angmsdad: '⦫', angmsdae: '⦬', angmsdaf: '⦭', angmsdag: '⦮', angmsdah: '⦯', angrt: '∟', angrtvb: '⊾', angrtvbd: '⦝', angsph: '∢', angst: 'Å', angzarr: '⍼', aogon: 'ą', aopf: '𝕒', ap: '≈', apE: '⩰', apacir: '⩯', ape: '≊', apid: '≋', apos: "'", approx: '≈', approxeq: '≊', aring: 'å', ascr: '𝒶', ast: '*', asymp: '≈', asympeq: '≍', atilde: 'ã', auml: 'ä', awconint: '∳', awint: '⨑', bNot: '⫭', backcong: '≌', backepsilon: '϶', backprime: '‵', backsim: '∽', backsimeq: '⋍', barvee: '⊽', barwed: '⌅', barwedge: '⌅', bbrk: '⎵', bbrktbrk: '⎶', bcong: '≌', bcy: 'б', bdquo: '„', becaus: '∵', because: '∵', bemptyv: '⦰', bepsi: '϶', bernou: 'ℬ', beta: 'β', beth: 'ℶ', between: '≬', bfr: '𝔟', bigcap: '⋂', bigcirc: '◯', bigcup: '⋃', bigodot: '⨀', bigoplus: '⨁', bigotimes: '⨂', bigsqcup: '⨆', bigstar: '★', bigtriangledown: '▽', bigtriangleup: '△', biguplus: '⨄', bigvee: '⋁', bigwedge: '⋀', bkarow: '⤍', blacklozenge: '⧫', blacksquare: '▪', blacktriangle: '▴', blacktriangledown: '▾', blacktriangleleft: '◂', blacktriangleright: '▸', blank: '␣', blk12: '▒', blk14: '░', blk34: '▓', block: '█', bne: '=⃥', bnequiv: '≡⃥', bnot: '⌐', bopf: '𝕓', bot: '⊥', bottom: '⊥', bowtie: '⋈', boxDL: '╗', boxDR: '╔', boxDl: '╖', boxDr: '╓', boxH: '═', boxHD: '╦', boxHU: '╩', boxHd: '╤', boxHu: '╧', boxUL: '╝', boxUR: '╚', boxUl: '╜', boxUr: '╙', boxV: '║', boxVH: '╬', boxVL: '╣', boxVR: '╠', boxVh: '╫', boxVl: '╢', boxVr: '╟', boxbox: '⧉', boxdL: '╕', boxdR: '╒', boxdl: '┐', boxdr: '┌', boxh: '─', boxhD: '╥', boxhU: '╨', boxhd: '┬', boxhu: '┴', boxminus: '⊟', boxplus: '⊞', boxtimes: '⊠', boxuL: '╛', boxuR: '╘', boxul: '┘', boxur: '└', boxv: '│', boxvH: '╪', boxvL: '╡', boxvR: '╞', boxvh: '┼', boxvl: '┤', boxvr: '├', bprime: '‵', breve: '˘', brvbar: '¦', bscr: '𝒷', bsemi: '⁏', bsim: '∽', bsime: '⋍', bsol: '\\', bsolb: '⧅', bsolhsub: '⟈', bull: '•', bullet: '•', bump: '≎', bumpE: '⪮', bumpe: '≏', bumpeq: '≏', cacute: 'ć', cap: '∩', capand: '⩄', capbrcup: '⩉', capcap: '⩋', capcup: '⩇', capdot: '⩀', caps: '∩︀', caret: '⁁', caron: 'ˇ', ccaps: '⩍', ccaron: 'č', ccedil: 'ç', ccirc: 'ĉ', ccups: '⩌', ccupssm: '⩐', cdot: 'ċ', cedil: '¸', cemptyv: '⦲', cent: '¢', centerdot: '·', cfr: '𝔠', chcy: 'ч', check: '✓', checkmark: '✓', chi: 'χ', cir: '○', cirE: '⧃', circ: 'ˆ', circeq: '≗', circlearrowleft: '↺', circlearrowright: '↻', circledR: '®', circledS: 'Ⓢ', circledast: '⊛', circledcirc: '⊚', circleddash: '⊝', cire: '≗', cirfnint: '⨐', cirmid: '⫯', cirscir: '⧂', clubs: '♣', clubsuit: '♣', colon: ':', colone: '≔', coloneq: '≔', comma: ',', commat: '@', comp: '∁', compfn: '∘', complement: '∁', complexes: 'ℂ', cong: '≅', congdot: '⩭', conint: '∮', copf: '𝕔', coprod: '∐', copy: '©', copysr: '℗', crarr: '↵', cross: '✗', cscr: '𝒸', csub: '⫏', csube: '⫑', csup: '⫐', csupe: '⫒', ctdot: '⋯', cudarrl: '⤸', cudarrr: '⤵', cuepr: '⋞', cuesc: '⋟', cularr: '↶', cularrp: '⤽', cup: '∪', cupbrcap: '⩈', cupcap: '⩆', cupcup: '⩊', cupdot: '⊍', cupor: '⩅', cups: '∪︀', curarr: '↷', curarrm: '⤼', curlyeqprec: '⋞', curlyeqsucc: '⋟', curlyvee: '⋎', curlywedge: '⋏', curren: '¤', curvearrowleft: '↶', curvearrowright: '↷', cuvee: '⋎', cuwed: '⋏', cwconint: '∲', cwint: '∱', cylcty: '⌭', dArr: '⇓', dHar: '⥥', dagger: '†', daleth: 'ℸ', darr: '↓', dash: '‐', dashv: '⊣', dbkarow: '⤏', dblac: '˝', dcaron: 'ď', dcy: 'д', dd: 'ⅆ', ddagger: '‡', ddarr: '⇊', ddotseq: '⩷', deg: '°', delta: 'δ', demptyv: '⦱', dfisht: '⥿', dfr: '𝔡', dharl: '⇃', dharr: '⇂', diam: '⋄', diamond: '⋄', diamondsuit: '♦', diams: '♦', die: '¨', digamma: 'ϝ', disin: '⋲', div: '÷', divide: '÷', divideontimes: '⋇', divonx: '⋇', djcy: 'ђ', dlcorn: '⌞', dlcrop: '⌍', dollar: '$', dopf: '𝕕', dot: '˙', doteq: '≐', doteqdot: '≑', dotminus: '∸', dotplus: '∔', dotsquare: '⊡', doublebarwedge: '⌆', downarrow: '↓', downdownarrows: '⇊', downharpoonleft: '⇃', downharpoonright: '⇂', drbkarow: '⤐', drcorn: '⌟', drcrop: '⌌', dscr: '𝒹', dscy: 'ѕ', dsol: '⧶', dstrok: 'đ', dtdot: '⋱', dtri: '▿', dtrif: '▾', duarr: '⇵', duhar: '⥯', dwangle: '⦦', dzcy: 'џ', dzigrarr: '⟿', eDDot: '⩷', eDot: '≑', eacute: 'é', easter: '⩮', ecaron: 'ě', ecir: '≖', ecirc: 'ê', ecolon: '≕', ecy: 'э', edot: 'ė', ee: 'ⅇ', efDot: '≒', efr: '𝔢', eg: '⪚', egrave: 'è', egs: '⪖', egsdot: '⪘', el: '⪙', elinters: '⏧', ell: 'ℓ', els: '⪕', elsdot: '⪗', emacr: 'ē', empty: '∅', emptyset: '∅', emptyv: '∅', emsp13: ' ', emsp14: ' ', emsp: ' ', eng: 'ŋ', ensp: ' ', eogon: 'ę', eopf: '𝕖', epar: '⋕', eparsl: '⧣', eplus: '⩱', epsi: 'ε', epsilon: 'ε', epsiv: 'ϵ', eqcirc: '≖', eqcolon: '≕', eqsim: '≂', eqslantgtr: '⪖', eqslantless: '⪕', equals: '=', equest: '≟', equiv: '≡', equivDD: '⩸', eqvparsl: '⧥', erDot: '≓', erarr: '⥱', escr: 'ℯ', esdot: '≐', esim: '≂', eta: 'η', eth: 'ð', euml: 'ë', euro: '€', excl: '!', exist: '∃', expectation: 'ℰ', exponentiale: 'ⅇ', fallingdotseq: '≒', fcy: 'ф', female: '♀', ffilig: 'ffi', fflig: 'ff', ffllig: 'ffl', ffr: '𝔣', filig: 'fi', fjlig: 'fj', flat: '♭', fllig: 'fl', fltns: '▱', fnof: 'ƒ', fopf: '𝕗', forall: '∀', fork: '⋔', forkv: '⫙', fpartint: '⨍', frac12: '½', frac13: '⅓', frac14: '¼', frac15: '⅕', frac16: '⅙', frac18: '⅛', frac23: '⅔', frac25: '⅖', frac34: '¾', frac35: '⅗', frac38: '⅜', frac45: '⅘', frac56: '⅚', frac58: '⅝', frac78: '⅞', frasl: '⁄', frown: '⌢', fscr: '𝒻', gE: '≧', gEl: '⪌', gacute: 'ǵ', gamma: 'γ', gammad: 'ϝ', gap: '⪆', gbreve: 'ğ', gcirc: 'ĝ', gcy: 'г', gdot: 'ġ', ge: '≥', gel: '⋛', geq: '≥', geqq: '≧', geqslant: '⩾', ges: '⩾', gescc: '⪩', gesdot: '⪀', gesdoto: '⪂', gesdotol: '⪄', gesl: '⋛︀', gesles: '⪔', gfr: '𝔤', gg: '≫', ggg: '⋙', gimel: 'ℷ', gjcy: 'ѓ', gl: '≷', glE: '⪒', gla: '⪥', glj: '⪤', gnE: '≩', gnap: '⪊', gnapprox: '⪊', gne: '⪈', gneq: '⪈', gneqq: '≩', gnsim: '⋧', gopf: '𝕘', grave: '`', gscr: 'ℊ', gsim: '≳', gsime: '⪎', gsiml: '⪐', gt: '>', gtcc: '⪧', gtcir: '⩺', gtdot: '⋗', gtlPar: '⦕', gtquest: '⩼', gtrapprox: '⪆', gtrarr: '⥸', gtrdot: '⋗', gtreqless: '⋛', gtreqqless: '⪌', gtrless: '≷', gtrsim: '≳', gvertneqq: '≩︀', gvnE: '≩︀', hArr: '⇔', hairsp: ' ', half: '½', hamilt: 'ℋ', hardcy: 'ъ', harr: '↔', harrcir: '⥈', harrw: '↭', hbar: 'ℏ', hcirc: 'ĥ', hearts: '♥', heartsuit: '♥', hellip: '…', hercon: '⊹', hfr: '𝔥', hksearow: '⤥', hkswarow: '⤦', hoarr: '⇿', homtht: '∻', hookleftarrow: '↩', hookrightarrow: '↪', hopf: '𝕙', horbar: '―', hscr: '𝒽', hslash: 'ℏ', hstrok: 'ħ', hybull: '⁃', hyphen: '‐', iacute: 'í', ic: '⁣', icirc: 'î', icy: 'и', iecy: 'е', iexcl: '¡', iff: '⇔', ifr: '𝔦', igrave: 'ì', ii: 'ⅈ', iiiint: '⨌', iiint: '∭', iinfin: '⧜', iiota: '℩', ijlig: 'ij', imacr: 'ī', image: 'ℑ', imagline: 'ℐ', imagpart: 'ℑ', imath: 'ı', imof: '⊷', imped: 'Ƶ', in: '∈', incare: '℅', infin: '∞', infintie: '⧝', inodot: 'ı', int: '∫', intcal: '⊺', integers: 'ℤ', intercal: '⊺', intlarhk: '⨗', intprod: '⨼', iocy: 'ё', iogon: 'į', iopf: '𝕚', iota: 'ι', iprod: '⨼', iquest: '¿', iscr: '𝒾', isin: '∈', isinE: '⋹', isindot: '⋵', isins: '⋴', isinsv: '⋳', isinv: '∈', it: '⁢', itilde: 'ĩ', iukcy: 'і', iuml: 'ï', jcirc: 'ĵ', jcy: 'й', jfr: '𝔧', jmath: 'ȷ', jopf: '𝕛', jscr: '𝒿', jsercy: 'ј', jukcy: 'є', kappa: 'κ', kappav: 'ϰ', kcedil: 'ķ', kcy: 'к', kfr: '𝔨', kgreen: 'ĸ', khcy: 'х', kjcy: 'ќ', kopf: '𝕜', kscr: '𝓀', lAarr: '⇚', lArr: '⇐', lAtail: '⤛', lBarr: '⤎', lE: '≦', lEg: '⪋', lHar: '⥢', lacute: 'ĺ', laemptyv: '⦴', lagran: 'ℒ', lambda: 'λ', lang: '⟨', langd: '⦑', langle: '⟨', lap: '⪅', laquo: '«', larr: '←', larrb: '⇤', larrbfs: '⤟', larrfs: '⤝', larrhk: '↩', larrlp: '↫', larrpl: '⤹', larrsim: '⥳', larrtl: '↢', lat: '⪫', latail: '⤙', late: '⪭', lates: '⪭︀', lbarr: '⤌', lbbrk: '❲', lbrace: '{', lbrack: '[', lbrke: '⦋', lbrksld: '⦏', lbrkslu: '⦍', lcaron: 'ľ', lcedil: 'ļ', lceil: '⌈', lcub: '{', lcy: 'л', ldca: '⤶', ldquo: '“', ldquor: '„', ldrdhar: '⥧', ldrushar: '⥋', ldsh: '↲', le: '≤', leftarrow: '←', leftarrowtail: '↢', leftharpoondown: '↽', leftharpoonup: '↼', leftleftarrows: '⇇', leftrightarrow: '↔', leftrightarrows: '⇆', leftrightharpoons: '⇋', leftrightsquigarrow: '↭', leftthreetimes: '⋋', leg: '⋚', leq: '≤', leqq: '≦', leqslant: '⩽', les: '⩽', lescc: '⪨', lesdot: '⩿', lesdoto: '⪁', lesdotor: '⪃', lesg: '⋚︀', lesges: '⪓', lessapprox: '⪅', lessdot: '⋖', lesseqgtr: '⋚', lesseqqgtr: '⪋', lessgtr: '≶', lesssim: '≲', lfisht: '⥼', lfloor: '⌊', lfr: '𝔩', lg: '≶', lgE: '⪑', lhard: '↽', lharu: '↼', lharul: '⥪', lhblk: '▄', ljcy: 'љ', ll: '≪', llarr: '⇇', llcorner: '⌞', llhard: '⥫', lltri: '◺', lmidot: 'ŀ', lmoust: '⎰', lmoustache: '⎰', lnE: '≨', lnap: '⪉', lnapprox: '⪉', lne: '⪇', lneq: '⪇', lneqq: '≨', lnsim: '⋦', loang: '⟬', loarr: '⇽', lobrk: '⟦', longleftarrow: '⟵', longleftrightarrow: '⟷', longmapsto: '⟼', longrightarrow: '⟶', looparrowleft: '↫', looparrowright: '↬', lopar: '⦅', lopf: '𝕝', loplus: '⨭', lotimes: '⨴', lowast: '∗', lowbar: '_', loz: '◊', lozenge: '◊', lozf: '⧫', lpar: '(', lparlt: '⦓', lrarr: '⇆', lrcorner: '⌟', lrhar: '⇋', lrhard: '⥭', lrm: '‎', lrtri: '⊿', lsaquo: '‹', lscr: '𝓁', lsh: '↰', lsim: '≲', lsime: '⪍', lsimg: '⪏', lsqb: '[', lsquo: '‘', lsquor: '‚', lstrok: 'ł', lt: '<', ltcc: '⪦', ltcir: '⩹', ltdot: '⋖', lthree: '⋋', ltimes: '⋉', ltlarr: '⥶', ltquest: '⩻', ltrPar: '⦖', ltri: '◃', ltrie: '⊴', ltrif: '◂', lurdshar: '⥊', luruhar: '⥦', lvertneqq: '≨︀', lvnE: '≨︀', mDDot: '∺', macr: '¯', male: '♂', malt: '✠', maltese: '✠', map: '↦', mapsto: '↦', mapstodown: '↧', mapstoleft: '↤', mapstoup: '↥', marker: '▮', mcomma: '⨩', mcy: 'м', mdash: '—', measuredangle: '∡', mfr: '𝔪', mho: '℧', micro: 'µ', mid: '∣', midast: '*', midcir: '⫰', middot: '·', minus: '−', minusb: '⊟', minusd: '∸', minusdu: '⨪', mlcp: '⫛', mldr: '…', mnplus: '∓', models: '⊧', mopf: '𝕞', mp: '∓', mscr: '𝓂', mstpos: '∾', mu: 'μ', multimap: '⊸', mumap: '⊸', nGg: '⋙̸', nGt: '≫⃒', nGtv: '≫̸', nLeftarrow: '⇍', nLeftrightarrow: '⇎', nLl: '⋘̸', nLt: '≪⃒', nLtv: '≪̸', nRightarrow: '⇏', nVDash: '⊯', nVdash: '⊮', nabla: '∇', nacute: 'ń', nang: '∠⃒', nap: '≉', napE: '⩰̸', napid: '≋̸', napos: 'ʼn', napprox: '≉', natur: '♮', natural: '♮', naturals: 'ℕ', nbsp: ' ', nbump: '≎̸', nbumpe: '≏̸', ncap: '⩃', ncaron: 'ň', ncedil: 'ņ', ncong: '≇', ncongdot: '⩭̸', ncup: '⩂', ncy: 'н', ndash: '–', ne: '≠', neArr: '⇗', nearhk: '⤤', nearr: '↗', nearrow: '↗', nedot: '≐̸', nequiv: '≢', nesear: '⤨', nesim: '≂̸', nexist: '∄', nexists: '∄', nfr: '𝔫', ngE: '≧̸', nge: '≱', ngeq: '≱', ngeqq: '≧̸', ngeqslant: '⩾̸', nges: '⩾̸', ngsim: '≵', ngt: '≯', ngtr: '≯', nhArr: '⇎', nharr: '↮', nhpar: '⫲', ni: '∋', nis: '⋼', nisd: '⋺', niv: '∋', njcy: 'њ', nlArr: '⇍', nlE: '≦̸', nlarr: '↚', nldr: '‥', nle: '≰', nleftarrow: '↚', nleftrightarrow: '↮', nleq: '≰', nleqq: '≦̸', nleqslant: '⩽̸', nles: '⩽̸', nless: '≮', nlsim: '≴', nlt: '≮', nltri: '⋪', nltrie: '⋬', nmid: '∤', nopf: '𝕟', not: '¬', notin: '∉', notinE: '⋹̸', notindot: '⋵̸', notinva: '∉', notinvb: '⋷', notinvc: '⋶', notni: '∌', notniva: '∌', notnivb: '⋾', notnivc: '⋽', npar: '∦', nparallel: '∦', nparsl: '⫽⃥', npart: '∂̸', npolint: '⨔', npr: '⊀', nprcue: '⋠', npre: '⪯̸', nprec: '⊀', npreceq: '⪯̸', nrArr: '⇏', nrarr: '↛', nrarrc: '⤳̸', nrarrw: '↝̸', nrightarrow: '↛', nrtri: '⋫', nrtrie: '⋭', nsc: '⊁', nsccue: '⋡', nsce: '⪰̸', nscr: '𝓃', nshortmid: '∤', nshortparallel: '∦', nsim: '≁', nsime: '≄', nsimeq: '≄', nsmid: '∤', nspar: '∦', nsqsube: '⋢', nsqsupe: '⋣', nsub: '⊄', nsubE: '⫅̸', nsube: '⊈', nsubset: '⊂⃒', nsubseteq: '⊈', nsubseteqq: '⫅̸', nsucc: '⊁', nsucceq: '⪰̸', nsup: '⊅', nsupE: '⫆̸', nsupe: '⊉', nsupset: '⊃⃒', nsupseteq: '⊉', nsupseteqq: '⫆̸', ntgl: '≹', ntilde: 'ñ', ntlg: '≸', ntriangleleft: '⋪', ntrianglelefteq: '⋬', ntriangleright: '⋫', ntrianglerighteq: '⋭', nu: 'ν', num: '#', numero: '№', numsp: ' ', nvDash: '⊭', nvHarr: '⤄', nvap: '≍⃒', nvdash: '⊬', nvge: '≥⃒', nvgt: '>⃒', nvinfin: '⧞', nvlArr: '⤂', nvle: '≤⃒', nvlt: '<⃒', nvltrie: '⊴⃒', nvrArr: '⤃', nvrtrie: '⊵⃒', nvsim: '∼⃒', nwArr: '⇖', nwarhk: '⤣', nwarr: '↖', nwarrow: '↖', nwnear: '⤧', oS: 'Ⓢ', oacute: 'ó', oast: '⊛', ocir: '⊚', ocirc: 'ô', ocy: 'о', odash: '⊝', odblac: 'ő', odiv: '⨸', odot: '⊙', odsold: '⦼', oelig: 'œ', ofcir: '⦿', ofr: '𝔬', ogon: '˛', ograve: 'ò', ogt: '⧁', ohbar: '⦵', ohm: 'Ω', oint: '∮', olarr: '↺', olcir: '⦾', olcross: '⦻', oline: '‾', olt: '⧀', omacr: 'ō', omega: 'ω', omicron: 'ο', omid: '⦶', ominus: '⊖', oopf: '𝕠', opar: '⦷', operp: '⦹', oplus: '⊕', or: '∨', orarr: '↻', ord: '⩝', order: 'ℴ', orderof: 'ℴ', ordf: 'ª', ordm: 'º', origof: '⊶', oror: '⩖', orslope: '⩗', orv: '⩛', oscr: 'ℴ', oslash: 'ø', osol: '⊘', otilde: 'õ', otimes: '⊗', otimesas: '⨶', ouml: 'ö', ovbar: '⌽', par: '∥', para: '¶', parallel: '∥', parsim: '⫳', parsl: '⫽', part: '∂', pcy: 'п', percnt: '%', period: '.', permil: '‰', perp: '⊥', pertenk: '‱', pfr: '𝔭', phi: 'φ', phiv: 'ϕ', phmmat: 'ℳ', phone: '☎', pi: 'π', pitchfork: '⋔', piv: 'ϖ', planck: 'ℏ', planckh: 'ℎ', plankv: 'ℏ', plus: '+', plusacir: '⨣', plusb: '⊞', pluscir: '⨢', plusdo: '∔', plusdu: '⨥', pluse: '⩲', plusmn: '±', plussim: '⨦', plustwo: '⨧', pm: '±', pointint: '⨕', popf: '𝕡', pound: '£', pr: '≺', prE: '⪳', prap: '⪷', prcue: '≼', pre: '⪯', prec: '≺', precapprox: '⪷', preccurlyeq: '≼', preceq: '⪯', precnapprox: '⪹', precneqq: '⪵', precnsim: '⋨', precsim: '≾', prime: '′', primes: 'ℙ', prnE: '⪵', prnap: '⪹', prnsim: '⋨', prod: '∏', profalar: '⌮', profline: '⌒', profsurf: '⌓', prop: '∝', propto: '∝', prsim: '≾', prurel: '⊰', pscr: '𝓅', psi: 'ψ', puncsp: ' ', qfr: '𝔮', qint: '⨌', qopf: '𝕢', qprime: '⁗', qscr: '𝓆', quaternions: 'ℍ', quatint: '⨖', quest: '?', questeq: '≟', quot: '"', rAarr: '⇛', rArr: '⇒', rAtail: '⤜', rBarr: '⤏', rHar: '⥤', race: '∽̱', racute: 'ŕ', radic: '√', raemptyv: '⦳', rang: '⟩', rangd: '⦒', range: '⦥', rangle: '⟩', raquo: '»', rarr: '→', rarrap: '⥵', rarrb: '⇥', rarrbfs: '⤠', rarrc: '⤳', rarrfs: '⤞', rarrhk: '↪', rarrlp: '↬', rarrpl: '⥅', rarrsim: '⥴', rarrtl: '↣', rarrw: '↝', ratail: '⤚', ratio: '∶', rationals: 'ℚ', rbarr: '⤍', rbbrk: '❳', rbrace: '}', rbrack: ']', rbrke: '⦌', rbrksld: '⦎', rbrkslu: '⦐', rcaron: 'ř', rcedil: 'ŗ', rceil: '⌉', rcub: '}', rcy: 'р', rdca: '⤷', rdldhar: '⥩', rdquo: '”', rdquor: '”', rdsh: '↳', real: 'ℜ', realine: 'ℛ', realpart: 'ℜ', reals: 'ℝ', rect: '▭', reg: '®', rfisht: '⥽', rfloor: '⌋', rfr: '𝔯', rhard: '⇁', rharu: '⇀', rharul: '⥬', rho: 'ρ', rhov: 'ϱ', rightarrow: '→', rightarrowtail: '↣', rightharpoondown: '⇁', rightharpoonup: '⇀', rightleftarrows: '⇄', rightleftharpoons: '⇌', rightrightarrows: '⇉', rightsquigarrow: '↝', rightthreetimes: '⋌', ring: '˚', risingdotseq: '≓', rlarr: '⇄', rlhar: '⇌', rlm: '‏', rmoust: '⎱', rmoustache: '⎱', rnmid: '⫮', roang: '⟭', roarr: '⇾', robrk: '⟧', ropar: '⦆', ropf: '𝕣', roplus: '⨮', rotimes: '⨵', rpar: ')', rpargt: '⦔', rppolint: '⨒', rrarr: '⇉', rsaquo: '›', rscr: '𝓇', rsh: '↱', rsqb: ']', rsquo: '’', rsquor: '’', rthree: '⋌', rtimes: '⋊', rtri: '▹', rtrie: '⊵', rtrif: '▸', rtriltri: '⧎', ruluhar: '⥨', rx: '℞', sacute: 'ś', sbquo: '‚', sc: '≻', scE: '⪴', scap: '⪸', scaron: 'š', sccue: '≽', sce: '⪰', scedil: 'ş', scirc: 'ŝ', scnE: '⪶', scnap: '⪺', scnsim: '⋩', scpolint: '⨓', scsim: '≿', scy: 'с', sdot: '⋅', sdotb: '⊡', sdote: '⩦', seArr: '⇘', searhk: '⤥', searr: '↘', searrow: '↘', sect: '§', semi: ';', seswar: '⤩', setminus: '∖', setmn: '∖', sext: '✶', sfr: '𝔰', sfrown: '⌢', sharp: '♯', shchcy: 'щ', shcy: 'ш', shortmid: '∣', shortparallel: '∥', shy: '­', sigma: 'σ', sigmaf: 'ς', sigmav: 'ς', sim: '∼', simdot: '⩪', sime: '≃', simeq: '≃', simg: '⪞', simgE: '⪠', siml: '⪝', simlE: '⪟', simne: '≆', simplus: '⨤', simrarr: '⥲', slarr: '←', smallsetminus: '∖', smashp: '⨳', smeparsl: '⧤', smid: '∣', smile: '⌣', smt: '⪪', smte: '⪬', smtes: '⪬︀', softcy: 'ь', sol: '/', solb: '⧄', solbar: '⌿', sopf: '𝕤', spades: '♠', spadesuit: '♠', spar: '∥', sqcap: '⊓', sqcaps: '⊓︀', sqcup: '⊔', sqcups: '⊔︀', sqsub: '⊏', sqsube: '⊑', sqsubset: '⊏', sqsubseteq: '⊑', sqsup: '⊐', sqsupe: '⊒', sqsupset: '⊐', sqsupseteq: '⊒', squ: '□', square: '□', squarf: '▪', squf: '▪', srarr: '→', sscr: '𝓈', ssetmn: '∖', ssmile: '⌣', sstarf: '⋆', star: '☆', starf: '★', straightepsilon: 'ϵ', straightphi: 'ϕ', strns: '¯', sub: '⊂', subE: '⫅', subdot: '⪽', sube: '⊆', subedot: '⫃', submult: '⫁', subnE: '⫋', subne: '⊊', subplus: '⪿', subrarr: '⥹', subset: '⊂', subseteq: '⊆', subseteqq: '⫅', subsetneq: '⊊', subsetneqq: '⫋', subsim: '⫇', subsub: '⫕', subsup: '⫓', succ: '≻', succapprox: '⪸', succcurlyeq: '≽', succeq: '⪰', succnapprox: '⪺', succneqq: '⪶', succnsim: '⋩', succsim: '≿', sum: '∑', sung: '♪', sup1: '¹', sup2: '²', sup3: '³', sup: '⊃', supE: '⫆', supdot: '⪾', supdsub: '⫘', supe: '⊇', supedot: '⫄', suphsol: '⟉', suphsub: '⫗', suplarr: '⥻', supmult: '⫂', supnE: '⫌', supne: '⊋', supplus: '⫀', supset: '⊃', supseteq: '⊇', supseteqq: '⫆', supsetneq: '⊋', supsetneqq: '⫌', supsim: '⫈', supsub: '⫔', supsup: '⫖', swArr: '⇙', swarhk: '⤦', swarr: '↙', swarrow: '↙', swnwar: '⤪', szlig: 'ß', target: '⌖', tau: 'τ', tbrk: '⎴', tcaron: 'ť', tcedil: 'ţ', tcy: 'т', tdot: '⃛', telrec: '⌕', tfr: '𝔱', there4: '∴', therefore: '∴', theta: 'θ', thetasym: 'ϑ', thetav: 'ϑ', thickapprox: '≈', thicksim: '∼', thinsp: ' ', thkap: '≈', thksim: '∼', thorn: 'þ', tilde: '˜', times: '×', timesb: '⊠', timesbar: '⨱', timesd: '⨰', tint: '∭', toea: '⤨', top: '⊤', topbot: '⌶', topcir: '⫱', topf: '𝕥', topfork: '⫚', tosa: '⤩', tprime: '‴', trade: '™', triangle: '▵', triangledown: '▿', triangleleft: '◃', trianglelefteq: '⊴', triangleq: '≜', triangleright: '▹', trianglerighteq: '⊵', tridot: '◬', trie: '≜', triminus: '⨺', triplus: '⨹', trisb: '⧍', tritime: '⨻', trpezium: '⏢', tscr: '𝓉', tscy: 'ц', tshcy: 'ћ', tstrok: 'ŧ', twixt: '≬', twoheadleftarrow: '↞', twoheadrightarrow: '↠', uArr: '⇑', uHar: '⥣', uacute: 'ú', uarr: '↑', ubrcy: 'ў', ubreve: 'ŭ', ucirc: 'û', ucy: 'у', udarr: '⇅', udblac: 'ű', udhar: '⥮', ufisht: '⥾', ufr: '𝔲', ugrave: 'ù', uharl: '↿', uharr: '↾', uhblk: '▀', ulcorn: '⌜', ulcorner: '⌜', ulcrop: '⌏', ultri: '◸', umacr: 'ū', uml: '¨', uogon: 'ų', uopf: '𝕦', uparrow: '↑', updownarrow: '↕', upharpoonleft: '↿', upharpoonright: '↾', uplus: '⊎', upsi: 'υ', upsih: 'ϒ', upsilon: 'υ', upuparrows: '⇈', urcorn: '⌝', urcorner: '⌝', urcrop: '⌎', uring: 'ů', urtri: '◹', uscr: '𝓊', utdot: '⋰', utilde: 'ũ', utri: '▵', utrif: '▴', uuarr: '⇈', uuml: 'ü', uwangle: '⦧', vArr: '⇕', vBar: '⫨', vBarv: '⫩', vDash: '⊨', vangrt: '⦜', varepsilon: 'ϵ', varkappa: 'ϰ', varnothing: '∅', varphi: 'ϕ', varpi: 'ϖ', varpropto: '∝', varr: '↕', varrho: 'ϱ', varsigma: 'ς', varsubsetneq: '⊊︀', varsubsetneqq: '⫋︀', varsupsetneq: '⊋︀', varsupsetneqq: '⫌︀', vartheta: 'ϑ', vartriangleleft: '⊲', vartriangleright: '⊳', vcy: 'в', vdash: '⊢', vee: '∨', veebar: '⊻', veeeq: '≚', vellip: '⋮', verbar: '|', vert: '|', vfr: '𝔳', vltri: '⊲', vnsub: '⊂⃒', vnsup: '⊃⃒', vopf: '𝕧', vprop: '∝', vrtri: '⊳', vscr: '𝓋', vsubnE: '⫋︀', vsubne: '⊊︀', vsupnE: '⫌︀', vsupne: '⊋︀', vzigzag: '⦚', wcirc: 'ŵ', wedbar: '⩟', wedge: '∧', wedgeq: '≙', weierp: '℘', wfr: '𝔴', wopf: '𝕨', wp: '℘', wr: '≀', wreath: '≀', wscr: '𝓌', xcap: '⋂', xcirc: '◯', xcup: '⋃', xdtri: '▽', xfr: '𝔵', xhArr: '⟺', xharr: '⟷', xi: 'ξ', xlArr: '⟸', xlarr: '⟵', xmap: '⟼', xnis: '⋻', xodot: '⨀', xopf: '𝕩', xoplus: '⨁', xotime: '⨂', xrArr: '⟹', xrarr: '⟶', xscr: '𝓍', xsqcup: '⨆', xuplus: '⨄', xutri: '△', xvee: '⋁', xwedge: '⋀', yacute: 'ý', yacy: 'я', ycirc: 'ŷ', ycy: 'ы', yen: '¥', yfr: '𝔶', yicy: 'ї', yopf: '𝕪', yscr: '𝓎', yucy: 'ю', yuml: 'ÿ', zacute: 'ź', zcaron: 'ž', zcy: 'з', zdot: 'ż', zeetrf: 'ℨ', zeta: 'ζ', zfr: '𝔷', zhcy: 'ж', zigrarr: '⇝', zopf: '𝕫', zscr: '𝓏', zwj: '‍', zwnj: '‌' } ;// CONCATENATED MODULE: ./node_modules/decode-named-character-reference/index.js const own = {}.hasOwnProperty /** * Decode a single character reference (without the `&` or `;`). * You probably only need this when you’re building parsers yourself that follow * different rules compared to HTML. * This is optimized to be tiny in browsers. * * @param {string} value * `notin` (named), `#123` (deci), `#x123` (hexa). * @returns {string|false} * Decoded reference. */ function decodeNamedCharacterReference(value) { return own.call(characterEntities, value) ? characterEntities[value] : false } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/character-reference.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const characterReference = { name: 'characterReference', tokenize: tokenizeCharacterReference } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCharacterReference(effects, ok, nok) { const self = this let size = 0 /** @type {number} */ let max /** @type {(code: Code) => boolean} */ let test return start /** * Start of character reference. * * ```markdown * > | a&b * ^ * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function start(code) { effects.enter('characterReference') effects.enter('characterReferenceMarker') effects.consume(code) effects.exit('characterReferenceMarker') return open } /** * After `&`, at `#` for numeric references or alphanumeric for named * references. * * ```markdown * > | a&b * ^ * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function open(code) { if (code === 35) { effects.enter('characterReferenceMarkerNumeric') effects.consume(code) effects.exit('characterReferenceMarkerNumeric') return numeric } effects.enter('characterReferenceValue') max = 31 test = asciiAlphanumeric return value(code) } /** * After `#`, at `x` for hexadecimals or digit for decimals. * * ```markdown * > | a{b * ^ * > | a b * ^ * ``` * * @type {State} */ function numeric(code) { if (code === 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) } /** * After markers (`&#x`, `&#`, or `&`), in value, before `;`. * * The character reference kind defines what and how many characters are * allowed. * * ```markdown * > | a&b * ^^^ * > | a{b * ^^^ * > | a b * ^ * ``` * * @type {State} */ function value(code) { if (code === 59 && size) { const token = effects.exit('characterReferenceValue') if ( test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token)) ) { return nok(code) } // To do: `markdown-rs` uses a different name: // `CharacterReferenceMarkerSemi`. 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/mermaid/node_modules/micromark-core-commonmark/lib/character-escape.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const characterEscape = { name: 'characterEscape', tokenize: tokenizeCharacterEscape } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCharacterEscape(effects, ok, nok) { return start /** * Start of character escape. * * ```markdown * > | a\*b * ^ * ``` * * @type {State} */ function start(code) { effects.enter('characterEscape') effects.enter('escapeMarker') effects.consume(code) effects.exit('escapeMarker') return inside } /** * After `\`, at punctuation. * * ```markdown * > | a\*b * ^ * ``` * * @type {State} */ function inside(code) { // ASCII punctuation. if (asciiPunctuation(code)) { effects.enter('characterEscapeValue') effects.consume(code) effects.exit('characterEscapeValue') effects.exit('characterEscape') return ok } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/line-ending.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const lineEnding = { name: 'lineEnding', tokenize: tokenizeLineEnding } /** * @this {TokenizeContext} * @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/mermaid/node_modules/micromark-core-commonmark/lib/label-end.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Event} Event * @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').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const labelEnd = { name: 'labelEnd', tokenize: tokenizeLabelEnd, resolveTo: resolveToLabelEnd, resolveAll: resolveAllLabelEnd } /** @type {Construct} */ const resourceConstruct = { tokenize: tokenizeResource } /** @type {Construct} */ const referenceFullConstruct = { tokenize: tokenizeReferenceFull } /** @type {Construct} */ const referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed } /** @type {Resolver} */ function resolveAllLabelEnd(events) { let index = -1 while (++index < events.length) { const 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 {Array} */ 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]]) // Always populated by defaults. // 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 } /** * @this {TokenizeContext} * @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 /** * Start of label end. * * ```markdown * > | [a](b) c * ^ * > | [a][b] c * ^ * > | [a][] b * ^ * > | [a] b * ``` * * @type {State} */ function start(code) { // If there is not an okay opening. if (!labelStart) { return nok(code) } // If the corresponding label (link) start is marked as inactive, // it means we’d be wrapping a link, like this: // // ```markdown // > | a [b [c](d) e](f) g. // ^ // ``` // // We can’t have that, so it’s just balanced brackets. if (labelStart._inactive) { return labelEndNok(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 after } /** * After `]`. * * ```markdown * > | [a](b) c * ^ * > | [a][b] c * ^ * > | [a][] b * ^ * > | [a] b * ^ * ``` * * @type {State} */ function after(code) { // Note: `markdown-rs` also parses GFM footnotes here, which for us is in // an extension. // Resource (`[asd](fgh)`)? if (code === 40) { return effects.attempt( resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok )(code) } // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference? if (code === 91) { return effects.attempt( referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok )(code) } // Shortcut (`[asd]`) reference? return defined ? labelEndOk(code) : labelEndNok(code) } /** * After `]`, at `[`, but not at a full reference. * * > 👉 **Note**: we only get here if the label is defined. * * ```markdown * > | [a][] b * ^ * > | [a] b * ^ * ``` * * @type {State} */ function referenceNotFull(code) { return effects.attempt( referenceCollapsedConstruct, labelEndOk, labelEndNok )(code) } /** * Done, we found something. * * ```markdown * > | [a](b) c * ^ * > | [a][b] c * ^ * > | [a][] b * ^ * > | [a] b * ^ * ``` * * @type {State} */ function labelEndOk(code) { // Note: `markdown-rs` does a bunch of stuff here. return ok(code) } /** * Done, it’s nothing. * * There was an okay opening, but we didn’t match anything. * * ```markdown * > | [a](b c * ^ * > | [a][b c * ^ * > | [a] b * ^ * ``` * * @type {State} */ function labelEndNok(code) { labelStart._balanced = true return nok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeResource(effects, ok, nok) { return resourceStart /** * At a resource. * * ```markdown * > | [a](b) c * ^ * ``` * * @type {State} */ function resourceStart(code) { effects.enter('resource') effects.enter('resourceMarker') effects.consume(code) effects.exit('resourceMarker') return resourceBefore } /** * In resource, after `(`, at optional whitespace. * * ```markdown * > | [a](b) c * ^ * ``` * * @type {State} */ function resourceBefore(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code) } /** * In resource, after optional whitespace, at `)` or a destination. * * ```markdown * > | [a](b) c * ^ * ``` * * @type {State} */ function resourceOpen(code) { if (code === 41) { return resourceEnd(code) } return factoryDestination( effects, resourceDestinationAfter, resourceDestinationMissing, 'resourceDestination', 'resourceDestinationLiteral', 'resourceDestinationLiteralMarker', 'resourceDestinationRaw', 'resourceDestinationString', 32 )(code) } /** * In resource, after destination, at optional whitespace. * * ```markdown * > | [a](b) c * ^ * ``` * * @type {State} */ function resourceDestinationAfter(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code) } /** * At invalid destination. * * ```markdown * > | [a](<<) b * ^ * ``` * * @type {State} */ function resourceDestinationMissing(code) { return nok(code) } /** * In resource, after destination and whitespace, at `(` or title. * * ```markdown * > | [a](b ) c * ^ * ``` * * @type {State} */ function resourceBetween(code) { if (code === 34 || code === 39 || code === 40) { return factoryTitle( effects, resourceTitleAfter, nok, 'resourceTitle', 'resourceTitleMarker', 'resourceTitleString' )(code) } return resourceEnd(code) } /** * In resource, after title, at optional whitespace. * * ```markdown * > | [a](b "c") d * ^ * ``` * * @type {State} */ function resourceTitleAfter(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code) } /** * In resource, at `)`. * * ```markdown * > | [a](b) d * ^ * ``` * * @type {State} */ function resourceEnd(code) { if (code === 41) { effects.enter('resourceMarker') effects.consume(code) effects.exit('resourceMarker') effects.exit('resource') return ok } return nok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeReferenceFull(effects, ok, nok) { const self = this return referenceFull /** * In a reference (full), at the `[`. * * ```markdown * > | [a][b] d * ^ * ``` * * @type {State} */ function referenceFull(code) { return factoryLabel.call( self, effects, referenceFullAfter, referenceFullMissing, 'reference', 'referenceMarker', 'referenceString' )(code) } /** * In a reference (full), after `]`. * * ```markdown * > | [a][b] d * ^ * ``` * * @type {State} */ function referenceFullAfter(code) { return self.parser.defined.includes( normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) ) ? ok(code) : nok(code) } /** * In reference (full) that was missing. * * ```markdown * > | [a][b d * ^ * ``` * * @type {State} */ function referenceFullMissing(code) { return nok(code) } } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeReferenceCollapsed(effects, ok, nok) { return referenceCollapsedStart /** * In reference (collapsed), at `[`. * * > 👉 **Note**: we only get here if the label is defined. * * ```markdown * > | [a][] d * ^ * ``` * * @type {State} */ function referenceCollapsedStart(code) { // We only attempt a collapsed label if there’s a `[`. effects.enter('reference') effects.enter('referenceMarker') effects.consume(code) effects.exit('referenceMarker') return referenceCollapsedOpen } /** * In reference (collapsed), at `]`. * * > 👉 **Note**: we only get here if the label is defined. * * ```markdown * > | [a][] d * ^ * ``` * * @type {State} */ function referenceCollapsedOpen(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/mermaid/node_modules/micromark-core-commonmark/lib/label-start-image.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const labelStartImage = { name: 'labelStartImage', tokenize: tokenizeLabelStartImage, resolveAll: labelEnd.resolveAll } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeLabelStartImage(effects, ok, nok) { const self = this return start /** * Start of label (image) start. * * ```markdown * > | a ![b] c * ^ * ``` * * @type {State} */ function start(code) { effects.enter('labelImage') effects.enter('labelImageMarker') effects.consume(code) effects.exit('labelImageMarker') return open } /** * After `!`, at `[`. * * ```markdown * > | a ![b] c * ^ * ``` * * @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) } /** * After `![`. * * ```markdown * > | a ![b] c * ^ * ``` * * This is needed in because, when GFM footnotes are enabled, images never * form when started with a `^`. * Instead, links form: * * ```markdown * ![^a](b) * * ![^a][b] * * [b]: c * ``` * * ```html *

!^a

*

!^a

* ``` * * @type {State} */ function after(code) { // To do: use a new field to do this, this is still needed for // `micromark-extension-gfm-footnote`, but the `label-start-link` // behavior isn’t. // Hidden footnotes hook. /* c8 ignore next 3 */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-classify-character/index.js /** * @typedef {import('micromark-util-types').Code} Code */ /** * Classify whether a 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**: eof (`null`) is seen as whitespace. * * @param {Code} code * Code. * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} * Group. */ function classifyCharacter(code) { if ( code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) ) { return 1 } if (unicodePunctuation(code)) { return 2 } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/attention.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Event} Event * @typedef {import('micromark-util-types').Point} Point * @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').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @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 {Array} */ 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] ]) // Always populated by defaults. // 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 } /** * @this {TokenizeContext} * @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 /** * Before a sequence. * * ```markdown * > | ** * ^ * ``` * * @type {State} */ function start(code) { marker = code effects.enter('attentionSequence') return inside(code) } /** * In a sequence. * * ```markdown * > | ** * ^^ * ``` * * @type {State} */ function inside(code) { if (code === marker) { effects.consume(code) return inside } const token = effects.exit('attentionSequence') // To do: next major: move this to resolver, just like `markdown-rs`. const after = classifyCharacter(code) // Always populated by defaults. 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/mermaid/node_modules/micromark-core-commonmark/lib/autolink.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const autolink = { name: 'autolink', tokenize: tokenizeAutolink } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeAutolink(effects, ok, nok) { let size = 0 return start /** * Start of an autolink. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function start(code) { effects.enter('autolink') effects.enter('autolinkMarker') effects.consume(code) effects.exit('autolinkMarker') effects.enter('autolinkProtocol') return open } /** * After `<`, at protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function open(code) { if (asciiAlpha(code)) { effects.consume(code) return schemeOrEmailAtext } return emailAtext(code) } /** * At second byte of protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function schemeOrEmailAtext(code) { // ASCII alphanumeric and `+`, `-`, and `.`. if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) { // Count the previous alphabetical from `open` too. size = 1 return schemeInsideOrEmailAtext(code) } return emailAtext(code) } /** * In ambiguous protocol or atext. * * ```markdown * > | ab * ^ * > | ab * ^ * ``` * * @type {State} */ function schemeInsideOrEmailAtext(code) { if (code === 58) { effects.consume(code) size = 0 return urlInside } // ASCII alphanumeric and `+`, `-`, and `.`. if ( (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32 ) { effects.consume(code) return schemeInsideOrEmailAtext } size = 0 return emailAtext(code) } /** * After protocol, in URL. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function urlInside(code) { if (code === 62) { effects.exit('autolinkProtocol') effects.enter('autolinkMarker') effects.consume(code) effects.exit('autolinkMarker') effects.exit('autolink') return ok } // ASCII control, space, or `<`. if (code === null || code === 32 || code === 60 || asciiControl(code)) { return nok(code) } effects.consume(code) return urlInside } /** * In email atext. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailAtext(code) { if (code === 64) { effects.consume(code) return emailAtSignOrDot } if (asciiAtext(code)) { effects.consume(code) return emailAtext } return nok(code) } /** * In label, after at-sign or dot. * * ```markdown * > | ab * ^ ^ * ``` * * @type {State} */ function emailAtSignOrDot(code) { return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) } /** * In label, where `.` and `>` are allowed. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailLabel(code) { if (code === 46) { effects.consume(code) size = 0 return emailAtSignOrDot } if (code === 62) { // Exit, then change the token type. effects.exit('autolinkProtocol').type = 'autolinkEmail' effects.enter('autolinkMarker') effects.consume(code) effects.exit('autolinkMarker') effects.exit('autolink') return ok } return emailValue(code) } /** * In label, where `.` and `>` are *not* allowed. * * Though, this is also used in `emailLabel` to parse other values. * * ```markdown * > | ab * ^ * ``` * * @type {State} */ function emailValue(code) { // ASCII alphanumeric or `-`. if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { const next = code === 45 ? emailValue : emailLabel effects.consume(code) return next } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/html-text.js /** * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const htmlText = { name: 'htmlText', tokenize: tokenizeHtmlText } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeHtmlText(effects, ok, nok) { const self = this /** @type {NonNullable | undefined} */ let marker /** @type {number} */ let index /** @type {State} */ let returnState return start /** * Start of HTML (text). * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function start(code) { effects.enter('htmlText') effects.enter('htmlTextData') effects.consume(code) return open } /** * After `<`, at tag name or other stuff. * * ```markdown * > | a c * ^ * > | a c * ^ * > | a c * ^ * ``` * * @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 } // ASCII alphabetical. if (asciiAlpha(code)) { effects.consume(code) return tagOpen } return nok(code) } /** * After ` | a c * ^ * > | a c * ^ * > | a &<]]> c * ^ * ``` * * @type {State} */ function declarationOpen(code) { if (code === 45) { effects.consume(code) return commentOpenInside } if (code === 91) { effects.consume(code) index = 0 return cdataOpenInside } if (asciiAlpha(code)) { effects.consume(code) return declaration } return nok(code) } /** * In a comment, after ` | a c * ^ * ``` * * @type {State} */ function commentOpenInside(code) { if (code === 45) { effects.consume(code) return commentEnd } return nok(code) } /** * In comment. * * ```markdown * > | a c * ^ * ``` * * @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 lineEndingBefore(code) } effects.consume(code) return comment } /** * In comment, after `-`. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function commentClose(code) { if (code === 45) { effects.consume(code) return commentEnd } return comment(code) } /** * In comment, after `--`. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function commentEnd(code) { return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code) } /** * After ` | a &<]]> b * ^^^^^^ * ``` * * @type {State} */ function cdataOpenInside(code) { const value = 'CDATA[' if (code === value.charCodeAt(index++)) { effects.consume(code) return index === value.length ? cdata : cdataOpenInside } return nok(code) } /** * In CDATA. * * ```markdown * > | a &<]]> b * ^^^ * ``` * * @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 lineEndingBefore(code) } effects.consume(code) return cdata } /** * In CDATA, after `]`, at another `]`. * * ```markdown * > | a &<]]> b * ^ * ``` * * @type {State} */ function cdataClose(code) { if (code === 93) { effects.consume(code) return cdataEnd } return cdata(code) } /** * In CDATA, after `]]`, at `>`. * * ```markdown * > | a &<]]> b * ^ * ``` * * @type {State} */ function cdataEnd(code) { if (code === 62) { return end(code) } if (code === 93) { effects.consume(code) return cdataEnd } return cdata(code) } /** * In declaration. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function declaration(code) { if (code === null || code === 62) { return end(code) } if (markdownLineEnding(code)) { returnState = declaration return lineEndingBefore(code) } effects.consume(code) return declaration } /** * In instruction. * * ```markdown * > | a c * ^ * ``` * * @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 lineEndingBefore(code) } effects.consume(code) return instruction } /** * In instruction, after `?`, at `>`. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function instructionClose(code) { return code === 62 ? end(code) : instruction(code) } /** * After ` | a c * ^ * ``` * * @type {State} */ function tagCloseStart(code) { // ASCII alphabetical. if (asciiAlpha(code)) { effects.consume(code) return tagClose } return nok(code) } /** * After ` | a c * ^ * ``` * * @type {State} */ function tagClose(code) { // ASCII alphanumerical and `-`. if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) return tagClose } return tagCloseBetween(code) } /** * In closing tag, after tag name. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function tagCloseBetween(code) { if (markdownLineEnding(code)) { returnState = tagCloseBetween return lineEndingBefore(code) } if (markdownSpace(code)) { effects.consume(code) return tagCloseBetween } return end(code) } /** * After ` | a c * ^ * ``` * * @type {State} */ function tagOpen(code) { // ASCII alphanumerical and `-`. if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code) return tagOpen } if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } /** * In opening tag, after tag name. * * ```markdown * > | a c * ^ * ``` * * @type {State} */ function tagOpenBetween(code) { if (code === 47) { effects.consume(code) return end } // ASCII alphabetical and `:` and `_`. if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code) return tagOpenAttributeName } if (markdownLineEnding(code)) { returnState = tagOpenBetween return lineEndingBefore(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenBetween } return end(code) } /** * In attribute name. * * ```markdown * > | a d * ^ * ``` * * @type {State} */ function tagOpenAttributeName(code) { // ASCII alphabetical and `-`, `.`, `:`, and `_`. if ( code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code) ) { effects.consume(code) return tagOpenAttributeName } return tagOpenAttributeNameAfter(code) } /** * After attribute name, before initializer, the end of the tag, or * whitespace. * * ```markdown * > | a d * ^ * ``` * * @type {State} */ function tagOpenAttributeNameAfter(code) { if (code === 61) { effects.consume(code) return tagOpenAttributeValueBefore } if (markdownLineEnding(code)) { returnState = tagOpenAttributeNameAfter return lineEndingBefore(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenAttributeNameAfter } return tagOpenBetween(code) } /** * Before unquoted, double quoted, or single quoted attribute value, allowing * whitespace. * * ```markdown * > | a e * ^ * ``` * * @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 lineEndingBefore(code) } if (markdownSpace(code)) { effects.consume(code) return tagOpenAttributeValueBefore } effects.consume(code) return tagOpenAttributeValueUnquoted } /** * In double or single quoted attribute value. * * ```markdown * > | a e * ^ * ``` * * @type {State} */ function tagOpenAttributeValueQuoted(code) { if (code === marker) { effects.consume(code) marker = undefined return tagOpenAttributeValueQuotedAfter } if (code === null) { return nok(code) } if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueQuoted return lineEndingBefore(code) } effects.consume(code) return tagOpenAttributeValueQuoted } /** * In unquoted attribute value. * * ```markdown * > | a e * ^ * ``` * * @type {State} */ function tagOpenAttributeValueUnquoted(code) { if ( code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96 ) { return nok(code) } if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } effects.consume(code) return tagOpenAttributeValueUnquoted } /** * After double or single quoted attribute value, before whitespace or the end * of the tag. * * ```markdown * > | a e * ^ * ``` * * @type {State} */ function tagOpenAttributeValueQuotedAfter(code) { if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } /** * In certain circumstances of a tag where only an `>` is allowed. * * ```markdown * > | a e * ^ * ``` * * @type {State} */ function end(code) { if (code === 62) { effects.consume(code) effects.exit('htmlTextData') effects.exit('htmlText') return ok } return nok(code) } /** * At eol. * * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about * > empty tokens. * * ```markdown * > | a * ``` * * @type {State} */ function lineEndingBefore(code) { effects.exit('htmlTextData') effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return lineEndingAfter } /** * After eol, at optional whitespace. * * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about * > empty tokens. * * ```markdown * | a * ^ * ``` * * @type {State} */ function lineEndingAfter(code) { // Always populated by defaults. return markdownSpace(code) ? factorySpace( effects, lineEndingAfterPrefix, 'linePrefix', self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) : lineEndingAfterPrefix(code) } /** * After eol, after optional whitespace. * * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about * > empty tokens. * * ```markdown * | a * ^ * ``` * * @type {State} */ function lineEndingAfterPrefix(code) { effects.enter('htmlTextData') return returnState(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/label-start-link.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const labelStartLink = { name: 'labelStartLink', tokenize: tokenizeLabelStartLink, resolveAll: labelEnd.resolveAll } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeLabelStartLink(effects, ok, nok) { const self = this return start /** * Start of label (link) start. * * ```markdown * > | a [b] c * ^ * ``` * * @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: this isn’t needed in `micromark-extension-gfm-footnote`, // remove. // Hidden footnotes hook. /* c8 ignore next 3 */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/hard-break-escape.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').State} State * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const hardBreakEscape = { name: 'hardBreakEscape', tokenize: tokenizeHardBreakEscape } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeHardBreakEscape(effects, ok, nok) { return start /** * Start of a hard break (escape). * * ```markdown * > | a\ * ^ * | b * ``` * * @type {State} */ function start(code) { effects.enter('hardBreakEscape') effects.consume(code) return after } /** * After `\`, at eol. * * ```markdown * > | a\ * ^ * | b * ``` * * @type {State} */ function after(code) { if (markdownLineEnding(code)) { effects.exit('hardBreakEscape') return ok(code) } return nok(code) } } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/code-text.js /** * @typedef {import('micromark-util-types').Construct} Construct * @typedef {import('micromark-util-types').Previous} Previous * @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').TokenizeContext} TokenizeContext * @typedef {import('micromark-util-types').Tokenizer} Tokenizer */ /** @type {Construct} */ const codeText = { name: 'codeText', tokenize: tokenizeCodeText, resolve: resolveCodeText, previous } // To do: next major: don’t resolve, like `markdown-rs`. /** @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 } /** * @this {TokenizeContext} * @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' ) } /** * @this {TokenizeContext} * @type {Tokenizer} */ function tokenizeCodeText(effects, ok, nok) { const self = this let sizeOpen = 0 /** @type {number} */ let size /** @type {Token} */ let token return start /** * Start of code (text). * * ```markdown * > | `a` * ^ * > | \`a` * ^ * ``` * * @type {State} */ function start(code) { effects.enter('codeText') effects.enter('codeTextSequence') return sequenceOpen(code) } /** * In opening sequence. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function sequenceOpen(code) { if (code === 96) { effects.consume(code) sizeOpen++ return sequenceOpen } effects.exit('codeTextSequence') return between(code) } /** * Between something and something else. * * ```markdown * > | `a` * ^^ * ``` * * @type {State} */ function between(code) { // EOF. if (code === null) { return nok(code) } // To do: next major: don’t do spaces in resolve, but when compiling, // like `markdown-rs`. // Tabs don’t work, and virtual spaces don’t make sense. if (code === 32) { effects.enter('space') effects.consume(code) effects.exit('space') return between } // Closing fence? Could also be data. if (code === 96) { token = effects.enter('codeTextSequence') size = 0 return sequenceClose(code) } if (markdownLineEnding(code)) { effects.enter('lineEnding') effects.consume(code) effects.exit('lineEnding') return between } // Data. effects.enter('codeTextData') return data(code) } /** * In data. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function data(code) { if ( code === null || code === 32 || code === 96 || markdownLineEnding(code) ) { effects.exit('codeTextData') return between(code) } effects.consume(code) return data } /** * In closing sequence. * * ```markdown * > | `a` * ^ * ``` * * @type {State} */ function sequenceClose(code) { // More. if (code === 96) { effects.consume(code) size++ return sequenceClose } // 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/mermaid/node_modules/micromark/lib/constructs.js /** * @typedef {import('micromark-util-types').Extension} Extension */ /** @satisfies {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 } /** @satisfies {Extension['contentInitial']} */ const contentInitial = { [91]: definition } /** @satisfies {Extension['flowInitial']} */ const flowInitial = { [-2]: codeIndented, [-1]: codeIndented, [32]: codeIndented } /** @satisfies {Extension['flow']} */ const constructs_flow = { [35]: headingAtx, [42]: thematicBreak, [45]: [setextUnderline, thematicBreak], [60]: htmlFlow, [61]: setextUnderline, [95]: thematicBreak, [96]: codeFenced, [126]: codeFenced } /** @satisfies {Extension['string']} */ const constructs_string = { [38]: characterReference, [92]: characterEscape } /** @satisfies {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 } /** @satisfies {Extension['insideSpan']} */ const insideSpan = { null: [attention, resolver] } /** @satisfies {Extension['attentionMarkers']} */ const attentionMarkers = { null: [42, 95] } /** @satisfies {Extension['disable']} */ const disable = { null: [] } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark/lib/parse.js /** * @typedef {import('micromark-util-types').Create} Create * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct * @typedef {import('micromark-util-types').ParseContext} ParseContext * @typedef {import('micromark-util-types').ParseOptions} ParseOptions */ /** * @param {ParseOptions | null | undefined} [options] * @returns {ParseContext} */ function parse(options) { const settings = options || {} const constructs = /** @type {FullNormalizedExtension} */ combineExtensions([constructs_namespaceObject, ...(settings.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/mermaid/node_modules/micromark/lib/preprocess.js /** * @typedef {import('micromark-util-types').Chunk} Chunk * @typedef {import('micromark-util-types').Code} Code * @typedef {import('micromark-util-types').Encoding} Encoding * @typedef {import('micromark-util-types').Value} Value */ /** * @callback Preprocessor * @param {Value} value * @param {Encoding | null | undefined} [encoding] * @param {boolean | null | undefined} [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) { // To do: `markdown-rs` actually parses BOMs (byte order mark). 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/mermaid/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. * * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes * non-characters and control characters safe. * * @param {string} value * Value to decode. * @param {number} base * Numeric base. * @returns {string} * Character. */ function decodeNumericCharacterReference(value, base) { const code = Number.parseInt(value, base) if ( // C0 except for HT, LF, FF, CR, space. code < 9 || code === 11 || (code > 13 && code < 32) || // Control character (DEL) of C0, and C1 controls. (code > 126 && code < 160) || // Lone high surrogates and low surrogates. (code > 55295 && code < 57344) || // Noncharacters. (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ || (code & 65535) === 65535 || (code & 65535) === 65534 /* eslint-enable no-bitwise */ || // Out of range code > 1114111 ) { return '\uFFFD' } return String.fromCharCode(code) } ;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-decode-string/index.js const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi /** * 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 * Value to decode. * @returns {string} * Decoded value. */ 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/mermaid/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/mermaid/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( 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) ) { 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', _spread: false, start: Object.assign({}, event[1].start), // @ts-expect-error: we’ll add `end` in a second. end: undefined } // @ts-expect-error: `listItem` is most definitely defined, TS... events.splice(index, 0, ['enter', listItem, event[2]]) index++ length++ firstBlankLineIndex = undefined atMarker = true } } } 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, spread: token._spread, children: [] } } /** * @param {Token} token * @returns {ListItem} */ function listItem(token) { return { type: 'listItem', 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' ) } } // EXTERNAL MODULE: ./node_modules/ts-dedent/esm/index.js var esm = __webpack_require__(18464); ;// CONCATENATED MODULE: ./node_modules/mermaid/dist/createText-aebacdfe.js function preprocessMarkdown(markdown) { const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n"); const withoutExtraSpaces = (0,esm/* dedent */.Z)(withoutMultipleNewlines); return withoutExtraSpaces; } function markdownToLines(markdown) { const preprocessedMarkdown = preprocessMarkdown(markdown); const { children } = fromMarkdown(preprocessedMarkdown); const lines = [[]]; let currentLine = 0; function processNode(node, parentType = "normal") { if (node.type === "text") { const textLines = node.value.split("\n"); textLines.forEach((textLine, index) => { if (index !== 0) { currentLine++; lines.push([]); } textLine.split(" ").forEach((word) => { if (word) { lines[currentLine].push({ content: word, type: parentType }); } }); }); } else if (node.type === "strong" || node.type === "emphasis") { node.children.forEach((contentNode) => { processNode(contentNode, node.type); }); } } children.forEach((treeNode) => { if (treeNode.type === "paragraph") { treeNode.children.forEach((contentNode) => { processNode(contentNode); }); } }); return lines; } function markdownToHTML(markdown) { const { children } = fromMarkdown(markdown); function output(node) { if (node.type === "text") { return node.value.replace(/\n/g, "
"); } else if (node.type === "strong") { return `${node.children.map(output).join("")}`; } else if (node.type === "emphasis") { return `${node.children.map(output).join("")}`; } else if (node.type === "paragraph") { return `

${node.children.map(output).join("")}

`; } return `Unsupported markdown: ${node.type}`; } return children.map(output).join(""); } function splitTextToChars(text) { if (Intl.Segmenter) { return [...new Intl.Segmenter().segment(text)].map((s) => s.segment); } return [...text]; } function splitWordToFitWidth(checkFit, word) { const characters = splitTextToChars(word.content); return splitWordToFitWidthRecursion(checkFit, [], characters, word.type); } function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) { if (remainingChars.length === 0) { return [ { content: usedChars.join(""), type }, { content: "", type } ]; } const [nextChar, ...rest] = remainingChars; const newWord = [...usedChars, nextChar]; if (checkFit([{ content: newWord.join(""), type }])) { return splitWordToFitWidthRecursion(checkFit, newWord, rest, type); } if (usedChars.length === 0 && nextChar) { usedChars.push(nextChar); remainingChars.shift(); } return [ { content: usedChars.join(""), type }, { content: remainingChars.join(""), type } ]; } function splitLineToFitWidth(line, checkFit) { if (line.some(({ content }) => content.includes("\n"))) { throw new Error("splitLineToFitWidth does not support newlines in the line"); } return splitLineToFitWidthRecursion(line, checkFit); } function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) { if (words.length === 0) { if (newLine.length > 0) { lines.push(newLine); } return lines.length > 0 ? lines : []; } let joiner = ""; if (words[0].content === " ") { joiner = " "; words.shift(); } const nextWord = words.shift() ?? { content: " ", type: "normal" }; const lineWithNextWord = [...newLine]; if (joiner !== "") { lineWithNextWord.push({ content: joiner, type: "normal" }); } lineWithNextWord.push(nextWord); if (checkFit(lineWithNextWord)) { return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord); } if (newLine.length > 0) { lines.push(newLine); words.unshift(nextWord); } else if (nextWord.content) { const [line, rest] = splitWordToFitWidth(checkFit, nextWord); lines.push([line]); if (rest.content) { words.unshift(rest); } } return splitLineToFitWidthRecursion(words, checkFit, lines); } function applyStyle(dom, styleFn) { if (styleFn) { dom.attr("style", styleFn); } } function addHtmlSpan(element, node, width, classes, addBackground = false) { const fo = element.append("foreignObject"); const div = fo.append("xhtml:div"); const label = node.label; const labelClass = node.isNode ? "nodeLabel" : "edgeLabel"; div.html( ` " + label + "" ); applyStyle(div, node.labelStyle); div.style("display", "table-cell"); div.style("white-space", "nowrap"); div.style("max-width", width + "px"); div.attr("xmlns", "http://www.w3.org/1999/xhtml"); if (addBackground) { div.attr("class", "labelBkg"); } let bbox = div.node().getBoundingClientRect(); if (bbox.width === width) { div.style("display", "table"); div.style("white-space", "break-spaces"); div.style("width", width + "px"); bbox = div.node().getBoundingClientRect(); } fo.style("width", bbox.width); fo.style("height", bbox.height); return fo.node(); } function createTspan(textElement, lineIndex, lineHeight) { return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em"); } function computeWidthOfText(parentNode, lineHeight, line) { const testElement = parentNode.append("text"); const testSpan = createTspan(testElement, 1, lineHeight); updateTextContentAndStyles(testSpan, line); const textLength = testSpan.node().getComputedTextLength(); testElement.remove(); return textLength; } function computeDimensionOfText(parentNode, lineHeight, text) { var _a; const testElement = parentNode.append("text"); const testSpan = createTspan(testElement, 1, lineHeight); updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]); const textDimension = (_a = testSpan.node()) == null ? void 0 : _a.getBoundingClientRect(); if (textDimension) { testElement.remove(); } return textDimension; } function createFormattedText(width, g, structuredText, addBackground = false) { const lineHeight = 1.1; const labelGroup = g.append("g"); const bkg = labelGroup.insert("rect").attr("class", "background"); const textElement = labelGroup.append("text").attr("y", "-10.1"); let lineIndex = 0; for (const line of structuredText) { const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width; const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth); for (const preparedLine of linesUnderWidth) { const tspan = createTspan(textElement, lineIndex, lineHeight); updateTextContentAndStyles(tspan, preparedLine); lineIndex++; } } if (addBackground) { const bbox = textElement.node().getBBox(); const padding = 2; bkg.attr("x", -padding).attr("y", -padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding); return labelGroup.node(); } else { return textElement.node(); } } function updateTextContentAndStyles(tspan, wrappedLine) { tspan.text(""); wrappedLine.forEach((word, index) => { const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal"); if (index === 0) { innerTspan.text(word.content); } else { innerTspan.text(" " + word.content); } }); } const createText = (el, text = "", { style = "", isTitle = false, classes = "", useHtmlLabels = true, isNode = true, width = 200, addSvgBackground = false } = {}) => { mermaid_934d9bea.l.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground); if (useHtmlLabels) { const htmlText = markdownToHTML(text); const node = { isNode, label: (0,mermaid_934d9bea.J)(htmlText).replace( /fa[blrs]?:fa-[\w-]+/g, (s) => `` ), labelStyle: style.replace("fill:", "color:") }; const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground); return vertexNode; } else { const structuredText = markdownToLines(text); const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground); return svgLabel; } }; /***/ }), /***/ 32693: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ diagram: () => (/* binding */ diagram) /* harmony export */ }); /* harmony import */ var _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(85322); /* harmony import */ var _createText_aebacdfe_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54511); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64218); /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27484); /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17967); /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20683); var parser = function() { var o = function(k, v, o2, l) { for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ; return o2; }, $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64]; var parser2 = { trace: function trace() { }, yy: {}, symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" }, productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { case 5: yy.setOrientation($$[$0]); break; case 9: yy.setDiagramTitle($$[$0].text.trim()); break; case 12: yy.setLineData({ text: "", type: "text" }, $$[$0]); break; case 13: yy.setLineData($$[$0 - 1], $$[$0]); break; case 14: yy.setBarData({ text: "", type: "text" }, $$[$0]); break; case 15: yy.setBarData($$[$0 - 1], $$[$0]); break; case 16: this.$ = $$[$0].trim(); yy.setAccTitle(this.$); break; case 17: case 18: this.$ = $$[$0].trim(); yy.setAccDescription(this.$); break; case 19: this.$ = $$[$0 - 1]; break; case 20: this.$ = [Number($$[$0 - 2]), ...$$[$0]]; break; case 21: this.$ = [Number($$[$0])]; break; case 22: yy.setXAxisTitle($$[$0]); break; case 23: yy.setXAxisTitle($$[$0 - 1]); break; case 24: yy.setXAxisTitle({ type: "text", text: "" }); break; case 25: yy.setXAxisBand($$[$0]); break; case 26: yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0])); break; case 27: this.$ = $$[$0 - 1]; break; case 28: this.$ = [$$[$0 - 2], ...$$[$0]]; break; case 29: this.$ = [$$[$0]]; break; case 30: yy.setYAxisTitle($$[$0]); break; case 31: yy.setYAxisTitle($$[$0 - 1]); break; case 32: yy.setYAxisTitle({ type: "text", text: "" }); break; case 33: yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0])); break; case 37: this.$ = { text: $$[$0], type: "text" }; break; case 38: this.$ = { text: $$[$0], type: "text" }; break; case 39: this.$ = { text: $$[$0], type: "markdown" }; break; case 40: this.$ = $$[$0]; break; case 41: this.$ = $$[$0 - 1] + "" + $$[$0]; break; } }, table: [o($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o($V6, [2, 34]), o($V6, [2, 35]), o($V6, [2, 36]), { 1: [2, 1] }, o($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o($V6, [2, 5]), o($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o($Vn, [2, 18]), { 1: [2, 2] }, o($Vn, [2, 8]), o($Vn, [2, 9]), o($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o($Vo, [2, 38]), o($Vo, [2, 39]), o($Vp, [2, 40]), o($Vp, [2, 42]), o($Vp, [2, 43]), o($Vp, [2, 44]), o($Vp, [2, 45]), o($Vp, [2, 46]), o($Vp, [2, 47]), o($Vp, [2, 48]), o($Vp, [2, 49]), o($Vp, [2, 50]), o($Vp, [2, 51]), o($Vn, [2, 10]), o($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o($Vn, [2, 24]), o($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 11]), o($Vn, [2, 30], { 33: 60, 27: $Vl }), o($Vn, [2, 32]), { 31: [1, 61] }, o($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o($Vn, [2, 14]), { 17: 65, 24: $Vm }, o($Vn, [2, 16]), o($Vn, [2, 17]), o($Vp, [2, 41]), o($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o($Vn, [2, 31]), { 27: [1, 69] }, o($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o($Vn, [2, 15]), o($Vn, [2, 26]), o($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 33]), o($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }], defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] }, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer2 = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer2.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer2; sharedState.yy.parser = this; if (typeof lexer2.yylloc == "undefined") { lexer2.yylloc = {}; } var yyloc = lexer2.yylloc; lstack.push(yyloc); var ranges = lexer2.options && lexer2.options.ranges; if (typeof sharedState.yy.parseError === "function") { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function lex() { var token; token = tstack.pop() || lexer2.lex() || EOF; if (typeof token !== "number") { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, state, action, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push("'" + this.terminals_[p] + "'"); } } if (lexer2.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, { text: lexer2.match, token: this.terminals_[symbol] || symbol, line: lexer2.yylineno, loc: yyloc, expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer2.yytext); lstack.push(lexer2.yylloc); stack.push(action[1]); symbol = null; { yyleng = lexer2.yyleng; yytext = lexer2.yytext; yylineno = lexer2.yylineno; yyloc = lexer2.yylloc; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; var lexer = function() { var lexer2 = { EOF: 1, parseError: function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput: function(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ""; this.conditionStack = ["INITIAL"]; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0, 0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input: function() { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput: function(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more: function() { this._more = true; return this; }, // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. reject: function() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less: function(n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput: function() { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput: function() { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20 - next.length); } return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition: function() { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match: function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { for (var k in backup) { this[k] = backup[k]; } return false; } return false; }, // return next match in input next: function() { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ""; this.match = ""; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; } else { return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } return false; } if (this._input === "") { return this.EOF; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex: function lex() { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin: function begin(condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState: function popState() { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules: function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState: function topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState: function pushState(condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize: function stateStackSize() { return this.conditionStack.length; }, options: { "case-insensitive": true }, performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { switch ($avoiding_name_collisions) { case 0: break; case 1: break; case 2: this.popState(); return 34; case 3: this.popState(); return 34; case 4: return 34; case 5: break; case 6: return 10; case 7: this.pushState("acc_title"); return 19; case 8: this.popState(); return "acc_title_value"; case 9: this.pushState("acc_descr"); return 21; case 10: this.popState(); return "acc_descr_value"; case 11: this.pushState("acc_descr_multiline"); break; case 12: this.popState(); break; case 13: return "acc_descr_multiline_value"; case 14: return 5; case 15: return 8; case 16: this.pushState("axis_data"); return "X_AXIS"; case 17: this.pushState("axis_data"); return "Y_AXIS"; case 18: this.pushState("axis_band_data"); return 24; case 19: return 31; case 20: this.pushState("data"); return 16; case 21: this.pushState("data"); return 18; case 22: this.pushState("data_inner"); return 24; case 23: return 27; case 24: this.popState(); return 26; case 25: this.popState(); break; case 26: this.pushState("string"); break; case 27: this.popState(); break; case 28: return "STR"; case 29: return 24; case 30: return 26; case 31: return 43; case 32: return "COLON"; case 33: return 44; case 34: return 28; case 35: return 45; case 36: return 46; case 37: return 48; case 38: return 50; case 39: return 47; case 40: return 41; case 41: return 49; case 42: return 42; case 43: break; case 44: return 35; case 45: return 36; } }, rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i], conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [27, 28], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true } } }; return lexer2; }(); parser2.lexer = lexer; function Parser() { this.yy = {}; } Parser.prototype = parser2; parser2.Parser = Parser; return new Parser(); }(); parser.parser = parser; const parser$1 = parser; function isBarPlot(data) { return data.type === "bar"; } function isBandAxisData(data) { return data.type === "band"; } function isLinearAxisData(data) { return data.type === "linear"; } class TextDimensionCalculatorWithFont { constructor(parentGroup) { this.parentGroup = parentGroup; } getMaxDimension(texts, fontSize) { if (!this.parentGroup) { return { width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize, height: fontSize }; } const dimension = { width: 0, height: 0 }; const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize); for (const t of texts) { const bbox = (0,_createText_aebacdfe_js__WEBPACK_IMPORTED_MODULE_4__.c)(elem, 1, t); const width = bbox ? bbox.width : t.length * fontSize; const height = bbox ? bbox.height : fontSize; dimension.width = Math.max(dimension.width, width); dimension.height = Math.max(dimension.height, height); } elem.remove(); return dimension; } } const BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7; const MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2; class BaseAxis { constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) { this.axisConfig = axisConfig; this.title = title; this.textDimensionCalculator = textDimensionCalculator; this.axisThemeConfig = axisThemeConfig; this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; this.axisPosition = "left"; this.showTitle = false; this.showLabel = false; this.showTick = false; this.showAxisLine = false; this.outerPadding = 0; this.titleTextHeight = 0; this.labelTextHeight = 0; this.range = [0, 10]; this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; this.axisPosition = "left"; } setRange(range) { this.range = range; if (this.axisPosition === "left" || this.axisPosition === "right") { this.boundingRect.height = range[1] - range[0]; } else { this.boundingRect.width = range[1] - range[0]; } this.recalculateScale(); } getRange() { return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding]; } setAxisPosition(axisPosition) { this.axisPosition = axisPosition; this.setRange(this.range); } getTickDistance() { const range = this.getRange(); return Math.abs(range[0] - range[1]) / this.getTickValues().length; } getAxisOuterPadding() { return this.outerPadding; } getLabelDimension() { return this.textDimensionCalculator.getMaxDimension( this.getTickValues().map((tick) => tick.toString()), this.axisConfig.labelFontSize ); } recalculateOuterPaddingToDrawBar() { if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) { this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2); } this.recalculateScale(); } calculateSpaceIfDrawnHorizontally(availableSpace) { let availableHeight = availableSpace.height; if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) { availableHeight -= this.axisConfig.axisLineWidth; this.showAxisLine = true; } if (this.axisConfig.showLabel) { const spaceRequired = this.getLabelDimension(); const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width; this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding); const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2; this.labelTextHeight = spaceRequired.height; if (heightRequired <= availableHeight) { availableHeight -= heightRequired; this.showLabel = true; } } if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) { this.showTick = true; availableHeight -= this.axisConfig.tickLength; } if (this.axisConfig.showTitle && this.title) { const spaceRequired = this.textDimensionCalculator.getMaxDimension( [this.title], this.axisConfig.titleFontSize ); const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2; this.titleTextHeight = spaceRequired.height; if (heightRequired <= availableHeight) { availableHeight -= heightRequired; this.showTitle = true; } } this.boundingRect.width = availableSpace.width; this.boundingRect.height = availableSpace.height - availableHeight; } calculateSpaceIfDrawnVertical(availableSpace) { let availableWidth = availableSpace.width; if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) { availableWidth -= this.axisConfig.axisLineWidth; this.showAxisLine = true; } if (this.axisConfig.showLabel) { const spaceRequired = this.getLabelDimension(); const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height; this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding); const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2; if (widthRequired <= availableWidth) { availableWidth -= widthRequired; this.showLabel = true; } } if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) { this.showTick = true; availableWidth -= this.axisConfig.tickLength; } if (this.axisConfig.showTitle && this.title) { const spaceRequired = this.textDimensionCalculator.getMaxDimension( [this.title], this.axisConfig.titleFontSize ); const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2; this.titleTextHeight = spaceRequired.height; if (widthRequired <= availableWidth) { availableWidth -= widthRequired; this.showTitle = true; } } this.boundingRect.width = availableSpace.width - availableWidth; this.boundingRect.height = availableSpace.height; } calculateSpace(availableSpace) { if (this.axisPosition === "left" || this.axisPosition === "right") { this.calculateSpaceIfDrawnVertical(availableSpace); } else { this.calculateSpaceIfDrawnHorizontally(availableSpace); } this.recalculateScale(); return { width: this.boundingRect.width, height: this.boundingRect.height }; } setBoundingBoxXY(point) { this.boundingRect.x = point.x; this.boundingRect.y = point.y; } getDrawableElementsForLeftAxis() { const drawableElement = []; if (this.showAxisLine) { const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2; drawableElement.push({ type: "path", groupTexts: ["left-axis", "axisl-line"], data: [ { path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `, strokeFill: this.axisThemeConfig.axisLineColor, strokeWidth: this.axisConfig.axisLineWidth } ] }); } if (this.showLabel) { drawableElement.push({ type: "text", groupTexts: ["left-axis", "label"], data: this.getTickValues().map((tick) => ({ text: tick.toString(), x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0), y: this.getScaleValue(tick), fill: this.axisThemeConfig.labelColor, fontSize: this.axisConfig.labelFontSize, rotation: 0, verticalPos: "middle", horizontalPos: "right" })) }); } if (this.showTick) { const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0); drawableElement.push({ type: "path", groupTexts: ["left-axis", "ticks"], data: this.getTickValues().map((tick) => ({ path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`, strokeFill: this.axisThemeConfig.tickColor, strokeWidth: this.axisConfig.tickWidth })) }); } if (this.showTitle) { drawableElement.push({ type: "text", groupTexts: ["left-axis", "title"], data: [ { text: this.title, x: this.boundingRect.x + this.axisConfig.titlePadding, y: this.boundingRect.y + this.boundingRect.height / 2, fill: this.axisThemeConfig.titleColor, fontSize: this.axisConfig.titleFontSize, rotation: 270, verticalPos: "top", horizontalPos: "center" } ] }); } return drawableElement; } getDrawableElementsForBottomAxis() { const drawableElement = []; if (this.showAxisLine) { const y = this.boundingRect.y + this.axisConfig.axisLineWidth / 2; drawableElement.push({ type: "path", groupTexts: ["bottom-axis", "axis-line"], data: [ { path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`, strokeFill: this.axisThemeConfig.axisLineColor, strokeWidth: this.axisConfig.axisLineWidth } ] }); } if (this.showLabel) { drawableElement.push({ type: "text", groupTexts: ["bottom-axis", "label"], data: this.getTickValues().map((tick) => ({ text: tick.toString(), x: this.getScaleValue(tick), y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0), fill: this.axisThemeConfig.labelColor, fontSize: this.axisConfig.labelFontSize, rotation: 0, verticalPos: "top", horizontalPos: "center" })) }); } if (this.showTick) { const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0); drawableElement.push({ type: "path", groupTexts: ["bottom-axis", "ticks"], data: this.getTickValues().map((tick) => ({ path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`, strokeFill: this.axisThemeConfig.tickColor, strokeWidth: this.axisConfig.tickWidth })) }); } if (this.showTitle) { drawableElement.push({ type: "text", groupTexts: ["bottom-axis", "title"], data: [ { text: this.title, x: this.range[0] + (this.range[1] - this.range[0]) / 2, y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight, fill: this.axisThemeConfig.titleColor, fontSize: this.axisConfig.titleFontSize, rotation: 0, verticalPos: "top", horizontalPos: "center" } ] }); } return drawableElement; } getDrawableElementsForTopAxis() { const drawableElement = []; if (this.showAxisLine) { const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2; drawableElement.push({ type: "path", groupTexts: ["top-axis", "axis-line"], data: [ { path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`, strokeFill: this.axisThemeConfig.axisLineColor, strokeWidth: this.axisConfig.axisLineWidth } ] }); } if (this.showLabel) { drawableElement.push({ type: "text", groupTexts: ["top-axis", "label"], data: this.getTickValues().map((tick) => ({ text: tick.toString(), x: this.getScaleValue(tick), y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding, fill: this.axisThemeConfig.labelColor, fontSize: this.axisConfig.labelFontSize, rotation: 0, verticalPos: "top", horizontalPos: "center" })) }); } if (this.showTick) { const y = this.boundingRect.y; drawableElement.push({ type: "path", groupTexts: ["top-axis", "ticks"], data: this.getTickValues().map((tick) => ({ path: `M ${this.getScaleValue(tick)},${y + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`, strokeFill: this.axisThemeConfig.tickColor, strokeWidth: this.axisConfig.tickWidth })) }); } if (this.showTitle) { drawableElement.push({ type: "text", groupTexts: ["top-axis", "title"], data: [ { text: this.title, x: this.boundingRect.x + this.boundingRect.width / 2, y: this.boundingRect.y + this.axisConfig.titlePadding, fill: this.axisThemeConfig.titleColor, fontSize: this.axisConfig.titleFontSize, rotation: 0, verticalPos: "top", horizontalPos: "center" } ] }); } return drawableElement; } getDrawableElements() { if (this.axisPosition === "left") { return this.getDrawableElementsForLeftAxis(); } if (this.axisPosition === "right") { throw Error("Drawing of right axis is not implemented"); } if (this.axisPosition === "bottom") { return this.getDrawableElementsForBottomAxis(); } if (this.axisPosition === "top") { return this.getDrawableElementsForTopAxis(); } return []; } } class BandAxis extends BaseAxis { constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) { super(axisConfig, title, textDimensionCalculator, axisThemeConfig); this.categories = categories; this.scale = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .scaleBand */ .tiA)().domain(this.categories).range(this.getRange()); } setRange(range) { super.setRange(range); } recalculateScale() { this.scale = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .scaleBand */ .tiA)().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5); _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.l.trace("BandAxis axis final categories, range: ", this.categories, this.getRange()); } getTickValues() { return this.categories; } getScaleValue(value) { return this.scale(value) || this.getRange()[0]; } } class LinearAxis extends BaseAxis { constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) { super(axisConfig, title, textDimensionCalculator, axisThemeConfig); this.domain = domain; this.scale = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .scaleLinear */ .BYU)().domain(this.domain).range(this.getRange()); } getTickValues() { return this.scale.ticks(); } recalculateScale() { const domain = [...this.domain]; if (this.axisPosition === "left") { domain.reverse(); } this.scale = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .scaleLinear */ .BYU)().domain(domain).range(this.getRange()); } getScaleValue(value) { return this.scale(value); } } function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) { const textDimansionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2); if (isBandAxisData(data)) { return new BandAxis( axisConfig, axisThemeConfig, data.categories, data.title, textDimansionCalculator ); } return new LinearAxis( axisConfig, axisThemeConfig, [data.min, data.max], data.title, textDimansionCalculator ); } class ChartTitle { constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) { this.textDimensionCalculator = textDimensionCalculator; this.chartConfig = chartConfig; this.chartData = chartData; this.chartThemeConfig = chartThemeConfig; this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; this.showChartTitle = false; } setBoundingBoxXY(point) { this.boundingRect.x = point.x; this.boundingRect.y = point.y; } calculateSpace(availableSpace) { const titleDimension = this.textDimensionCalculator.getMaxDimension( [this.chartData.title], this.chartConfig.titleFontSize ); const widthRequired = Math.max(titleDimension.width, availableSpace.width); const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding; if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) { this.boundingRect.width = widthRequired; this.boundingRect.height = heightRequired; this.showChartTitle = true; } return { width: this.boundingRect.width, height: this.boundingRect.height }; } getDrawableElements() { const drawableElem = []; if (this.showChartTitle) { drawableElem.push({ groupTexts: ["chart-title"], type: "text", data: [ { fontSize: this.chartConfig.titleFontSize, text: this.chartData.title, verticalPos: "middle", horizontalPos: "center", x: this.boundingRect.x + this.boundingRect.width / 2, y: this.boundingRect.y + this.boundingRect.height / 2, fill: this.chartThemeConfig.titleColor, rotation: 0 } ] }); } return drawableElem; } } function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) { const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2); return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig); } class LinePlot { constructor(plotData, xAxis, yAxis, orientation, plotIndex2) { this.plotData = plotData; this.xAxis = xAxis; this.yAxis = yAxis; this.orientation = orientation; this.plotIndex = plotIndex2; } getDrawableElement() { const finalData = this.plotData.data.map((d) => [ this.xAxis.getScaleValue(d[0]), this.yAxis.getScaleValue(d[1]) ]); let path; if (this.orientation === "horizontal") { path = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .line */ .jvg)().y((d) => d[0]).x((d) => d[1])(finalData); } else { path = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .line */ .jvg)().x((d) => d[0]).y((d) => d[1])(finalData); } if (!path) { return []; } return [ { groupTexts: ["plot", `line-plot-${this.plotIndex}`], type: "path", data: [ { path, strokeFill: this.plotData.strokeFill, strokeWidth: this.plotData.strokeWidth } ] } ]; } } class BarPlot { constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) { this.barData = barData; this.boundingRect = boundingRect; this.xAxis = xAxis; this.yAxis = yAxis; this.orientation = orientation; this.plotIndex = plotIndex2; } getDrawableElement() { const finalData = this.barData.data.map((d) => [ this.xAxis.getScaleValue(d[0]), this.yAxis.getScaleValue(d[1]) ]); const barPaddingPercent = 0.05; const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent); const barWidthHalf = barWidth / 2; if (this.orientation === "horizontal") { return [ { groupTexts: ["plot", `bar-plot-${this.plotIndex}`], type: "rect", data: finalData.map((data) => ({ x: this.boundingRect.x, y: data[0] - barWidthHalf, height: barWidth, width: data[1] - this.boundingRect.x, fill: this.barData.fill, strokeWidth: 0, strokeFill: this.barData.fill })) } ]; } return [ { groupTexts: ["plot", `bar-plot-${this.plotIndex}`], type: "rect", data: finalData.map((data) => ({ x: data[0] - barWidthHalf, y: data[1], width: barWidth, height: this.boundingRect.y + this.boundingRect.height - data[1], fill: this.barData.fill, strokeWidth: 0, strokeFill: this.barData.fill })) } ]; } } class BasePlot { constructor(chartConfig, chartData, chartThemeConfig) { this.chartConfig = chartConfig; this.chartData = chartData; this.chartThemeConfig = chartThemeConfig; this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; } setAxes(xAxis, yAxis) { this.xAxis = xAxis; this.yAxis = yAxis; } setBoundingBoxXY(point) { this.boundingRect.x = point.x; this.boundingRect.y = point.y; } calculateSpace(availableSpace) { this.boundingRect.width = availableSpace.width; this.boundingRect.height = availableSpace.height; return { width: this.boundingRect.width, height: this.boundingRect.height }; } getDrawableElements() { if (!(this.xAxis && this.yAxis)) { throw Error("Axes must be passed to render Plots"); } const drawableElem = []; for (const [i, plot] of this.chartData.plots.entries()) { switch (plot.type) { case "line": { const linePlot = new LinePlot( plot, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i ); drawableElem.push(...linePlot.getDrawableElement()); } break; case "bar": { const barPlot = new BarPlot( plot, this.boundingRect, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i ); drawableElem.push(...barPlot.getDrawableElement()); } break; } } return drawableElem; } } function getPlotComponent(chartConfig, chartData, chartThemeConfig) { return new BasePlot(chartConfig, chartData, chartThemeConfig); } class Orchestrator { constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) { this.chartConfig = chartConfig; this.chartData = chartData; this.componentStore = { title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2), plot: getPlotComponent(chartConfig, chartData, chartThemeConfig), xAxis: getAxis( chartData.xAxis, chartConfig.xAxis, { titleColor: chartThemeConfig.xAxisTitleColor, labelColor: chartThemeConfig.xAxisLabelColor, tickColor: chartThemeConfig.xAxisTickColor, axisLineColor: chartThemeConfig.xAxisLineColor }, tmpSVGGroup2 ), yAxis: getAxis( chartData.yAxis, chartConfig.yAxis, { titleColor: chartThemeConfig.yAxisTitleColor, labelColor: chartThemeConfig.yAxisLabelColor, tickColor: chartThemeConfig.yAxisTickColor, axisLineColor: chartThemeConfig.yAxisLineColor }, tmpSVGGroup2 ) }; } calculateVerticalSpace() { let availableWidth = this.chartConfig.width; let availableHeight = this.chartConfig.height; let plotX = 0; let plotY = 0; let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100); let chartHeight = Math.floor( availableHeight * this.chartConfig.plotReservedSpacePercent / 100 ); let spaceUsed = this.componentStore.plot.calculateSpace({ width: chartWidth, height: chartHeight }); availableWidth -= spaceUsed.width; availableHeight -= spaceUsed.height; spaceUsed = this.componentStore.title.calculateSpace({ width: this.chartConfig.width, height: availableHeight }); plotY = spaceUsed.height; availableHeight -= spaceUsed.height; this.componentStore.xAxis.setAxisPosition("bottom"); spaceUsed = this.componentStore.xAxis.calculateSpace({ width: availableWidth, height: availableHeight }); availableHeight -= spaceUsed.height; this.componentStore.yAxis.setAxisPosition("left"); spaceUsed = this.componentStore.yAxis.calculateSpace({ width: availableWidth, height: availableHeight }); plotX = spaceUsed.width; availableWidth -= spaceUsed.width; if (availableWidth > 0) { chartWidth += availableWidth; availableWidth = 0; } if (availableHeight > 0) { chartHeight += availableHeight; availableHeight = 0; } this.componentStore.plot.calculateSpace({ width: chartWidth, height: chartHeight }); this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY }); this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]); this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight }); this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]); this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY }); if (this.chartData.plots.some((p) => isBarPlot(p))) { this.componentStore.xAxis.recalculateOuterPaddingToDrawBar(); } } calculateHorizonatalSpace() { let availableWidth = this.chartConfig.width; let availableHeight = this.chartConfig.height; let titleYEnd = 0; let plotX = 0; let plotY = 0; let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100); let chartHeight = Math.floor( availableHeight * this.chartConfig.plotReservedSpacePercent / 100 ); let spaceUsed = this.componentStore.plot.calculateSpace({ width: chartWidth, height: chartHeight }); availableWidth -= spaceUsed.width; availableHeight -= spaceUsed.height; spaceUsed = this.componentStore.title.calculateSpace({ width: this.chartConfig.width, height: availableHeight }); titleYEnd = spaceUsed.height; availableHeight -= spaceUsed.height; this.componentStore.xAxis.setAxisPosition("left"); spaceUsed = this.componentStore.xAxis.calculateSpace({ width: availableWidth, height: availableHeight }); availableWidth -= spaceUsed.width; plotX = spaceUsed.width; this.componentStore.yAxis.setAxisPosition("top"); spaceUsed = this.componentStore.yAxis.calculateSpace({ width: availableWidth, height: availableHeight }); availableHeight -= spaceUsed.height; plotY = titleYEnd + spaceUsed.height; if (availableWidth > 0) { chartWidth += availableWidth; availableWidth = 0; } if (availableHeight > 0) { chartHeight += availableHeight; availableHeight = 0; } this.componentStore.plot.calculateSpace({ width: chartWidth, height: chartHeight }); this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY }); this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]); this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd }); this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]); this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY }); if (this.chartData.plots.some((p) => isBarPlot(p))) { this.componentStore.xAxis.recalculateOuterPaddingToDrawBar(); } } calculateSpace() { if (this.chartConfig.chartOrientation === "horizontal") { this.calculateHorizonatalSpace(); } else { this.calculateVerticalSpace(); } } getDrawableElement() { this.calculateSpace(); const drawableElem = []; this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis); for (const component of Object.values(this.componentStore)) { drawableElem.push(...component.getDrawableElements()); } return drawableElem; } } class XYChartBuilder { static build(config, chartData, chartThemeConfig, tmpSVGGroup2) { const orchestrator = new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2); return orchestrator.getDrawableElement(); } } let plotIndex = 0; let tmpSVGGroup; let xyChartConfig = getChartDefaultConfig(); let xyChartThemeConfig = getChartDefaultThemeConfig(); let xyChartData = getChartDefaultData(); let plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim()); let hasSetXAxis = false; let hasSetYAxis = false; function getChartDefaultThemeConfig() { const defaultThemeVariables = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.D)(); const config = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.E)(); return (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.B)(defaultThemeVariables.xyChart, config.themeVariables.xyChart); } function getChartDefaultConfig() { const config = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.E)(); return (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.B)( _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.A.xyChart, config.xyChart ); } function getChartDefaultData() { return { yAxis: { type: "linear", title: "", min: Infinity, max: -Infinity }, xAxis: { type: "band", title: "", categories: [] }, title: "", plots: [] }; } function textSanitizer(text) { const config = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.E)(); return (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.d)(text.trim(), config); } function setTmpSVGG(SVGG) { tmpSVGGroup = SVGG; } function setOrientation(orientation) { if (orientation === "horizontal") { xyChartConfig.chartOrientation = "horizontal"; } else { xyChartConfig.chartOrientation = "vertical"; } } function setXAxisTitle(title) { xyChartData.xAxis.title = textSanitizer(title.text); } function setXAxisRangeData(min, max) { xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min, max }; hasSetXAxis = true; } function setXAxisBand(categories) { xyChartData.xAxis = { type: "band", title: xyChartData.xAxis.title, categories: categories.map((c) => textSanitizer(c.text)) }; hasSetXAxis = true; } function setYAxisTitle(title) { xyChartData.yAxis.title = textSanitizer(title.text); } function setYAxisRangeData(min, max) { xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min, max }; hasSetYAxis = true; } function setYAxisRangeFromPlotData(data) { const minValue = Math.min(...data); const maxValue = Math.max(...data); const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity; const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity; xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min: Math.min(prevMinValue, minValue), max: Math.max(prevMaxValue, maxValue) }; } function transformDataWithoutCategory(data) { let retData = []; if (data.length === 0) { return retData; } if (!hasSetXAxis) { const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity; const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity; setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length)); } if (!hasSetYAxis) { setYAxisRangeFromPlotData(data); } if (isBandAxisData(xyChartData.xAxis)) { retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]); } if (isLinearAxisData(xyChartData.xAxis)) { const min = xyChartData.xAxis.min; const max = xyChartData.xAxis.max; const step = (max - min + 1) / data.length; const categories = []; for (let i = min; i <= max; i += step) { categories.push(`${i}`); } retData = categories.map((c, i) => [c, data[i]]); } return retData; } function getPlotColorFromPalette(plotIndex2) { return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length]; } function setLineData(title, data) { const plotData = transformDataWithoutCategory(data); xyChartData.plots.push({ type: "line", strokeFill: getPlotColorFromPalette(plotIndex), strokeWidth: 2, data: plotData }); plotIndex++; } function setBarData(title, data) { const plotData = transformDataWithoutCategory(data); xyChartData.plots.push({ type: "bar", fill: getPlotColorFromPalette(plotIndex), data: plotData }); plotIndex++; } function getDrawableElem() { if (xyChartData.plots.length === 0) { throw Error("No Plot to render, please provide a plot with some data"); } xyChartData.title = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.r)(); return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup); } function getChartThemeConfig() { return xyChartThemeConfig; } function getChartConfig() { return xyChartConfig; } const clear = function() { (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.t)(); plotIndex = 0; xyChartConfig = getChartDefaultConfig(); xyChartData = getChartDefaultData(); xyChartThemeConfig = getChartDefaultThemeConfig(); plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim()); hasSetXAxis = false; hasSetYAxis = false; }; const db = { getDrawableElem, clear, setAccTitle: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.s, getAccTitle: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.g, setDiagramTitle: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.q, getDiagramTitle: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.r, getAccDescription: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.a, setAccDescription: _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.b, setOrientation, setXAxisTitle, setXAxisRangeData, setXAxisBand, setYAxisTitle, setYAxisRangeData, setLineData, setBarData, setTmpSVGG, getChartThemeConfig, getChartConfig }; const draw = (txt, id, _version, diagObj) => { const db2 = diagObj.db; const themeConfig = db2.getChartThemeConfig(); const chartConfig = db2.getChartConfig(); function getDominantBaseLine(horizontalPos) { return horizontalPos === "top" ? "text-before-edge" : "middle"; } function getTextAnchor(verticalPos) { return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle"; } function getTextTransformation(data) { return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`; } _mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.l.debug("Rendering xychart chart\n" + txt); const svg = (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.z)(id); const group = svg.append("g").attr("class", "main"); const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background"); (0,_mermaid_934d9bea_js__WEBPACK_IMPORTED_MODULE_5__.i)(svg, chartConfig.height, chartConfig.width, true); svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`); background.attr("fill", themeConfig.backgroundColor); db2.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group")); const shapes = db2.getDrawableElem(); const groups = {}; function getGroup(gList) { let elem = group; let prefix = ""; for (const [i] of gList.entries()) { let parent = group; if (i > 0 && groups[prefix]) { parent = groups[prefix]; } prefix += gList[i]; elem = groups[prefix]; if (!elem) { elem = groups[prefix] = parent.append("g").attr("class", gList[i]); } } return elem; } for (const shape of shapes) { if (shape.data.length === 0) { continue; } const shapeGroup = getGroup(shape.groupTexts); switch (shape.type) { case "rect": shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data) => data.x).attr("y", (data) => data.y).attr("width", (data) => data.width).attr("height", (data) => data.height).attr("fill", (data) => data.fill).attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth); break; case "text": shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.verticalPos)).attr("text-anchor", (data) => getTextAnchor(data.horizontalPos)).attr("transform", (data) => getTextTransformation(data)).text((data) => data.text); break; case "path": shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data) => data.path).attr("fill", (data) => data.fill ? data.fill : "none").attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth); break; } } }; const renderer = { draw }; const diagram = { parser: parser$1, db, renderer }; /***/ }) }; ;