#!/usr/bin/env node var __getOwnPropNames2 = Object.getOwnPropertyNames; var __commonJS2 = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; // ../../core/dist/stage-parser.js var require_stage_parser = __commonJS2({ "../../core/dist/stage-parser.js"(exports, module) { var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __reExport = (target, module2, copyDefault, desc) => { if (module2 && typeof module2 === "object" || typeof module2 === "function") { for (let key of __getOwnPropNames(module2)) if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); } return target; }; var __toESM = (module2, isNodeMode) => { return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); }; var __toCommonJS = /* @__PURE__ */ ((cache) => { return (module2, temp) => { return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp); }; })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); var require_moo = __commonJS({ "../../node_modules/.pnpm/moo@0.5.1/node_modules/moo/moo.js"(exports2, module2) { (function(root, factory) { if (typeof define === "function" && define.amd) { define([], factory); } else if (typeof module2 === "object" && module2.exports) { module2.exports = factory(); } else { root.moo = factory(); } })(exports2, function() { "use strict"; var hasOwnProperty2 = Object.prototype.hasOwnProperty; var toString = Object.prototype.toString; var hasSticky = typeof new RegExp().sticky === "boolean"; function isRegExp(o) { return o && toString.call(o) === "[object RegExp]"; } function isObject(o) { return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o); } function reEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); } function reGroups(s) { var re = new RegExp("|" + s); return re.exec("").length - 1; } function reCapture(s) { return "(" + s + ")"; } function reUnion(regexps) { if (!regexps.length) return "(?!)"; var source = regexps.map(function(s) { return "(?:" + s + ")"; }).join("|"); return "(?:" + source + ")"; } function regexpOrLiteral(obj) { if (typeof obj === "string") { return "(?:" + reEscape(obj) + ")"; } else if (isRegExp(obj)) { if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed"); if (obj.global) throw new Error("RegExp /g flag is implied"); if (obj.sticky) throw new Error("RegExp /y flag is implied"); if (obj.multiline) throw new Error("RegExp /m flag is implied"); return obj.source; } else { throw new Error("Not a pattern: " + obj); } } function objectToRules(object) { var keys = Object.getOwnPropertyNames(object); var result = []; for (var i = 0; i < keys.length; i++) { var key = keys[i]; var thing = object[key]; var rules = [].concat(thing); if (key === "include") { for (var j = 0; j < rules.length; j++) { result.push({ include: rules[j] }); } continue; } var match = []; rules.forEach(function(rule) { if (isObject(rule)) { if (match.length) result.push(ruleOptions(key, match)); result.push(ruleOptions(key, rule)); match = []; } else { match.push(rule); } }); if (match.length) result.push(ruleOptions(key, match)); } return result; } function arrayToRules(array) { var result = []; for (var i = 0; i < array.length; i++) { var obj = array[i]; if (obj.include) { var include = [].concat(obj.include); for (var j = 0; j < include.length; j++) { result.push({ include: include[j] }); } continue; } if (!obj.type) { throw new Error("Rule has no type: " + JSON.stringify(obj)); } result.push(ruleOptions(obj.type, obj)); } return result; } function ruleOptions(type, obj) { if (!isObject(obj)) { obj = { match: obj }; } if (obj.include) { throw new Error("Matching rules cannot also include states"); } var options = { defaultType: type, lineBreaks: !!obj.error || !!obj.fallback, pop: false, next: null, push: null, error: false, fallback: false, value: null, type: null, shouldThrow: false }; for (var key in obj) { if (hasOwnProperty2.call(obj, key)) { options[key] = obj[key]; } } if (typeof options.type === "string" && type !== options.type) { throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')"); } var match = options.match; options.match = Array.isArray(match) ? match : match ? [match] : []; options.match.sort(function(a, b) { return isRegExp(a) && isRegExp(b) ? 0 : isRegExp(b) ? -1 : isRegExp(a) ? 1 : b.length - a.length; }); return options; } function toRules(spec) { return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec); } var defaultErrorRule = ruleOptions("error", { lineBreaks: true, shouldThrow: true }); function compileRules(rules, hasStates) { var errorRule = null; var fast = /* @__PURE__ */ Object.create(null); var fastAllowed = true; var unicodeFlag = null; var groups = []; var parts = []; for (var i = 0; i < rules.length; i++) { if (rules[i].fallback) { fastAllowed = false; } } for (var i = 0; i < rules.length; i++) { var options = rules[i]; if (options.include) { throw new Error("Inheritance is not allowed in stateless lexers"); } if (options.error || options.fallback) { if (errorRule) { if (!options.fallback === !errorRule.fallback) { throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')"); } else { throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')"); } } errorRule = options; } var match = options.match.slice(); if (fastAllowed) { while (match.length && typeof match[0] === "string" && match[0].length === 1) { var word = match.shift(); fast[word.charCodeAt(0)] = options; } } if (options.pop || options.push || options.next) { if (!hasStates) { throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')"); } if (options.fallback) { throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')"); } } if (match.length === 0) { continue; } fastAllowed = false; groups.push(options); for (var j = 0; j < match.length; j++) { var obj = match[j]; if (!isRegExp(obj)) { continue; } if (unicodeFlag === null) { unicodeFlag = obj.unicode; } else if (unicodeFlag !== obj.unicode && options.fallback === false) { throw new Error("If one rule is /u then all must be"); } } var pat = reUnion(match.map(regexpOrLiteral)); var regexp = new RegExp(pat); if (regexp.test("")) { throw new Error("RegExp matches empty string: " + regexp); } var groupCount = reGroups(pat); if (groupCount > 0) { throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: \u2026 ) instead"); } if (!options.lineBreaks && regexp.test("\n")) { throw new Error("Rule should declare lineBreaks: " + regexp); } parts.push(reCapture(pat)); } var fallbackRule = errorRule && errorRule.fallback; var flags = hasSticky && !fallbackRule ? "ym" : "gm"; var suffix = hasSticky || fallbackRule ? "" : "|"; if (unicodeFlag === true) flags += "u"; var combined = new RegExp(reUnion(parts) + suffix, flags); return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule }; } function compile(rules) { var result = compileRules(toRules(rules)); return new Lexer({ start: result }, "start"); } function checkStateGroup(g, name, map) { var state = g && (g.push || g.next); if (state && !map[state]) { throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')"); } if (g && g.pop && +g.pop !== 1) { throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')"); } } function compileStates(states, start) { var all = states.$all ? toRules(states.$all) : []; delete states.$all; var keys = Object.getOwnPropertyNames(states); if (!start) start = keys[0]; var ruleMap = /* @__PURE__ */ Object.create(null); for (var i = 0; i < keys.length; i++) { var key = keys[i]; ruleMap[key] = toRules(states[key]).concat(all); } for (var i = 0; i < keys.length; i++) { var key = keys[i]; var rules = ruleMap[key]; var included = /* @__PURE__ */ Object.create(null); for (var j = 0; j < rules.length; j++) { var rule = rules[j]; if (!rule.include) continue; var splice = [j, 1]; if (rule.include !== key && !included[rule.include]) { included[rule.include] = true; var newRules = ruleMap[rule.include]; if (!newRules) { throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')"); } for (var k = 0; k < newRules.length; k++) { var newRule = newRules[k]; if (rules.indexOf(newRule) !== -1) continue; splice.push(newRule); } } rules.splice.apply(rules, splice); j--; } } var map = /* @__PURE__ */ Object.create(null); for (var i = 0; i < keys.length; i++) { var key = keys[i]; map[key] = compileRules(ruleMap[key], true); } for (var i = 0; i < keys.length; i++) { var name = keys[i]; var state = map[name]; var groups = state.groups; for (var j = 0; j < groups.length; j++) { checkStateGroup(groups[j], name, map); } var fastKeys = Object.getOwnPropertyNames(state.fast); for (var j = 0; j < fastKeys.length; j++) { checkStateGroup(state.fast[fastKeys[j]], name, map); } } return new Lexer(map, start); } function keywordTransform(map) { var reverseMap = /* @__PURE__ */ Object.create(null); var byLength = /* @__PURE__ */ Object.create(null); var types = Object.getOwnPropertyNames(map); for (var i = 0; i < types.length; i++) { var tokenType = types[i]; var item = map[tokenType]; var keywordList = Array.isArray(item) ? item : [item]; keywordList.forEach(function(keyword) { (byLength[keyword.length] = byLength[keyword.length] || []).push(keyword); if (typeof keyword !== "string") { throw new Error("keyword must be string (in keyword '" + tokenType + "')"); } reverseMap[keyword] = tokenType; }); } function str(x) { return JSON.stringify(x); } var source = ""; source += "switch (value.length) {\n"; for (var length in byLength) { var keywords = byLength[length]; source += "case " + length + ":\n"; source += "switch (value) {\n"; keywords.forEach(function(keyword) { var tokenType2 = reverseMap[keyword]; source += "case " + str(keyword) + ": return " + str(tokenType2) + "\n"; }); source += "}\n"; } source += "}\n"; return Function("value", source); } var Lexer = function(states, state) { this.startState = state; this.states = states; this.buffer = ""; this.stack = []; this.reset(); }; Lexer.prototype.reset = function(data, info) { this.buffer = data || ""; this.index = 0; this.line = info ? info.line : 1; this.col = info ? info.col : 1; this.queuedToken = info ? info.queuedToken : null; this.queuedThrow = info ? info.queuedThrow : null; this.setState(info ? info.state : this.startState); this.stack = info && info.stack ? info.stack.slice() : []; return this; }; Lexer.prototype.save = function() { return { line: this.line, col: this.col, state: this.state, stack: this.stack.slice(), queuedToken: this.queuedToken, queuedThrow: this.queuedThrow }; }; Lexer.prototype.setState = function(state) { if (!state || this.state === state) return; this.state = state; var info = this.states[state]; this.groups = info.groups; this.error = info.error; this.re = info.regexp; this.fast = info.fast; }; Lexer.prototype.popState = function() { this.setState(this.stack.pop()); }; Lexer.prototype.pushState = function(state) { this.stack.push(this.state); this.setState(state); }; var eat = hasSticky ? function(re, buffer) { return re.exec(buffer); } : function(re, buffer) { var match = re.exec(buffer); if (match[0].length === 0) { return null; } return match; }; Lexer.prototype._getGroup = function(match) { var groupCount = this.groups.length; for (var i = 0; i < groupCount; i++) { if (match[i + 1] !== void 0) { return this.groups[i]; } } throw new Error("Cannot find token type for matched text"); }; function tokenToString() { return this.value; } Lexer.prototype.next = function() { var index = this.index; if (this.queuedGroup) { var token = this._token(this.queuedGroup, this.queuedText, index); this.queuedGroup = null; this.queuedText = ""; return token; } var buffer = this.buffer; if (index === buffer.length) { return; } var group = this.fast[buffer.charCodeAt(index)]; if (group) { return this._token(group, buffer.charAt(index), index); } var re = this.re; re.lastIndex = index; var match = eat(re, buffer); var error = this.error; if (match == null) { return this._token(error, buffer.slice(index, buffer.length), index); } var group = this._getGroup(match); var text = match[0]; if (error.fallback && match.index !== index) { this.queuedGroup = group; this.queuedText = text; return this._token(error, buffer.slice(index, match.index), index); } return this._token(group, text, index); }; Lexer.prototype._token = function(group, text, offset) { var lineBreaks = 0; if (group.lineBreaks) { var matchNL = /\n/g; var nl = 1; if (text === "\n") { lineBreaks = 1; } else { while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; } } } var token = { type: typeof group.type === "function" && group.type(text) || group.defaultType, value: typeof group.value === "function" ? group.value(text) : text, text, toString: tokenToString, offset, lineBreaks, line: this.line, col: this.col }; var size = text.length; this.index += size; this.line += lineBreaks; if (lineBreaks !== 0) { this.col = size - nl + 1; } else { this.col += size; } if (group.shouldThrow) { throw new Error(this.formatError(token, "invalid syntax")); } if (group.pop) this.popState(); else if (group.push) this.pushState(group.push); else if (group.next) this.setState(group.next); return token; }; if (typeof Symbol !== "undefined" && Symbol.iterator) { var LexerIterator = function(lexer) { this.lexer = lexer; }; LexerIterator.prototype.next = function() { var token = this.lexer.next(); return { value: token, done: !token }; }; LexerIterator.prototype[Symbol.iterator] = function() { return this; }; Lexer.prototype[Symbol.iterator] = function() { return new LexerIterator(this); }; } Lexer.prototype.formatError = function(token, message) { if (token == null) { var text = this.buffer.slice(this.index); var token = { text, offset: this.index, lineBreaks: text.indexOf("\n") === -1 ? 0 : 1, line: this.line, col: this.col }; } var start = Math.max(0, token.offset - token.col + 1); var eol8 = token.lineBreaks ? token.text.indexOf("\n") : token.text.length; var firstLine = this.buffer.substring(start, token.offset + eol8); message += " at line " + token.line + " col " + token.col + ":\n\n"; message += " " + firstLine + "\n"; message += " " + Array(token.col).join(" ") + "^"; return message; }; Lexer.prototype.clone = function() { return new Lexer(this.states, this.state); }; Lexer.prototype.has = function(tokenType) { return true; }; return { compile, states: compileStates, error: Object.freeze({ error: true }), fallback: Object.freeze({ fallback: true }), keywords: keywordTransform }; }); } }); var require_eol = __commonJS({ "../../node_modules/.pnpm/eol@0.9.1/node_modules/eol/eol.js"(exports2, module2) { !function(root, name, make) { if (typeof module2 != "undefined" && module2.exports) module2.exports = make(); else root[name] = make(); }(exports2, "eol", function() { var api = {}; var isWindows = typeof process != "undefined" && process.platform === "win32"; var linebreak = isWindows ? "\r\n" : "\n"; var newline = /\r\n|\r|\n/g; function before(text) { return linebreak + text; } function after(text) { return text + linebreak; } function converts(to) { function convert(text) { return text.replace(newline, to); } convert.toString = function() { return to; }; return convert; } function split(text) { return text.split(newline); } api["lf"] = converts("\n"); api["cr"] = converts("\r"); api["crlf"] = converts("\r\n"); api["auto"] = converts(linebreak); api["before"] = before; api["after"] = after; api["split"] = split; return api; }); } }); var require_parser = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) { "use strict"; var ParserEND = 1114112; var ParserError = class extends Error { constructor(msg, filename, linenumber) { super("[ParserError] " + msg, filename, linenumber); this.name = "ParserError"; this.code = "ParserError"; if (Error.captureStackTrace) Error.captureStackTrace(this, ParserError); } }; var State = class { constructor(parser) { this.parser = parser; this.buf = ""; this.returned = null; this.result = null; this.resultTable = null; this.resultArr = null; } }; var Parser = class { constructor() { this.pos = 0; this.col = 0; this.line = 0; this.obj = {}; this.ctx = this.obj; this.stack = []; this._buf = ""; this.char = null; this.ii = 0; this.state = new State(this.parseStart); } parse(str) { if (str.length === 0 || str.length == null) return; this._buf = String(str); this.ii = -1; this.char = -1; let getNext; while (getNext === false || this.nextChar()) { getNext = this.runOne(); } this._buf = null; } nextChar() { if (this.char === 10) { ++this.line; this.col = -1; } ++this.ii; this.char = this._buf.codePointAt(this.ii); ++this.pos; ++this.col; return this.haveBuffer(); } haveBuffer() { return this.ii < this._buf.length; } runOne() { return this.state.parser.call(this, this.state.returned); } finish() { this.char = ParserEND; let last; do { last = this.state.parser; this.runOne(); } while (this.state.parser !== last); this.ctx = null; this.state = null; this._buf = null; return this.obj; } next(fn) { if (typeof fn !== "function") throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn)); this.state.parser = fn; } goto(fn) { this.next(fn); return this.runOne(); } call(fn, returnWith) { if (returnWith) this.next(returnWith); this.stack.push(this.state); this.state = new State(fn); } callNow(fn, returnWith) { this.call(fn, returnWith); return this.runOne(); } return(value) { if (this.stack.length === 0) throw this.error(new ParserError("Stack underflow")); if (value === void 0) value = this.state.buf; this.state = this.stack.pop(); this.state.returned = value; } returnNow(value) { this.return(value); return this.runOne(); } consume() { if (this.char === ParserEND) throw this.error(new ParserError("Unexpected end-of-buffer")); this.state.buf += this._buf[this.ii]; } error(err) { err.line = this.line; err.col = this.col; err.pos = this.pos; return err; } parseStart() { throw new ParserError("Must declare a parseStart method"); } }; Parser.END = ParserEND; Parser.Error = ParserError; module2.exports = Parser; } }); var require_create_datetime = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) { "use strict"; module2.exports = (value) => { const date = new Date(value); if (isNaN(date)) { throw new TypeError("Invalid Datetime"); } else { return date; } }; } }); var require_format_num = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) { "use strict"; module2.exports = (d, num) => { num = String(num); while (num.length < d) num = "0" + num; return num; }; } }); var require_create_datetime_float = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) { "use strict"; var f = require_format_num(); var FloatingDateTime = class extends Date { constructor(value) { super(value + "Z"); this.isFloating = true; } toISOString() { const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`; const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`; return `${date}T${time}`; } }; module2.exports = (value) => { const date = new FloatingDateTime(value); if (isNaN(date)) { throw new TypeError("Invalid Datetime"); } else { return date; } }; } }); var require_create_date = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) { "use strict"; var f = require_format_num(); var DateTime = global.Date; var Date2 = class extends DateTime { constructor(value) { super(value); this.isDate = true; } toISOString() { return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`; } }; module2.exports = (value) => { const date = new Date2(value); if (isNaN(date)) { throw new TypeError("Invalid Datetime"); } else { return date; } }; } }); var require_create_time = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) { "use strict"; var f = require_format_num(); var Time = class extends Date { constructor(value) { super(`0000-01-01T${value}Z`); this.isTime = true; } toISOString() { return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`; } }; module2.exports = (value) => { const date = new Time(value); if (isNaN(date)) { throw new TypeError("Invalid Datetime"); } else { return date; } }; } }); var require_toml_parser = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) { "use strict"; module.exports = makeParserClass(require_parser()); module.exports.makeParserClass = makeParserClass; var TomlError = class extends Error { constructor(msg) { super(msg); this.name = "TomlError"; if (Error.captureStackTrace) Error.captureStackTrace(this, TomlError); this.fromTOML = true; this.wrapped = null; } }; TomlError.wrap = (err) => { const terr = new TomlError(err.message); terr.code = err.code; terr.wrapped = err; return terr; }; module.exports.TomlError = TomlError; var createDateTime = require_create_datetime(); var createDateTimeFloat = require_create_datetime_float(); var createDate = require_create_date(); var createTime = require_create_time(); var CTRL_I = 9; var CTRL_J = 10; var CTRL_M = 13; var CTRL_CHAR_BOUNDARY = 31; var CHAR_SP = 32; var CHAR_QUOT = 34; var CHAR_NUM = 35; var CHAR_APOS = 39; var CHAR_PLUS = 43; var CHAR_COMMA = 44; var CHAR_HYPHEN = 45; var CHAR_PERIOD = 46; var CHAR_0 = 48; var CHAR_1 = 49; var CHAR_7 = 55; var CHAR_9 = 57; var CHAR_COLON = 58; var CHAR_EQUALS = 61; var CHAR_A = 65; var CHAR_E = 69; var CHAR_F = 70; var CHAR_T = 84; var CHAR_U = 85; var CHAR_Z = 90; var CHAR_LOWBAR = 95; var CHAR_a = 97; var CHAR_b = 98; var CHAR_e = 101; var CHAR_f = 102; var CHAR_i = 105; var CHAR_l = 108; var CHAR_n = 110; var CHAR_o = 111; var CHAR_r = 114; var CHAR_s = 115; var CHAR_t = 116; var CHAR_u = 117; var CHAR_x = 120; var CHAR_z = 122; var CHAR_LCUB = 123; var CHAR_RCUB = 125; var CHAR_LSQB = 91; var CHAR_BSOL = 92; var CHAR_RSQB = 93; var CHAR_DEL = 127; var SURROGATE_FIRST = 55296; var SURROGATE_LAST = 57343; var escapes = { [CHAR_b]: "\b", [CHAR_t]: " ", [CHAR_n]: "\n", [CHAR_f]: "\f", [CHAR_r]: "\r", [CHAR_QUOT]: '"', [CHAR_BSOL]: "\\" }; function isDigit(cp) { return cp >= CHAR_0 && cp <= CHAR_9; } function isHexit(cp) { return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9; } function isBit(cp) { return cp === CHAR_1 || cp === CHAR_0; } function isOctit(cp) { return cp >= CHAR_0 && cp <= CHAR_7; } function isAlphaNumQuoteHyphen(cp) { return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN; } function isAlphaNumHyphen(cp) { return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN; } var _type = Symbol("type"); var _declared = Symbol("declared"); var hasOwnProperty = Object.prototype.hasOwnProperty; var defineProperty = Object.defineProperty; var descriptor = { configurable: true, enumerable: true, writable: true, value: void 0 }; function hasKey(obj, key) { if (hasOwnProperty.call(obj, key)) return true; if (key === "__proto__") defineProperty(obj, "__proto__", descriptor); return false; } var INLINE_TABLE = Symbol("inline-table"); function InlineTable() { return Object.defineProperties({}, { [_type]: { value: INLINE_TABLE } }); } function isInlineTable(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === INLINE_TABLE; } var TABLE = Symbol("table"); function Table() { return Object.defineProperties({}, { [_type]: { value: TABLE }, [_declared]: { value: false, writable: true } }); } function isTable(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === TABLE; } var _contentType = Symbol("content-type"); var INLINE_LIST = Symbol("inline-list"); function InlineList(type) { return Object.defineProperties([], { [_type]: { value: INLINE_LIST }, [_contentType]: { value: type } }); } function isInlineList(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === INLINE_LIST; } var LIST = Symbol("list"); function List() { return Object.defineProperties([], { [_type]: { value: LIST } }); } function isList(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === LIST; } var _custom; try { const utilInspect = eval("require('util').inspect"); _custom = utilInspect.custom; } catch (_) { } var _inspect = _custom || "inspect"; var BoxedBigInt = class { constructor(value) { try { this.value = global.BigInt.asIntN(64, value); } catch (_) { this.value = null; } Object.defineProperty(this, _type, { value: INTEGER }); } isNaN() { return this.value === null; } toString() { return String(this.value); } [_inspect]() { return `[BigInt: ${this.toString()}]}`; } valueOf() { return this.value; } }; var INTEGER = Symbol("integer"); function Integer(value) { let num = Number(value); if (Object.is(num, -0)) num = 0; if (global.BigInt && !Number.isSafeInteger(num)) { return new BoxedBigInt(value); } else { return Object.defineProperties(new Number(num), { isNaN: { value: function() { return isNaN(this); } }, [_type]: { value: INTEGER }, [_inspect]: { value: () => `[Integer: ${value}]` } }); } } function isInteger(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === INTEGER; } var FLOAT = Symbol("float"); function Float(value) { return Object.defineProperties(new Number(value), { [_type]: { value: FLOAT }, [_inspect]: { value: () => `[Float: ${value}]` } }); } function isFloat(obj) { if (obj === null || typeof obj !== "object") return false; return obj[_type] === FLOAT; } function tomlType(value) { const type = typeof value; if (type === "object") { if (value === null) return "null"; if (value instanceof Date) return "datetime"; if (_type in value) { switch (value[_type]) { case INLINE_TABLE: return "inline-table"; case INLINE_LIST: return "inline-list"; case TABLE: return "table"; case LIST: return "list"; case FLOAT: return "float"; case INTEGER: return "integer"; } } } return type; } function makeParserClass(Parser) { class TOMLParser extends Parser { constructor() { super(); this.ctx = this.obj = Table(); } atEndOfWord() { return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine(); } atEndOfLine() { return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M; } parseStart() { if (this.char === Parser.END) { return null; } else if (this.char === CHAR_LSQB) { return this.call(this.parseTableOrList); } else if (this.char === CHAR_NUM) { return this.call(this.parseComment); } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { return null; } else if (isAlphaNumQuoteHyphen(this.char)) { return this.callNow(this.parseAssignStatement); } else { throw this.error(new TomlError(`Unknown character "${this.char}"`)); } } parseWhitespaceToEOL() { if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { return null; } else if (this.char === CHAR_NUM) { return this.goto(this.parseComment); } else if (this.char === Parser.END || this.char === CTRL_J) { return this.return(); } else { throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line")); } } parseAssignStatement() { return this.callNow(this.parseAssign, this.recordAssignStatement); } recordAssignStatement(kv) { let target = this.ctx; let finalKey = kv.key.pop(); for (let kw of kv.key) { if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { throw this.error(new TomlError("Can't redefine existing key")); } target = target[kw] = target[kw] || Table(); } if (hasKey(target, finalKey)) { throw this.error(new TomlError("Can't redefine existing key")); } if (isInteger(kv.value) || isFloat(kv.value)) { target[finalKey] = kv.value.valueOf(); } else { target[finalKey] = kv.value; } return this.goto(this.parseWhitespaceToEOL); } parseAssign() { return this.callNow(this.parseKeyword, this.recordAssignKeyword); } recordAssignKeyword(key) { if (this.state.resultTable) { this.state.resultTable.push(key); } else { this.state.resultTable = [key]; } return this.goto(this.parseAssignKeywordPreDot); } parseAssignKeywordPreDot() { if (this.char === CHAR_PERIOD) { return this.next(this.parseAssignKeywordPostDot); } else if (this.char !== CHAR_SP && this.char !== CTRL_I) { return this.goto(this.parseAssignEqual); } } parseAssignKeywordPostDot() { if (this.char !== CHAR_SP && this.char !== CTRL_I) { return this.callNow(this.parseKeyword, this.recordAssignKeyword); } } parseAssignEqual() { if (this.char === CHAR_EQUALS) { return this.next(this.parseAssignPreValue); } else { throw this.error(new TomlError('Invalid character, expected "="')); } } parseAssignPreValue() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else { return this.callNow(this.parseValue, this.recordAssignValue); } } recordAssignValue(value) { return this.returnNow({ key: this.state.resultTable, value }); } parseComment() { do { if (this.char === Parser.END || this.char === CTRL_J) { return this.return(); } } while (this.nextChar()); } parseTableOrList() { if (this.char === CHAR_LSQB) { this.next(this.parseList); } else { return this.goto(this.parseTable); } } parseTable() { this.ctx = this.obj; return this.goto(this.parseTableNext); } parseTableNext() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else { return this.callNow(this.parseKeyword, this.parseTableMore); } } parseTableMore(keyword) { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else if (this.char === CHAR_RSQB) { if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) { throw this.error(new TomlError("Can't redefine existing key")); } else { this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table(); this.ctx[_declared] = true; } return this.next(this.parseWhitespaceToEOL); } else if (this.char === CHAR_PERIOD) { if (!hasKey(this.ctx, keyword)) { this.ctx = this.ctx[keyword] = Table(); } else if (isTable(this.ctx[keyword])) { this.ctx = this.ctx[keyword]; } else if (isList(this.ctx[keyword])) { this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1]; } else { throw this.error(new TomlError("Can't redefine existing key")); } return this.next(this.parseTableNext); } else { throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]")); } } parseList() { this.ctx = this.obj; return this.goto(this.parseListNext); } parseListNext() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else { return this.callNow(this.parseKeyword, this.parseListMore); } } parseListMore(keyword) { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else if (this.char === CHAR_RSQB) { if (!hasKey(this.ctx, keyword)) { this.ctx[keyword] = List(); } if (isInlineList(this.ctx[keyword])) { throw this.error(new TomlError("Can't extend an inline array")); } else if (isList(this.ctx[keyword])) { const next = Table(); this.ctx[keyword].push(next); this.ctx = next; } else { throw this.error(new TomlError("Can't redefine an existing key")); } return this.next(this.parseListEnd); } else if (this.char === CHAR_PERIOD) { if (!hasKey(this.ctx, keyword)) { this.ctx = this.ctx[keyword] = Table(); } else if (isInlineList(this.ctx[keyword])) { throw this.error(new TomlError("Can't extend an inline array")); } else if (isInlineTable(this.ctx[keyword])) { throw this.error(new TomlError("Can't extend an inline table")); } else if (isList(this.ctx[keyword])) { this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1]; } else if (isTable(this.ctx[keyword])) { this.ctx = this.ctx[keyword]; } else { throw this.error(new TomlError("Can't redefine an existing key")); } return this.next(this.parseListNext); } else { throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]")); } } parseListEnd(keyword) { if (this.char === CHAR_RSQB) { return this.next(this.parseWhitespaceToEOL); } else { throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]")); } } parseValue() { if (this.char === Parser.END) { throw this.error(new TomlError("Key without value")); } else if (this.char === CHAR_QUOT) { return this.next(this.parseDoubleString); } if (this.char === CHAR_APOS) { return this.next(this.parseSingleString); } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { return this.goto(this.parseNumberSign); } else if (this.char === CHAR_i) { return this.next(this.parseInf); } else if (this.char === CHAR_n) { return this.next(this.parseNan); } else if (isDigit(this.char)) { return this.goto(this.parseNumberOrDateTime); } else if (this.char === CHAR_t || this.char === CHAR_f) { return this.goto(this.parseBoolean); } else if (this.char === CHAR_LSQB) { return this.call(this.parseInlineList, this.recordValue); } else if (this.char === CHAR_LCUB) { return this.call(this.parseInlineTable, this.recordValue); } else { throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table")); } } recordValue(value) { return this.returnNow(value); } parseInf() { if (this.char === CHAR_n) { return this.next(this.parseInf2); } else { throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')); } } parseInf2() { if (this.char === CHAR_f) { if (this.state.buf === "-") { return this.return(-Infinity); } else { return this.return(Infinity); } } else { throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')); } } parseNan() { if (this.char === CHAR_a) { return this.next(this.parseNan2); } else { throw this.error(new TomlError('Unexpected character, expected "nan"')); } } parseNan2() { if (this.char === CHAR_n) { return this.return(NaN); } else { throw this.error(new TomlError('Unexpected character, expected "nan"')); } } parseKeyword() { if (this.char === CHAR_QUOT) { return this.next(this.parseBasicString); } else if (this.char === CHAR_APOS) { return this.next(this.parseLiteralString); } else { return this.goto(this.parseBareKey); } } parseBareKey() { do { if (this.char === Parser.END) { throw this.error(new TomlError("Key ended without value")); } else if (isAlphaNumHyphen(this.char)) { this.consume(); } else if (this.state.buf.length === 0) { throw this.error(new TomlError("Empty bare keys are not allowed")); } else { return this.returnNow(); } } while (this.nextChar()); } parseSingleString() { if (this.char === CHAR_APOS) { return this.next(this.parseLiteralMultiStringMaybe); } else { return this.goto(this.parseLiteralString); } } parseLiteralString() { do { if (this.char === CHAR_APOS) { return this.return(); } else if (this.atEndOfLine()) { throw this.error(new TomlError("Unterminated string")); } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) { throw this.errorControlCharInString(); } else { this.consume(); } } while (this.nextChar()); } parseLiteralMultiStringMaybe() { if (this.char === CHAR_APOS) { return this.next(this.parseLiteralMultiString); } else { return this.returnNow(); } } parseLiteralMultiString() { if (this.char === CTRL_M) { return null; } else if (this.char === CTRL_J) { return this.next(this.parseLiteralMultiStringContent); } else { return this.goto(this.parseLiteralMultiStringContent); } } parseLiteralMultiStringContent() { do { if (this.char === CHAR_APOS) { return this.next(this.parseLiteralMultiEnd); } else if (this.char === Parser.END) { throw this.error(new TomlError("Unterminated multi-line string")); } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) { throw this.errorControlCharInString(); } else { this.consume(); } } while (this.nextChar()); } parseLiteralMultiEnd() { if (this.char === CHAR_APOS) { return this.next(this.parseLiteralMultiEnd2); } else { this.state.buf += "'"; return this.goto(this.parseLiteralMultiStringContent); } } parseLiteralMultiEnd2() { if (this.char === CHAR_APOS) { return this.return(); } else { this.state.buf += "''"; return this.goto(this.parseLiteralMultiStringContent); } } parseDoubleString() { if (this.char === CHAR_QUOT) { return this.next(this.parseMultiStringMaybe); } else { return this.goto(this.parseBasicString); } } parseBasicString() { do { if (this.char === CHAR_BSOL) { return this.call(this.parseEscape, this.recordEscapeReplacement); } else if (this.char === CHAR_QUOT) { return this.return(); } else if (this.atEndOfLine()) { throw this.error(new TomlError("Unterminated string")); } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) { throw this.errorControlCharInString(); } else { this.consume(); } } while (this.nextChar()); } recordEscapeReplacement(replacement) { this.state.buf += replacement; return this.goto(this.parseBasicString); } parseMultiStringMaybe() { if (this.char === CHAR_QUOT) { return this.next(this.parseMultiString); } else { return this.returnNow(); } } parseMultiString() { if (this.char === CTRL_M) { return null; } else if (this.char === CTRL_J) { return this.next(this.parseMultiStringContent); } else { return this.goto(this.parseMultiStringContent); } } parseMultiStringContent() { do { if (this.char === CHAR_BSOL) { return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement); } else if (this.char === CHAR_QUOT) { return this.next(this.parseMultiEnd); } else if (this.char === Parser.END) { throw this.error(new TomlError("Unterminated multi-line string")); } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) { throw this.errorControlCharInString(); } else { this.consume(); } } while (this.nextChar()); } errorControlCharInString() { let displayCode = "\\u00"; if (this.char < 16) { displayCode += "0"; } displayCode += this.char.toString(16); return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`)); } recordMultiEscapeReplacement(replacement) { this.state.buf += replacement; return this.goto(this.parseMultiStringContent); } parseMultiEnd() { if (this.char === CHAR_QUOT) { return this.next(this.parseMultiEnd2); } else { this.state.buf += '"'; return this.goto(this.parseMultiStringContent); } } parseMultiEnd2() { if (this.char === CHAR_QUOT) { return this.return(); } else { this.state.buf += '""'; return this.goto(this.parseMultiStringContent); } } parseMultiEscape() { if (this.char === CTRL_M || this.char === CTRL_J) { return this.next(this.parseMultiTrim); } else if (this.char === CHAR_SP || this.char === CTRL_I) { return this.next(this.parsePreMultiTrim); } else { return this.goto(this.parseEscape); } } parsePreMultiTrim() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else if (this.char === CTRL_M || this.char === CTRL_J) { return this.next(this.parseMultiTrim); } else { throw this.error(new TomlError("Can't escape whitespace")); } } parseMultiTrim() { if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { return null; } else { return this.returnNow(); } } parseEscape() { if (this.char in escapes) { return this.return(escapes[this.char]); } else if (this.char === CHAR_u) { return this.call(this.parseSmallUnicode, this.parseUnicodeReturn); } else if (this.char === CHAR_U) { return this.call(this.parseLargeUnicode, this.parseUnicodeReturn); } else { throw this.error(new TomlError("Unknown escape character: " + this.char)); } } parseUnicodeReturn(char) { try { const codePoint = parseInt(char, 16); if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) { throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved")); } return this.returnNow(String.fromCodePoint(codePoint)); } catch (err) { throw this.error(TomlError.wrap(err)); } } parseSmallUnicode() { if (!isHexit(this.char)) { throw this.error(new TomlError("Invalid character in unicode sequence, expected hex")); } else { this.consume(); if (this.state.buf.length >= 4) return this.return(); } } parseLargeUnicode() { if (!isHexit(this.char)) { throw this.error(new TomlError("Invalid character in unicode sequence, expected hex")); } else { this.consume(); if (this.state.buf.length >= 8) return this.return(); } } parseNumberSign() { this.consume(); return this.next(this.parseMaybeSignedInfOrNan); } parseMaybeSignedInfOrNan() { if (this.char === CHAR_i) { return this.next(this.parseInf); } else if (this.char === CHAR_n) { return this.next(this.parseNan); } else { return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart); } } parseNumberIntegerStart() { if (this.char === CHAR_0) { this.consume(); return this.next(this.parseNumberIntegerExponentOrDecimal); } else { return this.goto(this.parseNumberInteger); } } parseNumberIntegerExponentOrDecimal() { if (this.char === CHAR_PERIOD) { this.consume(); return this.call(this.parseNoUnder, this.parseNumberFloat); } else if (this.char === CHAR_E || this.char === CHAR_e) { this.consume(); return this.next(this.parseNumberExponentSign); } else { return this.returnNow(Integer(this.state.buf)); } } parseNumberInteger() { if (isDigit(this.char)) { this.consume(); } else if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnder); } else if (this.char === CHAR_E || this.char === CHAR_e) { this.consume(); return this.next(this.parseNumberExponentSign); } else if (this.char === CHAR_PERIOD) { this.consume(); return this.call(this.parseNoUnder, this.parseNumberFloat); } else { const result = Integer(this.state.buf); if (result.isNaN()) { throw this.error(new TomlError("Invalid number")); } else { return this.returnNow(result); } } } parseNoUnder() { if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) { throw this.error(new TomlError("Unexpected character, expected digit")); } else if (this.atEndOfWord()) { throw this.error(new TomlError("Incomplete number")); } return this.returnNow(); } parseNoUnderHexOctBinLiteral() { if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) { throw this.error(new TomlError("Unexpected character, expected digit")); } else if (this.atEndOfWord()) { throw this.error(new TomlError("Incomplete number")); } return this.returnNow(); } parseNumberFloat() { if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnder, this.parseNumberFloat); } else if (isDigit(this.char)) { this.consume(); } else if (this.char === CHAR_E || this.char === CHAR_e) { this.consume(); return this.next(this.parseNumberExponentSign); } else { return this.returnNow(Float(this.state.buf)); } } parseNumberExponentSign() { if (isDigit(this.char)) { return this.goto(this.parseNumberExponent); } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { this.consume(); this.call(this.parseNoUnder, this.parseNumberExponent); } else { throw this.error(new TomlError("Unexpected character, expected -, + or digit")); } } parseNumberExponent() { if (isDigit(this.char)) { this.consume(); } else if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnder); } else { return this.returnNow(Float(this.state.buf)); } } parseNumberOrDateTime() { if (this.char === CHAR_0) { this.consume(); return this.next(this.parseNumberBaseOrDateTime); } else { return this.goto(this.parseNumberOrDateTimeOnly); } } parseNumberOrDateTimeOnly() { if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnder, this.parseNumberInteger); } else if (isDigit(this.char)) { this.consume(); if (this.state.buf.length > 4) this.next(this.parseNumberInteger); } else if (this.char === CHAR_E || this.char === CHAR_e) { this.consume(); return this.next(this.parseNumberExponentSign); } else if (this.char === CHAR_PERIOD) { this.consume(); return this.call(this.parseNoUnder, this.parseNumberFloat); } else if (this.char === CHAR_HYPHEN) { return this.goto(this.parseDateTime); } else if (this.char === CHAR_COLON) { return this.goto(this.parseOnlyTimeHour); } else { return this.returnNow(Integer(this.state.buf)); } } parseDateTimeOnly() { if (this.state.buf.length < 4) { if (isDigit(this.char)) { return this.consume(); } else if (this.char === CHAR_COLON) { return this.goto(this.parseOnlyTimeHour); } else { throw this.error(new TomlError("Expected digit while parsing year part of a date")); } } else { if (this.char === CHAR_HYPHEN) { return this.goto(this.parseDateTime); } else { throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date")); } } } parseNumberBaseOrDateTime() { if (this.char === CHAR_b) { this.consume(); return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin); } else if (this.char === CHAR_o) { this.consume(); return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct); } else if (this.char === CHAR_x) { this.consume(); return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex); } else if (this.char === CHAR_PERIOD) { return this.goto(this.parseNumberInteger); } else if (isDigit(this.char)) { return this.goto(this.parseDateTimeOnly); } else { return this.returnNow(Integer(this.state.buf)); } } parseIntegerHex() { if (isHexit(this.char)) { this.consume(); } else if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnderHexOctBinLiteral); } else { const result = Integer(this.state.buf); if (result.isNaN()) { throw this.error(new TomlError("Invalid number")); } else { return this.returnNow(result); } } } parseIntegerOct() { if (isOctit(this.char)) { this.consume(); } else if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnderHexOctBinLiteral); } else { const result = Integer(this.state.buf); if (result.isNaN()) { throw this.error(new TomlError("Invalid number")); } else { return this.returnNow(result); } } } parseIntegerBin() { if (isBit(this.char)) { this.consume(); } else if (this.char === CHAR_LOWBAR) { return this.call(this.parseNoUnderHexOctBinLiteral); } else { const result = Integer(this.state.buf); if (result.isNaN()) { throw this.error(new TomlError("Invalid number")); } else { return this.returnNow(result); } } } parseDateTime() { if (this.state.buf.length < 4) { throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters")); } this.state.result = this.state.buf; this.state.buf = ""; return this.next(this.parseDateMonth); } parseDateMonth() { if (this.char === CHAR_HYPHEN) { if (this.state.buf.length < 2) { throw this.error(new TomlError("Months less than 10 must be zero padded to two characters")); } this.state.result += "-" + this.state.buf; this.state.buf = ""; return this.next(this.parseDateDay); } else if (isDigit(this.char)) { this.consume(); } else { throw this.error(new TomlError("Incomplete datetime")); } } parseDateDay() { if (this.char === CHAR_T || this.char === CHAR_SP) { if (this.state.buf.length < 2) { throw this.error(new TomlError("Days less than 10 must be zero padded to two characters")); } this.state.result += "-" + this.state.buf; this.state.buf = ""; return this.next(this.parseStartTimeHour); } else if (this.atEndOfWord()) { return this.returnNow(createDate(this.state.result + "-" + this.state.buf)); } else if (isDigit(this.char)) { this.consume(); } else { throw this.error(new TomlError("Incomplete datetime")); } } parseStartTimeHour() { if (this.atEndOfWord()) { return this.returnNow(createDate(this.state.result)); } else { return this.goto(this.parseTimeHour); } } parseTimeHour() { if (this.char === CHAR_COLON) { if (this.state.buf.length < 2) { throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters")); } this.state.result += "T" + this.state.buf; this.state.buf = ""; return this.next(this.parseTimeMin); } else if (isDigit(this.char)) { this.consume(); } else { throw this.error(new TomlError("Incomplete datetime")); } } parseTimeMin() { if (this.state.buf.length < 2 && isDigit(this.char)) { this.consume(); } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { this.state.result += ":" + this.state.buf; this.state.buf = ""; return this.next(this.parseTimeSec); } else { throw this.error(new TomlError("Incomplete datetime")); } } parseTimeSec() { if (isDigit(this.char)) { this.consume(); if (this.state.buf.length === 2) { this.state.result += ":" + this.state.buf; this.state.buf = ""; return this.next(this.parseTimeZoneOrFraction); } } else { throw this.error(new TomlError("Incomplete datetime")); } } parseOnlyTimeHour() { if (this.char === CHAR_COLON) { if (this.state.buf.length < 2) { throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters")); } this.state.result = this.state.buf; this.state.buf = ""; return this.next(this.parseOnlyTimeMin); } else { throw this.error(new TomlError("Incomplete time")); } } parseOnlyTimeMin() { if (this.state.buf.length < 2 && isDigit(this.char)) { this.consume(); } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { this.state.result += ":" + this.state.buf; this.state.buf = ""; return this.next(this.parseOnlyTimeSec); } else { throw this.error(new TomlError("Incomplete time")); } } parseOnlyTimeSec() { if (isDigit(this.char)) { this.consume(); if (this.state.buf.length === 2) { return this.next(this.parseOnlyTimeFractionMaybe); } } else { throw this.error(new TomlError("Incomplete time")); } } parseOnlyTimeFractionMaybe() { this.state.result += ":" + this.state.buf; if (this.char === CHAR_PERIOD) { this.state.buf = ""; this.next(this.parseOnlyTimeFraction); } else { return this.return(createTime(this.state.result)); } } parseOnlyTimeFraction() { if (isDigit(this.char)) { this.consume(); } else if (this.atEndOfWord()) { if (this.state.buf.length === 0) throw this.error(new TomlError("Expected digit in milliseconds")); return this.returnNow(createTime(this.state.result + "." + this.state.buf)); } else { throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z")); } } parseTimeZoneOrFraction() { if (this.char === CHAR_PERIOD) { this.consume(); this.next(this.parseDateTimeFraction); } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { this.consume(); this.next(this.parseTimeZoneHour); } else if (this.char === CHAR_Z) { this.consume(); return this.return(createDateTime(this.state.result + this.state.buf)); } else if (this.atEndOfWord()) { return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf)); } else { throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z")); } } parseDateTimeFraction() { if (isDigit(this.char)) { this.consume(); } else if (this.state.buf.length === 1) { throw this.error(new TomlError("Expected digit in milliseconds")); } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { this.consume(); this.next(this.parseTimeZoneHour); } else if (this.char === CHAR_Z) { this.consume(); return this.return(createDateTime(this.state.result + this.state.buf)); } else if (this.atEndOfWord()) { return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf)); } else { throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z")); } } parseTimeZoneHour() { if (isDigit(this.char)) { this.consume(); if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep); } else { throw this.error(new TomlError("Unexpected character in datetime, expected digit")); } } parseTimeZoneSep() { if (this.char === CHAR_COLON) { this.consume(); this.next(this.parseTimeZoneMin); } else { throw this.error(new TomlError("Unexpected character in datetime, expected colon")); } } parseTimeZoneMin() { if (isDigit(this.char)) { this.consume(); if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf)); } else { throw this.error(new TomlError("Unexpected character in datetime, expected digit")); } } parseBoolean() { if (this.char === CHAR_t) { this.consume(); return this.next(this.parseTrue_r); } else if (this.char === CHAR_f) { this.consume(); return this.next(this.parseFalse_a); } } parseTrue_r() { if (this.char === CHAR_r) { this.consume(); return this.next(this.parseTrue_u); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseTrue_u() { if (this.char === CHAR_u) { this.consume(); return this.next(this.parseTrue_e); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseTrue_e() { if (this.char === CHAR_e) { return this.return(true); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseFalse_a() { if (this.char === CHAR_a) { this.consume(); return this.next(this.parseFalse_l); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseFalse_l() { if (this.char === CHAR_l) { this.consume(); return this.next(this.parseFalse_s); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseFalse_s() { if (this.char === CHAR_s) { this.consume(); return this.next(this.parseFalse_e); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseFalse_e() { if (this.char === CHAR_e) { return this.return(false); } else { throw this.error(new TomlError("Invalid boolean, expected true or false")); } } parseInlineList() { if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { return null; } else if (this.char === Parser.END) { throw this.error(new TomlError("Unterminated inline array")); } else if (this.char === CHAR_NUM) { return this.call(this.parseComment); } else if (this.char === CHAR_RSQB) { return this.return(this.state.resultArr || InlineList()); } else { return this.callNow(this.parseValue, this.recordInlineListValue); } } recordInlineListValue(value) { if (this.state.resultArr) { const listType = this.state.resultArr[_contentType]; const valueType = tomlType(value); if (listType !== valueType) { throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`)); } } else { this.state.resultArr = InlineList(tomlType(value)); } if (isFloat(value) || isInteger(value)) { this.state.resultArr.push(value.valueOf()); } else { this.state.resultArr.push(value); } return this.goto(this.parseInlineListNext); } parseInlineListNext() { if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { return null; } else if (this.char === CHAR_NUM) { return this.call(this.parseComment); } else if (this.char === CHAR_COMMA) { return this.next(this.parseInlineList); } else if (this.char === CHAR_RSQB) { return this.goto(this.parseInlineList); } else { throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])")); } } parseInlineTable() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { throw this.error(new TomlError("Unterminated inline array")); } else if (this.char === CHAR_RCUB) { return this.return(this.state.resultTable || InlineTable()); } else { if (!this.state.resultTable) this.state.resultTable = InlineTable(); return this.callNow(this.parseAssign, this.recordInlineTableValue); } } recordInlineTableValue(kv) { let target = this.state.resultTable; let finalKey = kv.key.pop(); for (let kw of kv.key) { if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { throw this.error(new TomlError("Can't redefine existing key")); } target = target[kw] = target[kw] || Table(); } if (hasKey(target, finalKey)) { throw this.error(new TomlError("Can't redefine existing key")); } if (isInteger(kv.value) || isFloat(kv.value)) { target[finalKey] = kv.value.valueOf(); } else { target[finalKey] = kv.value; } return this.goto(this.parseInlineTableNext); } parseInlineTableNext() { if (this.char === CHAR_SP || this.char === CTRL_I) { return null; } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { throw this.error(new TomlError("Unterminated inline array")); } else if (this.char === CHAR_COMMA) { return this.next(this.parseInlineTable); } else if (this.char === CHAR_RCUB) { return this.goto(this.parseInlineTable); } else { throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])")); } } } return TOMLParser; } } }); var require_parse_pretty_error = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) { "use strict"; module2.exports = prettyError; function prettyError(err, buf) { if (err.pos == null || err.line == null) return err; let msg = err.message; msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}: `; if (buf && buf.split) { const lines = buf.split(/\n/); const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length; let linePadding = " "; while (linePadding.length < lineNumWidth) linePadding += " "; for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) { let lineNum = String(ii + 1); if (lineNum.length < lineNumWidth) lineNum = " " + lineNum; if (err.line === ii) { msg += lineNum + "> " + lines[ii] + "\n"; msg += linePadding + " "; for (let hh = 0; hh < err.col; ++hh) { msg += " "; } msg += "^\n"; } else { msg += lineNum + ": " + lines[ii] + "\n"; } } } err.message = msg + "\n"; return err; } } }); var require_parse_string = __commonJS({ "../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(exports2, module2) { "use strict"; module2.exports = parseString2; var TOMLParser = require_toml_parser(); var prettyError = require_parse_pretty_error(); function parseString2(str) { if (global.Buffer && global.Buffer.isBuffer(str)) { str = str.toString("utf8"); } const parser = new TOMLParser(); try { parser.parse(str); return parser.finish(); } catch (err) { throw prettyError(err, str); } } } }); var stage_parser_exports = {}; __export(stage_parser_exports, { default: () => stage_parser_default, genFlattenedObject: () => genFlattenedObject, genFragmentsForScenes: () => genFragmentsForScenes, genSceneObjects: () => genSceneObjects, genTokensForScene: () => genTokensForScene, parse: () => parse, parseFlat: () => parseFlat, preprocessString: () => preprocessString }); var pipe = (raw, plugins) => { let intermediate = raw; for (let plugin of plugins) { intermediate = plugin(intermediate); } return intermediate; }; var import_moo = __toESM(require_moo()); var import_eol = __toESM(require_eol()); var parseComments = (raw) => { const lexer = import_moo.default.compile({ comment: { match: /^=.*\n?/, lineBreaks: true }, comment2: /^=.*?$/, text: { match: /[^]+?/, lineBreaks: true } }); lexer.reset(import_eol.default.lf(raw)); let finalString = ""; for (let token of Array.from(lexer)) { if (token.type === "text") { finalString += token.value; } } return finalString; }; var import_eol3 = __toESM(require_eol()); var import_eol2 = __toESM(require_eol()); var preserveWhitespaceTags = [ { start: /^```$/gm, end: /^```$/gm, startTag: "```", endTag: "```", type: "code" }, { start: /\<pre\>/gm, end: /\<\/pre\>/gm, startTag: "<pre>", endTag: "</pre>", type: "pre" }, { start: /^\!==$/gm, end: /^\!==$/gm, type: "custom" } ]; var createTrimWhitespaceTokens = (raw) => { const lines = import_eol2.default.split(raw); const tokens = []; let currentString = ""; let currentTag = null; for (let line of lines) { if (currentTag === null) { let matched = false; for (let tag of preserveWhitespaceTags) { if (line.match(tag.start)) { currentTag = tag; tokens.push({ text: currentString, type: "none" }); currentString = ""; matched = true; break; } } if (!matched) { currentString += line + "\n"; } continue; } if (line.match(currentTag.end)) { tokens.push({ text: currentString, type: currentTag.type, startTag: currentTag.startTag, endTag: currentTag.endTag }); currentTag = null; currentString = ""; continue; } currentString += line + "\n"; } if (currentString.length > 0) { if (currentTag === null) { tokens.push({ text: currentString, type: "none" }); } else { tokens.push({ text: currentString, type: currentTag.type, startTag: currentTag.startTag, endTag: currentTag.endTag }); } } return tokens; }; var parseTrimLines = (raw) => { const trimmedContentTokens = createTrimWhitespaceTokens(raw); let finalString = ""; for (let token of trimmedContentTokens) { switch (token.type) { case "none": finalString += trimLinesOfSection(token.text).trim() + "\n\n"; break; default: if (token.startTag) { finalString += token.startTag + "\n"; } finalString += token.text; if (token.endTag) { finalString += token.endTag + "\n"; } } } return finalString.trim(); }; var trimLinesOfSection = (text) => { const lines = import_eol3.default.split(text); let finalString = ""; for (let line of lines) { finalString += line.trim() + "\n"; } return finalString; }; var preprocessString = (raw) => { return pipe(raw, [parseTrimLines, parseComments]); }; var import_moo2 = __toESM(require_moo()); var import_eol4 = __toESM(require_eol()); var exposeMeta = (obj) => { if (!obj.meta) { return; } obj.id = obj.meta.id; obj.classes = obj.meta.classes; if (obj.id) { obj.primary = obj.id; } else if (obj.classes && obj.classes.length) { obj.primary = obj.classes[0]; } if (obj.meta.title) { obj.title = obj.meta.title; } }; var import_parse_string = __toESM(require_parse_string()); var parseTOMLMeta = (tomlString) => { try { const tomlObj = (0, import_parse_string.default)(tomlString); return tomlObj; } catch (err) { console.warn("TOML parser failed. String is instead being saved as one unit in the '_unparsed' field, where it can be processed later", err); return { _unparsed: tomlString }; } }; var separateAtShorthand = (string) => { if (!string.startsWith("@")) { throw new Error("@ shorthand must begin with an @ symbol"); } const stringWithoutPrefix = string.slice(1); const divElements = stringWithoutPrefix.split("."); const div = { classes: [] }; for (let str of divElements) { if (str.startsWith("#")) { div.id = str.slice(1); continue; } if (!div.classes) { div.classes = []; } div.classes.push(str); } return div; }; var splitLineBySpacesWithQuotes = (line) => { return line.match(/(\S*'.*?'|\S*".*?"|\S+)/gm) || []; }; var parseInlineMeta = (inlineMeta) => { let inlineMetaObject = {}; let autoTitleAvailable = true; let autoTitle = ""; const inlineMetaTokens = splitLineBySpacesWithQuotes(inlineMeta); for (let token of inlineMetaTokens) { if (token.startsWith("@")) { autoTitleAvailable = false; const tokenMeta = separateAtShorthand(token); inlineMetaObject = __spreadValues(__spreadValues({}, inlineMetaObject), tokenMeta); continue; } if (token.indexOf("=") >= 0) { autoTitleAvailable = false; const tokenMeta = parseTOMLMeta(token); inlineMetaObject = __spreadValues(__spreadValues({}, inlineMetaObject), tokenMeta); continue; } if (autoTitleAvailable) { autoTitle += token + " "; continue; } inlineMetaObject[token] = true; } autoTitle = autoTitle.trim(); if (autoTitle) { inlineMetaObject.title = autoTitle; } return inlineMetaObject; }; var genSceneObjects = (preprocessedString) => { const scenes = []; const lexer = import_moo2.default.states({ main: { sceneDefStart: { match: /\#[ \t]*\n/, lineBreaks: true, push: "sceneDefinition" }, sceneWithTitleStart: { match: /\#:[ \t]*.*\n/, lineBreaks: true, push: "sceneDefinition" }, text: { match: /[^]+?/, lineBreaks: true } }, sceneDefinition: { tomlStartDash: { match: "---", push: "sceneTomlDash" }, tomlStartPlus: { match: "+++", push: "sceneTomlPlus" }, sceneDefEnd: { match: /\n/, lineBreaks: true, push: "main" } }, sceneTomlDash: { tomlEnd: { match: "---", push: "sceneDefinition" }, toml: { match: /[^]+?(?=---)/, lineBreaks: true } }, sceneTomlPlus: { tomlEnd: { match: "+++", push: "sceneDefinition" }, toml: { match: /[^]+?(?=\+\+\+)/, lineBreaks: true } } }); let lexerRaw = import_eol4.default.lf(preprocessedString); if (lexerRaw.startsWith("---\n") || lexerRaw.startsWith("+++\n")) { lexerRaw = "#\n" + lexerRaw; } lexer.reset(import_eol4.default.lf(lexerRaw)); let currentScene = { type: "scene", raw: "" }; for (let token of Array.from(lexer)) { switch (token.type) { case "sceneDefStart": if (!currentScene.raw.length) { continue; } scenes.push(currentScene); currentScene = { type: "scene", raw: "" }; break; case "sceneWithTitleStart": if (currentScene.raw.length) { scenes.push(currentScene); } const inlineMeta = token.value.substring(2).trim(); const inlineMetaObject = inlineMeta ? parseInlineMeta(inlineMeta.trim()) : void 0; currentScene = { type: "scene", raw: "", meta: inlineMetaObject }; break; case "toml": const tomlObj = parseTOMLMeta(token.value); if (tomlObj === void 0) { throw new Error(lexer.formatError(token, "empty TOML frontmatter in scene.")); } if (currentScene.meta) { currentScene.meta = __spreadValues(__spreadValues({}, currentScene.meta), tomlObj); } else { currentScene.meta = tomlObj; } exposeMeta(currentScene); break; case "text": currentScene.raw += token.value; break; } } if (currentScene.raw.length) { scenes.push(currentScene); } return scenes; }; var import_moo3 = __toESM(require_moo()); var import_eol5 = __toESM(require_eol()); var FRAGMENT_START_TOKEN = "<>"; var FRAGMENT_END_TOKEN = "</>"; var genFragmentsForScenes = (scenes) => { const newScenes = []; for (let scene of scenes) { const fragments = genFragmentObjects(scene.raw); const newScene = { type: "scene", meta: scene.meta, id: scene.id, classes: scene.classes, primary: scene.primary, title: scene.title, fragments }; newScenes.push(newScene); } return newScenes; }; var genFragmentObjects = (raw) => { const fragments = []; let currentFragment = ""; const lines = import_eol5.default.split(raw); for (let line of lines) { if (line.trim().startsWith(FRAGMENT_START_TOKEN)) { let trimmedFragment2 = currentFragment.trim(); if (trimmedFragment2.length) { fragments.push(genFragmentObject(currentFragment)); } currentFragment = line + "\n"; continue; } if (line.trim() === FRAGMENT_END_TOKEN) { currentFragment += line + "\n"; fragments.push(genFragmentObject(currentFragment)); currentFragment = ""; continue; } currentFragment += line + "\n"; } let trimmedFragment = currentFragment.trim(); if (trimmedFragment.length) { fragments.push(genFragmentObject(currentFragment)); } return fragments; }; var genFragmentObject = (text) => { if (!text.startsWith(FRAGMENT_START_TOKEN)) { return { type: "empty", raw: text }; } const fragmentObject = { type: "fragment", raw: "" }; const lexer = import_moo3.default.states({ start: { fragDefStart: { match: FRAGMENT_START_TOKEN, push: "fragInlineMeta" } }, fragInlineMeta: { fragInlineEnd: { match: /\n/, lineBreaks: true, push: "fragDefinition" }, inlineMeta: { match: /[^]+?/, lineBreaks: true } }, fragDefinition: { tomlStart: { match: "---", push: "fragToml" }, tomlStartPlus: { match: "+++", push: "fragTomlPlus" }, fragDefEnd: { match: /\n/, lineBreaks: true, push: "main" }, text: { match: /[^]+?/, lineBreaks: true } }, fragToml: { tomlEnd: { match: "---", push: "fragDefinition" }, toml: { match: /[^]+?(?=---)/, lineBreaks: true } }, fragTomlPlus: { tomlEnd: { match: "+++", push: "fragDefinition" }, toml: { match: /[^]+?(?=\+\+\+)/, lineBreaks: true } }, main: { fragTagEnd: { match: FRAGMENT_END_TOKEN, push: "endFragTag" }, text: { match: /[^]+?/, lineBreaks: true } }, endFragTag: { misc: { match: /[^]+?/, lineBreaks: true } } }); lexer.reset(import_eol5.default.lf(text)); let inlineMeta = ""; for (let token of Array.from(lexer)) { switch (token.type) { case "toml": const tomlObj = parseTOMLMeta(token.value); if (tomlObj === void 0) { throw new Error(lexer.formatError(token, "empty TOML frontmatter in scene.")); } if (!fragmentObject.meta) { fragmentObject.meta = {}; } fragmentObject.meta = __spreadValues(__spreadValues({}, fragmentObject.meta), tomlObj); exposeMeta(fragmentObject); break; case "text": fragmentObject.raw += token.value; break; case "inlineMeta": inlineMeta += token.value; } } inlineMeta = inlineMeta.trim(); if (inlineMeta.length) { let inlineMetaObject = parseInlineMeta(inlineMeta); fragmentObject.meta = __spreadValues(__spreadValues({}, inlineMetaObject), fragmentObject.meta); exposeMeta(fragmentObject); } return fragmentObject; }; var import_eol7 = __toESM(require_eol()); var import_moo4 = __toESM(require_moo()); var import_eol6 = __toESM(require_eol()); var SOFTLINE_PLACEHOLDER = "%LINE%"; var preprocessSoftLines = (raw) => { const lfRaw = import_eol6.default.lf(raw); return lfRaw.replace(/(?<!\\)\\\n/gm, SOFTLINE_PLACEHOLDER); }; var createCommandObject = (line) => { if (!line.startsWith("$")) { throw new Error("$ shorthand must begin with an $ symbol"); } let trimmedCommand = line.substring(1).trim(); const commandParts = splitLineBySpacesWithQuotes(trimmedCommand).map((arg) => { if (arg.startsWith('"') && arg.endsWith('"')) { return arg.slice(1, arg.length - 1); } if (arg.startsWith("'") && arg.endsWith("'")) { return arg.slice(1, arg.length - 1); } return arg; }); let [command, ...params] = commandParts; return { type: "command", text: trimmedCommand, name: command, args: params }; }; var genTokensForScene = (scene) => { const newFragments = []; for (let fragment of scene.fragments) { const newFragment = genTokenizedFragment(fragment); newFragments.push(newFragment); } return __spreadProps(__spreadValues({}, scene), { fragments: newFragments }); }; var genTokenizedFragment = (fragment) => { const trimmedLineSections = createTrimWhitespaceTokens(fragment.raw); const tokens = []; for (let section of trimmedLineSections) { if (section.type === "none") { const newTokens = createTokensForTextSection(section.text); for (let t of newTokens) { tokens.push(t); } continue; } const newToken = { type: "rawText", text: section.text, startTag: section.startTag, endTag: section.endTag }; tokens.push(newToken); } const newFragmentObject = __spreadProps(__spreadValues({}, fragment), { tokens }); return newFragmentObject; }; var createTokensForTextSection = (text) => { const preprocessedString = pipe(text, [preprocessSoftLines]); const tokens = []; const lexer = import_moo4.default.states({ main: { startCommand: { match: /^\$/, next: "command" }, startAt: { match: /^@/, next: "at" }, startMetaTag: { match: /(?<!\n)\n<!/, lineBreaks: true, push: "meta" }, emptyLine: { match: /\n/, lineBreaks: true }, text: { match: /[^]+?/, lineBreaks: true } }, command: { endCommand: { match: /\n/, lineBreaks: true, next: "main" }, commandText: { match: /[^]+?/, lineBreaks: true } }, meta: { endMetaTag: { match: />/, pop: 1 }, meta: { match: /[^]+?/, lineBreaks: true } }, at: { colonWithWS: { match: /: /, next: "main" }, colon: { match: /:/, next: "main" }, ws: { match: /[ \t]/, next: "main" }, shorthandText: { match: /.+?/ } } }); lexer.reset(import_eol7.default.lf(preprocessedString)); let currentBuffer = ""; let existingToken = null; const createParagraphToken = () => { if (existingToken) { existingToken.text = currentBuffer; tokens.push(existingToken); existingToken = null; } else { const newToken = { type: "paragraph", text: currentBuffer }; tokens.push(newToken); } }; for (let token of Array.from(lexer)) { switch (token.type) { case "text": currentBuffer += token.value; break; case "emptyLine": if (currentBuffer.length) { createParagraphToken(); currentBuffer = ""; } break; case "startAt": currentBuffer = "@"; break; case "shorthandText": currentBuffer += token.value; break; case "colonWithWS": case "colon": case "ws": const meta = separateAtShorthand(currentBuffer); currentBuffer = ""; existingToken = { type: "paragraph", meta, text: "" }; exposeMeta(existingToken); break; case "startCommand": currentBuffer = "$"; break; case "commandText": currentBuffer += token.value; break; case "endCommand": const commandToken = createCommandObject(currentBuffer); tokens.push(commandToken); currentBuffer = ""; break; case "startMetaTag": if (currentBuffer.length) { createParagraphToken(); } currentBuffer = ""; break; case "meta": currentBuffer += token.value; break; case "endMetaTag": if (tokens.length === 0) { throw new Error("Created a post-paragraph meta tag that doesn't modify a paragraph"); } let modifiedToken = tokens[tokens.length - 1]; if (!modifiedToken.meta) { modifiedToken.meta = {}; } modifiedToken.meta._ = currentBuffer; currentBuffer = ""; break; } } if (currentBuffer.length) { createParagraphToken(); } return tokens; }; var concatInPlace = (arrayToModify, arrayToSplice) => { for (let item of arrayToSplice) { arrayToModify.push(item); } }; var genFlattenedObject = (scenes) => { const array = []; for (let scene of scenes) { const newScene = { type: "scene" }; if (scene.meta) { newScene.meta = scene.meta; } exposeMeta(newScene); array.push(newScene); for (let fragment of scene.fragments) { if (fragment.type === "empty") { concatInPlace(array, fragment.tokens); } else { const newFrag = { type: "fragment" }; if (fragment.meta) { newFrag.meta = fragment.meta; } exposeMeta(newFrag); array.push(newFrag); concatInPlace(array, fragment.tokens); array.push({ type: "endFragment" }); } } array.push({ type: "endScene" }); } return array; }; var parse = (text) => { const preprocessedText = preprocessString(text); const rawScenes = genSceneObjects(preprocessedText); const fragmentedScenes = genFragmentsForScenes(rawScenes); const tokenizedScenes = []; for (let scene of fragmentedScenes) { tokenizedScenes.push(genTokensForScene(scene)); } return tokenizedScenes; }; var parseFlat = (text) => { return genFlattenedObject(parse(text)); }; var stage_parser_default = parse; module.exports = __toCommonJS(stage_parser_exports); } }); // ../../core/dist/lib/tools/split-line-by-spaces-with-quotes.js var require_split_line_by_spaces_with_quotes = __commonJS2({ "../../core/dist/lib/tools/split-line-by-spaces-with-quotes.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.splitLineBySpacesWithQuotes = void 0; var splitLineBySpacesWithQuotes2 = (line) => { return line.match(/(\S*'.*?'|\S*".*?"|\S+)/gm) || []; }; exports2.splitLineBySpacesWithQuotes = splitLineBySpacesWithQuotes2; } }); // ../../core/dist/lib/tools/command-shorthand.js var require_command_shorthand = __commonJS2({ "../../core/dist/lib/tools/command-shorthand.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.createCommandObject = void 0; var split_line_by_spaces_with_quotes_1 = require_split_line_by_spaces_with_quotes(); var createCommandObject2 = (line) => { if (!line.startsWith("$")) { throw new Error("$ shorthand must begin with an $ symbol"); } let trimmedCommand = line.substring(1).trim(); const commandParts = (0, split_line_by_spaces_with_quotes_1.splitLineBySpacesWithQuotes)(trimmedCommand).map((arg) => { if (arg.startsWith('"') && arg.endsWith('"')) { return arg.slice(1, arg.length - 1); } if (arg.startsWith("'") && arg.endsWith("'")) { return arg.slice(1, arg.length - 1); } return arg; }); let [command, ...params] = commandParts; return { type: "command", text: trimmedCommand, name: command, args: params }; }; exports2.createCommandObject = createCommandObject2; } }); // ../../packages/ext-common-commands/dist/common-commands-ext.js var require_common_commands_ext = __commonJS2({ "../../packages/ext-common-commands/dist/common-commands-ext.js"(exports2) { var __create2 = Object.create; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames3 = Object.getOwnPropertyNames; var __getProtoOf2 = Object.getPrototypeOf; var __hasOwnProp2 = Object.prototype.hasOwnProperty; var __markAsModule2 = (target) => __defProp2(target, "__esModule", { value: true }); var __commonJS3 = (cb, mod) => function __require() { return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; var __reExport2 = (target, module22, desc) => { if (module22 && typeof module22 === "object" || typeof module22 === "function") { for (let key of __getOwnPropNames3(module22)) if (!__hasOwnProp2.call(target, key) && key !== "default") __defProp2(target, key, { get: () => module22[key], enumerable: !(desc = __getOwnPropDesc2(module22, key)) || desc.enumerable }); } return target; }; var __toModule = (module22) => { return __reExport2(__markAsModule2(__defProp2(module22 != null ? __create2(__getProtoOf2(module22)) : {}, "default", module22 && module22.__esModule && "default" in module22 ? { get: () => module22.default, enumerable: true } : { value: module22, enumerable: true })), module22); }; var require_eol2 = __commonJS3({ "../../node_modules/.pnpm/eol@0.9.1/node_modules/eol/eol.js"(exports3, module22) { !function(root, name, make) { if (typeof module22 != "undefined" && module22.exports) module22.exports = make(); else root[name] = make(); }(exports3, "eol", function() { var api = {}; var isWindows = typeof process != "undefined" && process.platform === "win32"; var linebreak = isWindows ? "\r\n" : "\n"; var newline = /\r\n|\r|\n/g; function before(text) { return linebreak + text; } function after(text) { return text + linebreak; } function converts(to) { function convert(text) { return text.replace(newline, to); } convert.toString = function() { return to; }; return convert; } function split(text) { return text.split(newline); } api["lf"] = converts("\n"); api["cr"] = converts("\r"); api["crlf"] = converts("\r\n"); api["auto"] = converts(linebreak); api["before"] = before; api["after"] = after; api["split"] = split; return api; }); } }); __markAsModule2(exports2); __export2(exports2, { convertWikiLinkToMd: () => convertWikiLinkToMd, enforceIds: () => enforceIds, findFragment: () => findFragment, findObjectViaLink: () => findObjectViaLink, findScene: () => findScene, getSceneThatFragmentBelongsTo: () => getSceneThatFragmentBelongsTo, parseWikiLink: () => parseWikiLink, resolveIncludes: () => resolveIncludes2, slugify: () => slugify }); var import_command_shorthand = __toModule(require_command_shorthand()); var import_eol8 = __toModule(require_eol2()); var resolveIncludes2 = (fs2, path2, filePath, stageString, layer = 0) => { if (layer > 20) { throw new Error("Include command recursed more than 20 layers deep. This is a lot. Is there an infinite loop somewhere?"); } const tokens = import_eol8.default.split(stageString); let finalString = ""; for (let token of tokens) { if (!token.startsWith("$include")) { finalString += token + "\n"; continue; } let commandObj = (0, import_command_shorthand.createCommandObject)(token); if (!commandObj.args) { console.warn("empty $include command found."); continue; } let givenFilepath = commandObj.args[0].toString(); let targetFilepath = path2.resolve(path2.dirname(filePath), givenFilepath); if (!fs2.existsSync(targetFilepath)) { console.log(targetFilepath); console.warn("File '" + givenFilepath + "' used in $include command does not exist"); continue; } const newFileContents = fs2.readFileSync(targetFilepath, { encoding: "utf-8" }); let shouldProcessInclude = true; if (shouldProcessInclude == true && commandObj.args.length > 1 && commandObj.args[1] === "raw") { shouldProcessInclude = false; } if (shouldProcessInclude) { const processedContents = resolveIncludes2(fs2, path2, targetFilepath, newFileContents, layer + 1); finalString += processedContents + "\n"; continue; } finalString += newFileContents + "\n"; } return finalString.trim(); }; var getSceneThatFragmentBelongsTo = (stageObjects, fragment) => { const index = stageObjects.indexOf(fragment); if (index === -1) { return void 0; } for (let i = index; i >= 0; i--) { const pointer = stageObjects[i]; if (pointer.type === "scene") { return pointer; } } return void 0; }; var findFragment = (stageObjects, primary, title) => { if (!primary && !title) { return void 0; } if (primary && title) { return stageObjects.find((val) => { return val.type === "fragment" && val.primary === primary && val.title === title; }); } if (primary) { return stageObjects.find((val) => { return val.type === "fragment" && val.primary === primary; }); } if (title) { return stageObjects.find((val) => { return val.type === "fragment" && val.title === title; }); } }; var findScene = (stageObjects, primary, title) => { if (!primary && !title) { return void 0; } if (primary && title) { return stageObjects.find((val) => { return val.type === "scene" && val.primary === primary && val.title === title; }); } if (primary) { return stageObjects.find((val) => { return val.type === "scene" && val.primary === primary; }); } if (title) { return stageObjects.find((val) => { return val.type === "scene" && val.title === title; }); } }; var slugify = (...args) => { const value = args.join(" "); return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[-_]/g, " ").replace(/[^a-z0-9 ]/g, "").replace(/\s+/g, "-"); }; var parseWikiLink = (wikiLink) => { let label = wikiLink; let target = wikiLink; const barIndex = wikiLink.indexOf("|"); if (barIndex !== -1) { label = wikiLink.substring(0, barIndex); target = wikiLink.substring(barIndex + 1); } else { const rightArrIndex = wikiLink.indexOf("->"); if (rightArrIndex !== -1) { label = wikiLink.substring(0, rightArrIndex); target = wikiLink.substring(rightArrIndex + 2); } else { const leftArrIndex = wikiLink.indexOf("<-"); if (leftArrIndex !== -1) { label = wikiLink.substring(leftArrIndex + 2); target = wikiLink.substring(0, leftArrIndex); } } } return { label, target }; }; var enforceIds = (stageObjects) => { let currentId = 0; const genWikiId = () => { const id = `__recital-id-${currentId.toString().padStart(4, "0")}`; currentId += 1; return id; }; const newObjs = []; for (let obj of stageObjects) { if (obj.type !== "scene" && obj.type !== "fragment") { newObjs.push(obj); continue; } if (obj.id) { newObjs.push(obj); continue; } if (obj.title) { let newObj2 = { ...obj }; newObj2.id = slugify(obj.title); newObjs.push(newObj2); continue; } let newObj = { ...obj }; newObj.id = genWikiId(); newObjs.push(newObj); } for (let obj of newObjs) { if (obj.type !== "scene" && obj.type !== "fragment") { continue; } if (!obj.primary) { obj.primary = obj.id; } } return newObjs; }; var findObjectViaLink = (stageObjects, target) => { if (target.startsWith("#")) { let possibleTarget2 = findFragment(stageObjects, target.substring(1)); if (!possibleTarget2) { possibleTarget2 = findScene(stageObjects, target.substring(1)); } return possibleTarget2; } let possibleTarget = findFragment(stageObjects, target); if (!possibleTarget) { possibleTarget = findFragment(stageObjects, void 0, target); } if (!possibleTarget) { possibleTarget = findScene(stageObjects, target); } if (!possibleTarget) { possibleTarget = findScene(stageObjects, void 0, target); } if (!possibleTarget) { return void 0; } return possibleTarget; }; var convertWikiLinkToMd = (stageObjects) => { const newFlatObjects = []; const stageObjectsWithId = enforceIds(stageObjects); for (let obj of stageObjectsWithId) { if (obj.type !== "paragraph") { newFlatObjects.push(obj); continue; } const newText = renderWikilinks(stageObjectsWithId, obj.text); newFlatObjects.push({ ...obj, text: newText }); } return newFlatObjects; }; var renderWikilinks = (stageObjects, source) => { return source.replace(/\[\[(.*?)\]\]/g, (_, target) => { const parsedLink = parseWikiLink(target); return renderLink(stageObjects, parsedLink.target, parsedLink.label || parsedLink.target); }); }; var renderLink = (stageObjects, target, label) => { if (/^\w+:\/\/\/?\w/i.test(target)) { return `[${label}](${target})`; } const linkTarget = findObjectViaLink(stageObjects, target); if (!linkTarget) { console.warn("link to " + target + " did not produce a valid link, and may not resolve correctly in editor."); return `[${label}](${target})`; } return `[${label}](${getHrefForObject(linkTarget)})`; }; var getHrefForObject = (object) => { if (!object.id) { throw new Error("Cannot create a link to an object without an id"); } return `#${object.id}`; }; } }); // dist/stage-html.js var require_stage_html = __commonJS2({ "dist/stage-html.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames3 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames3(from)) if (!__hasOwnProp2.call(to, key) && key !== except) __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { stageToHTML: () => stageToHTML2 }); module2.exports = __toCommonJS2(src_exports); var import_recital = require_stage_parser(); var import_recital_ext_common_commands = require_common_commands_ext(); var tags_to_skip = /<(\/?)(?:pre|code|kbd|script|math)[^>]*>/i; var SmartyPants = (text3 = "", attr = "1") => { var do_quotes; var do_backticks; var do_dashes; var do_ellipses; var do_stupefy; var convert_quot = 0; if (typeof attr === "number") { attr = attr.toString(); } else { attr = attr.replace(/\s/g, ""); } if (attr === "0") { return text3; } else if (attr === "1") { do_quotes = 1; do_backticks = 1; do_dashes = 1; do_ellipses = 1; } else if (attr === "2") { do_quotes = 1; do_backticks = 1; do_dashes = 2; do_ellipses = 1; } else if (attr === "3") { do_quotes = 1; do_backticks = 1; do_dashes = 3; do_ellipses = 1; } else if (attr === "-1") { do_stupefy = 1; } else { for (let i = 0; i < attr.length; i++) { let c = attr[i]; if (c === "q") { do_quotes = 1; } if (c === "b") { do_backticks = 1; } if (c === "B") { do_backticks = 2; } if (c === "d") { do_dashes = 1; } if (c === "D") { do_dashes = 2; } if (c === "i") { do_dashes = 3; } if (c === "e") { do_ellipses = 1; } if (c === "w") { convert_quot = 1; } } } var tokens = _tokenize(text3); var result = ""; var in_pre = 0; var prev_token_last_char = ""; for (let i = 0; i < tokens.length; i++) { let cur_token = tokens[i]; if (cur_token[0] === "tag") { result = result + cur_token[1]; let matched = tags_to_skip.exec(cur_token[1]); if (matched) { if (matched[1] === "/") { in_pre = 0; } else { in_pre = 1; } } } else { let t = cur_token[1]; let last_char = t.substring(t.length - 1, t.length); if (!in_pre) { t = ProcessEscapes(t); if (convert_quot) { t = t.replace(/$quot;/g, '"'); } if (do_dashes) { if (do_dashes === 1) { t = EducateDashes(t); } if (do_dashes === 2) { t = EducateDashesOldSchool(t); } if (do_dashes === 3) { t = EducateDashesOldSchoolInverted(t); } } if (do_ellipses) { t = EducateEllipses(t); } if (do_backticks) { t = EducateBackticks(t); if (do_backticks === 2) { t = EducateSingleBackticks(t); } } if (do_quotes) { if (t === "'") { if (/\S/.test(prev_token_last_char)) { t = "’"; } else { t = "‘"; } } else if (t === '"') { if (/\S/.test(prev_token_last_char)) { t = "”"; } else { t = "“"; } } else { t = EducateQuotes(t); } } if (do_stupefy) { t = StupefyEntities(t); } } prev_token_last_char = last_char; result = result + t; } } return result; }; var EducateQuotes = (str) => { var punct_class = "[!\"#$%'()*+,-./:;<=>?@[\\]^_`{|}~]"; str = str.replace(new RegExp(`^'(?=${punct_class}\\B)`), "’"); str = str.replace(new RegExp(`^"(?=${punct_class}\\B)`), "”"); str = str.replace(/"'(?=\w)/, "“‘"); str = str.replace(/'"(?=\w)/, "‘“"); str = str.replace(/'(?=\d\d)/, "’"); var close_class = "[^\\ \\t\\r\\n\\[\\{\\(\\-]"; var not_close_class = "[\\ \\t\\r\\n\\[\\{\\(\\-]"; var dec_dashes = "–|—"; str = str.replace(new RegExp(`(\\s| |--|&[mn]dash;|${dec_dashes}|ȁ[34])'(?=\\w)`, "g"), "$1‘"); str = str.replace(new RegExp(`(${close_class})'`, "g"), "$1’"); str = str.replace(new RegExp(`(${not_close_class}?)'(?=\\s|s\\b)`, "g"), "$1’"); str = str.replace(/'/g, "‘"); str = str.replace(new RegExp(`(\\s| |--|&[mn]dash;|${dec_dashes}|ȁ[34])"(?=\\w)`, "g"), "$1“"); str = str.replace(new RegExp(`(${close_class})"`, "g"), "$1”"); str = str.replace(new RegExp(`(${not_close_class}?)"(?=\\s)`, "g"), "$1”"); str = str.replace(/"/g, "“"); return str; }; var EducateBackticks = (str) => { str = str.replace(/``/g, "“"); str = str.replace(/''/g, "”"); return str; }; var EducateSingleBackticks = (str) => { str = str.replace(/`/g, "‘"); str = str.replace(/'/g, "’"); return str; }; var EducateDashes = (str) => { str = str.replace(/--/g, "—"); return str; }; var EducateDashesOldSchool = (str) => { str = str.replace(/---/g, "—"); str = str.replace(/--/g, "–"); return str; }; var EducateDashesOldSchoolInverted = (str) => { str = str.replace(/---/g, "–"); str = str.replace(/--/g, "—"); return str; }; var EducateEllipses = (str) => { str = str.replace(/\.\.\./g, "…"); str = str.replace(/\. \. \./g, "…"); return str; }; var StupefyEntities = (str) => { str = str.replace(/–/g, "-"); str = str.replace(/—/g, "--"); str = str.replace(/‘/g, "'"); str = str.replace(/’/g, "'"); str = str.replace(/“/g, '"'); str = str.replace(/”/g, '"'); str = str.replace(/…/g, "..."); return str; }; var ProcessEscapes = (str) => { str = str.replace(/\\\\/g, "\"); str = str.replace(/\\"/g, """); str = str.replace(/\\'/g, "'"); str = str.replace(/\\\./g, "."); str = str.replace(/\\-/g, "-"); str = str.replace(/\\`/g, "`"); return str; }; var _tokenize = (str) => { var pos = 0; var len = str.length; var tokens = []; var match = /<!--[\s\S]*?-->|<\?.*?\?>|<[^>]*>/g; var matched = null; while (matched = match.exec(str)) { if (pos < matched.index) { let t2 = ["text", str.substring(pos, matched.index)]; tokens.push(t2); } let t = ["tag", matched.toString()]; tokens.push(t); pos = match.lastIndex; } if (pos < len) { let t = ["text", str.substring(pos, len)]; tokens.push(t); } return tokens; }; var smartypants_es6_default = SmartyPants; var characterEntities = { AElig: "\xC6", AMP: "&", Aacute: "\xC1", Abreve: "\u0102", Acirc: "\xC2", Acy: "\u0410", Afr: "\u{1D504}", Agrave: "\xC0", Alpha: "\u0391", Amacr: "\u0100", And: "\u2A53", Aogon: "\u0104", Aopf: "\u{1D538}", ApplyFunction: "\u2061", Aring: "\xC5", Ascr: "\u{1D49C}", Assign: "\u2254", Atilde: "\xC3", Auml: "\xC4", Backslash: "\u2216", Barv: "\u2AE7", Barwed: "\u2306", Bcy: "\u0411", Because: "\u2235", Bernoullis: "\u212C", Beta: "\u0392", Bfr: "\u{1D505}", Bopf: "\u{1D539}", Breve: "\u02D8", Bscr: "\u212C", Bumpeq: "\u224E", CHcy: "\u0427", COPY: "\xA9", Cacute: "\u0106", Cap: "\u22D2", CapitalDifferentialD: "\u2145", Cayleys: "\u212D", Ccaron: "\u010C", Ccedil: "\xC7", Ccirc: "\u0108", Cconint: "\u2230", Cdot: "\u010A", Cedilla: "\xB8", CenterDot: "\xB7", Cfr: "\u212D", Chi: "\u03A7", CircleDot: "\u2299", CircleMinus: "\u2296", CirclePlus: "\u2295", CircleTimes: "\u2297", ClockwiseContourIntegral: "\u2232", CloseCurlyDoubleQuote: "\u201D", CloseCurlyQuote: "\u2019", Colon: "\u2237", Colone: "\u2A74", Congruent: "\u2261", Conint: "\u222F", ContourIntegral: "\u222E", Copf: "\u2102", Coproduct: "\u2210", CounterClockwiseContourIntegral: "\u2233", Cross: "\u2A2F", Cscr: "\u{1D49E}", Cup: "\u22D3", CupCap: "\u224D", DD: "\u2145", DDotrahd: "\u2911", DJcy: "\u0402", DScy: "\u0405", DZcy: "\u040F", Dagger: "\u2021", Darr: "\u21A1", Dashv: "\u2AE4", Dcaron: "\u010E", Dcy: "\u0414", Del: "\u2207", Delta: "\u0394", Dfr: "\u{1D507}", DiacriticalAcute: "\xB4", DiacriticalDot: "\u02D9", DiacriticalDoubleAcute: "\u02DD", DiacriticalGrave: "`", DiacriticalTilde: "\u02DC", Diamond: "\u22C4", DifferentialD: "\u2146", Dopf: "\u{1D53B}", Dot: "\xA8", DotDot: "\u20DC", DotEqual: "\u2250", DoubleContourIntegral: "\u222F", DoubleDot: "\xA8", DoubleDownArrow: "\u21D3", DoubleLeftArrow: "\u21D0", DoubleLeftRightArrow: "\u21D4", DoubleLeftTee: "\u2AE4", DoubleLongLeftArrow: "\u27F8", DoubleLongLeftRightArrow: "\u27FA", DoubleLongRightArrow: "\u27F9", DoubleRightArrow: "\u21D2", DoubleRightTee: "\u22A8", DoubleUpArrow: "\u21D1", DoubleUpDownArrow: "\u21D5", DoubleVerticalBar: "\u2225", DownArrow: "\u2193", DownArrowBar: "\u2913", DownArrowUpArrow: "\u21F5", DownBreve: "\u0311", DownLeftRightVector: "\u2950", DownLeftTeeVector: "\u295E", DownLeftVector: "\u21BD", DownLeftVectorBar: "\u2956", DownRightTeeVector: "\u295F", DownRightVector: "\u21C1", DownRightVectorBar: "\u2957", DownTee: "\u22A4", DownTeeArrow: "\u21A7", Downarrow: "\u21D3", Dscr: "\u{1D49F}", Dstrok: "\u0110", ENG: "\u014A", ETH: "\xD0", Eacute: "\xC9", Ecaron: "\u011A", Ecirc: "\xCA", Ecy: "\u042D", Edot: "\u0116", Efr: "\u{1D508}", Egrave: "\xC8", Element: "\u2208", Emacr: "\u0112", EmptySmallSquare: "\u25FB", EmptyVerySmallSquare: "\u25AB", Eogon: "\u0118", Eopf: "\u{1D53C}", Epsilon: "\u0395", Equal: "\u2A75", EqualTilde: "\u2242", Equilibrium: "\u21CC", Escr: "\u2130", Esim: "\u2A73", Eta: "\u0397", Euml: "\xCB", Exists: "\u2203", ExponentialE: "\u2147", Fcy: "\u0424", Ffr: "\u{1D509}", FilledSmallSquare: "\u25FC", FilledVerySmallSquare: "\u25AA", Fopf: "\u{1D53D}", ForAll: "\u2200", Fouriertrf: "\u2131", Fscr: "\u2131", GJcy: "\u0403", GT: ">", Gamma: "\u0393", Gammad: "\u03DC", Gbreve: "\u011E", Gcedil: "\u0122", Gcirc: "\u011C", Gcy: "\u0413", Gdot: "\u0120", Gfr: "\u{1D50A}", Gg: "\u22D9", Gopf: "\u{1D53E}", GreaterEqual: "\u2265", GreaterEqualLess: "\u22DB", GreaterFullEqual: "\u2267", GreaterGreater: "\u2AA2", GreaterLess: "\u2277", GreaterSlantEqual: "\u2A7E", GreaterTilde: "\u2273", Gscr: "\u{1D4A2}", Gt: "\u226B", HARDcy: "\u042A", Hacek: "\u02C7", Hat: "^", Hcirc: "\u0124", Hfr: "\u210C", HilbertSpace: "\u210B", Hopf: "\u210D", HorizontalLine: "\u2500", Hscr: "\u210B", Hstrok: "\u0126", HumpDownHump: "\u224E", HumpEqual: "\u224F", IEcy: "\u0415", IJlig: "\u0132", IOcy: "\u0401", Iacute: "\xCD", Icirc: "\xCE", Icy: "\u0418", Idot: "\u0130", Ifr: "\u2111", Igrave: "\xCC", Im: "\u2111", Imacr: "\u012A", ImaginaryI: "\u2148", Implies: "\u21D2", Int: "\u222C", Integral: "\u222B", Intersection: "\u22C2", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", Iogon: "\u012E", Iopf: "\u{1D540}", Iota: "\u0399", Iscr: "\u2110", Itilde: "\u0128", Iukcy: "\u0406", Iuml: "\xCF", Jcirc: "\u0134", Jcy: "\u0419", Jfr: "\u{1D50D}", Jopf: "\u{1D541}", Jscr: "\u{1D4A5}", Jsercy: "\u0408", Jukcy: "\u0404", KHcy: "\u0425", KJcy: "\u040C", Kappa: "\u039A", Kcedil: "\u0136", Kcy: "\u041A", Kfr: "\u{1D50E}", Kopf: "\u{1D542}", Kscr: "\u{1D4A6}", LJcy: "\u0409", LT: "<", Lacute: "\u0139", Lambda: "\u039B", Lang: "\u27EA", Laplacetrf: "\u2112", Larr: "\u219E", Lcaron: "\u013D", Lcedil: "\u013B", Lcy: "\u041B", LeftAngleBracket: "\u27E8", LeftArrow: "\u2190", LeftArrowBar: "\u21E4", LeftArrowRightArrow: "\u21C6", LeftCeiling: "\u2308", LeftDoubleBracket: "\u27E6", LeftDownTeeVector: "\u2961", LeftDownVector: "\u21C3", LeftDownVectorBar: "\u2959", LeftFloor: "\u230A", LeftRightArrow: "\u2194", LeftRightVector: "\u294E", LeftTee: "\u22A3", LeftTeeArrow: "\u21A4", LeftTeeVector: "\u295A", LeftTriangle: "\u22B2", LeftTriangleBar: "\u29CF", LeftTriangleEqual: "\u22B4", LeftUpDownVector: "\u2951", LeftUpTeeVector: "\u2960", LeftUpVector: "\u21BF", LeftUpVectorBar: "\u2958", LeftVector: "\u21BC", LeftVectorBar: "\u2952", Leftarrow: "\u21D0", Leftrightarrow: "\u21D4", LessEqualGreater: "\u22DA", LessFullEqual: "\u2266", LessGreater: "\u2276", LessLess: "\u2AA1", LessSlantEqual: "\u2A7D", LessTilde: "\u2272", Lfr: "\u{1D50F}", Ll: "\u22D8", Lleftarrow: "\u21DA", Lmidot: "\u013F", LongLeftArrow: "\u27F5", LongLeftRightArrow: "\u27F7", LongRightArrow: "\u27F6", Longleftarrow: "\u27F8", Longleftrightarrow: "\u27FA", Longrightarrow: "\u27F9", Lopf: "\u{1D543}", LowerLeftArrow: "\u2199", LowerRightArrow: "\u2198", Lscr: "\u2112", Lsh: "\u21B0", Lstrok: "\u0141", Lt: "\u226A", Map: "\u2905", Mcy: "\u041C", MediumSpace: "\u205F", Mellintrf: "\u2133", Mfr: "\u{1D510}", MinusPlus: "\u2213", Mopf: "\u{1D544}", Mscr: "\u2133", Mu: "\u039C", NJcy: "\u040A", Nacute: "\u0143", Ncaron: "\u0147", Ncedil: "\u0145", Ncy: "\u041D", NegativeMediumSpace: "\u200B", NegativeThickSpace: "\u200B", NegativeThinSpace: "\u200B", NegativeVeryThinSpace: "\u200B", NestedGreaterGreater: "\u226B", NestedLessLess: "\u226A", NewLine: "\n", Nfr: "\u{1D511}", NoBreak: "\u2060", NonBreakingSpace: "\xA0", Nopf: "\u2115", Not: "\u2AEC", NotCongruent: "\u2262", NotCupCap: "\u226D", NotDoubleVerticalBar: "\u2226", NotElement: "\u2209", NotEqual: "\u2260", NotEqualTilde: "\u2242\u0338", NotExists: "\u2204", NotGreater: "\u226F", NotGreaterEqual: "\u2271", NotGreaterFullEqual: "\u2267\u0338", NotGreaterGreater: "\u226B\u0338", NotGreaterLess: "\u2279", NotGreaterSlantEqual: "\u2A7E\u0338", NotGreaterTilde: "\u2275", NotHumpDownHump: "\u224E\u0338", NotHumpEqual: "\u224F\u0338", NotLeftTriangle: "\u22EA", NotLeftTriangleBar: "\u29CF\u0338", NotLeftTriangleEqual: "\u22EC", NotLess: "\u226E", NotLessEqual: "\u2270", NotLessGreater: "\u2278", NotLessLess: "\u226A\u0338", NotLessSlantEqual: "\u2A7D\u0338", NotLessTilde: "\u2274", NotNestedGreaterGreater: "\u2AA2\u0338", NotNestedLessLess: "\u2AA1\u0338", NotPrecedes: "\u2280", NotPrecedesEqual: "\u2AAF\u0338", NotPrecedesSlantEqual: "\u22E0", NotReverseElement: "\u220C", NotRightTriangle: "\u22EB", NotRightTriangleBar: "\u29D0\u0338", NotRightTriangleEqual: "\u22ED", NotSquareSubset: "\u228F\u0338", NotSquareSubsetEqual: "\u22E2", NotSquareSuperset: "\u2290\u0338", NotSquareSupersetEqual: "\u22E3", NotSubset: "\u2282\u20D2", NotSubsetEqual: "\u2288", NotSucceeds: "\u2281", NotSucceedsEqual: "\u2AB0\u0338", NotSucceedsSlantEqual: "\u22E1", NotSucceedsTilde: "\u227F\u0338", NotSuperset: "\u2283\u20D2", NotSupersetEqual: "\u2289", NotTilde: "\u2241", NotTildeEqual: "\u2244", NotTildeFullEqual: "\u2247", NotTildeTilde: "\u2249", NotVerticalBar: "\u2224", Nscr: "\u{1D4A9}", Ntilde: "\xD1", Nu: "\u039D", OElig: "\u0152", Oacute: "\xD3", Ocirc: "\xD4", Ocy: "\u041E", Odblac: "\u0150", Ofr: "\u{1D512}", Ograve: "\xD2", Omacr: "\u014C", Omega: "\u03A9", Omicron: "\u039F", Oopf: "\u{1D546}", OpenCurlyDoubleQuote: "\u201C", OpenCurlyQuote: "\u2018", Or: "\u2A54", Oscr: "\u{1D4AA}", Oslash: "\xD8", Otilde: "\xD5", Otimes: "\u2A37", Ouml: "\xD6", OverBar: "\u203E", OverBrace: "\u23DE", OverBracket: "\u23B4", OverParenthesis: "\u23DC", PartialD: "\u2202", Pcy: "\u041F", Pfr: "\u{1D513}", Phi: "\u03A6", Pi: "\u03A0", PlusMinus: "\xB1", Poincareplane: "\u210C", Popf: "\u2119", Pr: "\u2ABB", Precedes: "\u227A", PrecedesEqual: "\u2AAF", PrecedesSlantEqual: "\u227C", PrecedesTilde: "\u227E", Prime: "\u2033", Product: "\u220F", Proportion: "\u2237", Proportional: "\u221D", Pscr: "\u{1D4AB}", Psi: "\u03A8", QUOT: '"', Qfr: "\u{1D514}", Qopf: "\u211A", Qscr: "\u{1D4AC}", RBarr: "\u2910", REG: "\xAE", Racute: "\u0154", Rang: "\u27EB", Rarr: "\u21A0", Rarrtl: "\u2916", Rcaron: "\u0158", Rcedil: "\u0156", Rcy: "\u0420", Re: "\u211C", ReverseElement: "\u220B", ReverseEquilibrium: "\u21CB", ReverseUpEquilibrium: "\u296F", Rfr: "\u211C", Rho: "\u03A1", RightAngleBracket: "\u27E9", RightArrow: "\u2192", RightArrowBar: "\u21E5", RightArrowLeftArrow: "\u21C4", RightCeiling: "\u2309", RightDoubleBracket: "\u27E7", RightDownTeeVector: "\u295D", RightDownVector: "\u21C2", RightDownVectorBar: "\u2955", RightFloor: "\u230B", RightTee: "\u22A2", RightTeeArrow: "\u21A6", RightTeeVector: "\u295B", RightTriangle: "\u22B3", RightTriangleBar: "\u29D0", RightTriangleEqual: "\u22B5", RightUpDownVector: "\u294F", RightUpTeeVector: "\u295C", RightUpVector: "\u21BE", RightUpVectorBar: "\u2954", RightVector: "\u21C0", RightVectorBar: "\u2953", Rightarrow: "\u21D2", Ropf: "\u211D", RoundImplies: "\u2970", Rrightarrow: "\u21DB", Rscr: "\u211B", Rsh: "\u21B1", RuleDelayed: "\u29F4", SHCHcy: "\u0429", SHcy: "\u0428", SOFTcy: "\u042C", Sacute: "\u015A", Sc: "\u2ABC", Scaron: "\u0160", Scedil: "\u015E", Scirc: "\u015C", Scy: "\u0421", Sfr: "\u{1D516}", ShortDownArrow: "\u2193", ShortLeftArrow: "\u2190", ShortRightArrow: "\u2192", ShortUpArrow: "\u2191", Sigma: "\u03A3", SmallCircle: "\u2218", Sopf: "\u{1D54A}", Sqrt: "\u221A", Square: "\u25A1", SquareIntersection: "\u2293", SquareSubset: "\u228F", SquareSubsetEqual: "\u2291", SquareSuperset: "\u2290", SquareSupersetEqual: "\u2292", SquareUnion: "\u2294", Sscr: "\u{1D4AE}", Star: "\u22C6", Sub: "\u22D0", Subset: "\u22D0", SubsetEqual: "\u2286", Succeeds: "\u227B", SucceedsEqual: "\u2AB0", SucceedsSlantEqual: "\u227D", SucceedsTilde: "\u227F", SuchThat: "\u220B", Sum: "\u2211", Sup: "\u22D1", Superset: "\u2283", SupersetEqual: "\u2287", Supset: "\u22D1", THORN: "\xDE", TRADE: "\u2122", TSHcy: "\u040B", TScy: "\u0426", Tab: " ", Tau: "\u03A4", Tcaron: "\u0164", Tcedil: "\u0162", Tcy: "\u0422", Tfr: "\u{1D517}", Therefore: "\u2234", Theta: "\u0398", ThickSpace: "\u205F\u200A", ThinSpace: "\u2009", Tilde: "\u223C", TildeEqual: "\u2243", TildeFullEqual: "\u2245", TildeTilde: "\u2248", Topf: "\u{1D54B}", TripleDot: "\u20DB", Tscr: "\u{1D4AF}", Tstrok: "\u0166", Uacute: "\xDA", Uarr: "\u219F", Uarrocir: "\u2949", Ubrcy: "\u040E", Ubreve: "\u016C", Ucirc: "\xDB", Ucy: "\u0423", Udblac: "\u0170", Ufr: "\u{1D518}", Ugrave: "\xD9", Umacr: "\u016A", UnderBar: "_", UnderBrace: "\u23DF", UnderBracket: "\u23B5", UnderParenthesis: "\u23DD", Union: "\u22C3", UnionPlus: "\u228E", Uogon: "\u0172", Uopf: "\u{1D54C}", UpArrow: "\u2191", UpArrowBar: "\u2912", UpArrowDownArrow: "\u21C5", UpDownArrow: "\u2195", UpEquilibrium: "\u296E", UpTee: "\u22A5", UpTeeArrow: "\u21A5", Uparrow: "\u21D1", Updownarrow: "\u21D5", UpperLeftArrow: "\u2196", UpperRightArrow: "\u2197", Upsi: "\u03D2", Upsilon: "\u03A5", Uring: "\u016E", Uscr: "\u{1D4B0}", Utilde: "\u0168", Uuml: "\xDC", VDash: "\u22AB", Vbar: "\u2AEB", Vcy: "\u0412", Vdash: "\u22A9", Vdashl: "\u2AE6", Vee: "\u22C1", Verbar: "\u2016", Vert: "\u2016", VerticalBar: "\u2223", VerticalLine: "|", VerticalSeparator: "\u2758", VerticalTilde: "\u2240", VeryThinSpace: "\u200A", Vfr: "\u{1D519}", Vopf: "\u{1D54D}", Vscr: "\u{1D4B1}", Vvdash: "\u22AA", Wcirc: "\u0174", Wedge: "\u22C0", Wfr: "\u{1D51A}", Wopf: "\u{1D54E}", Wscr: "\u{1D4B2}", Xfr: "\u{1D51B}", Xi: "\u039E", Xopf: "\u{1D54F}", Xscr: "\u{1D4B3}", YAcy: "\u042F", YIcy: "\u0407", YUcy: "\u042E", Yacute: "\xDD", Ycirc: "\u0176", Ycy: "\u042B", Yfr: "\u{1D51C}", Yopf: "\u{1D550}", Yscr: "\u{1D4B4}", Yuml: "\u0178", ZHcy: "\u0416", Zacute: "\u0179", Zcaron: "\u017D", Zcy: "\u0417", Zdot: "\u017B", ZeroWidthSpace: "\u200B", Zeta: "\u0396", Zfr: "\u2128", Zopf: "\u2124", Zscr: "\u{1D4B5}", aacute: "\xE1", abreve: "\u0103", ac: "\u223E", acE: "\u223E\u0333", acd: "\u223F", acirc: "\xE2", acute: "\xB4", acy: "\u0430", aelig: "\xE6", af: "\u2061", afr: "\u{1D51E}", agrave: "\xE0", alefsym: "\u2135", aleph: "\u2135", alpha: "\u03B1", amacr: "\u0101", amalg: "\u2A3F", amp: "&", and: "\u2227", andand: "\u2A55", andd: "\u2A5C", andslope: "\u2A58", andv: "\u2A5A", ang: "\u2220", ange: "\u29A4", angle: "\u2220", angmsd: "\u2221", angmsdaa: "\u29A8", angmsdab: "\u29A9", angmsdac: "\u29AA", angmsdad: "\u29AB", angmsdae: "\u29AC", angmsdaf: "\u29AD", angmsdag: "\u29AE", angmsdah: "\u29AF", angrt: "\u221F", angrtvb: "\u22BE", angrtvbd: "\u299D", angsph: "\u2222", angst: "\xC5", angzarr: "\u237C", aogon: "\u0105", aopf: "\u{1D552}", ap: "\u2248", apE: "\u2A70", apacir: "\u2A6F", ape: "\u224A", apid: "\u224B", apos: "'", approx: "\u2248", approxeq: "\u224A", aring: "\xE5", ascr: "\u{1D4B6}", ast: "*", asymp: "\u2248", asympeq: "\u224D", atilde: "\xE3", auml: "\xE4", awconint: "\u2233", awint: "\u2A11", bNot: "\u2AED", backcong: "\u224C", backepsilon: "\u03F6", backprime: "\u2035", backsim: "\u223D", backsimeq: "\u22CD", barvee: "\u22BD", barwed: "\u2305", barwedge: "\u2305", bbrk: "\u23B5", bbrktbrk: "\u23B6", bcong: "\u224C", bcy: "\u0431", bdquo: "\u201E", becaus: "\u2235", because: "\u2235", bemptyv: "\u29B0", bepsi: "\u03F6", bernou: "\u212C", beta: "\u03B2", beth: "\u2136", between: "\u226C", bfr: "\u{1D51F}", bigcap: "\u22C2", bigcirc: "\u25EF", bigcup: "\u22C3", bigodot: "\u2A00", bigoplus: "\u2A01", bigotimes: "\u2A02", bigsqcup: "\u2A06", bigstar: "\u2605", bigtriangledown: "\u25BD", bigtriangleup: "\u25B3", biguplus: "\u2A04", bigvee: "\u22C1", bigwedge: "\u22C0", bkarow: "\u290D", blacklozenge: "\u29EB", blacksquare: "\u25AA", blacktriangle: "\u25B4", blacktriangledown: "\u25BE", blacktriangleleft: "\u25C2", blacktriangleright: "\u25B8", blank: "\u2423", blk12: "\u2592", blk14: "\u2591", blk34: "\u2593", block: "\u2588", bne: "=\u20E5", bnequiv: "\u2261\u20E5", bnot: "\u2310", bopf: "\u{1D553}", bot: "\u22A5", bottom: "\u22A5", bowtie: "\u22C8", boxDL: "\u2557", boxDR: "\u2554", boxDl: "\u2556", boxDr: "\u2553", boxH: "\u2550", boxHD: "\u2566", boxHU: "\u2569", boxHd: "\u2564", boxHu: "\u2567", boxUL: "\u255D", boxUR: "\u255A", boxUl: "\u255C", boxUr: "\u2559", boxV: "\u2551", boxVH: "\u256C", boxVL: "\u2563", boxVR: "\u2560", boxVh: "\u256B", boxVl: "\u2562", boxVr: "\u255F", boxbox: "\u29C9", boxdL: "\u2555", boxdR: "\u2552", boxdl: "\u2510", boxdr: "\u250C", boxh: "\u2500", boxhD: "\u2565", boxhU: "\u2568", boxhd: "\u252C", boxhu: "\u2534", boxminus: "\u229F", boxplus: "\u229E", boxtimes: "\u22A0", boxuL: "\u255B", boxuR: "\u2558", boxul: "\u2518", boxur: "\u2514", boxv: "\u2502", boxvH: "\u256A", boxvL: "\u2561", boxvR: "\u255E", boxvh: "\u253C", boxvl: "\u2524", boxvr: "\u251C", bprime: "\u2035", breve: "\u02D8", brvbar: "\xA6", bscr: "\u{1D4B7}", bsemi: "\u204F", bsim: "\u223D", bsime: "\u22CD", bsol: "\\", bsolb: "\u29C5", bsolhsub: "\u27C8", bull: "\u2022", bullet: "\u2022", bump: "\u224E", bumpE: "\u2AAE", bumpe: "\u224F", bumpeq: "\u224F", cacute: "\u0107", cap: "\u2229", capand: "\u2A44", capbrcup: "\u2A49", capcap: "\u2A4B", capcup: "\u2A47", capdot: "\u2A40", caps: "\u2229\uFE00", caret: "\u2041", caron: "\u02C7", ccaps: "\u2A4D", ccaron: "\u010D", ccedil: "\xE7", ccirc: "\u0109", ccups: "\u2A4C", ccupssm: "\u2A50", cdot: "\u010B", cedil: "\xB8", cemptyv: "\u29B2", cent: "\xA2", centerdot: "\xB7", cfr: "\u{1D520}", chcy: "\u0447", check: "\u2713", checkmark: "\u2713", chi: "\u03C7", cir: "\u25CB", cirE: "\u29C3", circ: "\u02C6", circeq: "\u2257", circlearrowleft: "\u21BA", circlearrowright: "\u21BB", circledR: "\xAE", circledS: "\u24C8", circledast: "\u229B", circledcirc: "\u229A", circleddash: "\u229D", cire: "\u2257", cirfnint: "\u2A10", cirmid: "\u2AEF", cirscir: "\u29C2", clubs: "\u2663", clubsuit: "\u2663", colon: ":", colone: "\u2254", coloneq: "\u2254", comma: ",", commat: "@", comp: "\u2201", compfn: "\u2218", complement: "\u2201", complexes: "\u2102", cong: "\u2245", congdot: "\u2A6D", conint: "\u222E", copf: "\u{1D554}", coprod: "\u2210", copy: "\xA9", copysr: "\u2117", crarr: "\u21B5", cross: "\u2717", cscr: "\u{1D4B8}", csub: "\u2ACF", csube: "\u2AD1", csup: "\u2AD0", csupe: "\u2AD2", ctdot: "\u22EF", cudarrl: "\u2938", cudarrr: "\u2935", cuepr: "\u22DE", cuesc: "\u22DF", cularr: "\u21B6", cularrp: "\u293D", cup: "\u222A", cupbrcap: "\u2A48", cupcap: "\u2A46", cupcup: "\u2A4A", cupdot: "\u228D", cupor: "\u2A45", cups: "\u222A\uFE00", curarr: "\u21B7", curarrm: "\u293C", curlyeqprec: "\u22DE", curlyeqsucc: "\u22DF", curlyvee: "\u22CE", curlywedge: "\u22CF", curren: "\xA4", curvearrowleft: "\u21B6", curvearrowright: "\u21B7", cuvee: "\u22CE", cuwed: "\u22CF", cwconint: "\u2232", cwint: "\u2231", cylcty: "\u232D", dArr: "\u21D3", dHar: "\u2965", dagger: "\u2020", daleth: "\u2138", darr: "\u2193", dash: "\u2010", dashv: "\u22A3", dbkarow: "\u290F", dblac: "\u02DD", dcaron: "\u010F", dcy: "\u0434", dd: "\u2146", ddagger: "\u2021", ddarr: "\u21CA", ddotseq: "\u2A77", deg: "\xB0", delta: "\u03B4", demptyv: "\u29B1", dfisht: "\u297F", dfr: "\u{1D521}", dharl: "\u21C3", dharr: "\u21C2", diam: "\u22C4", diamond: "\u22C4", diamondsuit: "\u2666", diams: "\u2666", die: "\xA8", digamma: "\u03DD", disin: "\u22F2", div: "\xF7", divide: "\xF7", divideontimes: "\u22C7", divonx: "\u22C7", djcy: "\u0452", dlcorn: "\u231E", dlcrop: "\u230D", dollar: "$", dopf: "\u{1D555}", dot: "\u02D9", doteq: "\u2250", doteqdot: "\u2251", dotminus: "\u2238", dotplus: "\u2214", dotsquare: "\u22A1", doublebarwedge: "\u2306", downarrow: "\u2193", downdownarrows: "\u21CA", downharpoonleft: "\u21C3", downharpoonright: "\u21C2", drbkarow: "\u2910", drcorn: "\u231F", drcrop: "\u230C", dscr: "\u{1D4B9}", dscy: "\u0455", dsol: "\u29F6", dstrok: "\u0111", dtdot: "\u22F1", dtri: "\u25BF", dtrif: "\u25BE", duarr: "\u21F5", duhar: "\u296F", dwangle: "\u29A6", dzcy: "\u045F", dzigrarr: "\u27FF", eDDot: "\u2A77", eDot: "\u2251", eacute: "\xE9", easter: "\u2A6E", ecaron: "\u011B", ecir: "\u2256", ecirc: "\xEA", ecolon: "\u2255", ecy: "\u044D", edot: "\u0117", ee: "\u2147", efDot: "\u2252", efr: "\u{1D522}", eg: "\u2A9A", egrave: "\xE8", egs: "\u2A96", egsdot: "\u2A98", el: "\u2A99", elinters: "\u23E7", ell: "\u2113", els: "\u2A95", elsdot: "\u2A97", emacr: "\u0113", empty: "\u2205", emptyset: "\u2205", emptyv: "\u2205", emsp13: "\u2004", emsp14: "\u2005", emsp: "\u2003", eng: "\u014B", ensp: "\u2002", eogon: "\u0119", eopf: "\u{1D556}", epar: "\u22D5", eparsl: "\u29E3", eplus: "\u2A71", epsi: "\u03B5", epsilon: "\u03B5", epsiv: "\u03F5", eqcirc: "\u2256", eqcolon: "\u2255", eqsim: "\u2242", eqslantgtr: "\u2A96", eqslantless: "\u2A95", equals: "=", equest: "\u225F", equiv: "\u2261", equivDD: "\u2A78", eqvparsl: "\u29E5", erDot: "\u2253", erarr: "\u2971", escr: "\u212F", esdot: "\u2250", esim: "\u2242", eta: "\u03B7", eth: "\xF0", euml: "\xEB", euro: "\u20AC", excl: "!", exist: "\u2203", expectation: "\u2130", exponentiale: "\u2147", fallingdotseq: "\u2252", fcy: "\u0444", female: "\u2640", ffilig: "\uFB03", fflig: "\uFB00", ffllig: "\uFB04", ffr: "\u{1D523}", filig: "\uFB01", fjlig: "fj", flat: "\u266D", fllig: "\uFB02", fltns: "\u25B1", fnof: "\u0192", fopf: "\u{1D557}", forall: "\u2200", fork: "\u22D4", forkv: "\u2AD9", fpartint: "\u2A0D", frac12: "\xBD", frac13: "\u2153", frac14: "\xBC", frac15: "\u2155", frac16: "\u2159", frac18: "\u215B", frac23: "\u2154", frac25: "\u2156", frac34: "\xBE", frac35: "\u2157", frac38: "\u215C", frac45: "\u2158", frac56: "\u215A", frac58: "\u215D", frac78: "\u215E", frasl: "\u2044", frown: "\u2322", fscr: "\u{1D4BB}", gE: "\u2267", gEl: "\u2A8C", gacute: "\u01F5", gamma: "\u03B3", gammad: "\u03DD", gap: "\u2A86", gbreve: "\u011F", gcirc: "\u011D", gcy: "\u0433", gdot: "\u0121", ge: "\u2265", gel: "\u22DB", geq: "\u2265", geqq: "\u2267", geqslant: "\u2A7E", ges: "\u2A7E", gescc: "\u2AA9", gesdot: "\u2A80", gesdoto: "\u2A82", gesdotol: "\u2A84", gesl: "\u22DB\uFE00", gesles: "\u2A94", gfr: "\u{1D524}", gg: "\u226B", ggg: "\u22D9", gimel: "\u2137", gjcy: "\u0453", gl: "\u2277", glE: "\u2A92", gla: "\u2AA5", glj: "\u2AA4", gnE: "\u2269", gnap: "\u2A8A", gnapprox: "\u2A8A", gne: "\u2A88", gneq: "\u2A88", gneqq: "\u2269", gnsim: "\u22E7", gopf: "\u{1D558}", grave: "`", gscr: "\u210A", gsim: "\u2273", gsime: "\u2A8E", gsiml: "\u2A90", gt: ">", gtcc: "\u2AA7", gtcir: "\u2A7A", gtdot: "\u22D7", gtlPar: "\u2995", gtquest: "\u2A7C", gtrapprox: "\u2A86", gtrarr: "\u2978", gtrdot: "\u22D7", gtreqless: "\u22DB", gtreqqless: "\u2A8C", gtrless: "\u2277", gtrsim: "\u2273", gvertneqq: "\u2269\uFE00", gvnE: "\u2269\uFE00", hArr: "\u21D4", hairsp: "\u200A", half: "\xBD", hamilt: "\u210B", hardcy: "\u044A", harr: "\u2194", harrcir: "\u2948", harrw: "\u21AD", hbar: "\u210F", hcirc: "\u0125", hearts: "\u2665", heartsuit: "\u2665", hellip: "\u2026", hercon: "\u22B9", hfr: "\u{1D525}", hksearow: "\u2925", hkswarow: "\u2926", hoarr: "\u21FF", homtht: "\u223B", hookleftarrow: "\u21A9", hookrightarrow: "\u21AA", hopf: "\u{1D559}", horbar: "\u2015", hscr: "\u{1D4BD}", hslash: "\u210F", hstrok: "\u0127", hybull: "\u2043", hyphen: "\u2010", iacute: "\xED", ic: "\u2063", icirc: "\xEE", icy: "\u0438", iecy: "\u0435", iexcl: "\xA1", iff: "\u21D4", ifr: "\u{1D526}", igrave: "\xEC", ii: "\u2148", iiiint: "\u2A0C", iiint: "\u222D", iinfin: "\u29DC", iiota: "\u2129", ijlig: "\u0133", imacr: "\u012B", image: "\u2111", imagline: "\u2110", imagpart: "\u2111", imath: "\u0131", imof: "\u22B7", imped: "\u01B5", in: "\u2208", incare: "\u2105", infin: "\u221E", infintie: "\u29DD", inodot: "\u0131", int: "\u222B", intcal: "\u22BA", integers: "\u2124", intercal: "\u22BA", intlarhk: "\u2A17", intprod: "\u2A3C", iocy: "\u0451", iogon: "\u012F", iopf: "\u{1D55A}", iota: "\u03B9", iprod: "\u2A3C", iquest: "\xBF", iscr: "\u{1D4BE}", isin: "\u2208", isinE: "\u22F9", isindot: "\u22F5", isins: "\u22F4", isinsv: "\u22F3", isinv: "\u2208", it: "\u2062", itilde: "\u0129", iukcy: "\u0456", iuml: "\xEF", jcirc: "\u0135", jcy: "\u0439", jfr: "\u{1D527}", jmath: "\u0237", jopf: "\u{1D55B}", jscr: "\u{1D4BF}", jsercy: "\u0458", jukcy: "\u0454", kappa: "\u03BA", kappav: "\u03F0", kcedil: "\u0137", kcy: "\u043A", kfr: "\u{1D528}", kgreen: "\u0138", khcy: "\u0445", kjcy: "\u045C", kopf: "\u{1D55C}", kscr: "\u{1D4C0}", lAarr: "\u21DA", lArr: "\u21D0", lAtail: "\u291B", lBarr: "\u290E", lE: "\u2266", lEg: "\u2A8B", lHar: "\u2962", lacute: "\u013A", laemptyv: "\u29B4", lagran: "\u2112", lambda: "\u03BB", lang: "\u27E8", langd: "\u2991", langle: "\u27E8", lap: "\u2A85", laquo: "\xAB", larr: "\u2190", larrb: "\u21E4", larrbfs: "\u291F", larrfs: "\u291D", larrhk: "\u21A9", larrlp: "\u21AB", larrpl: "\u2939", larrsim: "\u2973", larrtl: "\u21A2", lat: "\u2AAB", latail: "\u2919", late: "\u2AAD", lates: "\u2AAD\uFE00", lbarr: "\u290C", lbbrk: "\u2772", lbrace: "{", lbrack: "[", lbrke: "\u298B", lbrksld: "\u298F", lbrkslu: "\u298D", lcaron: "\u013E", lcedil: "\u013C", lceil: "\u2308", lcub: "{", lcy: "\u043B", ldca: "\u2936", ldquo: "\u201C", ldquor: "\u201E", ldrdhar: "\u2967", ldrushar: "\u294B", ldsh: "\u21B2", le: "\u2264", leftarrow: "\u2190", leftarrowtail: "\u21A2", leftharpoondown: "\u21BD", leftharpoonup: "\u21BC", leftleftarrows: "\u21C7", leftrightarrow: "\u2194", leftrightarrows: "\u21C6", leftrightharpoons: "\u21CB", leftrightsquigarrow: "\u21AD", leftthreetimes: "\u22CB", leg: "\u22DA", leq: "\u2264", leqq: "\u2266", leqslant: "\u2A7D", les: "\u2A7D", lescc: "\u2AA8", lesdot: "\u2A7F", lesdoto: "\u2A81", lesdotor: "\u2A83", lesg: "\u22DA\uFE00", lesges: "\u2A93", lessapprox: "\u2A85", lessdot: "\u22D6", lesseqgtr: "\u22DA", lesseqqgtr: "\u2A8B", lessgtr: "\u2276", lesssim: "\u2272", lfisht: "\u297C", lfloor: "\u230A", lfr: "\u{1D529}", lg: "\u2276", lgE: "\u2A91", lhard: "\u21BD", lharu: "\u21BC", lharul: "\u296A", lhblk: "\u2584", ljcy: "\u0459", ll: "\u226A", llarr: "\u21C7", llcorner: "\u231E", llhard: "\u296B", lltri: "\u25FA", lmidot: "\u0140", lmoust: "\u23B0", lmoustache: "\u23B0", lnE: "\u2268", lnap: "\u2A89", lnapprox: "\u2A89", lne: "\u2A87", lneq: "\u2A87", lneqq: "\u2268", lnsim: "\u22E6", loang: "\u27EC", loarr: "\u21FD", lobrk: "\u27E6", longleftarrow: "\u27F5", longleftrightarrow: "\u27F7", longmapsto: "\u27FC", longrightarrow: "\u27F6", looparrowleft: "\u21AB", looparrowright: "\u21AC", lopar: "\u2985", lopf: "\u{1D55D}", loplus: "\u2A2D", lotimes: "\u2A34", lowast: "\u2217", lowbar: "_", loz: "\u25CA", lozenge: "\u25CA", lozf: "\u29EB", lpar: "(", lparlt: "\u2993", lrarr: "\u21C6", lrcorner: "\u231F", lrhar: "\u21CB", lrhard: "\u296D", lrm: "\u200E", lrtri: "\u22BF", lsaquo: "\u2039", lscr: "\u{1D4C1}", lsh: "\u21B0", lsim: "\u2272", lsime: "\u2A8D", lsimg: "\u2A8F", lsqb: "[", lsquo: "\u2018", lsquor: "\u201A", lstrok: "\u0142", lt: "<", ltcc: "\u2AA6", ltcir: "\u2A79", ltdot: "\u22D6", lthree: "\u22CB", ltimes: "\u22C9", ltlarr: "\u2976", ltquest: "\u2A7B", ltrPar: "\u2996", ltri: "\u25C3", ltrie: "\u22B4", ltrif: "\u25C2", lurdshar: "\u294A", luruhar: "\u2966", lvertneqq: "\u2268\uFE00", lvnE: "\u2268\uFE00", mDDot: "\u223A", macr: "\xAF", male: "\u2642", malt: "\u2720", maltese: "\u2720", map: "\u21A6", mapsto: "\u21A6", mapstodown: "\u21A7", mapstoleft: "\u21A4", mapstoup: "\u21A5", marker: "\u25AE", mcomma: "\u2A29", mcy: "\u043C", mdash: "\u2014", measuredangle: "\u2221", mfr: "\u{1D52A}", mho: "\u2127", micro: "\xB5", mid: "\u2223", midast: "*", midcir: "\u2AF0", middot: "\xB7", minus: "\u2212", minusb: "\u229F", minusd: "\u2238", minusdu: "\u2A2A", mlcp: "\u2ADB", mldr: "\u2026", mnplus: "\u2213", models: "\u22A7", mopf: "\u{1D55E}", mp: "\u2213", mscr: "\u{1D4C2}", mstpos: "\u223E", mu: "\u03BC", multimap: "\u22B8", mumap: "\u22B8", nGg: "\u22D9\u0338", nGt: "\u226B\u20D2", nGtv: "\u226B\u0338", nLeftarrow: "\u21CD", nLeftrightarrow: "\u21CE", nLl: "\u22D8\u0338", nLt: "\u226A\u20D2", nLtv: "\u226A\u0338", nRightarrow: "\u21CF", nVDash: "\u22AF", nVdash: "\u22AE", nabla: "\u2207", nacute: "\u0144", nang: "\u2220\u20D2", nap: "\u2249", napE: "\u2A70\u0338", napid: "\u224B\u0338", napos: "\u0149", napprox: "\u2249", natur: "\u266E", natural: "\u266E", naturals: "\u2115", nbsp: "\xA0", nbump: "\u224E\u0338", nbumpe: "\u224F\u0338", ncap: "\u2A43", ncaron: "\u0148", ncedil: "\u0146", ncong: "\u2247", ncongdot: "\u2A6D\u0338", ncup: "\u2A42", ncy: "\u043D", ndash: "\u2013", ne: "\u2260", neArr: "\u21D7", nearhk: "\u2924", nearr: "\u2197", nearrow: "\u2197", nedot: "\u2250\u0338", nequiv: "\u2262", nesear: "\u2928", nesim: "\u2242\u0338", nexist: "\u2204", nexists: "\u2204", nfr: "\u{1D52B}", ngE: "\u2267\u0338", nge: "\u2271", ngeq: "\u2271", ngeqq: "\u2267\u0338", ngeqslant: "\u2A7E\u0338", nges: "\u2A7E\u0338", ngsim: "\u2275", ngt: "\u226F", ngtr: "\u226F", nhArr: "\u21CE", nharr: "\u21AE", nhpar: "\u2AF2", ni: "\u220B", nis: "\u22FC", nisd: "\u22FA", niv: "\u220B", njcy: "\u045A", nlArr: "\u21CD", nlE: "\u2266\u0338", nlarr: "\u219A", nldr: "\u2025", nle: "\u2270", nleftarrow: "\u219A", nleftrightarrow: "\u21AE", nleq: "\u2270", nleqq: "\u2266\u0338", nleqslant: "\u2A7D\u0338", nles: "\u2A7D\u0338", nless: "\u226E", nlsim: "\u2274", nlt: "\u226E", nltri: "\u22EA", nltrie: "\u22EC", nmid: "\u2224", nopf: "\u{1D55F}", not: "\xAC", notin: "\u2209", notinE: "\u22F9\u0338", notindot: "\u22F5\u0338", notinva: "\u2209", notinvb: "\u22F7", notinvc: "\u22F6", notni: "\u220C", notniva: "\u220C", notnivb: "\u22FE", notnivc: "\u22FD", npar: "\u2226", nparallel: "\u2226", nparsl: "\u2AFD\u20E5", npart: "\u2202\u0338", npolint: "\u2A14", npr: "\u2280", nprcue: "\u22E0", npre: "\u2AAF\u0338", nprec: "\u2280", npreceq: "\u2AAF\u0338", nrArr: "\u21CF", nrarr: "\u219B", nrarrc: "\u2933\u0338", nrarrw: "\u219D\u0338", nrightarrow: "\u219B", nrtri: "\u22EB", nrtrie: "\u22ED", nsc: "\u2281", nsccue: "\u22E1", nsce: "\u2AB0\u0338", nscr: "\u{1D4C3}", nshortmid: "\u2224", nshortparallel: "\u2226", nsim: "\u2241", nsime: "\u2244", nsimeq: "\u2244", nsmid: "\u2224", nspar: "\u2226", nsqsube: "\u22E2", nsqsupe: "\u22E3", nsub: "\u2284", nsubE: "\u2AC5\u0338", nsube: "\u2288", nsubset: "\u2282\u20D2", nsubseteq: "\u2288", nsubseteqq: "\u2AC5\u0338", nsucc: "\u2281", nsucceq: "\u2AB0\u0338", nsup: "\u2285", nsupE: "\u2AC6\u0338", nsupe: "\u2289", nsupset: "\u2283\u20D2", nsupseteq: "\u2289", nsupseteqq: "\u2AC6\u0338", ntgl: "\u2279", ntilde: "\xF1", ntlg: "\u2278", ntriangleleft: "\u22EA", ntrianglelefteq: "\u22EC", ntriangleright: "\u22EB", ntrianglerighteq: "\u22ED", nu: "\u03BD", num: "#", numero: "\u2116", numsp: "\u2007", nvDash: "\u22AD", nvHarr: "\u2904", nvap: "\u224D\u20D2", nvdash: "\u22AC", nvge: "\u2265\u20D2", nvgt: ">\u20D2", nvinfin: "\u29DE", nvlArr: "\u2902", nvle: "\u2264\u20D2", nvlt: "<\u20D2", nvltrie: "\u22B4\u20D2", nvrArr: "\u2903", nvrtrie: "\u22B5\u20D2", nvsim: "\u223C\u20D2", nwArr: "\u21D6", nwarhk: "\u2923", nwarr: "\u2196", nwarrow: "\u2196", nwnear: "\u2927", oS: "\u24C8", oacute: "\xF3", oast: "\u229B", ocir: "\u229A", ocirc: "\xF4", ocy: "\u043E", odash: "\u229D", odblac: "\u0151", odiv: "\u2A38", odot: "\u2299", odsold: "\u29BC", oelig: "\u0153", ofcir: "\u29BF", ofr: "\u{1D52C}", ogon: "\u02DB", ograve: "\xF2", ogt: "\u29C1", ohbar: "\u29B5", ohm: "\u03A9", oint: "\u222E", olarr: "\u21BA", olcir: "\u29BE", olcross: "\u29BB", oline: "\u203E", olt: "\u29C0", omacr: "\u014D", omega: "\u03C9", omicron: "\u03BF", omid: "\u29B6", ominus: "\u2296", oopf: "\u{1D560}", opar: "\u29B7", operp: "\u29B9", oplus: "\u2295", or: "\u2228", orarr: "\u21BB", ord: "\u2A5D", order: "\u2134", orderof: "\u2134", ordf: "\xAA", ordm: "\xBA", origof: "\u22B6", oror: "\u2A56", orslope: "\u2A57", orv: "\u2A5B", oscr: "\u2134", oslash: "\xF8", osol: "\u2298", otilde: "\xF5", otimes: "\u2297", otimesas: "\u2A36", ouml: "\xF6", ovbar: "\u233D", par: "\u2225", para: "\xB6", parallel: "\u2225", parsim: "\u2AF3", parsl: "\u2AFD", part: "\u2202", pcy: "\u043F", percnt: "%", period: ".", permil: "\u2030", perp: "\u22A5", pertenk: "\u2031", pfr: "\u{1D52D}", phi: "\u03C6", phiv: "\u03D5", phmmat: "\u2133", phone: "\u260E", pi: "\u03C0", pitchfork: "\u22D4", piv: "\u03D6", planck: "\u210F", planckh: "\u210E", plankv: "\u210F", plus: "+", plusacir: "\u2A23", plusb: "\u229E", pluscir: "\u2A22", plusdo: "\u2214", plusdu: "\u2A25", pluse: "\u2A72", plusmn: "\xB1", plussim: "\u2A26", plustwo: "\u2A27", pm: "\xB1", pointint: "\u2A15", popf: "\u{1D561}", pound: "\xA3", pr: "\u227A", prE: "\u2AB3", prap: "\u2AB7", prcue: "\u227C", pre: "\u2AAF", prec: "\u227A", precapprox: "\u2AB7", preccurlyeq: "\u227C", preceq: "\u2AAF", precnapprox: "\u2AB9", precneqq: "\u2AB5", precnsim: "\u22E8", precsim: "\u227E", prime: "\u2032", primes: "\u2119", prnE: "\u2AB5", prnap: "\u2AB9", prnsim: "\u22E8", prod: "\u220F", profalar: "\u232E", profline: "\u2312", profsurf: "\u2313", prop: "\u221D", propto: "\u221D", prsim: "\u227E", prurel: "\u22B0", pscr: "\u{1D4C5}", psi: "\u03C8", puncsp: "\u2008", qfr: "\u{1D52E}", qint: "\u2A0C", qopf: "\u{1D562}", qprime: "\u2057", qscr: "\u{1D4C6}", quaternions: "\u210D", quatint: "\u2A16", quest: "?", questeq: "\u225F", quot: '"', rAarr: "\u21DB", rArr: "\u21D2", rAtail: "\u291C", rBarr: "\u290F", rHar: "\u2964", race: "\u223D\u0331", racute: "\u0155", radic: "\u221A", raemptyv: "\u29B3", rang: "\u27E9", rangd: "\u2992", range: "\u29A5", rangle: "\u27E9", raquo: "\xBB", rarr: "\u2192", rarrap: "\u2975", rarrb: "\u21E5", rarrbfs: "\u2920", rarrc: "\u2933", rarrfs: "\u291E", rarrhk: "\u21AA", rarrlp: "\u21AC", rarrpl: "\u2945", rarrsim: "\u2974", rarrtl: "\u21A3", rarrw: "\u219D", ratail: "\u291A", ratio: "\u2236", rationals: "\u211A", rbarr: "\u290D", rbbrk: "\u2773", rbrace: "}", rbrack: "]", rbrke: "\u298C", rbrksld: "\u298E", rbrkslu: "\u2990", rcaron: "\u0159", rcedil: "\u0157", rceil: "\u2309", rcub: "}", rcy: "\u0440", rdca: "\u2937", rdldhar: "\u2969", rdquo: "\u201D", rdquor: "\u201D", rdsh: "\u21B3", real: "\u211C", realine: "\u211B", realpart: "\u211C", reals: "\u211D", rect: "\u25AD", reg: "\xAE", rfisht: "\u297D", rfloor: "\u230B", rfr: "\u{1D52F}", rhard: "\u21C1", rharu: "\u21C0", rharul: "\u296C", rho: "\u03C1", rhov: "\u03F1", rightarrow: "\u2192", rightarrowtail: "\u21A3", rightharpoondown: "\u21C1", rightharpoonup: "\u21C0", rightleftarrows: "\u21C4", rightleftharpoons: "\u21CC", rightrightarrows: "\u21C9", rightsquigarrow: "\u219D", rightthreetimes: "\u22CC", ring: "\u02DA", risingdotseq: "\u2253", rlarr: "\u21C4", rlhar: "\u21CC", rlm: "\u200F", rmoust: "\u23B1", rmoustache: "\u23B1", rnmid: "\u2AEE", roang: "\u27ED", roarr: "\u21FE", robrk: "\u27E7", ropar: "\u2986", ropf: "\u{1D563}", roplus: "\u2A2E", rotimes: "\u2A35", rpar: ")", rpargt: "\u2994", rppolint: "\u2A12", rrarr: "\u21C9", rsaquo: "\u203A", rscr: "\u{1D4C7}", rsh: "\u21B1", rsqb: "]", rsquo: "\u2019", rsquor: "\u2019", rthree: "\u22CC", rtimes: "\u22CA", rtri: "\u25B9", rtrie: "\u22B5", rtrif: "\u25B8", rtriltri: "\u29CE", ruluhar: "\u2968", rx: "\u211E", sacute: "\u015B", sbquo: "\u201A", sc: "\u227B", scE: "\u2AB4", scap: "\u2AB8", scaron: "\u0161", sccue: "\u227D", sce: "\u2AB0", scedil: "\u015F", scirc: "\u015D", scnE: "\u2AB6", scnap: "\u2ABA", scnsim: "\u22E9", scpolint: "\u2A13", scsim: "\u227F", scy: "\u0441", sdot: "\u22C5", sdotb: "\u22A1", sdote: "\u2A66", seArr: "\u21D8", searhk: "\u2925", searr: "\u2198", searrow: "\u2198", sect: "\xA7", semi: ";", seswar: "\u2929", setminus: "\u2216", setmn: "\u2216", sext: "\u2736", sfr: "\u{1D530}", sfrown: "\u2322", sharp: "\u266F", shchcy: "\u0449", shcy: "\u0448", shortmid: "\u2223", shortparallel: "\u2225", shy: "\xAD", sigma: "\u03C3", sigmaf: "\u03C2", sigmav: "\u03C2", sim: "\u223C", simdot: "\u2A6A", sime: "\u2243", simeq: "\u2243", simg: "\u2A9E", simgE: "\u2AA0", siml: "\u2A9D", simlE: "\u2A9F", simne: "\u2246", simplus: "\u2A24", simrarr: "\u2972", slarr: "\u2190", smallsetminus: "\u2216", smashp: "\u2A33", smeparsl: "\u29E4", smid: "\u2223", smile: "\u2323", smt: "\u2AAA", smte: "\u2AAC", smtes: "\u2AAC\uFE00", softcy: "\u044C", sol: "/", solb: "\u29C4", solbar: "\u233F", sopf: "\u{1D564}", spades: "\u2660", spadesuit: "\u2660", spar: "\u2225", sqcap: "\u2293", sqcaps: "\u2293\uFE00", sqcup: "\u2294", sqcups: "\u2294\uFE00", sqsub: "\u228F", sqsube: "\u2291", sqsubset: "\u228F", sqsubseteq: "\u2291", sqsup: "\u2290", sqsupe: "\u2292", sqsupset: "\u2290", sqsupseteq: "\u2292", squ: "\u25A1", square: "\u25A1", squarf: "\u25AA", squf: "\u25AA", srarr: "\u2192", sscr: "\u{1D4C8}", ssetmn: "\u2216", ssmile: "\u2323", sstarf: "\u22C6", star: "\u2606", starf: "\u2605", straightepsilon: "\u03F5", straightphi: "\u03D5", strns: "\xAF", sub: "\u2282", subE: "\u2AC5", subdot: "\u2ABD", sube: "\u2286", subedot: "\u2AC3", submult: "\u2AC1", subnE: "\u2ACB", subne: "\u228A", subplus: "\u2ABF", subrarr: "\u2979", subset: "\u2282", subseteq: "\u2286", subseteqq: "\u2AC5", subsetneq: "\u228A", subsetneqq: "\u2ACB", subsim: "\u2AC7", subsub: "\u2AD5", subsup: "\u2AD3", succ: "\u227B", succapprox: "\u2AB8", succcurlyeq: "\u227D", succeq: "\u2AB0", succnapprox: "\u2ABA", succneqq: "\u2AB6", succnsim: "\u22E9", succsim: "\u227F", sum: "\u2211", sung: "\u266A", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", sup: "\u2283", supE: "\u2AC6", supdot: "\u2ABE", supdsub: "\u2AD8", supe: "\u2287", supedot: "\u2AC4", suphsol: "\u27C9", suphsub: "\u2AD7", suplarr: "\u297B", supmult: "\u2AC2", supnE: "\u2ACC", supne: "\u228B", supplus: "\u2AC0", supset: "\u2283", supseteq: "\u2287", supseteqq: "\u2AC6", supsetneq: "\u228B", supsetneqq: "\u2ACC", supsim: "\u2AC8", supsub: "\u2AD4", supsup: "\u2AD6", swArr: "\u21D9", swarhk: "\u2926", swarr: "\u2199", swarrow: "\u2199", swnwar: "\u292A", szlig: "\xDF", target: "\u2316", tau: "\u03C4", tbrk: "\u23B4", tcaron: "\u0165", tcedil: "\u0163", tcy: "\u0442", tdot: "\u20DB", telrec: "\u2315", tfr: "\u{1D531}", there4: "\u2234", therefore: "\u2234", theta: "\u03B8", thetasym: "\u03D1", thetav: "\u03D1", thickapprox: "\u2248", thicksim: "\u223C", thinsp: "\u2009", thkap: "\u2248", thksim: "\u223C", thorn: "\xFE", tilde: "\u02DC", times: "\xD7", timesb: "\u22A0", timesbar: "\u2A31", timesd: "\u2A30", tint: "\u222D", toea: "\u2928", top: "\u22A4", topbot: "\u2336", topcir: "\u2AF1", topf: "\u{1D565}", topfork: "\u2ADA", tosa: "\u2929", tprime: "\u2034", trade: "\u2122", triangle: "\u25B5", triangledown: "\u25BF", triangleleft: "\u25C3", trianglelefteq: "\u22B4", triangleq: "\u225C", triangleright: "\u25B9", trianglerighteq: "\u22B5", tridot: "\u25EC", trie: "\u225C", triminus: "\u2A3A", triplus: "\u2A39", trisb: "\u29CD", tritime: "\u2A3B", trpezium: "\u23E2", tscr: "\u{1D4C9}", tscy: "\u0446", tshcy: "\u045B", tstrok: "\u0167", twixt: "\u226C", twoheadleftarrow: "\u219E", twoheadrightarrow: "\u21A0", uArr: "\u21D1", uHar: "\u2963", uacute: "\xFA", uarr: "\u2191", ubrcy: "\u045E", ubreve: "\u016D", ucirc: "\xFB", ucy: "\u0443", udarr: "\u21C5", udblac: "\u0171", udhar: "\u296E", ufisht: "\u297E", ufr: "\u{1D532}", ugrave: "\xF9", uharl: "\u21BF", uharr: "\u21BE", uhblk: "\u2580", ulcorn: "\u231C", ulcorner: "\u231C", ulcrop: "\u230F", ultri: "\u25F8", umacr: "\u016B", uml: "\xA8", uogon: "\u0173", uopf: "\u{1D566}", uparrow: "\u2191", updownarrow: "\u2195", upharpoonleft: "\u21BF", upharpoonright: "\u21BE", uplus: "\u228E", upsi: "\u03C5", upsih: "\u03D2", upsilon: "\u03C5", upuparrows: "\u21C8", urcorn: "\u231D", urcorner: "\u231D", urcrop: "\u230E", uring: "\u016F", urtri: "\u25F9", uscr: "\u{1D4CA}", utdot: "\u22F0", utilde: "\u0169", utri: "\u25B5", utrif: "\u25B4", uuarr: "\u21C8", uuml: "\xFC", uwangle: "\u29A7", vArr: "\u21D5", vBar: "\u2AE8", vBarv: "\u2AE9", vDash: "\u22A8", vangrt: "\u299C", varepsilon: "\u03F5", varkappa: "\u03F0", varnothing: "\u2205", varphi: "\u03D5", varpi: "\u03D6", varpropto: "\u221D", varr: "\u2195", varrho: "\u03F1", varsigma: "\u03C2", varsubsetneq: "\u228A\uFE00", varsubsetneqq: "\u2ACB\uFE00", varsupsetneq: "\u228B\uFE00", varsupsetneqq: "\u2ACC\uFE00", vartheta: "\u03D1", vartriangleleft: "\u22B2", vartriangleright: "\u22B3", vcy: "\u0432", vdash: "\u22A2", vee: "\u2228", veebar: "\u22BB", veeeq: "\u225A", vellip: "\u22EE", verbar: "|", vert: "|", vfr: "\u{1D533}", vltri: "\u22B2", vnsub: "\u2282\u20D2", vnsup: "\u2283\u20D2", vopf: "\u{1D567}", vprop: "\u221D", vrtri: "\u22B3", vscr: "\u{1D4CB}", vsubnE: "\u2ACB\uFE00", vsubne: "\u228A\uFE00", vsupnE: "\u2ACC\uFE00", vsupne: "\u228B\uFE00", vzigzag: "\u299A", wcirc: "\u0175", wedbar: "\u2A5F", wedge: "\u2227", wedgeq: "\u2259", weierp: "\u2118", wfr: "\u{1D534}", wopf: "\u{1D568}", wp: "\u2118", wr: "\u2240", wreath: "\u2240", wscr: "\u{1D4CC}", xcap: "\u22C2", xcirc: "\u25EF", xcup: "\u22C3", xdtri: "\u25BD", xfr: "\u{1D535}", xhArr: "\u27FA", xharr: "\u27F7", xi: "\u03BE", xlArr: "\u27F8", xlarr: "\u27F5", xmap: "\u27FC", xnis: "\u22FB", xodot: "\u2A00", xopf: "\u{1D569}", xoplus: "\u2A01", xotime: "\u2A02", xrArr: "\u27F9", xrarr: "\u27F6", xscr: "\u{1D4CD}", xsqcup: "\u2A06", xuplus: "\u2A04", xutri: "\u25B3", xvee: "\u22C1", xwedge: "\u22C0", yacute: "\xFD", yacy: "\u044F", ycirc: "\u0177", ycy: "\u044B", yen: "\xA5", yfr: "\u{1D536}", yicy: "\u0457", yopf: "\u{1D56A}", yscr: "\u{1D4CE}", yucy: "\u044E", yuml: "\xFF", zacute: "\u017A", zcaron: "\u017E", zcy: "\u0437", zdot: "\u017C", zeetrf: "\u2128", zeta: "\u03B6", zfr: "\u{1D537}", zhcy: "\u0436", zigrarr: "\u21DD", zopf: "\u{1D56B}", zscr: "\u{1D4CF}", zwj: "\u200D", zwnj: "\u200C" }; var own = {}.hasOwnProperty; function decodeNamedCharacterReference(value) { return own.call(characterEntities, value) ? characterEntities[value] : false; } function splice(list2, start, remove, items) { const end = list2.length; let chunkStart = 0; let parameters; if (start < 0) { start = -start > end ? 0 : end + start; } else { start = start > end ? end : start; } remove = remove > 0 ? remove : 0; if (items.length < 1e4) { parameters = Array.from(items); parameters.unshift(start, remove); [].splice.apply(list2, parameters); } else { if (remove) [].splice.apply(list2, [start, remove]); while (chunkStart < items.length) { parameters = items.slice(chunkStart, chunkStart + 1e4); parameters.unshift(start, 0); [].splice.apply(list2, parameters); chunkStart += 1e4; start += 1e4; } } } function push(list2, items) { if (list2.length > 0) { splice(list2, list2.length, 0, items); return list2; } return items; } var hasOwnProperty2 = {}.hasOwnProperty; function combineExtensions(extensions) { const all = {}; let index = -1; while (++index < extensions.length) { syntaxExtension(all, extensions[index]); } return all; } function syntaxExtension(all, extension) { let hook; for (hook in extension) { const maybe = hasOwnProperty2.call(all, hook) ? all[hook] : void 0; const left = maybe || (all[hook] = {}); const right = extension[hook]; let code; for (code in right) { if (!hasOwnProperty2.call(left, code)) left[code] = []; const value = right[code]; constructs( left[code], Array.isArray(value) ? value : value ? [value] : [] ); } } } function constructs(existing, list2) { let index = -1; const before = []; while (++index < list2.length) { ; (list2[index].add === "after" ? existing : before).push(list2[index]); } splice(existing, 0, 0, before); } function combineHtmlExtensions(htmlExtensions) { const handlers = {}; let index = -1; while (++index < htmlExtensions.length) { htmlExtension(handlers, htmlExtensions[index]); } return handlers; } function htmlExtension(all, extension) { let hook; for (hook in extension) { const maybe = hasOwnProperty2.call(all, hook) ? all[hook] : void 0; const left = maybe || (all[hook] = {}); const right = extension[hook]; let type; if (right) { for (type in right) { left[type] = right[type]; } } } } function decodeNumericCharacterReference(value, base) { const code = Number.parseInt(value, base); if (code < 9 || code === 11 || code > 13 && code < 32 || code > 126 && code < 160 || code > 55295 && code < 57344 || code > 64975 && code < 65008 || (code & 65535) === 65535 || (code & 65535) === 65534 || code > 1114111) { return "\uFFFD"; } return String.fromCharCode(code); } var characterReferences = { '"': "quot", "&": "amp", "<": "lt", ">": "gt" }; function encode(value) { return value.replace(/["&<>]/g, replace); function replace(value2) { return "&" + characterReferences[value2] + ";"; } } function normalizeIdentifier(value) { return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); } var unicodePunctuationRegex = /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; var asciiAlpha = regexCheck(/[A-Za-z]/); var asciiDigit = regexCheck(/\d/); var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); function asciiControl(code) { return code !== null && (code < 32 || code === 127); } function markdownLineEndingOrSpace(code) { return code !== null && (code < 0 || code === 32); } function markdownLineEnding(code) { return code !== null && code < -2; } function markdownSpace(code) { return code === -2 || code === -1 || code === 32; } var unicodeWhitespace = regexCheck(/\s/); var unicodePunctuation = regexCheck(unicodePunctuationRegex); function regexCheck(regex) { return check; function check(code) { return code !== null && regex.test(String.fromCharCode(code)); } } function sanitizeUri(url, protocol) { const value = encode(normalizeUri(url || "")); if (!protocol) { return value; } const colon = value.indexOf(":"); const questionMark = value.indexOf("?"); const numberSign = value.indexOf("#"); const slash = value.indexOf("/"); if (colon < 0 || slash > -1 && colon > slash || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign || protocol.test(value.slice(0, colon))) { return value; } return ""; } function normalizeUri(value) { const result = []; let index = -1; let start = 0; let skip = 0; while (++index < value.length) { const code = value.charCodeAt(index); let replace = ""; if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) { skip = 2; } else if (code < 128) { if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { replace = String.fromCharCode(code); } } else if (code > 55295 && code < 57344) { const next = value.charCodeAt(index + 1); if (code < 56320 && next > 56319 && next < 57344) { replace = String.fromCharCode(code, next); skip = 1; } else { replace = "\uFFFD"; } } else { replace = String.fromCharCode(code); } if (replace) { result.push(value.slice(start, index), encodeURIComponent(replace)); start = index + skip + 1; replace = ""; } if (skip) { index += skip; skip = 0; } } return result.join("") + value.slice(start); } var hasOwnProperty22 = {}.hasOwnProperty; var protocolHref = /^(https?|ircs?|mailto|xmpp)$/i; var protocolSrc = /^https?$/i; function compile(options = {}) { let tags = true; const definitions = {}; const buffers = [[]]; const mediaStack = []; const tightStack = []; const defaultHandlers = { enter: { blockQuote: onenterblockquote, codeFenced: onentercodefenced, codeFencedFenceInfo: buffer, codeFencedFenceMeta: buffer, codeIndented: onentercodeindented, codeText: onentercodetext, content: onentercontent, definition: onenterdefinition, definitionDestinationString: onenterdefinitiondestinationstring, definitionLabelString: buffer, definitionTitleString: buffer, emphasis: onenteremphasis, htmlFlow: onenterhtmlflow, htmlText: onenterhtml, image: onenterimage, label: buffer, link: onenterlink, listItemMarker: onenterlistitemmarker, listItemValue: onenterlistitemvalue, listOrdered: onenterlistordered, listUnordered: onenterlistunordered, paragraph: onenterparagraph, reference: buffer, resource: onenterresource, resourceDestinationString: onenterresourcedestinationstring, resourceTitleString: buffer, setextHeading: onentersetextheading, strong: onenterstrong }, exit: { atxHeading: onexitatxheading, atxHeadingSequence: onexitatxheadingsequence, autolinkEmail: onexitautolinkemail, autolinkProtocol: onexitautolinkprotocol, blockQuote: onexitblockquote, characterEscapeValue: onexitdata, characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, characterReferenceMarkerNumeric: onexitcharacterreferencemarker, characterReferenceValue: onexitcharacterreferencevalue, codeFenced: onexitflowcode, codeFencedFence: onexitcodefencedfence, codeFencedFenceInfo: onexitcodefencedfenceinfo, codeFencedFenceMeta: resume, codeFlowValue: onexitcodeflowvalue, codeIndented: onexitflowcode, codeText: onexitcodetext, codeTextData: onexitdata, data: onexitdata, definition: onexitdefinition, definitionDestinationString: onexitdefinitiondestinationstring, definitionLabelString: onexitdefinitionlabelstring, definitionTitleString: onexitdefinitiontitlestring, emphasis: onexitemphasis, hardBreakEscape: onexithardbreak, hardBreakTrailing: onexithardbreak, htmlFlow: onexithtml, htmlFlowData: onexitdata, htmlText: onexithtml, htmlTextData: onexitdata, image: onexitmedia, label: onexitlabel, labelText: onexitlabeltext, lineEnding: onexitlineending, link: onexitmedia, listOrdered: onexitlistordered, listUnordered: onexitlistunordered, paragraph: onexitparagraph, reference: resume, referenceString: onexitreferencestring, resource: resume, resourceDestinationString: onexitresourcedestinationstring, resourceTitleString: onexitresourcetitlestring, setextHeading: onexitsetextheading, setextHeadingLineSequence: onexitsetextheadinglinesequence, setextHeadingText: onexitsetextheadingtext, strong: onexitstrong, thematicBreak: onexitthematicbreak } }; const handlers = combineHtmlExtensions( [defaultHandlers].concat(options.htmlExtensions || []) ); const data = { tightStack }; const context = { lineEndingIfNeeded, options, encode: encode2, raw, tag, buffer, resume, setData, getData }; let lineEndingStyle = options.defaultLineEnding; return compile2; function compile2(events) { let index = -1; let start = 0; const listStack = []; let head = []; let body = []; while (++index < events.length) { if (!lineEndingStyle && (events[index][1].type === "lineEnding" || events[index][1].type === "lineEndingBlank")) { lineEndingStyle = events[index][2].sliceSerialize(events[index][1]); } if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") { if (events[index][0] === "enter") { listStack.push(index); } else { prepareList(events.slice(listStack.pop(), index)); } } if (events[index][1].type === "definition") { if (events[index][0] === "enter") { body = push(body, events.slice(start, index)); start = index; } else { head = push(head, events.slice(start, index + 1)); start = index + 1; } } } head = push(head, body); head = push(head, events.slice(start)); index = -1; const result = head; if (handlers.enter.null) { handlers.enter.null.call(context); } while (++index < events.length) { const handler = handlers[result[index][0]]; if (hasOwnProperty22.call(handler, result[index][1].type)) { handler[result[index][1].type].call( Object.assign( { sliceSerialize: result[index][2].sliceSerialize }, context ), result[index][1] ); } } if (handlers.exit.null) { handlers.exit.null.call(context); } return buffers[0].join(""); } function prepareList(slice) { const length = slice.length; let index = 0; let containerBalance = 0; let loose = false; let atMarker; while (++index < length) { const event = slice[index]; if (event[1]._container) { atMarker = void 0; if (event[0] === "enter") { containerBalance++; } else { containerBalance--; } } else switch (event[1].type) { case "listItemPrefix": { if (event[0] === "exit") { atMarker = true; } break; } case "linePrefix": { break; } case "lineEndingBlank": { if (event[0] === "enter" && !containerBalance) { if (atMarker) { atMarker = void 0; } else { loose = true; } } break; } default: { atMarker = void 0; } } } slice[0][1]._loose = loose; } function setData(key, value) { data[key] = value; } function getData(key) { return data[key]; } function buffer() { buffers.push([]); } function resume() { const buf = buffers.pop(); return buf.join(""); } function tag(value) { if (!tags) return; setData("lastWasTag", true); buffers[buffers.length - 1].push(value); } function raw(value) { setData("lastWasTag"); buffers[buffers.length - 1].push(value); } function lineEnding2() { raw(lineEndingStyle || "\n"); } function lineEndingIfNeeded() { const buffer2 = buffers[buffers.length - 1]; const slice = buffer2[buffer2.length - 1]; const previous2 = slice ? slice.charCodeAt(slice.length - 1) : null; if (previous2 === 10 || previous2 === 13 || previous2 === null) { return; } lineEnding2(); } function encode2(value) { return getData("ignoreEncode") ? value : encode(value); } function onenterlistordered(token) { tightStack.push(!token._loose); lineEndingIfNeeded(); tag("<ol"); setData("expectFirstItem", true); } function onenterlistunordered(token) { tightStack.push(!token._loose); lineEndingIfNeeded(); tag("<ul"); setData("expectFirstItem", true); } function onenterlistitemvalue(token) { if (getData("expectFirstItem")) { const value = Number.parseInt(this.sliceSerialize(token), 10); if (value !== 1) { tag(' start="' + encode2(String(value)) + '"'); } } } function onenterlistitemmarker() { if (getData("expectFirstItem")) { tag(">"); } else { onexitlistitem(); } lineEndingIfNeeded(); tag("<li>"); setData("expectFirstItem"); setData("lastWasTag"); } function onexitlistordered() { onexitlistitem(); tightStack.pop(); lineEnding2(); tag("</ol>"); } function onexitlistunordered() { onexitlistitem(); tightStack.pop(); lineEnding2(); tag("</ul>"); } function onexitlistitem() { if (getData("lastWasTag") && !getData("slurpAllLineEndings")) { lineEndingIfNeeded(); } tag("</li>"); setData("slurpAllLineEndings"); } function onenterblockquote() { tightStack.push(false); lineEndingIfNeeded(); tag("<blockquote>"); } function onexitblockquote() { tightStack.pop(); lineEndingIfNeeded(); tag("</blockquote>"); setData("slurpAllLineEndings"); } function onenterparagraph() { if (!tightStack[tightStack.length - 1]) { lineEndingIfNeeded(); tag("<p>"); } setData("slurpAllLineEndings"); } function onexitparagraph() { if (tightStack[tightStack.length - 1]) { setData("slurpAllLineEndings", true); } else { tag("</p>"); } } function onentercodefenced() { lineEndingIfNeeded(); tag("<pre><code"); setData("fencesCount", 0); } function onexitcodefencedfenceinfo() { const value = resume(); tag(' class="language-' + value + '"'); } function onexitcodefencedfence() { const count = getData("fencesCount") || 0; if (!count) { tag(">"); setData("slurpOneLineEnding", true); } setData("fencesCount", count + 1); } function onentercodeindented() { lineEndingIfNeeded(); tag("<pre><code>"); } function onexitflowcode() { const count = getData("fencesCount"); if (count !== void 0 && count < 2 && data.tightStack.length > 0 && !getData("lastWasTag")) { lineEnding2(); } if (getData("flowCodeSeenData")) { lineEndingIfNeeded(); } tag("</code></pre>"); if (count !== void 0 && count < 2) lineEndingIfNeeded(); setData("flowCodeSeenData"); setData("fencesCount"); setData("slurpOneLineEnding"); } function onenterimage() { mediaStack.push({ image: true }); tags = void 0; } function onenterlink() { mediaStack.push({}); } function onexitlabeltext(token) { mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token); } function onexitlabel() { mediaStack[mediaStack.length - 1].label = resume(); } function onexitreferencestring(token) { mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token); } function onenterresource() { buffer(); mediaStack[mediaStack.length - 1].destination = ""; } function onenterresourcedestinationstring() { buffer(); setData("ignoreEncode", true); } function onexitresourcedestinationstring() { mediaStack[mediaStack.length - 1].destination = resume(); setData("ignoreEncode"); } function onexitresourcetitlestring() { mediaStack[mediaStack.length - 1].title = resume(); } function onexitmedia() { let index = mediaStack.length - 1; const media = mediaStack[index]; const id = media.referenceId || media.labelId; const context2 = media.destination === void 0 ? definitions[normalizeIdentifier(id)] : media; tags = true; while (index--) { if (mediaStack[index].image) { tags = void 0; break; } } if (media.image) { tag( '<img src="' + sanitizeUri( context2.destination, options.allowDangerousProtocol ? void 0 : protocolSrc ) + '" alt="' ); raw(media.label); tag('"'); } else { tag( '<a href="' + sanitizeUri( context2.destination, options.allowDangerousProtocol ? void 0 : protocolHref ) + '"' ); } tag(context2.title ? ' title="' + context2.title + '"' : ""); if (media.image) { tag(" />"); } else { tag(">"); raw(media.label); tag("</a>"); } mediaStack.pop(); } function onenterdefinition() { buffer(); mediaStack.push({}); } function onexitdefinitionlabelstring(token) { resume(); mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token); } function onenterdefinitiondestinationstring() { buffer(); setData("ignoreEncode", true); } function onexitdefinitiondestinationstring() { mediaStack[mediaStack.length - 1].destination = resume(); setData("ignoreEncode"); } function onexitdefinitiontitlestring() { mediaStack[mediaStack.length - 1].title = resume(); } function onexitdefinition() { const media = mediaStack[mediaStack.length - 1]; const id = normalizeIdentifier(media.labelId); resume(); if (!hasOwnProperty22.call(definitions, id)) { definitions[id] = mediaStack[mediaStack.length - 1]; } mediaStack.pop(); } function onentercontent() { setData("slurpAllLineEndings", true); } function onexitatxheadingsequence(token) { if (getData("headingRank")) return; setData("headingRank", this.sliceSerialize(token).length); lineEndingIfNeeded(); tag("<h" + getData("headingRank") + ">"); } function onentersetextheading() { buffer(); setData("slurpAllLineEndings"); } function onexitsetextheadingtext() { setData("slurpAllLineEndings", true); } function onexitatxheading() { tag("</h" + getData("headingRank") + ">"); setData("headingRank"); } function onexitsetextheadinglinesequence(token) { setData( "headingRank", this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 ); } function onexitsetextheading() { const value = resume(); lineEndingIfNeeded(); tag("<h" + getData("headingRank") + ">"); raw(value); tag("</h" + getData("headingRank") + ">"); setData("slurpAllLineEndings"); setData("headingRank"); } function onexitdata(token) { raw(encode2(this.sliceSerialize(token))); } function onexitlineending(token) { if (getData("slurpAllLineEndings")) { return; } if (getData("slurpOneLineEnding")) { setData("slurpOneLineEnding"); return; } if (getData("inCodeText")) { raw(" "); return; } raw(encode2(this.sliceSerialize(token))); } function onexitcodeflowvalue(token) { raw(encode2(this.sliceSerialize(token))); setData("flowCodeSeenData", true); } function onexithardbreak() { tag("<br />"); } function onenterhtmlflow() { lineEndingIfNeeded(); onenterhtml(); } function onexithtml() { setData("ignoreEncode"); } function onenterhtml() { if (options.allowDangerousHtml) { setData("ignoreEncode", true); } } function onenteremphasis() { tag("<em>"); } function onenterstrong() { tag("<strong>"); } function onentercodetext() { setData("inCodeText", true); tag("<code>"); } function onexitcodetext() { setData("inCodeText"); tag("</code>"); } function onexitemphasis() { tag("</em>"); } function onexitstrong() { tag("</strong>"); } function onexitthematicbreak() { lineEndingIfNeeded(); tag("<hr />"); } function onexitcharacterreferencemarker(token) { setData("characterReferenceType", token.type); } function onexitcharacterreferencevalue(token) { let value = this.sliceSerialize(token); value = getData("characterReferenceType") ? decodeNumericCharacterReference( value, getData("characterReferenceType") === "characterReferenceMarkerNumeric" ? 10 : 16 ) : decodeNamedCharacterReference(value); raw(encode2(value)); setData("characterReferenceType"); } function onexitautolinkprotocol(token) { const uri = this.sliceSerialize(token); tag( '<a href="' + sanitizeUri( uri, options.allowDangerousProtocol ? void 0 : protocolHref ) + '">' ); raw(encode2(uri)); tag("</a>"); } function onexitautolinkemail(token) { const uri = this.sliceSerialize(token); tag('<a href="' + sanitizeUri("mailto:" + uri) + '">'); raw(encode2(uri)); tag("</a>"); } } function factorySpace(effects, ok, type, max) { const limit = max ? max - 1 : Number.POSITIVE_INFINITY; let size = 0; return start; function start(code) { if (markdownSpace(code)) { effects.enter(type); return prefix(code); } return ok(code); } function prefix(code) { if (markdownSpace(code) && size++ < limit) { effects.consume(code); return prefix; } effects.exit(type); return ok(code); } } var content = { tokenize: initializeContent }; function initializeContent(effects) { const contentStart = effects.attempt( this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial ); let previous2; return contentStart; function afterContentStartConstruct(code) { if (code === null) { effects.consume(code); return; } effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return factorySpace(effects, contentStart, "linePrefix"); } function paragraphInitial(code) { effects.enter("paragraph"); return lineStart(code); } function lineStart(code) { const token = effects.enter("chunkText", { contentType: "text", previous: previous2 }); if (previous2) { previous2.next = token; } previous2 = token; return data(code); } 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; } effects.consume(code); return data; } } var document = { tokenize: initializeDocument }; var containerConstruct = { tokenize: tokenizeContainer }; function initializeDocument(effects) { const self = this; const stack = []; let continued = 0; let childFlow; let childToken; let lineStartOffset; return start; function start(code) { if (continued < stack.length) { const item = stack[continued]; self.containerState = item[1]; return effects.attempt( item[0].continuation, documentContinue, checkNewContainers )(code); } return checkNewContainers(code); } function documentContinue(code) { continued++; if (self.containerState._closeFlow) { self.containerState._closeFlow = void 0; if (childFlow) { closeFlow(); } const indexBeforeExits = self.events.length; let indexBeforeFlow = indexBeforeExits; let point; while (indexBeforeFlow--) { if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") { point = self.events[indexBeforeFlow][1].end; break; } } exitContainers(continued); let index = indexBeforeExits; while (index < self.events.length) { self.events[index][1].end = Object.assign({}, point); index++; } splice( self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits) ); self.events.length = index; return checkNewContainers(code); } return start(code); } function checkNewContainers(code) { if (continued === stack.length) { if (!childFlow) { return documentContinued(code); } if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { return flowStart(code); } self.interrupt = Boolean( childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack ); } self.containerState = {}; return effects.check( containerConstruct, thereIsANewContainer, thereIsNoNewContainer )(code); } function thereIsANewContainer(code) { if (childFlow) closeFlow(); exitContainers(continued); return documentContinued(code); } function thereIsNoNewContainer(code) { self.parser.lazy[self.now().line] = continued !== stack.length; lineStartOffset = self.now().offset; return flowStart(code); } function documentContinued(code) { self.containerState = {}; return effects.attempt( containerConstruct, containerContinue, flowStart )(code); } function containerContinue(code) { continued++; stack.push([self.currentConstruct, self.containerState]); return documentContinued(code); } 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); } 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")); continued = 0; self.interrupt = void 0; return start; } effects.consume(code); return flowContinue; } 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); if (self.parser.lazy[token.start.line]) { let index = childFlow.events.length; while (index--) { if (childFlow.events[index][1].start.offset < lineStartOffset && (!childFlow.events[index][1].end || childFlow.events[index][1].end.offset > lineStartOffset)) { return; } } const indexBeforeExits = self.events.length; let indexBeforeFlow = indexBeforeExits; let seen; let point; 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); index = indexBeforeExits; while (index < self.events.length) { self.events[index][1].end = Object.assign({}, point); index++; } splice( self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits) ); self.events.length = index; } } function exitContainers(size) { let index = stack.length; 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 = void 0; childFlow = void 0; self.containerState._closeFlow = void 0; } } function tokenizeContainer(effects, ok, nok) { return factorySpace( effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); } function classifyCharacter(code) { if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { return 1; } if (unicodePunctuation(code)) { return 2; } } function resolveAll(constructs2, events, context) { const called = []; let index = -1; while (++index < constructs2.length) { const resolve = constructs2[index].resolveAll; if (resolve && !called.includes(resolve)) { events = resolve(events, context); called.push(resolve); } } return events; } var attention = { name: "attention", tokenize: tokenizeAttention, resolveAll: resolveAllAttention }; function resolveAllAttention(events, context) { let index = -1; let open; let group; let text3; let openingSequence; let closingSequence; let use; let nextEvents; let offset; while (++index < events.length) { if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) { open = index; while (open--) { if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) { if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) { continue; } use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; const start = 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 }; text3 = { 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 (events[open][1].end.offset - events[open][1].start.offset) { nextEvents = push(nextEvents, [ ["enter", events[open][1], context], ["exit", events[open][1], context] ]); } nextEvents = push(nextEvents, [ ["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text3, context] ]); nextEvents = push( nextEvents, resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) ); nextEvents = push(nextEvents, [ ["exit", text3, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context] ]); if (events[index][1].end.offset - events[index][1].start.offset) { offset = 2; nextEvents = push(nextEvents, [ ["enter", events[index][1], context], ["exit", events[index][1], context] ]); } else { offset = 0; } splice(events, open - 1, index - open + 3, nextEvents); index = open + nextEvents.length - offset - 2; break; } } } } index = -1; while (++index < events.length) { if (events[index][1].type === "attentionSequence") { events[index][1].type = "data"; } } return events; } function tokenizeAttention(effects, ok) { const attentionMarkers2 = this.parser.constructs.attentionMarkers.null; const previous2 = this.previous; const before = classifyCharacter(previous2); let marker; return start; function start(code) { effects.enter("attentionSequence"); marker = code; return sequence(code); } function sequence(code) { if (code === marker) { effects.consume(code); return sequence; } const token = effects.exit("attentionSequence"); const after = classifyCharacter(code); const open = !after || after === 2 && before || attentionMarkers2.includes(code); const close = !before || before === 2 && after || attentionMarkers2.includes(previous2); token._open = Boolean(marker === 42 ? open : open && (before || !close)); token._close = Boolean(marker === 42 ? close : close && (after || !open)); return ok(code); } } function movePoint(point, offset) { point.column += offset; point.offset += offset; point._bufferIndex += offset; } var autolink = { name: "autolink", tokenize: tokenizeAutolink }; function tokenizeAutolink(effects, ok, nok) { let size = 1; return start; function start(code) { effects.enter("autolink"); effects.enter("autolinkMarker"); effects.consume(code); effects.exit("autolinkMarker"); effects.enter("autolinkProtocol"); return open; } function open(code) { if (asciiAlpha(code)) { effects.consume(code); return schemeOrEmailAtext; } return asciiAtext(code) ? emailAtext(code) : nok(code); } function schemeOrEmailAtext(code) { return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) ? schemeInsideOrEmailAtext(code) : emailAtext(code); } function schemeInsideOrEmailAtext(code) { if (code === 58) { effects.consume(code); return urlInside; } if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) { effects.consume(code); return schemeInsideOrEmailAtext; } return emailAtext(code); } function urlInside(code) { if (code === 62) { effects.exit("autolinkProtocol"); return end(code); } if (code === null || code === 32 || code === 60 || asciiControl(code)) { return nok(code); } effects.consume(code); return urlInside; } function emailAtext(code) { if (code === 64) { effects.consume(code); size = 0; return emailAtSignOrDot; } if (asciiAtext(code)) { effects.consume(code); return emailAtext; } return nok(code); } function emailAtSignOrDot(code) { return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); } function emailLabel(code) { if (code === 46) { effects.consume(code); size = 0; return emailAtSignOrDot; } if (code === 62) { effects.exit("autolinkProtocol").type = "autolinkEmail"; return end(code); } return emailValue(code); } function emailValue(code) { if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { effects.consume(code); return code === 45 ? emailValue : emailLabel; } return nok(code); } function end(code) { effects.enter("autolinkMarker"); effects.consume(code); effects.exit("autolinkMarker"); effects.exit("autolink"); return ok; } } var blankLine = { tokenize: tokenizeBlankLine, partial: true }; function tokenizeBlankLine(effects, ok, nok) { return factorySpace(effects, afterWhitespace, "linePrefix"); function afterWhitespace(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code); } } var blockQuote = { name: "blockQuote", tokenize: tokenizeBlockQuoteStart, continuation: { tokenize: tokenizeBlockQuoteContinuation }, exit }; function tokenizeBlockQuoteStart(effects, ok, nok) { const self = this; return start; 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); } 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); } } function tokenizeBlockQuoteContinuation(effects, ok, nok) { return factorySpace( effects, effects.attempt(blockQuote, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); } function exit(effects) { effects.exit("blockQuote"); } var characterEscape = { name: "characterEscape", tokenize: tokenizeCharacterEscape }; function tokenizeCharacterEscape(effects, ok, nok) { return start; function start(code) { effects.enter("characterEscape"); effects.enter("escapeMarker"); effects.consume(code); effects.exit("escapeMarker"); return open; } function open(code) { if (asciiPunctuation(code)) { effects.enter("characterEscapeValue"); effects.consume(code); effects.exit("characterEscapeValue"); effects.exit("characterEscape"); return ok; } return nok(code); } } var characterReference = { name: "characterReference", tokenize: tokenizeCharacterReference }; function tokenizeCharacterReference(effects, ok, nok) { const self = this; let size = 0; let max; let test; return start; function start(code) { effects.enter("characterReference"); effects.enter("characterReferenceMarker"); effects.consume(code); effects.exit("characterReferenceMarker"); return open; } 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); } 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); } function value(code) { let token; if (code === 59 && size) { token = effects.exit("characterReferenceValue"); if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) { return nok(code); } effects.enter("characterReferenceMarker"); effects.consume(code); effects.exit("characterReferenceMarker"); effects.exit("characterReference"); return ok; } if (test(code) && size++ < max) { effects.consume(code); return value; } return nok(code); } } var codeFenced = { name: "codeFenced", tokenize: tokenizeCodeFenced, concrete: true }; function tokenizeCodeFenced(effects, ok, nok) { const self = this; const closingFenceConstruct = { tokenize: tokenizeClosingFence, partial: true }; const nonLazyLine = { tokenize: tokenizeNonLazyLine, partial: true }; const tail = this.events[this.events.length - 1]; const initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; let sizeOpen = 0; let marker; return start; function start(code) { effects.enter("codeFenced"); effects.enter("codeFencedFence"); effects.enter("codeFencedFenceSequence"); marker = code; return sequenceOpen(code); } function sequenceOpen(code) { if (code === marker) { effects.consume(code); sizeOpen++; return sequenceOpen; } effects.exit("codeFencedFenceSequence"); return sizeOpen < 3 ? nok(code) : factorySpace(effects, infoOpen, "whitespace")(code); } function infoOpen(code) { if (code === null || markdownLineEnding(code)) { return openAfter(code); } effects.enter("codeFencedFenceInfo"); effects.enter("chunkString", { contentType: "string" }); return info(code); } function info(code) { if (code === null || markdownLineEndingOrSpace(code)) { effects.exit("chunkString"); effects.exit("codeFencedFenceInfo"); return factorySpace(effects, infoAfter, "whitespace")(code); } if (code === 96 && code === marker) return nok(code); effects.consume(code); return info; } function infoAfter(code) { if (code === null || markdownLineEnding(code)) { return openAfter(code); } effects.enter("codeFencedFenceMeta"); effects.enter("chunkString", { contentType: "string" }); return meta(code); } function meta(code) { if (code === null || markdownLineEnding(code)) { effects.exit("chunkString"); effects.exit("codeFencedFenceMeta"); return openAfter(code); } if (code === 96 && code === marker) return nok(code); effects.consume(code); return meta; } function openAfter(code) { effects.exit("codeFencedFence"); return self.interrupt ? ok(code) : contentStart(code); } function contentStart(code) { if (code === null) { return after(code); } if (markdownLineEnding(code)) { return effects.attempt( nonLazyLine, effects.attempt( closingFenceConstruct, after, initialPrefix ? factorySpace( effects, contentStart, "linePrefix", initialPrefix + 1 ) : contentStart ), after )(code); } effects.enter("codeFlowValue"); return contentContinue(code); } function contentContinue(code) { if (code === null || markdownLineEnding(code)) { effects.exit("codeFlowValue"); return contentStart(code); } effects.consume(code); return contentContinue; } function after(code) { effects.exit("codeFenced"); return ok(code); } function tokenizeNonLazyLine(effects2, ok2, nok2) { const self2 = this; return start2; function start2(code) { effects2.enter("lineEnding"); effects2.consume(code); effects2.exit("lineEnding"); return lineStart; } function lineStart(code) { return self2.parser.lazy[self2.now().line] ? nok2(code) : ok2(code); } } function tokenizeClosingFence(effects2, ok2, nok2) { let size = 0; return factorySpace( effects2, closingSequenceStart, "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); function closingSequenceStart(code) { effects2.enter("codeFencedFence"); effects2.enter("codeFencedFenceSequence"); return closingSequence(code); } function closingSequence(code) { if (code === marker) { effects2.consume(code); size++; return closingSequence; } if (size < sizeOpen) return nok2(code); effects2.exit("codeFencedFenceSequence"); return factorySpace(effects2, closingSequenceEnd, "whitespace")(code); } function closingSequenceEnd(code) { if (code === null || markdownLineEnding(code)) { effects2.exit("codeFencedFence"); return ok2(code); } return nok2(code); } } } var codeIndented = { name: "codeIndented", tokenize: tokenizeCodeIndented }; var indentedContent = { tokenize: tokenizeIndentedContent, partial: true }; function tokenizeCodeIndented(effects, ok, nok) { const self = this; return start; function start(code) { effects.enter("codeIndented"); return factorySpace(effects, afterStartPrefix, "linePrefix", 4 + 1)(code); } function afterStartPrefix(code) { const tail = self.events[self.events.length - 1]; return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? afterPrefix(code) : nok(code); } function afterPrefix(code) { if (code === null) { return after(code); } if (markdownLineEnding(code)) { return effects.attempt(indentedContent, afterPrefix, after)(code); } effects.enter("codeFlowValue"); return content3(code); } function content3(code) { if (code === null || markdownLineEnding(code)) { effects.exit("codeFlowValue"); return afterPrefix(code); } effects.consume(code); return content3; } function after(code) { effects.exit("codeIndented"); return ok(code); } } function tokenizeIndentedContent(effects, ok, nok) { const self = this; return start; function start(code) { if (self.parser.lazy[self.now().line]) { return nok(code); } if (markdownLineEnding(code)) { effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return start; } return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); } function afterPrefix(code) { const tail = self.events[self.events.length - 1]; return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? start(code) : nok(code); } } var codeText = { name: "codeText", tokenize: tokenizeCodeText, resolve: resolveCodeText, previous }; function resolveCodeText(events) { let tailExitIndex = events.length - 4; let headEnterIndex = 3; let index; let enter; if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) { index = headEnterIndex; while (++index < tailExitIndex) { if (events[index][1].type === "codeTextData") { events[headEnterIndex][1].type = "codeTextPadding"; events[tailExitIndex][1].type = "codeTextPadding"; headEnterIndex += 2; tailExitIndex -= 2; break; } } } index = headEnterIndex - 1; tailExitIndex++; while (++index <= tailExitIndex) { if (enter === void 0) { 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 = void 0; } } return events; } function previous(code) { return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; } function tokenizeCodeText(effects, ok, nok) { const self = this; let sizeOpen = 0; let size; let token; return start; function start(code) { effects.enter("codeText"); effects.enter("codeTextSequence"); return openingSequence(code); } function openingSequence(code) { if (code === 96) { effects.consume(code); sizeOpen++; return openingSequence; } effects.exit("codeTextSequence"); return gap(code); } function gap(code) { if (code === null) { return nok(code); } if (code === 96) { token = effects.enter("codeTextSequence"); size = 0; return closingSequence(code); } if (code === 32) { effects.enter("space"); effects.consume(code); effects.exit("space"); return gap; } if (markdownLineEnding(code)) { effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return gap; } effects.enter("codeTextData"); return data(code); } function data(code) { if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) { effects.exit("codeTextData"); return gap(code); } effects.consume(code); return data; } function closingSequence(code) { if (code === 96) { effects.consume(code); size++; return closingSequence; } if (size === sizeOpen) { effects.exit("codeTextSequence"); effects.exit("codeText"); return ok(code); } token.type = "codeTextData"; return data(code); } } function subtokenize(events) { const jumps = {}; let index = -1; let event; let lineIndex; let otherIndex; let otherEvent; let parameters; let subevents; let more; while (++index < events.length) { while (index in jumps) { index = jumps[index]; } event = events[index]; 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++; } } } } if (event[0] === "enter") { if (event[1].contentType) { Object.assign(jumps, subcontent(events, index)); index = jumps[index]; more = true; } } else if (event[1]._container) { otherIndex = index; lineIndex = void 0; while (otherIndex--) { otherEvent = events[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) { event[1].end = Object.assign({}, events[lineIndex][1].start); parameters = events.slice(lineIndex, index); parameters.unshift(event); splice(events, lineIndex, index - lineIndex + 1, parameters); } } } return !more; } function subcontent(events, eventIndex) { const token = events[eventIndex][1]; const context = events[eventIndex][2]; let startPosition = eventIndex - 1; const startPositions = []; const tokenizer = token._tokenizer || context.parser[token.contentType](token.start); const childEvents = tokenizer.events; const jumps = []; const gaps = {}; let stream; let previous2; let index = -1; let current = token; let adjust = 0; let start = 0; const breaks = [start]; while (current) { while (events[++startPosition][1] !== current) { } startPositions.push(startPosition); if (!current._tokenizer) { stream = context.sliceStream(current); if (!current.next) { stream.push(null); } if (previous2) { tokenizer.defineSkip(current.start); } if (current._isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = true; } tokenizer.write(stream); if (current._isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = void 0; } } previous2 = current; current = current.next; } current = token; while (++index < childEvents.length) { if (childEvents[index][0] === "exit" && childEvents[index - 1][0] === "enter" && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) { start = index + 1; breaks.push(start); current._tokenizer = void 0; current.previous = void 0; current = current.next; } } tokenizer.events = []; if (current) { current._tokenizer = void 0; current.previous = void 0; } else { breaks.pop(); } index = breaks.length; while (index--) { const slice = childEvents.slice(breaks[index], breaks[index + 1]); const start2 = startPositions.pop(); jumps.unshift([start2, start2 + slice.length - 1]); splice(events, start2, 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; } var content2 = { tokenize: tokenizeContent, resolve: resolveContent }; var continuationConstruct = { tokenize: tokenizeContinuation, partial: true }; function resolveContent(events) { subtokenize(events); return events; } function tokenizeContent(effects, ok) { let previous2; return start; function start(code) { effects.enter("content"); previous2 = effects.enter("chunkContent", { contentType: "content" }); return data(code); } function data(code) { if (code === null) { return contentEnd(code); } if (markdownLineEnding(code)) { return effects.check( continuationConstruct, contentContinue, contentEnd )(code); } effects.consume(code); return data; } function contentEnd(code) { effects.exit("chunkContent"); effects.exit("content"); return ok(code); } function contentContinue(code) { effects.consume(code); effects.exit("chunkContent"); previous2.next = effects.enter("chunkContent", { contentType: "content", previous: previous2 }); previous2 = previous2.next; return data; } } function tokenizeContinuation(effects, ok, nok) { const self = this; return startLookahead; function startLookahead(code) { effects.exit("chunkContent"); effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return factorySpace(effects, prefixed, "linePrefix"); } function prefixed(code) { if (code === null || markdownLineEnding(code)) { return nok(code); } const tail = self.events[self.events.length - 1]; if (!self.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { return ok(code); } return effects.interrupt(self.parser.constructs.flow, nok, ok)(code); } } function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) { const limit = max || Number.POSITIVE_INFINITY; let balance = 0; return start; function start(code) { if (code === 60) { effects.enter(type); effects.enter(literalType); effects.enter(literalMarkerType); effects.consume(code); effects.exit(literalMarkerType); return destinationEnclosedBefore; } if (code === null || code === 41 || asciiControl(code)) { return nok(code); } effects.enter(type); effects.enter(rawType); effects.enter(stringType); effects.enter("chunkString", { contentType: "string" }); return destinationRaw(code); } function destinationEnclosedBefore(code) { if (code === 62) { effects.enter(literalMarkerType); effects.consume(code); effects.exit(literalMarkerType); effects.exit(literalType); effects.exit(type); return ok; } effects.enter(stringType); effects.enter("chunkString", { contentType: "string" }); return destinationEnclosed(code); } function destinationEnclosed(code) { if (code === 62) { effects.exit("chunkString"); effects.exit(stringType); return destinationEnclosedBefore(code); } if (code === null || code === 60 || markdownLineEnding(code)) { return nok(code); } effects.consume(code); return code === 92 ? destinationEnclosedEscape : destinationEnclosed; } function destinationEnclosedEscape(code) { if (code === 60 || code === 62 || code === 92) { effects.consume(code); return destinationEnclosed; } return destinationEnclosed(code); } function destinationRaw(code) { if (code === 40) { if (++balance > limit) return nok(code); effects.consume(code); return destinationRaw; } if (code === 41) { if (!balance--) { effects.exit("chunkString"); effects.exit(stringType); effects.exit(rawType); effects.exit(type); return ok(code); } effects.consume(code); return destinationRaw; } if (code === null || markdownLineEndingOrSpace(code)) { if (balance) return nok(code); effects.exit("chunkString"); effects.exit(stringType); effects.exit(rawType); effects.exit(type); return ok(code); } if (asciiControl(code)) return nok(code); effects.consume(code); return code === 92 ? destinationRawEscape : destinationRaw; } function destinationRawEscape(code) { if (code === 40 || code === 41 || code === 92) { effects.consume(code); return destinationRaw; } return destinationRaw(code); } } function factoryLabel(effects, ok, nok, type, markerType, stringType) { const self = this; let size = 0; let data; return start; function start(code) { effects.enter(type); effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.enter(stringType); return atBreak; } function atBreak(code) { if (code === null || code === 91 || code === 93 && !data || code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs || size > 999) { return nok(code); } if (code === 93) { effects.exit(stringType); effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.exit(type); return ok; } if (markdownLineEnding(code)) { effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return atBreak; } effects.enter("chunkString", { contentType: "string" }); return label(code); } function label(code) { if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) { effects.exit("chunkString"); return atBreak(code); } effects.consume(code); data = data || !markdownSpace(code); return code === 92 ? labelEscape : label; } function labelEscape(code) { if (code === 91 || code === 92 || code === 93) { effects.consume(code); size++; return label; } return label(code); } } function factoryTitle(effects, ok, nok, type, markerType, stringType) { let marker; return start; function start(code) { effects.enter(type); effects.enter(markerType); effects.consume(code); effects.exit(markerType); marker = code === 40 ? 41 : code; return atFirstTitleBreak; } function atFirstTitleBreak(code) { if (code === marker) { effects.enter(markerType); effects.consume(code); effects.exit(markerType); effects.exit(type); return ok; } effects.enter(stringType); return atTitleBreak(code); } function atTitleBreak(code) { if (code === marker) { effects.exit(stringType); return atFirstTitleBreak(marker); } if (code === null) { return nok(code); } if (markdownLineEnding(code)) { effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return factorySpace(effects, atTitleBreak, "linePrefix"); } effects.enter("chunkString", { contentType: "string" }); return title(code); } function title(code) { if (code === marker || code === null || markdownLineEnding(code)) { effects.exit("chunkString"); return atTitleBreak(code); } effects.consume(code); return code === 92 ? titleEscape : title; } function titleEscape(code) { if (code === marker || code === 92) { effects.consume(code); return title; } return title(code); } } function factoryWhitespace(effects, ok) { let seen; return start; 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); } } var definition = { name: "definition", tokenize: tokenizeDefinition }; var titleConstruct = { tokenize: tokenizeTitle, partial: true }; function tokenizeDefinition(effects, ok, nok) { const self = this; let identifier; return start; function start(code) { effects.enter("definition"); return factoryLabel.call( self, effects, labelAfter, nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString" )(code); } 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 factoryWhitespace( effects, factoryDestination( effects, effects.attempt( titleConstruct, factorySpace(effects, after, "whitespace"), factorySpace(effects, after, "whitespace") ), nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString" ) ); } return nok(code); } function after(code) { if (code === null || markdownLineEnding(code)) { effects.exit("definition"); if (!self.parser.defined.includes(identifier)) { self.parser.defined.push(identifier); } return ok(code); } return nok(code); } } function tokenizeTitle(effects, ok, nok) { return start; function start(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, before)(code) : nok(code); } function before(code) { if (code === 34 || code === 39 || code === 40) { return factoryTitle( effects, factorySpace(effects, after, "whitespace"), nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString" )(code); } return nok(code); } function after(code) { return code === null || markdownLineEnding(code) ? ok(code) : nok(code); } } var hardBreakEscape = { name: "hardBreakEscape", tokenize: tokenizeHardBreakEscape }; function tokenizeHardBreakEscape(effects, ok, nok) { return start; function start(code) { effects.enter("hardBreakEscape"); effects.enter("escapeMarker"); effects.consume(code); return open; } function open(code) { if (markdownLineEnding(code)) { effects.exit("escapeMarker"); effects.exit("hardBreakEscape"); return ok(code); } return nok(code); } } var headingAtx = { name: "headingAtx", tokenize: tokenizeHeadingAtx, resolve: resolveHeadingAtx }; function resolveHeadingAtx(events, context) { let contentEnd = events.length - 2; let contentStart = 3; let content3; let text3; if (events[contentStart][1].type === "whitespace") { contentStart += 2; } 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) { content3 = { type: "atxHeadingText", start: events[contentStart][1].start, end: events[contentEnd][1].end }; text3 = { type: "chunkText", start: events[contentStart][1].start, end: events[contentEnd][1].end, contentType: "text" }; splice(events, contentStart, contentEnd - contentStart + 1, [ ["enter", content3, context], ["enter", text3, context], ["exit", text3, context], ["exit", content3, context] ]); } return events; } function tokenizeHeadingAtx(effects, ok, nok) { const self = this; let size = 0; return start; function start(code) { effects.enter("atxHeading"); effects.enter("atxHeadingSequence"); return fenceOpenInside(code); } function fenceOpenInside(code) { if (code === 35 && size++ < 6) { effects.consume(code); return fenceOpenInside; } if (code === null || markdownLineEndingOrSpace(code)) { effects.exit("atxHeadingSequence"); return self.interrupt ? ok(code) : headingBreak(code); } return nok(code); } function headingBreak(code) { if (code === 35) { effects.enter("atxHeadingSequence"); return sequence(code); } if (code === null || markdownLineEnding(code)) { effects.exit("atxHeading"); return ok(code); } if (markdownSpace(code)) { return factorySpace(effects, headingBreak, "whitespace")(code); } effects.enter("atxHeadingText"); return data(code); } function sequence(code) { if (code === 35) { effects.consume(code); return sequence; } effects.exit("atxHeadingSequence"); return headingBreak(code); } function data(code) { if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { effects.exit("atxHeadingText"); return headingBreak(code); } effects.consume(code); return data; } } var htmlBlockNames = [ "address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul" ]; var htmlRawNames = ["pre", "script", "style", "textarea"]; var htmlFlow = { name: "htmlFlow", tokenize: tokenizeHtmlFlow, resolveTo: resolveToHtmlFlow, concrete: true }; var nextBlankConstruct = { tokenize: tokenizeNextBlank, partial: true }; 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") { events[index][1].start = events[index - 2][1].start; events[index + 1][1].start = events[index - 2][1].start; events.splice(index - 2, 2); } return events; } function tokenizeHtmlFlow(effects, ok, nok) { const self = this; let kind; let startTag; let buffer; let index; let marker; return start; function start(code) { effects.enter("htmlFlow"); effects.enter("htmlFlowData"); effects.consume(code); return open; } function open(code) { if (code === 33) { effects.consume(code); return declarationStart; } if (code === 47) { effects.consume(code); return tagCloseStart; } if (code === 63) { effects.consume(code); kind = 3; return self.interrupt ? ok : continuationDeclarationInside; } if (asciiAlpha(code)) { effects.consume(code); buffer = String.fromCharCode(code); startTag = true; return tagName; } return nok(code); } function declarationStart(code) { if (code === 45) { effects.consume(code); kind = 2; return commentOpenInside; } if (code === 91) { effects.consume(code); kind = 5; buffer = "CDATA["; index = 0; return cdataOpenInside; } if (asciiAlpha(code)) { effects.consume(code); kind = 4; return self.interrupt ? ok : continuationDeclarationInside; } return nok(code); } function commentOpenInside(code) { if (code === 45) { effects.consume(code); return self.interrupt ? ok : continuationDeclarationInside; } return nok(code); } function cdataOpenInside(code) { if (code === buffer.charCodeAt(index++)) { effects.consume(code); return index === buffer.length ? self.interrupt ? ok : continuation : cdataOpenInside; } return nok(code); } function tagCloseStart(code) { if (asciiAlpha(code)) { effects.consume(code); buffer = String.fromCharCode(code); return tagName; } return nok(code); } function tagName(code) { if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { if (code !== 47 && startTag && htmlRawNames.includes(buffer.toLowerCase())) { kind = 1; return self.interrupt ? ok(code) : continuation(code); } if (htmlBlockNames.includes(buffer.toLowerCase())) { kind = 6; if (code === 47) { effects.consume(code); return basicSelfClosing; } return self.interrupt ? ok(code) : continuation(code); } kind = 7; return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : startTag ? completeAttributeNameBefore(code) : completeClosingTagAfter(code); } if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); buffer += String.fromCharCode(code); return tagName; } return nok(code); } function basicSelfClosing(code) { if (code === 62) { effects.consume(code); return self.interrupt ? ok : continuation; } return nok(code); } function completeClosingTagAfter(code) { if (markdownSpace(code)) { effects.consume(code); return completeClosingTagAfter; } return completeEnd(code); } function completeAttributeNameBefore(code) { if (code === 47) { effects.consume(code); return completeEnd; } if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code); return completeAttributeName; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameBefore; } return completeEnd(code); } function completeAttributeName(code) { if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { effects.consume(code); return completeAttributeName; } return completeAttributeNameAfter(code); } function completeAttributeNameAfter(code) { if (code === 61) { effects.consume(code); return completeAttributeValueBefore; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameAfter; } return completeAttributeNameBefore(code); } function completeAttributeValueBefore(code) { if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { return nok(code); } if (code === 34 || code === 39) { effects.consume(code); marker = code; return completeAttributeValueQuoted; } if (markdownSpace(code)) { effects.consume(code); return completeAttributeValueBefore; } marker = null; return completeAttributeValueUnquoted(code); } function completeAttributeValueQuoted(code) { if (code === null || markdownLineEnding(code)) { return nok(code); } if (code === marker) { effects.consume(code); return completeAttributeValueQuotedAfter; } effects.consume(code); return completeAttributeValueQuoted; } function completeAttributeValueUnquoted(code) { if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) { return completeAttributeNameAfter(code); } effects.consume(code); return completeAttributeValueUnquoted; } function completeAttributeValueQuotedAfter(code) { if (code === 47 || code === 62 || markdownSpace(code)) { return completeAttributeNameBefore(code); } return nok(code); } function completeEnd(code) { if (code === 62) { effects.consume(code); return completeAfter; } return nok(code); } function completeAfter(code) { if (markdownSpace(code)) { effects.consume(code); return completeAfter; } return code === null || markdownLineEnding(code) ? continuation(code) : nok(code); } function continuation(code) { if (code === 45 && kind === 2) { effects.consume(code); return continuationCommentInside; } if (code === 60 && kind === 1) { effects.consume(code); return continuationRawTagOpen; } if (code === 62 && kind === 4) { effects.consume(code); return continuationClose; } if (code === 63 && kind === 3) { effects.consume(code); return continuationDeclarationInside; } if (code === 93 && kind === 5) { effects.consume(code); return continuationCharacterDataInside; } if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { return effects.check( nextBlankConstruct, continuationClose, continuationAtLineEnding )(code); } if (code === null || markdownLineEnding(code)) { return continuationAtLineEnding(code); } effects.consume(code); return continuation; } function continuationAtLineEnding(code) { effects.exit("htmlFlowData"); return htmlContinueStart(code); } function htmlContinueStart(code) { if (code === null) { return done(code); } if (markdownLineEnding(code)) { return effects.attempt( { tokenize: htmlLineEnd, partial: true }, htmlContinueStart, done )(code); } effects.enter("htmlFlowData"); return continuation(code); } function htmlLineEnd(effects2, ok2, nok2) { return start2; function start2(code) { effects2.enter("lineEnding"); effects2.consume(code); effects2.exit("lineEnding"); return lineStart; } function lineStart(code) { return self.parser.lazy[self.now().line] ? nok2(code) : ok2(code); } } function continuationCommentInside(code) { if (code === 45) { effects.consume(code); return continuationDeclarationInside; } return continuation(code); } function continuationRawTagOpen(code) { if (code === 47) { effects.consume(code); buffer = ""; return continuationRawEndTag; } return continuation(code); } function continuationRawEndTag(code) { if (code === 62 && htmlRawNames.includes(buffer.toLowerCase())) { effects.consume(code); return continuationClose; } if (asciiAlpha(code) && buffer.length < 8) { effects.consume(code); buffer += String.fromCharCode(code); return continuationRawEndTag; } return continuation(code); } function continuationCharacterDataInside(code) { if (code === 93) { effects.consume(code); return continuationDeclarationInside; } return continuation(code); } function continuationDeclarationInside(code) { if (code === 62) { effects.consume(code); return continuationClose; } if (code === 45 && kind === 2) { effects.consume(code); return continuationDeclarationInside; } return continuation(code); } function continuationClose(code) { if (code === null || markdownLineEnding(code)) { effects.exit("htmlFlowData"); return done(code); } effects.consume(code); return continuationClose; } function done(code) { effects.exit("htmlFlow"); return ok(code); } } function tokenizeNextBlank(effects, ok, nok) { return start; function start(code) { effects.exit("htmlFlowData"); effects.enter("lineEndingBlank"); effects.consume(code); effects.exit("lineEndingBlank"); return effects.attempt(blankLine, ok, nok); } } var htmlText = { name: "htmlText", tokenize: tokenizeHtmlText }; function tokenizeHtmlText(effects, ok, nok) { const self = this; let marker; let buffer; let index; let returnState; return start; function start(code) { effects.enter("htmlText"); effects.enter("htmlTextData"); effects.consume(code); return open; } function open(code) { if (code === 33) { effects.consume(code); return declarationOpen; } if (code === 47) { effects.consume(code); return tagCloseStart; } if (code === 63) { effects.consume(code); return instruction; } if (asciiAlpha(code)) { effects.consume(code); return tagOpen; } return nok(code); } function declarationOpen(code) { if (code === 45) { effects.consume(code); return commentOpen; } if (code === 91) { effects.consume(code); buffer = "CDATA["; index = 0; return cdataOpen; } if (asciiAlpha(code)) { effects.consume(code); return declaration; } return nok(code); } function commentOpen(code) { if (code === 45) { effects.consume(code); return commentStart; } return nok(code); } function commentStart(code) { if (code === null || code === 62) { return nok(code); } if (code === 45) { effects.consume(code); return commentStartDash; } return comment(code); } function commentStartDash(code) { if (code === null || code === 62) { return nok(code); } return comment(code); } function comment(code) { if (code === null) { return nok(code); } if (code === 45) { effects.consume(code); return commentClose; } if (markdownLineEnding(code)) { returnState = comment; return atLineEnding(code); } effects.consume(code); return comment; } function commentClose(code) { if (code === 45) { effects.consume(code); return end; } return comment(code); } function cdataOpen(code) { if (code === buffer.charCodeAt(index++)) { effects.consume(code); return index === buffer.length ? cdata : cdataOpen; } return nok(code); } function cdata(code) { if (code === null) { return nok(code); } if (code === 93) { effects.consume(code); return cdataClose; } if (markdownLineEnding(code)) { returnState = cdata; return atLineEnding(code); } effects.consume(code); return cdata; } function cdataClose(code) { if (code === 93) { effects.consume(code); return cdataEnd; } return cdata(code); } function cdataEnd(code) { if (code === 62) { return end(code); } if (code === 93) { effects.consume(code); return cdataEnd; } return cdata(code); } function declaration(code) { if (code === null || code === 62) { return end(code); } if (markdownLineEnding(code)) { returnState = declaration; return atLineEnding(code); } effects.consume(code); return declaration; } function instruction(code) { if (code === null) { return nok(code); } if (code === 63) { effects.consume(code); return instructionClose; } if (markdownLineEnding(code)) { returnState = instruction; return atLineEnding(code); } effects.consume(code); return instruction; } function instructionClose(code) { return code === 62 ? end(code) : instruction(code); } function tagCloseStart(code) { if (asciiAlpha(code)) { effects.consume(code); return tagClose; } return nok(code); } function tagClose(code) { if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); return tagClose; } return tagCloseBetween(code); } function tagCloseBetween(code) { if (markdownLineEnding(code)) { returnState = tagCloseBetween; return atLineEnding(code); } if (markdownSpace(code)) { effects.consume(code); return tagCloseBetween; } return end(code); } function tagOpen(code) { if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); return tagOpen; } if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code); } return nok(code); } function tagOpenBetween(code) { if (code === 47) { effects.consume(code); return end; } if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code); return tagOpenAttributeName; } if (markdownLineEnding(code)) { returnState = tagOpenBetween; return atLineEnding(code); } if (markdownSpace(code)) { effects.consume(code); return tagOpenBetween; } return end(code); } function tagOpenAttributeName(code) { if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { effects.consume(code); return tagOpenAttributeName; } return tagOpenAttributeNameAfter(code); } function tagOpenAttributeNameAfter(code) { if (code === 61) { effects.consume(code); return tagOpenAttributeValueBefore; } if (markdownLineEnding(code)) { returnState = tagOpenAttributeNameAfter; return atLineEnding(code); } if (markdownSpace(code)) { effects.consume(code); return tagOpenAttributeNameAfter; } return tagOpenBetween(code); } function tagOpenAttributeValueBefore(code) { if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { return nok(code); } if (code === 34 || code === 39) { effects.consume(code); marker = code; return tagOpenAttributeValueQuoted; } if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueBefore; return atLineEnding(code); } if (markdownSpace(code)) { effects.consume(code); return tagOpenAttributeValueBefore; } effects.consume(code); marker = void 0; return tagOpenAttributeValueUnquoted; } function tagOpenAttributeValueQuoted(code) { if (code === marker) { effects.consume(code); return tagOpenAttributeValueQuotedAfter; } if (code === null) { return nok(code); } if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueQuoted; return atLineEnding(code); } effects.consume(code); return tagOpenAttributeValueQuoted; } function tagOpenAttributeValueQuotedAfter(code) { if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code); } return nok(code); } function tagOpenAttributeValueUnquoted(code) { if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) { return nok(code); } if (code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code); } effects.consume(code); return tagOpenAttributeValueUnquoted; } function atLineEnding(code) { effects.exit("htmlTextData"); effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return factorySpace( effects, afterPrefix, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); } function afterPrefix(code) { effects.enter("htmlTextData"); return returnState(code); } function end(code) { if (code === 62) { effects.consume(code); effects.exit("htmlTextData"); effects.exit("htmlText"); return ok; } return nok(code); } } var labelEnd = { name: "labelEnd", tokenize: tokenizeLabelEnd, resolveTo: resolveToLabelEnd, resolveAll: resolveAllLabelEnd }; var resourceConstruct = { tokenize: tokenizeResource }; var fullReferenceConstruct = { tokenize: tokenizeFullReference }; var collapsedReferenceConstruct = { tokenize: tokenizeCollapsedReference }; function resolveAllLabelEnd(events) { let index = -1; let token; while (++index < events.length) { token = events[index][1]; if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { events.splice(index + 1, token.type === "labelImage" ? 4 : 2); token.type = "data"; index++; } } return events; } function resolveToLabelEnd(events, context) { let index = events.length; let offset = 0; let token; let open; let close; let media; while (index--) { token = events[index][1]; if (open) { if (token.type === "link" || token.type === "labelLink" && token._inactive) { break; } 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 text3 = { 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] ]; media = push(media, events.slice(open + 1, open + offset + 3)); media = push(media, [["enter", text3, context]]); media = push( media, resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context ) ); media = push(media, [ ["exit", text3, context], events[close - 2], events[close - 1], ["exit", label, context] ]); media = push(media, events.slice(close + 1)); media = push(media, [["exit", group, context]]); splice(events, open, events.length, media); return events; } function tokenizeLabelEnd(effects, ok, nok) { const self = this; let index = self.events.length; let labelStart; let defined; 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; function start(code) { if (!labelStart) { return nok(code); } if (labelStart._inactive) return balanced(code); defined = self.parser.defined.includes( normalizeIdentifier( self.sliceSerialize({ start: labelStart.end, end: self.now() }) ) ); effects.enter("labelEnd"); effects.enter("labelMarker"); effects.consume(code); effects.exit("labelMarker"); effects.exit("labelEnd"); return afterLabelEnd; } function afterLabelEnd(code) { if (code === 40) { return effects.attempt( resourceConstruct, ok, defined ? ok : balanced )(code); } if (code === 91) { return effects.attempt( fullReferenceConstruct, ok, defined ? effects.attempt(collapsedReferenceConstruct, ok, balanced) : balanced )(code); } return defined ? ok(code) : balanced(code); } function balanced(code) { labelStart._balanced = true; return nok(code); } } function tokenizeResource(effects, ok, nok) { return start; function start(code) { effects.enter("resource"); effects.enter("resourceMarker"); effects.consume(code); effects.exit("resourceMarker"); return factoryWhitespace(effects, open); } function open(code) { if (code === 41) { return end(code); } return factoryDestination( effects, destinationAfter, nok, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32 )(code); } function destinationAfter(code) { return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, between)(code) : end(code); } function between(code) { if (code === 34 || code === 39 || code === 40) { return factoryTitle( effects, factoryWhitespace(effects, end), nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString" )(code); } return end(code); } function end(code) { if (code === 41) { effects.enter("resourceMarker"); effects.consume(code); effects.exit("resourceMarker"); effects.exit("resource"); return ok; } return nok(code); } } function tokenizeFullReference(effects, ok, nok) { const self = this; return start; function start(code) { return factoryLabel.call( self, effects, afterLabel, nok, "reference", "referenceMarker", "referenceString" )(code); } function afterLabel(code) { return self.parser.defined.includes( normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) ) ? ok(code) : nok(code); } } function tokenizeCollapsedReference(effects, ok, nok) { return start; function start(code) { effects.enter("reference"); effects.enter("referenceMarker"); effects.consume(code); effects.exit("referenceMarker"); return open; } function open(code) { if (code === 93) { effects.enter("referenceMarker"); effects.consume(code); effects.exit("referenceMarker"); effects.exit("reference"); return ok; } return nok(code); } } var labelStartImage = { name: "labelStartImage", tokenize: tokenizeLabelStartImage, resolveAll: labelEnd.resolveAll }; function tokenizeLabelStartImage(effects, ok, nok) { const self = this; return start; function start(code) { effects.enter("labelImage"); effects.enter("labelImageMarker"); effects.consume(code); effects.exit("labelImageMarker"); return open; } function open(code) { if (code === 91) { effects.enter("labelMarker"); effects.consume(code); effects.exit("labelMarker"); effects.exit("labelImage"); return after; } return nok(code); } function after(code) { return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code); } } var labelStartLink = { name: "labelStartLink", tokenize: tokenizeLabelStartLink, resolveAll: labelEnd.resolveAll }; function tokenizeLabelStartLink(effects, ok, nok) { const self = this; return start; function start(code) { effects.enter("labelLink"); effects.enter("labelMarker"); effects.consume(code); effects.exit("labelMarker"); effects.exit("labelLink"); return after; } function after(code) { return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code); } } var lineEnding = { name: "lineEnding", tokenize: tokenizeLineEnding }; function tokenizeLineEnding(effects, ok) { return start; function start(code) { effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); return factorySpace(effects, ok, "linePrefix"); } } var thematicBreak = { name: "thematicBreak", tokenize: tokenizeThematicBreak }; function tokenizeThematicBreak(effects, ok, nok) { let size = 0; let marker; return start; function start(code) { effects.enter("thematicBreak"); marker = code; return atBreak(code); } function atBreak(code) { if (code === marker) { effects.enter("thematicBreakSequence"); return sequence(code); } if (markdownSpace(code)) { return factorySpace(effects, atBreak, "whitespace")(code); } if (size < 3 || code !== null && !markdownLineEnding(code)) { return nok(code); } effects.exit("thematicBreak"); return ok(code); } function sequence(code) { if (code === marker) { effects.consume(code); size++; return sequence; } effects.exit("thematicBreakSequence"); return atBreak(code); } } var list = { name: "list", tokenize: tokenizeListStart, continuation: { tokenize: tokenizeListContinuation }, exit: tokenizeListEnd }; var listItemPrefixWhitespaceConstruct = { tokenize: tokenizeListItemPrefixWhitespace, partial: true }; var indentConstruct = { tokenize: tokenizeIndent, partial: true }; 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; 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); } 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); } function atMarker(code) { effects.enter("listItemMarker"); effects.consume(code); effects.exit("listItemMarker"); self.containerState.marker = self.containerState.marker || code; return effects.check( blankLine, self.interrupt ? nok : onBlank, effects.attempt( listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix ) ); } function onBlank(code) { self.containerState.initialBlankLine = true; initialSize++; return endOfPrefix(code); } function otherPrefix(code) { if (markdownSpace(code)) { effects.enter("listItemPrefixWhitespace"); effects.consume(code); effects.exit("listItemPrefixWhitespace"); return endOfPrefix; } return nok(code); } function endOfPrefix(code) { self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length; return ok(code); } } function tokenizeListContinuation(effects, ok, nok) { const self = this; self.containerState._closeFlow = void 0; return effects.check(blankLine, onBlank, notBlank); function onBlank(code) { self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; return factorySpace( effects, ok, "listItemIndent", self.containerState.size + 1 )(code); } function notBlank(code) { if (self.containerState.furtherBlankLines || !markdownSpace(code)) { self.containerState.furtherBlankLines = void 0; self.containerState.initialBlankLine = void 0; return notInCurrentItem(code); } self.containerState.furtherBlankLines = void 0; self.containerState.initialBlankLine = void 0; return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); } function notInCurrentItem(code) { self.containerState._closeFlow = true; self.interrupt = void 0; return factorySpace( effects, effects.attempt(list, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 )(code); } } function tokenizeIndent(effects, ok, nok) { const self = this; return factorySpace( effects, afterPrefix, "listItemIndent", self.containerState.size + 1 ); 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); } } function tokenizeListEnd(effects) { effects.exit(this.containerState.type); } function tokenizeListItemPrefixWhitespace(effects, ok, nok) { const self = this; return factorySpace( effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1 ); function afterPrefix(code) { const tail = self.events[self.events.length - 1]; return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code); } } var setextUnderline = { name: "setextUnderline", tokenize: tokenizeSetextUnderline, resolveTo: resolveToSetextUnderline }; function resolveToSetextUnderline(events, context) { let index = events.length; let content3; let text3; let definition2; while (index--) { if (events[index][0] === "enter") { if (events[index][1].type === "content") { content3 = index; break; } if (events[index][1].type === "paragraph") { text3 = index; } } else { if (events[index][1].type === "content") { events.splice(index, 1); } if (!definition2 && events[index][1].type === "definition") { definition2 = index; } } } const heading = { type: "setextHeading", start: Object.assign({}, events[text3][1].start), end: Object.assign({}, events[events.length - 1][1].end) }; events[text3][1].type = "setextHeadingText"; if (definition2) { events.splice(text3, 0, ["enter", heading, context]); events.splice(definition2 + 1, 0, ["exit", events[content3][1], context]); events[content3][1].end = Object.assign({}, events[definition2][1].end); } else { events[content3][1] = heading; } events.push(["exit", heading, context]); return events; } function tokenizeSetextUnderline(effects, ok, nok) { const self = this; let index = self.events.length; let marker; let paragraph; while (index--) { if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") { paragraph = self.events[index][1].type === "paragraph"; break; } } return start; function start(code) { if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { effects.enter("setextHeadingLine"); effects.enter("setextHeadingLineSequence"); marker = code; return closingSequence(code); } return nok(code); } function closingSequence(code) { if (code === marker) { effects.consume(code); return closingSequence; } effects.exit("setextHeadingLineSequence"); return factorySpace(effects, closingSequenceEnd, "lineSuffix")(code); } function closingSequenceEnd(code) { if (code === null || markdownLineEnding(code)) { effects.exit("setextHeadingLine"); return ok(code); } return nok(code); } } var flow = { tokenize: initializeFlow }; function initializeFlow(effects) { const self = this; const initial = effects.attempt( blankLine, atBlankEnding, effects.attempt( this.parser.constructs.flowInitial, afterConstruct, factorySpace( effects, effects.attempt( this.parser.constructs.flow, afterConstruct, effects.attempt(content2, afterConstruct) ), "linePrefix" ) ) ); return initial; function atBlankEnding(code) { if (code === null) { effects.consume(code); return; } effects.enter("lineEndingBlank"); effects.consume(code); effects.exit("lineEndingBlank"); self.currentConstruct = void 0; return initial; } function afterConstruct(code) { if (code === null) { effects.consume(code); return; } effects.enter("lineEnding"); effects.consume(code); effects.exit("lineEnding"); self.currentConstruct = void 0; return initial; } } var resolver = { resolveAll: createResolver() }; var string = initializeFactory("string"); var text = initializeFactory("text"); function initializeFactory(field) { return { tokenize: initializeText, resolveAll: createResolver( field === "text" ? resolveAllLineSuffixes : void 0 ) }; function initializeText(effects) { const self = this; const constructs2 = this.parser.constructs[field]; const text3 = effects.attempt(constructs2, start, notText); return start; function start(code) { return atBreak(code) ? text3(code) : notText(code); } function notText(code) { if (code === null) { effects.consume(code); return; } effects.enter("data"); effects.consume(code); return data; } function data(code) { if (atBreak(code)) { effects.exit("data"); return text3(code); } effects.consume(code); return data; } function atBreak(code) { if (code === null) { return true; } const list2 = constructs2[code]; let index = -1; if (list2) { while (++index < list2.length) { const item = list2[index]; if (!item.previous || item.previous.call(self, self.previous)) { return true; } } } return false; } } } function createResolver(extraResolver) { return resolveAllText; function resolveAllText(events, context) { let index = -1; let enter; while (++index <= events.length) { if (enter === void 0) { if (events[index] && events[index][1].type === "data") { enter = index; index++; } } else if (!events[index] || events[index][1].type !== "data") { if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end; events.splice(enter + 2, index - enter - 2); index = enter + 2; } enter = void 0; } } return extraResolver ? extraResolver(events, context) : events; } } function resolveAllLineSuffixes(events, context) { let eventIndex = 0; 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; 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; } else if (chunk === -2) { tabs = true; size++; } else if (chunk === -1) { } else { 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; } function createTokenizer(parser, initialize, from) { let point = Object.assign( from ? Object.assign({}, from) : { line: 1, column: 1, offset: 0 }, { _index: 0, _bufferIndex: -1 } ); const columnStart = {}; const resolveAllConstructs = []; let chunks = []; let stack = []; let consumed = true; const effects = { consume, enter, exit: exit2, attempt: constructFactory(onsuccessfulconstruct), check: constructFactory(onsuccessfulcheck), interrupt: constructFactory(onsuccessfulcheck, { interrupt: true }) }; const context = { previous: null, code: null, containerState: {}, events: [], parser, sliceStream, sliceSerialize, now, defineSkip, write }; let state = initialize.tokenize.call(context, effects); let expectedCode; if (initialize.resolveAll) { resolveAllConstructs.push(initialize); } return context; function write(slice) { chunks = push(chunks, slice); main2(); if (chunks[chunks.length - 1] !== null) { return []; } addResult(initialize, 0); context.events = resolveAll(resolveAllConstructs, context.events, context); return context.events; } function sliceSerialize(token, expandTabs) { return serializeChunks(sliceStream(token), expandTabs); } function sliceStream(token) { return sliceChunks(chunks, token); } function now() { return Object.assign({}, point); } function defineSkip(value) { columnStart[value.line] = value.column; accountForPotentialSkip(); } function main2() { let chunkIndex; while (point._index < chunks.length) { const chunk = chunks[point._index]; 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); } } } function go(code) { consumed = void 0; expectedCode = code; state = state(code); } 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++; } if (point._bufferIndex < 0) { point._index++; } else { point._bufferIndex++; if (point._bufferIndex === chunks[point._index].length) { point._bufferIndex = -1; point._index++; } } context.previous = code; consumed = true; } function enter(type, fields) { const token = fields || {}; token.type = type; token.start = now(); context.events.push(["enter", token, context]); stack.push(token); return token; } function exit2(type) { const token = stack.pop(); token.end = now(); context.events.push(["exit", token, context]); return token; } function onsuccessfulconstruct(construct, info) { addResult(construct, info.from); } function onsuccessfulcheck(_, info) { info.restore(); } function constructFactory(onreturn, fields) { return hook; function hook(constructs2, returnState, bogusState) { let listOfConstructs; let constructIndex; let currentConstruct; let info; return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? handleListOfConstructs([constructs2]) : handleMapOfConstructs(constructs2); function handleMapOfConstructs(map) { return start; function start(code) { const def = code !== null && map[code]; const all = code !== null && map.null; const list2 = [ ...Array.isArray(def) ? def : def ? [def] : [], ...Array.isArray(all) ? all : all ? [all] : [] ]; return handleListOfConstructs(list2)(code); } } function handleListOfConstructs(list2) { listOfConstructs = list2; constructIndex = 0; if (list2.length === 0) { return bogusState; } return handleConstruct(list2[constructIndex]); } function handleConstruct(construct) { return start; function start(code) { info = store(); currentConstruct = construct; if (!construct.partial) { context.currentConstruct = construct; } if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) { return nok(code); } return construct.tokenize.call( fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok )(code); } } function ok(code) { consumed = true; onreturn(currentConstruct, info); return returnState; } function nok(code) { consumed = true; info.restore(); if (++constructIndex < listOfConstructs.length) { return handleConstruct(listOfConstructs[constructIndex]); } return bogusState; } } } function addResult(construct, from2) { if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { resolveAllConstructs.push(construct); } if (construct.resolve) { splice( context.events, from2, context.events.length - from2, construct.resolve(context.events.slice(from2), context) ); } if (construct.resolveTo) { context.events = construct.resolveTo(context.events, context); } } 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 }; function restore() { point = startPoint; context.previous = startPrevious; context.currentConstruct = startCurrentConstruct; context.events.length = startEventsIndex; stack = startStack; accountForPotentialSkip(); } } function accountForPotentialSkip() { if (point.line in columnStart && point.column < 2) { point.column = columnStart[point.line]; point.offset += columnStart[point.line] - 1; } } } function sliceChunks(chunks, token) { const startIndex = token.start._index; const startBufferIndex = token.start._bufferIndex; const endIndex = token.end._index; const endBufferIndex = token.end._bufferIndex; let view; if (startIndex === endIndex) { view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; } else { view = chunks.slice(startIndex, endIndex); if (startBufferIndex > -1) { view[0] = view[0].slice(startBufferIndex); } if (endBufferIndex > 0) { view.push(chunks[endIndex].slice(0, endBufferIndex)); } } return view; } function serializeChunks(chunks, expandTabs) { let index = -1; const result = []; let atTab; while (++index < chunks.length) { const chunk = chunks[index]; 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 ? " " : " "; break; } case -1: { if (!expandTabs && atTab) continue; value = " "; break; } default: { value = String.fromCharCode(chunk); } } atTab = chunk === -2; result.push(value); } return result.join(""); } var constructs_exports = {}; __export2(constructs_exports, { attentionMarkers: () => attentionMarkers, contentInitial: () => contentInitial, disable: () => disable, document: () => document2, flow: () => flow2, flowInitial: () => flowInitial, insideSpan: () => insideSpan, string: () => string2, text: () => text2 }); var document2 = { [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 }; var contentInitial = { [91]: definition }; var flowInitial = { [-2]: codeIndented, [-1]: codeIndented, [32]: codeIndented }; var flow2 = { [35]: headingAtx, [42]: thematicBreak, [45]: [setextUnderline, thematicBreak], [60]: htmlFlow, [61]: setextUnderline, [95]: thematicBreak, [96]: codeFenced, [126]: codeFenced }; var string2 = { [38]: characterReference, [92]: characterEscape }; var text2 = { [-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 }; var insideSpan = { null: [attention, resolver] }; var attentionMarkers = { null: [42, 95] }; var disable = { null: [] }; function parse2(options = {}) { const constructs2 = combineExtensions( [constructs_exports].concat(options.extensions || []) ); const parser = { defined: [], lazy: {}, constructs: constructs2, content: create(content), document: create(document), flow: create(flow), string: create(string), text: create(text) }; return parser; function create(initial) { return creator; function creator(from) { return createTokenizer(parser, initial, from); } } } function postprocess(events) { while (!subtokenize(events)) { } return events; } var search = /[\0\t\n\r]/g; function preprocess() { let column = 1; let buffer = ""; let start = true; let atCarriageReturn; return preprocessor; function preprocessor(value, encoding, end) { const chunks = []; let match; let next; let startPosition; let endPosition; let code; value = buffer + value.toString(encoding); startPosition = 0; buffer = ""; if (start) { if (value.charCodeAt(0) === 65279) { startPosition++; } start = void 0; } while (startPosition < value.length) { search.lastIndex = startPosition; match = search.exec(value); endPosition = match && match.index !== void 0 ? 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 = void 0; } else { if (atCarriageReturn) { chunks.push(-5); atCarriageReturn = void 0; } 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; } } var micromark = function(value, encoding, options) { if (typeof encoding !== "string") { options = encoding; encoding = void 0; } return compile(options)( postprocess( parse2(options).document().write(preprocess()(value, encoding, true)) ) ); }; var stageToHTML2 = (stageScriptString, opts = {}) => { let finalString = ""; const flatScenes = opts?.pureMarkdown ? (0, import_recital.parseFlat)(stageScriptString) : (0, import_recital_ext_common_commands.convertWikiLinkToMd)((0, import_recital.parseFlat)(stageScriptString)); const defaultOpts = { sceneTag: "section", blockTag: "div", sceneSeparator: "" }; opts = opts || {}; opts = { ...defaultOpts, ...opts }; for (let i = 0; i < flatScenes.length; i++) { const token = flatScenes[i]; switch (token.type) { case "scene": if (opts.sceneTag) { finalString += `<${opts.sceneTag}`; if (token.id) { finalString += ' id="' + token.id + '"'; } if (token.classes && token.classes.length) { finalString += ` class="${token.classes.join(" ")}"`; } finalString += ">\n"; } break; case "endScene": if (opts.sceneTag) { finalString += `</${opts.sceneTag}> `; } if (opts.sceneSeparator && i < flatScenes.length - 1) { finalString += opts.sceneSeparator + "\n"; } break; case "fragment": if (opts.blockTag) { finalString += `<${opts.blockTag}`; if (token.id) { finalString += ' id="' + token.id + '"'; } if (token.classes && token.classes.length) { finalString += ` class="${token.classes.join(" ")}"`; } finalString += ">\n"; } break; case "endFragment": if (opts.blockTag) { finalString += `</${opts.blockTag}> `; } break; case "paragraph": const smartText = smartypants_es6_default(token.text, "qie"); let renderedText = micromark(smartText.replace(/\-\-/gm, "\u2014")) + "\n"; if (token.primary) { const wrappedText = `<div${token.id ? ` id="${token.id}"` : ""}${token.classes ? ` class="${token.classes.join(" ")}"` : ""}> ${renderedText}</div> `; renderedText = wrappedText; } finalString += renderedText; break; case "rawText": let processedText = ""; if (token.startTag) { processedText += token.startTag + "\n"; } processedText += token.text; if (token.endTag) { processedText += token.endTag + "\n"; } finalString += micromark(processedText); break; } } return finalString.trim(); }; } }); // ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js var require_minimist = __commonJS2({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports2, module2) { module2.exports = function(args, opts) { if (!opts) opts = {}; var flags = { bools: {}, strings: {}, unknownFn: null }; if (typeof opts["unknown"] === "function") { flags.unknownFn = opts["unknown"]; } if (typeof opts["boolean"] === "boolean" && opts["boolean"]) { flags.allBools = true; } else { [].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) { flags.bools[key2] = true; }); } var aliases = {}; Object.keys(opts.alias || {}).forEach(function(key2) { aliases[key2] = [].concat(opts.alias[key2]); aliases[key2].forEach(function(x) { aliases[x] = [key2].concat(aliases[key2].filter(function(y) { return x !== y; })); }); }); [].concat(opts.string).filter(Boolean).forEach(function(key2) { flags.strings[key2] = true; if (aliases[key2]) { flags.strings[aliases[key2]] = true; } }); var defaults = opts["default"] || {}; var argv2 = { _: [] }; Object.keys(flags.bools).forEach(function(key2) { setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]); }); var notFlags = []; if (args.indexOf("--") !== -1) { notFlags = args.slice(args.indexOf("--") + 1); args = args.slice(0, args.indexOf("--")); } function argDefined(key2, arg2) { return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2]; } function setArg(key2, val, arg2) { if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) { if (flags.unknownFn(arg2) === false) return; } var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val; setKey(argv2, key2.split("."), value2); (aliases[key2] || []).forEach(function(x) { setKey(argv2, x.split("."), value2); }); } function setKey(obj, keys, value2) { var o = obj; for (var i2 = 0; i2 < keys.length - 1; i2++) { var key2 = keys[i2]; if (isConstructorOrProto(o, key2)) return; if (o[key2] === void 0) o[key2] = {}; if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) o[key2] = {}; if (o[key2] === Array.prototype) o[key2] = []; o = o[key2]; } var key2 = keys[keys.length - 1]; if (isConstructorOrProto(o, key2)) return; if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {}; if (o === Array.prototype) o = []; if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") { o[key2] = value2; } else if (Array.isArray(o[key2])) { o[key2].push(value2); } else { o[key2] = [o[key2], value2]; } } function aliasIsBoolean(key2) { return aliases[key2].some(function(x) { return flags.bools[x]; }); } for (var i = 0; i < args.length; i++) { var arg = args[i]; if (/^--.+=/.test(arg)) { var m = arg.match(/^--([^=]+)=([\s\S]*)$/); var key = m[1]; var value = m[2]; if (flags.bools[key]) { value = value !== "false"; } setArg(key, value, arg); } else if (/^--no-.+/.test(arg)) { var key = arg.match(/^--no-(.+)/)[1]; setArg(key, false, arg); } else if (/^--.+/.test(arg)) { var key = arg.match(/^--(.+)/)[1]; var next = args[i + 1]; if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) { setArg(key, next, arg); i++; } else if (/^(true|false)$/.test(next)) { setArg(key, next === "true", arg); i++; } else { setArg(key, flags.strings[key] ? "" : true, arg); } } else if (/^-[^-]+/.test(arg)) { var letters = arg.slice(1, -1).split(""); var broken = false; for (var j = 0; j < letters.length; j++) { var next = arg.slice(j + 2); if (next === "-") { setArg(letters[j], next, arg); continue; } if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { setArg(letters[j], next.split("=")[1], arg); broken = true; break; } if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { setArg(letters[j], next, arg); broken = true; break; } if (letters[j + 1] && letters[j + 1].match(/\W/)) { setArg(letters[j], arg.slice(j + 2), arg); broken = true; break; } else { setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg); } } var key = arg.slice(-1)[0]; if (!broken && key !== "-") { if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) { setArg(key, args[i + 1], arg); i++; } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) { setArg(key, args[i + 1] === "true", arg); i++; } else { setArg(key, flags.strings[key] ? "" : true, arg); } } } else { if (!flags.unknownFn || flags.unknownFn(arg) !== false) { argv2._.push( flags.strings["_"] || !isNumber(arg) ? arg : Number(arg) ); } if (opts.stopEarly) { argv2._.push.apply(argv2._, args.slice(i + 1)); break; } } } Object.keys(defaults).forEach(function(key2) { if (!hasKey2(argv2, key2.split("."))) { setKey(argv2, key2.split("."), defaults[key2]); (aliases[key2] || []).forEach(function(x) { setKey(argv2, x.split("."), defaults[key2]); }); } }); if (opts["--"]) { argv2["--"] = new Array(); notFlags.forEach(function(key2) { argv2["--"].push(key2); }); } else { notFlags.forEach(function(key2) { argv2._.push(key2); }); } return argv2; }; function hasKey2(obj, keys) { var o = obj; keys.slice(0, -1).forEach(function(key2) { o = o[key2] || {}; }); var key = keys[keys.length - 1]; return key in o; } function isNumber(x) { if (typeof x === "number") return true; if (/^0x[0-9a-f]+$/i.test(x)) return true; return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); } function isConstructorOrProto(obj, key) { return key === "constructor" && typeof obj[key] === "function" || key === "__proto__"; } } }); // package.json var require_package = __commonJS2({ "package.json"(exports2, module2) { module2.exports = { name: "@a-morphous/recital-stage-html", version: "1.1.1", description: "", main: "dist/stage-html.js", module: "dist/stage-html.module.js", scripts: { test: "node_modules/.bin/test test/*.js" }, bin: { "stage-html": "./dist/cli.js" }, repository: { type: "git", url: "https://github.com/a-morphous/recital" }, publishConfig: { registry: "https://npm.pkg.github.com/" }, files: [ "dist", "src" ], author: "Amorphous", license: "MIT", dependencies: { "@a-morphous/recital": "^1.1.0", "@a-morphous/recital-ext-common-commands": "^1.1.0", micromark: "^3.0.10", minimist: "^1.2.6", smartypants: "^0.1.6" }, devDependencies: { esbuild: "^0.14.34", "@a-morphous/test": "workspace:^1.0.0" } }; } }); // cli.js var stageToHTML = require_stage_html().stageToHTML; var argv = require_minimist()(process.argv.slice(2)); var fs = require("fs"); var path = require("path"); var pkg = require_package(); var { resolveIncludes } = require_common_commands_ext(); var main = () => { if (argv.v || argv.version) { console.log(pkg.version); return; } if (!argv._ || argv._.length === 0) { console.log(`Usage: stage-html input-file.stage optional-file-2.stage -o outputfile.html Options: *TAG OPTIONS* --sceneTag tagName - Tag (without brackets) that wraps around scenes. Defaults to 'section' --blockTag tagName - Tag (without brackets) that wraps around fragments. Defaults to 'div' --separator '<hr />' - HTML that goes between scenes. Defaults to nothing. *CONVERSION OPTIONS* --useIncludes - if set, will accept the $include command to have HTML templates. Defaults to false. --pureMarkdown - if set, will not use any of the common extensions (e.g. wikilinks). Defaults to false. `); return; } let opts = {}; if (argv.sceneTag !== void 0) { opts.sceneTag = argv.sceneTag; } if (argv.blockTag !== void 0) { opts.blockTag = argv.blockTag; } if (argv.separator !== void 0) { opts.sceneSeparator = argv.separator; } if (argv.useIncludes !== void 0) { opts.useIncludes = true; } if (argv.pureMarkdown !== void 0) { opts.pureMarkdown = true; } let str = ""; for (let file of argv._) { let fileString = fs.readFileSync(file, "utf-8"); if (opts.useIncludes) { fileString = resolveIncludes(fs, path, file, fileString); } const htmlString = stageToHTML(fileString, opts); str += htmlString + "\n\n"; } if (argv.o) { fs.writeFileSync(argv.o, str); } else { console.log(str); } }; main();