'use strict'; var obsidian = require('obsidian'); var path$1 = require('path'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } const DEFAULT_DATE_FORMAT = 'YYYYMMDDHHmm'; const DATE_REGEX = /(?{{date:?(?[^}]*)}})/g; const NEW_HEADER_TEMPLATE =` date updated: '{{date:YYYY-MM-DDTHH:mm:ssZ}}' `; var constants = { NEW_HEADER_TEMPLATE: NEW_HEADER_TEMPLATE, DATE_REGEX: DATE_REGEX, DEFAULT_DATE_FORMAT: DEFAULT_DATE_FORMAT }; function isNothing(subject) { return (typeof subject === 'undefined') || (subject === null); } function isObject(subject) { return (typeof subject === 'object') && (subject !== null); } function toArray(sequence) { if (Array.isArray(sequence)) return sequence; else if (isNothing(sequence)) return []; return [ sequence ]; } function extend(target, source) { var index, length, key, sourceKeys; if (source) { sourceKeys = Object.keys(source); for (index = 0, length = sourceKeys.length; index < length; index += 1) { key = sourceKeys[index]; target[key] = source[key]; } } return target; } function repeat(string, count) { var result = '', cycle; for (cycle = 0; cycle < count; cycle += 1) { result += string; } return result; } function isNegativeZero(number) { return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); } var isNothing_1 = isNothing; var isObject_1 = isObject; var toArray_1 = toArray; var repeat_1 = repeat; var isNegativeZero_1 = isNegativeZero; var extend_1 = extend; var common = { isNothing: isNothing_1, isObject: isObject_1, toArray: toArray_1, repeat: repeat_1, isNegativeZero: isNegativeZero_1, extend: extend_1 }; // YAML error class. http://stackoverflow.com/questions/8458984 function YAMLException(reason, mark) { // Super constructor Error.call(this); this.name = 'YAMLException'; this.reason = reason; this.mark = mark; this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); // Include stack trace in error object if (Error.captureStackTrace) { // Chrome and NodeJS Error.captureStackTrace(this, this.constructor); } else { // FF, IE 10+ and Safari 6+. Fallback for others this.stack = (new Error()).stack || ''; } } // Inherit from Error YAMLException.prototype = Object.create(Error.prototype); YAMLException.prototype.constructor = YAMLException; YAMLException.prototype.toString = function toString(compact) { var result = this.name + ': '; result += this.reason || '(unknown reason)'; if (!compact && this.mark) { result += ' ' + this.mark.toString(); } return result; }; var exception = YAMLException; function Mark(name, buffer, position, line, column) { this.name = name; this.buffer = buffer; this.position = position; this.line = line; this.column = column; } Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { var head, start, tail, end, snippet; if (!this.buffer) return null; indent = indent || 4; maxLength = maxLength || 75; head = ''; start = this.position; while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { start -= 1; if (this.position - start > (maxLength / 2 - 1)) { head = ' ... '; start += 5; break; } } tail = ''; end = this.position; while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { end += 1; if (end - this.position > (maxLength / 2 - 1)) { tail = ' ... '; end -= 5; break; } } snippet = this.buffer.slice(start, end); return common.repeat(' ', indent) + head + snippet + tail + '\n' + common.repeat(' ', indent + this.position - start + head.length) + '^'; }; Mark.prototype.toString = function toString(compact) { var snippet, where = ''; if (this.name) { where += 'in "' + this.name + '" '; } where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); if (!compact) { snippet = this.getSnippet(); if (snippet) { where += ':\n' + snippet; } } return where; }; var mark = Mark; var TYPE_CONSTRUCTOR_OPTIONS = [ 'kind', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', 'defaultStyle', 'styleAliases' ]; var YAML_NODE_KINDS = [ 'scalar', 'sequence', 'mapping' ]; function compileStyleAliases(map) { var result = {}; if (map !== null) { Object.keys(map).forEach(function (style) { map[style].forEach(function (alias) { result[String(alias)] = style; }); }); } return result; } function Type(tag, options) { options = options || {}; Object.keys(options).forEach(function (name) { if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); } }); // TODO: Add tag format check. this.tag = tag; this.kind = options['kind'] || null; this.resolve = options['resolve'] || function () { return true; }; this.construct = options['construct'] || function (data) { return data; }; this.instanceOf = options['instanceOf'] || null; this.predicate = options['predicate'] || null; this.represent = options['represent'] || null; this.defaultStyle = options['defaultStyle'] || null; this.styleAliases = compileStyleAliases(options['styleAliases'] || null); if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); } } var type = Type; /*eslint-disable max-len*/ function compileList(schema, name, result) { var exclude = []; schema.include.forEach(function (includedSchema) { result = compileList(includedSchema, name, result); }); schema[name].forEach(function (currentType) { result.forEach(function (previousType, previousIndex) { if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { exclude.push(previousIndex); } }); result.push(currentType); }); return result.filter(function (type, index) { return exclude.indexOf(index) === -1; }); } function compileMap(/* lists... */) { var result = { scalar: {}, sequence: {}, mapping: {}, fallback: {} }, index, length; function collectType(type) { result[type.kind][type.tag] = result['fallback'][type.tag] = type; } for (index = 0, length = arguments.length; index < length; index += 1) { arguments[index].forEach(collectType); } return result; } function Schema(definition) { this.include = definition.include || []; this.implicit = definition.implicit || []; this.explicit = definition.explicit || []; this.implicit.forEach(function (type) { if (type.loadKind && type.loadKind !== 'scalar') { throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } }); this.compiledImplicit = compileList(this, 'implicit', []); this.compiledExplicit = compileList(this, 'explicit', []); this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); } Schema.DEFAULT = null; Schema.create = function createSchema() { var schemas, types; switch (arguments.length) { case 1: schemas = Schema.DEFAULT; types = arguments[0]; break; case 2: schemas = arguments[0]; types = arguments[1]; break; default: throw new exception('Wrong number of arguments for Schema.create function'); } schemas = common.toArray(schemas); types = common.toArray(types); if (!schemas.every(function (schema) { return schema instanceof Schema; })) { throw new exception('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); } if (!types.every(function (type$1) { return type$1 instanceof type; })) { throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } return new Schema({ include: schemas, explicit: types }); }; var schema = Schema; var str = new type('tag:yaml.org,2002:str', { kind: 'scalar', construct: function (data) { return data !== null ? data : ''; } }); var seq = new type('tag:yaml.org,2002:seq', { kind: 'sequence', construct: function (data) { return data !== null ? data : []; } }); var map = new type('tag:yaml.org,2002:map', { kind: 'mapping', construct: function (data) { return data !== null ? data : {}; } }); var failsafe = new schema({ explicit: [ str, seq, map ] }); function resolveYamlNull(data) { if (data === null) return true; var max = data.length; return (max === 1 && data === '~') || (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); } function constructYamlNull() { return null; } function isNull(object) { return object === null; } var _null = new type('tag:yaml.org,2002:null', { kind: 'scalar', resolve: resolveYamlNull, construct: constructYamlNull, predicate: isNull, represent: { canonical: function () { return '~'; }, lowercase: function () { return 'null'; }, uppercase: function () { return 'NULL'; }, camelcase: function () { return 'Null'; } }, defaultStyle: 'lowercase' }); function resolveYamlBoolean(data) { if (data === null) return false; var max = data.length; return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); } function constructYamlBoolean(data) { return data === 'true' || data === 'True' || data === 'TRUE'; } function isBoolean(object) { return Object.prototype.toString.call(object) === '[object Boolean]'; } var bool = new type('tag:yaml.org,2002:bool', { kind: 'scalar', resolve: resolveYamlBoolean, construct: constructYamlBoolean, predicate: isBoolean, represent: { lowercase: function (object) { return object ? 'true' : 'false'; }, uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, camelcase: function (object) { return object ? 'True' : 'False'; } }, defaultStyle: 'lowercase' }); function isHexCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || ((0x61/* a */ <= c) && (c <= 0x66/* f */)); } function isOctCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); } function isDecCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); } function resolveYamlInteger(data) { if (data === null) return false; var max = data.length, index = 0, hasDigits = false, ch; if (!max) return false; ch = data[index]; // sign if (ch === '-' || ch === '+') { ch = data[++index]; } if (ch === '0') { // 0 if (index + 1 === max) return true; ch = data[++index]; // base 2, base 8, base 16 if (ch === 'b') { // base 2 index++; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (ch !== '0' && ch !== '1') return false; hasDigits = true; } return hasDigits && ch !== '_'; } if (ch === 'x') { // base 16 index++; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (!isHexCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits && ch !== '_'; } // base 8 for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (!isOctCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits && ch !== '_'; } // base 10 (except 0) or base 60 // value should not start with `_`; if (ch === '_') return false; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (ch === ':') break; if (!isDecCode(data.charCodeAt(index))) { return false; } hasDigits = true; } // Should have digits and should not end with `_` if (!hasDigits || ch === '_') return false; // if !base60 - done; if (ch !== ':') return true; // base60 almost not used, no needs to optimize return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); } function constructYamlInteger(data) { var value = data, sign = 1, ch, base, digits = []; if (value.indexOf('_') !== -1) { value = value.replace(/_/g, ''); } ch = value[0]; if (ch === '-' || ch === '+') { if (ch === '-') sign = -1; value = value.slice(1); ch = value[0]; } if (value === '0') return 0; if (ch === '0') { if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); if (value[1] === 'x') return sign * parseInt(value, 16); return sign * parseInt(value, 8); } if (value.indexOf(':') !== -1) { value.split(':').forEach(function (v) { digits.unshift(parseInt(v, 10)); }); value = 0; base = 1; digits.forEach(function (d) { value += (d * base); base *= 60; }); return sign * value; } return sign * parseInt(value, 10); } function isInteger(object) { return (Object.prototype.toString.call(object)) === '[object Number]' && (object % 1 === 0 && !common.isNegativeZero(object)); } var int_1 = new type('tag:yaml.org,2002:int', { kind: 'scalar', resolve: resolveYamlInteger, construct: constructYamlInteger, predicate: isInteger, represent: { binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, decimal: function (obj) { return obj.toString(10); }, /* eslint-disable max-len */ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } }, defaultStyle: 'decimal', styleAliases: { binary: [ 2, 'bin' ], octal: [ 8, 'oct' ], decimal: [ 10, 'dec' ], hexadecimal: [ 16, 'hex' ] } }); var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2 // special case, seems not from spec '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + // 20:59 '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + // .inf '|[-+]?\\.(?:inf|Inf|INF)' + // .nan '|\\.(?:nan|NaN|NAN))$'); function resolveYamlFloat(data) { if (data === null) return false; if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` // Probably should update regexp & check speed data[data.length - 1] === '_') { return false; } return true; } function constructYamlFloat(data) { var value, sign, base, digits; value = data.replace(/_/g, '').toLowerCase(); sign = value[0] === '-' ? -1 : 1; digits = []; if ('+-'.indexOf(value[0]) >= 0) { value = value.slice(1); } if (value === '.inf') { return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; } else if (value === '.nan') { return NaN; } else if (value.indexOf(':') >= 0) { value.split(':').forEach(function (v) { digits.unshift(parseFloat(v, 10)); }); value = 0.0; base = 1; digits.forEach(function (d) { value += d * base; base *= 60; }); return sign * value; } return sign * parseFloat(value, 10); } var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; function representYamlFloat(object, style) { var res; if (isNaN(object)) { switch (style) { case 'lowercase': return '.nan'; case 'uppercase': return '.NAN'; case 'camelcase': return '.NaN'; } } else if (Number.POSITIVE_INFINITY === object) { switch (style) { case 'lowercase': return '.inf'; case 'uppercase': return '.INF'; case 'camelcase': return '.Inf'; } } else if (Number.NEGATIVE_INFINITY === object) { switch (style) { case 'lowercase': return '-.inf'; case 'uppercase': return '-.INF'; case 'camelcase': return '-.Inf'; } } else if (common.isNegativeZero(object)) { return '-0.0'; } res = object.toString(10); // JS stringifier can build scientific format without dots: 5e-100, // while YAML requres dot: 5.e-100. Fix it with simple hack return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; } function isFloat(object) { return (Object.prototype.toString.call(object) === '[object Number]') && (object % 1 !== 0 || common.isNegativeZero(object)); } var float_1 = new type('tag:yaml.org,2002:float', { kind: 'scalar', resolve: resolveYamlFloat, construct: constructYamlFloat, predicate: isFloat, represent: representYamlFloat, defaultStyle: 'lowercase' }); var json = new schema({ include: [ failsafe ], implicit: [ _null, bool, int_1, float_1 ] }); var core = new schema({ include: [ json ] }); var YAML_DATE_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9])' + // [2] month '-([0-9][0-9])$'); // [3] day var YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9]?)' + // [2] month '-([0-9][0-9]?)' + // [3] day '(?:[Tt]|[ \\t]+)' + // ... '([0-9][0-9]?)' + // [4] hour ':([0-9][0-9])' + // [5] minute ':([0-9][0-9])' + // [6] second '(?:\\.([0-9]*))?' + // [7] fraction '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour '(?::([0-9][0-9]))?))?$'); // [11] tz_minute function resolveYamlTimestamp(data) { if (data === null) return false; if (YAML_DATE_REGEXP.exec(data) !== null) return true; if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; return false; } function constructYamlTimestamp(data) { var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; match = YAML_DATE_REGEXP.exec(data); if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); if (match === null) throw new Error('Date resolve error'); // match: [1] year [2] month [3] day year = +(match[1]); month = +(match[2]) - 1; // JS month starts with 0 day = +(match[3]); if (!match[4]) { // no hour return new Date(Date.UTC(year, month, day)); } // match: [4] hour [5] minute [6] second [7] fraction hour = +(match[4]); minute = +(match[5]); second = +(match[6]); if (match[7]) { fraction = match[7].slice(0, 3); while (fraction.length < 3) { // milli-seconds fraction += '0'; } fraction = +fraction; } // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute if (match[9]) { tz_hour = +(match[10]); tz_minute = +(match[11] || 0); delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds if (match[9] === '-') delta = -delta; } date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); if (delta) date.setTime(date.getTime() - delta); return date; } function representYamlTimestamp(object /*, style*/) { return object.toISOString(); } var timestamp = new type('tag:yaml.org,2002:timestamp', { kind: 'scalar', resolve: resolveYamlTimestamp, construct: constructYamlTimestamp, instanceOf: Date, represent: representYamlTimestamp }); function resolveYamlMerge(data) { return data === '<<' || data === null; } var merge = new type('tag:yaml.org,2002:merge', { kind: 'scalar', resolve: resolveYamlMerge }); var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, basedir, module) { return module = { path: basedir, exports: {}, require: function (path, base) { return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); } }, fn(module, module.exports), module.exports; } function commonjsRequire () { throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); } /*eslint-disable no-bitwise*/ var NodeBuffer; try { // A trick for browserified version, to not include `Buffer` shim var _require = commonjsRequire; NodeBuffer = _require('buffer').Buffer; } catch (__) {} // [ 64, 65, 66 ] -> [ padding, CR, LF ] var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; function resolveYamlBinary(data) { if (data === null) return false; var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; // Convert one by one. for (idx = 0; idx < max; idx++) { code = map.indexOf(data.charAt(idx)); // Skip CR/LF if (code > 64) continue; // Fail on illegal characters if (code < 0) return false; bitlen += 6; } // If there are any bits left, source was corrupted return (bitlen % 8) === 0; } function constructYamlBinary(data) { var idx, tailbits, input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan max = input.length, map = BASE64_MAP, bits = 0, result = []; // Collect by 6*4 bits (3 bytes) for (idx = 0; idx < max; idx++) { if ((idx % 4 === 0) && idx) { result.push((bits >> 16) & 0xFF); result.push((bits >> 8) & 0xFF); result.push(bits & 0xFF); } bits = (bits << 6) | map.indexOf(input.charAt(idx)); } // Dump tail tailbits = (max % 4) * 6; if (tailbits === 0) { result.push((bits >> 16) & 0xFF); result.push((bits >> 8) & 0xFF); result.push(bits & 0xFF); } else if (tailbits === 18) { result.push((bits >> 10) & 0xFF); result.push((bits >> 2) & 0xFF); } else if (tailbits === 12) { result.push((bits >> 4) & 0xFF); } // Wrap into Buffer for NodeJS and leave Array for browser if (NodeBuffer) { // Support node 6.+ Buffer API when available return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); } return result; } function representYamlBinary(object /*, style*/) { var result = '', bits = 0, idx, tail, max = object.length, map = BASE64_MAP; // Convert every three bytes to 4 ASCII characters. for (idx = 0; idx < max; idx++) { if ((idx % 3 === 0) && idx) { result += map[(bits >> 18) & 0x3F]; result += map[(bits >> 12) & 0x3F]; result += map[(bits >> 6) & 0x3F]; result += map[bits & 0x3F]; } bits = (bits << 8) + object[idx]; } // Dump tail tail = max % 3; if (tail === 0) { result += map[(bits >> 18) & 0x3F]; result += map[(bits >> 12) & 0x3F]; result += map[(bits >> 6) & 0x3F]; result += map[bits & 0x3F]; } else if (tail === 2) { result += map[(bits >> 10) & 0x3F]; result += map[(bits >> 4) & 0x3F]; result += map[(bits << 2) & 0x3F]; result += map[64]; } else if (tail === 1) { result += map[(bits >> 2) & 0x3F]; result += map[(bits << 4) & 0x3F]; result += map[64]; result += map[64]; } return result; } function isBinary(object) { return NodeBuffer && NodeBuffer.isBuffer(object); } var binary = new type('tag:yaml.org,2002:binary', { kind: 'scalar', resolve: resolveYamlBinary, construct: constructYamlBinary, predicate: isBinary, represent: representYamlBinary }); var _hasOwnProperty = Object.prototype.hasOwnProperty; var _toString = Object.prototype.toString; function resolveYamlOmap(data) { if (data === null) return true; var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data; for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; pairHasKey = false; if (_toString.call(pair) !== '[object Object]') return false; for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { if (!pairHasKey) pairHasKey = true; else return false; } } if (!pairHasKey) return false; if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); else return false; } return true; } function constructYamlOmap(data) { return data !== null ? data : []; } var omap = new type('tag:yaml.org,2002:omap', { kind: 'sequence', resolve: resolveYamlOmap, construct: constructYamlOmap }); var _toString$1 = Object.prototype.toString; function resolveYamlPairs(data) { if (data === null) return true; var index, length, pair, keys, result, object = data; result = new Array(object.length); for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; if (_toString$1.call(pair) !== '[object Object]') return false; keys = Object.keys(pair); if (keys.length !== 1) return false; result[index] = [ keys[0], pair[keys[0]] ]; } return true; } function constructYamlPairs(data) { if (data === null) return []; var index, length, pair, keys, result, object = data; result = new Array(object.length); for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; keys = Object.keys(pair); result[index] = [ keys[0], pair[keys[0]] ]; } return result; } var pairs = new type('tag:yaml.org,2002:pairs', { kind: 'sequence', resolve: resolveYamlPairs, construct: constructYamlPairs }); var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; function resolveYamlSet(data) { if (data === null) return true; var key, object = data; for (key in object) { if (_hasOwnProperty$1.call(object, key)) { if (object[key] !== null) return false; } } return true; } function constructYamlSet(data) { return data !== null ? data : {}; } var set = new type('tag:yaml.org,2002:set', { kind: 'mapping', resolve: resolveYamlSet, construct: constructYamlSet }); var default_safe = new schema({ include: [ core ], implicit: [ timestamp, merge ], explicit: [ binary, omap, pairs, set ] }); function resolveJavascriptUndefined() { return true; } function constructJavascriptUndefined() { /*eslint-disable no-undefined*/ return undefined; } function representJavascriptUndefined() { return ''; } function isUndefined(object) { return typeof object === 'undefined'; } var _undefined = new type('tag:yaml.org,2002:js/undefined', { kind: 'scalar', resolve: resolveJavascriptUndefined, construct: constructJavascriptUndefined, predicate: isUndefined, represent: representJavascriptUndefined }); function resolveJavascriptRegExp(data) { if (data === null) return false; if (data.length === 0) return false; var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ''; // if regexp starts with '/' it can have modifiers and must be properly closed // `/foo/gim` - modifiers tail can be maximum 3 chars if (regexp[0] === '/') { if (tail) modifiers = tail[1]; if (modifiers.length > 3) return false; // if expression starts with /, is should be properly terminated if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; } return true; } function constructJavascriptRegExp(data) { var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ''; // `/foo/gim` - tail can be maximum 4 chars if (regexp[0] === '/') { if (tail) modifiers = tail[1]; regexp = regexp.slice(1, regexp.length - modifiers.length - 1); } return new RegExp(regexp, modifiers); } function representJavascriptRegExp(object /*, style*/) { var result = '/' + object.source + '/'; if (object.global) result += 'g'; if (object.multiline) result += 'm'; if (object.ignoreCase) result += 'i'; return result; } function isRegExp(object) { return Object.prototype.toString.call(object) === '[object RegExp]'; } var regexp = new type('tag:yaml.org,2002:js/regexp', { kind: 'scalar', resolve: resolveJavascriptRegExp, construct: constructJavascriptRegExp, predicate: isRegExp, represent: representJavascriptRegExp }); var esprima; // Browserified version does not have esprima // // 1. For node.js just require module as deps // 2. For browser try to require mudule via external AMD system. // If not found - try to fallback to window.esprima. If not // found too - then fail to parse. // try { // workaround to exclude package from browserify list. var _require$1 = commonjsRequire; esprima = _require$1('esprima'); } catch (_) { /* eslint-disable no-redeclare */ /* global window */ if (typeof window !== 'undefined') esprima = window.esprima; } function resolveJavascriptFunction(data) { if (data === null) return false; try { var source = '(' + data + ')', ast = esprima.parse(source, { range: true }); if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || (ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression')) { return false; } return true; } catch (err) { return false; } } function constructJavascriptFunction(data) { /*jslint evil:true*/ var source = '(' + data + ')', ast = esprima.parse(source, { range: true }), params = [], body; if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || (ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression')) { throw new Error('Failed to resolve function'); } ast.body[0].expression.params.forEach(function (param) { params.push(param.name); }); body = ast.body[0].expression.body.range; // Esprima's ranges include the first '{' and the last '}' characters on // function expressions. So cut them out. if (ast.body[0].expression.body.type === 'BlockStatement') { /*eslint-disable no-new-func*/ return new Function(params, source.slice(body[0] + 1, body[1] - 1)); } // ES6 arrow functions can omit the BlockStatement. In that case, just return // the body. /*eslint-disable no-new-func*/ return new Function(params, 'return ' + source.slice(body[0], body[1])); } function representJavascriptFunction(object /*, style*/) { return object.toString(); } function isFunction(object) { return Object.prototype.toString.call(object) === '[object Function]'; } var _function = new type('tag:yaml.org,2002:js/function', { kind: 'scalar', resolve: resolveJavascriptFunction, construct: constructJavascriptFunction, predicate: isFunction, represent: representJavascriptFunction }); var default_full = schema.DEFAULT = new schema({ include: [ default_safe ], explicit: [ _undefined, regexp, _function ] }); /*eslint-disable max-len,no-use-before-define*/ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; var CONTEXT_FLOW_IN = 1; var CONTEXT_FLOW_OUT = 2; var CONTEXT_BLOCK_IN = 3; var CONTEXT_BLOCK_OUT = 4; var CHOMPING_CLIP = 1; var CHOMPING_STRIP = 2; var CHOMPING_KEEP = 3; var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(obj) { return Object.prototype.toString.call(obj); } function is_EOL(c) { return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } function is_WHITE_SPACE(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */); } function is_WS_OR_EOL(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */) || (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } function is_FLOW_INDICATOR(c) { return c === 0x2C/* , */ || c === 0x5B/* [ */ || c === 0x5D/* ] */ || c === 0x7B/* { */ || c === 0x7D/* } */; } function fromHexCode(c) { var lc; if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { return c - 0x30; } /*eslint-disable no-bitwise*/ lc = c | 0x20; if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { return lc - 0x61 + 10; } return -1; } function escapedHexLen(c) { if (c === 0x78/* x */) { return 2; } if (c === 0x75/* u */) { return 4; } if (c === 0x55/* U */) { return 8; } return 0; } function fromDecimalCode(c) { if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { return c - 0x30; } return -1; } function simpleEscapeSequence(c) { /* eslint-disable indent */ return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : (c === 0x62/* b */) ? '\x08' : (c === 0x74/* t */) ? '\x09' : (c === 0x09/* Tab */) ? '\x09' : (c === 0x6E/* n */) ? '\x0A' : (c === 0x76/* v */) ? '\x0B' : (c === 0x66/* f */) ? '\x0C' : (c === 0x72/* r */) ? '\x0D' : (c === 0x65/* e */) ? '\x1B' : (c === 0x20/* Space */) ? ' ' : (c === 0x22/* " */) ? '\x22' : (c === 0x2F/* / */) ? '/' : (c === 0x5C/* \ */) ? '\x5C' : (c === 0x4E/* N */) ? '\x85' : (c === 0x5F/* _ */) ? '\xA0' : (c === 0x4C/* L */) ? '\u2028' : (c === 0x50/* P */) ? '\u2029' : ''; } function charFromCodepoint(c) { if (c <= 0xFFFF) { return String.fromCharCode(c); } // Encode UTF-16 surrogate pair // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF return String.fromCharCode( ((c - 0x010000) >> 10) + 0xD800, ((c - 0x010000) & 0x03FF) + 0xDC00 ); } var simpleEscapeCheck = new Array(256); // integer, for fast access var simpleEscapeMap = new Array(256); for (var i = 0; i < 256; i++) { simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; simpleEscapeMap[i] = simpleEscapeSequence(i); } function State(input, options) { this.input = input; this.filename = options['filename'] || null; this.schema = options['schema'] || default_full; this.onWarning = options['onWarning'] || null; this.legacy = options['legacy'] || false; this.json = options['json'] || false; this.listener = options['listener'] || null; this.implicitTypes = this.schema.compiledImplicit; this.typeMap = this.schema.compiledTypeMap; this.length = input.length; this.position = 0; this.line = 0; this.lineStart = 0; this.lineIndent = 0; this.documents = []; /* this.version; this.checkLineBreaks; this.tagMap; this.anchorMap; this.tag; this.anchor; this.kind; this.result;*/ } function generateError(state, message) { return new exception( message, new mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); } function throwError(state, message) { throw generateError(state, message); } function throwWarning(state, message) { if (state.onWarning) { state.onWarning.call(null, generateError(state, message)); } } var directiveHandlers = { YAML: function handleYamlDirective(state, name, args) { var match, major, minor; if (state.version !== null) { throwError(state, 'duplication of %YAML directive'); } if (args.length !== 1) { throwError(state, 'YAML directive accepts exactly one argument'); } match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); if (match === null) { throwError(state, 'ill-formed argument of the YAML directive'); } major = parseInt(match[1], 10); minor = parseInt(match[2], 10); if (major !== 1) { throwError(state, 'unacceptable YAML version of the document'); } state.version = args[0]; state.checkLineBreaks = (minor < 2); if (minor !== 1 && minor !== 2) { throwWarning(state, 'unsupported YAML version of the document'); } }, TAG: function handleTagDirective(state, name, args) { var handle, prefix; if (args.length !== 2) { throwError(state, 'TAG directive accepts exactly two arguments'); } handle = args[0]; prefix = args[1]; if (!PATTERN_TAG_HANDLE.test(handle)) { throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); } if (_hasOwnProperty$2.call(state.tagMap, handle)) { throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } if (!PATTERN_TAG_URI.test(prefix)) { throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); } state.tagMap[handle] = prefix; } }; function captureSegment(state, start, end, checkJson) { var _position, _length, _character, _result; if (start < end) { _result = state.input.slice(start, end); if (checkJson) { for (_position = 0, _length = _result.length; _position < _length; _position += 1) { _character = _result.charCodeAt(_position); if (!(_character === 0x09 || (0x20 <= _character && _character <= 0x10FFFF))) { throwError(state, 'expected valid JSON character'); } } } else if (PATTERN_NON_PRINTABLE.test(_result)) { throwError(state, 'the stream contains non-printable characters'); } state.result += _result; } } function mergeMappings(state, destination, source, overridableKeys) { var sourceKeys, key, index, quantity; if (!common.isObject(source)) { throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); } sourceKeys = Object.keys(source); for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { key = sourceKeys[index]; if (!_hasOwnProperty$2.call(destination, key)) { destination[key] = source[key]; overridableKeys[key] = true; } } } function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { var index, quantity; // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process // (deeply nested arrays that explode exponentially using aliases). if (Array.isArray(keyNode)) { keyNode = Array.prototype.slice.call(keyNode); for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { if (Array.isArray(keyNode[index])) { throwError(state, 'nested arrays are not supported inside keys'); } if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { keyNode[index] = '[object Object]'; } } } // Avoid code execution in load() via toString property // (still use its own toString for arrays, timestamps, // and whatever user schema extensions happen to have @@toStringTag) if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { keyNode = '[object Object]'; } keyNode = String(keyNode); if (_result === null) { _result = {}; } if (keyTag === 'tag:yaml.org,2002:merge') { if (Array.isArray(valueNode)) { for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { mergeMappings(state, _result, valueNode[index], overridableKeys); } } else { mergeMappings(state, _result, valueNode, overridableKeys); } } else { if (!state.json && !_hasOwnProperty$2.call(overridableKeys, keyNode) && _hasOwnProperty$2.call(_result, keyNode)) { state.line = startLine || state.line; state.position = startPos || state.position; throwError(state, 'duplicated mapping key'); } _result[keyNode] = valueNode; delete overridableKeys[keyNode]; } return _result; } function readLineBreak(state) { var ch; ch = state.input.charCodeAt(state.position); if (ch === 0x0A/* LF */) { state.position++; } else if (ch === 0x0D/* CR */) { state.position++; if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { state.position++; } } else { throwError(state, 'a line break is expected'); } state.line += 1; state.lineStart = state.position; } function skipSeparationSpace(state, allowComments, checkIndent) { var lineBreaks = 0, ch = state.input.charCodeAt(state.position); while (ch !== 0) { while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (allowComments && ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); } if (is_EOL(ch)) { readLineBreak(state); ch = state.input.charCodeAt(state.position); lineBreaks++; state.lineIndent = 0; while (ch === 0x20/* Space */) { state.lineIndent++; ch = state.input.charCodeAt(++state.position); } } else { break; } } if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { throwWarning(state, 'deficient indentation'); } return lineBreaks; } function testDocumentSeparator(state) { var _position = state.position, ch; ch = state.input.charCodeAt(_position); // Condition state.position === state.lineStart is tested // in parent on each call, for efficiency. No needs to test here again. if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) { _position += 3; ch = state.input.charCodeAt(_position); if (ch === 0 || is_WS_OR_EOL(ch)) { return true; } } return false; } function writeFoldedLines(state, count) { if (count === 1) { state.result += ' '; } else if (count > 1) { state.result += common.repeat('\n', count - 1); } } function readPlainScalar(state, nodeIndent, withinFlowCollection) { var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch; ch = state.input.charCodeAt(state.position); if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 0x23/* # */ || ch === 0x26/* & */ || ch === 0x2A/* * */ || ch === 0x21/* ! */ || ch === 0x7C/* | */ || ch === 0x3E/* > */ || ch === 0x27/* ' */ || ch === 0x22/* " */ || ch === 0x25/* % */ || ch === 0x40/* @ */ || ch === 0x60/* ` */) { return false; } if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { return false; } } state.kind = 'scalar'; state.result = ''; captureStart = captureEnd = state.position; hasPendingContent = false; while (ch !== 0) { if (ch === 0x3A/* : */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { break; } } else if (ch === 0x23/* # */) { preceding = state.input.charCodeAt(state.position - 1); if (is_WS_OR_EOL(preceding)) { break; } } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { break; } else if (is_EOL(ch)) { _line = state.line; _lineStart = state.lineStart; _lineIndent = state.lineIndent; skipSeparationSpace(state, false, -1); if (state.lineIndent >= nodeIndent) { hasPendingContent = true; ch = state.input.charCodeAt(state.position); continue; } else { state.position = captureEnd; state.line = _line; state.lineStart = _lineStart; state.lineIndent = _lineIndent; break; } } if (hasPendingContent) { captureSegment(state, captureStart, captureEnd, false); writeFoldedLines(state, state.line - _line); captureStart = captureEnd = state.position; hasPendingContent = false; } if (!is_WHITE_SPACE(ch)) { captureEnd = state.position + 1; } ch = state.input.charCodeAt(++state.position); } captureSegment(state, captureStart, captureEnd, false); if (state.result) { return true; } state.kind = _kind; state.result = _result; return false; } function readSingleQuotedScalar(state, nodeIndent) { var ch, captureStart, captureEnd; ch = state.input.charCodeAt(state.position); if (ch !== 0x27/* ' */) { return false; } state.kind = 'scalar'; state.result = ''; state.position++; captureStart = captureEnd = state.position; while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x27/* ' */) { captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); if (ch === 0x27/* ' */) { captureStart = state.position; state.position++; captureEnd = state.position; } else { return true; } } else if (is_EOL(ch)) { captureSegment(state, captureStart, captureEnd, true); writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; } else if (state.position === state.lineStart && testDocumentSeparator(state)) { throwError(state, 'unexpected end of the document within a single quoted scalar'); } else { state.position++; captureEnd = state.position; } } throwError(state, 'unexpected end of the stream within a single quoted scalar'); } function readDoubleQuotedScalar(state, nodeIndent) { var captureStart, captureEnd, hexLength, hexResult, tmp, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x22/* " */) { return false; } state.kind = 'scalar'; state.result = ''; state.position++; captureStart = captureEnd = state.position; while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x22/* " */) { captureSegment(state, captureStart, state.position, true); state.position++; return true; } else if (ch === 0x5C/* \ */) { captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); if (is_EOL(ch)) { skipSeparationSpace(state, false, nodeIndent); // TODO: rework to inline fn with no type cast? } else if (ch < 256 && simpleEscapeCheck[ch]) { state.result += simpleEscapeMap[ch]; state.position++; } else if ((tmp = escapedHexLen(ch)) > 0) { hexLength = tmp; hexResult = 0; for (; hexLength > 0; hexLength--) { ch = state.input.charCodeAt(++state.position); if ((tmp = fromHexCode(ch)) >= 0) { hexResult = (hexResult << 4) + tmp; } else { throwError(state, 'expected hexadecimal character'); } } state.result += charFromCodepoint(hexResult); state.position++; } else { throwError(state, 'unknown escape sequence'); } captureStart = captureEnd = state.position; } else if (is_EOL(ch)) { captureSegment(state, captureStart, captureEnd, true); writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; } else if (state.position === state.lineStart && testDocumentSeparator(state)) { throwError(state, 'unexpected end of the document within a double quoted scalar'); } else { state.position++; captureEnd = state.position; } } throwError(state, 'unexpected end of the stream within a double quoted scalar'); } function readFlowCollection(state, nodeIndent) { var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch; ch = state.input.charCodeAt(state.position); if (ch === 0x5B/* [ */) { terminator = 0x5D;/* ] */ isMapping = false; _result = []; } else if (ch === 0x7B/* { */) { terminator = 0x7D;/* } */ isMapping = true; _result = {}; } else { return false; } if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(++state.position); while (ch !== 0) { skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if (ch === terminator) { state.position++; state.tag = _tag; state.anchor = _anchor; state.kind = isMapping ? 'mapping' : 'sequence'; state.result = _result; return true; } else if (!readNext) { throwError(state, 'missed comma between flow collection entries'); } keyTag = keyNode = valueNode = null; isPair = isExplicitPair = false; if (ch === 0x3F/* ? */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following)) { isPair = isExplicitPair = true; state.position++; skipSeparationSpace(state, true, nodeIndent); } } _line = state.line; composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); keyTag = state.tag; keyNode = state.result; skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { isPair = true; ch = state.input.charCodeAt(++state.position); skipSeparationSpace(state, true, nodeIndent); composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); valueNode = state.result; } if (isMapping) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); } else if (isPair) { _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); } else { _result.push(keyNode); } skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if (ch === 0x2C/* , */) { readNext = true; ch = state.input.charCodeAt(++state.position); } else { readNext = false; } } throwError(state, 'unexpected end of the stream within a flow collection'); } function readBlockScalar(state, nodeIndent) { var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch; ch = state.input.charCodeAt(state.position); if (ch === 0x7C/* | */) { folding = false; } else if (ch === 0x3E/* > */) { folding = true; } else { return false; } state.kind = 'scalar'; state.result = ''; while (ch !== 0) { ch = state.input.charCodeAt(++state.position); if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { if (CHOMPING_CLIP === chomping) { chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; } else { throwError(state, 'repeat of a chomping mode identifier'); } } else if ((tmp = fromDecimalCode(ch)) >= 0) { if (tmp === 0) { throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); } else if (!detectedIndent) { textIndent = nodeIndent + tmp - 1; detectedIndent = true; } else { throwError(state, 'repeat of an indentation width identifier'); } } else { break; } } if (is_WHITE_SPACE(ch)) { do { ch = state.input.charCodeAt(++state.position); } while (is_WHITE_SPACE(ch)); if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (!is_EOL(ch) && (ch !== 0)); } } while (ch !== 0) { readLineBreak(state); state.lineIndent = 0; ch = state.input.charCodeAt(state.position); while ((!detectedIndent || state.lineIndent < textIndent) && (ch === 0x20/* Space */)) { state.lineIndent++; ch = state.input.charCodeAt(++state.position); } if (!detectedIndent && state.lineIndent > textIndent) { textIndent = state.lineIndent; } if (is_EOL(ch)) { emptyLines++; continue; } // End of the scalar. if (state.lineIndent < textIndent) { // Perform the chomping. if (chomping === CHOMPING_KEEP) { state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { // i.e. only if the scalar is not empty. state.result += '\n'; } } // Break this `while` cycle and go to the funciton's epilogue. break; } // Folded style: use fancy rules to handle line breaks. if (folding) { // Lines starting with white space characters (more-indented lines) are not folded. if (is_WHITE_SPACE(ch)) { atMoreIndented = true; // except for the first content line (cf. Example 8.1) state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); // End of more-indented block. } else if (atMoreIndented) { atMoreIndented = false; state.result += common.repeat('\n', emptyLines + 1); // Just one line break - perceive as the same line. } else if (emptyLines === 0) { if (didReadContent) { // i.e. only if we have already read some scalar content. state.result += ' '; } // Several line breaks - perceive as different lines. } else { state.result += common.repeat('\n', emptyLines); } // Literal style: just add exact number of line breaks between content lines. } else { // Keep all line breaks except the header line break. state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); } didReadContent = true; detectedIndent = true; emptyLines = 0; captureStart = state.position; while (!is_EOL(ch) && (ch !== 0)) { ch = state.input.charCodeAt(++state.position); } captureSegment(state, captureStart, state.position, false); } return true; } function readBlockSequence(state, nodeIndent) { var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch; if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(state.position); while (ch !== 0) { if (ch !== 0x2D/* - */) { break; } following = state.input.charCodeAt(state.position + 1); if (!is_WS_OR_EOL(following)) { break; } detected = true; state.position++; if (skipSeparationSpace(state, true, -1)) { if (state.lineIndent <= nodeIndent) { _result.push(null); ch = state.input.charCodeAt(state.position); continue; } } _line = state.line; composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); _result.push(state.result); skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { throwError(state, 'bad indentation of a sequence entry'); } else if (state.lineIndent < nodeIndent) { break; } } if (detected) { state.tag = _tag; state.anchor = _anchor; state.kind = 'sequence'; state.result = _result; return true; } return false; } function readBlockMapping(state, nodeIndent, flowIndent) { var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch; if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(state.position); while (ch !== 0) { following = state.input.charCodeAt(state.position + 1); _line = state.line; // Save the current line. _pos = state.position; // // Explicit notation case. There are two separate blocks: // first for the key (denoted by "?") and second for the value (denoted by ":") // if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { if (ch === 0x3F/* ? */) { if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = true; allowCompact = true; } else if (atExplicitKey) { // i.e. 0x3A/* : */ === character after the explicit key. atExplicitKey = false; allowCompact = true; } else { throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); } state.position += 1; ch = following; // // Implicit notation case. Flow-style node as the key first, then ":", and the value. // } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { if (state.line === _line) { ch = state.input.charCodeAt(state.position); while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x3A/* : */) { ch = state.input.charCodeAt(++state.position); if (!is_WS_OR_EOL(ch)) { throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); } if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = false; allowCompact = false; keyTag = state.tag; keyNode = state.result; } else if (detected) { throwError(state, 'can not read an implicit mapping pair; a colon is missed'); } else { state.tag = _tag; state.anchor = _anchor; return true; // Keep the result of `composeNode`. } } else if (detected) { throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); } else { state.tag = _tag; state.anchor = _anchor; return true; // Keep the result of `composeNode`. } } else { break; // Reading is done. Go to the epilogue. } // // Common reading code for both explicit and implicit notations. // if (state.line === _line || state.lineIndent > nodeIndent) { if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { if (atExplicitKey) { keyNode = state.result; } else { valueNode = state.result; } } if (!atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); keyTag = keyNode = valueNode = null; } skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); } if (state.lineIndent > nodeIndent && (ch !== 0)) { throwError(state, 'bad indentation of a mapping entry'); } else if (state.lineIndent < nodeIndent) { break; } } // // Epilogue. // // Special case: last mapping's node contains only the key in explicit notation. if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); } // Expose the resulting mapping. if (detected) { state.tag = _tag; state.anchor = _anchor; state.kind = 'mapping'; state.result = _result; } return detected; } function readTagProperty(state) { var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x21/* ! */) return false; if (state.tag !== null) { throwError(state, 'duplication of a tag property'); } ch = state.input.charCodeAt(++state.position); if (ch === 0x3C/* < */) { isVerbatim = true; ch = state.input.charCodeAt(++state.position); } else if (ch === 0x21/* ! */) { isNamed = true; tagHandle = '!!'; ch = state.input.charCodeAt(++state.position); } else { tagHandle = '!'; } _position = state.position; if (isVerbatim) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0 && ch !== 0x3E/* > */); if (state.position < state.length) { tagName = state.input.slice(_position, state.position); ch = state.input.charCodeAt(++state.position); } else { throwError(state, 'unexpected end of the stream within a verbatim tag'); } } else { while (ch !== 0 && !is_WS_OR_EOL(ch)) { if (ch === 0x21/* ! */) { if (!isNamed) { tagHandle = state.input.slice(_position - 1, state.position + 1); if (!PATTERN_TAG_HANDLE.test(tagHandle)) { throwError(state, 'named tag handle cannot contain such characters'); } isNamed = true; _position = state.position + 1; } else { throwError(state, 'tag suffix cannot contain exclamation marks'); } } ch = state.input.charCodeAt(++state.position); } tagName = state.input.slice(_position, state.position); if (PATTERN_FLOW_INDICATORS.test(tagName)) { throwError(state, 'tag suffix cannot contain flow indicator characters'); } } if (tagName && !PATTERN_TAG_URI.test(tagName)) { throwError(state, 'tag name cannot contain such characters: ' + tagName); } if (isVerbatim) { state.tag = tagName; } else if (_hasOwnProperty$2.call(state.tagMap, tagHandle)) { state.tag = state.tagMap[tagHandle] + tagName; } else if (tagHandle === '!') { state.tag = '!' + tagName; } else if (tagHandle === '!!') { state.tag = 'tag:yaml.org,2002:' + tagName; } else { throwError(state, 'undeclared tag handle "' + tagHandle + '"'); } return true; } function readAnchorProperty(state) { var _position, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x26/* & */) return false; if (state.anchor !== null) { throwError(state, 'duplication of an anchor property'); } ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { throwError(state, 'name of an anchor node must contain at least one character'); } state.anchor = state.input.slice(_position, state.position); return true; } function readAlias(state) { var _position, alias, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x2A/* * */) return false; ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { throwError(state, 'name of an alias node must contain at least one character'); } alias = state.input.slice(_position, state.position); if (!state.anchorMap.hasOwnProperty(alias)) { throwError(state, 'unidentified alias "' + alias + '"'); } state.result = state.anchorMap[alias]; skipSeparationSpace(state, true, -1); return true; } function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { indentStatus = 1; } else if (state.lineIndent === parentIndent) { indentStatus = 0; } else if (state.lineIndent < parentIndent) { indentStatus = -1; } } } if (indentStatus === 1) { while (readTagProperty(state) || readAnchorProperty(state)) { if (skipSeparationSpace(state, true, -1)) { atNewLine = true; allowBlockCollections = allowBlockStyles; if (state.lineIndent > parentIndent) { indentStatus = 1; } else if (state.lineIndent === parentIndent) { indentStatus = 0; } else if (state.lineIndent < parentIndent) { indentStatus = -1; } } else { allowBlockCollections = false; } } } if (allowBlockCollections) { allowBlockCollections = atNewLine || allowCompact; } if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { flowIndent = parentIndent; } else { flowIndent = parentIndent + 1; } blockIndent = state.position - state.lineStart; if (indentStatus === 1) { if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) { hasContent = true; } else { if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) { hasContent = true; } else if (readAlias(state)) { hasContent = true; if (state.tag !== null || state.anchor !== null) { throwError(state, 'alias node should not have any properties'); } } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { hasContent = true; if (state.tag === null) { state.tag = '?'; } } if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } } } else if (indentStatus === 0) { // Special case: block sequences are allowed to have same indentation level as the parent. // http://www.yaml.org/spec/1.2/spec.html#id2799784 hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); } } if (state.tag !== null && state.tag !== '!') { if (state.tag === '?') { // Implicit resolving is not allowed for non-scalar types, and '?' // non-specific tag is only automatically assigned to plain scalars. // // We only need to check kind conformity in case user explicitly assigns '?' // tag, for example like this: "! [0]" // if (state.result !== null && state.kind !== 'scalar') { throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); } for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { type = state.implicitTypes[typeIndex]; if (type.resolve(state.result)) { // `state.result` updated in resolver if matched state.result = type.construct(state.result); state.tag = type.tag; if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } break; } } } else if (_hasOwnProperty$2.call(state.typeMap[state.kind || 'fallback'], state.tag)) { type = state.typeMap[state.kind || 'fallback'][state.tag]; if (state.result !== null && type.kind !== state.kind) { throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); } if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); } else { state.result = type.construct(state.result); if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } } } else { throwError(state, 'unknown tag !<' + state.tag + '>'); } } if (state.listener !== null) { state.listener('close', state); } return state.tag !== null || state.anchor !== null || hasContent; } function readDocument(state) { var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch; state.version = null; state.checkLineBreaks = state.legacy; state.tagMap = {}; state.anchorMap = {}; while ((ch = state.input.charCodeAt(state.position)) !== 0) { skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); if (state.lineIndent > 0 || ch !== 0x25/* % */) { break; } hasDirectives = true; ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } directiveName = state.input.slice(_position, state.position); directiveArgs = []; if (directiveName.length < 1) { throwError(state, 'directive name must not be less than one character in length'); } while (ch !== 0) { while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0 && !is_EOL(ch)); break; } if (is_EOL(ch)) break; _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } directiveArgs.push(state.input.slice(_position, state.position)); } if (ch !== 0) readLineBreak(state); if (_hasOwnProperty$2.call(directiveHandlers, directiveName)) { directiveHandlers[directiveName](state, directiveName, directiveArgs); } else { throwWarning(state, 'unknown document directive "' + directiveName + '"'); } } skipSeparationSpace(state, true, -1); if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D/* - */ && state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { state.position += 3; skipSeparationSpace(state, true, -1); } else if (hasDirectives) { throwError(state, 'directives end mark is expected'); } composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); skipSeparationSpace(state, true, -1); if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { throwWarning(state, 'non-ASCII line breaks are interpreted as content'); } state.documents.push(state.result); if (state.position === state.lineStart && testDocumentSeparator(state)) { if (state.input.charCodeAt(state.position) === 0x2E/* . */) { state.position += 3; skipSeparationSpace(state, true, -1); } return; } if (state.position < (state.length - 1)) { throwError(state, 'end of the stream or a document separator is expected'); } else { return; } } function loadDocuments(input, options) { input = String(input); options = options || {}; if (input.length !== 0) { // Add tailing `\n` if not exists if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { input += '\n'; } // Strip BOM if (input.charCodeAt(0) === 0xFEFF) { input = input.slice(1); } } var state = new State(input, options); var nullpos = input.indexOf('\0'); if (nullpos !== -1) { state.position = nullpos; throwError(state, 'null byte is not allowed in input'); } // Use 0 as string terminator. That significantly simplifies bounds check. state.input += '\0'; while (state.input.charCodeAt(state.position) === 0x20/* Space */) { state.lineIndent += 1; state.position += 1; } while (state.position < (state.length - 1)) { readDocument(state); } return state.documents; } function loadAll(input, iterator, options) { if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { options = iterator; iterator = null; } var documents = loadDocuments(input, options); if (typeof iterator !== 'function') { return documents; } for (var index = 0, length = documents.length; index < length; index += 1) { iterator(documents[index]); } } function load(input, options) { var documents = loadDocuments(input, options); if (documents.length === 0) { /*eslint-disable no-undefined*/ return undefined; } else if (documents.length === 1) { return documents[0]; } throw new exception('expected a single document in the stream, but found more'); } function safeLoadAll(input, iterator, options) { if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { options = iterator; iterator = null; } return loadAll(input, iterator, common.extend({ schema: default_safe }, options)); } function safeLoad(input, options) { return load(input, common.extend({ schema: default_safe }, options)); } var loadAll_1 = loadAll; var load_1 = load; var safeLoadAll_1 = safeLoadAll; var safeLoad_1 = safeLoad; var loader = { loadAll: loadAll_1, load: load_1, safeLoadAll: safeLoadAll_1, safeLoad: safeLoad_1 }; /*eslint-disable no-use-before-define*/ var _toString$2 = Object.prototype.toString; var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; var CHAR_TAB = 0x09; /* Tab */ var CHAR_LINE_FEED = 0x0A; /* LF */ var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ var CHAR_SPACE = 0x20; /* Space */ var CHAR_EXCLAMATION = 0x21; /* ! */ var CHAR_DOUBLE_QUOTE = 0x22; /* " */ var CHAR_SHARP = 0x23; /* # */ var CHAR_PERCENT = 0x25; /* % */ var CHAR_AMPERSAND = 0x26; /* & */ var CHAR_SINGLE_QUOTE = 0x27; /* ' */ var CHAR_ASTERISK = 0x2A; /* * */ var CHAR_COMMA = 0x2C; /* , */ var CHAR_MINUS = 0x2D; /* - */ var CHAR_COLON = 0x3A; /* : */ var CHAR_EQUALS = 0x3D; /* = */ var CHAR_GREATER_THAN = 0x3E; /* > */ var CHAR_QUESTION = 0x3F; /* ? */ var CHAR_COMMERCIAL_AT = 0x40; /* @ */ var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ var CHAR_GRAVE_ACCENT = 0x60; /* ` */ var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ var CHAR_VERTICAL_LINE = 0x7C; /* | */ var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ var ESCAPE_SEQUENCES = {}; ESCAPE_SEQUENCES[0x00] = '\\0'; ESCAPE_SEQUENCES[0x07] = '\\a'; ESCAPE_SEQUENCES[0x08] = '\\b'; ESCAPE_SEQUENCES[0x09] = '\\t'; ESCAPE_SEQUENCES[0x0A] = '\\n'; ESCAPE_SEQUENCES[0x0B] = '\\v'; ESCAPE_SEQUENCES[0x0C] = '\\f'; ESCAPE_SEQUENCES[0x0D] = '\\r'; ESCAPE_SEQUENCES[0x1B] = '\\e'; ESCAPE_SEQUENCES[0x22] = '\\"'; ESCAPE_SEQUENCES[0x5C] = '\\\\'; ESCAPE_SEQUENCES[0x85] = '\\N'; ESCAPE_SEQUENCES[0xA0] = '\\_'; ESCAPE_SEQUENCES[0x2028] = '\\L'; ESCAPE_SEQUENCES[0x2029] = '\\P'; var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ]; function compileStyleMap(schema, map) { var result, keys, index, length, tag, style, type; if (map === null) return {}; result = {}; keys = Object.keys(map); for (index = 0, length = keys.length; index < length; index += 1) { tag = keys[index]; style = String(map[tag]); if (tag.slice(0, 2) === '!!') { tag = 'tag:yaml.org,2002:' + tag.slice(2); } type = schema.compiledTypeMap['fallback'][tag]; if (type && _hasOwnProperty$3.call(type.styleAliases, style)) { style = type.styleAliases[style]; } result[tag] = style; } return result; } function encodeHex(character) { var string, handle, length; string = character.toString(16).toUpperCase(); if (character <= 0xFF) { handle = 'x'; length = 2; } else if (character <= 0xFFFF) { handle = 'u'; length = 4; } else if (character <= 0xFFFFFFFF) { handle = 'U'; length = 8; } else { throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); } return '\\' + handle + common.repeat('0', length - string.length) + string; } function State$1(options) { this.schema = options['schema'] || default_full; this.indent = Math.max(1, (options['indent'] || 2)); this.noArrayIndent = options['noArrayIndent'] || false; this.skipInvalid = options['skipInvalid'] || false; this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); this.styleMap = compileStyleMap(this.schema, options['styles'] || null); this.sortKeys = options['sortKeys'] || false; this.lineWidth = options['lineWidth'] || 80; this.noRefs = options['noRefs'] || false; this.noCompatMode = options['noCompatMode'] || false; this.condenseFlow = options['condenseFlow'] || false; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; this.tag = null; this.result = ''; this.duplicates = []; this.usedDuplicates = null; } // Indents every line in a string. Empty lines (\n only) are not indented. function indentString(string, spaces) { var ind = common.repeat(' ', spaces), position = 0, next = -1, result = '', line, length = string.length; while (position < length) { next = string.indexOf('\n', position); if (next === -1) { line = string.slice(position); position = length; } else { line = string.slice(position, next + 1); position = next + 1; } if (line.length && line !== '\n') result += ind; result += line; } return result; } function generateNextLine(state, level) { return '\n' + common.repeat(' ', state.indent * level); } function testImplicitResolving(state, str) { var index, length, type; for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { type = state.implicitTypes[index]; if (type.resolve(str)) { return true; } } return false; } // [33] s-white ::= s-space | s-tab function isWhitespace(c) { return c === CHAR_SPACE || c === CHAR_TAB; } // Returns true if the character can be printed without escaping. // From YAML 1.2: "any allowed characters known to be non-printable // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. function isPrintable(c) { return (0x00020 <= c && c <= 0x00007E) || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) || (0x10000 <= c && c <= 0x10FFFF); } // [34] ns-char ::= nb-char - s-white // [27] nb-char ::= c-printable - b-char - c-byte-order-mark // [26] b-char ::= b-line-feed | b-carriage-return // [24] b-line-feed ::= #xA /* LF */ // [25] b-carriage-return ::= #xD /* CR */ // [3] c-byte-order-mark ::= #xFEFF function isNsChar(c) { return isPrintable(c) && !isWhitespace(c) // byte-order-mark && c !== 0xFEFF // b-char && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED; } // Simplified test for values allowed after the first character in plain style. function isPlainSafe(c, prev) { // Uses a subset of nb-char - c-flow-indicator - ":" - "#" // where nb-char ::= c-printable - b-char - c-byte-order-mark. return isPrintable(c) && c !== 0xFEFF // - c-flow-indicator && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // - ":" - "#" // /* An ns-char preceding */ "#" && c !== CHAR_COLON && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); } // Simplified test for values allowed as the first character in plain style. function isPlainSafeFirst(c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. return isPrintable(c) && c !== 0xFEFF && !isWhitespace(c) // - s-white // - (c-indicator ::= // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE // | “%” | “@” | “`”) && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT; } // Determines whether block indentation indicator is required. function needIndentIndicator(string) { var leadingSpaceRe = /^\n* /; return leadingSpaceRe.test(string); } var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5; // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. // Pre-conditions: str.length > 0. // Post-conditions: // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { var i; var char, prev_char; var hasLineBreak = false; var hasFoldableLine = false; // only checked if shouldTrackWidth var shouldTrackWidth = lineWidth !== -1; var previousLineBreak = -1; // count the first line correctly var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1)); if (singleLineOnly) { // Case: no block styles. // Check for disallowed characters to rule out plain and single. for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (!isPrintable(char)) { return STYLE_DOUBLE; } prev_char = i > 0 ? string.charCodeAt(i - 1) : null; plain = plain && isPlainSafe(char, prev_char); } } else { // Case: block styles permitted. for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (char === CHAR_LINE_FEED) { hasLineBreak = true; // Check if any line can be folded. if (shouldTrackWidth) { hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' '); previousLineBreak = i; } } else if (!isPrintable(char)) { return STYLE_DOUBLE; } prev_char = i > 0 ? string.charCodeAt(i - 1) : null; plain = plain && isPlainSafe(char, prev_char); } // in case the end is missing a \n hasFoldableLine = hasFoldableLine || (shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ')); } // Although every style can represent \n without escaping, prefer block styles // for multiline, since they're more readable and they don't add empty lines. // Also prefer folding a super-long line. if (!hasLineBreak && !hasFoldableLine) { // Strings interpretable as another type have to be quoted; // e.g. the string 'true' vs. the boolean true. return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE; } // Edge case: block indentation indicator can only have one digit. if (indentPerLevel > 9 && needIndentIndicator(string)) { return STYLE_DOUBLE; } // At this point we know block styles are valid. // Prefer literal style unless we want to fold. return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; } // Note: line breaking/folding is implemented for only the folded style. // NB. We drop the last trailing newline (if any) of a returned block scalar // since the dumper adds its own newline. This always works: // • No ending newline => unaffected; already using strip "-" chomping. // • Ending newline => removed then restored. // Importantly, this keeps the "+" chomp indicator from gaining an extra line. function writeScalar(state, string, level, iskey) { state.dump = (function () { if (string.length === 0) { return "''"; } if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { return "'" + string + "'"; } var indent = state.indent * Math.max(1, level); // no 0-indent scalars // As indentation gets deeper, let the width decrease monotonically // to the lower bound min(state.lineWidth, 40). // Note that this implies // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. // state.lineWidth > 40 + state.indent: width decreases until the lower bound. // This behaves better than a constant minimum width which disallows narrower options, // or an indent threshold which causes the width to suddenly increase. var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); // Without knowing if keys are implicit/explicit, assume implicit for safety. var singleLineOnly = iskey // No block styles in flow mode. || (state.flowLevel > -1 && level >= state.flowLevel); function testAmbiguity(string) { return testImplicitResolving(state, string); } switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { case STYLE_PLAIN: return string; case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'"; case STYLE_LITERAL: return '|' + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent)); case STYLE_FOLDED: return '>' + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); case STYLE_DOUBLE: return '"' + escapeString(string) + '"'; default: throw new exception('impossible error: invalid scalar style'); } }()); } // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. function blockHeader(string, indentPerLevel) { var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; // note the special case: the string '\n' counts as a "trailing" empty line. var clip = string[string.length - 1] === '\n'; var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); var chomp = keep ? '+' : (clip ? '' : '-'); return indentIndicator + chomp + '\n'; } // (See the note for writeScalar.) function dropEndingNewline(string) { return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; } // Note: a long line without a suitable break point will exceed the width limit. // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. function foldString(string, width) { // In folded style, $k$ consecutive newlines output as $k+1$ newlines— // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. // Therefore, parse each chunk as newline(s) followed by a content line. var lineRe = /(\n+)([^\n]*)/g; // first line (possibly an empty line) var result = (function () { var nextLF = string.indexOf('\n'); nextLF = nextLF !== -1 ? nextLF : string.length; lineRe.lastIndex = nextLF; return foldLine(string.slice(0, nextLF), width); }()); // If we haven't reached the first content line yet, don't add an extra \n. var prevMoreIndented = string[0] === '\n' || string[0] === ' '; var moreIndented; // rest of the lines var match; while ((match = lineRe.exec(string))) { var prefix = match[1], line = match[2]; moreIndented = (line[0] === ' '); result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') + foldLine(line, width); prevMoreIndented = moreIndented; } return result; } // Greedy line breaking. // Picks the longest line under the limit each time, // otherwise settles for the shortest line over the limit. // NB. More-indented lines *cannot* be folded, as that would add an extra \n. function foldLine(line, width) { if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space. var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. var match; // start is an inclusive index. end, curr, and next are exclusive. var start = 0, end, curr = 0, next = 0; var result = ''; // Invariants: 0 <= start <= length-1. // 0 <= curr <= next <= max(0, length-2). curr - start <= width. // Inside the loop: // A match implies length >= 2, so curr and next are <= length-2. while ((match = breakRe.exec(line))) { next = match.index; // maintain invariant: curr - start <= width if (next - start > width) { end = (curr > start) ? curr : next; // derive end <= length-2 result += '\n' + line.slice(start, end); // skip the space that was output as \n start = end + 1; // derive start <= length-1 } curr = next; } // By the invariants, start <= length-1, so there is something left over. // It is either the whole string or a part starting from non-whitespace. result += '\n'; // Insert a break if the remainder is too long and there is a break available. if (line.length - start > width && curr > start) { result += line.slice(start, curr) + '\n' + line.slice(curr + 1); } else { result += line.slice(start); } return result.slice(1); // drop extra \n joiner } // Escapes a double-quoted string. function escapeString(string) { var result = ''; var char, nextChar; var escapeSeq; for (var i = 0; i < string.length; i++) { char = string.charCodeAt(i); // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { nextChar = string.charCodeAt(i + 1); if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { // Combine the surrogate pair and store it escaped. result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); // Advance index one extra since we already used that char here. i++; continue; } } escapeSeq = ESCAPE_SEQUENCES[char]; result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char); } return result; } function writeFlowSequence(state, level, object) { var _result = '', _tag = state.tag, index, length; for (index = 0, length = object.length; index < length; index += 1) { // Write only valid elements. if (writeNode(state, level, object[index], false, false)) { if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); _result += state.dump; } } state.tag = _tag; state.dump = '[' + _result + ']'; } function writeBlockSequence(state, level, object, compact) { var _result = '', _tag = state.tag, index, length; for (index = 0, length = object.length; index < length; index += 1) { // Write only valid elements. if (writeNode(state, level + 1, object[index], true, true)) { if (!compact || index !== 0) { _result += generateNextLine(state, level); } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { _result += '-'; } else { _result += '- '; } _result += state.dump; } } state.tag = _tag; state.dump = _result || '[]'; // Empty sequence if no valid values. } function writeFlowMapping(state, level, object) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer; for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; if (index !== 0) pairBuffer += ', '; if (state.condenseFlow) pairBuffer += '"'; objectKey = objectKeyList[index]; objectValue = object[objectKey]; if (!writeNode(state, level, objectKey, false, false)) { continue; // Skip this pair because of invalid key; } if (state.dump.length > 1024) pairBuffer += '? '; pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); if (!writeNode(state, level, objectValue, false, false)) { continue; // Skip this pair because of invalid value. } pairBuffer += state.dump; // Both key and value are valid. _result += pairBuffer; } state.tag = _tag; state.dump = '{' + _result + '}'; } function writeBlockMapping(state, level, object, compact) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer; // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { // Default sorting objectKeyList.sort(); } else if (typeof state.sortKeys === 'function') { // Custom sort function objectKeyList.sort(state.sortKeys); } else if (state.sortKeys) { // Something is wrong throw new exception('sortKeys must be a boolean or a function'); } for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; if (!compact || index !== 0) { pairBuffer += generateNextLine(state, level); } objectKey = objectKeyList[index]; objectValue = object[objectKey]; if (!writeNode(state, level + 1, objectKey, true, true, true)) { continue; // Skip this pair because of invalid key. } explicitPair = (state.tag !== null && state.tag !== '?') || (state.dump && state.dump.length > 1024); if (explicitPair) { if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += '?'; } else { pairBuffer += '? '; } } pairBuffer += state.dump; if (explicitPair) { pairBuffer += generateNextLine(state, level); } if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { continue; // Skip this pair because of invalid value. } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += ':'; } else { pairBuffer += ': '; } pairBuffer += state.dump; // Both key and value are valid. _result += pairBuffer; } state.tag = _tag; state.dump = _result || '{}'; // Empty mapping if no valid pairs. } function detectType(state, object, explicit) { var _result, typeList, index, length, type, style; typeList = explicit ? state.explicitTypes : state.implicitTypes; for (index = 0, length = typeList.length; index < length; index += 1) { type = typeList[index]; if ((type.instanceOf || type.predicate) && (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && (!type.predicate || type.predicate(object))) { state.tag = explicit ? type.tag : '?'; if (type.represent) { style = state.styleMap[type.tag] || type.defaultStyle; if (_toString$2.call(type.represent) === '[object Function]') { _result = type.represent(object, style); } else if (_hasOwnProperty$3.call(type.represent, style)) { _result = type.represent[style](object, style); } else { throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); } state.dump = _result; } return true; } } return false; } // Serializes `object` and writes it to global `result`. // Returns true on success, or false on invalid object. // function writeNode(state, level, object, block, compact, iskey) { state.tag = null; state.dump = object; if (!detectType(state, object, false)) { detectType(state, object, true); } var type = _toString$2.call(state.dump); if (block) { block = (state.flowLevel < 0 || state.flowLevel > level); } var objectOrArray = type === '[object Object]' || type === '[object Array]', duplicateIndex, duplicate; if (objectOrArray) { duplicateIndex = state.duplicates.indexOf(object); duplicate = duplicateIndex !== -1; } if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { compact = false; } if (duplicate && state.usedDuplicates[duplicateIndex]) { state.dump = '*ref_' + duplicateIndex; } else { if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { state.usedDuplicates[duplicateIndex] = true; } if (type === '[object Object]') { if (block && (Object.keys(state.dump).length !== 0)) { writeBlockMapping(state, level, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowMapping(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object Array]') { var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; if (block && (state.dump.length !== 0)) { writeBlockSequence(state, arrayLevel, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowSequence(state, arrayLevel, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object String]') { if (state.tag !== '?') { writeScalar(state, state.dump, level, iskey); } } else { if (state.skipInvalid) return false; throw new exception('unacceptable kind of an object to dump ' + type); } if (state.tag !== null && state.tag !== '?') { state.dump = '!<' + state.tag + '> ' + state.dump; } } return true; } function getDuplicateReferences(object, state) { var objects = [], duplicatesIndexes = [], index, length; inspectNode(object, objects, duplicatesIndexes); for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { state.duplicates.push(objects[duplicatesIndexes[index]]); } state.usedDuplicates = new Array(length); } function inspectNode(object, objects, duplicatesIndexes) { var objectKeyList, index, length; if (object !== null && typeof object === 'object') { index = objects.indexOf(object); if (index !== -1) { if (duplicatesIndexes.indexOf(index) === -1) { duplicatesIndexes.push(index); } } else { objects.push(object); if (Array.isArray(object)) { for (index = 0, length = object.length; index < length; index += 1) { inspectNode(object[index], objects, duplicatesIndexes); } } else { objectKeyList = Object.keys(object); for (index = 0, length = objectKeyList.length; index < length; index += 1) { inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); } } } } } function dump(input, options) { options = options || {}; var state = new State$1(options); if (!state.noRefs) getDuplicateReferences(input, state); if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; return ''; } function safeDump(input, options) { return dump(input, common.extend({ schema: default_safe }, options)); } var dump_1 = dump; var safeDump_1 = safeDump; var dumper = { dump: dump_1, safeDump: safeDump_1 }; function deprecated(name) { return function () { throw new Error('Function ' + name + ' is deprecated and cannot be used.'); }; } var Type$1 = type; var Schema$1 = schema; var FAILSAFE_SCHEMA = failsafe; var JSON_SCHEMA = json; var CORE_SCHEMA = core; var DEFAULT_SAFE_SCHEMA = default_safe; var DEFAULT_FULL_SCHEMA = default_full; var load$1 = loader.load; var loadAll$1 = loader.loadAll; var safeLoad$1 = loader.safeLoad; var safeLoadAll$1 = loader.safeLoadAll; var dump$1 = dumper.dump; var safeDump$1 = dumper.safeDump; var YAMLException$1 = exception; // Deprecated schema names from JS-YAML 2.0.x var MINIMAL_SCHEMA = failsafe; var SAFE_SCHEMA = default_safe; var DEFAULT_SCHEMA = default_full; // Deprecated functions from JS-YAML 1.x.x var scan = deprecated('scan'); var parse = deprecated('parse'); var compose = deprecated('compose'); var addConstructor = deprecated('addConstructor'); var jsYaml = { Type: Type$1, Schema: Schema$1, FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, JSON_SCHEMA: JSON_SCHEMA, CORE_SCHEMA: CORE_SCHEMA, DEFAULT_SAFE_SCHEMA: DEFAULT_SAFE_SCHEMA, DEFAULT_FULL_SCHEMA: DEFAULT_FULL_SCHEMA, load: load$1, loadAll: loadAll$1, safeLoad: safeLoad$1, safeLoadAll: safeLoadAll$1, dump: dump$1, safeDump: safeDump$1, YAMLException: YAMLException$1, MINIMAL_SCHEMA: MINIMAL_SCHEMA, SAFE_SCHEMA: SAFE_SCHEMA, DEFAULT_SCHEMA: DEFAULT_SCHEMA, scan: scan, parse: parse, compose: compose, addConstructor: addConstructor }; var jsYaml$1 = jsYaml; const {DEFAULT_DATE_FORMAT: DEFAULT_DATE_FORMAT$1, DATE_REGEX: DATE_REGEX$1} = constants; /** * From note-refactor-obsidian */ const index = class Templates { isValidYaml(input) { try{ jsYaml$1.dump(jsYaml$1.load(String(input))); return true } catch (error){ return false } } replace(input, moment) { //A regex to capture multiple matches, each with a target group ({date:YYMMDD}) and date group (YYMMDD) const dateRegex = DATE_REGEX$1; const customFolderString = input; //Iterate through the matches to collect them in a single array const matches = []; let match; while (match = dateRegex.exec(customFolderString)) { matches.push(match); } //Return the custom folder setting value if no dates are found if (!matches || matches.length === 0) { return input; } //Transform date matches into moment formatted dates const formattedDates = matches.map(m => { //Default to YYYYMMDDHHmm if {{date}} is used const dateFormat = m.groups.date === '' ? DEFAULT_DATE_FORMAT$1 : m.groups.date; return [m.groups.target, moment.format(dateFormat)]; }); //Check to see if any date formatting is needed. If not return the unformatted setting text. let output = customFolderString; formattedDates.forEach(fd => { output = output.replace(fd[0], fd[1]); }); return output; } }; var template = index; var moment = createCommonjsModule(function (module, exports) { (function (global, factory) { module.exports = factory() ; }(commonjsGlobal, (function () { var hookCallback; function hooks() { return hookCallback.apply(null, arguments); } // This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback(callback) { hookCallback = callback; } function isArray(input) { return ( input instanceof Array || Object.prototype.toString.call(input) === '[object Array]' ); } function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return ( input != null && Object.prototype.toString.call(input) === '[object Object]' ); } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return Object.getOwnPropertyNames(obj).length === 0; } else { var k; for (k in obj) { if (hasOwnProp(obj, k)) { return false; } } return true; } } function isUndefined(input) { return input === void 0; } function isNumber(input) { return ( typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]' ); } function isDate(input) { return ( input instanceof Date || Object.prototype.toString.call(input) === '[object Date]' ); } function map(arr, fn) { var res = [], i; for (i = 0; i < arr.length; ++i) { res.push(fn(arr[i], i)); } return res; } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, 'toString')) { a.toString = b.toString; } if (hasOwnProp(b, 'valueOf')) { a.valueOf = b.valueOf; } return a; } function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); } function defaultParsingFlags() { // We need to deep clone this object. return { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false, }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function (fun) { var t = Object(this), len = t.length >>> 0, i; for (i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m), parsedParts = some.call(flags.parsedDateParts, function (i) { return i != null; }), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || (flags.meridiem && parsedParts)); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } } return m._isValid; } function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. var momentProperties = (hooks.momentProperties = []), updateInProgress = false; function copyConfig(to, from) { var i, prop, val; if (!isUndefined(from._isAMomentObject)) { to._isAMomentObject = from._isAMomentObject; } if (!isUndefined(from._i)) { to._i = from._i; } if (!isUndefined(from._f)) { to._f = from._f; } if (!isUndefined(from._l)) { to._l = from._l; } if (!isUndefined(from._strict)) { to._strict = from._strict; } if (!isUndefined(from._tzm)) { to._tzm = from._tzm; } if (!isUndefined(from._isUTC)) { to._isUTC = from._isUTC; } if (!isUndefined(from._offset)) { to._offset = from._offset; } if (!isUndefined(from._pf)) { to._pf = getParsingFlags(from); } if (!isUndefined(from._locale)) { to._locale = from._locale; } if (momentProperties.length > 0) { for (i = 0; i < momentProperties.length; i++) { prop = momentProperties[i]; val = from[prop]; if (!isUndefined(val)) { to[prop] = val; } } } return to; } // Moment prototype object function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment(obj) { return ( obj instanceof Moment || (obj != null && obj._isAMomentObject != null) ); } function warn(msg) { if ( hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn ) { console.warn('Deprecation warning: ' + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = [], arg, i, key; for (i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (key in arguments[0]) { if (hasOwnProp(arguments[0], key)) { arg += key + ': ' + arguments[0][key] + ', '; } } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn( msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack ); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return ( (typeof Function !== 'undefined' && input instanceof Function) || Object.prototype.toString.call(input) === '[object Function]' ); } function set(config) { var prop, i; for (i in config) { if (hasOwnProp(config, i)) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this['_' + i] = prop; } } } this._config = config; // Lenient ordinal parsing accepts just a number in addition to // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. // TODO: Remove "ordinalParse" fallback in next major release. this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source ); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if ( hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop]) ) { // make sure changes to properties don't modify parent config res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function (obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var defaultCalendar = { sameDay: '[Today at] LT', nextDay: '[Tomorrow at] LT', nextWeek: 'dddd [at] LT', lastDay: '[Yesterday at] LT', lastWeek: '[Last] dddd [at] LT', sameElse: 'L', }; function calendar(key, mom, now) { var output = this._calendar[key] || this._calendar['sameElse']; return isFunction(output) ? output.call(mom, now) : output; } function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return ( (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber ); } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; // token: 'M' // padded: ['MM', 2] // ordinal: 'Mo' // callback: function () { this.month() + 1 } function addFormatToken(token, padded, ordinal, callback) { var func = callback; if (typeof callback === 'string') { func = function () { return this[callback](); }; } if (token) { formatTokenFunctions[token] = func; } if (padded) { formatTokenFunctions[padded[0]] = function () { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal) { formatTokenFunctions[ordinal] = function () { return this.localeData().ordinal( func.apply(this, arguments), token ); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ''); } return input.replace(/\\/g, ''); } function makeFormatFunction(format) { var array = format.match(formattingTokens), i, length; for (i = 0, length = array.length; i < length; i++) { if (formatTokenFunctions[array[i]]) { array[i] = formatTokenFunctions[array[i]]; } else { array[i] = removeFormattingTokens(array[i]); } } return function (mom) { var output = '', i; for (i = 0; i < length; i++) { output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } return output; }; } // format date using native date object function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); } function expandFormat(format, locale) { var i = 5; function replaceLongDateFormatTokens(input) { return locale.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i >= 0 && localFormattingTokens.test(format)) { format = format.replace( localFormattingTokens, replaceLongDateFormatTokens ); localFormattingTokens.lastIndex = 0; i -= 1; } return format; } var defaultLongDateFormat = { LTS: 'h:mm:ss A', LT: 'h:mm A', L: 'MM/DD/YYYY', LL: 'MMMM D, YYYY', LLL: 'MMMM D, YYYY h:mm A', LLLL: 'dddd, MMMM D, YYYY h:mm A', }; function longDateFormat(key) { var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format || !formatUpper) { return format; } this._longDateFormat[key] = formatUpper .match(formattingTokens) .map(function (tok) { if ( tok === 'MMMM' || tok === 'MM' || tok === 'DD' || tok === 'dddd' ) { return tok.slice(1); } return tok; }) .join(''); return this._longDateFormat[key]; } var defaultInvalidDate = 'Invalid date'; function invalidDate() { return this._invalidDate; } var defaultOrdinal = '%d', defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal(number) { return this._ordinal.replace('%d', number); } var defaultRelativeTime = { future: 'in %s', past: '%s ago', s: 'a few seconds', ss: '%d seconds', m: 'a minute', mm: '%d minutes', h: 'an hour', hh: '%d hours', d: 'a day', dd: '%d days', w: 'a week', ww: '%d weeks', M: 'a month', MM: '%d months', y: 'a year', yy: '%d years', }; function relativeTime(number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture(diff, output) { var format = this._relativeTime[diff > 0 ? 'future' : 'past']; return isFunction(format) ? format(output) : format.replace(/%s/i, output); } var aliases = {}; function addUnitAlias(unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = [], u; for (u in unitsObj) { if (hasOwnProp(unitsObj, u)) { units.push({ unit: u, priority: priorities[u] }); } } units.sort(function (a, b) { return a.priority - b.priority; }); return units; } function isLeapYear(year) { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } function absFloor(number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } function makeGetSet(unit, keepTime) { return function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get(mom, unit) { return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; } function set$1(mom, unit, value) { if (mom.isValid() && !isNaN(value)) { if ( unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29 ) { value = toInt(value); mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( value, mom.month(), daysInMonth(value, mom.month()) ); } else { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); } } } // MOMENTS function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet(units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units), i; for (i = 0; i < prioritized.length; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } var match1 = /\d/, // 0 - 9 match2 = /\d\d/, // 00 - 99 match3 = /\d{3}/, // 000 - 999 match4 = /\d{4}/, // 0000 - 9999 match6 = /[+-]?\d{6}/, // -999999 - 999999 match1to2 = /\d\d?/, // 0 - 99 match3to4 = /\d\d\d\d?/, // 999 - 9999 match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 match1to3 = /\d{1,3}/, // 0 - 999 match1to4 = /\d{1,4}/, // 0 - 9999 match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 matchUnsigned = /\d+/, // 0 - inf matchSigned = /[+-]?\d+/, // -inf - inf matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 // any word (or two) characters or numbers including two/three word month in arabic. // includes scottish gaelic two word and hyphenated months matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, regexes; regexes = {}; function addRegexToken(token, regex, strictRegex) { regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { return isStrict && strictRegex ? strictRegex : regex; }; } function getParseRegexForToken(token, config) { if (!hasOwnProp(regexes, token)) { return new RegExp(unescapeFormat(token)); } return regexes[token](config._strict, config._locale); } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function unescapeFormat(s) { return regexEscape( s .replace('\\', '') .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function ( matched, p1, p2, p3, p4 ) { return p1 || p2 || p3 || p4; }) ); } function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } var tokens = {}; function addParseToken(token, callback) { var i, func = callback; if (typeof token === 'string') { token = [token]; } if (isNumber(callback)) { func = function (input, array) { array[callback] = toInt(input); }; } for (i = 0; i < token.length; i++) { tokens[token[i]] = func; } } function addWeekParseToken(token, callback) { addParseToken(token, function (input, array, config, token) { config._w = config._w || {}; callback(input, config._w, config, token); }); } function addTimeToArrayFromToken(token, input, config) { if (input != null && hasOwnProp(tokens, token)) { tokens[token](input, config._a, config, token); } } var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8; function mod(n, x) { return ((n % x) + x) % x; } var indexOf; if (Array.prototype.indexOf) { indexOf = Array.prototype.indexOf; } else { indexOf = function (o) { // I know var i; for (i = 0; i < this.length; ++i) { if (this[i] === o) { return i; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - ((modMonth % 7) % 2); } // FORMATTING addFormatToken('M', ['MM', 2], 'Mo', function () { return this.month() + 1; }); addFormatToken('MMM', 0, 0, function (format) { return this.localeData().monthsShort(this, format); }); addFormatToken('MMMM', 0, 0, function (format) { return this.localeData().months(this, format); }); // ALIASES addUnitAlias('month', 'M'); // PRIORITY addUnitPriority('month', 8); // PARSING addRegexToken('M', match1to2); addRegexToken('MM', match1to2, match2); addRegexToken('MMM', function (isStrict, locale) { return locale.monthsShortRegex(isStrict); }); addRegexToken('MMMM', function (isStrict, locale) { return locale.monthsRegex(isStrict); }); addParseToken(['M', 'MM'], function (input, array) { array[MONTH] = toInt(input) - 1; }); addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (month != null) { array[MONTH] = month; } else { getParsingFlags(config).invalidMonth = input; } }); // LOCALES var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( '_' ), defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split( '_' ), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord; function localeMonths(m, format) { if (!m) { return isArray(this._months) ? this._months : this._months['standalone']; } return isArray(this._months) ? this._months[m.month()] : this._months[ (this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone' ][m.month()]; } function localeMonthsShort(m, format) { if (!m) { return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; } return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[ MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' ][m.month()]; } function handleStrictParse(monthName, format, strict) { var i, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { // this is not used this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i = 0; i < 12; ++i) { mom = createUTC([2000, i]); this._shortMonthsParse[i] = this.monthsShort( mom, '' ).toLocaleLowerCase(); this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse(monthName, format, strict) { var i, mom, regex; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } // TODO: add sorting // Sorting makes sure if one month (or abbr) is a prefix of another // see sorting in computeMonthsParse for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); if (strict && !this._longMonthsParse[i]) { this._longMonthsParse[i] = new RegExp( '^' + this.months(mom, '').replace('.', '') + '$', 'i' ); this._shortMonthsParse[i] = new RegExp( '^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i' ); } if (!strict && !this._monthsParse[i]) { regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName) ) { return i; } else if ( strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName) ) { return i; } else if (!strict && this._monthsParse[i].test(monthName)) { return i; } } } // MOMENTS function setMonth(mom, value) { var dayOfMonth; if (!mom.isValid()) { // No op return mom; } if (typeof value === 'string') { if (/^\d+$/.test(value)) { value = toInt(value); } else { value = mom.localeData().monthsParse(value); // TODO: Another silent failure? if (!isNumber(value)) { return mom; } } } dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); return mom; } function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } } function getDaysInMonth() { return daysInMonth(this.year(), this.month()); } function monthsShortRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, '_monthsShortRegex')) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } function monthsRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, '_monthsRegex')) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse() { function cmpLenRev(a, b) { return b.length - a.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i, mom; for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); shortPieces.push(this.monthsShort(mom, '')); longPieces.push(this.months(mom, '')); mixedPieces.push(this.months(mom, '')); mixedPieces.push(this.monthsShort(mom, '')); } // Sorting makes sure if one month (or abbr) is a prefix of another it // will match the longer piece. shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i = 0; i < 12; i++) { shortPieces[i] = regexEscape(shortPieces[i]); longPieces[i] = regexEscape(longPieces[i]); } for (i = 0; i < 24; i++) { mixedPieces[i] = regexEscape(mixedPieces[i]); } this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._monthsShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); } // FORMATTING addFormatToken('Y', 0, 0, function () { var y = this.year(); return y <= 9999 ? zeroFill(y, 4) : '+' + y; }); addFormatToken(0, ['YY', 2], 0, function () { return this.year() % 100; }); addFormatToken(0, ['YYYY', 4], 0, 'year'); addFormatToken(0, ['YYYYY', 5], 0, 'year'); addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES addUnitAlias('year', 'y'); // PRIORITIES addUnitPriority('year', 1); // PARSING addRegexToken('Y', matchSigned); addRegexToken('YY', match1to2, match2); addRegexToken('YYYY', match1to4, match4); addRegexToken('YYYYY', match1to6, match6); addRegexToken('YYYYYY', match1to6, match6); addParseToken(['YYYYY', 'YYYYYY'], YEAR); addParseToken('YYYY', function (input, array) { array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken('YY', function (input, array) { array[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken('Y', function (input, array) { array[YEAR] = parseInt(input, 10); }); // HELPERS function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } // HOOKS hooks.parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }; // MOMENTS var getSetYear = makeGetSet('FullYear', true); function getIsLeapYear() { return isLeapYear(this.year()); } function createDate(y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 var date; // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset date = new Date(y + 400, m, d, h, M, s, ms); if (isFinite(date.getFullYear())) { date.setFullYear(y); } } else { date = new Date(y, m, d, h, M, s, ms); } return date; } function createUTCDate(y) { var date, args; // the Date.UTC function remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { args = Array.prototype.slice.call(arguments); // preserve leap years using a full 400 year cycle, then reset args[0] = y + 400; date = new Date(Date.UTC.apply(null, args)); if (isFinite(date.getUTCFullYear())) { date.setUTCFullYear(y); } } else { date = new Date(Date.UTC.apply(null, arguments)); } return date; } // start-of-first-week - start-of-year function firstWeekOffset(year, dow, doy) { var // first-week day -- which january is always in the first week (4 for iso, 1 for other) fwd = 7 + dow - doy, // first-week day local weekday -- which local weekday is fwd fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear, }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear, }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } // FORMATTING addFormatToken('w', ['ww', 2], 'wo', 'week'); addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES addUnitAlias('week', 'w'); addUnitAlias('isoWeek', 'W'); // PRIORITIES addUnitPriority('week', 5); addUnitPriority('isoWeek', 5); // PARSING addRegexToken('w', match1to2); addRegexToken('ww', match1to2, match2); addRegexToken('W', match1to2); addRegexToken('WW', match1to2, match2); addWeekParseToken(['w', 'ww', 'W', 'WW'], function ( input, week, config, token ) { week[token.substr(0, 1)] = toInt(input); }); // HELPERS // LOCALES function localeWeek(mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow: 0, // Sunday is the first day of the week. doy: 6, // The week that contains Jan 6th is the first week of the year. }; function localeFirstDayOfWeek() { return this._week.dow; } function localeFirstDayOfYear() { return this._week.doy; } // MOMENTS function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); } function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); } // FORMATTING addFormatToken('d', 0, 'do', 'day'); addFormatToken('dd', 0, 0, function (format) { return this.localeData().weekdaysMin(this, format); }); addFormatToken('ddd', 0, 0, function (format) { return this.localeData().weekdaysShort(this, format); }); addFormatToken('dddd', 0, 0, function (format) { return this.localeData().weekdays(this, format); }); addFormatToken('e', 0, 0, 'weekday'); addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES addUnitAlias('day', 'd'); addUnitAlias('weekday', 'e'); addUnitAlias('isoWeekday', 'E'); // PRIORITY addUnitPriority('day', 11); addUnitPriority('weekday', 11); addUnitPriority('isoWeekday', 11); // PARSING addRegexToken('d', match1to2); addRegexToken('e', match1to2); addRegexToken('E', match1to2); addRegexToken('dd', function (isStrict, locale) { return locale.weekdaysMinRegex(isStrict); }); addRegexToken('ddd', function (isStrict, locale) { return locale.weekdaysShortRegex(isStrict); }); addRegexToken('dddd', function (isStrict, locale) { return locale.weekdaysRegex(isStrict); }); addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid if (weekday != null) { week.d = weekday; } else { getParsingFlags(config).invalidWeekday = input; } }); addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { week[token] = toInt(input); }); // HELPERS function parseWeekday(input, locale) { if (typeof input !== 'string') { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale.weekdaysParse(input); if (typeof input === 'number') { return input; } return null; } function parseIsoWeekday(input, locale) { if (typeof input === 'string') { return locale.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } // LOCALES function shiftWeekdays(ws, n) { return ws.slice(n, 7).concat(ws.slice(0, n)); } var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( '_' ), defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord; function localeWeekdays(m, format) { var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[ m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone' ]; return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays; } function localeWeekdaysShort(m) { return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort; } function localeWeekdaysMin(m) { return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i = 0; i < 7; ++i) { mom = createUTC([2000, 1]).day(i); this._minWeekdaysParse[i] = this.weekdaysMin( mom, '' ).toLocaleLowerCase(); this._shortWeekdaysParse[i] = this.weekdaysShort( mom, '' ).toLocaleLowerCase(); this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse(weekdayName, format, strict) { var i, mom, regex; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { this._fullWeekdaysParse[i] = new RegExp( '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i' ); this._shortWeekdaysParse[i] = new RegExp( '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i' ); this._minWeekdaysParse[i] = new RegExp( '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i' ); } if (!this._weekdaysParse[i]) { regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName) ) { return i; } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { return i; } } } // MOMENTS function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } } function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); } function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } function weekdaysRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, '_weekdaysRegex')) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } function weekdaysShortRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, '_weekdaysShortRegex')) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } function weekdaysMinRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, '_weekdaysMinRegex')) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse() { function cmpLenRev(a, b) { return b.length - a.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); minp = regexEscape(this.weekdaysMin(mom, '')); shortp = regexEscape(this.weekdaysShort(mom, '')); longp = regexEscape(this.weekdays(mom, '')); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } // Sorting makes sure if one weekday (or abbr) is a prefix of another it // will match the longer piece. minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._weekdaysShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); this._weekdaysMinStrictRegex = new RegExp( '^(' + minPieces.join('|') + ')', 'i' ); } // FORMATTING function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken('H', ['HH', 2], 0, 'hour'); addFormatToken('h', ['hh', 2], 0, hFormat); addFormatToken('k', ['kk', 2], 0, kFormat); addFormatToken('hmm', 0, 0, function () { return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken('hmmss', 0, 0, function () { return ( '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); addFormatToken('Hmm', 0, 0, function () { return '' + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken('Hmmss', 0, 0, function () { return ( '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); function meridiem(token, lowercase) { addFormatToken(token, 0, 0, function () { return this.localeData().meridiem( this.hours(), this.minutes(), lowercase ); }); } meridiem('a', true); meridiem('A', false); // ALIASES addUnitAlias('hour', 'h'); // PRIORITY addUnitPriority('hour', 13); // PARSING function matchMeridiem(isStrict, locale) { return locale._meridiemParse; } addRegexToken('a', matchMeridiem); addRegexToken('A', matchMeridiem); addRegexToken('H', match1to2); addRegexToken('h', match1to2); addRegexToken('k', match1to2); addRegexToken('HH', match1to2, match2); addRegexToken('hh', match1to2, match2); addRegexToken('kk', match1to2, match2); addRegexToken('hmm', match3to4); addRegexToken('hmmss', match5to6); addRegexToken('Hmm', match3to4); addRegexToken('Hmmss', match5to6); addParseToken(['H', 'HH'], HOUR); addParseToken(['k', 'kk'], function (input, array, config) { var kInput = toInt(input); array[HOUR] = kInput === 24 ? 0 : kInput; }); addParseToken(['a', 'A'], function (input, array, config) { config._isPm = config._locale.isPM(input); config._meridiem = input; }); addParseToken(['h', 'hh'], function (input, array, config) { array[HOUR] = toInt(input); getParsingFlags(config).bigHour = true; }); addParseToken('hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); getParsingFlags(config).bigHour = true; }); addParseToken('hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); getParsingFlags(config).bigHour = true; }); addParseToken('Hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); }); addParseToken('Hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); }); // LOCALES function localeIsPM(input) { // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays // Using charAt should be more compatible. return (input + '').toLowerCase().charAt(0) === 'p'; } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, // Setting the hour should keep the time, because the user explicitly // specified which hour they want. So trying to maintain the same hour (in // a new timezone) makes sense. Adding/subtracting hours does not follow // this rule. getSetHour = makeGetSet('Hours', true); function localeMeridiem(hours, minutes, isLower) { if (hours > 11) { return isLower ? 'pm' : 'PM'; } else { return isLower ? 'am' : 'AM'; } } var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse, }; // internal storage for locale config files var locales = {}, localeFamilies = {}, globalLocale; function commonPrefix(arr1, arr2) { var i, minl = Math.min(arr1.length, arr2.length); for (i = 0; i < minl; i += 1) { if (arr1[i] !== arr2[i]) { return i; } } return minl; } function normalizeLocale(key) { return key ? key.toLowerCase().replace('_', '-') : key; } // pick the locale from the array // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if ( next && next.length >= j && commonPrefix(split, next) >= j - 1 ) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return globalLocale; } function loadLocale(name) { var oldLocale = null, aliasedRequire; // TODO: Find a better way to register and load all the locales in Node if ( locales[name] === undefined && 'object' !== 'undefined' && module && module.exports ) { try { oldLocale = globalLocale._abbr; aliasedRequire = commonjsRequire; aliasedRequire('./locale/' + name); getSetGlobalLocale(oldLocale); } catch (e) { // mark as not found to avoid repeating expensive file require call causing high CPU // when trying to find en-US, en_US, en-us for every format call locales[name] = null; // null means not found } } return locales[name]; } // This function will load locale and then set the global locale. If // no arguments are passed in, it will simply return the current global // locale key. function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } else { if (typeof console !== 'undefined' && console.warn) { //warn user if arguments are passed but the locale could not be set console.warn( 'Locale ' + key + ' not found. Did you forget to load it?' ); } } } return globalLocale._abbr; } function defineLocale(name, config) { if (config !== null) { var locale, parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple( 'defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' ); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { locale = loadLocale(config.parentLocale); if (locale != null) { parentConfig = locale._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config, }); return null; } } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } } function updateLocale(name, config) { if (config != null) { var locale, tmpLocale, parentConfig = baseConfig; if (locales[name] != null && locales[name].parentLocale != null) { // Update existing child locale in-place to avoid memory-leaks locales[name].set(mergeConfigs(locales[name]._config, config)); } else { // MERGE tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); if (tmpLocale == null) { // updateLocale is called for creating a new locale // Set abbr so it will have a name (getters return // undefined otherwise). config.abbr = name; } locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; } // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; if (name === getSetGlobalLocale()) { getSetGlobalLocale(name); } } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } // returns locale data function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); } function listLocales() { return keys(locales); } function checkOverflow(m) { var overflow, a = m._a; if (a && getParsingFlags(m).overflow === -2) { overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; if ( getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE) ) { overflow = DATE; } if (getParsingFlags(m)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m).overflow = overflow; } return m; } // iso 8601 regex // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/], ['YYYYMM', /\d{6}/, false], ['YYYY', /\d{4}/, false], ], // iso time formats and regexes isoTimes = [ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/], ], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = { UT: 0, GMT: 0, EDT: -4 * 60, EST: -5 * 60, CDT: -5 * 60, CST: -6 * 60, MDT: -6 * 60, MST: -7 * 60, PDT: -7 * 60, PST: -8 * 60, }; // date from iso format function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } } function extractFromRFC2822Strings( yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr ) { var result = [ untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10), ]; if (secondStr) { result.push(parseInt(secondStr, 10)); } return result; } function untruncateYear(yearStr) { var year = parseInt(yearStr, 10); if (year <= 49) { return 2000 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space return s .replace(/\([^)]*\)|[\n\t]/g, ' ') .replace(/(\s\s+)/g, ' ') .replace(/^\s\s*/, '') .replace(/\s\s*$/, ''); } function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { // TODO: Replace the vanilla JS Date object with an independent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date( parsedInput[0], parsedInput[1], parsedInput[2] ).getDay(); if (weekdayProvided !== weekdayActual) { getParsingFlags(config).weekdayMismatch = true; config._isValid = false; return false; } } return true; } function calculateOffset(obsOffset, militaryOffset, numOffset) { if (obsOffset) { return obsOffsets[obsOffset]; } else if (militaryOffset) { // the only allowed military tz is Z return 0; } else { var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100; return h * 60 + m; } } // date and time from ref 2822 format function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray; if (match) { parsedArray = extractFromRFC2822Strings( match[4], match[3], match[2], match[5], match[6], match[7] ); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } } // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } if (config._strict) { config._isValid = false; } else { // Final attempt, use Input Fallback hooks.createFromInputFallback(config); } } hooks.createFromInputFallback = deprecate( 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); } ); // Pick the first defined of two or three arguments. function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; } function currentDateArray(config) { // hooks is actually the exported moment object var nowValue = new Date(hooks.now()); if (config._useUTC) { return [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate(), ]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } // convert an array to a date. // the array should mirror the parameters below // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] function configFromArray(config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if ( config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0 ) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if ( config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0 ) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply( null, input ); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if ( config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday ) { getParsingFlags(config).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config) { var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; w = config._w; if (w.GG != null || w.W != null || w.E != null) { dow = 1; doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on // how we interpret now (local, utc, fixed offset). So create // a now version of current config (take local/utc/offset flags, and // create now). weekYear = defaults( w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year ); week = defaults(w.W, 1); weekday = defaults(w.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config._locale._week.dow; doy = config._locale._week.doy; curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. week = defaults(w.w, curWeek.week); if (w.d != null) { // weekday -- low day numbers are considered next week weekday = w.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w.e != null) { // local weekday -- counting starts from beginning of week weekday = w.e + dow; if (w.e < 0 || w.e > 6) { weekdayOverflow = true; } } else { // default to beginning of week weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config._a[YEAR] = temp.year; config._dayOfYear = temp.dayOfYear; } } // constant that refers to the ISO standard hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form hooks.RFC_2822 = function () {}; // date from string and format string function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0, era; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice( string.indexOf(parsedInput) + parsedInput.length ); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if ( config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0 ) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap( config._locale, config._a[HOUR], config._meridiem ); // handle era era = getParsingFlags(config).era; if (era !== null) { config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); } configFromArray(config); checkOverflow(config); } function meridiemFixWrap(locale, hour, meridiem) { var isPm; if (meridiem == null) { // nothing to do return hour; } if (locale.meridiemHour != null) { return locale.meridiemHour(hour, meridiem); } else if (locale.isPM != null) { // Fallback isPm = locale.isPM(meridiem); if (isPm && hour < 12) { hour += 12; } if (!isPm && hour === 12) { hour = 0; } return hour; } else { // this is not supposed to happen return hour; } } // date from string and array of format strings function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false; if (config._f.length === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; validFormatFound = false; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (isValid(tempConfig)) { validFormatFound = true; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (!bestFormatIsValid) { if ( scoreToBeat == null || currentScore < scoreToBeat || validFormatFound ) { scoreToBeat = currentScore; bestMoment = tempConfig; if (validFormatFound) { bestFormatIsValid = true; } } } else { if (currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } } extend(config, bestMoment || tempConfig); } function configFromObject(config) { if (config._d) { return; } var i = normalizeObjectUnits(config._i), dayOrDate = i.day === undefined ? i.date : i.day; config._a = map( [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) { return obj && parseInt(obj, 10); } ); configFromArray(config); } function createFromConfig(config) { var res = new Moment(checkOverflow(prepareConfig(config))); if (res._nextDay) { // Adding is smart enough around DST res.add(1, 'd'); res._nextDay = undefined; } return res; } function prepareConfig(config) { var input = config._i, format = config._f; config._locale = config._locale || getLocale(config._l); if (input === null || (format === undefined && input === '')) { return createInvalid({ nullInput: true }); } if (typeof input === 'string') { config._i = input = config._locale.preparse(input); } if (isMoment(input)) { return new Moment(checkOverflow(input)); } else if (isDate(input)) { config._d = input; } else if (isArray(format)) { configFromStringAndArray(config); } else if (format) { configFromStringAndFormat(config); } else { configFromInput(config); } if (!isValid(config)) { config._d = null; } return config; } function configFromInput(config) { var input = config._i; if (isUndefined(input)) { config._d = new Date(hooks.now()); } else if (isDate(input)) { config._d = new Date(input.valueOf()); } else if (typeof input === 'string') { configFromString(config); } else if (isArray(input)) { config._a = map(input.slice(0), function (obj) { return parseInt(obj, 10); }); configFromArray(config); } else if (isObject(input)) { configFromObject(config); } else if (isNumber(input)) { // from milliseconds config._d = new Date(input); } else { hooks.createFromInputFallback(config); } } function createLocalOrUTC(input, format, locale, strict, isUTC) { var c = {}; if (format === true || format === false) { strict = format; format = undefined; } if (locale === true || locale === false) { strict = locale; locale = undefined; } if ( (isObject(input) && isObjectEmpty(input)) || (isArray(input) && input.length === 0) ) { input = undefined; } // object construction must be done this way. // https://github.com/moment/moment/issues/1423 c._isAMomentObject = true; c._useUTC = c._isUTC = isUTC; c._l = locale; c._i = input; c._f = format; c._strict = strict; return createFromConfig(c); } function createLocal(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, false); } var prototypeMin = deprecate( 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } } ), prototypeMax = deprecate( 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } } ); // Pick a moment m from moments so that m[fn](other) is true for all // other. This relies on the function fn to be transitive. // // moments should either be an array of moment objects or an array, whose // first element is an array of moment objects. function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; } // TODO: Use [].sort instead? function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); } function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); } var now = function () { return Date.now ? Date.now() : +new Date(); }; var ordering = [ 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', ]; function isDurationValid(m) { var key, unitHasDecimal = false, i; for (key in m) { if ( hasOwnProp(m, key) && !( indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])) ) ) { return false; } } for (i = 0; i < ordering.length; ++i) { if (m[ordering[i]]) { if (unitHasDecimal) { return false; // only allow non-integers for smallest unit } if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { unitHasDecimal = true; } } } return true; } function isValid$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration(duration) { var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || normalizedInput.isoWeek || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 minutes * 6e4 + // 1000 * 60 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 // Because of dateAddRemove treats 24 hours as different from a // day when working around DST, we need to store them separately this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = +months + quarters * 3 + years * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration(obj) { return obj instanceof Duration; } function absRound(number) { if (number < 0) { return Math.round(-1 * number) * -1; } else { return Math.round(number); } } // compare two arrays, return the number of differences function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ( (dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) ) { diffs++; } } return diffs + lengthDiff; } // FORMATTING function offset(token, separator) { addFormatToken(token, 0, 0, function () { var offset = this.utcOffset(), sign = '+'; if (offset < 0) { offset = -offset; sign = '-'; } return ( sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2) ); }); } offset('Z', ':'); offset('ZZ', ''); // PARSING addRegexToken('Z', matchShortOffset); addRegexToken('ZZ', matchShortOffset); addParseToken(['Z', 'ZZ'], function (input, array, config) { config._useUTC = true; config._tzm = offsetFromString(matchShortOffset, input); }); // HELPERS // timezone chunker // '+10:00' > ['10', '00'] // '-1530' > ['-15', '30'] var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string) { var matches = (string || '').match(matcher), chunk, parts, minutes; if (matches === null) { return null; } chunk = matches[matches.length - 1] || []; parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; minutes = +(parts[1] * 60) + toInt(parts[2]); return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; } // Return a moment from input, that is local/utc/zone equivalent to model. function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset(m) { // On Firefox.24 Date#getTimezoneOffset returns a floating point. // https://github.com/moment/moment/pull/1871 return -Math.round(m._d.getTimezoneOffset()); } // HOOKS // This function will be called whenever a moment is mutated. // It is intended to keep the offset in sync with the timezone. hooks.updateOffset = function () {}; // MOMENTS // keepLocalTime = true means only change the timezone, without // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset // +0200, so we adjust the time as needed, to be valid. // // Keeping the time actually adds/subtracts (one hour) // from the actual represented time. That is why we call updateOffset // a second time. In case it wants us to change the offset again // _changeInProgress == true case, then we have to adjust, because // there is no such time in the given timezone. function getSetOffset(input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract( this, createDuration(input - offset, 'm'), 1, false ); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } } function getSetZone(input, keepLocalTime) { if (input != null) { if (typeof input !== 'string') { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; } function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime() { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); } function isDaylightSavingTimeShifted() { if (!isUndefined(this._isDSTShifted)) { return this._isDSTShifted; } var c = {}, other; copyConfig(c, this); c = prepareConfig(c); if (c._a) { other = c._isUTC ? createUTC(c._a) : createLocal(c._a); this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal() { return this.isValid() ? !this._isUTC : false; } function isUtcOffset() { return this.isValid() ? this._isUTC : false; } function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; } // ASP.NET json date format regex var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // and further modified to allow for strings containing both week and day isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms: input._milliseconds, d: input._days, M: input._months, }; } else if (isNumber(input) || !isNaN(+input)) { duration = {}; if (key) { duration[key] = +input; } else { duration.milliseconds = +input; } } else if ((match = aspNetRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: 0, d: toInt(match[DATE]) * sign, h: toInt(match[HOUR]) * sign, m: toInt(match[MINUTE]) * sign, s: toInt(match[SECOND]) * sign, ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match }; } else if ((match = isoRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: parseIso(match[2], sign), M: parseIso(match[3], sign), w: parseIso(match[4], sign), d: parseIso(match[5], sign), h: parseIso(match[6], sign), m: parseIso(match[7], sign), s: parseIso(match[8], sign), }; } else if (duration == null) { // checks for null or undefined duration = {}; } else if ( typeof duration === 'object' && ('from' in duration || 'to' in duration) ) { diffRes = momentsDifference( createLocal(duration.from), createLocal(duration.to) ); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } if (isDuration(input) && hasOwnProp(input, '_isValid')) { ret._isValid = input._isValid; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso(inp, sign) { // We'd normally use ~~inp for this, but unfortunately it also // converts floats to ints. // inp may be undefined, so careful calling replace on it. var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it return (isNaN(res) ? 0 : res) * sign; } function positiveMomentsDifference(base, other) { var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, 'M').isAfter(other)) { --res.months; } res.milliseconds = +other - +base.clone().add(res.months, 'M'); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } // TODO: remove 'name' arg after deprecation is removed function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple( name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' ); tmp = val; val = period; period = tmp; } dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract(mom, duration, isAdding, updateOffset) { var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months); if (!mom.isValid()) { // No op return; } updateOffset = updateOffset == null ? true : updateOffset; if (months) { setMonth(mom, get(mom, 'Month') + months * isAdding); } if (days) { set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } if (milliseconds) { mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days || months); } } var add = createAdder(1, 'add'), subtract = createAdder(-1, 'subtract'); function isString(input) { return typeof input === 'string' || input instanceof String; } // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined function isMomentInput(input) { return ( isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === undefined ); } function isMomentInputObject(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms', ], i, property; for (i = 0; i < properties.length; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function isNumberOrStringArray(input) { var arrayTest = isArray(input), dataTypeTest = false; if (arrayTest) { dataTypeTest = input.filter(function (item) { return !isNumber(item) && isString(input); }).length === 0; } return arrayTest && dataTypeTest; } function isCalendarSpec(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'sameDay', 'nextDay', 'lastDay', 'nextWeek', 'lastWeek', 'sameElse', ], i, property; for (i = 0; i < properties.length; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; } function calendar$1(time, formats) { // Support for single parameter, formats only overload to the calendar function if (arguments.length === 1) { if (!arguments[0]) { time = undefined; formats = undefined; } else if (isMomentInput(arguments[0])) { time = arguments[0]; formats = undefined; } else if (isCalendarSpec(arguments[0])) { formats = arguments[0]; time = undefined; } } // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse', output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format( output || this.localeData().calendar(format, this, createLocal(now)) ); } function clone() { return new Moment(this); } function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween(from, to, units, inclusivity) { var localFrom = isMoment(from) ? from : createLocal(from), localTo = isMoment(to) ? to : createLocal(to); if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { return false; } inclusivity = inclusivity || '()'; return ( (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)) ); } function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return ( this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf() ); } } function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input, units); } function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input, units); } function diff(input, units, asFloat) { var that, zoneDelta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case 'year': output = monthDiff(this, that) / 12; break; case 'month': output = monthDiff(this, that); break; case 'quarter': output = monthDiff(this, that) / 3; break; case 'second': output = (this - that) / 1e3; break; // 1000 case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff(a, b) { if (a.date() < b.date()) { // end-of-month calculations work correct when the start month has more // days than the end month. return -monthDiff(b, a); } // difference in months var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), // b is in (anchor - 1 month, anchor + 1 month) anchor = a.clone().add(wholeMonthDiff, 'months'), anchor2, adjust; if (b - anchor < 0) { anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor - anchor2); } else { anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor2 - anchor); } //check for negative zero, return zero if negative zero return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; function toString() { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true, m = utc ? this.clone().utc() : this; if (m.year() < 0 || m.year() > 9999) { return formatMoment( m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can if (utc) { return this.toDate().toISOString(); } else { return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) .toISOString() .replace('Z', formatMoment(m, 'Z')); } } return formatMoment( m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } /** * Return a human readable representation of a moment that can * also be evaluated to get a new moment which is the same * * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects */ function inspect() { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment', zone = '', prefix, year, datetime, suffix; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } prefix = '[' + func + '("]'; year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; datetime = '-MM-DD[T]HH:mm:ss.SSS'; suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ to: this, from: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ from: this, to: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } // If passed a locale key, it will set the locale for this // instance. Otherwise, it will return the locale configuration // variables for this instance. function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate( 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { if (key === undefined) { return this.localeData(); } else { return this.locale(key); } } ); function localeData() { return this._locale; } var MS_PER_SECOND = 1000, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970): function mod$1(dividend, divisor) { return ((dividend % divisor) + divisor) % divisor; } function localStartOfDate(y, m, d) { // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return new Date(y + 400, m, d) - MS_PER_400_YEARS; } else { return new Date(y, m, d).valueOf(); } } function utcStartOfDate(y, m, d) { // Date.UTC remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; } else { return Date.UTC(y, m, d); } } function startOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year(), 0, 1); break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3), 1 ); break; case 'month': time = startOfDate(this.year(), this.month(), 1); break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() ); break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) ); break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date()); break; case 'hour': time = this._d.valueOf(); time -= mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ); break; case 'minute': time = this._d.valueOf(); time -= mod$1(time, MS_PER_MINUTE); break; case 'second': time = this._d.valueOf(); time -= mod$1(time, MS_PER_SECOND); break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function endOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year() + 1, 0, 1) - 1; break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3) + 3, 1 ) - 1; break; case 'month': time = startOfDate(this.year(), this.month() + 1, 1) - 1; break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() + 7 ) - 1; break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7 ) - 1; break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case 'hour': time = this._d.valueOf(); time += MS_PER_HOUR - mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ) - 1; break; case 'minute': time = this._d.valueOf(); time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; break; case 'second': time = this._d.valueOf(); time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function valueOf() { return this._d.valueOf() - (this._offset || 0) * 60000; } function unix() { return Math.floor(this.valueOf() / 1000); } function toDate() { return new Date(this.valueOf()); } function toArray() { var m = this; return [ m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond(), ]; } function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds(), }; } function toJSON() { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; } function isValid$2() { return isValid(this); } function parsingFlags() { return extend({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict, }; } addFormatToken('N', 0, 0, 'eraAbbr'); addFormatToken('NN', 0, 0, 'eraAbbr'); addFormatToken('NNN', 0, 0, 'eraAbbr'); addFormatToken('NNNN', 0, 0, 'eraName'); addFormatToken('NNNNN', 0, 0, 'eraNarrow'); addFormatToken('y', ['y', 1], 'yo', 'eraYear'); addFormatToken('y', ['yy', 2], 0, 'eraYear'); addFormatToken('y', ['yyy', 3], 0, 'eraYear'); addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); addRegexToken('N', matchEraAbbr); addRegexToken('NN', matchEraAbbr); addRegexToken('NNN', matchEraAbbr); addRegexToken('NNNN', matchEraName); addRegexToken('NNNNN', matchEraNarrow); addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function ( input, array, config, token ) { var era = config._locale.erasParse(input, token, config._strict); if (era) { getParsingFlags(config).era = era; } else { getParsingFlags(config).invalidEra = input; } }); addRegexToken('y', matchUnsigned); addRegexToken('yy', matchUnsigned); addRegexToken('yyy', matchUnsigned); addRegexToken('yyyy', matchUnsigned); addRegexToken('yo', matchEraYearOrdinal); addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); addParseToken(['yo'], function (input, array, config, token) { var match; if (config._locale._eraYearOrdinalRegex) { match = input.match(config._locale._eraYearOrdinalRegex); } if (config._locale.eraYearOrdinalParse) { array[YEAR] = config._locale.eraYearOrdinalParse(input, match); } else { array[YEAR] = parseInt(input, 10); } }); function localeEras(m, format) { var i, l, date, eras = this._eras || getLocale('en')._eras; for (i = 0, l = eras.length; i < l; ++i) { switch (typeof eras[i].since) { case 'string': // truncate time date = hooks(eras[i].since).startOf('day'); eras[i].since = date.valueOf(); break; } switch (typeof eras[i].until) { case 'undefined': eras[i].until = +Infinity; break; case 'string': // truncate time date = hooks(eras[i].until).startOf('day').valueOf(); eras[i].until = date.valueOf(); break; } } return eras; } function localeErasParse(eraName, format, strict) { var i, l, eras = this.eras(), name, abbr, narrow; eraName = eraName.toUpperCase(); for (i = 0, l = eras.length; i < l; ++i) { name = eras[i].name.toUpperCase(); abbr = eras[i].abbr.toUpperCase(); narrow = eras[i].narrow.toUpperCase(); if (strict) { switch (format) { case 'N': case 'NN': case 'NNN': if (abbr === eraName) { return eras[i]; } break; case 'NNNN': if (name === eraName) { return eras[i]; } break; case 'NNNNN': if (narrow === eraName) { return eras[i]; } break; } } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { return eras[i]; } } } function localeErasConvertYear(era, year) { var dir = era.since <= era.until ? +1 : -1; if (year === undefined) { return hooks(era.since).year(); } else { return hooks(era.since).year() + (year - era.offset) * dir; } } function getEraName() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].name; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].name; } } return ''; } function getEraNarrow() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].narrow; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].narrow; } } return ''; } function getEraAbbr() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].abbr; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].abbr; } } return ''; } function getEraYear() { var i, l, dir, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { dir = eras[i].since <= eras[i].until ? +1 : -1; // truncate time val = this.clone().startOf('day').valueOf(); if ( (eras[i].since <= val && val <= eras[i].until) || (eras[i].until <= val && val <= eras[i].since) ) { return ( (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset ); } } return this.year(); } function erasNameRegex(isStrict) { if (!hasOwnProp(this, '_erasNameRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNameRegex : this._erasRegex; } function erasAbbrRegex(isStrict) { if (!hasOwnProp(this, '_erasAbbrRegex')) { computeErasParse.call(this); } return isStrict ? this._erasAbbrRegex : this._erasRegex; } function erasNarrowRegex(isStrict) { if (!hasOwnProp(this, '_erasNarrowRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNarrowRegex : this._erasRegex; } function matchEraAbbr(isStrict, locale) { return locale.erasAbbrRegex(isStrict); } function matchEraName(isStrict, locale) { return locale.erasNameRegex(isStrict); } function matchEraNarrow(isStrict, locale) { return locale.erasNarrowRegex(isStrict); } function matchEraYearOrdinal(isStrict, locale) { return locale._eraYearOrdinalRegex || matchUnsigned; } function computeErasParse() { var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, eras = this.eras(); for (i = 0, l = eras.length; i < l; ++i) { namePieces.push(regexEscape(eras[i].name)); abbrPieces.push(regexEscape(eras[i].abbr)); narrowPieces.push(regexEscape(eras[i].narrow)); mixedPieces.push(regexEscape(eras[i].name)); mixedPieces.push(regexEscape(eras[i].abbr)); mixedPieces.push(regexEscape(eras[i].narrow)); } this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); this._erasNarrowRegex = new RegExp( '^(' + narrowPieces.join('|') + ')', 'i' ); } // FORMATTING addFormatToken(0, ['gg', 2], 0, function () { return this.weekYear() % 100; }); addFormatToken(0, ['GG', 2], 0, function () { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken(token, getter) { addFormatToken(0, [token, token.length], 0, getter); } addWeekYearFormatToken('gggg', 'weekYear'); addWeekYearFormatToken('ggggg', 'weekYear'); addWeekYearFormatToken('GGGG', 'isoWeekYear'); addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES addUnitAlias('weekYear', 'gg'); addUnitAlias('isoWeekYear', 'GG'); // PRIORITY addUnitPriority('weekYear', 1); addUnitPriority('isoWeekYear', 1); // PARSING addRegexToken('G', matchSigned); addRegexToken('g', matchSigned); addRegexToken('GG', match1to2, match2); addRegexToken('gg', match1to2, match2); addRegexToken('GGGG', match1to4, match4); addRegexToken('gggg', match1to4, match4); addRegexToken('GGGGG', match1to6, match6); addRegexToken('ggggg', match1to6, match6); addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function ( input, week, config, token ) { week[token.substr(0, 2)] = toInt(input); }); addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { week[token] = hooks.parseTwoDigitYear(input); }); // MOMENTS function getSetWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy ); } function getSetISOWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.isoWeek(), this.isoWeekday(), 1, 4 ); } function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); } function getISOWeeksInISOWeekYear() { return weeksInYear(this.isoWeekYear(), 1, 4); } function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getWeeksInWeekYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date.getUTCFullYear()); this.month(date.getUTCMonth()); this.date(date.getUTCDate()); return this; } // FORMATTING addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES addUnitAlias('quarter', 'Q'); // PRIORITY addUnitPriority('quarter', 7); // PARSING addRegexToken('Q', match1); addParseToken('Q', function (input, array) { array[MONTH] = (toInt(input) - 1) * 3; }); // MOMENTS function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + (this.month() % 3)); } // FORMATTING addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES addUnitAlias('date', 'D'); // PRIORITY addUnitPriority('date', 9); // PARSING addRegexToken('D', match1to2); addRegexToken('DD', match1to2, match2); addRegexToken('Do', function (isStrict, locale) { // TODO: Remove "ordinalParse" fallback in next major release. return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; }); addParseToken(['D', 'DD'], DATE); addParseToken('Do', function (input, array) { array[DATE] = toInt(input.match(match1to2)[0]); }); // MOMENTS var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES addUnitAlias('dayOfYear', 'DDD'); // PRIORITY addUnitPriority('dayOfYear', 4); // PARSING addRegexToken('DDD', match1to3); addRegexToken('DDDD', match3); addParseToken(['DDD', 'DDDD'], function (input, array, config) { config._dayOfYear = toInt(input); }); // HELPERS // MOMENTS function getSetDayOfYear(input) { var dayOfYear = Math.round( (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 ) + 1; return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); } // FORMATTING addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES addUnitAlias('minute', 'm'); // PRIORITY addUnitPriority('minute', 14); // PARSING addRegexToken('m', match1to2); addRegexToken('mm', match1to2, match2); addParseToken(['m', 'mm'], MINUTE); // MOMENTS var getSetMinute = makeGetSet('Minutes', false); // FORMATTING addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES addUnitAlias('second', 's'); // PRIORITY addUnitPriority('second', 15); // PARSING addRegexToken('s', match1to2); addRegexToken('ss', match1to2, match2); addParseToken(['s', 'ss'], SECOND); // MOMENTS var getSetSecond = makeGetSet('Seconds', false); // FORMATTING addFormatToken('S', 0, 0, function () { return ~~(this.millisecond() / 100); }); addFormatToken(0, ['SS', 2], 0, function () { return ~~(this.millisecond() / 10); }); addFormatToken(0, ['SSS', 3], 0, 'millisecond'); addFormatToken(0, ['SSSS', 4], 0, function () { return this.millisecond() * 10; }); addFormatToken(0, ['SSSSS', 5], 0, function () { return this.millisecond() * 100; }); addFormatToken(0, ['SSSSSS', 6], 0, function () { return this.millisecond() * 1000; }); addFormatToken(0, ['SSSSSSS', 7], 0, function () { return this.millisecond() * 10000; }); addFormatToken(0, ['SSSSSSSS', 8], 0, function () { return this.millisecond() * 100000; }); addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { return this.millisecond() * 1000000; }); // ALIASES addUnitAlias('millisecond', 'ms'); // PRIORITY addUnitPriority('millisecond', 16); // PARSING addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); var token, getSetMillisecond; for (token = 'SSSS'; token.length <= 9; token += 'S') { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); } for (token = 'S'; token.length <= 9; token += 'S') { addParseToken(token, parseMs); } getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING addFormatToken('z', 0, 0, 'zoneAbbr'); addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS function getZoneAbbr() { return this._isUTC ? 'UTC' : ''; } function getZoneName() { return this._isUTC ? 'Coordinated Universal Time' : ''; } var proto = Moment.prototype; proto.add = add; proto.calendar = calendar$1; proto.clone = clone; proto.diff = diff; proto.endOf = endOf; proto.format = format; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2; proto.lang = lang; proto.locale = locale; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray; proto.toObject = toObject; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect; if (typeof Symbol !== 'undefined' && Symbol.for != null) { proto[Symbol.for('nodejs.util.inspect.custom')] = function () { return 'Moment<' + this.format() + '>'; }; } proto.toJSON = toJSON; proto.toString = toString; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; proto.eraName = getEraName; proto.eraNarrow = getEraNarrow; proto.eraAbbr = getEraAbbr; proto.eraYear = getEraYear; proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; proto.quarter = proto.quarters = getSetQuarter; proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.weeksInWeekYear = getWeeksInWeekYear; proto.isoWeeksInYear = getISOWeeksInYear; proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; proto.hour = proto.hours = getSetHour; proto.minute = proto.minutes = getSetMinute; proto.second = proto.seconds = getSetSecond; proto.millisecond = proto.milliseconds = getSetMillisecond; proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; proto.dates = deprecate( 'dates accessor is deprecated. Use date instead.', getSetDayOfMonth ); proto.months = deprecate( 'months accessor is deprecated. Use month instead', getSetMonth ); proto.years = deprecate( 'years accessor is deprecated. Use year instead', getSetYear ); proto.zone = deprecate( 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone ); proto.isDSTShifted = deprecate( 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted ); function createUnix(input) { return createLocal(input * 1000); } function createInZone() { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat(string) { return string; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set; proto$1.eras = localeEras; proto$1.erasParse = localeErasParse; proto$1.erasConvertYear = localeErasConvertYear; proto$1.erasAbbrRegex = erasAbbrRegex; proto$1.erasNameRegex = erasNameRegex; proto$1.erasNarrowRegex = erasNarrowRegex; proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1(format, index, field, setter) { var locale = getLocale(), utc = createUTC().set(setter, index); return locale[field](utc, format); } function listMonthsImpl(format, index, field) { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; if (index != null) { return get$1(format, index, field, 'month'); } var i, out = []; for (i = 0; i < 12; i++) { out[i] = get$1(format, i, field, 'month'); } return out; } // () // (5) // (fmt, 5) // (fmt) // (true) // (true, 5) // (true, fmt, 5) // (true, fmt) function listWeekdaysImpl(localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0, i, out = []; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; } function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); } function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); } function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); } function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); } function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); } getSetGlobalLocale('en', { eras: [ { since: '0001-01-01', until: +Infinity, offset: 1, name: 'Anno Domini', narrow: 'AD', abbr: 'AD', }, { since: '0000-12-31', until: -Infinity, offset: 1, name: 'Before Christ', narrow: 'BC', abbr: 'BC', }, ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function (number) { var b = number % 10, output = toInt((number % 100) / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; return number + output; }, }); // Side effect imports hooks.lang = deprecate( 'moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale ); hooks.langData = deprecate( 'moment.langData is deprecated. Use moment.localeData instead.', getLocale ); var mathAbs = Math.abs; function abs() { var data = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data.milliseconds = mathAbs(data.milliseconds); data.seconds = mathAbs(data.seconds); data.minutes = mathAbs(data.minutes); data.hours = mathAbs(data.hours); data.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; } function addSubtract$1(duration, input, value, direction) { var other = createDuration(input, value); duration._milliseconds += direction * other._milliseconds; duration._days += direction * other._days; duration._months += direction * other._months; return duration._bubble(); } // supports only 2.0-style add(1, 's') or add(duration) function add$1(input, value) { return addSubtract$1(this, input, value, 1); } // supports only 2.0-style subtract(1, 's') or subtract(duration) function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); } function absCeil(number) { if (number < 0) { return Math.floor(number); } else { return Math.ceil(number); } } function bubble() { var milliseconds = this._milliseconds, days = this._days, months = this._months, data = this._data, seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first // check: https://github.com/moment/moment/issues/2166 if ( !( (milliseconds >= 0 && days >= 0 && months >= 0) || (milliseconds <= 0 && days <= 0 && months <= 0) ) ) { milliseconds += absCeil(monthsToDays(months) + days) * 864e5; days = 0; months = 0; } // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds = absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes = absFloor(seconds / 60); data.minutes = minutes % 60; hours = absFloor(minutes / 60); data.hours = hours % 24; days += absFloor(hours / 24); // convert days to months monthsFromDays = absFloor(daysToMonths(days)); months += monthsFromDays; days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year years = absFloor(months / 12); months %= 12; data.days = days; data.months = months; data.years = years; return this; } function daysToMonths(days) { // 400 years have 146097 days (taking into account leap year rules) // 400 years have 12 months === 4800 return (days * 4800) / 146097; } function monthsToDays(months) { // the reverse of daysToMonths return (months * 146097) / 4800; } function as(units) { if (!this.isValid()) { return NaN; } var days, months, milliseconds = this._milliseconds; units = normalizeUnits(units); if (units === 'month' || units === 'quarter' || units === 'year') { days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); switch (units) { case 'month': return months; case 'quarter': return months / 3; case 'year': return months / 12; } } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); switch (units) { case 'week': return days / 7 + milliseconds / 6048e5; case 'day': return days + milliseconds / 864e5; case 'hour': return days * 24 + milliseconds / 36e5; case 'minute': return days * 1440 + milliseconds / 6e4; case 'second': return days * 86400 + milliseconds / 1000; // Math.floor prevents floating point math errors here case 'millisecond': return Math.floor(days * 864e5) + milliseconds; default: throw new Error('Unknown unit ' + units); } } } // TODO: Use this.as('ms')? function valueOf$1() { if (!this.isValid()) { return NaN; } return ( this._milliseconds + this._days * 864e5 + (this._months % 12) * 2592e6 + toInt(this._months / 12) * 31536e6 ); } function makeAs(alias) { return function () { return this.as(alias); }; } var asMilliseconds = makeAs('ms'), asSeconds = makeAs('s'), asMinutes = makeAs('m'), asHours = makeAs('h'), asDays = makeAs('d'), asWeeks = makeAs('w'), asMonths = makeAs('M'), asQuarters = makeAs('Q'), asYears = makeAs('y'); function clone$1() { return createDuration(this); } function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; } function makeGetter(name) { return function () { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter('milliseconds'), seconds = makeGetter('seconds'), minutes = makeGetter('minutes'), hours = makeGetter('hours'), days = makeGetter('days'), months = makeGetter('months'), years = makeGetter('years'); function weeks() { return absFloor(this.days() / 7); } var round = Math.round, thresholds = { ss: 44, // a few seconds to seconds s: 45, // seconds to minute m: 45, // minutes to hour h: 22, // hours to day d: 26, // days to month/week w: null, // weeks to month M: 11, // months to year }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { var duration = createDuration(posNegDuration).abs(), seconds = round(duration.as('s')), minutes = round(duration.as('m')), hours = round(duration.as('h')), days = round(duration.as('d')), months = round(duration.as('M')), weeks = round(duration.as('w')), years = round(duration.as('y')), a = (seconds <= thresholds.ss && ['s', seconds]) || (seconds < thresholds.s && ['ss', seconds]) || (minutes <= 1 && ['m']) || (minutes < thresholds.m && ['mm', minutes]) || (hours <= 1 && ['h']) || (hours < thresholds.h && ['hh', hours]) || (days <= 1 && ['d']) || (days < thresholds.d && ['dd', days]); if (thresholds.w != null) { a = a || (weeks <= 1 && ['w']) || (weeks < thresholds.w && ['ww', weeks]); } a = a || (months <= 1 && ['M']) || (months < thresholds.M && ['MM', months]) || (years <= 1 && ['y']) || ['yy', years]; a[2] = withoutSuffix; a[3] = +posNegDuration > 0; a[4] = locale; return substituteTimeAgo.apply(null, a); } // This function allows you to set the rounding function for relative time strings function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof roundingFunction === 'function') { round = roundingFunction; return true; } return false; } // This function allows you to set a threshold for relative time strings function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; } function humanize(argWithSuffix, argThresholds) { if (!this.isValid()) { return this.localeData().invalidDate(); } var withSuffix = false, th = thresholds, locale, output; if (typeof argWithSuffix === 'object') { argThresholds = argWithSuffix; argWithSuffix = false; } if (typeof argWithSuffix === 'boolean') { withSuffix = argWithSuffix; } if (typeof argThresholds === 'object') { th = Object.assign({}, thresholds, argThresholds); if (argThresholds.s != null && argThresholds.ss == null) { th.ss = argThresholds.s - 1; } } locale = this.localeData(); output = relativeTime$1(this, !withSuffix, th, locale); if (withSuffix) { output = locale.pastFuture(+this, output); } return locale.postformat(output); } var abs$1 = Math.abs; function sign(x) { return (x > 0) - (x < 0) || +x; } function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), minutes, hours, years, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign; if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; totalSign = total < 0 ? '-' : ''; ymSign = sign(this._months) !== sign(total) ? '-' : ''; daysSign = sign(this._days) !== sign(total) ? '-' : ''; hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; return ( totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '') ); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1; proto$2.abs = abs; proto$2.add = add$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale; proto$2.localeData = localeData; proto$2.toIsoString = deprecate( 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1 ); proto$2.lang = lang; // FORMATTING addFormatToken('X', 0, 0, 'unix'); addFormatToken('x', 0, 0, 'valueOf'); // PARSING addRegexToken('x', matchSigned); addRegexToken('X', matchTimestamp); addParseToken('X', function (input, array, config) { config._d = new Date(parseFloat(input) * 1000); }); addParseToken('x', function (input, array, config) { config._d = new Date(toInt(input)); }); //! moment.js hooks.version = '2.29.1'; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats hooks.HTML5_FMT = { DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // DATE: 'YYYY-MM-DD', // TIME: 'HH:mm', // TIME_SECONDS: 'HH:mm:ss', // TIME_MS: 'HH:mm:ss.SSS', // WEEK: 'GGGG-[W]WW', // MONTH: 'YYYY-MM', // }; return hooks; }))); }); var hasOwnProperty_1 = {}.hasOwnProperty; var miniflat_1 = miniflat; function miniflat(value) { return value === null || value === undefined ? [] : 'length' in value ? value : [value] } var chunkedSplice_1 = chunkedSplice; var v8MaxSafeChunkSize = 10000; // `Array#splice` takes all items to be inserted as individual argument which // causes a stack overflow in V8 when trying to insert 100k items for instance. function chunkedSplice(list, start, remove, items) { var end = list.length; var chunkStart = 0; var result; var parameters; // Make start between zero and `end` (included). if (start < 0) { start = -start > end ? 0 : end + start; } else { start = start > end ? end : start; } remove = remove > 0 ? remove : 0; // No need to chunk the items if there’s only a couple (10k) items. if (items.length < v8MaxSafeChunkSize) { parameters = Array.from(items); parameters.unshift(start, remove); return [].splice.apply(list, parameters) } // Delete `remove` items starting from `start` result = [].splice.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. while (chunkStart < items.length) { parameters = items.slice(chunkStart, chunkStart + v8MaxSafeChunkSize); parameters.unshift(start, 0) ;[].splice.apply(list, parameters); chunkStart += v8MaxSafeChunkSize; start += v8MaxSafeChunkSize; } return result } var combineExtensions_1 = combineExtensions; // Combine several syntax extensions into one. function combineExtensions(extensions) { var all = {}; var index = -1; while (++index < extensions.length) { extension(all, extensions[index]); } return all } function extension(all, extension) { var hook; var left; var right; var code; for (hook in extension) { left = hasOwnProperty_1.call(all, hook) ? all[hook] : (all[hook] = {}); right = extension[hook]; for (code in right) { left[code] = constructs( miniflat_1(right[code]), hasOwnProperty_1.call(left, code) ? left[code] : [] ); } } } function constructs(list, existing) { var index = -1; var before = []; while (++index < list.length) { (list[index].add === 'after' ? existing : before).push(list[index]); } chunkedSplice_1(existing, 0, 0, before); return existing } var fromCharCode = String.fromCharCode; var regexCheck_1 = regexCheck; function regexCheck(regex) { return check function check(code) { return regex.test(fromCharCode(code)) } } var asciiAlphanumeric = regexCheck_1(/[\dA-Za-z]/); var asciiAlpha = regexCheck_1(/[A-Za-z]/); var domain = {tokenize: tokenizeDomain}; var path = {tokenize: tokenizePath}; var punctuation = {tokenize: tokenizePunctuation}; var paren = {tokenize: tokenizeParen}; var namedCharacterReference = {tokenize: tokenizeNamedCharacterReference}; var wwwAutolink = {tokenize: tokenizeWwwAutolink, previous: previous}; var httpAutolink = {tokenize: tokenizeHttpAutolink, previous: previous}; var emailAutolink = {tokenize: tokenizeEmailAutolink, previous: previous}; var text = {}; // Export hooked constructs. var text_1 = text; // `0` var code = 48; // While the code is smaller than `{`. while (code < 123) { text[code] = emailAutolink; code++; // Jump from `:` -> `A` if (code === 58) code = 65; // Jump from `[` -> `a` else if (code === 91) code = 97; } // `+` text[43] = emailAutolink; // `-` text[45] = emailAutolink; // `.` text[46] = emailAutolink; // `_` text[95] = emailAutolink; // `h`. text[72] = [emailAutolink, httpAutolink]; text[104] = [emailAutolink, httpAutolink]; // `w`. text[87] = [emailAutolink, wwwAutolink]; text[119] = [emailAutolink, wwwAutolink]; function tokenizeEmailAutolink(effects, ok, nok) { var self = this; var hasDot; return start function start(code) { /* istanbul ignore next - hooks. */ if (!gfmAtext(code) || !previous(self.previous)) { return nok(code) } effects.enter('literalAutolink'); effects.enter('literalAutolinkEmail'); return atext(code) } function atext(code) { if (gfmAtext(code)) { effects.consume(code); return atext } // `@` if (code === 64) { effects.consume(code); return label } return nok(code) } function label(code) { // `.` if (code === 46) { return effects.check(punctuation, done, dotContinuation)(code) } if ( // `-` code === 45 || // `_` code === 95 ) { return effects.check(punctuation, nok, dashOrUnderscoreContinuation)(code) } if (asciiAlphanumeric(code)) { effects.consume(code); return label } return done(code) } function dotContinuation(code) { effects.consume(code); hasDot = true; return label } function dashOrUnderscoreContinuation(code) { effects.consume(code); return afterDashOrUnderscore } function afterDashOrUnderscore(code) { // `.` if (code === 46) { return effects.check(punctuation, nok, dotContinuation)(code) } return label(code) } function done(code) { if (hasDot) { effects.exit('literalAutolinkEmail'); effects.exit('literalAutolink'); return ok(code) } return nok(code) } } function tokenizeWwwAutolink(effects, ok, nok) { var self = this; return start function start(code) { /* istanbul ignore next - hooks. */ if ((code !== 87 && code - 32 !== 87) || !previous(self.previous)) { return nok(code) } effects.enter('literalAutolink'); effects.enter('literalAutolinkWww'); effects.consume(code); return w2 } function w2(code) { // `w` if (code === 87 || code - 32 === 87) { effects.consume(code); return w3 } return nok(code) } function w3(code) { // `w` if (code === 87 || code - 32 === 87) { effects.consume(code); return dot } return nok(code) } function dot(code) { // `.` if (code === 46) { effects.consume(code); return effects.attempt(domain, effects.attempt(path, done), nok) } return nok(code) } function done(code) { effects.exit('literalAutolinkWww'); effects.exit('literalAutolink'); return ok(code) } } function tokenizeHttpAutolink(effects, ok, nok) { var self = this; return start function start(code) { /* istanbul ignore next - hooks. */ if ((code !== 72 && code - 32 !== 72) || !previous(self.previous)) { return nok(code) } effects.enter('literalAutolink'); effects.enter('literalAutolinkHttp'); effects.consume(code); return t1 } function t1(code) { // `t` if (code === 84 || code - 32 === 84) { effects.consume(code); return t2 } return nok(code) } function t2(code) { // `t` if (code === 84 || code - 32 === 84) { effects.consume(code); return p } return nok(code) } function p(code) { // `p` if (code === 80 || code - 32 === 80) { effects.consume(code); return s } return nok(code) } function s(code) { // `s` if (code === 83 || code - 32 === 83) { effects.consume(code); return colon } return colon(code) } function colon(code) { // `:` if (code === 58) { effects.consume(code); return slash1 } return nok(code) } function slash1(code) { // `/` if (code === 47) { effects.consume(code); return slash2 } return nok(code) } function slash2(code) { // `/` if (code === 47) { effects.consume(code); return effects.attempt(domain, effects.attempt(path, done), nok) } return nok(code) } function done(code) { effects.exit('literalAutolinkHttp'); effects.exit('literalAutolink'); return ok(code) } } function tokenizeDomain(effects, ok, nok) { var hasUnderscoreInLastSegment; var hasUnderscoreInLastLastSegment; var hasDot; return start function start(code) { effects.enter('literalAutolinkDomain'); return domain(code) } function domain(code) { if ( // `-` code === 45 || // `_` code === 95 || asciiAlphanumeric(code) ) { if (code === 95) { hasUnderscoreInLastSegment = true; } effects.consume(code); return domain } // `.` if (code === 46) { return effects.check(punctuation, done, dotContinuation)(code) } return done(code) } function dotContinuation(code) { effects.consume(code); hasDot = true; hasUnderscoreInLastLastSegment = hasUnderscoreInLastSegment; hasUnderscoreInLastSegment = undefined; return domain } function done(code) { if ( hasDot && !hasUnderscoreInLastLastSegment && !hasUnderscoreInLastSegment ) { effects.exit('literalAutolinkDomain'); return ok(code) } return nok(code) } } function tokenizePath(effects, ok) { var balance = 0; return start function start(code) { if (pathEnd(code)) { return ok(code) } if (trailingPunctuation(code)) { return effects.check(punctuation, ok, atPathStart)(code) } return atPathStart(code) } function atPathStart(code) { effects.enter('literalAutolinkWwwPath'); return inPath(code) } function inPath(code) { // `&` if (code === 38) { return effects.check( namedCharacterReference, atPathEnd, continuedPunctuation )(code) } // `(` if (code === 40) { balance++; } // `)` if (code === 41) { return effects.check(paren, parenAtPathEnd, continuedPunctuation)(code) } if (pathEnd(code)) { return atPathEnd(code) } if (trailingPunctuation(code)) { return effects.check(punctuation, atPathEnd, continuedPunctuation)(code) } effects.consume(code); return inPath } function continuedPunctuation(code) { effects.consume(code); return inPath } function parenAtPathEnd(code) { balance--; return balance < 0 ? atPathEnd(code) : continuedPunctuation(code) } function atPathEnd(code) { effects.exit('literalAutolinkWwwPath'); return ok(code) } } function tokenizeNamedCharacterReference(effects, ok, nok) { return start function start(code) { // Assume an ampersand. effects.enter('literalAutolinkCharacterReferenceNamed'); effects.consume(code); return inside } function inside(code) { if (asciiAlpha(code)) { effects.consume(code); return inside } // `;` if (code === 59) { effects.consume(code); return after } return nok(code) } function after(code) { // If the named character reference is followed by the end of the path, it’s // not continued punctuation. effects.exit('literalAutolinkCharacterReferenceNamed'); return pathEnd(code) ? ok(code) : nok(code) } } function tokenizeParen(effects, ok, nok) { return start function start(code) { // Assume a right paren. effects.enter('literalAutolinkParen'); effects.consume(code); return after } function after(code) { // If the punctuation marker is followed by the end of the path, it’s not // continued punctuation. effects.exit('literalAutolinkParen'); return pathEnd(code) || // `)` code === 41 ? ok(code) : nok(code) } } function tokenizePunctuation(effects, ok, nok) { return start function start(code) { effects.enter('literalAutolinkPunctuation'); // Always a valid trailing punctuation marker. effects.consume(code); return after } function after(code) { // If the punctuation marker is followed by the end of the path, it’s not // continued punctuation. effects.exit('literalAutolinkPunctuation'); return pathEnd(code) ? ok(code) : nok(code) } } function trailingPunctuation(code) { return ( // Exclamation mark. code === 33 || // Asterisk. code === 42 || // Comma. code === 44 || // Dot. code === 46 || // Colon. code === 58 || // Question mark. code === 63 || // Underscore. code === 95 || // Tilde. code === 126 ) } function pathEnd(code) { return ( // EOF. code === null || // CR, LF, CRLF, HT, VS. code < 0 || // Space. code === 32 || // Less than. code === 60 ) } function gfmAtext(code) { return ( // `+` code === 43 || // `-` code === 45 || // `.` code === 46 || // `_` code === 95 || asciiAlphanumeric(code) ) } function previous(code) { return ( // EOF. code === null || // CR, LF, CRLF, HT, VS. code < 0 || // Space. code === 32 || // Left paren. code === 40 || // Asterisk. code === 42 || // Underscore. code === 95 || // Tilde. code === 126 ) } var syntax = { text: text_1 }; var micromarkExtensionGfmAutolinkLiteral = syntax; var markdownLineEndingOrSpace_1 = markdownLineEndingOrSpace; function markdownLineEndingOrSpace(code) { return code < 0 || code === 32 } // This module is generated by `script/`. // // CommonMark handles attention (emphasis, strong) markers based on what comes // before or after them. // One such difference is if those characters are Unicode punctuation. // This script is generated from the Unicode data. var unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\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]/; // Size note: removing ASCII from the regex and using `ascii-punctuation` here // In fact adds to the bundle size. var unicodePunctuation_1 = regexCheck_1(unicodePunctuationRegex); var unicodeWhitespace = regexCheck_1(/\s/); var classifyCharacter_1 = classifyCharacter; // Classify whether a character is unicode whitespace, unicode punctuation, or // anything else. // Used for attention (emphasis, strong), whose sequences can open or close // based on the class of surrounding characters. function classifyCharacter(code) { if ( code === null || markdownLineEndingOrSpace_1(code) || unicodeWhitespace(code) ) { return 1 } if (unicodePunctuation_1(code)) { return 2 } } var resolveAll_1 = resolveAll; function resolveAll(constructs, events, context) { var called = []; var index = -1; var resolve; while (++index < constructs.length) { resolve = constructs[index].resolveAll; if (resolve && called.indexOf(resolve) < 0) { events = resolve(events, context); called.push(resolve); } } return events } var assign = Object.assign; var shallow_1 = shallow; function shallow(object) { return assign({}, object) } var micromarkExtensionGfmStrikethrough = create; function create(options) { var settings = options || {}; var single = settings.singleTilde; var tokenizer = { tokenize: tokenizeStrikethrough, resolveAll: resolveAllStrikethrough }; if (single === null || single === undefined) { single = true; } return {text: {126: tokenizer}, insideSpan: {null: tokenizer}} // Take events and resolve strikethrough. function resolveAllStrikethrough(events, context) { var index = -1; var strikethrough; var text; var open; var nextEvents; // Walk through all events. while (++index < events.length) { // Find a token that can close. if ( events[index][0] === 'enter' && events[index][1].type === 'strikethroughSequenceTemporary' && events[index][1]._close ) { open = index; // Now walk back to find an opener. while (open--) { // Find a token that can open the closer. if ( events[open][0] === 'exit' && events[open][1].type === 'strikethroughSequenceTemporary' && events[open][1]._open && // If the sizes are the same: events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset ) { events[index][1].type = 'strikethroughSequence'; events[open][1].type = 'strikethroughSequence'; strikethrough = { type: 'strikethrough', start: shallow_1(events[open][1].start), end: shallow_1(events[index][1].end) }; text = { type: 'strikethroughText', start: shallow_1(events[open][1].end), end: shallow_1(events[index][1].start) }; // Opening. nextEvents = [ ['enter', strikethrough, context], ['enter', events[open][1], context], ['exit', events[open][1], context], ['enter', text, context] ]; // Between. chunkedSplice_1( nextEvents, nextEvents.length, 0, resolveAll_1( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) ); // Closing. chunkedSplice_1(nextEvents, nextEvents.length, 0, [ ['exit', text, context], ['enter', events[index][1], context], ['exit', events[index][1], context], ['exit', strikethrough, context] ]); chunkedSplice_1(events, open - 1, index - open + 3, nextEvents); index = open + nextEvents.length - 2; break } } } } return removeRemainingSequences(events) } function removeRemainingSequences(events) { var index = -1; var length = events.length; while (++index < length) { if (events[index][1].type === 'strikethroughSequenceTemporary') { events[index][1].type = 'data'; } } return events } function tokenizeStrikethrough(effects, ok, nok) { var previous = this.previous; var events = this.events; var size = 0; return start function start(code) { if ( code !== 126 || (previous === 126 && events[events.length - 1][1].type !== 'characterEscape') ) { return nok(code) } effects.enter('strikethroughSequenceTemporary'); return more(code) } function more(code) { var before = classifyCharacter_1(previous); var token; var after; if (code === 126) { // If this is the third marker, exit. if (size > 1) return nok(code) effects.consume(code); size++; return more } if (size < 2 && !single) return nok(code) token = effects.exit('strikethroughSequenceTemporary'); after = classifyCharacter_1(code); token._open = !after || (after === 2 && before); token._close = !before || (before === 2 && after); return ok(code) } } } var markdownSpace_1 = markdownSpace; function markdownSpace(code) { return code === -2 || code === -1 || code === 32 } var factorySpace = createSpace; function createSpace(effects, ok, type, max) { var limit = max ? max - 1 : Infinity; var size; return start function start(code) { if (markdownSpace_1(code)) { effects.enter(type); size = 0; return prefix(code) } return ok(code) } function prefix(code) { if (markdownSpace_1(code) && size++ < limit) { effects.consume(code); return prefix } effects.exit(type); return ok(code) } } var flow = { null: {tokenize: tokenizeTable, resolve: resolveTable, interruptible: true} }; var setextUnderlineMini = {tokenize: tokenizeSetextUnderlineMini, partial: true}; var nextPrefixedOrBlank = {tokenize: tokenizeNextPrefixedOrBlank, partial: true}; function resolveTable(events, context) { var length = events.length; var index = -1; var token; var inHead; var inDelimiterRow; var inRow; var cell; var content; var text; var contentStart; var contentEnd; var cellStart; while (++index < length) { token = events[index][1]; if (inRow) { if (token.type === 'temporaryTableCellContent') { contentStart = contentStart || index; contentEnd = index; } if ( // Combine separate content parts into one. (token.type === 'tableCellDivider' || token.type === 'tableRow') && contentEnd ) { content = { type: 'tableContent', start: events[contentStart][1].start, end: events[contentEnd][1].end }; text = { type: 'chunkText', start: content.start, end: content.end, contentType: 'text' }; events.splice( contentStart, contentEnd - contentStart + 1, ['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context] ); index -= contentEnd - contentStart - 3; length = events.length; contentStart = undefined; contentEnd = undefined; } } if ( events[index][0] === 'exit' && (token.type === 'tableCellDivider' || token.type === 'tableRow') && cellStart && cellStart + 1 < index ) { cell = { type: inDelimiterRow ? 'tableDelimiter' : inHead ? 'tableHeader' : 'tableData', start: events[cellStart][1].start, end: events[index][1].end }; events.splice(index + (token.type === 'tableCellDivider' ? 1 : 0), 0, [ 'exit', cell, context ]); events.splice(cellStart, 0, ['enter', cell, context]); index += 2; length = events.length; cellStart = index + 1; } if (token.type === 'tableRow') { inRow = events[index][0] === 'enter'; if (inRow) { cellStart = index + 1; } } if (token.type === 'tableDelimiterRow') { inDelimiterRow = events[index][0] === 'enter'; if (inDelimiterRow) { cellStart = index + 1; } } if (token.type === 'tableHead') { inHead = events[index][0] === 'enter'; } } return events } function tokenizeTable(effects, ok, nok) { var align = []; var tableHeaderCount = 0; var seenDelimiter; var hasDash; return start function start(code) { /* istanbul ignore if - used to be passed in beta micromark versions. */ if (code === null || code === -5 || code === -4 || code === -3) { return nok(code) } effects.enter('table')._align = align; effects.enter('tableHead'); effects.enter('tableRow'); // If we start with a pipe, we open a cell marker. if (code === 124) { return cellDividerHead(code) } tableHeaderCount++; effects.enter('temporaryTableCellContent'); // Can’t be space or eols at the start of a construct, so we’re in a cell. return inCellContentHead(code) } function cellDividerHead(code) { // Always a pipe. effects.enter('tableCellDivider'); effects.consume(code); effects.exit('tableCellDivider'); seenDelimiter = true; return cellBreakHead } function cellBreakHead(code) { // EOF, CR, LF, CRLF. if (code === null || code === -5 || code === -4 || code === -3) { return atRowEndHead(code) } // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.enter('whitespace'); effects.consume(code); return inWhitespaceHead } if (seenDelimiter) { seenDelimiter = undefined; tableHeaderCount++; } // `|` if (code === 124) { return cellDividerHead(code) } // Anything else is cell content. effects.enter('temporaryTableCellContent'); return inCellContentHead(code) } function inWhitespaceHead(code) { // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.consume(code); return inWhitespaceHead } effects.exit('whitespace'); return cellBreakHead(code) } function inCellContentHead(code) { // EOF, whitespace, pipe if (code === null || code < 0 || code === 32 || code === 124) { effects.exit('temporaryTableCellContent'); return cellBreakHead(code) } effects.consume(code); // `\` return code === 92 ? inCellContentEscapeHead : inCellContentHead } function inCellContentEscapeHead(code) { // `\` or `|` if (code === 92 || code === 124) { effects.consume(code); return inCellContentHead } // Anything else. return inCellContentHead(code) } function atRowEndHead(code) { if (code === null) { return nok(code) } effects.exit('tableRow'); effects.exit('tableHead'); // Always a line ending. effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); // If a setext heading, exit. return effects.check( setextUnderlineMini, nok, // Support an indent before the delimiter row. factorySpace(effects, rowStartDelimiter, 'linePrefix', 4) ) } function rowStartDelimiter(code) { // If there’s another space, or we’re at the EOL/EOF, exit. if (code === null || code < 0 || code === 32) { return nok(code) } effects.enter('tableDelimiterRow'); return atDelimiterRowBreak(code) } function atDelimiterRowBreak(code) { // EOF, CR, LF, CRLF. if (code === null || code === -5 || code === -4 || code === -3) { return rowEndDelimiter(code) } // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.enter('whitespace'); effects.consume(code); return inWhitespaceDelimiter } // `-` if (code === 45) { effects.enter('tableDelimiterFiller'); effects.consume(code); hasDash = true; align.push(null); return inFillerDelimiter } // `:` if (code === 58) { effects.enter('tableDelimiterAlignment'); effects.consume(code); effects.exit('tableDelimiterAlignment'); align.push('left'); return afterLeftAlignment } // If we start with a pipe, we open a cell marker. if (code === 124) { effects.enter('tableCellDivider'); effects.consume(code); effects.exit('tableCellDivider'); return atDelimiterRowBreak } return nok(code) } function inWhitespaceDelimiter(code) { // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.consume(code); return inWhitespaceDelimiter } effects.exit('whitespace'); return atDelimiterRowBreak(code) } function inFillerDelimiter(code) { // `-` if (code === 45) { effects.consume(code); return inFillerDelimiter } effects.exit('tableDelimiterFiller'); // `:` if (code === 58) { effects.enter('tableDelimiterAlignment'); effects.consume(code); effects.exit('tableDelimiterAlignment'); align[align.length - 1] = align[align.length - 1] === 'left' ? 'center' : 'right'; return afterRightAlignment } return atDelimiterRowBreak(code) } function afterLeftAlignment(code) { // `-` if (code === 45) { effects.enter('tableDelimiterFiller'); effects.consume(code); hasDash = true; return inFillerDelimiter } // Anything else is not ok. return nok(code) } function afterRightAlignment(code) { // EOF, CR, LF, CRLF. if (code === null || code === -5 || code === -4 || code === -3) { return rowEndDelimiter(code) } // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.enter('whitespace'); effects.consume(code); return inWhitespaceDelimiter } // `|` if (code === 124) { effects.enter('tableCellDivider'); effects.consume(code); effects.exit('tableCellDivider'); return atDelimiterRowBreak } return nok(code) } function rowEndDelimiter(code) { effects.exit('tableDelimiterRow'); // Exit if there was no dash at all, or if the header cell count is not the // delimiter cell count. if (!hasDash || tableHeaderCount !== align.length) { return nok(code) } if (code === null) { return tableClose(code) } return effects.check(nextPrefixedOrBlank, tableClose, tableContinue)(code) } function tableClose(code) { effects.exit('table'); return ok(code) } function tableContinue(code) { // Always a line ending. effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); // We checked that it’s not a prefixed or blank line, so we’re certain a // body is coming, though it may be indented. return factorySpace(effects, bodyStart, 'linePrefix', 4) } function bodyStart(code) { effects.enter('tableBody'); return rowStartBody(code) } function rowStartBody(code) { effects.enter('tableRow'); // If we start with a pipe, we open a cell marker. if (code === 124) { return cellDividerBody(code) } effects.enter('temporaryTableCellContent'); // Can’t be space or eols at the start of a construct, so we’re in a cell. return inCellContentBody(code) } function cellDividerBody(code) { // Always a pipe. effects.enter('tableCellDivider'); effects.consume(code); effects.exit('tableCellDivider'); return cellBreakBody } function cellBreakBody(code) { // EOF, CR, LF, CRLF. if (code === null || code === -5 || code === -4 || code === -3) { return atRowEndBody(code) } // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.enter('whitespace'); effects.consume(code); return inWhitespaceBody } // `|` if (code === 124) { return cellDividerBody(code) } // Anything else is cell content. effects.enter('temporaryTableCellContent'); return inCellContentBody(code) } function inWhitespaceBody(code) { // HT, VS, SP. if (code === -2 || code === -1 || code === 32) { effects.consume(code); return inWhitespaceBody } effects.exit('whitespace'); return cellBreakBody(code) } function inCellContentBody(code) { // EOF, whitespace, pipe if (code === null || code < 0 || code === 32 || code === 124) { effects.exit('temporaryTableCellContent'); return cellBreakBody(code) } effects.consume(code); // `\` return code === 92 ? inCellContentEscapeBody : inCellContentBody } function inCellContentEscapeBody(code) { // `\` or `|` if (code === 92 || code === 124) { effects.consume(code); return inCellContentBody } // Anything else. return inCellContentBody(code) } function atRowEndBody(code) { effects.exit('tableRow'); if (code === null) { return tableBodyClose(code) } return effects.check( nextPrefixedOrBlank, tableBodyClose, tableBodyContinue )(code) } function tableBodyClose(code) { effects.exit('tableBody'); return tableClose(code) } function tableBodyContinue(code) { // Always a line ending. effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); // Support an optional prefix, then start a body row. return factorySpace(effects, rowStartBody, 'linePrefix', 4) } } // Based on micromark, but that won’t work as we’re in a table, and that expects // content. // function tokenizeSetextUnderlineMini(effects, ok, nok) { return start function start(code) { // `-` if (code !== 45) { return nok(code) } effects.enter('setextUnderline'); return sequence(code) } function sequence(code) { if (code === 45) { effects.consume(code); return sequence } return whitespace(code) } function whitespace(code) { if (code === -2 || code === -1 || code === 32) { effects.consume(code); return whitespace } if (code === null || code === -5 || code === -4 || code === -3) { return ok(code) } return nok(code) } } function tokenizeNextPrefixedOrBlank(effects, ok, nok) { var size = 0; return start function start(code) { // This is a check, so we don’t care about tokens, but we open a bogus one // so we’re valid. effects.enter('check'); // EOL. effects.consume(code); return whitespace } function whitespace(code) { // VS or SP. if (code === -1 || code === 32) { effects.consume(code); size++; return size === 4 ? ok : whitespace } // EOF or whitespace if (code === null || code < 0) { return ok(code) } // Anything else. return nok(code) } } var syntax$1 = { flow: flow }; var micromarkExtensionGfmTable = syntax$1; var sizeChunks_1 = sizeChunks; // Measure the number of character codes in chunks. // Counts tabs based on their expanded size, and CR+LF as one character. function sizeChunks(chunks) { var index = -1; var size = 0; while (++index < chunks.length) { size += typeof chunks[index] === 'string' ? chunks[index].length : 1; } return size } var prefixSize_1 = prefixSize; function prefixSize(events, type) { var tail = events[events.length - 1]; if (!tail || tail[1].type !== type) return 0 return sizeChunks_1(tail[2].sliceStream(tail[1])) } var tasklistCheck = {tokenize: tokenizeTasklistCheck}; var text$1 = {91: tasklistCheck}; function tokenizeTasklistCheck(effects, ok, nok) { var self = this; return open function open(code) { if ( // Exit if not `[`. code !== 91 || // Exit if there’s stuff before. self.previous !== null || // Exit if not in the first content that is the first child of a list // item. !self._gfmTasklistFirstContentOfListItem ) { return nok(code) } effects.enter('taskListCheck'); effects.enter('taskListCheckMarker'); effects.consume(code); effects.exit('taskListCheckMarker'); return inside } function inside(code) { // Tab or space. if (code === -2 || code === 32) { effects.enter('taskListCheckValueUnchecked'); effects.consume(code); effects.exit('taskListCheckValueUnchecked'); return close } // Upper- and lower `x`. if (code === 88 || code === 120) { effects.enter('taskListCheckValueChecked'); effects.consume(code); effects.exit('taskListCheckValueChecked'); return close } return nok(code) } function close(code) { // `]` if (code === 93) { effects.enter('taskListCheckMarker'); effects.consume(code); effects.exit('taskListCheckMarker'); effects.exit('taskListCheck'); return effects.check({tokenize: spaceThenNonSpace}, ok, nok) } return nok(code) } } function spaceThenNonSpace(effects, ok, nok) { var self = this; return factorySpace(effects, after, 'whitespace') function after(code) { return prefixSize_1(self.events, 'whitespace') && code !== null && !markdownLineEndingOrSpace_1(code) ? ok(code) : nok(code) } } var syntax$2 = { text: text$1 }; var micromarkExtensionGfmTaskListItem = syntax$2; var syntax$3 = create$1; function create$1(options) { return combineExtensions_1([micromarkExtensionGfmAutolinkLiteral, micromarkExtensionGfmStrikethrough(options), micromarkExtensionGfmTable, micromarkExtensionGfmTaskListItem]) } var micromarkExtensionGfm = syntax$3; var enter = { literalAutolink: enterLiteralAutolink, literalAutolinkEmail: enterLiteralAutolinkValue, literalAutolinkHttp: enterLiteralAutolinkValue, literalAutolinkWww: enterLiteralAutolinkValue }; var exit = { literalAutolink: exitLiteralAutolink, literalAutolinkEmail: exitLiteralAutolinkEmail, literalAutolinkHttp: exitLiteralAutolinkHttp, literalAutolinkWww: exitLiteralAutolinkWww }; function enterLiteralAutolink(token) { this.enter({type: 'link', title: null, url: '', children: []}, token); } function enterLiteralAutolinkValue(token) { this.config.enter.autolinkProtocol.call(this, token); } function exitLiteralAutolinkHttp(token) { this.config.exit.autolinkProtocol.call(this, token); } function exitLiteralAutolinkWww(token) { this.config.exit.data.call(this, token); this.stack[this.stack.length - 1].url = 'http://' + this.sliceSerialize(token); } function exitLiteralAutolinkEmail(token) { this.config.exit.autolinkEmail.call(this, token); } function exitLiteralAutolink(token) { this.exit(token); } var fromMarkdown = { enter: enter, exit: exit }; var canContainEols = ['delete']; var enter$1 = {strikethrough: enterStrikethrough}; var exit$1 = {strikethrough: exitStrikethrough}; function enterStrikethrough(token) { this.enter({type: 'delete', children: []}, token); } function exitStrikethrough(token) { this.exit(token); } var fromMarkdown$1 = { canContainEols: canContainEols, enter: enter$1, exit: exit$1 }; var enter$2 = { table: enterTable, tableData: enterCell, tableHeader: enterCell, tableRow: enterRow }; var exit_1 = { codeText: exitCodeText, table: exitTable, tableData: exit$2, tableHeader: exit$2, tableRow: exit$2 }; function enterTable(token) { this.enter({type: 'table', align: token._align, children: []}, token); this.setData('inTable', true); } function exitTable(token) { this.exit(token); this.setData('inTable'); } function enterRow(token) { this.enter({type: 'tableRow', children: []}, token); } function exit$2(token) { this.exit(token); } function enterCell(token) { this.enter({type: 'tableCell', children: []}, token); } // Overwrite the default code text data handler to unescape escaped pipes when // they are in tables. function exitCodeText(token) { var value = this.resume(); if (this.getData('inTable')) { value = value.replace(/\\([\\|])/g, replace); } this.stack[this.stack.length - 1].value = value; this.exit(token); } function replace($0, $1) { // Pipes work, backslashes don’t (but can’t escape pipes). return $1 === '|' ? $1 : $0 } var fromMarkdown$2 = { enter: enter$2, exit: exit_1 }; var exit$3 = { taskListCheckValueChecked: exitCheck, taskListCheckValueUnchecked: exitCheck, paragraph: exitParagraphWithTaskListItem }; function exitCheck(token) { // We’re always in a paragraph, in a list item. this.stack[this.stack.length - 2].checked = token.type === 'taskListCheckValueChecked'; } function exitParagraphWithTaskListItem(token) { var parent = this.stack[this.stack.length - 2]; var node = this.stack[this.stack.length - 1]; var siblings = parent.children; var head = node.children[0]; var index = -1; var firstParaghraph; if ( parent && parent.type === 'listItem' && typeof parent.checked === 'boolean' && head && head.type === 'text' ) { while (++index < siblings.length) { if (siblings[index].type === 'paragraph') { firstParaghraph = siblings[index]; break } } if (firstParaghraph === node) { // Must start with a space or a tab. head.value = head.value.slice(1); if (head.value.length === 0) { node.children.shift(); } else { head.position.start.column++; head.position.start.offset++; node.position.start = Object.assign({}, head.position.start); } } } this.exit(token); } var fromMarkdown$3 = { exit: exit$3 }; var own = {}.hasOwnProperty; var fromMarkdown$4 = configure([ fromMarkdown, fromMarkdown$1, fromMarkdown$2, fromMarkdown$3 ]); function configure(extensions) { var config = {canContainEols: []}; var length = extensions.length; var index = -1; while (++index < length) { extension$1(config, extensions[index]); } return config } function extension$1(config, extension) { var key; var left; var right; for (key in extension) { left = own.call(config, key) ? config[key] : (config[key] = {}); right = extension[key]; if (key === 'canContainEols') { config[key] = [].concat(left, right); } else { Object.assign(left, right); } } } var inConstruct = 'phrasing'; var notInConstruct = ['autolink', 'link', 'image']; var unsafe = [ { character: '@', before: '[+\\-.\\w]', after: '[\\-.\\w]', inConstruct: inConstruct, notInConstruct: notInConstruct }, { character: '.', before: '[Ww]', after: '[\\-.\\w]', inConstruct: inConstruct, notInConstruct: notInConstruct }, { character: ':', before: '[ps]', after: '\\/', inConstruct: inConstruct, notInConstruct: notInConstruct } ]; var toMarkdown = { unsafe: unsafe }; var containerPhrasing = phrasing; function phrasing(parent, context, safeOptions) { var children = parent.children || []; var results = []; var index = -1; var before = safeOptions.before; var after; var handle; var child; while (++index < children.length) { child = children[index]; if (index + 1 < children.length) { handle = context.handle.handlers[children[index + 1].type]; if (handle && handle.peek) handle = handle.peek; after = handle ? handle(children[index + 1], parent, context, { before: '', after: '' }).charAt(0) : ''; } else { after = safeOptions.after; } results.push( context.handle(child, parent, context, { before: before, after: after }) ); before = results[results.length - 1].slice(-1); } return results.join('') } var unsafe$1 = [{character: '~', inConstruct: 'phrasing'}]; var handlers = {delete: handleDelete}; handleDelete.peek = peekDelete; function handleDelete(node, _, context) { var exit = context.enter('emphasis'); var value = containerPhrasing(node, context, {before: '~', after: '~'}); exit(); return '~~' + value + '~~' } function peekDelete() { return '~' } var toMarkdown$1 = { unsafe: unsafe$1, handlers: handlers }; var inlineCode_1 = inlineCode; inlineCode.peek = inlineCodePeek; function inlineCode(node) { var value = node.value || ''; var sequence = '`'; var pad = ''; // If there is a single grave accent on its own in the code, use a fence of // two. // If there are two in a row, use one. while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { sequence += '`'; } // If this is not just spaces or eols (tabs don’t count), and either the // first or last character are a space, eol, or tick, then pad with spaces. if ( /[^ \r\n]/.test(value) && (/[ \r\n`]/.test(value.charAt(0)) || /[ \r\n`]/.test(value.charAt(value.length - 1))) ) { pad = ' '; } return sequence + pad + value + pad + sequence } function inlineCodePeek() { return '`' } /*! * repeat-string * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ /** * Results cache */ var res = ''; var cache; /** * Expose `repeat` */ var repeatString = repeat$1; /** * Repeat the given `string` the specified `number` * of times. * * **Example:** * * ```js * var repeat = require('repeat-string'); * repeat('A', 5); * //=> AAAAA * ``` * * @param {String} `string` The string to repeat * @param {Number} `number` The number of times to repeat the string * @return {String} Repeated string * @api public */ function repeat$1(str, num) { if (typeof str !== 'string') { throw new TypeError('expected a string'); } // cover common, quick use cases if (num === 1) return str; if (num === 2) return str + str; var max = str.length * num; if (cache !== str || typeof cache === 'undefined') { cache = str; res = ''; } else if (res.length >= max) { return res.substr(0, max); } while (max > res.length && num > 1) { if (num & 1) { res += str; } num >>= 1; str += str; } res += str; res = res.substr(0, max); return res; } var markdownTable_1 = markdownTable; var trailingWhitespace = / +$/; // Characters. var space = ' '; var lineFeed = '\n'; var dash = '-'; var colon = ':'; var verticalBar = '|'; var x = 0; var C = 67; var L = 76; var R = 82; var c = 99; var l = 108; var r = 114; // Create a table from a matrix of strings. function markdownTable(table, options) { var settings = options || {}; var padding = settings.padding !== false; var start = settings.delimiterStart !== false; var end = settings.delimiterEnd !== false; var align = (settings.align || []).concat(); var alignDelimiters = settings.alignDelimiters !== false; var alignments = []; var stringLength = settings.stringLength || defaultStringLength; var rowIndex = -1; var rowLength = table.length; var cellMatrix = []; var sizeMatrix = []; var row = []; var sizes = []; var longestCellByColumn = []; var mostCellsPerRow = 0; var cells; var columnIndex; var columnLength; var largest; var size; var cell; var lines; var line; var before; var after; var code; // This is a superfluous loop if we don’t align delimiters, but otherwise we’d // do superfluous work when aligning, so optimize for aligning. while (++rowIndex < rowLength) { cells = table[rowIndex]; columnIndex = -1; columnLength = cells.length; row = []; sizes = []; if (columnLength > mostCellsPerRow) { mostCellsPerRow = columnLength; } while (++columnIndex < columnLength) { cell = serialize(cells[columnIndex]); if (alignDelimiters === true) { size = stringLength(cell); sizes[columnIndex] = size; largest = longestCellByColumn[columnIndex]; if (largest === undefined || size > largest) { longestCellByColumn[columnIndex] = size; } } row.push(cell); } cellMatrix[rowIndex] = row; sizeMatrix[rowIndex] = sizes; } // Figure out which alignments to use. columnIndex = -1; columnLength = mostCellsPerRow; if (typeof align === 'object' && 'length' in align) { while (++columnIndex < columnLength) { alignments[columnIndex] = toAlignment(align[columnIndex]); } } else { code = toAlignment(align); while (++columnIndex < columnLength) { alignments[columnIndex] = code; } } // Inject the alignment row. columnIndex = -1; columnLength = mostCellsPerRow; row = []; sizes = []; while (++columnIndex < columnLength) { code = alignments[columnIndex]; before = ''; after = ''; if (code === l) { before = colon; } else if (code === r) { after = colon; } else if (code === c) { before = colon; after = colon; } // There *must* be at least one hyphen-minus in each alignment cell. size = alignDelimiters ? Math.max( 1, longestCellByColumn[columnIndex] - before.length - after.length ) : 1; cell = before + repeatString(dash, size) + after; if (alignDelimiters === true) { size = before.length + size + after.length; if (size > longestCellByColumn[columnIndex]) { longestCellByColumn[columnIndex] = size; } sizes[columnIndex] = size; } row[columnIndex] = cell; } // Inject the alignment row. cellMatrix.splice(1, 0, row); sizeMatrix.splice(1, 0, sizes); rowIndex = -1; rowLength = cellMatrix.length; lines = []; while (++rowIndex < rowLength) { row = cellMatrix[rowIndex]; sizes = sizeMatrix[rowIndex]; columnIndex = -1; columnLength = mostCellsPerRow; line = []; while (++columnIndex < columnLength) { cell = row[columnIndex] || ''; before = ''; after = ''; if (alignDelimiters === true) { size = longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0); code = alignments[columnIndex]; if (code === r) { before = repeatString(space, size); } else if (code === c) { if (size % 2 === 0) { before = repeatString(space, size / 2); after = before; } else { before = repeatString(space, size / 2 + 0.5); after = repeatString(space, size / 2 - 0.5); } } else { after = repeatString(space, size); } } if (start === true && columnIndex === 0) { line.push(verticalBar); } if ( padding === true && // Don’t add the opening space if we’re not aligning and the cell is // empty: there will be a closing space. !(alignDelimiters === false && cell === '') && (start === true || columnIndex !== 0) ) { line.push(space); } if (alignDelimiters === true) { line.push(before); } line.push(cell); if (alignDelimiters === true) { line.push(after); } if (padding === true) { line.push(space); } if (end === true || columnIndex !== columnLength - 1) { line.push(verticalBar); } } line = line.join(''); if (end === false) { line = line.replace(trailingWhitespace, ''); } lines.push(line); } return lines.join(lineFeed) } function serialize(value) { return value === null || value === undefined ? '' : String(value) } function defaultStringLength(value) { return value.length } function toAlignment(value) { var code = typeof value === 'string' ? value.charCodeAt(0) : x; return code === L || code === l ? l : code === R || code === r ? r : code === C || code === c ? c : x } var toMarkdown_1 = toMarkdown$2; function toMarkdown$2(options) { var settings = options || {}; var padding = settings.tableCellPadding; var alignDelimiters = settings.tablePipeAlign; var stringLength = settings.stringLength; var around = padding ? ' ' : '|'; return { unsafe: [ {character: '\r', inConstruct: 'tableCell'}, {character: '\n', inConstruct: 'tableCell'}, // A pipe, when followed by a tab or space (padding), or a dash or colon // (unpadded delimiter row), could result in a table. {atBreak: true, character: '|', after: '[\t :-]'}, // A pipe in a cell must be encoded. {character: '|', inConstruct: 'tableCell'}, // A colon must be followed by a dash, in which case it could start a // delimiter row. {atBreak: true, character: ':', after: '-'}, // A delimiter row can also start with a dash, when followed by more // dashes, a colon, or a pipe. // This is a stricter version than the built in check for lists, thematic // breaks, and setex heading underlines though: // {atBreak: true, character: '-', after: '[:|-]'} ], handlers: { table: handleTable, tableRow: handleTableRow, tableCell: handleTableCell, inlineCode: inlineCodeWithTable } } function handleTable(node, _, context) { return serializeData(handleTableAsData(node, context), node.align) } // This function isn’t really used normally, because we handle rows at the // table level. // But, if someone passes in a table row, this ensures we make somewhat sense. function handleTableRow(node, _, context) { var row = handleTableRowAsData(node, context); // `markdown-table` will always add an align row var value = serializeData([row]); return value.slice(0, value.indexOf('\n')) } function handleTableCell(node, _, context) { var exit = context.enter('tableCell'); var value = containerPhrasing(node, context, {before: around, after: around}); exit(); return value } function serializeData(matrix, align) { return markdownTable_1(matrix, { align: align, alignDelimiters: alignDelimiters, padding: padding, stringLength: stringLength }) } function handleTableAsData(node, context) { var children = node.children; var index = -1; var length = children.length; var result = []; var subexit = context.enter('table'); while (++index < length) { result[index] = handleTableRowAsData(children[index], context); } subexit(); return result } function handleTableRowAsData(node, context) { var children = node.children; var index = -1; var length = children.length; var result = []; var subexit = context.enter('tableRow'); while (++index < length) { result[index] = handleTableCell(children[index], node, context); } subexit(); return result } function inlineCodeWithTable(node, parent, context) { var value = inlineCode_1(node); if (context.stack.indexOf('tableCell') !== -1) { value = value.replace(/\|/, '\\$&'); } return value } } var checkBullet_1 = checkBullet; function checkBullet(context) { var marker = context.options.bullet || '*'; if (marker !== '*' && marker !== '+' && marker !== '-') { throw new Error( 'Cannot serialize items with `' + marker + '` for `options.bullet`, expected `*`, `+`, or `-`' ) } return marker } var checkListItemIndent_1 = checkListItemIndent; function checkListItemIndent(context) { var style = context.options.listItemIndent || 'tab'; if (style === 1 || style === '1') { return 'one' } if (style !== 'tab' && style !== 'one' && style !== 'mixed') { throw new Error( 'Cannot serialize items with `' + style + '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' ) } return style } var containerFlow = flow$1; function flow$1(parent, context) { var children = parent.children || []; var results = []; var index = -1; var child; while (++index < children.length) { child = children[index]; results.push( context.handle(child, parent, context, {before: '\n', after: '\n'}) ); if (index + 1 < children.length) { results.push(between(child, children[index + 1])); } } return results.join('') function between(left, right) { var index = -1; var result; while (++index < context.join.length) { result = context.join[index](left, right, parent, context); if (result === true || result === 1) { break } if (typeof result === 'number') { return repeatString('\n', 1 + Number(result)) } if (result === false) { return '\n\n\n\n' } } return '\n\n' } } var indentLines_1 = indentLines; var eol = /\r?\n|\r/g; function indentLines(value, map) { var result = []; var start = 0; var line = 0; var match; while ((match = eol.exec(value))) { one(value.slice(start, match.index)); result.push(match[0]); start = match.index + match[0].length; line++; } one(value.slice(start)); return result.join('') function one(value) { result.push(map(value, line, !value)); } } var listItem_1 = listItem; function listItem(node, parent, context) { var bullet = checkBullet_1(context); var listItemIndent = checkListItemIndent_1(context); var size; var value; var exit; if (parent && parent.ordered) { bullet = (parent.start > -1 ? parent.start : 1) + (context.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + '.'; } size = bullet.length + 1; if ( listItemIndent === 'tab' || (listItemIndent === 'mixed' && ((parent && parent.spread) || node.spread)) ) { size = Math.ceil(size / 4) * 4; } exit = context.enter('listItem'); value = indentLines_1(containerFlow(node, context), map); exit(); return value function map(line, index, blank) { if (index) { return (blank ? '' : repeatString(' ', size)) + line } return (blank ? bullet : bullet + repeatString(' ', size - bullet.length)) + line } } var unsafe$2 = [{atBreak: true, character: '-', after: '[:|-]'}]; var handlers$1 = { listItem: listItemWithTaskListItem }; function listItemWithTaskListItem(node, parent, context) { var value = listItem_1(node, parent, context); var head = node.children[0]; if (typeof node.checked === 'boolean' && head && head.type === 'paragraph') { value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check); } return value function check($0) { return $0 + '[' + (node.checked ? 'x' : ' ') + '] ' } } var toMarkdown$3 = { unsafe: unsafe$2, handlers: handlers$1 }; var toMarkdown_1$1 = toMarkdown$4; function toMarkdown$4(options) { var extensions = [ toMarkdown, toMarkdown$1, toMarkdown_1(options), toMarkdown$3 ]; var length = extensions.length; var index = -1; var extension; var unsafe = []; var handlers = {}; while (++index < length) { extension = extensions[index]; // istanbul ignore next - unsafe always exists, for now. unsafe = unsafe.concat(extension.unsafe || []); handlers = Object.assign(handlers, extension.handlers || {}); } return {unsafe: unsafe, handlers: handlers} } var warningIssued; var remarkGfm = gfm; function gfm(options) { var data = this.data(); /* istanbul ignore next - old remark. */ if ( !warningIssued && ((this.Parser && this.Parser.prototype && this.Parser.prototype.blockTokenizers) || (this.Compiler && this.Compiler.prototype && this.Compiler.prototype.visitors)) ) { warningIssued = true; console.warn( '[remark-gfm] Warning: please upgrade to remark 13 to use this plugin' ); } add('micromarkExtensions', micromarkExtensionGfm(options)); add('fromMarkdownExtensions', fromMarkdown$4); add('toMarkdownExtensions', toMarkdown_1$1(options)); function add(field, value) { /* istanbul ignore if - other extensions. */ if (data[field]) data[field].push(value); else data[field] = [value]; } } var bail_1 = bail; function bail(err) { if (err) { throw err } } /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ var isBuffer = function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) }; var hasOwn = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var defineProperty = Object.defineProperty; var gOPD = Object.getOwnPropertyDescriptor; var isArray = function isArray(arr) { if (typeof Array.isArray === 'function') { return Array.isArray(arr); } return toStr.call(arr) === '[object Array]'; }; var isPlainObject = function isPlainObject(obj) { if (!obj || toStr.call(obj) !== '[object Object]') { return false; } var hasOwnConstructor = hasOwn.call(obj, 'constructor'); var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for (key in obj) { /**/ } return typeof key === 'undefined' || hasOwn.call(obj, key); }; // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target var setProperty = function setProperty(target, options) { if (defineProperty && options.name === '__proto__') { defineProperty(target, options.name, { enumerable: true, configurable: true, value: options.newValue, writable: true }); } else { target[options.name] = options.newValue; } }; // Return undefined instead of __proto__ if '__proto__' is not an own property var getProperty = function getProperty(obj, name) { if (name === '__proto__') { if (!hasOwn.call(obj, name)) { return void 0; } else if (gOPD) { // In early versions of node, obj['__proto__'] is buggy when obj has // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. return gOPD(obj, name).value; } } return obj[name]; }; var extend$1 = function extend() { var options, name, src, copy, copyIsArray, clone; var target = arguments[0]; var i = 1; var length = arguments.length; var deep = false; // Handle a deep copy situation if (typeof target === 'boolean') { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { target = {}; } for (; i < length; ++i) { options = arguments[i]; // Only deal with non-null/undefined values if (options != null) { // Extend the base object for (name in options) { src = getProperty(target, name); copy = getProperty(options, name); // Prevent never-ending loop if (target !== copy) { // Recurse if we're merging plain objects or arrays if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } // Never move original objects, clone them setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); // Don't bring in undefined values } else if (typeof copy !== 'undefined') { setProperty(target, { name: name, newValue: copy }); } } } } } // Return the modified object return target; }; var isPlainObj = value => { if (Object.prototype.toString.call(value) !== '[object Object]') { return false; } const prototype = Object.getPrototypeOf(value); return prototype === null || prototype === Object.prototype; }; var slice = [].slice; var wrap_1 = wrap; // Wrap `fn`. // Can be sync or async; return a promise, receive a completion handler, return // new values and errors. function wrap(fn, callback) { var invoked; return wrapped function wrapped() { var params = slice.call(arguments, 0); var callback = fn.length > params.length; var result; if (callback) { params.push(done); } try { result = fn.apply(null, params); } catch (error) { // Well, this is quite the pickle. // `fn` received a callback and invoked it (thus continuing the pipeline), // but later also threw an error. // We’re not about to restart the pipeline again, so the only thing left // to do is to throw the thing instead. if (callback && invoked) { throw error } return done(error) } if (!callback) { if (result && typeof result.then === 'function') { result.then(then, done); } else if (result instanceof Error) { done(result); } else { then(result); } } } // Invoke `next`, only once. function done() { if (!invoked) { invoked = true; callback.apply(null, arguments); } } // Invoke `done` with one value. // Tracks if an error is passed, too. function then(value) { done(null, value); } } var trough_1 = trough; trough.wrap = wrap_1; var slice$1 = [].slice; // Create new middleware. function trough() { var fns = []; var middleware = {}; middleware.run = run; middleware.use = use; return middleware // Run `fns`. Last argument must be a completion handler. function run() { var index = -1; var input = slice$1.call(arguments, 0, -1); var done = arguments[arguments.length - 1]; if (typeof done !== 'function') { throw new Error('Expected function as last argument, not ' + done) } next.apply(null, [null].concat(input)); // Run the next `fn`, if any. function next(err) { var fn = fns[++index]; var params = slice$1.call(arguments, 0); var values = params.slice(1); var length = input.length; var pos = -1; if (err) { done(err); return } // Copy non-nully input into values. while (++pos < length) { if (values[pos] === null || values[pos] === undefined) { values[pos] = input[pos]; } } input = values; // Next or done. if (fn) { wrap_1(fn, next).apply(null, input); } else { done.apply(null, [null].concat(input)); } } } // Add `fn` to the list. function use(fn) { if (typeof fn !== 'function') { throw new Error('Expected `fn` to be a function, not ' + fn) } fns.push(fn); return middleware } } var own$1 = {}.hasOwnProperty; var unistUtilStringifyPosition = stringify; function stringify(value) { // Nothing. if (!value || typeof value !== 'object') { return '' } // Node. if (own$1.call(value, 'position') || own$1.call(value, 'type')) { return position(value.position) } // Position. if (own$1.call(value, 'start') || own$1.call(value, 'end')) { return position(value) } // Point. if (own$1.call(value, 'line') || own$1.call(value, 'column')) { return point(value) } // ? return '' } function point(point) { if (!point || typeof point !== 'object') { point = {}; } return index$1(point.line) + ':' + index$1(point.column) } function position(pos) { if (!pos || typeof pos !== 'object') { pos = {}; } return point(pos.start) + '-' + point(pos.end) } function index$1(value) { return value && typeof value === 'number' ? value : 1 } var vfileMessage = VMessage; // Inherit from `Error#`. function VMessagePrototype() {} VMessagePrototype.prototype = Error.prototype; VMessage.prototype = new VMessagePrototype(); // Message properties. var proto = VMessage.prototype; proto.file = ''; proto.name = ''; proto.reason = ''; proto.message = ''; proto.stack = ''; proto.fatal = null; proto.column = null; proto.line = null; // Construct a new VMessage. // // Note: We cannot invoke `Error` on the created context, as that adds readonly // `line` and `column` attributes on Safari 9, thus throwing and failing the // data. function VMessage(reason, position, origin) { var parts; var range; var location; if (typeof position === 'string') { origin = position; position = null; } parts = parseOrigin(origin); range = unistUtilStringifyPosition(position) || '1:1'; location = { start: {line: null, column: null}, end: {line: null, column: null} }; // Node. if (position && position.position) { position = position.position; } if (position) { // Position. if (position.start) { location = position; position = position.start; } else { // Point. location.start = position; } } if (reason.stack) { this.stack = reason.stack; reason = reason.message; } this.message = reason; this.name = range; this.reason = reason; this.line = position ? position.line : null; this.column = position ? position.column : null; this.location = location; this.source = parts[0]; this.ruleId = parts[1]; } function parseOrigin(origin) { var result = [null, null]; var index; if (typeof origin === 'string') { index = origin.indexOf(':'); if (index === -1) { result[1] = origin; } else { result[0] = origin.slice(0, index); result[1] = origin.slice(index + 1); } } return result } function replaceExt(npath, ext) { if (typeof npath !== 'string') { return npath; } if (npath.length === 0) { return npath; } var nFileName = path__default['default'].basename(npath, path__default['default'].extname(npath)) + ext; return path__default['default'].join(path__default['default'].dirname(npath), nFileName); } var replaceExt_1 = replaceExt; var core$1 = VFile; var own$2 = {}.hasOwnProperty; var proto$1 = VFile.prototype; // Order of setting (least specific to most), we need this because otherwise // `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a // stem can be set. var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; proto$1.toString = toString; // Access full path (`~/index.min.js`). Object.defineProperty(proto$1, 'path', {get: getPath, set: setPath}); // Access parent path (`~`). Object.defineProperty(proto$1, 'dirname', {get: getDirname, set: setDirname}); // Access basename (`index.min.js`). Object.defineProperty(proto$1, 'basename', {get: getBasename, set: setBasename}); // Access extname (`.js`). Object.defineProperty(proto$1, 'extname', {get: getExtname, set: setExtname}); // Access stem (`index.min`). Object.defineProperty(proto$1, 'stem', {get: getStem, set: setStem}); // Construct a new file. function VFile(options) { var prop; var index; var length; if (!options) { options = {}; } else if (typeof options === 'string' || isBuffer(options)) { options = {contents: options}; } else if ('message' in options && 'messages' in options) { return options } if (!(this instanceof VFile)) { return new VFile(options) } this.data = {}; this.messages = []; this.history = []; this.cwd = process.cwd(); // Set path related properties in the correct order. index = -1; length = order.length; while (++index < length) { prop = order[index]; if (own$2.call(options, prop)) { this[prop] = options[prop]; } } // Set non-path related properties. for (prop in options) { if (order.indexOf(prop) === -1) { this[prop] = options[prop]; } } } function getPath() { return this.history[this.history.length - 1] } function setPath(path) { assertNonEmpty(path, 'path'); if (path !== this.path) { this.history.push(path); } } function getDirname() { return typeof this.path === 'string' ? path__default['default'].dirname(this.path) : undefined } function setDirname(dirname) { assertPath(this.path, 'dirname'); this.path = path__default['default'].join(dirname || '', this.basename); } function getBasename() { return typeof this.path === 'string' ? path__default['default'].basename(this.path) : undefined } function setBasename(basename) { assertNonEmpty(basename, 'basename'); assertPart(basename, 'basename'); this.path = path__default['default'].join(this.dirname || '', basename); } function getExtname() { return typeof this.path === 'string' ? path__default['default'].extname(this.path) : undefined } function setExtname(extname) { var ext = extname || ''; assertPart(ext, 'extname'); assertPath(this.path, 'extname'); if (ext) { if (ext.charAt(0) !== '.') { throw new Error('`extname` must start with `.`') } if (ext.indexOf('.', 1) !== -1) { throw new Error('`extname` cannot contain multiple dots') } } this.path = replaceExt_1(this.path, ext); } function getStem() { return typeof this.path === 'string' ? path__default['default'].basename(this.path, this.extname) : undefined } function setStem(stem) { assertNonEmpty(stem, 'stem'); assertPart(stem, 'stem'); this.path = path__default['default'].join(this.dirname || '', stem + (this.extname || '')); } // Get the value of the file. function toString(encoding) { var value = this.contents || ''; return isBuffer(value) ? value.toString(encoding) : String(value) } // Assert that `part` is not a path (i.e., does not contain `path.sep`). function assertPart(part, name) { if (part.indexOf(path__default['default'].sep) !== -1) { throw new Error( '`' + name + '` cannot be a path: did not expect `' + path__default['default'].sep + '`' ) } } // Assert that `part` is not empty. function assertNonEmpty(part, name) { if (!part) { throw new Error('`' + name + '` cannot be empty') } } // Assert `path` exists. function assertPath(path, name) { if (!path) { throw new Error('Setting `' + name + '` requires `path` to be set too') } } var vfile = core$1; var proto$2 = core$1.prototype; proto$2.message = message; proto$2.info = info; proto$2.fail = fail; // Create a message with `reason` at `position`. // When an error is passed in as `reason`, copies the stack. function message(reason, position, origin) { var filePath = this.path; var message = new vfileMessage(reason, position, origin); if (filePath) { message.name = filePath + ':' + message.name; message.file = filePath; } message.fatal = false; this.messages.push(message); return message } // Fail: creates a vmessage, associates it with the file, and throws it. function fail() { var message = this.message.apply(this, arguments); message.fatal = true; throw message } // Info: creates a vmessage, associates it with the file, and marks the fatality // as null. function info() { var message = this.message.apply(this, arguments); message.fatal = null; return message } // Expose a frozen processor. var unified_1 = unified().freeze(); var slice$2 = [].slice; var own$3 = {}.hasOwnProperty; // Process pipeline. var pipeline = trough_1() .use(pipelineParse) .use(pipelineRun) .use(pipelineStringify); function pipelineParse(p, ctx) { ctx.tree = p.parse(ctx.file); } function pipelineRun(p, ctx, next) { p.run(ctx.tree, ctx.file, done); function done(err, tree, file) { if (err) { next(err); } else { ctx.tree = tree; ctx.file = file; next(); } } } function pipelineStringify(p, ctx) { var result = p.stringify(ctx.tree, ctx.file); var file = ctx.file; if (result === undefined || result === null) ; else if (typeof result === 'string' || isBuffer(result)) { file.contents = result; } else { file.result = result; } } // Function to create the first processor. function unified() { var attachers = []; var transformers = trough_1(); var namespace = {}; var frozen = false; var freezeIndex = -1; // Data management. processor.data = data; // Lock. processor.freeze = freeze; // Plugins. processor.attachers = attachers; processor.use = use; // API. processor.parse = parse; processor.stringify = stringify; processor.run = run; processor.runSync = runSync; processor.process = process; processor.processSync = processSync; // Expose. return processor // Create a new processor based on the processor in the current scope. function processor() { var destination = unified(); var length = attachers.length; var index = -1; while (++index < length) { destination.use.apply(null, attachers[index]); } destination.data(extend$1(true, {}, namespace)); return destination } // Freeze: used to signal a processor that has finished configuration. // // For example, take unified itself: it’s frozen. // Plugins should not be added to it. // Rather, it should be extended, by invoking it, before modifying it. // // In essence, always invoke this when exporting a processor. function freeze() { var values; var plugin; var options; var transformer; if (frozen) { return processor } while (++freezeIndex < attachers.length) { values = attachers[freezeIndex]; plugin = values[0]; options = values[1]; transformer = null; if (options === false) { continue } if (options === true) { values[1] = undefined; } transformer = plugin.apply(processor, values.slice(1)); if (typeof transformer === 'function') { transformers.use(transformer); } } frozen = true; freezeIndex = Infinity; return processor } // Data management. // Getter / setter for processor-specific informtion. function data(key, value) { if (typeof key === 'string') { // Set `key`. if (arguments.length === 2) { assertUnfrozen('data', frozen); namespace[key] = value; return processor } // Get `key`. return (own$3.call(namespace, key) && namespace[key]) || null } // Set space. if (key) { assertUnfrozen('data', frozen); namespace = key; return processor } // Get space. return namespace } // Plugin management. // // Pass it: // * an attacher and options, // * a preset, // * a list of presets, attachers, and arguments (list of attachers and // options). function use(value) { var settings; assertUnfrozen('use', frozen); if (value === null || value === undefined) ; else if (typeof value === 'function') { addPlugin.apply(null, arguments); } else if (typeof value === 'object') { if ('length' in value) { addList(value); } else { addPreset(value); } } else { throw new Error('Expected usable value, not `' + value + '`') } if (settings) { namespace.settings = extend$1(namespace.settings || {}, settings); } return processor function addPreset(result) { addList(result.plugins); if (result.settings) { settings = extend$1(settings || {}, result.settings); } } function add(value) { if (typeof value === 'function') { addPlugin(value); } else if (typeof value === 'object') { if ('length' in value) { addPlugin.apply(null, value); } else { addPreset(value); } } else { throw new Error('Expected usable value, not `' + value + '`') } } function addList(plugins) { var length; var index; if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && 'length' in plugins) { length = plugins.length; index = -1; while (++index < length) { add(plugins[index]); } } else { throw new Error('Expected a list of plugins, not `' + plugins + '`') } } function addPlugin(plugin, value) { var entry = find(plugin); if (entry) { if (isPlainObj(entry[1]) && isPlainObj(value)) { value = extend$1(entry[1], value); } entry[1] = value; } else { attachers.push(slice$2.call(arguments)); } } } function find(plugin) { var length = attachers.length; var index = -1; var entry; while (++index < length) { entry = attachers[index]; if (entry[0] === plugin) { return entry } } } // Parse a file (in string or vfile representation) into a unist node using // the `Parser` on the processor. function parse(doc) { var file = vfile(doc); var Parser; freeze(); Parser = processor.Parser; assertParser('parse', Parser); if (newable(Parser, 'parse')) { return new Parser(String(file), file).parse() } return Parser(String(file), file) // eslint-disable-line new-cap } // Run transforms on a unist node representation of a file (in string or // vfile representation), async. function run(node, file, cb) { assertNode(node); freeze(); if (!cb && typeof file === 'function') { cb = file; file = null; } if (!cb) { return new Promise(executor) } executor(null, cb); function executor(resolve, reject) { transformers.run(node, vfile(file), done); function done(err, tree, file) { tree = tree || node; if (err) { reject(err); } else if (resolve) { resolve(tree); } else { cb(null, tree, file); } } } } // Run transforms on a unist node representation of a file (in string or // vfile representation), sync. function runSync(node, file) { var complete = false; var result; run(node, file, done); assertDone('runSync', 'run', complete); return result function done(err, tree) { complete = true; bail_1(err); result = tree; } } // Stringify a unist node representation of a file (in string or vfile // representation) into a string using the `Compiler` on the processor. function stringify(node, doc) { var file = vfile(doc); var Compiler; freeze(); Compiler = processor.Compiler; assertCompiler('stringify', Compiler); assertNode(node); if (newable(Compiler, 'compile')) { return new Compiler(node, file).compile() } return Compiler(node, file) // eslint-disable-line new-cap } // Parse a file (in string or vfile representation) into a unist node using // the `Parser` on the processor, then run transforms on that node, and // compile the resulting node using the `Compiler` on the processor, and // store that result on the vfile. function process(doc, cb) { freeze(); assertParser('process', processor.Parser); assertCompiler('process', processor.Compiler); if (!cb) { return new Promise(executor) } executor(null, cb); function executor(resolve, reject) { var file = vfile(doc); pipeline.run(processor, {file: file}, done); function done(err) { if (err) { reject(err); } else if (resolve) { resolve(file); } else { cb(null, file); } } } } // Process the given document (in string or vfile representation), sync. function processSync(doc) { var complete = false; var file; freeze(); assertParser('processSync', processor.Parser); assertCompiler('processSync', processor.Compiler); file = vfile(doc); process(file, done); assertDone('processSync', 'process', complete); return file function done(err) { complete = true; bail_1(err); } } } // Check if `value` is a constructor. function newable(value, name) { return ( typeof value === 'function' && value.prototype && // A function with keys in its prototype is probably a constructor. // Classes’ prototype methods are not enumerable, so we check if some value // exists in the prototype. (keys(value.prototype) || name in value.prototype) ) } // Check if `value` is an object with keys. function keys(value) { var key; for (key in value) { return true } return false } // Assert a parser is available. function assertParser(name, Parser) { if (typeof Parser !== 'function') { throw new Error('Cannot `' + name + '` without `Parser`') } } // Assert a compiler is available. function assertCompiler(name, Compiler) { if (typeof Compiler !== 'function') { throw new Error('Cannot `' + name + '` without `Compiler`') } } // Assert the processor is not frozen. function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( 'Cannot invoke `' + name + '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' ) } } // Assert `node` is a unist node. function assertNode(node) { if (!node || typeof node.type !== 'string') { throw new Error('Expected node, got `' + node + '`') } } // Assert that `complete` is `true`. function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( '`' + name + '` finished async. Use `' + asyncName + '` instead' ) } } var AEli = "Æ"; var AElig = "Æ"; var AM = "&"; var AMP = "&"; var Aacut = "Á"; var Aacute = "Á"; var Abreve = "Ă"; var Acir = "Â"; var Acirc = "Â"; var Acy = "А"; var Afr = "𝔄"; var Agrav = "À"; var Agrave = "À"; var Alpha = "Α"; var Amacr = "Ā"; var And = "⩓"; var Aogon = "Ą"; var Aopf = "𝔸"; var ApplyFunction = "⁡"; var Arin = "Å"; var Aring = "Å"; var Ascr = "𝒜"; var Assign = "≔"; var Atild = "Ã"; var Atilde = "Ã"; var Aum = "Ä"; var Auml = "Ä"; var Backslash = "∖"; var Barv = "⫧"; var Barwed = "⌆"; var Bcy = "Б"; var Because = "∵"; var Bernoullis = "ℬ"; var Beta = "Β"; var Bfr = "𝔅"; var Bopf = "𝔹"; var Breve = "˘"; var Bscr = "ℬ"; var Bumpeq = "≎"; var CHcy = "Ч"; var COP = "©"; var COPY = "©"; var Cacute = "Ć"; var Cap = "⋒"; var CapitalDifferentialD = "ⅅ"; var Cayleys = "ℭ"; var Ccaron = "Č"; var Ccedi = "Ç"; var Ccedil = "Ç"; var Ccirc = "Ĉ"; var Cconint = "∰"; var Cdot = "Ċ"; var Cedilla = "¸"; var CenterDot = "·"; var Cfr = "ℭ"; var Chi = "Χ"; var CircleDot = "⊙"; var CircleMinus = "⊖"; var CirclePlus = "⊕"; var CircleTimes = "⊗"; var ClockwiseContourIntegral = "∲"; var CloseCurlyDoubleQuote = "”"; var CloseCurlyQuote = "’"; var Colon = "∷"; var Colone = "⩴"; var Congruent = "≡"; var Conint = "∯"; var ContourIntegral = "∮"; var Copf = "ℂ"; var Coproduct = "∐"; var CounterClockwiseContourIntegral = "∳"; var Cross = "⨯"; var Cscr = "𝒞"; var Cup = "⋓"; var CupCap = "≍"; var DD = "ⅅ"; var DDotrahd = "⤑"; var DJcy = "Ђ"; var DScy = "Ѕ"; var DZcy = "Џ"; var Dagger = "‡"; var Darr = "↡"; var Dashv = "⫤"; var Dcaron = "Ď"; var Dcy = "Д"; var Del = "∇"; var Delta = "Δ"; var Dfr = "𝔇"; var DiacriticalAcute = "´"; var DiacriticalDot = "˙"; var DiacriticalDoubleAcute = "˝"; var DiacriticalGrave = "`"; var DiacriticalTilde = "˜"; var Diamond = "⋄"; var DifferentialD = "ⅆ"; var Dopf = "𝔻"; var Dot = "¨"; var DotDot = "⃜"; var DotEqual = "≐"; var DoubleContourIntegral = "∯"; var DoubleDot = "¨"; var DoubleDownArrow = "⇓"; var DoubleLeftArrow = "⇐"; var DoubleLeftRightArrow = "⇔"; var DoubleLeftTee = "⫤"; var DoubleLongLeftArrow = "⟸"; var DoubleLongLeftRightArrow = "⟺"; var DoubleLongRightArrow = "⟹"; var DoubleRightArrow = "⇒"; var DoubleRightTee = "⊨"; var DoubleUpArrow = "⇑"; var DoubleUpDownArrow = "⇕"; var DoubleVerticalBar = "∥"; var DownArrow = "↓"; var DownArrowBar = "⤓"; var DownArrowUpArrow = "⇵"; var DownBreve = "̑"; var DownLeftRightVector = "⥐"; var DownLeftTeeVector = "⥞"; var DownLeftVector = "↽"; var DownLeftVectorBar = "⥖"; var DownRightTeeVector = "⥟"; var DownRightVector = "⇁"; var DownRightVectorBar = "⥗"; var DownTee = "⊤"; var DownTeeArrow = "↧"; var Downarrow = "⇓"; var Dscr = "𝒟"; var Dstrok = "Đ"; var ENG = "Ŋ"; var ET = "Ð"; var ETH = "Ð"; var Eacut = "É"; var Eacute = "É"; var Ecaron = "Ě"; var Ecir = "Ê"; var Ecirc = "Ê"; var Ecy = "Э"; var Edot = "Ė"; var Efr = "𝔈"; var Egrav = "È"; var Egrave = "È"; var Element = "∈"; var Emacr = "Ē"; var EmptySmallSquare = "◻"; var EmptyVerySmallSquare = "▫"; var Eogon = "Ę"; var Eopf = "𝔼"; var Epsilon = "Ε"; var Equal = "⩵"; var EqualTilde = "≂"; var Equilibrium = "⇌"; var Escr = "ℰ"; var Esim = "⩳"; var Eta = "Η"; var Eum = "Ë"; var Euml = "Ë"; var Exists = "∃"; var ExponentialE = "ⅇ"; var Fcy = "Ф"; var Ffr = "𝔉"; var FilledSmallSquare = "◼"; var FilledVerySmallSquare = "▪"; var Fopf = "𝔽"; var ForAll = "∀"; var Fouriertrf = "ℱ"; var Fscr = "ℱ"; var GJcy = "Ѓ"; var G = ">"; var GT = ">"; var Gamma = "Γ"; var Gammad = "Ϝ"; var Gbreve = "Ğ"; var Gcedil = "Ģ"; var Gcirc = "Ĝ"; var Gcy = "Г"; var Gdot = "Ġ"; var Gfr = "𝔊"; var Gg = "⋙"; var Gopf = "𝔾"; var GreaterEqual = "≥"; var GreaterEqualLess = "⋛"; var GreaterFullEqual = "≧"; var GreaterGreater = "⪢"; var GreaterLess = "≷"; var GreaterSlantEqual = "⩾"; var GreaterTilde = "≳"; var Gscr = "𝒢"; var Gt = "≫"; var HARDcy = "Ъ"; var Hacek = "ˇ"; var Hat = "^"; var Hcirc = "Ĥ"; var Hfr = "ℌ"; var HilbertSpace = "ℋ"; var Hopf = "ℍ"; var HorizontalLine = "─"; var Hscr = "ℋ"; var Hstrok = "Ħ"; var HumpDownHump = "≎"; var HumpEqual = "≏"; var IEcy = "Е"; var IJlig = "IJ"; var IOcy = "Ё"; var Iacut = "Í"; var Iacute = "Í"; var Icir = "Î"; var Icirc = "Î"; var Icy = "И"; var Idot = "İ"; var Ifr = "ℑ"; var Igrav = "Ì"; var Igrave = "Ì"; var Im = "ℑ"; var Imacr = "Ī"; var ImaginaryI = "ⅈ"; var Implies = "⇒"; var Int = "∬"; var Integral = "∫"; var Intersection = "⋂"; var InvisibleComma = "⁣"; var InvisibleTimes = "⁢"; var Iogon = "Į"; var Iopf = "𝕀"; var Iota = "Ι"; var Iscr = "ℐ"; var Itilde = "Ĩ"; var Iukcy = "І"; var Ium = "Ï"; var Iuml = "Ï"; var Jcirc = "Ĵ"; var Jcy = "Й"; var Jfr = "𝔍"; var Jopf = "𝕁"; var Jscr = "𝒥"; var Jsercy = "Ј"; var Jukcy = "Є"; var KHcy = "Х"; var KJcy = "Ќ"; var Kappa = "Κ"; var Kcedil = "Ķ"; var Kcy = "К"; var Kfr = "𝔎"; var Kopf = "𝕂"; var Kscr = "𝒦"; var LJcy = "Љ"; var L$1 = "<"; var LT = "<"; var Lacute = "Ĺ"; var Lambda = "Λ"; var Lang = "⟪"; var Laplacetrf = "ℒ"; var Larr = "↞"; var Lcaron = "Ľ"; var Lcedil = "Ļ"; var Lcy = "Л"; var LeftAngleBracket = "⟨"; var LeftArrow = "←"; var LeftArrowBar = "⇤"; var LeftArrowRightArrow = "⇆"; var LeftCeiling = "⌈"; var LeftDoubleBracket = "⟦"; var LeftDownTeeVector = "⥡"; var LeftDownVector = "⇃"; var LeftDownVectorBar = "⥙"; var LeftFloor = "⌊"; var LeftRightArrow = "↔"; var LeftRightVector = "⥎"; var LeftTee = "⊣"; var LeftTeeArrow = "↤"; var LeftTeeVector = "⥚"; var LeftTriangle = "⊲"; var LeftTriangleBar = "⧏"; var LeftTriangleEqual = "⊴"; var LeftUpDownVector = "⥑"; var LeftUpTeeVector = "⥠"; var LeftUpVector = "↿"; var LeftUpVectorBar = "⥘"; var LeftVector = "↼"; var LeftVectorBar = "⥒"; var Leftarrow = "⇐"; var Leftrightarrow = "⇔"; var LessEqualGreater = "⋚"; var LessFullEqual = "≦"; var LessGreater = "≶"; var LessLess = "⪡"; var LessSlantEqual = "⩽"; var LessTilde = "≲"; var Lfr = "𝔏"; var Ll = "⋘"; var Lleftarrow = "⇚"; var Lmidot = "Ŀ"; var LongLeftArrow = "⟵"; var LongLeftRightArrow = "⟷"; var LongRightArrow = "⟶"; var Longleftarrow = "⟸"; var Longleftrightarrow = "⟺"; var Longrightarrow = "⟹"; var Lopf = "𝕃"; var LowerLeftArrow = "↙"; var LowerRightArrow = "↘"; var Lscr = "ℒ"; var Lsh = "↰"; var Lstrok = "Ł"; var Lt = "≪"; var Mcy = "М"; var MediumSpace = " "; var Mellintrf = "ℳ"; var Mfr = "𝔐"; var MinusPlus = "∓"; var Mopf = "𝕄"; var Mscr = "ℳ"; var Mu = "Μ"; var NJcy = "Њ"; var Nacute = "Ń"; var Ncaron = "Ň"; var Ncedil = "Ņ"; var Ncy = "Н"; var NegativeMediumSpace = "​"; var NegativeThickSpace = "​"; var NegativeThinSpace = "​"; var NegativeVeryThinSpace = "​"; var NestedGreaterGreater = "≫"; var NestedLessLess = "≪"; var NewLine = "\n"; var Nfr = "𝔑"; var NoBreak = "⁠"; var NonBreakingSpace = " "; var Nopf = "ℕ"; var Not = "⫬"; var NotCongruent = "≢"; var NotCupCap = "≭"; var NotDoubleVerticalBar = "∦"; var NotElement = "∉"; var NotEqual = "≠"; var NotEqualTilde = "≂̸"; var NotExists = "∄"; var NotGreater = "≯"; var NotGreaterEqual = "≱"; var NotGreaterFullEqual = "≧̸"; var NotGreaterGreater = "≫̸"; var NotGreaterLess = "≹"; var NotGreaterSlantEqual = "⩾̸"; var NotGreaterTilde = "≵"; var NotHumpDownHump = "≎̸"; var NotHumpEqual = "≏̸"; var NotLeftTriangle = "⋪"; var NotLeftTriangleBar = "⧏̸"; var NotLeftTriangleEqual = "⋬"; var NotLess = "≮"; var NotLessEqual = "≰"; var NotLessGreater = "≸"; var NotLessLess = "≪̸"; var NotLessSlantEqual = "⩽̸"; var NotLessTilde = "≴"; var NotNestedGreaterGreater = "⪢̸"; var NotNestedLessLess = "⪡̸"; var NotPrecedes = "⊀"; var NotPrecedesEqual = "⪯̸"; var NotPrecedesSlantEqual = "⋠"; var NotReverseElement = "∌"; var NotRightTriangle = "⋫"; var NotRightTriangleBar = "⧐̸"; var NotRightTriangleEqual = "⋭"; var NotSquareSubset = "⊏̸"; var NotSquareSubsetEqual = "⋢"; var NotSquareSuperset = "⊐̸"; var NotSquareSupersetEqual = "⋣"; var NotSubset = "⊂⃒"; var NotSubsetEqual = "⊈"; var NotSucceeds = "⊁"; var NotSucceedsEqual = "⪰̸"; var NotSucceedsSlantEqual = "⋡"; var NotSucceedsTilde = "≿̸"; var NotSuperset = "⊃⃒"; var NotSupersetEqual = "⊉"; var NotTilde = "≁"; var NotTildeEqual = "≄"; var NotTildeFullEqual = "≇"; var NotTildeTilde = "≉"; var NotVerticalBar = "∤"; var Nscr = "𝒩"; var Ntild = "Ñ"; var Ntilde = "Ñ"; var Nu = "Ν"; var OElig = "Œ"; var Oacut = "Ó"; var Oacute = "Ó"; var Ocir = "Ô"; var Ocirc = "Ô"; var Ocy = "О"; var Odblac = "Ő"; var Ofr = "𝔒"; var Ograv = "Ò"; var Ograve = "Ò"; var Omacr = "Ō"; var Omega = "Ω"; var Omicron = "Ο"; var Oopf = "𝕆"; var OpenCurlyDoubleQuote = "“"; var OpenCurlyQuote = "‘"; var Or = "⩔"; var Oscr = "𝒪"; var Oslas = "Ø"; var Oslash = "Ø"; var Otild = "Õ"; var Otilde = "Õ"; var Otimes = "⨷"; var Oum = "Ö"; var Ouml = "Ö"; var OverBar = "‾"; var OverBrace = "⏞"; var OverBracket = "⎴"; var OverParenthesis = "⏜"; var PartialD = "∂"; var Pcy = "П"; var Pfr = "𝔓"; var Phi = "Φ"; var Pi = "Π"; var PlusMinus = "±"; var Poincareplane = "ℌ"; var Popf = "ℙ"; var Pr = "⪻"; var Precedes = "≺"; var PrecedesEqual = "⪯"; var PrecedesSlantEqual = "≼"; var PrecedesTilde = "≾"; var Prime = "″"; var Product = "∏"; var Proportion = "∷"; var Proportional = "∝"; var Pscr = "𝒫"; var Psi = "Ψ"; var QUO = "\""; var QUOT = "\""; var Qfr = "𝔔"; var Qopf = "ℚ"; var Qscr = "𝒬"; var RBarr = "⤐"; var RE = "®"; var REG = "®"; var Racute = "Ŕ"; var Rang = "⟫"; var Rarr = "↠"; var Rarrtl = "⤖"; var Rcaron = "Ř"; var Rcedil = "Ŗ"; var Rcy = "Р"; var Re = "ℜ"; var ReverseElement = "∋"; var ReverseEquilibrium = "⇋"; var ReverseUpEquilibrium = "⥯"; var Rfr = "ℜ"; var Rho = "Ρ"; var RightAngleBracket = "⟩"; var RightArrow = "→"; var RightArrowBar = "⇥"; var RightArrowLeftArrow = "⇄"; var RightCeiling = "⌉"; var RightDoubleBracket = "⟧"; var RightDownTeeVector = "⥝"; var RightDownVector = "⇂"; var RightDownVectorBar = "⥕"; var RightFloor = "⌋"; var RightTee = "⊢"; var RightTeeArrow = "↦"; var RightTeeVector = "⥛"; var RightTriangle = "⊳"; var RightTriangleBar = "⧐"; var RightTriangleEqual = "⊵"; var RightUpDownVector = "⥏"; var RightUpTeeVector = "⥜"; var RightUpVector = "↾"; var RightUpVectorBar = "⥔"; var RightVector = "⇀"; var RightVectorBar = "⥓"; var Rightarrow = "⇒"; var Ropf = "ℝ"; var RoundImplies = "⥰"; var Rrightarrow = "⇛"; var Rscr = "ℛ"; var Rsh = "↱"; var RuleDelayed = "⧴"; var SHCHcy = "Щ"; var SHcy = "Ш"; var SOFTcy = "Ь"; var Sacute = "Ś"; var Sc = "⪼"; var Scaron = "Š"; var Scedil = "Ş"; var Scirc = "Ŝ"; var Scy = "С"; var Sfr = "𝔖"; var ShortDownArrow = "↓"; var ShortLeftArrow = "←"; var ShortRightArrow = "→"; var ShortUpArrow = "↑"; var Sigma = "Σ"; var SmallCircle = "∘"; var Sopf = "𝕊"; var Sqrt = "√"; var Square = "□"; var SquareIntersection = "⊓"; var SquareSubset = "⊏"; var SquareSubsetEqual = "⊑"; var SquareSuperset = "⊐"; var SquareSupersetEqual = "⊒"; var SquareUnion = "⊔"; var Sscr = "𝒮"; var Star = "⋆"; var Sub = "⋐"; var Subset = "⋐"; var SubsetEqual = "⊆"; var Succeeds = "≻"; var SucceedsEqual = "⪰"; var SucceedsSlantEqual = "≽"; var SucceedsTilde = "≿"; var SuchThat = "∋"; var Sum = "∑"; var Sup = "⋑"; var Superset = "⊃"; var SupersetEqual = "⊇"; var Supset = "⋑"; var THOR = "Þ"; var THORN = "Þ"; var TRADE = "™"; var TSHcy = "Ћ"; var TScy = "Ц"; var Tab = "\t"; var Tau = "Τ"; var Tcaron = "Ť"; var Tcedil = "Ţ"; var Tcy = "Т"; var Tfr = "𝔗"; var Therefore = "∴"; var Theta = "Θ"; var ThickSpace = "  "; var ThinSpace = " "; var Tilde = "∼"; var TildeEqual = "≃"; var TildeFullEqual = "≅"; var TildeTilde = "≈"; var Topf = "𝕋"; var TripleDot = "⃛"; var Tscr = "𝒯"; var Tstrok = "Ŧ"; var Uacut = "Ú"; var Uacute = "Ú"; var Uarr = "↟"; var Uarrocir = "⥉"; var Ubrcy = "Ў"; var Ubreve = "Ŭ"; var Ucir = "Û"; var Ucirc = "Û"; var Ucy = "У"; var Udblac = "Ű"; var Ufr = "𝔘"; var Ugrav = "Ù"; var Ugrave = "Ù"; var Umacr = "Ū"; var UnderBar = "_"; var UnderBrace = "⏟"; var UnderBracket = "⎵"; var UnderParenthesis = "⏝"; var Union = "⋃"; var UnionPlus = "⊎"; var Uogon = "Ų"; var Uopf = "𝕌"; var UpArrow = "↑"; var UpArrowBar = "⤒"; var UpArrowDownArrow = "⇅"; var UpDownArrow = "↕"; var UpEquilibrium = "⥮"; var UpTee = "⊥"; var UpTeeArrow = "↥"; var Uparrow = "⇑"; var Updownarrow = "⇕"; var UpperLeftArrow = "↖"; var UpperRightArrow = "↗"; var Upsi = "ϒ"; var Upsilon = "Υ"; var Uring = "Ů"; var Uscr = "𝒰"; var Utilde = "Ũ"; var Uum = "Ü"; var Uuml = "Ü"; var VDash = "⊫"; var Vbar = "⫫"; var Vcy = "В"; var Vdash = "⊩"; var Vdashl = "⫦"; var Vee = "⋁"; var Verbar = "‖"; var Vert = "‖"; var VerticalBar = "∣"; var VerticalLine = "|"; var VerticalSeparator = "❘"; var VerticalTilde = "≀"; var VeryThinSpace = " "; var Vfr = "𝔙"; var Vopf = "𝕍"; var Vscr = "𝒱"; var Vvdash = "⊪"; var Wcirc = "Ŵ"; var Wedge = "⋀"; var Wfr = "𝔚"; var Wopf = "𝕎"; var Wscr = "𝒲"; var Xfr = "𝔛"; var Xi = "Ξ"; var Xopf = "𝕏"; var Xscr = "𝒳"; var YAcy = "Я"; var YIcy = "Ї"; var YUcy = "Ю"; var Yacut = "Ý"; var Yacute = "Ý"; var Ycirc = "Ŷ"; var Ycy = "Ы"; var Yfr = "𝔜"; var Yopf = "𝕐"; var Yscr = "𝒴"; var Yuml = "Ÿ"; var ZHcy = "Ж"; var Zacute = "Ź"; var Zcaron = "Ž"; var Zcy = "З"; var Zdot = "Ż"; var ZeroWidthSpace = "​"; var Zeta = "Ζ"; var Zfr = "ℨ"; var Zopf = "ℤ"; var Zscr = "𝒵"; var aacut = "á"; var aacute = "á"; var abreve = "ă"; var ac = "∾"; var acE = "∾̳"; var acd = "∿"; var acir = "â"; var acirc = "â"; var acut = "´"; var acute = "´"; var acy = "а"; var aeli = "æ"; var aelig = "æ"; var af = "⁡"; var afr = "𝔞"; var agrav = "à"; var agrave = "à"; var alefsym = "ℵ"; var aleph = "ℵ"; var alpha = "α"; var amacr = "ā"; var amalg = "⨿"; var am = "&"; var amp = "&"; var and = "∧"; var andand = "⩕"; var andd = "⩜"; var andslope = "⩘"; var andv = "⩚"; var ang = "∠"; var ange = "⦤"; var angle = "∠"; var angmsd = "∡"; var angmsdaa = "⦨"; var angmsdab = "⦩"; var angmsdac = "⦪"; var angmsdad = "⦫"; var angmsdae = "⦬"; var angmsdaf = "⦭"; var angmsdag = "⦮"; var angmsdah = "⦯"; var angrt = "∟"; var angrtvb = "⊾"; var angrtvbd = "⦝"; var angsph = "∢"; var angst = "Å"; var angzarr = "⍼"; var aogon = "ą"; var aopf = "𝕒"; var ap = "≈"; var apE = "⩰"; var apacir = "⩯"; var ape = "≊"; var apid = "≋"; var apos = "'"; var approx = "≈"; var approxeq = "≊"; var arin = "å"; var aring = "å"; var ascr = "𝒶"; var ast = "*"; var asymp = "≈"; var asympeq = "≍"; var atild = "ã"; var atilde = "ã"; var aum = "ä"; var auml = "ä"; var awconint = "∳"; var awint = "⨑"; var bNot = "⫭"; var backcong = "≌"; var backepsilon = "϶"; var backprime = "‵"; var backsim = "∽"; var backsimeq = "⋍"; var barvee = "⊽"; var barwed = "⌅"; var barwedge = "⌅"; var bbrk = "⎵"; var bbrktbrk = "⎶"; var bcong = "≌"; var bcy = "б"; var bdquo = "„"; var becaus = "∵"; var because = "∵"; var bemptyv = "⦰"; var bepsi = "϶"; var bernou = "ℬ"; var beta = "β"; var beth = "ℶ"; var between = "≬"; var bfr = "𝔟"; var bigcap = "⋂"; var bigcirc = "◯"; var bigcup = "⋃"; var bigodot = "⨀"; var bigoplus = "⨁"; var bigotimes = "⨂"; var bigsqcup = "⨆"; var bigstar = "★"; var bigtriangledown = "▽"; var bigtriangleup = "△"; var biguplus = "⨄"; var bigvee = "⋁"; var bigwedge = "⋀"; var bkarow = "⤍"; var blacklozenge = "⧫"; var blacksquare = "▪"; var blacktriangle = "▴"; var blacktriangledown = "▾"; var blacktriangleleft = "◂"; var blacktriangleright = "▸"; var blank = "␣"; var blk12 = "▒"; var blk14 = "░"; var blk34 = "▓"; var block = "█"; var bne = "=⃥"; var bnequiv = "≡⃥"; var bnot = "⌐"; var bopf = "𝕓"; var bot = "⊥"; var bottom = "⊥"; var bowtie = "⋈"; var boxDL = "╗"; var boxDR = "╔"; var boxDl = "╖"; var boxDr = "╓"; var boxH = "═"; var boxHD = "╦"; var boxHU = "╩"; var boxHd = "╤"; var boxHu = "╧"; var boxUL = "╝"; var boxUR = "╚"; var boxUl = "╜"; var boxUr = "╙"; var boxV = "║"; var boxVH = "╬"; var boxVL = "╣"; var boxVR = "╠"; var boxVh = "╫"; var boxVl = "╢"; var boxVr = "╟"; var boxbox = "⧉"; var boxdL = "╕"; var boxdR = "╒"; var boxdl = "┐"; var boxdr = "┌"; var boxh = "─"; var boxhD = "╥"; var boxhU = "╨"; var boxhd = "┬"; var boxhu = "┴"; var boxminus = "⊟"; var boxplus = "⊞"; var boxtimes = "⊠"; var boxuL = "╛"; var boxuR = "╘"; var boxul = "┘"; var boxur = "└"; var boxv = "│"; var boxvH = "╪"; var boxvL = "╡"; var boxvR = "╞"; var boxvh = "┼"; var boxvl = "┤"; var boxvr = "├"; var bprime = "‵"; var breve = "˘"; var brvba = "¦"; var brvbar = "¦"; var bscr = "𝒷"; var bsemi = "⁏"; var bsim = "∽"; var bsime = "⋍"; var bsol = "\\"; var bsolb = "⧅"; var bsolhsub = "⟈"; var bull = "•"; var bullet = "•"; var bump = "≎"; var bumpE = "⪮"; var bumpe = "≏"; var bumpeq = "≏"; var cacute = "ć"; var cap = "∩"; var capand = "⩄"; var capbrcup = "⩉"; var capcap = "⩋"; var capcup = "⩇"; var capdot = "⩀"; var caps = "∩︀"; var caret = "⁁"; var caron = "ˇ"; var ccaps = "⩍"; var ccaron = "č"; var ccedi = "ç"; var ccedil = "ç"; var ccirc = "ĉ"; var ccups = "⩌"; var ccupssm = "⩐"; var cdot = "ċ"; var cedi = "¸"; var cedil = "¸"; var cemptyv = "⦲"; var cen = "¢"; var cent = "¢"; var centerdot = "·"; var cfr = "𝔠"; var chcy = "ч"; var check = "✓"; var checkmark = "✓"; var chi = "χ"; var cir = "○"; var cirE = "⧃"; var circ = "ˆ"; var circeq = "≗"; var circlearrowleft = "↺"; var circlearrowright = "↻"; var circledR = "®"; var circledS = "Ⓢ"; var circledast = "⊛"; var circledcirc = "⊚"; var circleddash = "⊝"; var cire = "≗"; var cirfnint = "⨐"; var cirmid = "⫯"; var cirscir = "⧂"; var clubs = "♣"; var clubsuit = "♣"; var colon$1 = ":"; var colone = "≔"; var coloneq = "≔"; var comma = ","; var commat = "@"; var comp = "∁"; var compfn = "∘"; var complement = "∁"; var complexes = "ℂ"; var cong = "≅"; var congdot = "⩭"; var conint = "∮"; var copf = "𝕔"; var coprod = "∐"; var cop = "©"; var copy = "©"; var copysr = "℗"; var crarr = "↵"; var cross = "✗"; var cscr = "𝒸"; var csub = "⫏"; var csube = "⫑"; var csup = "⫐"; var csupe = "⫒"; var ctdot = "⋯"; var cudarrl = "⤸"; var cudarrr = "⤵"; var cuepr = "⋞"; var cuesc = "⋟"; var cularr = "↶"; var cularrp = "⤽"; var cup = "∪"; var cupbrcap = "⩈"; var cupcap = "⩆"; var cupcup = "⩊"; var cupdot = "⊍"; var cupor = "⩅"; var cups = "∪︀"; var curarr = "↷"; var curarrm = "⤼"; var curlyeqprec = "⋞"; var curlyeqsucc = "⋟"; var curlyvee = "⋎"; var curlywedge = "⋏"; var curre = "¤"; var curren = "¤"; var curvearrowleft = "↶"; var curvearrowright = "↷"; var cuvee = "⋎"; var cuwed = "⋏"; var cwconint = "∲"; var cwint = "∱"; var cylcty = "⌭"; var dArr = "⇓"; var dHar = "⥥"; var dagger = "†"; var daleth = "ℸ"; var darr = "↓"; var dash$1 = "‐"; var dashv = "⊣"; var dbkarow = "⤏"; var dblac = "˝"; var dcaron = "ď"; var dcy = "д"; var dd = "ⅆ"; var ddagger = "‡"; var ddarr = "⇊"; var ddotseq = "⩷"; var de = "°"; var deg = "°"; var delta = "δ"; var demptyv = "⦱"; var dfisht = "⥿"; var dfr = "𝔡"; var dharl = "⇃"; var dharr = "⇂"; var diam = "⋄"; var diamond = "⋄"; var diamondsuit = "♦"; var diams = "♦"; var die = "¨"; var digamma = "ϝ"; var disin = "⋲"; var div = "÷"; var divid = "÷"; var divide = "÷"; var divideontimes = "⋇"; var divonx = "⋇"; var djcy = "ђ"; var dlcorn = "⌞"; var dlcrop = "⌍"; var dollar = "$"; var dopf = "𝕕"; var dot = "˙"; var doteq = "≐"; var doteqdot = "≑"; var dotminus = "∸"; var dotplus = "∔"; var dotsquare = "⊡"; var doublebarwedge = "⌆"; var downarrow = "↓"; var downdownarrows = "⇊"; var downharpoonleft = "⇃"; var downharpoonright = "⇂"; var drbkarow = "⤐"; var drcorn = "⌟"; var drcrop = "⌌"; var dscr = "𝒹"; var dscy = "ѕ"; var dsol = "⧶"; var dstrok = "đ"; var dtdot = "⋱"; var dtri = "▿"; var dtrif = "▾"; var duarr = "⇵"; var duhar = "⥯"; var dwangle = "⦦"; var dzcy = "џ"; var dzigrarr = "⟿"; var eDDot = "⩷"; var eDot = "≑"; var eacut = "é"; var eacute = "é"; var easter = "⩮"; var ecaron = "ě"; var ecir = "ê"; var ecirc = "ê"; var ecolon = "≕"; var ecy = "э"; var edot = "ė"; var ee = "ⅇ"; var efDot = "≒"; var efr = "𝔢"; var eg = "⪚"; var egrav = "è"; var egrave = "è"; var egs = "⪖"; var egsdot = "⪘"; var el = "⪙"; var elinters = "⏧"; var ell = "ℓ"; var els = "⪕"; var elsdot = "⪗"; var emacr = "ē"; var empty = "∅"; var emptyset = "∅"; var emptyv = "∅"; var emsp13 = " "; var emsp14 = " "; var emsp = " "; var eng = "ŋ"; var ensp = " "; var eogon = "ę"; var eopf = "𝕖"; var epar = "⋕"; var eparsl = "⧣"; var eplus = "⩱"; var epsi = "ε"; var epsilon = "ε"; var epsiv = "ϵ"; var eqcirc = "≖"; var eqcolon = "≕"; var eqsim = "≂"; var eqslantgtr = "⪖"; var eqslantless = "⪕"; var equals = "="; var equest = "≟"; var equiv = "≡"; var equivDD = "⩸"; var eqvparsl = "⧥"; var erDot = "≓"; var erarr = "⥱"; var escr = "ℯ"; var esdot = "≐"; var esim = "≂"; var eta = "η"; var et = "ð"; var eth = "ð"; var eum = "ë"; var euml = "ë"; var euro = "€"; var excl = "!"; var exist = "∃"; var expectation = "ℰ"; var exponentiale = "ⅇ"; var fallingdotseq = "≒"; var fcy = "ф"; var female = "♀"; var ffilig = "ffi"; var fflig = "ff"; var ffllig = "ffl"; var ffr = "𝔣"; var filig = "fi"; var fjlig = "fj"; var flat = "♭"; var fllig = "fl"; var fltns = "▱"; var fnof = "ƒ"; var fopf = "𝕗"; var forall = "∀"; var fork = "⋔"; var forkv = "⫙"; var fpartint = "⨍"; var frac1 = "¼"; var frac12 = "½"; var frac13 = "⅓"; var frac14 = "¼"; var frac15 = "⅕"; var frac16 = "⅙"; var frac18 = "⅛"; var frac23 = "⅔"; var frac25 = "⅖"; var frac3 = "¾"; var frac34 = "¾"; var frac35 = "⅗"; var frac38 = "⅜"; var frac45 = "⅘"; var frac56 = "⅚"; var frac58 = "⅝"; var frac78 = "⅞"; var frasl = "⁄"; var frown = "⌢"; var fscr = "𝒻"; var gE = "≧"; var gEl = "⪌"; var gacute = "ǵ"; var gamma = "γ"; var gammad = "ϝ"; var gap = "⪆"; var gbreve = "ğ"; var gcirc = "ĝ"; var gcy = "г"; var gdot = "ġ"; var ge = "≥"; var gel = "⋛"; var geq = "≥"; var geqq = "≧"; var geqslant = "⩾"; var ges = "⩾"; var gescc = "⪩"; var gesdot = "⪀"; var gesdoto = "⪂"; var gesdotol = "⪄"; var gesl = "⋛︀"; var gesles = "⪔"; var gfr = "𝔤"; var gg = "≫"; var ggg = "⋙"; var gimel = "ℷ"; var gjcy = "ѓ"; var gl = "≷"; var glE = "⪒"; var gla = "⪥"; var glj = "⪤"; var gnE = "≩"; var gnap = "⪊"; var gnapprox = "⪊"; var gne = "⪈"; var gneq = "⪈"; var gneqq = "≩"; var gnsim = "⋧"; var gopf = "𝕘"; var grave = "`"; var gscr = "ℊ"; var gsim = "≳"; var gsime = "⪎"; var gsiml = "⪐"; var g = ">"; var gt = ">"; var gtcc = "⪧"; var gtcir = "⩺"; var gtdot = "⋗"; var gtlPar = "⦕"; var gtquest = "⩼"; var gtrapprox = "⪆"; var gtrarr = "⥸"; var gtrdot = "⋗"; var gtreqless = "⋛"; var gtreqqless = "⪌"; var gtrless = "≷"; var gtrsim = "≳"; var gvertneqq = "≩︀"; var gvnE = "≩︀"; var hArr = "⇔"; var hairsp = " "; var half = "½"; var hamilt = "ℋ"; var hardcy = "ъ"; var harr = "↔"; var harrcir = "⥈"; var harrw = "↭"; var hbar = "ℏ"; var hcirc = "ĥ"; var hearts = "♥"; var heartsuit = "♥"; var hellip = "…"; var hercon = "⊹"; var hfr = "𝔥"; var hksearow = "⤥"; var hkswarow = "⤦"; var hoarr = "⇿"; var homtht = "∻"; var hookleftarrow = "↩"; var hookrightarrow = "↪"; var hopf = "𝕙"; var horbar = "―"; var hscr = "𝒽"; var hslash = "ℏ"; var hstrok = "ħ"; var hybull = "⁃"; var hyphen = "‐"; var iacut = "í"; var iacute = "í"; var ic = "⁣"; var icir = "î"; var icirc = "î"; var icy = "и"; var iecy = "е"; var iexc = "¡"; var iexcl = "¡"; var iff = "⇔"; var ifr = "𝔦"; var igrav = "ì"; var igrave = "ì"; var ii = "ⅈ"; var iiiint = "⨌"; var iiint = "∭"; var iinfin = "⧜"; var iiota = "℩"; var ijlig = "ij"; var imacr = "ī"; var image = "ℑ"; var imagline = "ℐ"; var imagpart = "ℑ"; var imath = "ı"; var imof = "⊷"; var imped = "Ƶ"; var incare = "℅"; var infin = "∞"; var infintie = "⧝"; var inodot = "ı"; var int = "∫"; var intcal = "⊺"; var integers = "ℤ"; var intercal = "⊺"; var intlarhk = "⨗"; var intprod = "⨼"; var iocy = "ё"; var iogon = "į"; var iopf = "𝕚"; var iota = "ι"; var iprod = "⨼"; var iques = "¿"; var iquest = "¿"; var iscr = "𝒾"; var isin = "∈"; var isinE = "⋹"; var isindot = "⋵"; var isins = "⋴"; var isinsv = "⋳"; var isinv = "∈"; var it = "⁢"; var itilde = "ĩ"; var iukcy = "і"; var ium = "ï"; var iuml = "ï"; var jcirc = "ĵ"; var jcy = "й"; var jfr = "𝔧"; var jmath = "ȷ"; var jopf = "𝕛"; var jscr = "𝒿"; var jsercy = "ј"; var jukcy = "є"; var kappa = "κ"; var kappav = "ϰ"; var kcedil = "ķ"; var kcy = "к"; var kfr = "𝔨"; var kgreen = "ĸ"; var khcy = "х"; var kjcy = "ќ"; var kopf = "𝕜"; var kscr = "𝓀"; var lAarr = "⇚"; var lArr = "⇐"; var lAtail = "⤛"; var lBarr = "⤎"; var lE = "≦"; var lEg = "⪋"; var lHar = "⥢"; var lacute = "ĺ"; var laemptyv = "⦴"; var lagran = "ℒ"; var lambda = "λ"; var lang = "⟨"; var langd = "⦑"; var langle = "⟨"; var lap = "⪅"; var laqu = "«"; var laquo = "«"; var larr = "←"; var larrb = "⇤"; var larrbfs = "⤟"; var larrfs = "⤝"; var larrhk = "↩"; var larrlp = "↫"; var larrpl = "⤹"; var larrsim = "⥳"; var larrtl = "↢"; var lat = "⪫"; var latail = "⤙"; var late = "⪭"; var lates = "⪭︀"; var lbarr = "⤌"; var lbbrk = "❲"; var lbrace = "{"; var lbrack = "["; var lbrke = "⦋"; var lbrksld = "⦏"; var lbrkslu = "⦍"; var lcaron = "ľ"; var lcedil = "ļ"; var lceil = "⌈"; var lcub = "{"; var lcy = "л"; var ldca = "⤶"; var ldquo = "“"; var ldquor = "„"; var ldrdhar = "⥧"; var ldrushar = "⥋"; var ldsh = "↲"; var le = "≤"; var leftarrow = "←"; var leftarrowtail = "↢"; var leftharpoondown = "↽"; var leftharpoonup = "↼"; var leftleftarrows = "⇇"; var leftrightarrow = "↔"; var leftrightarrows = "⇆"; var leftrightharpoons = "⇋"; var leftrightsquigarrow = "↭"; var leftthreetimes = "⋋"; var leg = "⋚"; var leq = "≤"; var leqq = "≦"; var leqslant = "⩽"; var les = "⩽"; var lescc = "⪨"; var lesdot = "⩿"; var lesdoto = "⪁"; var lesdotor = "⪃"; var lesg = "⋚︀"; var lesges = "⪓"; var lessapprox = "⪅"; var lessdot = "⋖"; var lesseqgtr = "⋚"; var lesseqqgtr = "⪋"; var lessgtr = "≶"; var lesssim = "≲"; var lfisht = "⥼"; var lfloor = "⌊"; var lfr = "𝔩"; var lg = "≶"; var lgE = "⪑"; var lhard = "↽"; var lharu = "↼"; var lharul = "⥪"; var lhblk = "▄"; var ljcy = "љ"; var ll = "≪"; var llarr = "⇇"; var llcorner = "⌞"; var llhard = "⥫"; var lltri = "◺"; var lmidot = "ŀ"; var lmoust = "⎰"; var lmoustache = "⎰"; var lnE = "≨"; var lnap = "⪉"; var lnapprox = "⪉"; var lne = "⪇"; var lneq = "⪇"; var lneqq = "≨"; var lnsim = "⋦"; var loang = "⟬"; var loarr = "⇽"; var lobrk = "⟦"; var longleftarrow = "⟵"; var longleftrightarrow = "⟷"; var longmapsto = "⟼"; var longrightarrow = "⟶"; var looparrowleft = "↫"; var looparrowright = "↬"; var lopar = "⦅"; var lopf = "𝕝"; var loplus = "⨭"; var lotimes = "⨴"; var lowast = "∗"; var lowbar = "_"; var loz = "◊"; var lozenge = "◊"; var lozf = "⧫"; var lpar = "("; var lparlt = "⦓"; var lrarr = "⇆"; var lrcorner = "⌟"; var lrhar = "⇋"; var lrhard = "⥭"; var lrm = "‎"; var lrtri = "⊿"; var lsaquo = "‹"; var lscr = "𝓁"; var lsh = "↰"; var lsim = "≲"; var lsime = "⪍"; var lsimg = "⪏"; var lsqb = "["; var lsquo = "‘"; var lsquor = "‚"; var lstrok = "ł"; var l$1 = "<"; var lt = "<"; var ltcc = "⪦"; var ltcir = "⩹"; var ltdot = "⋖"; var lthree = "⋋"; var ltimes = "⋉"; var ltlarr = "⥶"; var ltquest = "⩻"; var ltrPar = "⦖"; var ltri = "◃"; var ltrie = "⊴"; var ltrif = "◂"; var lurdshar = "⥊"; var luruhar = "⥦"; var lvertneqq = "≨︀"; var lvnE = "≨︀"; var mDDot = "∺"; var mac = "¯"; var macr = "¯"; var male = "♂"; var malt = "✠"; var maltese = "✠"; var map$1 = "↦"; var mapsto = "↦"; var mapstodown = "↧"; var mapstoleft = "↤"; var mapstoup = "↥"; var marker = "▮"; var mcomma = "⨩"; var mcy = "м"; var mdash = "—"; var measuredangle = "∡"; var mfr = "𝔪"; var mho = "℧"; var micr = "µ"; var micro = "µ"; var mid = "∣"; var midast = "*"; var midcir = "⫰"; var middo = "·"; var middot = "·"; var minus = "−"; var minusb = "⊟"; var minusd = "∸"; var minusdu = "⨪"; var mlcp = "⫛"; var mldr = "…"; var mnplus = "∓"; var models = "⊧"; var mopf = "𝕞"; var mp = "∓"; var mscr = "𝓂"; var mstpos = "∾"; var mu = "μ"; var multimap = "⊸"; var mumap = "⊸"; var nGg = "⋙̸"; var nGt = "≫⃒"; var nGtv = "≫̸"; var nLeftarrow = "⇍"; var nLeftrightarrow = "⇎"; var nLl = "⋘̸"; var nLt = "≪⃒"; var nLtv = "≪̸"; var nRightarrow = "⇏"; var nVDash = "⊯"; var nVdash = "⊮"; var nabla = "∇"; var nacute = "ń"; var nang = "∠⃒"; var nap = "≉"; var napE = "⩰̸"; var napid = "≋̸"; var napos = "ʼn"; var napprox = "≉"; var natur = "♮"; var natural = "♮"; var naturals = "ℕ"; var nbs = " "; var nbsp = " "; var nbump = "≎̸"; var nbumpe = "≏̸"; var ncap = "⩃"; var ncaron = "ň"; var ncedil = "ņ"; var ncong = "≇"; var ncongdot = "⩭̸"; var ncup = "⩂"; var ncy = "н"; var ndash = "–"; var ne = "≠"; var neArr = "⇗"; var nearhk = "⤤"; var nearr = "↗"; var nearrow = "↗"; var nedot = "≐̸"; var nequiv = "≢"; var nesear = "⤨"; var nesim = "≂̸"; var nexist = "∄"; var nexists = "∄"; var nfr = "𝔫"; var ngE = "≧̸"; var nge = "≱"; var ngeq = "≱"; var ngeqq = "≧̸"; var ngeqslant = "⩾̸"; var nges = "⩾̸"; var ngsim = "≵"; var ngt = "≯"; var ngtr = "≯"; var nhArr = "⇎"; var nharr = "↮"; var nhpar = "⫲"; var ni = "∋"; var nis = "⋼"; var nisd = "⋺"; var niv = "∋"; var njcy = "њ"; var nlArr = "⇍"; var nlE = "≦̸"; var nlarr = "↚"; var nldr = "‥"; var nle = "≰"; var nleftarrow = "↚"; var nleftrightarrow = "↮"; var nleq = "≰"; var nleqq = "≦̸"; var nleqslant = "⩽̸"; var nles = "⩽̸"; var nless = "≮"; var nlsim = "≴"; var nlt = "≮"; var nltri = "⋪"; var nltrie = "⋬"; var nmid = "∤"; var nopf = "𝕟"; var no = "¬"; var not = "¬"; var notin = "∉"; var notinE = "⋹̸"; var notindot = "⋵̸"; var notinva = "∉"; var notinvb = "⋷"; var notinvc = "⋶"; var notni = "∌"; var notniva = "∌"; var notnivb = "⋾"; var notnivc = "⋽"; var npar = "∦"; var nparallel = "∦"; var nparsl = "⫽⃥"; var npart = "∂̸"; var npolint = "⨔"; var npr = "⊀"; var nprcue = "⋠"; var npre = "⪯̸"; var nprec = "⊀"; var npreceq = "⪯̸"; var nrArr = "⇏"; var nrarr = "↛"; var nrarrc = "⤳̸"; var nrarrw = "↝̸"; var nrightarrow = "↛"; var nrtri = "⋫"; var nrtrie = "⋭"; var nsc = "⊁"; var nsccue = "⋡"; var nsce = "⪰̸"; var nscr = "𝓃"; var nshortmid = "∤"; var nshortparallel = "∦"; var nsim = "≁"; var nsime = "≄"; var nsimeq = "≄"; var nsmid = "∤"; var nspar = "∦"; var nsqsube = "⋢"; var nsqsupe = "⋣"; var nsub = "⊄"; var nsubE = "⫅̸"; var nsube = "⊈"; var nsubset = "⊂⃒"; var nsubseteq = "⊈"; var nsubseteqq = "⫅̸"; var nsucc = "⊁"; var nsucceq = "⪰̸"; var nsup = "⊅"; var nsupE = "⫆̸"; var nsupe = "⊉"; var nsupset = "⊃⃒"; var nsupseteq = "⊉"; var nsupseteqq = "⫆̸"; var ntgl = "≹"; var ntild = "ñ"; var ntilde = "ñ"; var ntlg = "≸"; var ntriangleleft = "⋪"; var ntrianglelefteq = "⋬"; var ntriangleright = "⋫"; var ntrianglerighteq = "⋭"; var nu = "ν"; var num = "#"; var numero = "№"; var numsp = " "; var nvDash = "⊭"; var nvHarr = "⤄"; var nvap = "≍⃒"; var nvdash = "⊬"; var nvge = "≥⃒"; var nvgt = ">⃒"; var nvinfin = "⧞"; var nvlArr = "⤂"; var nvle = "≤⃒"; var nvlt = "<⃒"; var nvltrie = "⊴⃒"; var nvrArr = "⤃"; var nvrtrie = "⊵⃒"; var nvsim = "∼⃒"; var nwArr = "⇖"; var nwarhk = "⤣"; var nwarr = "↖"; var nwarrow = "↖"; var nwnear = "⤧"; var oS = "Ⓢ"; var oacut = "ó"; var oacute = "ó"; var oast = "⊛"; var ocir = "ô"; var ocirc = "ô"; var ocy = "о"; var odash = "⊝"; var odblac = "ő"; var odiv = "⨸"; var odot = "⊙"; var odsold = "⦼"; var oelig = "œ"; var ofcir = "⦿"; var ofr = "𝔬"; var ogon = "˛"; var ograv = "ò"; var ograve = "ò"; var ogt = "⧁"; var ohbar = "⦵"; var ohm = "Ω"; var oint = "∮"; var olarr = "↺"; var olcir = "⦾"; var olcross = "⦻"; var oline = "‾"; var olt = "⧀"; var omacr = "ō"; var omega = "ω"; var omicron = "ο"; var omid = "⦶"; var ominus = "⊖"; var oopf = "𝕠"; var opar = "⦷"; var operp = "⦹"; var oplus = "⊕"; var or = "∨"; var orarr = "↻"; var ord = "º"; var order$1 = "ℴ"; var orderof = "ℴ"; var ordf = "ª"; var ordm = "º"; var origof = "⊶"; var oror = "⩖"; var orslope = "⩗"; var orv = "⩛"; var oscr = "ℴ"; var oslas = "ø"; var oslash = "ø"; var osol = "⊘"; var otild = "õ"; var otilde = "õ"; var otimes = "⊗"; var otimesas = "⨶"; var oum = "ö"; var ouml = "ö"; var ovbar = "⌽"; var par = "¶"; var para = "¶"; var parallel = "∥"; var parsim = "⫳"; var parsl = "⫽"; var part = "∂"; var pcy = "п"; var percnt = "%"; var period = "."; var permil = "‰"; var perp = "⊥"; var pertenk = "‱"; var pfr = "𝔭"; var phi = "φ"; var phiv = "ϕ"; var phmmat = "ℳ"; var phone = "☎"; var pi = "π"; var pitchfork = "⋔"; var piv = "ϖ"; var planck = "ℏ"; var planckh = "ℎ"; var plankv = "ℏ"; var plus = "+"; var plusacir = "⨣"; var plusb = "⊞"; var pluscir = "⨢"; var plusdo = "∔"; var plusdu = "⨥"; var pluse = "⩲"; var plusm = "±"; var plusmn = "±"; var plussim = "⨦"; var plustwo = "⨧"; var pm = "±"; var pointint = "⨕"; var popf = "𝕡"; var poun = "£"; var pound = "£"; var pr = "≺"; var prE = "⪳"; var prap = "⪷"; var prcue = "≼"; var pre = "⪯"; var prec = "≺"; var precapprox = "⪷"; var preccurlyeq = "≼"; var preceq = "⪯"; var precnapprox = "⪹"; var precneqq = "⪵"; var precnsim = "⋨"; var precsim = "≾"; var prime = "′"; var primes = "ℙ"; var prnE = "⪵"; var prnap = "⪹"; var prnsim = "⋨"; var prod = "∏"; var profalar = "⌮"; var profline = "⌒"; var profsurf = "⌓"; var prop = "∝"; var propto = "∝"; var prsim = "≾"; var prurel = "⊰"; var pscr = "𝓅"; var psi = "ψ"; var puncsp = " "; var qfr = "𝔮"; var qint = "⨌"; var qopf = "𝕢"; var qprime = "⁗"; var qscr = "𝓆"; var quaternions = "ℍ"; var quatint = "⨖"; var quest = "?"; var questeq = "≟"; var quo = "\""; var quot = "\""; var rAarr = "⇛"; var rArr = "⇒"; var rAtail = "⤜"; var rBarr = "⤏"; var rHar = "⥤"; var race = "∽̱"; var racute = "ŕ"; var radic = "√"; var raemptyv = "⦳"; var rang = "⟩"; var rangd = "⦒"; var range = "⦥"; var rangle = "⟩"; var raqu = "»"; var raquo = "»"; var rarr = "→"; var rarrap = "⥵"; var rarrb = "⇥"; var rarrbfs = "⤠"; var rarrc = "⤳"; var rarrfs = "⤞"; var rarrhk = "↪"; var rarrlp = "↬"; var rarrpl = "⥅"; var rarrsim = "⥴"; var rarrtl = "↣"; var rarrw = "↝"; var ratail = "⤚"; var ratio = "∶"; var rationals = "ℚ"; var rbarr = "⤍"; var rbbrk = "❳"; var rbrace = "}"; var rbrack = "]"; var rbrke = "⦌"; var rbrksld = "⦎"; var rbrkslu = "⦐"; var rcaron = "ř"; var rcedil = "ŗ"; var rceil = "⌉"; var rcub = "}"; var rcy = "р"; var rdca = "⤷"; var rdldhar = "⥩"; var rdquo = "”"; var rdquor = "”"; var rdsh = "↳"; var real = "ℜ"; var realine = "ℛ"; var realpart = "ℜ"; var reals = "ℝ"; var rect = "▭"; var re = "®"; var reg = "®"; var rfisht = "⥽"; var rfloor = "⌋"; var rfr = "𝔯"; var rhard = "⇁"; var rharu = "⇀"; var rharul = "⥬"; var rho = "ρ"; var rhov = "ϱ"; var rightarrow = "→"; var rightarrowtail = "↣"; var rightharpoondown = "⇁"; var rightharpoonup = "⇀"; var rightleftarrows = "⇄"; var rightleftharpoons = "⇌"; var rightrightarrows = "⇉"; var rightsquigarrow = "↝"; var rightthreetimes = "⋌"; var ring = "˚"; var risingdotseq = "≓"; var rlarr = "⇄"; var rlhar = "⇌"; var rlm = "‏"; var rmoust = "⎱"; var rmoustache = "⎱"; var rnmid = "⫮"; var roang = "⟭"; var roarr = "⇾"; var robrk = "⟧"; var ropar = "⦆"; var ropf = "𝕣"; var roplus = "⨮"; var rotimes = "⨵"; var rpar = ")"; var rpargt = "⦔"; var rppolint = "⨒"; var rrarr = "⇉"; var rsaquo = "›"; var rscr = "𝓇"; var rsh = "↱"; var rsqb = "]"; var rsquo = "’"; var rsquor = "’"; var rthree = "⋌"; var rtimes = "⋊"; var rtri = "▹"; var rtrie = "⊵"; var rtrif = "▸"; var rtriltri = "⧎"; var ruluhar = "⥨"; var rx = "℞"; var sacute = "ś"; var sbquo = "‚"; var sc = "≻"; var scE = "⪴"; var scap = "⪸"; var scaron = "š"; var sccue = "≽"; var sce = "⪰"; var scedil = "ş"; var scirc = "ŝ"; var scnE = "⪶"; var scnap = "⪺"; var scnsim = "⋩"; var scpolint = "⨓"; var scsim = "≿"; var scy = "с"; var sdot = "⋅"; var sdotb = "⊡"; var sdote = "⩦"; var seArr = "⇘"; var searhk = "⤥"; var searr = "↘"; var searrow = "↘"; var sec = "§"; var sect = "§"; var semi = ";"; var seswar = "⤩"; var setminus = "∖"; var setmn = "∖"; var sext = "✶"; var sfr = "𝔰"; var sfrown = "⌢"; var sharp = "♯"; var shchcy = "щ"; var shcy = "ш"; var shortmid = "∣"; var shortparallel = "∥"; var sh = "­"; var shy = "­"; var sigma = "σ"; var sigmaf = "ς"; var sigmav = "ς"; var sim = "∼"; var simdot = "⩪"; var sime = "≃"; var simeq = "≃"; var simg = "⪞"; var simgE = "⪠"; var siml = "⪝"; var simlE = "⪟"; var simne = "≆"; var simplus = "⨤"; var simrarr = "⥲"; var slarr = "←"; var smallsetminus = "∖"; var smashp = "⨳"; var smeparsl = "⧤"; var smid = "∣"; var smile = "⌣"; var smt = "⪪"; var smte = "⪬"; var smtes = "⪬︀"; var softcy = "ь"; var sol = "/"; var solb = "⧄"; var solbar = "⌿"; var sopf = "𝕤"; var spades = "♠"; var spadesuit = "♠"; var spar = "∥"; var sqcap = "⊓"; var sqcaps = "⊓︀"; var sqcup = "⊔"; var sqcups = "⊔︀"; var sqsub = "⊏"; var sqsube = "⊑"; var sqsubset = "⊏"; var sqsubseteq = "⊑"; var sqsup = "⊐"; var sqsupe = "⊒"; var sqsupset = "⊐"; var sqsupseteq = "⊒"; var squ = "□"; var square = "□"; var squarf = "▪"; var squf = "▪"; var srarr = "→"; var sscr = "𝓈"; var ssetmn = "∖"; var ssmile = "⌣"; var sstarf = "⋆"; var star = "☆"; var starf = "★"; var straightepsilon = "ϵ"; var straightphi = "ϕ"; var strns = "¯"; var sub = "⊂"; var subE = "⫅"; var subdot = "⪽"; var sube = "⊆"; var subedot = "⫃"; var submult = "⫁"; var subnE = "⫋"; var subne = "⊊"; var subplus = "⪿"; var subrarr = "⥹"; var subset = "⊂"; var subseteq = "⊆"; var subseteqq = "⫅"; var subsetneq = "⊊"; var subsetneqq = "⫋"; var subsim = "⫇"; var subsub = "⫕"; var subsup = "⫓"; var succ = "≻"; var succapprox = "⪸"; var succcurlyeq = "≽"; var succeq = "⪰"; var succnapprox = "⪺"; var succneqq = "⪶"; var succnsim = "⋩"; var succsim = "≿"; var sum = "∑"; var sung = "♪"; var sup = "⊃"; var sup1 = "¹"; var sup2 = "²"; var sup3 = "³"; var supE = "⫆"; var supdot = "⪾"; var supdsub = "⫘"; var supe = "⊇"; var supedot = "⫄"; var suphsol = "⟉"; var suphsub = "⫗"; var suplarr = "⥻"; var supmult = "⫂"; var supnE = "⫌"; var supne = "⊋"; var supplus = "⫀"; var supset = "⊃"; var supseteq = "⊇"; var supseteqq = "⫆"; var supsetneq = "⊋"; var supsetneqq = "⫌"; var supsim = "⫈"; var supsub = "⫔"; var supsup = "⫖"; var swArr = "⇙"; var swarhk = "⤦"; var swarr = "↙"; var swarrow = "↙"; var swnwar = "⤪"; var szli = "ß"; var szlig = "ß"; var target = "⌖"; var tau = "τ"; var tbrk = "⎴"; var tcaron = "ť"; var tcedil = "ţ"; var tcy = "т"; var tdot = "⃛"; var telrec = "⌕"; var tfr = "𝔱"; var there4 = "∴"; var therefore = "∴"; var theta = "θ"; var thetasym = "ϑ"; var thetav = "ϑ"; var thickapprox = "≈"; var thicksim = "∼"; var thinsp = " "; var thkap = "≈"; var thksim = "∼"; var thor = "þ"; var thorn = "þ"; var tilde = "˜"; var time = "×"; var times = "×"; var timesb = "⊠"; var timesbar = "⨱"; var timesd = "⨰"; var tint = "∭"; var toea = "⤨"; var top = "⊤"; var topbot = "⌶"; var topcir = "⫱"; var topf = "𝕥"; var topfork = "⫚"; var tosa = "⤩"; var tprime = "‴"; var trade = "™"; var triangle = "▵"; var triangledown = "▿"; var triangleleft = "◃"; var trianglelefteq = "⊴"; var triangleq = "≜"; var triangleright = "▹"; var trianglerighteq = "⊵"; var tridot = "◬"; var trie = "≜"; var triminus = "⨺"; var triplus = "⨹"; var trisb = "⧍"; var tritime = "⨻"; var trpezium = "⏢"; var tscr = "𝓉"; var tscy = "ц"; var tshcy = "ћ"; var tstrok = "ŧ"; var twixt = "≬"; var twoheadleftarrow = "↞"; var twoheadrightarrow = "↠"; var uArr = "⇑"; var uHar = "⥣"; var uacut = "ú"; var uacute = "ú"; var uarr = "↑"; var ubrcy = "ў"; var ubreve = "ŭ"; var ucir = "û"; var ucirc = "û"; var ucy = "у"; var udarr = "⇅"; var udblac = "ű"; var udhar = "⥮"; var ufisht = "⥾"; var ufr = "𝔲"; var ugrav = "ù"; var ugrave = "ù"; var uharl = "↿"; var uharr = "↾"; var uhblk = "▀"; var ulcorn = "⌜"; var ulcorner = "⌜"; var ulcrop = "⌏"; var ultri = "◸"; var umacr = "ū"; var um = "¨"; var uml = "¨"; var uogon = "ų"; var uopf = "𝕦"; var uparrow = "↑"; var updownarrow = "↕"; var upharpoonleft = "↿"; var upharpoonright = "↾"; var uplus = "⊎"; var upsi = "υ"; var upsih = "ϒ"; var upsilon = "υ"; var upuparrows = "⇈"; var urcorn = "⌝"; var urcorner = "⌝"; var urcrop = "⌎"; var uring = "ů"; var urtri = "◹"; var uscr = "𝓊"; var utdot = "⋰"; var utilde = "ũ"; var utri = "▵"; var utrif = "▴"; var uuarr = "⇈"; var uum = "ü"; var uuml = "ü"; var uwangle = "⦧"; var vArr = "⇕"; var vBar = "⫨"; var vBarv = "⫩"; var vDash = "⊨"; var vangrt = "⦜"; var varepsilon = "ϵ"; var varkappa = "ϰ"; var varnothing = "∅"; var varphi = "ϕ"; var varpi = "ϖ"; var varpropto = "∝"; var varr = "↕"; var varrho = "ϱ"; var varsigma = "ς"; var varsubsetneq = "⊊︀"; var varsubsetneqq = "⫋︀"; var varsupsetneq = "⊋︀"; var varsupsetneqq = "⫌︀"; var vartheta = "ϑ"; var vartriangleleft = "⊲"; var vartriangleright = "⊳"; var vcy = "в"; var vdash = "⊢"; var vee = "∨"; var veebar = "⊻"; var veeeq = "≚"; var vellip = "⋮"; var verbar = "|"; var vert = "|"; var vfr = "𝔳"; var vltri = "⊲"; var vnsub = "⊂⃒"; var vnsup = "⊃⃒"; var vopf = "𝕧"; var vprop = "∝"; var vrtri = "⊳"; var vscr = "𝓋"; var vsubnE = "⫋︀"; var vsubne = "⊊︀"; var vsupnE = "⫌︀"; var vsupne = "⊋︀"; var vzigzag = "⦚"; var wcirc = "ŵ"; var wedbar = "⩟"; var wedge = "∧"; var wedgeq = "≙"; var weierp = "℘"; var wfr = "𝔴"; var wopf = "𝕨"; var wp = "℘"; var wr = "≀"; var wreath = "≀"; var wscr = "𝓌"; var xcap = "⋂"; var xcirc = "◯"; var xcup = "⋃"; var xdtri = "▽"; var xfr = "𝔵"; var xhArr = "⟺"; var xharr = "⟷"; var xi = "ξ"; var xlArr = "⟸"; var xlarr = "⟵"; var xmap = "⟼"; var xnis = "⋻"; var xodot = "⨀"; var xopf = "𝕩"; var xoplus = "⨁"; var xotime = "⨂"; var xrArr = "⟹"; var xrarr = "⟶"; var xscr = "𝓍"; var xsqcup = "⨆"; var xuplus = "⨄"; var xutri = "△"; var xvee = "⋁"; var xwedge = "⋀"; var yacut = "ý"; var yacute = "ý"; var yacy = "я"; var ycirc = "ŷ"; var ycy = "ы"; var ye = "¥"; var yen = "¥"; var yfr = "𝔶"; var yicy = "ї"; var yopf = "𝕪"; var yscr = "𝓎"; var yucy = "ю"; var yum = "ÿ"; var yuml = "ÿ"; var zacute = "ź"; var zcaron = "ž"; var zcy = "з"; var zdot = "ż"; var zeetrf = "ℨ"; var zeta = "ζ"; var zfr = "𝔷"; var zhcy = "ж"; var zigrarr = "⇝"; var zopf = "𝕫"; var zscr = "𝓏"; var zwj = "‍"; var zwnj = "‌"; var characterEntities = { AEli: AEli, AElig: AElig, AM: AM, AMP: AMP, Aacut: Aacut, Aacute: Aacute, Abreve: Abreve, Acir: Acir, Acirc: Acirc, Acy: Acy, Afr: Afr, Agrav: Agrav, Agrave: Agrave, Alpha: Alpha, Amacr: Amacr, And: And, Aogon: Aogon, Aopf: Aopf, ApplyFunction: ApplyFunction, Arin: Arin, Aring: Aring, Ascr: Ascr, Assign: Assign, Atild: Atild, Atilde: Atilde, Aum: Aum, Auml: Auml, Backslash: Backslash, Barv: Barv, Barwed: Barwed, Bcy: Bcy, Because: Because, Bernoullis: Bernoullis, Beta: Beta, Bfr: Bfr, Bopf: Bopf, Breve: Breve, Bscr: Bscr, Bumpeq: Bumpeq, CHcy: CHcy, COP: COP, COPY: COPY, Cacute: Cacute, Cap: Cap, CapitalDifferentialD: CapitalDifferentialD, Cayleys: Cayleys, Ccaron: Ccaron, Ccedi: Ccedi, Ccedil: Ccedil, Ccirc: Ccirc, Cconint: Cconint, Cdot: Cdot, Cedilla: Cedilla, CenterDot: CenterDot, Cfr: Cfr, Chi: Chi, CircleDot: CircleDot, CircleMinus: CircleMinus, CirclePlus: CirclePlus, CircleTimes: CircleTimes, ClockwiseContourIntegral: ClockwiseContourIntegral, CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, CloseCurlyQuote: CloseCurlyQuote, Colon: Colon, Colone: Colone, Congruent: Congruent, Conint: Conint, ContourIntegral: ContourIntegral, Copf: Copf, Coproduct: Coproduct, CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, Cross: Cross, Cscr: Cscr, Cup: Cup, CupCap: CupCap, DD: DD, DDotrahd: DDotrahd, DJcy: DJcy, DScy: DScy, DZcy: DZcy, Dagger: Dagger, Darr: Darr, Dashv: Dashv, Dcaron: Dcaron, Dcy: Dcy, Del: Del, Delta: Delta, Dfr: Dfr, DiacriticalAcute: DiacriticalAcute, DiacriticalDot: DiacriticalDot, DiacriticalDoubleAcute: DiacriticalDoubleAcute, DiacriticalGrave: DiacriticalGrave, DiacriticalTilde: DiacriticalTilde, Diamond: Diamond, DifferentialD: DifferentialD, Dopf: Dopf, Dot: Dot, DotDot: DotDot, DotEqual: DotEqual, DoubleContourIntegral: DoubleContourIntegral, DoubleDot: DoubleDot, DoubleDownArrow: DoubleDownArrow, DoubleLeftArrow: DoubleLeftArrow, DoubleLeftRightArrow: DoubleLeftRightArrow, DoubleLeftTee: DoubleLeftTee, DoubleLongLeftArrow: DoubleLongLeftArrow, DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, DoubleLongRightArrow: DoubleLongRightArrow, DoubleRightArrow: DoubleRightArrow, DoubleRightTee: DoubleRightTee, DoubleUpArrow: DoubleUpArrow, DoubleUpDownArrow: DoubleUpDownArrow, DoubleVerticalBar: DoubleVerticalBar, DownArrow: DownArrow, DownArrowBar: DownArrowBar, DownArrowUpArrow: DownArrowUpArrow, DownBreve: DownBreve, DownLeftRightVector: DownLeftRightVector, DownLeftTeeVector: DownLeftTeeVector, DownLeftVector: DownLeftVector, DownLeftVectorBar: DownLeftVectorBar, DownRightTeeVector: DownRightTeeVector, DownRightVector: DownRightVector, DownRightVectorBar: DownRightVectorBar, DownTee: DownTee, DownTeeArrow: DownTeeArrow, Downarrow: Downarrow, Dscr: Dscr, Dstrok: Dstrok, ENG: ENG, ET: ET, ETH: ETH, Eacut: Eacut, Eacute: Eacute, Ecaron: Ecaron, Ecir: Ecir, Ecirc: Ecirc, Ecy: Ecy, Edot: Edot, Efr: Efr, Egrav: Egrav, Egrave: Egrave, Element: Element, Emacr: Emacr, EmptySmallSquare: EmptySmallSquare, EmptyVerySmallSquare: EmptyVerySmallSquare, Eogon: Eogon, Eopf: Eopf, Epsilon: Epsilon, Equal: Equal, EqualTilde: EqualTilde, Equilibrium: Equilibrium, Escr: Escr, Esim: Esim, Eta: Eta, Eum: Eum, Euml: Euml, Exists: Exists, ExponentialE: ExponentialE, Fcy: Fcy, Ffr: Ffr, FilledSmallSquare: FilledSmallSquare, FilledVerySmallSquare: FilledVerySmallSquare, Fopf: Fopf, ForAll: ForAll, Fouriertrf: Fouriertrf, Fscr: Fscr, GJcy: GJcy, G: G, GT: GT, Gamma: Gamma, Gammad: Gammad, Gbreve: Gbreve, Gcedil: Gcedil, Gcirc: Gcirc, Gcy: Gcy, Gdot: Gdot, Gfr: Gfr, Gg: Gg, Gopf: Gopf, GreaterEqual: GreaterEqual, GreaterEqualLess: GreaterEqualLess, GreaterFullEqual: GreaterFullEqual, GreaterGreater: GreaterGreater, GreaterLess: GreaterLess, GreaterSlantEqual: GreaterSlantEqual, GreaterTilde: GreaterTilde, Gscr: Gscr, Gt: Gt, HARDcy: HARDcy, Hacek: Hacek, Hat: Hat, Hcirc: Hcirc, Hfr: Hfr, HilbertSpace: HilbertSpace, Hopf: Hopf, HorizontalLine: HorizontalLine, Hscr: Hscr, Hstrok: Hstrok, HumpDownHump: HumpDownHump, HumpEqual: HumpEqual, IEcy: IEcy, IJlig: IJlig, IOcy: IOcy, Iacut: Iacut, Iacute: Iacute, Icir: Icir, Icirc: Icirc, Icy: Icy, Idot: Idot, Ifr: Ifr, Igrav: Igrav, Igrave: Igrave, Im: Im, Imacr: Imacr, ImaginaryI: ImaginaryI, Implies: Implies, Int: Int, Integral: Integral, Intersection: Intersection, InvisibleComma: InvisibleComma, InvisibleTimes: InvisibleTimes, Iogon: Iogon, Iopf: Iopf, Iota: Iota, Iscr: Iscr, Itilde: Itilde, Iukcy: Iukcy, Ium: Ium, Iuml: Iuml, Jcirc: Jcirc, Jcy: Jcy, Jfr: Jfr, Jopf: Jopf, Jscr: Jscr, Jsercy: Jsercy, Jukcy: Jukcy, KHcy: KHcy, KJcy: KJcy, Kappa: Kappa, Kcedil: Kcedil, Kcy: Kcy, Kfr: Kfr, Kopf: Kopf, Kscr: Kscr, LJcy: LJcy, L: L$1, LT: LT, Lacute: Lacute, Lambda: Lambda, Lang: Lang, Laplacetrf: Laplacetrf, Larr: Larr, Lcaron: Lcaron, Lcedil: Lcedil, Lcy: Lcy, LeftAngleBracket: LeftAngleBracket, LeftArrow: LeftArrow, LeftArrowBar: LeftArrowBar, LeftArrowRightArrow: LeftArrowRightArrow, LeftCeiling: LeftCeiling, LeftDoubleBracket: LeftDoubleBracket, LeftDownTeeVector: LeftDownTeeVector, LeftDownVector: LeftDownVector, LeftDownVectorBar: LeftDownVectorBar, LeftFloor: LeftFloor, LeftRightArrow: LeftRightArrow, LeftRightVector: LeftRightVector, LeftTee: LeftTee, LeftTeeArrow: LeftTeeArrow, LeftTeeVector: LeftTeeVector, LeftTriangle: LeftTriangle, LeftTriangleBar: LeftTriangleBar, LeftTriangleEqual: LeftTriangleEqual, LeftUpDownVector: LeftUpDownVector, LeftUpTeeVector: LeftUpTeeVector, LeftUpVector: LeftUpVector, LeftUpVectorBar: LeftUpVectorBar, LeftVector: LeftVector, LeftVectorBar: LeftVectorBar, Leftarrow: Leftarrow, Leftrightarrow: Leftrightarrow, LessEqualGreater: LessEqualGreater, LessFullEqual: LessFullEqual, LessGreater: LessGreater, LessLess: LessLess, LessSlantEqual: LessSlantEqual, LessTilde: LessTilde, Lfr: Lfr, Ll: Ll, Lleftarrow: Lleftarrow, Lmidot: Lmidot, LongLeftArrow: LongLeftArrow, LongLeftRightArrow: LongLeftRightArrow, LongRightArrow: LongRightArrow, Longleftarrow: Longleftarrow, Longleftrightarrow: Longleftrightarrow, Longrightarrow: Longrightarrow, Lopf: Lopf, LowerLeftArrow: LowerLeftArrow, LowerRightArrow: LowerRightArrow, Lscr: Lscr, Lsh: Lsh, Lstrok: Lstrok, Lt: Lt, "Map": "⤅", Mcy: Mcy, MediumSpace: MediumSpace, Mellintrf: Mellintrf, Mfr: Mfr, MinusPlus: MinusPlus, Mopf: Mopf, Mscr: Mscr, Mu: Mu, NJcy: NJcy, Nacute: Nacute, Ncaron: Ncaron, Ncedil: Ncedil, Ncy: Ncy, NegativeMediumSpace: NegativeMediumSpace, NegativeThickSpace: NegativeThickSpace, NegativeThinSpace: NegativeThinSpace, NegativeVeryThinSpace: NegativeVeryThinSpace, NestedGreaterGreater: NestedGreaterGreater, NestedLessLess: NestedLessLess, NewLine: NewLine, Nfr: Nfr, NoBreak: NoBreak, NonBreakingSpace: NonBreakingSpace, Nopf: Nopf, Not: Not, NotCongruent: NotCongruent, NotCupCap: NotCupCap, NotDoubleVerticalBar: NotDoubleVerticalBar, NotElement: NotElement, NotEqual: NotEqual, NotEqualTilde: NotEqualTilde, NotExists: NotExists, NotGreater: NotGreater, NotGreaterEqual: NotGreaterEqual, NotGreaterFullEqual: NotGreaterFullEqual, NotGreaterGreater: NotGreaterGreater, NotGreaterLess: NotGreaterLess, NotGreaterSlantEqual: NotGreaterSlantEqual, NotGreaterTilde: NotGreaterTilde, NotHumpDownHump: NotHumpDownHump, NotHumpEqual: NotHumpEqual, NotLeftTriangle: NotLeftTriangle, NotLeftTriangleBar: NotLeftTriangleBar, NotLeftTriangleEqual: NotLeftTriangleEqual, NotLess: NotLess, NotLessEqual: NotLessEqual, NotLessGreater: NotLessGreater, NotLessLess: NotLessLess, NotLessSlantEqual: NotLessSlantEqual, NotLessTilde: NotLessTilde, NotNestedGreaterGreater: NotNestedGreaterGreater, NotNestedLessLess: NotNestedLessLess, NotPrecedes: NotPrecedes, NotPrecedesEqual: NotPrecedesEqual, NotPrecedesSlantEqual: NotPrecedesSlantEqual, NotReverseElement: NotReverseElement, NotRightTriangle: NotRightTriangle, NotRightTriangleBar: NotRightTriangleBar, NotRightTriangleEqual: NotRightTriangleEqual, NotSquareSubset: NotSquareSubset, NotSquareSubsetEqual: NotSquareSubsetEqual, NotSquareSuperset: NotSquareSuperset, NotSquareSupersetEqual: NotSquareSupersetEqual, NotSubset: NotSubset, NotSubsetEqual: NotSubsetEqual, NotSucceeds: NotSucceeds, NotSucceedsEqual: NotSucceedsEqual, NotSucceedsSlantEqual: NotSucceedsSlantEqual, NotSucceedsTilde: NotSucceedsTilde, NotSuperset: NotSuperset, NotSupersetEqual: NotSupersetEqual, NotTilde: NotTilde, NotTildeEqual: NotTildeEqual, NotTildeFullEqual: NotTildeFullEqual, NotTildeTilde: NotTildeTilde, NotVerticalBar: NotVerticalBar, Nscr: Nscr, Ntild: Ntild, Ntilde: Ntilde, Nu: Nu, OElig: OElig, Oacut: Oacut, Oacute: Oacute, Ocir: Ocir, Ocirc: Ocirc, Ocy: Ocy, Odblac: Odblac, Ofr: Ofr, Ograv: Ograv, Ograve: Ograve, Omacr: Omacr, Omega: Omega, Omicron: Omicron, Oopf: Oopf, OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, OpenCurlyQuote: OpenCurlyQuote, Or: Or, Oscr: Oscr, Oslas: Oslas, Oslash: Oslash, Otild: Otild, Otilde: Otilde, Otimes: Otimes, Oum: Oum, Ouml: Ouml, OverBar: OverBar, OverBrace: OverBrace, OverBracket: OverBracket, OverParenthesis: OverParenthesis, PartialD: PartialD, Pcy: Pcy, Pfr: Pfr, Phi: Phi, Pi: Pi, PlusMinus: PlusMinus, Poincareplane: Poincareplane, Popf: Popf, Pr: Pr, Precedes: Precedes, PrecedesEqual: PrecedesEqual, PrecedesSlantEqual: PrecedesSlantEqual, PrecedesTilde: PrecedesTilde, Prime: Prime, Product: Product, Proportion: Proportion, Proportional: Proportional, Pscr: Pscr, Psi: Psi, QUO: QUO, QUOT: QUOT, Qfr: Qfr, Qopf: Qopf, Qscr: Qscr, RBarr: RBarr, RE: RE, REG: REG, Racute: Racute, Rang: Rang, Rarr: Rarr, Rarrtl: Rarrtl, Rcaron: Rcaron, Rcedil: Rcedil, Rcy: Rcy, Re: Re, ReverseElement: ReverseElement, ReverseEquilibrium: ReverseEquilibrium, ReverseUpEquilibrium: ReverseUpEquilibrium, Rfr: Rfr, Rho: Rho, RightAngleBracket: RightAngleBracket, RightArrow: RightArrow, RightArrowBar: RightArrowBar, RightArrowLeftArrow: RightArrowLeftArrow, RightCeiling: RightCeiling, RightDoubleBracket: RightDoubleBracket, RightDownTeeVector: RightDownTeeVector, RightDownVector: RightDownVector, RightDownVectorBar: RightDownVectorBar, RightFloor: RightFloor, RightTee: RightTee, RightTeeArrow: RightTeeArrow, RightTeeVector: RightTeeVector, RightTriangle: RightTriangle, RightTriangleBar: RightTriangleBar, RightTriangleEqual: RightTriangleEqual, RightUpDownVector: RightUpDownVector, RightUpTeeVector: RightUpTeeVector, RightUpVector: RightUpVector, RightUpVectorBar: RightUpVectorBar, RightVector: RightVector, RightVectorBar: RightVectorBar, Rightarrow: Rightarrow, Ropf: Ropf, RoundImplies: RoundImplies, Rrightarrow: Rrightarrow, Rscr: Rscr, Rsh: Rsh, RuleDelayed: RuleDelayed, SHCHcy: SHCHcy, SHcy: SHcy, SOFTcy: SOFTcy, Sacute: Sacute, Sc: Sc, Scaron: Scaron, Scedil: Scedil, Scirc: Scirc, Scy: Scy, Sfr: Sfr, ShortDownArrow: ShortDownArrow, ShortLeftArrow: ShortLeftArrow, ShortRightArrow: ShortRightArrow, ShortUpArrow: ShortUpArrow, Sigma: Sigma, SmallCircle: SmallCircle, Sopf: Sopf, Sqrt: Sqrt, Square: Square, SquareIntersection: SquareIntersection, SquareSubset: SquareSubset, SquareSubsetEqual: SquareSubsetEqual, SquareSuperset: SquareSuperset, SquareSupersetEqual: SquareSupersetEqual, SquareUnion: SquareUnion, Sscr: Sscr, Star: Star, Sub: Sub, Subset: Subset, SubsetEqual: SubsetEqual, Succeeds: Succeeds, SucceedsEqual: SucceedsEqual, SucceedsSlantEqual: SucceedsSlantEqual, SucceedsTilde: SucceedsTilde, SuchThat: SuchThat, Sum: Sum, Sup: Sup, Superset: Superset, SupersetEqual: SupersetEqual, Supset: Supset, THOR: THOR, THORN: THORN, TRADE: TRADE, TSHcy: TSHcy, TScy: TScy, Tab: Tab, Tau: Tau, Tcaron: Tcaron, Tcedil: Tcedil, Tcy: Tcy, Tfr: Tfr, Therefore: Therefore, Theta: Theta, ThickSpace: ThickSpace, ThinSpace: ThinSpace, Tilde: Tilde, TildeEqual: TildeEqual, TildeFullEqual: TildeFullEqual, TildeTilde: TildeTilde, Topf: Topf, TripleDot: TripleDot, Tscr: Tscr, Tstrok: Tstrok, Uacut: Uacut, Uacute: Uacute, Uarr: Uarr, Uarrocir: Uarrocir, Ubrcy: Ubrcy, Ubreve: Ubreve, Ucir: Ucir, Ucirc: Ucirc, Ucy: Ucy, Udblac: Udblac, Ufr: Ufr, Ugrav: Ugrav, Ugrave: Ugrave, Umacr: Umacr, UnderBar: UnderBar, UnderBrace: UnderBrace, UnderBracket: UnderBracket, UnderParenthesis: UnderParenthesis, Union: Union, UnionPlus: UnionPlus, Uogon: Uogon, Uopf: Uopf, UpArrow: UpArrow, UpArrowBar: UpArrowBar, UpArrowDownArrow: UpArrowDownArrow, UpDownArrow: UpDownArrow, UpEquilibrium: UpEquilibrium, UpTee: UpTee, UpTeeArrow: UpTeeArrow, Uparrow: Uparrow, Updownarrow: Updownarrow, UpperLeftArrow: UpperLeftArrow, UpperRightArrow: UpperRightArrow, Upsi: Upsi, Upsilon: Upsilon, Uring: Uring, Uscr: Uscr, Utilde: Utilde, Uum: Uum, Uuml: Uuml, VDash: VDash, Vbar: Vbar, Vcy: Vcy, Vdash: Vdash, Vdashl: Vdashl, Vee: Vee, Verbar: Verbar, Vert: Vert, VerticalBar: VerticalBar, VerticalLine: VerticalLine, VerticalSeparator: VerticalSeparator, VerticalTilde: VerticalTilde, VeryThinSpace: VeryThinSpace, Vfr: Vfr, Vopf: Vopf, Vscr: Vscr, Vvdash: Vvdash, Wcirc: Wcirc, Wedge: Wedge, Wfr: Wfr, Wopf: Wopf, Wscr: Wscr, Xfr: Xfr, Xi: Xi, Xopf: Xopf, Xscr: Xscr, YAcy: YAcy, YIcy: YIcy, YUcy: YUcy, Yacut: Yacut, Yacute: Yacute, Ycirc: Ycirc, Ycy: Ycy, Yfr: Yfr, Yopf: Yopf, Yscr: Yscr, Yuml: Yuml, ZHcy: ZHcy, Zacute: Zacute, Zcaron: Zcaron, Zcy: Zcy, Zdot: Zdot, ZeroWidthSpace: ZeroWidthSpace, Zeta: Zeta, Zfr: Zfr, Zopf: Zopf, Zscr: Zscr, aacut: aacut, aacute: aacute, abreve: abreve, ac: ac, acE: acE, acd: acd, acir: acir, acirc: acirc, acut: acut, acute: acute, acy: acy, aeli: aeli, aelig: aelig, af: af, afr: afr, agrav: agrav, agrave: agrave, alefsym: alefsym, aleph: aleph, alpha: alpha, amacr: amacr, amalg: amalg, am: am, amp: amp, and: and, andand: andand, andd: andd, andslope: andslope, andv: andv, ang: ang, ange: ange, angle: angle, angmsd: angmsd, angmsdaa: angmsdaa, angmsdab: angmsdab, angmsdac: angmsdac, angmsdad: angmsdad, angmsdae: angmsdae, angmsdaf: angmsdaf, angmsdag: angmsdag, angmsdah: angmsdah, angrt: angrt, angrtvb: angrtvb, angrtvbd: angrtvbd, angsph: angsph, angst: angst, angzarr: angzarr, aogon: aogon, aopf: aopf, ap: ap, apE: apE, apacir: apacir, ape: ape, apid: apid, apos: apos, approx: approx, approxeq: approxeq, arin: arin, aring: aring, ascr: ascr, ast: ast, asymp: asymp, asympeq: asympeq, atild: atild, atilde: atilde, aum: aum, auml: auml, awconint: awconint, awint: awint, bNot: bNot, backcong: backcong, backepsilon: backepsilon, backprime: backprime, backsim: backsim, backsimeq: backsimeq, barvee: barvee, barwed: barwed, barwedge: barwedge, bbrk: bbrk, bbrktbrk: bbrktbrk, bcong: bcong, bcy: bcy, bdquo: bdquo, becaus: becaus, because: because, bemptyv: bemptyv, bepsi: bepsi, bernou: bernou, beta: beta, beth: beth, between: between, bfr: bfr, bigcap: bigcap, bigcirc: bigcirc, bigcup: bigcup, bigodot: bigodot, bigoplus: bigoplus, bigotimes: bigotimes, bigsqcup: bigsqcup, bigstar: bigstar, bigtriangledown: bigtriangledown, bigtriangleup: bigtriangleup, biguplus: biguplus, bigvee: bigvee, bigwedge: bigwedge, bkarow: bkarow, blacklozenge: blacklozenge, blacksquare: blacksquare, blacktriangle: blacktriangle, blacktriangledown: blacktriangledown, blacktriangleleft: blacktriangleleft, blacktriangleright: blacktriangleright, blank: blank, blk12: blk12, blk14: blk14, blk34: blk34, block: block, bne: bne, bnequiv: bnequiv, bnot: bnot, bopf: bopf, bot: bot, bottom: bottom, bowtie: bowtie, boxDL: boxDL, boxDR: boxDR, boxDl: boxDl, boxDr: boxDr, boxH: boxH, boxHD: boxHD, boxHU: boxHU, boxHd: boxHd, boxHu: boxHu, boxUL: boxUL, boxUR: boxUR, boxUl: boxUl, boxUr: boxUr, boxV: boxV, boxVH: boxVH, boxVL: boxVL, boxVR: boxVR, boxVh: boxVh, boxVl: boxVl, boxVr: boxVr, boxbox: boxbox, boxdL: boxdL, boxdR: boxdR, boxdl: boxdl, boxdr: boxdr, boxh: boxh, boxhD: boxhD, boxhU: boxhU, boxhd: boxhd, boxhu: boxhu, boxminus: boxminus, boxplus: boxplus, boxtimes: boxtimes, boxuL: boxuL, boxuR: boxuR, boxul: boxul, boxur: boxur, boxv: boxv, boxvH: boxvH, boxvL: boxvL, boxvR: boxvR, boxvh: boxvh, boxvl: boxvl, boxvr: boxvr, bprime: bprime, breve: breve, brvba: brvba, brvbar: brvbar, bscr: bscr, bsemi: bsemi, bsim: bsim, bsime: bsime, bsol: bsol, bsolb: bsolb, bsolhsub: bsolhsub, bull: bull, bullet: bullet, bump: bump, bumpE: bumpE, bumpe: bumpe, bumpeq: bumpeq, cacute: cacute, cap: cap, capand: capand, capbrcup: capbrcup, capcap: capcap, capcup: capcup, capdot: capdot, caps: caps, caret: caret, caron: caron, ccaps: ccaps, ccaron: ccaron, ccedi: ccedi, ccedil: ccedil, ccirc: ccirc, ccups: ccups, ccupssm: ccupssm, cdot: cdot, cedi: cedi, cedil: cedil, cemptyv: cemptyv, cen: cen, cent: cent, centerdot: centerdot, cfr: cfr, chcy: chcy, check: check, checkmark: checkmark, chi: chi, cir: cir, cirE: cirE, circ: circ, circeq: circeq, circlearrowleft: circlearrowleft, circlearrowright: circlearrowright, circledR: circledR, circledS: circledS, circledast: circledast, circledcirc: circledcirc, circleddash: circleddash, cire: cire, cirfnint: cirfnint, cirmid: cirmid, cirscir: cirscir, clubs: clubs, clubsuit: clubsuit, colon: colon$1, colone: colone, coloneq: coloneq, comma: comma, commat: commat, comp: comp, compfn: compfn, complement: complement, complexes: complexes, cong: cong, congdot: congdot, conint: conint, copf: copf, coprod: coprod, cop: cop, copy: copy, copysr: copysr, crarr: crarr, cross: cross, cscr: cscr, csub: csub, csube: csube, csup: csup, csupe: csupe, ctdot: ctdot, cudarrl: cudarrl, cudarrr: cudarrr, cuepr: cuepr, cuesc: cuesc, cularr: cularr, cularrp: cularrp, cup: cup, cupbrcap: cupbrcap, cupcap: cupcap, cupcup: cupcup, cupdot: cupdot, cupor: cupor, cups: cups, curarr: curarr, curarrm: curarrm, curlyeqprec: curlyeqprec, curlyeqsucc: curlyeqsucc, curlyvee: curlyvee, curlywedge: curlywedge, curre: curre, curren: curren, curvearrowleft: curvearrowleft, curvearrowright: curvearrowright, cuvee: cuvee, cuwed: cuwed, cwconint: cwconint, cwint: cwint, cylcty: cylcty, dArr: dArr, dHar: dHar, dagger: dagger, daleth: daleth, darr: darr, dash: dash$1, dashv: dashv, dbkarow: dbkarow, dblac: dblac, dcaron: dcaron, dcy: dcy, dd: dd, ddagger: ddagger, ddarr: ddarr, ddotseq: ddotseq, de: de, deg: deg, delta: delta, demptyv: demptyv, dfisht: dfisht, dfr: dfr, dharl: dharl, dharr: dharr, diam: diam, diamond: diamond, diamondsuit: diamondsuit, diams: diams, die: die, digamma: digamma, disin: disin, div: div, divid: divid, divide: divide, divideontimes: divideontimes, divonx: divonx, djcy: djcy, dlcorn: dlcorn, dlcrop: dlcrop, dollar: dollar, dopf: dopf, dot: dot, doteq: doteq, doteqdot: doteqdot, dotminus: dotminus, dotplus: dotplus, dotsquare: dotsquare, doublebarwedge: doublebarwedge, downarrow: downarrow, downdownarrows: downdownarrows, downharpoonleft: downharpoonleft, downharpoonright: downharpoonright, drbkarow: drbkarow, drcorn: drcorn, drcrop: drcrop, dscr: dscr, dscy: dscy, dsol: dsol, dstrok: dstrok, dtdot: dtdot, dtri: dtri, dtrif: dtrif, duarr: duarr, duhar: duhar, dwangle: dwangle, dzcy: dzcy, dzigrarr: dzigrarr, eDDot: eDDot, eDot: eDot, eacut: eacut, eacute: eacute, easter: easter, ecaron: ecaron, ecir: ecir, ecirc: ecirc, ecolon: ecolon, ecy: ecy, edot: edot, ee: ee, efDot: efDot, efr: efr, eg: eg, egrav: egrav, egrave: egrave, egs: egs, egsdot: egsdot, el: el, elinters: elinters, ell: ell, els: els, elsdot: elsdot, emacr: emacr, empty: empty, emptyset: emptyset, emptyv: emptyv, emsp13: emsp13, emsp14: emsp14, emsp: emsp, eng: eng, ensp: ensp, eogon: eogon, eopf: eopf, epar: epar, eparsl: eparsl, eplus: eplus, epsi: epsi, epsilon: epsilon, epsiv: epsiv, eqcirc: eqcirc, eqcolon: eqcolon, eqsim: eqsim, eqslantgtr: eqslantgtr, eqslantless: eqslantless, equals: equals, equest: equest, equiv: equiv, equivDD: equivDD, eqvparsl: eqvparsl, erDot: erDot, erarr: erarr, escr: escr, esdot: esdot, esim: esim, eta: eta, et: et, eth: eth, eum: eum, euml: euml, euro: euro, excl: excl, exist: exist, expectation: expectation, exponentiale: exponentiale, fallingdotseq: fallingdotseq, fcy: fcy, female: female, ffilig: ffilig, fflig: fflig, ffllig: ffllig, ffr: ffr, filig: filig, fjlig: fjlig, flat: flat, fllig: fllig, fltns: fltns, fnof: fnof, fopf: fopf, forall: forall, fork: fork, forkv: forkv, fpartint: fpartint, frac1: frac1, frac12: frac12, frac13: frac13, frac14: frac14, frac15: frac15, frac16: frac16, frac18: frac18, frac23: frac23, frac25: frac25, frac3: frac3, frac34: frac34, frac35: frac35, frac38: frac38, frac45: frac45, frac56: frac56, frac58: frac58, frac78: frac78, frasl: frasl, frown: frown, fscr: fscr, gE: gE, gEl: gEl, gacute: gacute, gamma: gamma, gammad: gammad, gap: gap, gbreve: gbreve, gcirc: gcirc, gcy: gcy, gdot: gdot, ge: ge, gel: gel, geq: geq, geqq: geqq, geqslant: geqslant, ges: ges, gescc: gescc, gesdot: gesdot, gesdoto: gesdoto, gesdotol: gesdotol, gesl: gesl, gesles: gesles, gfr: gfr, gg: gg, ggg: ggg, gimel: gimel, gjcy: gjcy, gl: gl, glE: glE, gla: gla, glj: glj, gnE: gnE, gnap: gnap, gnapprox: gnapprox, gne: gne, gneq: gneq, gneqq: gneqq, gnsim: gnsim, gopf: gopf, grave: grave, gscr: gscr, gsim: gsim, gsime: gsime, gsiml: gsiml, g: g, gt: gt, gtcc: gtcc, gtcir: gtcir, gtdot: gtdot, gtlPar: gtlPar, gtquest: gtquest, gtrapprox: gtrapprox, gtrarr: gtrarr, gtrdot: gtrdot, gtreqless: gtreqless, gtreqqless: gtreqqless, gtrless: gtrless, gtrsim: gtrsim, gvertneqq: gvertneqq, gvnE: gvnE, hArr: hArr, hairsp: hairsp, half: half, hamilt: hamilt, hardcy: hardcy, harr: harr, harrcir: harrcir, harrw: harrw, hbar: hbar, hcirc: hcirc, hearts: hearts, heartsuit: heartsuit, hellip: hellip, hercon: hercon, hfr: hfr, hksearow: hksearow, hkswarow: hkswarow, hoarr: hoarr, homtht: homtht, hookleftarrow: hookleftarrow, hookrightarrow: hookrightarrow, hopf: hopf, horbar: horbar, hscr: hscr, hslash: hslash, hstrok: hstrok, hybull: hybull, hyphen: hyphen, iacut: iacut, iacute: iacute, ic: ic, icir: icir, icirc: icirc, icy: icy, iecy: iecy, iexc: iexc, iexcl: iexcl, iff: iff, ifr: ifr, igrav: igrav, igrave: igrave, ii: ii, iiiint: iiiint, iiint: iiint, iinfin: iinfin, iiota: iiota, ijlig: ijlig, imacr: imacr, image: image, imagline: imagline, imagpart: imagpart, imath: imath, imof: imof, imped: imped, "in": "∈", incare: incare, infin: infin, infintie: infintie, inodot: inodot, int: int, intcal: intcal, integers: integers, intercal: intercal, intlarhk: intlarhk, intprod: intprod, iocy: iocy, iogon: iogon, iopf: iopf, iota: iota, iprod: iprod, iques: iques, iquest: iquest, iscr: iscr, isin: isin, isinE: isinE, isindot: isindot, isins: isins, isinsv: isinsv, isinv: isinv, it: it, itilde: itilde, iukcy: iukcy, ium: ium, iuml: iuml, jcirc: jcirc, jcy: jcy, jfr: jfr, jmath: jmath, jopf: jopf, jscr: jscr, jsercy: jsercy, jukcy: jukcy, kappa: kappa, kappav: kappav, kcedil: kcedil, kcy: kcy, kfr: kfr, kgreen: kgreen, khcy: khcy, kjcy: kjcy, kopf: kopf, kscr: kscr, lAarr: lAarr, lArr: lArr, lAtail: lAtail, lBarr: lBarr, lE: lE, lEg: lEg, lHar: lHar, lacute: lacute, laemptyv: laemptyv, lagran: lagran, lambda: lambda, lang: lang, langd: langd, langle: langle, lap: lap, laqu: laqu, laquo: laquo, larr: larr, larrb: larrb, larrbfs: larrbfs, larrfs: larrfs, larrhk: larrhk, larrlp: larrlp, larrpl: larrpl, larrsim: larrsim, larrtl: larrtl, lat: lat, latail: latail, late: late, lates: lates, lbarr: lbarr, lbbrk: lbbrk, lbrace: lbrace, lbrack: lbrack, lbrke: lbrke, lbrksld: lbrksld, lbrkslu: lbrkslu, lcaron: lcaron, lcedil: lcedil, lceil: lceil, lcub: lcub, lcy: lcy, ldca: ldca, ldquo: ldquo, ldquor: ldquor, ldrdhar: ldrdhar, ldrushar: ldrushar, ldsh: ldsh, le: le, leftarrow: leftarrow, leftarrowtail: leftarrowtail, leftharpoondown: leftharpoondown, leftharpoonup: leftharpoonup, leftleftarrows: leftleftarrows, leftrightarrow: leftrightarrow, leftrightarrows: leftrightarrows, leftrightharpoons: leftrightharpoons, leftrightsquigarrow: leftrightsquigarrow, leftthreetimes: leftthreetimes, leg: leg, leq: leq, leqq: leqq, leqslant: leqslant, les: les, lescc: lescc, lesdot: lesdot, lesdoto: lesdoto, lesdotor: lesdotor, lesg: lesg, lesges: lesges, lessapprox: lessapprox, lessdot: lessdot, lesseqgtr: lesseqgtr, lesseqqgtr: lesseqqgtr, lessgtr: lessgtr, lesssim: lesssim, lfisht: lfisht, lfloor: lfloor, lfr: lfr, lg: lg, lgE: lgE, lhard: lhard, lharu: lharu, lharul: lharul, lhblk: lhblk, ljcy: ljcy, ll: ll, llarr: llarr, llcorner: llcorner, llhard: llhard, lltri: lltri, lmidot: lmidot, lmoust: lmoust, lmoustache: lmoustache, lnE: lnE, lnap: lnap, lnapprox: lnapprox, lne: lne, lneq: lneq, lneqq: lneqq, lnsim: lnsim, loang: loang, loarr: loarr, lobrk: lobrk, longleftarrow: longleftarrow, longleftrightarrow: longleftrightarrow, longmapsto: longmapsto, longrightarrow: longrightarrow, looparrowleft: looparrowleft, looparrowright: looparrowright, lopar: lopar, lopf: lopf, loplus: loplus, lotimes: lotimes, lowast: lowast, lowbar: lowbar, loz: loz, lozenge: lozenge, lozf: lozf, lpar: lpar, lparlt: lparlt, lrarr: lrarr, lrcorner: lrcorner, lrhar: lrhar, lrhard: lrhard, lrm: lrm, lrtri: lrtri, lsaquo: lsaquo, lscr: lscr, lsh: lsh, lsim: lsim, lsime: lsime, lsimg: lsimg, lsqb: lsqb, lsquo: lsquo, lsquor: lsquor, lstrok: lstrok, l: l$1, lt: lt, ltcc: ltcc, ltcir: ltcir, ltdot: ltdot, lthree: lthree, ltimes: ltimes, ltlarr: ltlarr, ltquest: ltquest, ltrPar: ltrPar, ltri: ltri, ltrie: ltrie, ltrif: ltrif, lurdshar: lurdshar, luruhar: luruhar, lvertneqq: lvertneqq, lvnE: lvnE, mDDot: mDDot, mac: mac, macr: macr, male: male, malt: malt, maltese: maltese, map: map$1, mapsto: mapsto, mapstodown: mapstodown, mapstoleft: mapstoleft, mapstoup: mapstoup, marker: marker, mcomma: mcomma, mcy: mcy, mdash: mdash, measuredangle: measuredangle, mfr: mfr, mho: mho, micr: micr, micro: micro, mid: mid, midast: midast, midcir: midcir, middo: middo, middot: middot, minus: minus, minusb: minusb, minusd: minusd, minusdu: minusdu, mlcp: mlcp, mldr: mldr, mnplus: mnplus, models: models, mopf: mopf, mp: mp, mscr: mscr, mstpos: mstpos, mu: mu, multimap: multimap, mumap: mumap, nGg: nGg, nGt: nGt, nGtv: nGtv, nLeftarrow: nLeftarrow, nLeftrightarrow: nLeftrightarrow, nLl: nLl, nLt: nLt, nLtv: nLtv, nRightarrow: nRightarrow, nVDash: nVDash, nVdash: nVdash, nabla: nabla, nacute: nacute, nang: nang, nap: nap, napE: napE, napid: napid, napos: napos, napprox: napprox, natur: natur, natural: natural, naturals: naturals, nbs: nbs, nbsp: nbsp, nbump: nbump, nbumpe: nbumpe, ncap: ncap, ncaron: ncaron, ncedil: ncedil, ncong: ncong, ncongdot: ncongdot, ncup: ncup, ncy: ncy, ndash: ndash, ne: ne, neArr: neArr, nearhk: nearhk, nearr: nearr, nearrow: nearrow, nedot: nedot, nequiv: nequiv, nesear: nesear, nesim: nesim, nexist: nexist, nexists: nexists, nfr: nfr, ngE: ngE, nge: nge, ngeq: ngeq, ngeqq: ngeqq, ngeqslant: ngeqslant, nges: nges, ngsim: ngsim, ngt: ngt, ngtr: ngtr, nhArr: nhArr, nharr: nharr, nhpar: nhpar, ni: ni, nis: nis, nisd: nisd, niv: niv, njcy: njcy, nlArr: nlArr, nlE: nlE, nlarr: nlarr, nldr: nldr, nle: nle, nleftarrow: nleftarrow, nleftrightarrow: nleftrightarrow, nleq: nleq, nleqq: nleqq, nleqslant: nleqslant, nles: nles, nless: nless, nlsim: nlsim, nlt: nlt, nltri: nltri, nltrie: nltrie, nmid: nmid, nopf: nopf, no: no, not: not, notin: notin, notinE: notinE, notindot: notindot, notinva: notinva, notinvb: notinvb, notinvc: notinvc, notni: notni, notniva: notniva, notnivb: notnivb, notnivc: notnivc, npar: npar, nparallel: nparallel, nparsl: nparsl, npart: npart, npolint: npolint, npr: npr, nprcue: nprcue, npre: npre, nprec: nprec, npreceq: npreceq, nrArr: nrArr, nrarr: nrarr, nrarrc: nrarrc, nrarrw: nrarrw, nrightarrow: nrightarrow, nrtri: nrtri, nrtrie: nrtrie, nsc: nsc, nsccue: nsccue, nsce: nsce, nscr: nscr, nshortmid: nshortmid, nshortparallel: nshortparallel, nsim: nsim, nsime: nsime, nsimeq: nsimeq, nsmid: nsmid, nspar: nspar, nsqsube: nsqsube, nsqsupe: nsqsupe, nsub: nsub, nsubE: nsubE, nsube: nsube, nsubset: nsubset, nsubseteq: nsubseteq, nsubseteqq: nsubseteqq, nsucc: nsucc, nsucceq: nsucceq, nsup: nsup, nsupE: nsupE, nsupe: nsupe, nsupset: nsupset, nsupseteq: nsupseteq, nsupseteqq: nsupseteqq, ntgl: ntgl, ntild: ntild, ntilde: ntilde, ntlg: ntlg, ntriangleleft: ntriangleleft, ntrianglelefteq: ntrianglelefteq, ntriangleright: ntriangleright, ntrianglerighteq: ntrianglerighteq, nu: nu, num: num, numero: numero, numsp: numsp, nvDash: nvDash, nvHarr: nvHarr, nvap: nvap, nvdash: nvdash, nvge: nvge, nvgt: nvgt, nvinfin: nvinfin, nvlArr: nvlArr, nvle: nvle, nvlt: nvlt, nvltrie: nvltrie, nvrArr: nvrArr, nvrtrie: nvrtrie, nvsim: nvsim, nwArr: nwArr, nwarhk: nwarhk, nwarr: nwarr, nwarrow: nwarrow, nwnear: nwnear, oS: oS, oacut: oacut, oacute: oacute, oast: oast, ocir: ocir, ocirc: ocirc, ocy: ocy, odash: odash, odblac: odblac, odiv: odiv, odot: odot, odsold: odsold, oelig: oelig, ofcir: ofcir, ofr: ofr, ogon: ogon, ograv: ograv, ograve: ograve, ogt: ogt, ohbar: ohbar, ohm: ohm, oint: oint, olarr: olarr, olcir: olcir, olcross: olcross, oline: oline, olt: olt, omacr: omacr, omega: omega, omicron: omicron, omid: omid, ominus: ominus, oopf: oopf, opar: opar, operp: operp, oplus: oplus, or: or, orarr: orarr, ord: ord, order: order$1, orderof: orderof, ordf: ordf, ordm: ordm, origof: origof, oror: oror, orslope: orslope, orv: orv, oscr: oscr, oslas: oslas, oslash: oslash, osol: osol, otild: otild, otilde: otilde, otimes: otimes, otimesas: otimesas, oum: oum, ouml: ouml, ovbar: ovbar, par: par, para: para, parallel: parallel, parsim: parsim, parsl: parsl, part: part, pcy: pcy, percnt: percnt, period: period, permil: permil, perp: perp, pertenk: pertenk, pfr: pfr, phi: phi, phiv: phiv, phmmat: phmmat, phone: phone, pi: pi, pitchfork: pitchfork, piv: piv, planck: planck, planckh: planckh, plankv: plankv, plus: plus, plusacir: plusacir, plusb: plusb, pluscir: pluscir, plusdo: plusdo, plusdu: plusdu, pluse: pluse, plusm: plusm, plusmn: plusmn, plussim: plussim, plustwo: plustwo, pm: pm, pointint: pointint, popf: popf, poun: poun, pound: pound, pr: pr, prE: prE, prap: prap, prcue: prcue, pre: pre, prec: prec, precapprox: precapprox, preccurlyeq: preccurlyeq, preceq: preceq, precnapprox: precnapprox, precneqq: precneqq, precnsim: precnsim, precsim: precsim, prime: prime, primes: primes, prnE: prnE, prnap: prnap, prnsim: prnsim, prod: prod, profalar: profalar, profline: profline, profsurf: profsurf, prop: prop, propto: propto, prsim: prsim, prurel: prurel, pscr: pscr, psi: psi, puncsp: puncsp, qfr: qfr, qint: qint, qopf: qopf, qprime: qprime, qscr: qscr, quaternions: quaternions, quatint: quatint, quest: quest, questeq: questeq, quo: quo, quot: quot, rAarr: rAarr, rArr: rArr, rAtail: rAtail, rBarr: rBarr, rHar: rHar, race: race, racute: racute, radic: radic, raemptyv: raemptyv, rang: rang, rangd: rangd, range: range, rangle: rangle, raqu: raqu, raquo: raquo, rarr: rarr, rarrap: rarrap, rarrb: rarrb, rarrbfs: rarrbfs, rarrc: rarrc, rarrfs: rarrfs, rarrhk: rarrhk, rarrlp: rarrlp, rarrpl: rarrpl, rarrsim: rarrsim, rarrtl: rarrtl, rarrw: rarrw, ratail: ratail, ratio: ratio, rationals: rationals, rbarr: rbarr, rbbrk: rbbrk, rbrace: rbrace, rbrack: rbrack, rbrke: rbrke, rbrksld: rbrksld, rbrkslu: rbrkslu, rcaron: rcaron, rcedil: rcedil, rceil: rceil, rcub: rcub, rcy: rcy, rdca: rdca, rdldhar: rdldhar, rdquo: rdquo, rdquor: rdquor, rdsh: rdsh, real: real, realine: realine, realpart: realpart, reals: reals, rect: rect, re: re, reg: reg, rfisht: rfisht, rfloor: rfloor, rfr: rfr, rhard: rhard, rharu: rharu, rharul: rharul, rho: rho, rhov: rhov, rightarrow: rightarrow, rightarrowtail: rightarrowtail, rightharpoondown: rightharpoondown, rightharpoonup: rightharpoonup, rightleftarrows: rightleftarrows, rightleftharpoons: rightleftharpoons, rightrightarrows: rightrightarrows, rightsquigarrow: rightsquigarrow, rightthreetimes: rightthreetimes, ring: ring, risingdotseq: risingdotseq, rlarr: rlarr, rlhar: rlhar, rlm: rlm, rmoust: rmoust, rmoustache: rmoustache, rnmid: rnmid, roang: roang, roarr: roarr, robrk: robrk, ropar: ropar, ropf: ropf, roplus: roplus, rotimes: rotimes, rpar: rpar, rpargt: rpargt, rppolint: rppolint, rrarr: rrarr, rsaquo: rsaquo, rscr: rscr, rsh: rsh, rsqb: rsqb, rsquo: rsquo, rsquor: rsquor, rthree: rthree, rtimes: rtimes, rtri: rtri, rtrie: rtrie, rtrif: rtrif, rtriltri: rtriltri, ruluhar: ruluhar, rx: rx, sacute: sacute, sbquo: sbquo, sc: sc, scE: scE, scap: scap, scaron: scaron, sccue: sccue, sce: sce, scedil: scedil, scirc: scirc, scnE: scnE, scnap: scnap, scnsim: scnsim, scpolint: scpolint, scsim: scsim, scy: scy, sdot: sdot, sdotb: sdotb, sdote: sdote, seArr: seArr, searhk: searhk, searr: searr, searrow: searrow, sec: sec, sect: sect, semi: semi, seswar: seswar, setminus: setminus, setmn: setmn, sext: sext, sfr: sfr, sfrown: sfrown, sharp: sharp, shchcy: shchcy, shcy: shcy, shortmid: shortmid, shortparallel: shortparallel, sh: sh, shy: shy, sigma: sigma, sigmaf: sigmaf, sigmav: sigmav, sim: sim, simdot: simdot, sime: sime, simeq: simeq, simg: simg, simgE: simgE, siml: siml, simlE: simlE, simne: simne, simplus: simplus, simrarr: simrarr, slarr: slarr, smallsetminus: smallsetminus, smashp: smashp, smeparsl: smeparsl, smid: smid, smile: smile, smt: smt, smte: smte, smtes: smtes, softcy: softcy, sol: sol, solb: solb, solbar: solbar, sopf: sopf, spades: spades, spadesuit: spadesuit, spar: spar, sqcap: sqcap, sqcaps: sqcaps, sqcup: sqcup, sqcups: sqcups, sqsub: sqsub, sqsube: sqsube, sqsubset: sqsubset, sqsubseteq: sqsubseteq, sqsup: sqsup, sqsupe: sqsupe, sqsupset: sqsupset, sqsupseteq: sqsupseteq, squ: squ, square: square, squarf: squarf, squf: squf, srarr: srarr, sscr: sscr, ssetmn: ssetmn, ssmile: ssmile, sstarf: sstarf, star: star, starf: starf, straightepsilon: straightepsilon, straightphi: straightphi, strns: strns, sub: sub, subE: subE, subdot: subdot, sube: sube, subedot: subedot, submult: submult, subnE: subnE, subne: subne, subplus: subplus, subrarr: subrarr, subset: subset, subseteq: subseteq, subseteqq: subseteqq, subsetneq: subsetneq, subsetneqq: subsetneqq, subsim: subsim, subsub: subsub, subsup: subsup, succ: succ, succapprox: succapprox, succcurlyeq: succcurlyeq, succeq: succeq, succnapprox: succnapprox, succneqq: succneqq, succnsim: succnsim, succsim: succsim, sum: sum, sung: sung, sup: sup, sup1: sup1, sup2: sup2, sup3: sup3, supE: supE, supdot: supdot, supdsub: supdsub, supe: supe, supedot: supedot, suphsol: suphsol, suphsub: suphsub, suplarr: suplarr, supmult: supmult, supnE: supnE, supne: supne, supplus: supplus, supset: supset, supseteq: supseteq, supseteqq: supseteqq, supsetneq: supsetneq, supsetneqq: supsetneqq, supsim: supsim, supsub: supsub, supsup: supsup, swArr: swArr, swarhk: swarhk, swarr: swarr, swarrow: swarrow, swnwar: swnwar, szli: szli, szlig: szlig, target: target, tau: tau, tbrk: tbrk, tcaron: tcaron, tcedil: tcedil, tcy: tcy, tdot: tdot, telrec: telrec, tfr: tfr, there4: there4, therefore: therefore, theta: theta, thetasym: thetasym, thetav: thetav, thickapprox: thickapprox, thicksim: thicksim, thinsp: thinsp, thkap: thkap, thksim: thksim, thor: thor, thorn: thorn, tilde: tilde, time: time, times: times, timesb: timesb, timesbar: timesbar, timesd: timesd, tint: tint, toea: toea, top: top, topbot: topbot, topcir: topcir, topf: topf, topfork: topfork, tosa: tosa, tprime: tprime, trade: trade, triangle: triangle, triangledown: triangledown, triangleleft: triangleleft, trianglelefteq: trianglelefteq, triangleq: triangleq, triangleright: triangleright, trianglerighteq: trianglerighteq, tridot: tridot, trie: trie, triminus: triminus, triplus: triplus, trisb: trisb, tritime: tritime, trpezium: trpezium, tscr: tscr, tscy: tscy, tshcy: tshcy, tstrok: tstrok, twixt: twixt, twoheadleftarrow: twoheadleftarrow, twoheadrightarrow: twoheadrightarrow, uArr: uArr, uHar: uHar, uacut: uacut, uacute: uacute, uarr: uarr, ubrcy: ubrcy, ubreve: ubreve, ucir: ucir, ucirc: ucirc, ucy: ucy, udarr: udarr, udblac: udblac, udhar: udhar, ufisht: ufisht, ufr: ufr, ugrav: ugrav, ugrave: ugrave, uharl: uharl, uharr: uharr, uhblk: uhblk, ulcorn: ulcorn, ulcorner: ulcorner, ulcrop: ulcrop, ultri: ultri, umacr: umacr, um: um, uml: uml, uogon: uogon, uopf: uopf, uparrow: uparrow, updownarrow: updownarrow, upharpoonleft: upharpoonleft, upharpoonright: upharpoonright, uplus: uplus, upsi: upsi, upsih: upsih, upsilon: upsilon, upuparrows: upuparrows, urcorn: urcorn, urcorner: urcorner, urcrop: urcrop, uring: uring, urtri: urtri, uscr: uscr, utdot: utdot, utilde: utilde, utri: utri, utrif: utrif, uuarr: uuarr, uum: uum, uuml: uuml, uwangle: uwangle, vArr: vArr, vBar: vBar, vBarv: vBarv, vDash: vDash, vangrt: vangrt, varepsilon: varepsilon, varkappa: varkappa, varnothing: varnothing, varphi: varphi, varpi: varpi, varpropto: varpropto, varr: varr, varrho: varrho, varsigma: varsigma, varsubsetneq: varsubsetneq, varsubsetneqq: varsubsetneqq, varsupsetneq: varsupsetneq, varsupsetneqq: varsupsetneqq, vartheta: vartheta, vartriangleleft: vartriangleleft, vartriangleright: vartriangleright, vcy: vcy, vdash: vdash, vee: vee, veebar: veebar, veeeq: veeeq, vellip: vellip, verbar: verbar, vert: vert, vfr: vfr, vltri: vltri, vnsub: vnsub, vnsup: vnsup, vopf: vopf, vprop: vprop, vrtri: vrtri, vscr: vscr, vsubnE: vsubnE, vsubne: vsubne, vsupnE: vsupnE, vsupne: vsupne, vzigzag: vzigzag, wcirc: wcirc, wedbar: wedbar, wedge: wedge, wedgeq: wedgeq, weierp: weierp, wfr: wfr, wopf: wopf, wp: wp, wr: wr, wreath: wreath, wscr: wscr, xcap: xcap, xcirc: xcirc, xcup: xcup, xdtri: xdtri, xfr: xfr, xhArr: xhArr, xharr: xharr, xi: xi, xlArr: xlArr, xlarr: xlarr, xmap: xmap, xnis: xnis, xodot: xodot, xopf: xopf, xoplus: xoplus, xotime: xotime, xrArr: xrArr, xrarr: xrarr, xscr: xscr, xsqcup: xsqcup, xuplus: xuplus, xutri: xutri, xvee: xvee, xwedge: xwedge, yacut: yacut, yacute: yacute, yacy: yacy, ycirc: ycirc, ycy: ycy, ye: ye, yen: yen, yfr: yfr, yicy: yicy, yopf: yopf, yscr: yscr, yucy: yucy, yum: yum, yuml: yuml, zacute: zacute, zcaron: zcaron, zcy: zcy, zdot: zdot, zeetrf: zeetrf, zeta: zeta, zfr: zfr, zhcy: zhcy, zigrarr: zigrarr, zopf: zopf, zscr: zscr, zwj: zwj, zwnj: zwnj }; var decodeEntity_1 = decodeEntity; var own$4 = {}.hasOwnProperty; function decodeEntity(characters) { return own$4.call(characterEntities, characters) ? characterEntities[characters] : false } var mdastUtilToString = toString$1; // Get the text content of a node. // Prefer the node’s plain-text fields, otherwise serialize its children, // and if the given value is an array, serialize the nodes in it. function toString$1(node) { return ( (node && (node.value || node.alt || node.title || ('children' in node && all(node.children)) || ('length' in node && all(node)))) || '' ) } function all(values) { var result = []; var length = values.length; var index = -1; while (++index < length) { result[index] = toString$1(values[index]); } return result.join('') } var normalizeIdentifier_1 = normalizeIdentifier; function normalizeIdentifier(value) { return ( value // Collapse Markdown whitespace. .replace(/[\t\n\r ]+/g, ' ') // Trim. .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase // counterpart is uppercased will result in a different uppercase // character. // Hence, to get that form, we perform both lower- and uppercase. // Upper case makes sure keys will not interact with default prototypal // methods: no object method is uppercase. .toLowerCase() .toUpperCase() ) } var safeFromInt_1 = safeFromInt; function safeFromInt(value, base) { var code = parseInt(value, base); if ( // C0 except for HT, LF, FF, CR, space code < 9 || code === 11 || (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. (code > 126 && code < 160) || // Lone high surrogates and low surrogates. (code > 55295 && code < 57344) || // Noncharacters. (code > 64975 && code < 65008) || (code & 65535) === 65535 || (code & 65535) === 65534 || // Out of range code > 1114111 ) { return '\uFFFD' } return fromCharCode(code) } var markdownLineEnding_1 = markdownLineEnding; function markdownLineEnding(code) { return code < -2 } var tokenize = initializeContent; function initializeContent(effects) { var contentStart = effects.attempt( this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial ); var previous; 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) { var token = effects.enter('chunkText', { contentType: 'text', previous: previous }); if (previous) { previous.next = token; } previous = token; return data(code) } function data(code) { if (code === null) { effects.exit('chunkText'); effects.exit('paragraph'); effects.consume(code); return } if (markdownLineEnding_1(code)) { effects.consume(code); effects.exit('chunkText'); return lineStart } // Data. effects.consume(code); return data } } var content = { tokenize: tokenize }; var tokenize$1 = tokenizeBlankLine; var partial = true; function tokenizeBlankLine(effects, ok, nok) { return factorySpace(effects, afterWhitespace, 'linePrefix') function afterWhitespace(code) { return code === null || markdownLineEnding_1(code) ? ok(code) : nok(code) } } var partialBlankLine = { tokenize: tokenize$1, partial: partial }; var tokenize$2 = initializeDocument; var container = {tokenize: tokenizeContainer}; var lazyFlow = {tokenize: tokenizeLazyFlow}; function initializeDocument(effects) { var self = this; var stack = []; var continued = 0; var inspectResult; var childFlow; var childToken; return start function start(code) { if (continued < stack.length) { self.containerState = stack[continued][1]; return effects.attempt( stack[continued][0].continuation, documentContinue, documentContinued )(code) } return documentContinued(code) } function documentContinue(code) { continued++; return start(code) } function documentContinued(code) { // If we’re in a concrete construct (such as when expecting another line of // HTML, or we resulted in lazy content), we can immediately start flow. if (inspectResult && inspectResult.flowContinue) { return flowStart(code) } self.interrupt = childFlow && childFlow.currentConstruct && childFlow.currentConstruct.interruptible; self.containerState = {}; return effects.attempt(container, containerContinue, flowStart)(code) } function containerContinue(code) { stack.push([self.currentConstruct, self.containerState]); self.containerState = undefined; return documentContinued(code) } function flowStart(code) { if (code === null) { exitContainers(0, true); 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) { continueFlow(effects.exit('chunkFlow')); return flowStart(code) } if (markdownLineEnding_1(code)) { effects.consume(code); continueFlow(effects.exit('chunkFlow')); return effects.check( {tokenize: tokenizeInspect, partial: true}, documentAfterPeek ) } effects.consume(code); return flowContinue } function documentAfterPeek(code) { exitContainers( inspectResult.continued, inspectResult && inspectResult.flowEnd ); continued = 0; return start(code) } function continueFlow(token) { if (childToken) childToken.next = token; childToken = token; childFlow.lazy = inspectResult && inspectResult.lazy; childFlow.defineSkip(token.start); childFlow.write(self.sliceStream(token)); } function exitContainers(size, end) { var index = stack.length; // Close the flow. if (childFlow && end) { childFlow.write([null]); childToken = childFlow = undefined; } // Exit open containers. while (index-- > size) { self.containerState = stack[index][1]; stack[index][0].exit.call(self, effects); } stack.length = size; } function tokenizeInspect(effects, ok) { var subcontinued = 0; inspectResult = {}; return inspectStart function inspectStart(code) { if (subcontinued < stack.length) { self.containerState = stack[subcontinued][1]; return effects.attempt( stack[subcontinued][0].continuation, inspectContinue, inspectLess )(code) } // If we’re continued but in a concrete flow, we can’t have more // containers. if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { inspectResult.flowContinue = true; return inspectDone(code) } self.interrupt = childFlow.currentConstruct && childFlow.currentConstruct.interruptible; self.containerState = {}; return effects.attempt(container, inspectFlowEnd, inspectDone)(code) } function inspectContinue(code) { subcontinued++; return self.containerState._closeFlow ? inspectFlowEnd(code) : inspectStart(code) } function inspectLess(code) { if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { // Maybe another container? self.containerState = {}; return effects.attempt( container, inspectFlowEnd, // Maybe flow, or a blank line? effects.attempt( lazyFlow, inspectFlowEnd, effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) ) )(code) } // Otherwise we’re interrupting. return inspectFlowEnd(code) } function inspectLazy(code) { // Act as if all containers are continued. subcontinued = stack.length; inspectResult.lazy = true; inspectResult.flowContinue = true; return inspectDone(code) } // We’re done with flow if we have more containers, or an interruption. function inspectFlowEnd(code) { inspectResult.flowEnd = true; return inspectDone(code) } function inspectDone(code) { inspectResult.continued = subcontinued; self.interrupt = self.containerState = undefined; return ok(code) } } } function tokenizeContainer(effects, ok, nok) { return factorySpace( effects, effects.attempt(this.parser.constructs.document, ok, nok), 'linePrefix', 4 ) } function tokenizeLazyFlow(effects, ok, nok) { return factorySpace( effects, effects.lazy(this.parser.constructs.flow, ok, nok), 'linePrefix', 4 ) } var document$1 = { tokenize: tokenize$2 }; var subtokenize_1 = subtokenize; function subtokenize(events) { var jumps = {}; var index = -1; var event; var lineIndex; var otherIndex; var otherEvent; var parameters; var subevents; var more; while (++index < events.length) { while (index in jumps) { index = jumps[index]; } event = events[index]; // Add a hook for the GFM tasklist extension, which needs to know if text // is in the first content of a list item. if ( index && event[1].type === 'chunkFlow' && events[index - 1][1].type === 'listItemPrefix' ) { subevents = event[1]._tokenizer.events; otherIndex = 0; if ( otherIndex < subevents.length && subevents[otherIndex][1].type === 'lineEndingBlank' ) { otherIndex += 2; } if ( otherIndex < subevents.length && subevents[otherIndex][1].type === 'content' ) { while (++otherIndex < subevents.length) { if (subevents[otherIndex][1].type === 'content') { break } if (subevents[otherIndex][1].type === 'chunkText') { subevents[otherIndex][1].isInFirstContentOfListItem = true; otherIndex++; } } } } // Enter. if (event[0] === 'enter') { if (event[1].contentType) { assign(jumps, subcontent(events, index)); index = jumps[index]; more = true; } } // Exit. else if (event[1]._container || event[1]._movePreviousLineEndings) { otherIndex = index; lineIndex = undefined; while (otherIndex--) { otherEvent = events[otherIndex]; if ( otherEvent[1].type === 'lineEnding' || otherEvent[1].type === 'lineEndingBlank' ) { if (otherEvent[0] === 'enter') { if (lineIndex) { events[lineIndex][1].type = 'lineEndingBlank'; } otherEvent[1].type = 'lineEnding'; lineIndex = otherIndex; } } else { break } } if (lineIndex) { // Fix position. event[1].end = shallow_1(events[lineIndex][1].start); // Switch container exit w/ line endings. parameters = events.slice(lineIndex, index); parameters.unshift(event); chunkedSplice_1(events, lineIndex, index - lineIndex + 1, parameters); } } } return !more } function subcontent(events, eventIndex) { var token = events[eventIndex][1]; var context = events[eventIndex][2]; var startPosition = eventIndex - 1; var startPositions = []; var tokenizer = token._tokenizer || context.parser[token.contentType](token.start); var childEvents = tokenizer.events; var jumps = []; var gaps = {}; var stream; var previous; var index; var entered; var end; var adjust; // Loop forward through the linked tokens to pass them in order to the // subtokenizer. while (token) { // Find the position of the event for this token. while (events[++startPosition][1] !== token) { // Empty. } startPositions.push(startPosition); if (!token._tokenizer) { stream = context.sliceStream(token); if (!token.next) { stream.push(null); } if (previous) { tokenizer.defineSkip(token.start); } if (token.isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = true; } tokenizer.write(stream); if (token.isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = undefined; } } // Unravel the next token. previous = token; token = token.next; } // Now, loop back through all events (and linked tokens), to figure out which // parts belong where. token = previous; index = childEvents.length; while (index--) { // Make sure we’ve at least seen something (final eol is part of the last // token). if (childEvents[index][0] === 'enter') { entered = true; } else if ( // Find a void token that includes a break. entered && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line ) { add(childEvents.slice(index + 1, end)); // Help GC. token._tokenizer = token.next = undefined; token = token.previous; end = index + 1; } } // Help GC. tokenizer.events = token._tokenizer = token.next = undefined; // Do head: add(childEvents.slice(0, end)); index = -1; adjust = 0; while (++index < jumps.length) { gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; adjust += jumps[index][1] - jumps[index][0] - 1; } return gaps function add(slice) { var start = startPositions.pop(); jumps.unshift([start, start + slice.length - 1]); chunkedSplice_1(events, start, 2, slice); } } var tokenize$3 = tokenizeContent; var resolve = resolveContent; var interruptible = true; var lazy = true; var lookaheadConstruct = {tokenize: tokenizeLookaheadConstruct, partial: true}; // Content is transparent: it’s parsed right now. That way, definitions are also // parsed right now: before text in paragraphs (specifically, media) are parsed. function resolveContent(events) { subtokenize_1(events); return events } function tokenizeContent(effects, ok) { var previous; return start function start(code) { effects.enter('content'); previous = effects.enter('chunkContent', { contentType: 'content' }); return data(code) } function data(code) { if (code === null) { return contentEnd(code) } if (markdownLineEnding_1(code)) { return effects.check( lookaheadConstruct, contentContinue, contentEnd )(code) } // Data. 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'); previous = previous.next = effects.enter('chunkContent', { contentType: 'content', previous: previous }); return data } } function tokenizeLookaheadConstruct(effects, ok, nok) { var self = this; return startLookahead function startLookahead(code) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return factorySpace(effects, prefixed, 'linePrefix') } function prefixed(code) { if (code === null || markdownLineEnding_1(code)) { return nok(code) } if (prefixSize_1(self.events, 'linePrefix') < 4) { return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) } return ok(code) } } var content$1 = { tokenize: tokenize$3, resolve: resolve, interruptible: interruptible, lazy: lazy }; var tokenize$4 = initializeFlow; function initializeFlow(effects) { var self = this; var initial = effects.attempt( // Try to parse a blank line. partialBlankLine, atBlankEnding, // Try to parse initial flow (essentially, only code). effects.attempt( this.parser.constructs.flowInitial, afterConstruct, factorySpace( effects, effects.attempt( this.parser.constructs.flow, afterConstruct, effects.attempt(content$1, 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 = undefined; return initial } function afterConstruct(code) { if (code === null) { effects.consume(code); return } effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); self.currentConstruct = undefined; return initial } } var flow$2 = { tokenize: tokenize$4 }; var text_1$1 = initializeFactory('text'); var string = initializeFactory('string'); var resolver_1 = {resolveAll: resolver()}; function initializeFactory(field) { return { tokenize: initializeText, resolveAll: resolver(field === 'text' ? resolveAllLineSuffixes : undefined) } function initializeText(effects) { var self = this; var constructs = this.parser.constructs[field]; var text = effects.attempt(constructs, start, notText); return start function start(code) { return atBreak(code) ? text(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 text(code) } // Data. effects.consume(code); return data } function atBreak(code) { var list = constructs[code]; var index = -1; if (code === null) { return true } if (list) { while (++index < list.length) { if ( !list[index].previous || list[index].previous.call(self, self.previous) ) { return true } } } } } } function resolver(extraResolver) { return resolveAllText function resolveAllText(events, context) { var index = -1; var enter; // A rather boring computation (to merge adjacent `data` events) which // improves mm performance by 29%. while (++index <= events.length) { if (enter === undefined) { if (events[index] && events[index][1].type === 'data') { enter = index; index++; } } else if (!events[index] || events[index][1].type !== 'data') { // Don’t do anything if there is one data token. if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end; events.splice(enter + 2, index - enter - 2); index = enter + 2; } enter = undefined; } } return extraResolver ? extraResolver(events, context) : events } } // A rather ugly set of instructions which again looks at chunks in the input // stream. // The reason to do this here is that it is *much* faster to parse in reverse. // And that we can’t hook into `null` to split the line suffix before an EOF. // To do: figure out if we can make this into a clean utility, or even in core. // As it will be useful for GFMs literal autolink extension (and maybe even // tables?) function resolveAllLineSuffixes(events, context) { var eventIndex = -1; var chunks; var data; var chunk; var index; var bufferIndex; var size; var tabs; var token; while (++eventIndex <= events.length) { if ( (eventIndex === events.length || events[eventIndex][1].type === 'lineEnding') && events[eventIndex - 1][1].type === 'data' ) { data = events[eventIndex - 1][1]; chunks = context.sliceStream(data); index = chunks.length; bufferIndex = -1; size = 0; tabs = undefined; while (index--) { chunk = chunks[index]; if (typeof chunk === 'string') { bufferIndex = chunk.length; while (chunk.charCodeAt(bufferIndex - 1) === 32) { size++; bufferIndex--; } if (bufferIndex) break bufferIndex = -1; } // Number else if (chunk === -2) { tabs = true; size++; } else if (chunk === -1) ; else { // Replacement character, exit. index++; break } } if (size) { 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: shallow_1(data.end) }; data.end = shallow_1(token.start); if (data.start.offset === data.end.offset) { assign(data, token); } else { events.splice( eventIndex, 0, ['enter', token, context], ['exit', token, context] ); eventIndex += 2; } } eventIndex++; } } return events } var text$2 = { text: text_1$1, string: string, resolver: resolver_1 }; var movePoint_1 = movePoint; // Note! `move` only works inside lines! It’s not possible to move past other // chunks (replacement characters, tabs, or line endings). function movePoint(point, offset) { point.column += offset; point.offset += offset; point._bufferIndex += offset; return point } var tokenize$5 = tokenizeAttention; var resolveAll_1$1 = resolveAllAttention; // Take all events and resolve attention to emphasis or strong. function resolveAllAttention(events, context) { var index = -1; var open; var group; var text; var openingSequence; var closingSequence; var use; var nextEvents; var offset; // Walk through all events. // // Note: performance of this is fine on an mb of normal markdown, but it’s // a bottleneck for malicious stuff. while (++index < events.length) { // Find a token that can close. if ( events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close ) { open = index; // Now walk back to find an opener. while (open--) { // Find a token that can open the closer. if ( events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open && // If the markers are the same: context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0) ) { // If the opening can close or the closing can open, // and the close size *is not* a multiple of three, // but the sum of the opening and closing size *is* multiple of three, // then don’t match. if ( (events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !( (events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3 ) ) { continue } // Number of markers to use from the sequence. use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; openingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start: movePoint_1(shallow_1(events[open][1].end), -use), end: shallow_1(events[open][1].end) }; closingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start: shallow_1(events[index][1].start), end: movePoint_1(shallow_1(events[index][1].start), use) }; text = { type: use > 1 ? 'strongText' : 'emphasisText', start: shallow_1(events[open][1].end), end: shallow_1(events[index][1].start) }; group = { type: use > 1 ? 'strong' : 'emphasis', start: shallow_1(openingSequence.start), end: shallow_1(closingSequence.end) }; events[open][1].end = shallow_1(openingSequence.start); events[index][1].start = shallow_1(closingSequence.end); nextEvents = []; // If there are more markers in the opening, add them before. if (events[open][1].end.offset - events[open][1].start.offset) { chunkedSplice_1(nextEvents, nextEvents.length, 0, [ ['enter', events[open][1], context], ['exit', events[open][1], context] ]); } // Opening. chunkedSplice_1(nextEvents, nextEvents.length, 0, [ ['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context] ]); // Between. chunkedSplice_1( nextEvents, nextEvents.length, 0, resolveAll_1( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) ); // Closing. chunkedSplice_1(nextEvents, nextEvents.length, 0, [ ['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context] ]); // If there are more markers in the closing, add them after. if (events[index][1].end.offset - events[index][1].start.offset) { offset = 2; chunkedSplice_1(nextEvents, nextEvents.length, 0, [ ['enter', events[index][1], context], ['exit', events[index][1], context] ]); } else { offset = 0; } chunkedSplice_1(events, open - 1, index - open + 3, nextEvents); index = open + nextEvents.length - offset - 2; break } } } } // Remove remaining sequences. index = -1; while (++index < events.length) { if (events[index][1].type === 'attentionSequence') { events[index][1].type = 'data'; } } return events } function tokenizeAttention(effects, ok) { var before = classifyCharacter_1(this.previous); var marker; return start function start(code) { effects.enter('attentionSequence'); marker = code; return sequence(code) } function sequence(code) { var token; var after; var open; var close; if (code === marker) { effects.consume(code); return sequence } token = effects.exit('attentionSequence'); after = classifyCharacter_1(code); open = !after || (after === 2 && before); close = !before || (before === 2 && after); token._open = marker === 42 ? open : open && (before || !close); token._close = marker === 42 ? close : close && (after || !open); return ok(code) } } var attention = { tokenize: tokenize$5, resolveAll: resolveAll_1$1 }; var tokenize$6 = tokenizeAtxHeading; var resolve$1 = resolveAtxHeading; function resolveAtxHeading(events, context) { var contentEnd = events.length - 2; var contentStart = 3; var content; var text; // Prefix whitespace, part of the opening. if (events[contentStart][1].type === 'whitespace') { contentStart += 2; } // Suffix whitespace, part of the closing. if ( contentEnd - 2 > contentStart && events[contentEnd][1].type === 'whitespace' ) { contentEnd -= 2; } if ( events[contentEnd][1].type === 'atxHeadingSequence' && (contentStart === contentEnd - 1 || (contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === 'whitespace')) ) { contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; } if (contentEnd > contentStart) { content = { type: 'atxHeadingText', start: events[contentStart][1].start, end: events[contentEnd][1].end }; text = { type: 'chunkText', start: events[contentStart][1].start, end: events[contentEnd][1].end, contentType: 'text' }; chunkedSplice_1(events, contentStart, contentEnd - contentStart + 1, [ ['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context] ]); } return events } function tokenizeAtxHeading(effects, ok, nok) { var self = this; var 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_1(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_1(code)) { effects.exit('atxHeading'); return ok(code) } if (markdownSpace_1(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_1(code)) { effects.exit('atxHeadingText'); return headingBreak(code) } effects.consume(code); return data } } var headingAtx = { tokenize: tokenize$6, resolve: resolve$1 }; var asciiAtext = regexCheck_1(/[#-'*+\--9=?A-Z^-~]/); var asciiControl_1 = asciiControl; // Note: EOF is seen as ASCII control here, because `null < 32 == true`. function asciiControl(code) { return ( // Special whitespace codes (which have negative values), C0 and Control // character DEL code < 32 || code === 127 ) } var tokenize$7 = tokenizeAutolink; function tokenizeAutolink(effects, ok, nok) { var size; 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); size = 1; 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 === 32 || code === 60 || asciiControl_1(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) { // Exit, then change the type. 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 autolink = { tokenize: tokenize$7 }; var asciiDigit = regexCheck_1(/\d/); var tokenize$8 = tokenizeThematicBreak; function tokenizeThematicBreak(effects, ok, nok) { var size = 0; var 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_1(code)) { return factorySpace(effects, atBreak, 'whitespace')(code) } if (size < 3 || (code !== null && !markdownLineEnding_1(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 thematicBreak = { tokenize: tokenize$8 }; var list = createCommonjsModule(function (module, exports) { exports.tokenize = tokenizeListStart; exports.continuation = {tokenize: tokenizeListContinuation}; exports.exit = tokenizeListEnd; function tokenizeListStart(effects, ok, nok) { var self = this; var initialSize = prefixSize_1(self.events, 'linePrefix'); var valueSize; return start function start(code) { if ( (code === 42 || code === 43 || code === 45) && (!self.containerState.marker || code === self.containerState.marker) ) { return code === 42 || code === 45 ? effects.check(thematicBreak, nok, unordered)(code) : unordered(code) } if ( asciiDigit(code) && (!self.containerState.type || self.containerState.type === 'listOrdered') ) { return ordered(code) } return nok(code) } function unordered(code) { if (!self.containerState.type) { self.containerState.type = 'listUnordered'; effects.enter(self.containerState.type, {_container: true}); } effects.enter('listItemPrefix'); return atMarker(code) } function ordered(code) { if (self.containerState.type || !self.interrupt || code === 49) { if (!self.containerState.type) { self.containerState.type = 'listOrdered'; effects.enter(self.containerState.type, {_container: true}); } effects.enter('listItemPrefix'); effects.enter('listItemValue'); effects.consume(code); valueSize = 1; return self.interrupt ? afterValue : inside } return nok(code) } function inside(code) { if (asciiDigit(code) && ++valueSize < 10) { effects.consume(code); return inside } return afterValue(code) } function afterValue(code) { effects.exit('listItemValue'); return code === 41 || code === 46 ? atMarker(code) : nok(code) } function atMarker(code) { self.containerState.marker = self.containerState.marker || code; if (code === self.containerState.marker) { effects.enter('listItemMarker'); effects.consume(code); effects.exit('listItemMarker'); return effects.check( partialBlankLine, // Can’t be empty when interrupting. self.interrupt ? nok : onBlank, effects.attempt( {tokenize: tokenizeListItemPrefixWhitespace, partial: true}, endOfPrefix, otherPrefix ) ) } return nok(code) } function onBlank(code) { self.containerState.initialBlankLine = true; initialSize++; return endOfPrefix(code) } function otherPrefix(code) { if (markdownSpace_1(code)) { effects.enter('listItemPrefixWhitespace'); effects.consume(code); effects.exit('listItemPrefixWhitespace'); return endOfPrefix } return nok(code) } function endOfPrefix(code) { self.containerState.size = initialSize + sizeChunks_1(self.sliceStream(effects.exit('listItemPrefix'))); return ok(code) } } function tokenizeListContinuation(effects, ok, nok) { var self = this; self.containerState._closeFlow = undefined; return effects.check(partialBlankLine, onBlank, notBlank) function onBlank(code) { self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; return ok(code) } function notBlank(code) { if (self.containerState.furtherBlankLines || !markdownSpace_1(code)) { self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; return notInCurrentItem(code) } self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; return effects.attempt( {tokenize: tokenizeIndent, partial: true}, ok, notInCurrentItem )(code) } function notInCurrentItem(code) { // While we do continue, we signal that the flow should be closed. self.containerState._closeFlow = true; // As we’re closing flow, we’re no longer interrupting self.interrupt = undefined; return factorySpace( effects, effects.attempt(exports, ok, nok), 'linePrefix', 4 )(code) } } function tokenizeIndent(effects, ok, nok) { var self = this; return factorySpace( effects, afterPrefix, 'listItemIndent', self.containerState.size + 1 ) function afterPrefix(code) { return prefixSize_1(self.events, 'listItemIndent') === self.containerState.size ? ok(code) : nok(code) } } function tokenizeListEnd(effects) { effects.exit(this.containerState.type); } function tokenizeListItemPrefixWhitespace(effects, ok, nok) { var self = this; return factorySpace( effects, afterPrefix, 'listItemPrefixWhitespace', 4 + 1 ) function afterPrefix(code) { return markdownSpace_1(code) || !prefixSize_1(self.events, 'listItemPrefixWhitespace') ? nok(code) : ok(code) } } }); var blockQuote = createCommonjsModule(function (module, exports) { exports.tokenize = tokenizeBlockQuoteStart; exports.continuation = {tokenize: tokenizeBlockQuoteContinuation}; exports.exit = exit; function tokenizeBlockQuoteStart(effects, ok, nok) { var self = this; return start function start(code) { if (code === 62) { if (!self.containerState.open) { effects.enter('blockQuote', {_container: true}); self.containerState.open = true; } effects.enter('blockQuotePrefix'); effects.enter('blockQuoteMarker'); effects.consume(code); effects.exit('blockQuoteMarker'); return after } return nok(code) } function after(code) { if (markdownSpace_1(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(exports, ok, nok), 'linePrefix', 4 ) } function exit(effects) { effects.exit('blockQuote'); } }); var asciiPunctuation = regexCheck_1(/[!-/:-@[-`{-~]/); var tokenize$9 = 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 characterEscape = { tokenize: tokenize$9 }; var asciiHexDigit = regexCheck_1(/[\dA-Fa-f]/); var tokenize$a = tokenizeCharacterReference; function tokenizeCharacterReference(effects, ok, nok) { var self = this; var size = 0; var max; var 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) { var token; if (code === 59 && size) { token = effects.exit('characterReferenceValue'); if (test === asciiAlphanumeric && !decodeEntity_1(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 characterReference = { tokenize: tokenize$a }; var tokenize$b = tokenizeCodeFenced; var concrete = true; function tokenizeCodeFenced(effects, ok, nok) { var self = this; var initialPrefix = prefixSize_1(this.events, 'linePrefix'); var sizeOpen = 0; var 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_1(code)) { return openAfter(code) } effects.enter('codeFencedFenceInfo'); effects.enter('chunkString', {contentType: 'string'}); return info(code) } function info(code) { if (code === null || markdownLineEndingOrSpace_1(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_1(code)) { return openAfter(code) } effects.enter('codeFencedFenceMeta'); effects.enter('chunkString', {contentType: 'string'}); return meta(code) } function meta(code) { if (code === null || markdownLineEnding_1(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) : content(code) } function content(code) { if (code === null) { return after(code) } if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return effects.attempt( {tokenize: tokenizeClosingFence, partial: true}, after, initialPrefix ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) : content ) } effects.enter('codeFlowValue'); return contentContinue(code) } function contentContinue(code) { if (code === null || markdownLineEnding_1(code)) { effects.exit('codeFlowValue'); return content(code) } effects.consume(code); return contentContinue } function after(code) { effects.exit('codeFenced'); return ok(code) } function tokenizeClosingFence(effects, ok, nok) { var size = 0; return factorySpace(effects, closingPrefixAfter, 'linePrefix', 4) function closingPrefixAfter(code) { effects.enter('codeFencedFence'); effects.enter('codeFencedFenceSequence'); return closingSequence(code) } function closingSequence(code) { if (code === marker) { effects.consume(code); size++; return closingSequence } if (size < sizeOpen) return nok(code) effects.exit('codeFencedFenceSequence'); return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) } function closingSequenceEnd(code) { if (code === null || markdownLineEnding_1(code)) { effects.exit('codeFencedFence'); return ok(code) } return nok(code) } } } var codeFenced = { tokenize: tokenize$b, concrete: concrete }; var tokenize$c = tokenizeCodeIndented; var resolve$2 = resolveCodeIndented; var continuedIndent = {tokenize: tokenizeContinuedIndent, partial: true}; function resolveCodeIndented(events, context) { var code = { type: 'codeIndented', start: events[0][1].start, end: events[events.length - 1][1].end }; chunkedSplice_1(events, 0, 0, [['enter', code, context]]); chunkedSplice_1(events, events.length, 0, [['exit', code, context]]); return events } function tokenizeCodeIndented(effects, ok, nok) { var self = this; return factorySpace( effects, afterInitial, 'linePrefix', 4 + 1 ) function afterInitial(code) { // Flow checks blank lines first, so we don’t have EOL/EOF. if (prefixSize_1(self.events, 'linePrefix') < 4) { return nok(code) } effects.enter('codeFlowValue'); return content(code) } function afterPrefix(code) { if (code === null) { return ok(code) } if (markdownLineEnding_1(code)) { return effects.attempt(continuedIndent, afterPrefix, ok)(code) } effects.enter('codeFlowValue'); return content(code) } function content(code) { if (code === null || markdownLineEnding_1(code)) { effects.exit('codeFlowValue'); return afterPrefix(code) } effects.consume(code); return content } } function tokenizeContinuedIndent(effects, ok, nok) { var self = this; return factorySpace( effects, afterPrefix, 'linePrefix', 4 + 1 ) function afterPrefix(code) { if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return factorySpace( effects, afterPrefix, 'linePrefix', 4 + 1 ) } return prefixSize_1(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) } } var codeIndented = { tokenize: tokenize$c, resolve: resolve$2 }; var tokenize$d = tokenizeCodeText; var resolve$3 = resolveCodeText; var previous_1 = previous$1; function resolveCodeText(events) { var tailExitIndex = events.length - 4; var headEnterIndex = 3; var index; var enter; // If we start and end with an EOL or a space. if ( (events[headEnterIndex][1].type === 'lineEnding' || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === 'lineEnding' || events[tailExitIndex][1].type === 'space') ) { index = headEnterIndex; // And we have data. while (++index < tailExitIndex) { if (events[index][1].type === 'codeTextData') { // Then we have padding. events[tailExitIndex][1].type = events[headEnterIndex][1].type = 'codeTextPadding'; headEnterIndex += 2; tailExitIndex -= 2; break } } } // Merge adjacent spaces and data. index = headEnterIndex - 1; tailExitIndex++; while (++index <= tailExitIndex) { if (enter === undefined) { if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { enter = index; } } else if ( index === tailExitIndex || events[index][1].type === 'lineEnding' ) { events[enter][1].type = 'codeTextData'; if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end; events.splice(enter + 2, index - enter - 2); tailExitIndex -= index - enter - 2; index = enter + 2; } enter = undefined; } } return events } function previous$1(code) { // If there is a previous code, there will always be a tail. return ( code !== 96 || this.events[this.events.length - 1][1].type === 'characterEscape' ) } function tokenizeCodeText(effects, ok, nok) { var sizeOpen = 0; var size; var 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) { // EOF. if (code === null) { return nok(code) } // Closing fence? // Could also be data. if (code === 96) { token = effects.enter('codeTextSequence'); size = 0; return closingSequence(code) } // Tabs don’t work, and virtual spaces don’t make sense. if (code === 32) { effects.enter('space'); effects.consume(code); effects.exit('space'); return gap } if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return gap } // Data. effects.enter('codeTextData'); return data(code) } // In code. function data(code) { if ( code === null || code === 32 || code === 96 || markdownLineEnding_1(code) ) { effects.exit('codeTextData'); return gap(code) } effects.consume(code); return data } // Closing fence. function closingSequence(code) { // More. if (code === 96) { effects.consume(code); size++; return closingSequence } // Done! if (size === sizeOpen) { effects.exit('codeTextSequence'); effects.exit('codeText'); return ok(code) } // More or less accents: mark as data. token.type = 'codeTextData'; return data(code) } } var codeText = { tokenize: tokenize$d, resolve: resolve$3, previous: previous_1 }; var factoryDestination = createDestination; // eslint-disable-next-line max-params function createDestination( effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max ) { var limit = max || Infinity; var 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 (asciiControl_1(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_1(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_1(code)) { if (balance) return nok(code) effects.exit('chunkString'); effects.exit(stringType); effects.exit(rawType); effects.exit(type); return ok(code) } if (asciiControl_1(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) } } var factoryLabel = createLabel; // eslint-disable-next-line max-params function createLabel(effects, ok, nok, type, markerType, stringType) { var self = this; var size = 0; var 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) || /* istanbul ignore next - footnotes. */ (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_1(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_1(code) || size++ > 999 ) { effects.exit('chunkString'); return atBreak(code) } effects.consume(code); data = data || !markdownSpace_1(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) } } var factoryWhitespace = createWhitespace; function createWhitespace(effects, ok) { var seen; return start function start(code) { if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); seen = true; return start } if (markdownSpace_1(code)) { return factorySpace( effects, start, seen ? 'linePrefix' : 'lineSuffix' )(code) } return ok(code) } } var factoryTitle = createTitle; // eslint-disable-next-line max-params function createTitle(effects, ok, nok, type, markerType, stringType) { var 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) } // Note: blank lines can’t exist in content. if (markdownLineEnding_1(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_1(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) } } var tokenize$e = tokenizeDefinition; function tokenizeDefinition(effects, ok, nok) { var self = this; var destinationAfter = effects.attempt( {tokenize: tokenizeTitle, partial: true}, factorySpace(effects, after, 'whitespace'), factorySpace(effects, after, 'whitespace') ); var 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_1( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ); if (code === 58) { effects.enter('definitionMarker'); effects.consume(code); effects.exit('definitionMarker'); // Note: blank lines can’t exist in content. return factoryWhitespace( effects, factoryDestination( effects, destinationAfter, nok, 'definitionDestination', 'definitionDestinationLiteral', 'definitionDestinationLiteralMarker', 'definitionDestinationRaw', 'definitionDestinationString' ) ) } return nok(code) } function after(code) { if (code === null || markdownLineEnding_1(code)) { effects.exit('definition'); if (self.parser.defined.indexOf(identifier) < 0) { self.parser.defined.push(identifier); } return ok(code) } return nok(code) } } function tokenizeTitle(effects, ok, nok) { return start function start(code) { return markdownLineEndingOrSpace_1(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_1(code) ? ok(code) : nok(code) } } var definition = { tokenize: tokenize$e }; var tokenize$f = 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_1(code)) { effects.exit('escapeMarker'); effects.exit('hardBreakEscape'); return ok(code) } return nok(code) } } var hardBreakEscape = { tokenize: tokenize$f }; // This module is copied from . 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', 'source', 'summary', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul' ]; // This module is copied from . var htmlRawNames = ['pre', 'script', 'style']; var tokenize$g = tokenizeHtml; var resolveTo = resolveToHtml; var concrete$1 = true; var nextBlank = {tokenize: tokenizeNextBlank, partial: true}; function resolveToHtml(events) { var index = events.length; while (index--) { if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { break } } if (index > 1 && events[index - 2][1].type === 'linePrefix') { // Add the prefix start to the HTML token. events[index][1].start = events[index - 2][1].start; // Add the prefix start to the HTML line token. events[index + 1][1].start = events[index - 2][1].start; // Remove the line prefix. events.splice(index - 2, 2); } return events } function tokenizeHtml(effects, ok, nok) { var self = this; var kind; var startTag; var buffer; var index; var 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; // While we’re in an instruction instead of a declaration, we’re on a `?` // right now, so we do need to search for `>`, similar to declarations. return self.interrupt ? ok : continuationDeclarationInside } if (asciiAlpha(code)) { effects.consume(code); buffer = 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 = fromCharCode(code); return tagName } return nok(code) } function tagName(code) { if ( code === null || code === 47 || code === 62 || markdownLineEndingOrSpace_1(code) ) { if (code !== 47 && startTag && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { kind = 1; return self.interrupt ? ok(code) : continuation(code) } if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { kind = 6; if (code === 47) { effects.consume(code); return basicSelfClosing } return self.interrupt ? ok(code) : continuation(code) } kind = 7; // Do not support complete HTML when interrupting. return self.interrupt ? nok(code) : startTag ? completeAttributeNameBefore(code) : completeClosingTagAfter(code) } if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); buffer += 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_1(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_1(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_1(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_1(code)) { effects.consume(code); return completeAttributeValueBefore } marker = undefined; return completeAttributeValueUnquoted(code) } function completeAttributeValueQuoted(code) { if (code === marker) { effects.consume(code); return completeAttributeValueQuotedAfter } if (code === null || markdownLineEnding_1(code)) { return nok(code) } effects.consume(code); return completeAttributeValueQuoted } function completeAttributeValueUnquoted(code) { if ( code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace_1(code) ) { return completeAttributeNameAfter(code) } effects.consume(code); return completeAttributeValueUnquoted } function completeAttributeValueQuotedAfter(code) { if (code === 47 || code === 62 || markdownSpace_1(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_1(code)) { effects.consume(code); return completeAfter } return code === null || markdownLineEnding_1(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_1(code) && (kind === 6 || kind === 7)) { return effects.check( nextBlank, continuationClose, continuationAtLineEnding )(code) } if (code === null || markdownLineEnding_1(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_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return htmlContinueStart } effects.enter('htmlFlowData'); return continuation(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.indexOf(buffer.toLowerCase()) > -1) { effects.consume(code); return continuationClose } if (asciiAlpha(code) && buffer.length < 6) { effects.consume(code); buffer += 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 } return continuation(code) } function continuationClose(code) { if (code === null || markdownLineEnding_1(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(partialBlankLine, ok, nok) } } var htmlFlow = { tokenize: tokenize$g, resolveTo: resolveTo, concrete: concrete$1 }; var tokenize$h = tokenizeHtml$1; function tokenizeHtml$1(effects, ok, nok) { var marker; var buffer; var index; var 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_1(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 } 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_1(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_1(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_1(code)) { returnState = tagCloseBetween; return atLineEnding(code) } if (markdownSpace_1(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_1(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_1(code)) { returnState = tagOpenBetween; return atLineEnding(code) } if (markdownSpace_1(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_1(code)) { returnState = tagOpenAttributeNameAfter; return atLineEnding(code) } if (markdownSpace_1(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_1(code)) { returnState = tagOpenAttributeValueBefore; return atLineEnding(code) } if (markdownSpace_1(code)) { effects.consume(code); return tagOpenAttributeValueBefore } effects.consume(code); marker = undefined; return tagOpenAttributeValueUnquoted } function tagOpenAttributeValueQuoted(code) { if (code === marker) { effects.consume(code); return tagOpenAttributeValueQuotedAfter } if (code === null) { return nok(code) } if (markdownLineEnding_1(code)) { returnState = tagOpenAttributeValueQuoted; return atLineEnding(code) } effects.consume(code); return tagOpenAttributeValueQuoted } function tagOpenAttributeValueQuotedAfter(code) { if (code === 62 || code === 47 || markdownLineEndingOrSpace_1(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_1(code)) { return tagOpenBetween(code) } effects.consume(code); return tagOpenAttributeValueUnquoted } // We can’t have blank lines in content, so no need to worry about empty // tokens. function atLineEnding(code) { effects.exit('htmlTextData'); effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return factorySpace(effects, afterPrefix, 'linePrefix', 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 htmlText = { tokenize: tokenize$h }; var tokenize$i = tokenizeLabelEnd; var resolveTo$1 = resolveToLabelEnd; var resolveAll_1$2 = resolveAllLabelEnd; var resource = {tokenize: tokenizeResource}; var fullReference = {tokenize: tokenizeFullReference}; var collapsedReference = {tokenize: tokenizeCollapsedReference}; function resolveAllLabelEnd(events) { var index = -1; var token; while (++index < events.length) { token = events[index][1]; if ( !token._used && (token.type === 'labelImage' || token.type === 'labelLink' || token.type === 'labelEnd') ) { // Remove the marker. events.splice(index + 1, token.type === 'labelImage' ? 4 : 2); token.type = 'data'; index++; } } return events } function resolveToLabelEnd(events, context) { var index = events.length; var offset = 0; var group; var label; var text; var token; var open; var close; var media; // Find an opening. while (index--) { token = events[index][1]; if (open) { // If we see another link, or inactive link label, we’ve been here before. if ( token.type === 'link' || (token.type === 'labelLink' && token._inactive) ) { break } // Mark other link openings as inactive, as we can’t have links in // links. if (events[index][0] === 'enter' && token.type === 'labelLink') { token._inactive = true; } } else if (close) { if ( events[index][0] === 'enter' && (token.type === 'labelImage' || token.type === 'labelLink') && !token._balanced ) { open = index; if (token.type !== 'labelLink') { offset = 2; break } } } else if (token.type === 'labelEnd') { close = index; } } group = { type: events[open][1].type === 'labelLink' ? 'link' : 'image', start: shallow_1(events[open][1].start), end: shallow_1(events[events.length - 1][1].end) }; label = { type: 'label', start: shallow_1(events[open][1].start), end: shallow_1(events[close][1].end) }; text = { type: 'labelText', start: shallow_1(events[open + offset + 2][1].end), end: shallow_1(events[close - 2][1].start) }; media = [ ['enter', group, context], ['enter', label, context] ]; // Opening marker. chunkedSplice_1( media, media.length, 0, events.slice(open + 1, open + offset + 3) ); // Text open. chunkedSplice_1(media, media.length, 0, [['enter', text, context]]); // Between. chunkedSplice_1( media, media.length, 0, resolveAll_1( context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context ) ); // Text close, marker close, label close. chunkedSplice_1(media, media.length, 0, [ ['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context] ]); // Reference, resource, or so. chunkedSplice_1(media, media.length, 0, events.slice(close + 1)); // Media close. chunkedSplice_1(media, media.length, 0, [['exit', group, context]]); chunkedSplice_1(events, open, events.length, media); return events } function tokenizeLabelEnd(effects, ok, nok) { var self = this; var index = self.events.length; var labelStart; var defined; // Find an opening. while (index--) { if ( (self.events[index][1].type === 'labelImage' || self.events[index][1].type === 'labelLink') && !self.events[index][1]._balanced ) { labelStart = self.events[index][1]; break } } return start function start(code) { if (!labelStart) { return nok(code) } // It’s a balanced bracket, but contains a link. if (labelStart._inactive) return balanced(code) defined = self.parser.defined.indexOf( normalizeIdentifier_1( self.sliceSerialize({start: labelStart.end, end: self.now()}) ) ) > -1; effects.enter('labelEnd'); effects.enter('labelMarker'); effects.consume(code); effects.exit('labelMarker'); effects.exit('labelEnd'); return afterLabelEnd } function afterLabelEnd(code) { // Resource: `[asd](fgh)`. if (code === 40) { return effects.attempt(resource, ok, defined ? ok : balanced)(code) } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? if (code === 91) { return effects.attempt( fullReference, ok, defined ? effects.attempt(collapsedReference, ok, balanced) : balanced )(code) } // Shortcut reference: `[asd]`? 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', 3 )(code) } function destinationAfter(code) { return markdownLineEndingOrSpace_1(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) { var 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.indexOf( normalizeIdentifier_1( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) ) < 0 ? nok(code) : ok(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 labelEnd = { tokenize: tokenize$i, resolveTo: resolveTo$1, resolveAll: resolveAll_1$2 }; var tokenize$j = tokenizelabelImage; var resolveAll$1 = labelEnd.resolveAll; function tokenizelabelImage(effects, ok, nok) { var 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) { /* istanbul ignore next - footnotes. */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } var labelStartImage = { tokenize: tokenize$j, resolveAll: resolveAll$1 }; var tokenize$k = tokenizelabelLink; var resolveAll$2 = labelEnd.resolveAll; function tokenizelabelLink(effects, ok, nok) { var 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) { /* istanbul ignore next - footnotes. */ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code) } } var labelStartLink = { tokenize: tokenize$k, resolveAll: resolveAll$2 }; var tokenize$l = tokenizeSetextUnderline; var resolveTo$2 = resolveToSetextUnderline; function resolveToSetextUnderline(events, context) { var index = events.length; var content; var text; var definition; var heading; // Find the opening of the content. // It’ll always exist: we don’t tokenize if it isn’t there. while (index--) { if (events[index][0] === 'enter') { if (events[index][1].type === 'content') { content = index; break } if (events[index][1].type === 'paragraph') { text = index; } } // Exit else { if (events[index][1].type === 'content') { // Remove the content end (if needed we’ll add it later) events.splice(index, 1); } if (!definition && events[index][1].type === 'definition') { definition = index; } } } heading = { type: 'setextHeading', start: shallow_1(events[text][1].start), end: shallow_1(events[events.length - 1][1].end) }; // Change the paragraph to setext heading text. events[text][1].type = 'setextHeadingText'; // If we have definitions in the content, we’ll keep on having content, // but we need move it. if (definition) { events.splice(text, 0, ['enter', heading, context]); events.splice(definition + 1, 0, ['exit', events[content][1], context]); events[content][1].end = shallow_1(events[definition][1].end); } else { events[content][1] = heading; } // Add the heading exit at the end. events.push(['exit', heading, context]); return events } function tokenizeSetextUnderline(effects, ok, nok) { var self = this; var index = self.events.length; var marker; var paragraph; // Find an opening. while (index--) { // Skip enter/exit of line ending, line prefix, and content. // We can now either have a definition or a paragraph. if ( self.events[index][1].type !== 'lineEnding' && self.events[index][1].type !== 'linePrefix' && self.events[index][1].type !== 'content' ) { paragraph = self.events[index][1].type === 'paragraph'; break } } return start function start(code) { if (!self.lazy && (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_1(code)) { effects.exit('setextHeadingLine'); return ok(code) } return nok(code) } } var setextUnderline = { tokenize: tokenize$l, resolveTo: resolveTo$2 }; var tokenize$m = tokenizeWhitespace; function tokenizeWhitespace(effects, ok) { return start function start(code) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return factorySpace(effects, ok, 'linePrefix') } } var lineEnding = { tokenize: tokenize$m }; var resolveText = text$2.resolver; var document$2 = { 42: list, // Asterisk 43: list, // Plus sign 45: list, // Dash 48: list, // 0 49: list, // 1 50: list, // 2 51: list, // 3 52: list, // 4 53: list, // 5 54: list, // 6 55: list, // 7 56: list, // 8 57: list, // 9 62: blockQuote // Greater than }; var contentInitial = { 91: definition // Left square bracket }; var flowInitial = { '-2': codeIndented, // Horizontal tab '-1': codeIndented, // Virtual space 32: codeIndented // Space }; var flow$3 = { 35: headingAtx, // Number sign 42: thematicBreak, // Asterisk 45: [setextUnderline, thematicBreak], // Dash 60: htmlFlow, // Less than 61: setextUnderline, // Equals to 95: thematicBreak, // Underscore 96: codeFenced, // Grave accent 126: codeFenced // Tilde }; var string$1 = { 38: characterReference, // Ampersand 92: characterEscape // Backslash }; var text$3 = { '-5': lineEnding, // Carriage return '-4': lineEnding, // Line feed '-3': lineEnding, // Carriage return + line feed 33: labelStartImage, // Exclamation mark 38: characterReference, // Ampersand 42: attention, // Asterisk 60: [autolink, htmlText], // Less than 91: labelStartLink, // Left square bracket 92: [hardBreakEscape, characterEscape], // Backslash 93: labelEnd, // Right square bracket 95: attention, // Underscore 96: codeText // Grave accent }; var insideSpan = { null: [attention, resolveText] }; var constructs$1 = { document: document$2, contentInitial: contentInitial, flowInitial: flowInitial, flow: flow$3, string: string$1, text: text$3, insideSpan: insideSpan }; var serializeChunks_1 = serializeChunks; function serializeChunks(chunks) { var index = -1; var result = []; var chunk; var value; var atTab; while (++index < chunks.length) { chunk = chunks[index]; if (typeof chunk === 'string') { value = chunk; } else if (chunk === -5) { value = '\r'; } else if (chunk === -4) { value = '\n'; } else if (chunk === -3) { value = '\r' + '\n'; } else if (chunk === -2) { value = '\t'; } else if (chunk === -1) { if (atTab) continue value = ' '; } else { // Currently only replacement character. value = fromCharCode(chunk); } atTab = chunk === -2; result.push(value); } return result.join('') } var sliceChunks_1 = sliceChunks; function sliceChunks(chunks, token) { var startIndex = token.start._index; var startBufferIndex = token.start._bufferIndex; var endIndex = token.end._index; var endBufferIndex = token.end._bufferIndex; var 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 } var createTokenizer_1 = createTokenizer; // Create a tokenizer. // Tokenizers deal with one type of data (e.g., containers, flow, text). // The parser is the object dealing with it all. // `initialize` works like other constructs, except that only its `tokenize` // function is used, in which case it doesn’t receive an `ok` or `nok`. // `from` can be given to set the point before the first character, although // when further lines are indented, they must be set with `defineSkip`. function createTokenizer(parser, initialize, from) { var point = from ? shallow_1(from) : {line: 1, column: 1, offset: 0}; var columnStart = {}; var resolveAllConstructs = []; var chunks = []; var stack = []; // Tools used for tokenizing. var effects = { consume: consume, enter: enter, exit: exit, attempt: constructFactory(onsuccessfulconstruct), check: constructFactory(onsuccessfulcheck), interrupt: constructFactory(onsuccessfulcheck, {interrupt: true}), lazy: constructFactory(onsuccessfulcheck, {lazy: true}) }; // State and tools for resolving and serializing. var context = { previous: null, events: [], parser: parser, sliceStream: sliceStream, sliceSerialize: sliceSerialize, now: now, defineSkip: skip, write: write }; // The state function. var state = initialize.tokenize.call(context, effects); if (initialize.resolveAll) { resolveAllConstructs.push(initialize); } // Store where we are in the input stream. point._index = 0; point._bufferIndex = -1; return context function write(slice) { chunkedSplice_1(chunks, chunks.length, 0, slice); main(); // Exit if we’re not done, resolve might change stuff. if (chunks[chunks.length - 1] !== null) { return [] } addResult(initialize, 0); // Otherwise, resolve, and exit. context.events = resolveAll_1(resolveAllConstructs, context.events, context); return context.events } // // Tools. // function sliceSerialize(token) { return serializeChunks_1(sliceStream(token)) } function sliceStream(token) { return sliceChunks_1(chunks, token) } function now() { return shallow_1(point) } function skip(value) { columnStart[value.line] = value.column; accountForPotentialSkip(); } // // State management. // // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by // `consume`). // Here is where we walk through the chunks, which either include strings of // several characters, or numerical character codes. // The reason to do this in a loop instead of a call is so the stack can // drain. function main() { var chunkIndex; var chunk; while (point._index < chunks.length) { chunk = chunks[point._index]; // If we’re in a buffer chunk, loop through it. if (typeof chunk === 'string') { chunkIndex = point._index; if (point._bufferIndex < 0) { point._bufferIndex = 0; } while ( point._index === chunkIndex && point._bufferIndex < chunk.length ) { go(chunk.charCodeAt(point._bufferIndex)); } } else { go(chunk); } } } // Deal with one code. function go(code) { state = state(code); } // Move a character forward. function consume(code) { if (markdownLineEnding_1(code)) { point.line++; point.column = 1; point.offset += code === -3 ? 2 : 1; accountForPotentialSkip(); } else if (code !== -1) { point.column++; point.offset++; } // Not in a string chunk. if (point._bufferIndex < 0) { point._index++; } else { point._bufferIndex++; // At end of string chunk. if (point._bufferIndex === chunks[point._index].length) { point._bufferIndex = -1; point._index++; } } // Expose the previous character. context.previous = code; } // Start a token. function enter(type, fields) { var token = fields || {}; token.type = type; token.start = now(); context.events.push(['enter', token, context]); stack.push(token); return token } // Stop a token. function exit(type) { var token = stack.pop(); token.end = now(); context.events.push(['exit', token, context]); return token } // Use results. function onsuccessfulconstruct(construct, info) { addResult(construct, info.from); } // Discard results. function onsuccessfulcheck(construct, info) { info.restore(); } // Factory to attempt/check/interrupt. function constructFactory(onreturn, fields) { return hook // Handle either an object mapping codes to constructs, a list of // constructs, or a single construct. function hook(constructs, returnState, bogusState) { var listOfConstructs; var constructIndex; var currentConstruct; var info; return constructs.tokenize || 'length' in constructs ? handleListOfConstructs(miniflat_1(constructs)) : handleMapOfConstructs function handleMapOfConstructs(code) { if (code in constructs || null in constructs) { return handleListOfConstructs( /* istanbul ignore next - `null` is used by some extensions */ constructs.null ? miniflat_1(constructs[code]).concat(miniflat_1(constructs.null)) : constructs[code] )(code) } return bogusState(code) } function handleListOfConstructs(list) { listOfConstructs = list; constructIndex = 0; return handleConstruct(list[constructIndex]) } function handleConstruct(construct) { return start function start(code) { // To do: not nede to store if there is no bogus state, probably? // Currently doesn’t work because `inspect` in document does a check // w/o a bogus, which doesn’t make sense. But it does seem to help perf // by not storing. info = store(); currentConstruct = construct; if (!construct.partial) { context.currentConstruct = construct; } return construct.tokenize.call( fields ? assign({}, context, fields) : context, effects, ok, nok )(code) } } function ok(code) { onreturn(currentConstruct, info); return returnState } function nok(code) { info.restore(); if (++constructIndex < listOfConstructs.length) { return handleConstruct(listOfConstructs[constructIndex]) } return bogusState } } } function addResult(construct, from) { if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { resolveAllConstructs.push(construct); } if (construct.resolve) { chunkedSplice_1( context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context) ); } if (construct.resolveTo) { context.events = construct.resolveTo(context.events, context); } } function store() { var startPoint = now(); var startPrevious = context.previous; var startCurrentConstruct = context.currentConstruct; var startEventsIndex = context.events.length; var startStack = Array.from(stack); return {restore: 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; } } } var parse$1 = createParser; function createParser(options) { var settings = options || {}; var parser = { defined: [], constructs: combineExtensions_1( [constructs$1].concat(miniflat_1(settings.extensions)) ), content: create(content), document: create(document$1), flow: create(flow$2), string: create(text$2.string), text: create(text$2.text) }; return parser function create(initializer) { return creator function creator(from) { return createTokenizer_1(parser, initializer, from) } } } var preprocess = preprocessor; var search = /[\0\t\n\r]/g; function preprocessor() { var start = true; var column = 1; var buffer = ''; var atCarriageReturn; return preprocess function preprocess(value, encoding, end) { var chunks = []; var match; var next; var startPosition; var endPosition; var code; value = buffer + value.toString(encoding); startPosition = 0; buffer = ''; if (start) { if (value.charCodeAt(0) === 65279) { startPosition++; } start = undefined; } while (startPosition < value.length) { search.lastIndex = startPosition; match = search.exec(value); endPosition = match ? match.index : value.length; code = value.charCodeAt(endPosition); if (!match) { buffer = value.slice(startPosition); break } if (code === 10 && startPosition === endPosition && atCarriageReturn) { chunks.push(-3); atCarriageReturn = undefined; } else { if (atCarriageReturn) { chunks.push(-5); atCarriageReturn = undefined; } if (startPosition < endPosition) { chunks.push(value.slice(startPosition, endPosition)); column += endPosition - startPosition; } if (code === 0) { chunks.push(65533); column++; } else if (code === 9) { next = Math.ceil(column / 4) * 4; chunks.push(-2); while (column++ < next) chunks.push(-1); } else if (code === 10) { chunks.push(-4); column = 1; } // Must be carriage return. else { 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 postprocess_1 = postprocess; function postprocess(events) { while (!subtokenize_1(events)) { // Empty } return events } var dist = fromMarkdown$5; // These three are compiled away in the `dist/` function fromMarkdown$5(value, encoding, options) { if (typeof encoding !== 'string') { options = encoding; encoding = undefined; } return compiler(options)( postprocess_1( parse$1(options).document().write(preprocess()(value, encoding, true)) ) ) } // Note this compiler only understand complete buffering, not streaming. function compiler(options) { var settings = options || {}; var config = configure$1( { canContainEols: [ 'emphasis', 'fragment', 'heading', 'paragraph', 'strong' ], enter: { autolink: opener(link), autolinkProtocol: onenterdata, autolinkEmail: onenterdata, atxHeading: opener(heading), blockQuote: opener(blockQuote), characterEscape: onenterdata, characterReference: onenterdata, codeFenced: opener(codeFlow), codeFencedFenceInfo: buffer, codeFencedFenceMeta: buffer, codeIndented: opener(codeFlow, buffer), codeText: opener(codeText, buffer), codeTextData: onenterdata, data: onenterdata, codeFlowValue: onenterdata, definition: opener(definition), definitionDestinationString: buffer, definitionLabelString: buffer, definitionTitleString: buffer, emphasis: opener(emphasis), hardBreakEscape: opener(hardBreak), hardBreakTrailing: opener(hardBreak), htmlFlow: opener(html, buffer), htmlFlowData: onenterdata, htmlText: opener(html, buffer), htmlTextData: onenterdata, image: opener(image), label: buffer, link: opener(link), listItem: opener(listItem), listItemValue: onenterlistitemvalue, listOrdered: opener(list, onenterlistordered), listUnordered: opener(list), paragraph: opener(paragraph), reference: onenterreference, referenceString: buffer, resourceDestinationString: buffer, resourceTitleString: buffer, setextHeading: opener(heading), strong: opener(strong), thematicBreak: opener(thematicBreak) }, exit: { atxHeading: closer(), atxHeadingSequence: onexitatxheadingsequence, autolink: closer(), autolinkEmail: onexitautolinkemail, autolinkProtocol: onexitautolinkprotocol, blockQuote: closer(), characterEscapeValue: onexitdata, characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, characterReferenceMarkerNumeric: onexitcharacterreferencemarker, characterReferenceValue: closer(onexitcharacterreferencevalue), codeFenced: closer(onexitcodefenced), codeFencedFence: onexitcodefencedfence, codeFencedFenceInfo: onexitcodefencedfenceinfo, codeFencedFenceMeta: onexitcodefencedfencemeta, codeFlowValue: onexitdata, codeIndented: closer(onexitcodeindented), codeText: closer(onexitcodetext), codeTextData: onexitdata, data: onexitdata, definition: closer(), definitionDestinationString: onexitdefinitiondestinationstring, definitionLabelString: onexitdefinitionlabelstring, definitionTitleString: onexitdefinitiontitlestring, emphasis: closer(), hardBreakEscape: closer(onexithardbreak), hardBreakTrailing: closer(onexithardbreak), htmlFlow: closer(onexithtmlflow), htmlFlowData: onexitdata, htmlText: closer(onexithtmltext), htmlTextData: onexitdata, image: closer(onexitimage), label: onexitlabel, labelText: onexitlabeltext, lineEnding: onexitlineending, link: closer(onexitlink), listItem: closer(), listOrdered: closer(), listUnordered: closer(), paragraph: closer(), referenceString: onexitreferencestring, resourceDestinationString: onexitresourcedestinationstring, resourceTitleString: onexitresourcetitlestring, resource: onexitresource, setextHeading: closer(onexitsetextheading), setextHeadingLineSequence: onexitsetextheadinglinesequence, setextHeadingText: onexitsetextheadingtext, strong: closer(), thematicBreak: closer() } }, settings.mdastExtensions || [] ); var data = {}; return compile function compile(events) { var stack = [{type: 'root', children: []}]; var index = -1; var listStack = []; var length; var handler; var listStart; var event; while (++index < events.length) { event = events[index]; // We preprocess lists to add `listItem` tokens, and to infer whether // items the list itself are spread out. if ( event[1].type === 'listOrdered' || event[1].type === 'listUnordered' ) { if (event[0] === 'enter') { listStack.push(index); } else { listStart = listStack.pop(index); index = prepareList(events, listStart, index); } } } index = -1; length = events.length; while (++index < length) { handler = config[events[index][0]]; if (hasOwnProperty_1.call(handler, events[index][1].type)) { handler[events[index][1].type].call( { stack: stack, config: config, enter: enter, exit: exit, buffer: buffer, resume: resume, sliceSerialize: events[index][2].sliceSerialize, setData: setData, getData: getData }, events[index][1] ); } } // Figure out `root` position. stack[0].position = { start: point( length ? events[0][1].start : {line: 1, column: 1, offset: 0} ), end: point( length ? events[events.length - 2][1].end : {line: 1, column: 1, offset: 0} ) }; return stack[0] } function prepareList(events, start, length) { var index = start - 1; var containerBalance = -1; var listSpread = false; var listItem; var tailIndex; var lineIndex; var tailEvent; var event; var firstBlankLineIndex; var atMarker; while (++index <= length) { event = events[index]; if ( event[1].type === 'listUnordered' || event[1].type === 'listOrdered' || event[1].type === 'blockQuote' ) { if (event[0] === 'enter') { containerBalance++; } else { containerBalance--; } atMarker = undefined; } else if (event[1].type === 'lineEndingBlank') { if (event[0] === 'enter') { if ( listItem && !atMarker && !containerBalance && !firstBlankLineIndex ) { firstBlankLineIndex = index; } atMarker = undefined; } } else if ( event[1].type === 'linePrefix' || event[1].type === 'listItemValue' || event[1].type === 'listItemMarker' || event[1].type === 'listItemPrefix' || event[1].type === 'listItemPrefixWhitespace' ) ; else { atMarker = undefined; } if ( (!containerBalance && event[0] === 'enter' && event[1].type === 'listItemPrefix') || (containerBalance === -1 && event[0] === 'exit' && (event[1].type === 'listUnordered' || event[1].type === 'listOrdered')) ) { if (listItem) { tailIndex = index; lineIndex = undefined; while (tailIndex--) { tailEvent = events[tailIndex]; if ( tailEvent[1].type === 'lineEnding' || tailEvent[1].type === 'lineEndingBlank' ) { if (tailEvent[0] === 'exit') continue if (lineIndex) { events[lineIndex][1].type = 'lineEndingBlank'; listSpread = true; } tailEvent[1].type = 'lineEnding'; lineIndex = tailIndex; } else if ( tailEvent[1].type === 'linePrefix' || tailEvent[1].type === 'blockQuotePrefix' || tailEvent[1].type === 'blockQuotePrefixWhitespace' || tailEvent[1].type === 'blockQuoteMarker' || tailEvent[1].type === 'listItemIndent' ) ; else { break } } if ( firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex) ) { listItem._spread = true; } // Fix position. listItem.end = point( lineIndex ? events[lineIndex][1].start : event[1].end ); events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]); index++; length++; } // Create a new list item. if (event[1].type === 'listItemPrefix') { listItem = { type: 'listItem', _spread: false, start: point(event[1].start) }; events.splice(index, 0, ['enter', listItem, event[2]]); index++; length++; firstBlankLineIndex = undefined; atMarker = true; } } } events[start][1]._spread = listSpread; return length } function setData(key, value) { data[key] = value; } function getData(key) { return data[key] } function point(d) { return {line: d.line, column: d.column, offset: d.offset} } function opener(create, and) { return open function open(token) { enter.call(this, create(token), token); if (and) and.call(this, token); } } function buffer() { this.stack.push({type: 'fragment', children: []}); } function enter(node, token) { this.stack[this.stack.length - 1].children.push(node); this.stack.push(node); node.position = {start: point(token.start)}; return node } function closer(and) { return close function close(token) { if (and) and.call(this, token); exit.call(this, token); } } function exit(token) { var node = this.stack.pop(); node.position.end = point(token.end); return node } function resume() { var value = mdastUtilToString(this.stack.pop()); return value } // // Handlers. // function onenterlistordered() { setData('expectingFirstListItemValue', true); } function onenterlistitemvalue(token) { if (getData('expectingFirstListItemValue')) { this.stack[this.stack.length - 2].start = parseInt( this.sliceSerialize(token), 10 ); setData('expectingFirstListItemValue'); } } function onexitcodefencedfenceinfo() { var data = this.resume(); this.stack[this.stack.length - 1].lang = data; } function onexitcodefencedfencemeta() { var data = this.resume(); this.stack[this.stack.length - 1].meta = data; } function onexitcodefencedfence() { // Exit if this is the closing fence. if (getData('flowCodeInside')) return this.buffer(); setData('flowCodeInside', true); } function onexitcodefenced() { var data = this.resume(); this.stack[this.stack.length - 1].value = data.replace( /^(\r?\n|\r)|(\r?\n|\r)$/g, '' ); setData('flowCodeInside'); } function onexitcodeindented() { var data = this.resume(); this.stack[this.stack.length - 1].value = data; } function onexitdefinitionlabelstring(token) { // Discard label, use the source content instead. var label = this.resume(); this.stack[this.stack.length - 1].label = label; this.stack[this.stack.length - 1].identifier = normalizeIdentifier_1( this.sliceSerialize(token) ).toLowerCase(); } function onexitdefinitiontitlestring() { var data = this.resume(); this.stack[this.stack.length - 1].title = data; } function onexitdefinitiondestinationstring() { var data = this.resume(); this.stack[this.stack.length - 1].url = data; } function onexitatxheadingsequence(token) { if (!this.stack[this.stack.length - 1].depth) { this.stack[this.stack.length - 1].depth = this.sliceSerialize( token ).length; } } function onexitsetextheadingtext() { setData('setextHeadingSlurpLineEnding', true); } function onexitsetextheadinglinesequence(token) { this.stack[this.stack.length - 1].depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; } function onexitsetextheading() { setData('setextHeadingSlurpLineEnding'); } function onenterdata(token) { var siblings = this.stack[this.stack.length - 1].children; var tail = siblings[siblings.length - 1]; if (!tail || tail.type !== 'text') { // Add a new text node. tail = text(); tail.position = {start: point(token.start)}; this.stack[this.stack.length - 1].children.push(tail); } this.stack.push(tail); } function onexitdata(token) { var tail = this.stack.pop(); tail.value += this.sliceSerialize(token); tail.position.end = point(token.end); } function onexitlineending(token) { var context = this.stack[this.stack.length - 1]; // If we’re at a hard break, include the line ending in there. if (getData('atHardBreak')) { context.children[context.children.length - 1].position.end = point( token.end ); setData('atHardBreak'); return } if (getData('setextHeadingSlurpLineEnding')) { return } if (config.canContainEols.indexOf(context.type) !== -1) { onenterdata.call(this, token); onexitdata.call(this, token); } } function onexithardbreak() { setData('atHardBreak', true); } function onexithtmlflow() { var data = this.resume(); this.stack[this.stack.length - 1].value = data; } function onexithtmltext() { var data = this.resume(); this.stack[this.stack.length - 1].value = data; } function onexitcodetext() { var data = this.resume(); this.stack[this.stack.length - 1].value = data; } function onexitlink() { var context = this.stack[this.stack.length - 1]; // To do: clean. if (getData('inReference')) { context.type += 'Reference'; context.referenceType = getData('referenceType') || 'shortcut'; delete context.url; delete context.title; } else { delete context.identifier; delete context.label; delete context.referenceType; } setData('referenceType'); } function onexitimage() { var context = this.stack[this.stack.length - 1]; // To do: clean. if (getData('inReference')) { context.type += 'Reference'; context.referenceType = getData('referenceType') || 'shortcut'; delete context.url; delete context.title; } else { delete context.identifier; delete context.label; delete context.referenceType; } setData('referenceType'); } function onexitlabeltext(token) { this.stack[this.stack.length - 2].identifier = normalizeIdentifier_1( this.sliceSerialize(token) ).toLowerCase(); } function onexitlabel() { var fragment = this.stack[this.stack.length - 1]; var value = this.resume(); this.stack[this.stack.length - 1].label = value; // Assume a reference. setData('inReference', true); if (this.stack[this.stack.length - 1].type === 'link') { this.stack[this.stack.length - 1].children = fragment.children; } else { this.stack[this.stack.length - 1].alt = value; } } function onexitresourcedestinationstring() { var data = this.resume(); this.stack[this.stack.length - 1].url = data; } function onexitresourcetitlestring() { var data = this.resume(); this.stack[this.stack.length - 1].title = data; } function onexitresource() { setData('inReference'); } function onenterreference() { setData('referenceType', 'collapsed'); } function onexitreferencestring(token) { var label = this.resume(); this.stack[this.stack.length - 1].label = label; this.stack[this.stack.length - 1].identifier = normalizeIdentifier_1( this.sliceSerialize(token) ).toLowerCase(); setData('referenceType', 'full'); } function onexitcharacterreferencemarker(token) { setData('characterReferenceType', token.type); } function onexitcharacterreferencevalue(token) { var data = this.sliceSerialize(token); var type = getData('characterReferenceType'); var value; if (type) { value = safeFromInt_1( data, type === 'characterReferenceMarkerNumeric' ? 10 : 16 ); setData('characterReferenceType'); } else { value = decodeEntity_1(data); } this.stack[this.stack.length - 1].value += value; } function onexitautolinkprotocol(token) { onexitdata.call(this, token); this.stack[this.stack.length - 1].url = this.sliceSerialize(token); } function onexitautolinkemail(token) { onexitdata.call(this, token); this.stack[this.stack.length - 1].url = 'mailto:' + this.sliceSerialize(token); } // // Creaters. // function blockQuote() { return {type: 'blockquote', children: []} } function codeFlow() { return {type: 'code', lang: null, meta: null, value: ''} } function codeText() { return {type: 'inlineCode', value: ''} } function definition() { return { type: 'definition', identifier: '', label: null, title: null, url: '' } } function emphasis() { return {type: 'emphasis', children: []} } function heading() { return {type: 'heading', depth: undefined, children: []} } function hardBreak() { return {type: 'break'} } function html() { return {type: 'html', value: ''} } function image() { return {type: 'image', title: null, url: '', alt: null} } function link() { return {type: 'link', title: null, url: '', children: []} } function list(token) { return { type: 'list', ordered: token.type === 'listOrdered', start: null, spread: token._spread, children: [] } } function listItem(token) { return { type: 'listItem', spread: token._spread, checked: null, children: [] } } function paragraph() { return {type: 'paragraph', children: []} } function strong() { return {type: 'strong', children: []} } function text() { return {type: 'text', value: ''} } function thematicBreak() { return {type: 'thematicBreak'} } } function configure$1(config, extensions) { var length = extensions.length; var index = -1; while (++index < length) { extension$2(config, extensions[index]); } return config } function extension$2(config, extension) { var key; var left; var right; for (key in extension) { left = hasOwnProperty_1.call(config, key) ? config[key] : (config[key] = {}); right = extension[key]; if (key === 'canContainEols') { config[key] = [].concat(left, right); } else { Object.assign(left, right); } } } var mdastUtilFromMarkdown = dist; var remarkParse = parse$2; function parse$2(options) { var self = this; this.Parser = parse; function parse(doc) { return mdastUtilFromMarkdown( doc, Object.assign({}, self.data('settings'), options, { // Note: these options are not in the readme. // The goal is for them to be set by plugins on `data` instead of being // passed by users. extensions: self.data('micromarkExtensions') || [], mdastExtensions: self.data('fromMarkdownExtensions') || [] }) ) } } /** * Expose `isUrl`. */ var isUrl_1 = isUrl; /** * RegExps. * A URL must match #1 and then at least one of #2/#3. * Use two levels of REs to avoid REDOS. */ var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; var localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/; var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/; /** * Loosely validate a URL `string`. * * @param {String} string * @return {Boolean} */ function isUrl(string){ if (typeof string !== 'string') { return false; } var match = string.match(protocolAndDomainRE); if (!match) { return false; } var everythingAfterProtocol = match[1]; if (!everythingAfterProtocol) { return false; } if (localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol)) { return true; } return false; } var convert_1 = convert; function convert(test) { if (test == null) { return ok } if (typeof test === 'string') { return typeFactory(test) } if (typeof test === 'object') { return 'length' in test ? anyFactory(test) : allFactory(test) } if (typeof test === 'function') { return test } throw new Error('Expected function, string, or object as test') } // Utility assert each property in `test` is represented in `node`, and each // values are strictly equal. function allFactory(test) { return all function all(node) { var key; for (key in test) { if (node[key] !== test[key]) return } return true } } function anyFactory(tests) { var checks = []; var index = -1; while (++index < tests.length) { checks[index] = convert(tests[index]); } return any function any() { var index = -1; while (++index < checks.length) { if (checks[index].apply(this, arguments)) { return true } } } } // Utility to convert a string into a function which checks a given node’s type // for said string. function typeFactory(test) { return type function type(node) { return node && node.type === test } } // Utility to return true. function ok() { return true } var color_1 = color; function color(d) { return '\u001B[33m' + d + '\u001B[39m' } var unistUtilVisitParents = visitParents; var CONTINUE = true; var SKIP = 'skip'; var EXIT = false; visitParents.CONTINUE = CONTINUE; visitParents.SKIP = SKIP; visitParents.EXIT = EXIT; function visitParents(tree, test, visitor, reverse) { var step; var is; if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor; visitor = test; test = null; } is = convert_1(test); step = reverse ? -1 : 1; factory(tree, null, [])(); function factory(node, index, parents) { var value = typeof node === 'object' && node !== null ? node : {}; var name; if (typeof value.type === 'string') { name = typeof value.tagName === 'string' ? value.tagName : typeof value.name === 'string' ? value.name : undefined; visit.displayName = 'node (' + color_1(value.type + (name ? '<' + name + '>' : '')) + ')'; } return visit function visit() { var grandparents = parents.concat(node); var result = []; var subresult; var offset; if (!test || is(node, index, parents[parents.length - 1] || null)) { result = toResult(visitor(node, parents)); if (result[0] === EXIT) { return result } } if (node.children && result[0] !== SKIP) { offset = (reverse ? node.children.length : -1) + step; while (offset > -1 && offset < node.children.length) { subresult = factory(node.children[offset], offset, grandparents)(); if (subresult[0] === EXIT) { return subresult } offset = typeof subresult[1] === 'number' ? subresult[1] : offset + step; } } return result } } } function toResult(value) { if (value !== null && typeof value === 'object' && 'length' in value) { return value } if (typeof value === 'number') { return [CONTINUE, value] } return [value] } const isImgExt = (value) => /\.(svg|png|jpg|jpeg|gif)$/.test(value); const isAbsolutePath = (value) => value.startsWith('/'); const isRelativePath = (value) => value.startsWith('./') || value.startsWith('../'); const isImgPath = (value) => isAbsolutePath(value) || isRelativePath(value); const isInteractive = convert_1(['link', 'linkReference']); var remarkImages = images; function images() { return transform } function transform(tree) { unistUtilVisitParents(tree, 'text', ontext); } function ontext(node, parents) { const value = String(node.value).trim(); if ((isUrl_1(value) || isImgPath(value)) && isImgExt(value)) { let interactive = false; let length = parents.length; const siblings = parents[length - 1].children; // Check if we’re in interactive content. while (length--) { if (isInteractive(parents[length])) { interactive = true; break } } let next = { type: 'image', url: value, title: null, alt: null, position: node.position }; // Add a link if we’re not already in one. if (!interactive) { next = { type: 'link', url: value, title: null, children: [next], position: node.position }; } siblings[siblings.indexOf(node)] = next; } } var format = createCommonjsModule(function (module) { (function() { //// Export the API var namespace; // CommonJS / Node module { namespace = module.exports = format; } namespace.format = format; namespace.vsprintf = vsprintf; if (typeof console !== 'undefined' && typeof console.log === 'function') { namespace.printf = printf; } function printf(/* ... */) { console.log(format.apply(null, arguments)); } function vsprintf(fmt, replacements) { return format.apply(null, [fmt].concat(replacements)); } function format(fmt) { var argIndex = 1 // skip initial format argument , args = [].slice.call(arguments) , i = 0 , n = fmt.length , result = '' , c , escaped = false , arg , tmp , leadingZero = false , precision , nextArg = function() { return args[argIndex++]; } , slurpNumber = function() { var digits = ''; while (/\d/.test(fmt[i])) { digits += fmt[i++]; c = fmt[i]; } return digits.length > 0 ? parseInt(digits) : null; } ; for (; i < n; ++i) { c = fmt[i]; if (escaped) { escaped = false; if (c == '.') { leadingZero = false; c = fmt[++i]; } else if (c == '0' && fmt[i + 1] == '.') { leadingZero = true; i += 2; c = fmt[i]; } else { leadingZero = true; } precision = slurpNumber(); switch (c) { case 'b': // number in binary result += parseInt(nextArg(), 10).toString(2); break; case 'c': // character arg = nextArg(); if (typeof arg === 'string' || arg instanceof String) result += arg; else result += String.fromCharCode(parseInt(arg, 10)); break; case 'd': // number in decimal result += parseInt(nextArg(), 10); break; case 'f': // floating point number tmp = String(parseFloat(nextArg()).toFixed(precision || 6)); result += leadingZero ? tmp : tmp.replace(/^0/, ''); break; case 'j': // JSON result += JSON.stringify(nextArg()); break; case 'o': // number in octal result += '0' + parseInt(nextArg(), 10).toString(8); break; case 's': // string result += nextArg(); break; case 'x': // lowercase hexadecimal result += '0x' + parseInt(nextArg(), 10).toString(16); break; case 'X': // uppercase hexadecimal result += '0x' + parseInt(nextArg(), 10).toString(16).toUpperCase(); break; default: result += c; break; } } else if (c === '%') { escaped = true; } else { result += c; } } return result; } }()); }); var fault = create$2(Error); var fault_1 = fault; fault.eval = create$2(EvalError); fault.range = create$2(RangeError); fault.reference = create$2(ReferenceError); fault.syntax = create$2(SyntaxError); fault.type = create$2(TypeError); fault.uri = create$2(URIError); fault.create = create$2; // Create a new `EConstructor`, with the formatted `format` as a first argument. function create$2(EConstructor) { FormattedError.displayName = EConstructor.displayName || EConstructor.name; return FormattedError function FormattedError(format$1) { if (format$1) { format$1 = format.apply(null, arguments); } return new EConstructor(format$1) } } var matters_1 = matters; var own$5 = {}.hasOwnProperty; var markers = {yaml: '-', toml: '+'}; function matters(options) { var settings = options || 'yaml'; var results = []; var index = -1; var length; // One preset or matter. if (typeof settings === 'string' || !('length' in settings)) { settings = [settings]; } length = settings.length; while (++index < length) { results[index] = matter(settings[index]); } return results } function matter(option) { var result = option; if (typeof result === 'string') { if (!own$5.call(markers, result)) { throw fault_1('Missing matter definition for `%s`', result) } result = {type: result, marker: markers[result]}; } else if (typeof result !== 'object') { throw fault_1('Expected matter to be an object, not `%j`', result) } if (!own$5.call(result, 'type')) { throw fault_1('Missing `type` in matter `%j`', result) } if (!own$5.call(result, 'fence') && !own$5.call(result, 'marker')) { throw fault_1('Missing `marker` or `fence` in matter `%j`', result) } return result } var syntax$4 = create$3; function create$3(options) { var settings = matters_1(options); var length = settings.length; var index = -1; var flow = {}; var matter; var code; while (++index < length) { matter = settings[index]; code = fence(matter, 'open').charCodeAt(0); if (code in flow) { flow[code].push(parse$3(matter)); } else { flow[code] = [parse$3(matter)]; } } return {flow: flow} } function parse$3(matter) { var name = matter.type; var anywhere = matter.anywhere; var valueType = name + 'Value'; var fenceType = name + 'Fence'; var sequenceType = fenceType + 'Sequence'; var fenceConstruct = {tokenize: tokenizeFence, partial: true}; var buffer; return {tokenize: tokenizeFrontmatter, concrete: true} function tokenizeFrontmatter(effects, ok, nok) { var self = this; return start function start(code) { var position = self.now(); if (position.column !== 1 || (!anywhere && position.line !== 1)) { return nok(code) } effects.enter(name); buffer = fence(matter, 'open'); return effects.attempt(fenceConstruct, afterOpeningFence, nok)(code) } function afterOpeningFence(code) { buffer = fence(matter, 'close'); return lineEnd(code) } function lineStart(code) { if (code === -5 || code === -4 || code === -3 || code === null) { return lineEnd(code) } effects.enter(valueType); return lineData(code) } function lineData(code) { if (code === -5 || code === -4 || code === -3 || code === null) { effects.exit(valueType); return lineEnd(code) } effects.consume(code); return lineData } function lineEnd(code) { // Require a closing fence. if (code === null) { return nok(code) } // Can only be an eol. effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return effects.attempt(fenceConstruct, after, lineStart) } function after(code) { effects.exit(name); return ok(code) } } function tokenizeFence(effects, ok, nok) { var bufferIndex = 0; return start function start(code) { if (code === buffer.charCodeAt(bufferIndex)) { effects.enter(fenceType); effects.enter(sequenceType); return insideSequence(code) } return nok(code) } function insideSequence(code) { if (bufferIndex === buffer.length) { effects.exit(sequenceType); if (code === -2 || code === -1 || code === 32) { effects.enter('whitespace'); return insideWhitespace(code) } return fenceEnd(code) } if (code === buffer.charCodeAt(bufferIndex)) { effects.consume(code); bufferIndex++; return insideSequence } return nok(code) } function insideWhitespace(code) { if (code === -2 || code === -1 || code === 32) { effects.consume(code); return insideWhitespace } effects.exit('whitespace'); return fenceEnd(code) } function fenceEnd(code) { if (code === -5 || code === -4 || code === -3 || code === null) { effects.exit(fenceType); return ok(code) } return nok(code) } } } function fence(matter, prop) { var marker; if (matter.marker) { marker = pick(matter.marker, prop); return marker + marker + marker } return pick(matter.fence, prop) } function pick(schema, prop) { return typeof schema === 'string' ? schema : schema[prop] } var micromarkExtensionFrontmatter = syntax$4; var fromMarkdown$6 = createFromMarkdown; function createFromMarkdown(options) { var settings = matters_1(options); var length = settings.length; var index = -1; var enter = {}; var exit = {}; var matter; while (++index < length) { matter = settings[index]; enter[matter.type] = opener(matter); exit[matter.type] = close; exit[matter.type + 'Value'] = value; } return {enter: enter, exit: exit} } function opener(matter) { return open function open(token) { this.enter({type: matter.type, value: ''}, token); this.buffer(); } } function close(token) { var data = this.resume(); // Remove the initial and final eol. this.exit(token).value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ''); } function value(token) { this.config.enter.data.call(this, token); this.config.exit.data.call(this, token); } var toMarkdown$5 = createToMarkdown; function createToMarkdown(options) { var unsafe = []; var handlers = {}; var settings = matters_1(options); var length = settings.length; var index = -1; var matter; while (++index < length) { matter = settings[index]; handlers[matter.type] = handler(matter); unsafe.push({atBreak: true, character: fence$1(matter, 'open').charAt(0)}); } return {unsafe: unsafe, handlers: handlers} } function handler(matter) { var open = fence$1(matter, 'open'); var close = fence$1(matter, 'close'); return handle function handle(node) { return open + (node.value ? '\n' + node.value : '') + '\n' + close } } function fence$1(matter, prop) { var marker; if (matter.marker) { marker = pick$1(matter.marker, prop); return marker + marker + marker } return pick$1(matter.fence, prop) } function pick$1(schema, prop) { return typeof schema === 'string' ? schema : schema[prop] } var remarkFrontmatter = frontmatter; function frontmatter(options) { var data = this.data(); add('micromarkExtensions', micromarkExtensionFrontmatter(options)); add('fromMarkdownExtensions', fromMarkdown$6(options)); add('toMarkdownExtensions', toMarkdown$5(options)); function add(field, value) { /* istanbul ignore if - other extensions. */ if (data[field]) data[field].push(value); else data[field] = [value]; } } const {NEW_HEADER_TEMPLATE: NEW_HEADER_TEMPLATE$1} = constants; const template$1 = new template(); /** * Returns the transformer which acts on the MDAST tree and given VFile. * * @link https://github.com/unifiedjs/unified#function-transformernode-file-next * @link https://github.com/syntax-tree/mdast * @link https://github.com/vfile/vfile * @return {function} */ function metadataWriter({ createHeaderIfNotPresent = false, newHeaderTemplate = NEW_HEADER_TEMPLATE$1, updateHeader = false, currentMoment = moment(), } = {}) { return function transformer(ast, vFile, next) { let metadataNode = getMetadataNode(ast); let hasMetadata = !(metadataNode == null); // If we don't have a Matter node in the AST, put it in. if (!hasMetadata && createHeaderIfNotPresent) { metadataNode = { type: 'yaml', value: jsYaml$1.dump(getFreshProperties(newHeaderTemplate, currentMoment)), }; ast.children.unshift(metadataNode); hasMetadata = true; } if (updateHeader && hasMetadata) { // Write metadata (by reference) metadataNode.value = updatedValue(metadataNode.value, getFreshProperties(newHeaderTemplate, currentMoment)); } if (typeof next === 'function') { return next(null, ast, vFile); } return ast; }; } function getFreshProperties(newHeaderTemplate, moment) { return jsYaml$1.load(String(template$1.replace(newHeaderTemplate, moment))); } function getMetadataNode(ast, types = ['yaml', 'toml']) { return ast.children.find(node => types.includes(node.type)); } function updatedValue(value, meta) { let fm = jsYaml$1.load(value); if (fm) { Object.assign(fm, meta); } else { fm = meta; } // stringify return jsYaml$1.dump(fm); // eslint-disable-line no-param-reassign } var tableWriter = metadataWriter; var zwitch = factory; var noop = Function.prototype; var own$6 = {}.hasOwnProperty; // Handle values based on a property. function factory(key, options) { var settings = options || {}; function one(value) { var fn = one.invalid; var handlers = one.handlers; if (value && own$6.call(value, key)) { fn = own$6.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; } return (fn || noop).apply(this, arguments) } one.handlers = settings.handlers || {}; one.invalid = settings.invalid; one.unknown = settings.unknown; return one } var containerFlow$1 = flow$4; function flow$4(parent, context) { var children = parent.children || []; var results = []; var index = -1; var child; while (++index < children.length) { child = children[index]; results.push( context.handle(child, parent, context, {before: '\n', after: '\n'}) ); if (index + 1 < children.length) { results.push(between(child, children[index + 1])); } } return results.join('') function between(left, right) { var index = -1; var result; while (++index < context.join.length) { result = context.join[index](left, right, parent, context); if (result === true || result === 1) { break } if (typeof result === 'number') { return repeatString('\n', 1 + Number(result)) } /** * The injection of the comment */ if (result === false) { return '\n' // return '\n\n\n\n' } } return '\n\n' } } var indentLines_1$1 = indentLines$1; var eol$1 = /\r?\n|\r/g; function indentLines$1(value, map) { var result = []; var start = 0; var line = 0; var match; while ((match = eol$1.exec(value))) { one(value.slice(start, match.index)); result.push(match[0]); start = match.index + match[0].length; line++; } one(value.slice(start)); return result.join('') function one(value) { result.push(map(value, line, !value)); } } var blockquote_1 = blockquote; function blockquote(node, _, context) { var exit = context.enter('blockquote'); var value = indentLines_1$1(containerFlow$1(node, context), map$2); exit(); return value } function map$2(line, index, blank) { return '>' + (blank ? '' : ' ') + line } var _break = hardBreak; function hardBreak() { return '\\\n' } var longestStreak_1 = longestStreak; // Get the count of the longest repeating streak of `character` in `value`. function longestStreak(value, character) { var count = 0; var maximum = 0; var expected; var index; if (typeof character !== 'string' || character.length !== 1) { throw new Error('Expected character') } value = String(value); index = value.indexOf(character); expected = index; while (index !== -1) { count++; if (index === expected) { if (count > maximum) { maximum = count; } } else { count = 1; } expected = index + 1; index = value.indexOf(character, expected); } return maximum } var formatCodeAsIndented_1 = formatCodeAsIndented; function formatCodeAsIndented(node, context) { return ( node.value && !context.options.fences && // If there’s no info… !node.lang && // And there’s a non-whitespace character… /[^ \r\n]/.test(node.value) && // And the value doesn’t start or end in a blank… !/^[\t ]*[\r\n]|[\r\n][\t ]*$/.test(node.value) ) } var checkFence_1 = checkFence; function checkFence(context) { var marker = context.options.fence || '`'; if (marker !== '`' && marker !== '~') { throw new Error( 'Cannot serialize code with `' + marker + '` for `options.fence`, expected `` ` `` or `~`' ) } return marker } var safe_1 = safe; function safe(context, input, config) { var value = (config.before || '') + (input || '') + (config.after || ''); var positions = []; var result = []; var infos = {}; var index = -1; var before; var after; var position; var pattern; var expression; var match; var start; var end; while (++index < context.unsafePatterns.length) { pattern = context.unsafePatterns[index]; if ( !inScope(context.stack, pattern.inConstruct, true) || inScope(context.stack, pattern.notInConstruct) ) { continue } expression = pattern._compiled || (pattern._compiled = toExpression(pattern)); while ((match = expression.exec(value))) { before = 'before' in pattern || pattern.atBreak; after = 'after' in pattern; position = match.index + (before ? match[1].length : 0); if (positions.indexOf(position) === -1) { positions.push(position); infos[position] = {before: before, after: after}; } else { if (infos[position].before && !before) { infos[position].before = false; } if (infos[position].after && !after) { infos[position].after = false; } } } } positions.sort(numerical); start = config.before ? config.before.length : 0; end = value.length - (config.after ? config.after.length : 0); index = -1; while (++index < positions.length) { position = positions[index]; if ( // Character before or after matched: position < start || position >= end ) { continue } // If this character is supposed to be escaped because it has a condition on // the next character, and the next character is definitly being escaped, // then skip this escape. if ( position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after ) { continue } if (start !== position) { result.push(value.slice(start, position)); } start = position; if ( /[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || config.encode.indexOf(value.charAt(position)) === -1) ) { // Character escape. result.push('\\'); } else { // Character reference. result.push( '&#x' + value.charCodeAt(position).toString(16).toUpperCase() + ';' ); start++; } } result.push(value.slice(start, end)); return result.join('') } function inScope(stack, list, none) { var index; if (!list) { return none } if (typeof list === 'string') { list = [list]; } index = -1; while (++index < list.length) { if (stack.indexOf(list[index]) !== -1) { return true } } return false } function toExpression(pattern) { var before = pattern.before ? '(?:' + pattern.before + ')' : ''; var after = pattern.after ? '(?:' + pattern.after + ')' : ''; if (pattern.atBreak) { before = '[\\r\\n][\\t ]*' + before; } return new RegExp( (before ? '(' + before + ')' : '') + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + pattern.character + (after || ''), 'g' ) } function numerical(a, b) { return a - b } var code_1 = code$1; function code$1(node, _, context) { var marker = checkFence_1(context); var raw = node.value || ''; var suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; var value; var sequence; var exit; var subexit; if (formatCodeAsIndented_1(node, context)) { exit = context.enter('codeIndented'); value = indentLines_1$1(raw, map$3); } else { sequence = repeatString(marker, Math.max(longestStreak_1(raw, marker) + 1, 3)); exit = context.enter('codeFenced'); value = sequence; if (node.lang) { subexit = context.enter('codeFencedLang' + suffix); value += safe_1(context, node.lang, { before: '`', after: ' ', encode: ['`'] }); subexit(); } if (node.lang && node.meta) { subexit = context.enter('codeFencedMeta' + suffix); value += ' ' + safe_1(context, node.meta, { before: ' ', after: '\n', encode: ['`'] }); subexit(); } value += '\n'; if (raw) { value += raw + '\n'; } value += sequence; } exit(); return value } function map$3(line, _, blank) { return (blank ? '' : ' ') + line } var association_1 = association; var characterEscape$1 = /\\([!-/:-@[-`{-~])/g; var characterReference$1 = /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; // The `label` of an association is the string value: character escapes and // references work, and casing is intact. // The `identifier` is used to match one association to another: controversially, // character escapes and references don’t work in this matching: `©` does // not match `©`, and `\+` does not match `+`. // But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` // matches `a b`. // So, we do prefer the label when figuring out how we’re going to serialize: // it has whitespace, casing, and we can ignore most useless character escapes // and all character references. function association(node) { if (node.label || !node.identifier) { return node.label || '' } return node.identifier .replace(characterEscape$1, '$1') .replace(characterReference$1, decodeIfPossible) } function decodeIfPossible($0, $1) { return decodeEntity_1($1) || $0 } var checkQuote_1 = checkQuote; function checkQuote(context) { var marker = context.options.quote || '"'; if (marker !== '"' && marker !== "'") { throw new Error( 'Cannot serialize title with `' + marker + '` for `options.quote`, expected `"`, or `\'`' ) } return marker } var definition_1 = definition$1; function definition$1(node, _, context) { var marker = checkQuote_1(context); var suffix = marker === '"' ? 'Quote' : 'Apostrophe'; var exit = context.enter('definition'); var subexit = context.enter('label'); var value = '[' + safe_1(context, association_1(node), {before: '[', after: ']'}) + ']: '; subexit(); if ( // If there’s no url, or… !node.url || // If there’s whitespace, enclosed is prettier. /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); value += '<' + safe_1(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); value += safe_1(context, node.url, {before: ' ', after: ' '}); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); value += ' ' + marker + safe_1(context, node.title, {before: marker, after: marker}) + marker; subexit(); } exit(); return value } var checkEmphasis_1 = checkEmphasis; function checkEmphasis(context) { var marker = context.options.emphasis || '*'; if (marker !== '*' && marker !== '_') { throw new Error( 'Cannot serialize emphasis with `' + marker + '` for `options.emphasis`, expected `*`, or `_`' ) } return marker } var containerPhrasing$1 = phrasing$1; function phrasing$1(parent, context, safeOptions) { var children = parent.children || []; var results = []; var index = -1; var before = safeOptions.before; var after; var handle; var child; while (++index < children.length) { child = children[index]; if (index + 1 < children.length) { handle = context.handle.handlers[children[index + 1].type]; if (handle && handle.peek) handle = handle.peek; after = handle ? handle(children[index + 1], parent, context, { before: '', after: '' }).charAt(0) : ''; } else { after = safeOptions.after; } results.push( context.handle(child, parent, context, { before: before, after: after }) ); before = results[results.length - 1].slice(-1); } return results.join('') } var emphasis_1 = emphasis; emphasis.peek = emphasisPeek; // To do: there are cases where emphasis cannot “form” depending on the // previous or next character of sequences. // There’s no way around that though, except for injecting zero-width stuff. // Do we need to safeguard against that? function emphasis(node, _, context) { var marker = checkEmphasis_1(context); var exit = context.enter('emphasis'); var value = containerPhrasing$1(node, context, {before: marker, after: marker}); exit(); return marker + value + marker } function emphasisPeek(node, _, context) { return context.options.emphasis || '*' } var formatHeadingAsSetext_1 = formatHeadingAsSetext; function formatHeadingAsSetext(node, context) { return ( context.options.setext && (!node.depth || node.depth < 3) && mdastUtilToString(node) ) } var heading_1 = heading; function heading(node, _, context) { var rank = Math.max(Math.min(6, node.depth || 1), 1); var exit; var subexit; var value; var sequence; if (formatHeadingAsSetext_1(node, context)) { exit = context.enter('headingSetext'); subexit = context.enter('phrasing'); value = containerPhrasing$1(node, context, {before: '\n', after: '\n'}); subexit(); exit(); return ( value + '\n' + repeatString( rank === 1 ? '=' : '-', // The whole size… value.length - // Minus the position of the character after the last EOL (or // 0 if there is none)… (Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1) ) ) } sequence = repeatString('#', rank); exit = context.enter('headingAtx'); subexit = context.enter('phrasing'); value = containerPhrasing$1(node, context, {before: '# ', after: '\n'}); value = value ? sequence + ' ' + value : sequence; if (context.options.closeAtx) { value += ' ' + sequence; } subexit(); exit(); return value } var html_1 = html; function html(node) { return node.value || '' } var image_1 = image$1; image$1.peek = imagePeek; function image$1(node, _, context) { var quote = checkQuote_1(context); var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; var exit = context.enter('image'); var subexit = context.enter('label'); var value = '![' + safe_1(context, node.alt, {before: '[', after: ']'}) + ']('; subexit(); if ( // If there’s no url but there is a title… (!node.url && node.title) || // Or if there’s markdown whitespace or an eol, enclose. /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); value += '<' + safe_1(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); value += safe_1(context, node.url, { before: '(', after: node.title ? ' ' : ')' }); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); value += ' ' + quote + safe_1(context, node.title, {before: quote, after: quote}) + quote; subexit(); } value += ')'; exit(); return value } function imagePeek() { return '!' } var imageReference_1 = imageReference; imageReference.peek = imageReferencePeek; function imageReference(node, _, context) { var type = node.referenceType; var exit = context.enter('imageReference'); var subexit = context.enter('label'); var alt = safe_1(context, node.alt, {before: '[', after: ']'}); var value = '![' + alt + ']'; var reference; var stack; subexit(); // Hide the fact that we’re in phrasing, because escapes don’t work. stack = context.stack; context.stack = []; subexit = context.enter('reference'); reference = safe_1(context, association_1(node), {before: '[', after: ']'}); subexit(); context.stack = stack; exit(); if (type === 'full' || !alt || alt !== reference) { value += '[' + reference + ']'; } else if (type !== 'shortcut') { value += '[]'; } return value } function imageReferencePeek() { return '!' } var inlineCode_1$1 = inlineCode$1; inlineCode$1.peek = inlineCodePeek$1; function inlineCode$1(node) { var value = node.value || ''; var sequence = '`'; var pad = ''; // If there is a single grave accent on its own in the code, use a fence of // two. // If there are two in a row, use one. while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { sequence += '`'; } // If this is not just spaces or eols (tabs don’t count), and either the // first or last character are a space, eol, or tick, then pad with spaces. if ( /[^ \r\n]/.test(value) && (/[ \r\n`]/.test(value.charAt(0)) || /[ \r\n`]/.test(value.charAt(value.length - 1))) ) { pad = ' '; } return sequence + pad + value + pad + sequence } function inlineCodePeek$1() { return '`' } var formatLinkAsAutolink_1 = formatLinkAsAutolink; function formatLinkAsAutolink(node) { var raw = mdastUtilToString(node); return ( // If there’s a url… node.url && // And there’s a no title… !node.title && // And if the url is the same as the content… (raw === node.url || 'mailto:' + raw === node.url) && // And that starts w/ a protocol… /^[a-z][a-z+.-]+:/i.test(node.url) && // And that doesn’t contain ASCII control codes (character escapes and // references don’t work) or angle brackets… !/[\0- <>\u007F]/.test(node.url) ) } var link_1 = link; link.peek = linkPeek; function link(node, _, context) { var quote = checkQuote_1(context); var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; var exit; var subexit; var value; var stack; if (formatLinkAsAutolink_1(node)) { // Hide the fact that we’re in phrasing, because escapes don’t work. stack = context.stack; context.stack = []; exit = context.enter('autolink'); value = '<' + containerPhrasing$1(node, context, {before: '<', after: '>'}) + '>'; exit(); context.stack = stack; return value } exit = context.enter('link'); subexit = context.enter('label'); value = '[' + containerPhrasing$1(node, context, {before: '[', after: ']'}) + ']('; subexit(); if ( // If there’s no url but there is a title… (!node.url && node.title) || // Or if there’s markdown whitespace or an eol, enclose. /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); value += '<' + safe_1(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); value += safe_1(context, node.url, { before: '(', after: node.title ? ' ' : ')' }); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); value += ' ' + quote + safe_1(context, node.title, {before: quote, after: quote}) + quote; subexit(); } value += ')'; exit(); return value } function linkPeek(node) { return formatLinkAsAutolink_1(node) ? '<' : '[' } var linkReference_1 = linkReference; linkReference.peek = linkReferencePeek; function linkReference(node, _, context) { var type = node.referenceType; var exit = context.enter('linkReference'); var subexit = context.enter('label'); var text = containerPhrasing$1(node, context, {before: '[', after: ']'}); var value = '[' + text + ']'; var reference; var stack; subexit(); // Hide the fact that we’re in phrasing, because escapes don’t work. stack = context.stack; context.stack = []; subexit = context.enter('reference'); reference = safe_1(context, association_1(node), {before: '[', after: ']'}); subexit(); context.stack = stack; exit(); if (type === 'full' || !text || text !== reference) { value += '[' + reference + ']'; } else if (type !== 'shortcut') { value += '[]'; } return value } function linkReferencePeek() { return '[' } var list_1 = list$1; function list$1(node, _, context) { var exit = context.enter('list'); var value = containerFlow$1(node, context); exit(); return value } var checkBullet_1$1 = checkBullet$1; function checkBullet$1(context) { var marker = context.options.bullet || '*'; if (marker !== '*' && marker !== '+' && marker !== '-') { throw new Error( 'Cannot serialize items with `' + marker + '` for `options.bullet`, expected `*`, `+`, or `-`' ) } return marker } var checkListItemIndent_1$1 = checkListItemIndent$1; function checkListItemIndent$1(context) { var style = context.options.listItemIndent || 'tab'; if (style === 1 || style === '1') { return 'one' } if (style !== 'tab' && style !== 'one' && style !== 'mixed') { throw new Error( 'Cannot serialize items with `' + style + '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' ) } return style } var listItem_1$1 = listItem$1; function listItem$1(node, parent, context) { var bullet = checkBullet_1$1(context); var listItemIndent = checkListItemIndent_1$1(context); var size; var value; var exit; if (parent && parent.ordered) { bullet = (parent.start > -1 ? parent.start : 1) + (context.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + '.'; } size = bullet.length + 1; if ( listItemIndent === 'tab' || (listItemIndent === 'mixed' && ((parent && parent.spread) || node.spread)) ) { size = Math.ceil(size / 4) * 4; } exit = context.enter('listItem'); value = indentLines_1$1(containerFlow$1(node, context), map); exit(); return value function map(line, index, blank) { if (index) { return (blank ? '' : repeatString(' ', size)) + line } return (blank ? bullet : bullet + repeatString(' ', size - bullet.length)) + line } } var paragraph_1 = paragraph; function paragraph(node, _, context) { var exit = context.enter('paragraph'); var subexit = context.enter('phrasing'); var value = containerPhrasing$1(node, context, {before: '\n', after: '\n'}); subexit(); exit(); return value } var root_1 = root; function root(node, _, context) { return containerFlow$1(node, context) } var checkStrong_1 = checkStrong; function checkStrong(context) { var marker = context.options.strong || '*'; if (marker !== '*' && marker !== '_') { throw new Error( 'Cannot serialize strong with `' + marker + '` for `options.strong`, expected `*`, or `_`' ) } return marker } var strong_1 = strong; strong.peek = strongPeek; // To do: there are cases where emphasis cannot “form” depending on the // previous or next character of sequences. // There’s no way around that though, except for injecting zero-width stuff. // Do we need to safeguard against that? function strong(node, _, context) { var marker = checkStrong_1(context); var exit = context.enter('strong'); var value = containerPhrasing$1(node, context, {before: marker, after: marker}); exit(); return marker + marker + value + marker + marker } function strongPeek(node, _, context) { return context.options.strong || '*' } var text_1$2 = text$4; function text$4(node, parent, context, safeOptions) { return safe_1(context, node.value, safeOptions) } var checkRuleRepeat = checkRule; function checkRule(context) { var repetition = context.options.ruleRepetition || 3; if (repetition < 3) { throw new Error( 'Cannot serialize rules with repetition `' + repetition + '` for `options.ruleRepetition`, expected `3` or more' ) } return repetition } var checkRule_1 = checkRule$1; function checkRule$1(context) { var marker = context.options.rule || '*'; if (marker !== '*' && marker !== '-' && marker !== '_') { throw new Error( 'Cannot serialize rules with `' + marker + '` for `options.rule`, expected `*`, `-`, or `_`' ) } return marker } var thematicBreak_1 = thematicBreak$1; function thematicBreak$1(node, parent, context) { var value = repeatString( checkRule_1(context) + (context.options.ruleSpaces ? ' ' : ''), checkRuleRepeat(context) ); return context.options.ruleSpaces ? value.slice(0, -1) : value } var blockquote$1 = blockquote_1; var _break$1 = _break; var code$2 = code_1; var definition$2 = definition_1; var emphasis$1 = emphasis_1; var hardBreak$1 = _break; var heading$1 = heading_1; var html$1 = html_1; var image$2 = image_1; var imageReference$1 = imageReference_1; var inlineCode$2 = inlineCode_1$1; var link$1 = link_1; var linkReference$1 = linkReference_1; var list$2 = list_1; var listItem$2 = listItem_1$1; var paragraph$1 = paragraph_1; var root$1 = root_1; var strong$1 = strong_1; var text$5 = text_1$2; var thematicBreak$2 = thematicBreak_1; var handle = { blockquote: blockquote$1, break: _break$1, code: code$2, definition: definition$2, emphasis: emphasis$1, hardBreak: hardBreak$1, heading: heading$1, html: html$1, image: image$2, imageReference: imageReference$1, inlineCode: inlineCode$2, link: link$1, linkReference: linkReference$1, list: list$2, listItem: listItem$2, paragraph: paragraph$1, root: root$1, strong: strong$1, text: text$5, thematicBreak: thematicBreak$2 }; var join = [joinDefaults]; function joinDefaults(left, right, parent, context) { if ( // Two lists with the same marker. (right.type === 'list' && right.type === left.type && Boolean(left.ordered) === Boolean(right.ordered)) || // Indented code after list or another indented code. (right.type === 'code' && formatCodeAsIndented_1(right, context) && (left.type === 'list' || (left.type === right.type && formatCodeAsIndented_1(left, context)))) ) { return false } // Join children of a list or an item. // In which case, `parent` has a `spread` field. if (typeof parent.spread === 'boolean') { if ( left.type === 'paragraph' && // Two paragraphs. (left.type === right.type || right.type === 'definition' || // Paragraph followed by a setext heading. (right.type === 'heading' && formatHeadingAsSetext_1(right, context))) ) { return } return parent.spread ? 1 : 0 } } var lib = toMarkdown$6; function toMarkdown$6(tree, options) { let settings = options || {}; let extensions = configure$2(settings); let stack = []; let handle = zwitch('type', { invalid: invalid, unknown: unknown, handlers: extensions.handlers }); let context = { handle: handle, stack: stack, enter: enter, options: settings, unsafePatterns: [],//extensions.unsafe, join: extensions.join }; let result = handle(tree, null, context, {before: '\n', after: '\n'}); if ( result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13 ) { result += '\n'; } return result function enter(name) { stack.push(name); return exit function exit() { stack.pop(); } } } function invalid(value) { throw new Error('Cannot handle value `' + value + '`, expected node') } function unknown(node) { throw new Error('Cannot handle unknown node `' + node.type + '`') } function configure$2(settings) { var extensions = [ {unsafe: settings.unsafe, handlers: settings.handlers, join: settings.join} ].concat(settings.extensions || []); var join$1 = join; var handlers = Object.assign({}, handle); var index = -1; if (settings.tightDefinitions) { join$1 = [joinDefinition].concat(join$1); } while (++index < extensions.length) { join$1 = join$1.concat(extensions[index].join || []); Object.assign(handlers, extensions[index].handlers || {}); } //return {unsafe: unsafe, join: join, handlers: handlers} return {unsafe: [], join: join$1, handlers: handlers} } function joinDefinition(left, right) { // No blank line between adjacent definitions. if (left.type === 'definition' && left.type === right.type) { return 0 } } var mdastUtilToMarkdown = lib; var stringify_1 = stringify$1; function stringify$1(options) { const self = this; this.Compiler = compile; function compile(tree) { return mdastUtilToMarkdown( tree, Object.assign({}, self.data('settings'), options, { extensions: self.data('toMarkdownExtensions') || [] }) ) } } var tokenize$n = tokenizeMathFenced; var concrete$2 = true; function tokenizeMathFenced(effects, ok, nok) { var self = this; var initialPrefix = prefixSize_1(this.events, 'linePrefix'); var sizeOpen = 0; return start function start(code) { /* istanbul ignore if - handled by mm */ if (code !== 36) throw new Error('expected `$`') effects.enter('mathFlow'); effects.enter('mathFlowFence'); effects.enter('mathFlowFenceSequence'); return sequenceOpen(code) } function sequenceOpen(code) { if (code === 36) { effects.consume(code); sizeOpen++; return sequenceOpen } effects.exit('mathFlowFenceSequence'); return sizeOpen < 2 ? nok(code) : factorySpace(effects, metaOpen, 'whitespace')(code) } function metaOpen(code) { if (code === null || code === -5 || code === -4 || code === -3) { return openAfter(code) } effects.enter('mathFlowFenceMeta'); effects.enter('chunkString', {contentType: 'string'}); return meta(code) } function meta(code) { if (code === null || code === -5 || code === -4 || code === -3) { effects.exit('chunkString'); effects.exit('mathFlowFenceMeta'); return openAfter(code) } if (code === 36) return nok(code) effects.consume(code); return meta } function openAfter(code) { effects.exit('mathFlowFence'); return self.interrupt ? ok(code) : content(code) } function content(code) { if (code === null) { return after(code) } if (code === -5 || code === -4 || code === -3) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return effects.attempt( {tokenize: tokenizeClosingFence, partial: true}, after, initialPrefix ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) : content ) } effects.enter('mathFlowValue'); return contentContinue(code) } function contentContinue(code) { if (code === null || code === -5 || code === -4 || code === -3) { effects.exit('mathFlowValue'); return content(code) } effects.consume(code); return contentContinue } function after(code) { effects.exit('mathFlow'); return ok(code) } function tokenizeClosingFence(effects, ok, nok) { var size = 0; return factorySpace(effects, closingPrefixAfter, 'linePrefix', 4) function closingPrefixAfter(code) { effects.enter('mathFlowFence'); effects.enter('mathFlowFenceSequence'); return closingSequence(code) } function closingSequence(code) { if (code === 36) { effects.consume(code); size++; return closingSequence } if (size < sizeOpen) return nok(code) effects.exit('mathFlowFenceSequence'); return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) } function closingSequenceEnd(code) { if (code === null || code === -5 || code === -4 || code === -3) { effects.exit('mathFlowFence'); return ok(code) } return nok(code) } } } var tokenizeMathFlow = { tokenize: tokenize$n, concrete: concrete$2 }; var tokenize$o = tokenizeMathText; var resolve$4 = resolveMathText; var previous_1$1 = previous$2; function resolveMathText(events) { var tailExitIndex = events.length - 4; var headEnterIndex = 3; var index; var enter; // If we start and end with an EOL or a space. if ( (events[headEnterIndex][1].type === 'lineEnding' || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === 'lineEnding' || events[tailExitIndex][1].type === 'space') ) { index = headEnterIndex; // And we have data. while (++index < tailExitIndex) { if (events[index][1].type === 'mathTextData') { // Then we have padding. events[tailExitIndex][1].type = 'mathTextPadding'; events[headEnterIndex][1].type = 'mathTextPadding'; headEnterIndex += 2; tailExitIndex -= 2; break } } } // Merge adjacent spaces and data. index = headEnterIndex - 1; tailExitIndex++; while (++index <= tailExitIndex) { if (enter === undefined) { if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { enter = index; } } else if ( index === tailExitIndex || events[index][1].type === 'lineEnding' ) { events[enter][1].type = 'mathTextData'; if (index !== enter + 2) { events[enter][1].end = events[index - 1][1].end; events.splice(enter + 2, index - enter - 2); tailExitIndex -= index - enter - 2; index = enter + 2; } enter = undefined; } } return events } function previous$2(code) { // If there is a previous code, there will always be a tail. return ( code !== 36 || this.events[this.events.length - 1][1].type === 'characterEscape' ) } function tokenizeMathText(effects, ok, nok) { var self = this; var sizeOpen = 0; var size; var token; return start function start(code) { /* istanbul ignore if - handled by mm */ if (code !== 36) throw new Error('expected `$`') /* istanbul ignore if - handled by mm */ if (!previous$2.call(self, self.previous)) { throw new Error('expected correct previous') } effects.enter('mathText'); effects.enter('mathTextSequence'); return openingSequence(code) } function openingSequence(code) { if (code === 36) { effects.consume(code); sizeOpen++; return openingSequence } effects.exit('mathTextSequence'); return gap(code) } function gap(code) { // EOF. if (code === null) { return nok(code) } // Closing fence? // Could also be data. if (code === 36) { token = effects.enter('mathTextSequence'); size = 0; return closingSequence(code) } // Tabs don’t work, and virtual spaces don’t make sense. if (code === 32) { effects.enter('space'); effects.consume(code); effects.exit('space'); return gap } if (code === -5 || code === -4 || code === -3) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); return gap } // Data. effects.enter('mathTextData'); return data(code) } // In code. function data(code) { if ( code === null || code === 32 || code === 36 || code === -5 || code === -4 || code === -3 ) { effects.exit('mathTextData'); return gap(code) } effects.consume(code); return data } // Closing fence. function closingSequence(code) { // More. if (code === 36) { effects.consume(code); size++; return closingSequence } // Done! if (size === sizeOpen) { effects.exit('mathTextSequence'); effects.exit('mathText'); return ok(code) } // More or less accents: mark as data. token.type = 'mathTextData'; return data(code) } } var tokenizeMathText_1 = { tokenize: tokenize$o, resolve: resolve$4, previous: previous_1$1 }; var flow$5 = {36: tokenizeMathFlow}; var text$6 = {36: tokenizeMathText_1}; var syntax$5 = { flow: flow$5, text: text$6 }; var micromarkExtensionMath = syntax$5; var enter$3 = { mathFlow: enterMathFlow, mathFlowFenceMeta: enterMathFlowMeta, mathText: enterMathText }; var exit$4 = { mathFlow: exitMathFlow, mathFlowFence: exitMathFlowFence, mathFlowFenceMeta: exitMathFlowMeta, mathFlowValue: exitMathData, mathText: exitMathText, mathTextData: exitMathData }; function enterMathFlow(token) { this.enter( { type: 'math', meta: null, value: '', data: { hName: 'div', hProperties: {className: ['math', 'math-display']}, hChildren: [{type: 'text', value: ''}] } }, token ); } function enterMathFlowMeta() { this.buffer(); } function exitMathFlowMeta() { var data = this.resume(); this.stack[this.stack.length - 1].meta = data; } function exitMathFlowFence() { // Exit if this is the closing fence. if (this.getData('mathFlowInside')) return this.buffer(); this.setData('mathFlowInside', true); } function exitMathFlow(token) { var data = this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ''); var node = this.exit(token); node.value = data; node.data.hChildren[0].value = data; this.setData('mathFlowInside'); } function enterMathText(token) { this.enter( { type: 'inlineMath', value: '', data: { hName: 'span', hProperties: {className: ['math', 'math-inline']}, hChildren: [{type: 'text', value: ''}] } }, token ); this.buffer(); } function exitMathText(token) { var data = this.resume(); var node = this.exit(token); node.value = data; node.data.hChildren[0].value = data; } function exitMathData(token) { this.config.enter.data.call(this, token); this.config.exit.data.call(this, token); } var fromMarkdown$7 = { enter: enter$3, exit: exit$4 }; var safe_1$1 = safe$1; function safe$1(context, input, config) { var value = (config.before || '') + (input || '') + (config.after || ''); var positions = []; var result = []; var infos = {}; var index = -1; var before; var after; var position; var pattern; var expression; var match; var start; var end; while (++index < context.unsafePatterns.length) { pattern = context.unsafePatterns[index]; if ( !inScope$1(context.stack, pattern.inConstruct, true) || inScope$1(context.stack, pattern.notInConstruct) ) { continue } expression = pattern._compiled || (pattern._compiled = toExpression$1(pattern)); while ((match = expression.exec(value))) { before = 'before' in pattern || pattern.atBreak; after = 'after' in pattern; position = match.index + (before ? match[1].length : 0); if (positions.indexOf(position) === -1) { positions.push(position); infos[position] = {before: before, after: after}; } else { if (infos[position].before && !before) { infos[position].before = false; } if (infos[position].after && !after) { infos[position].after = false; } } } } positions.sort(numerical$1); start = config.before ? config.before.length : 0; end = value.length - (config.after ? config.after.length : 0); index = -1; while (++index < positions.length) { position = positions[index]; if ( // Character before or after matched: position < start || position >= end ) { continue } // If this character is supposed to be escaped because it has a condition on // the next character, and the next character is definitly being escaped, // then skip this escape. if ( position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after ) { continue } if (start !== position) { result.push(value.slice(start, position)); } start = position; if ( /[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || config.encode.indexOf(value.charAt(position)) === -1) ) { // Character escape. result.push('\\'); } else { // Character reference. result.push( '&#x' + value.charCodeAt(position).toString(16).toUpperCase() + ';' ); start++; } } result.push(value.slice(start, end)); return result.join('') } function inScope$1(stack, list, none) { var index; if (!list) { return none } if (typeof list === 'string') { list = [list]; } index = -1; while (++index < list.length) { if (stack.indexOf(list[index]) !== -1) { return true } } return false } function toExpression$1(pattern) { var before = pattern.before ? '(?:' + pattern.before + ')' : ''; var after = pattern.after ? '(?:' + pattern.after + ')' : ''; if (pattern.atBreak) { before = '[\\r\\n][\\t ]*' + before; } return new RegExp( (before ? '(' + before + ')' : '') + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + pattern.character + (after || ''), 'g' ) } function numerical$1(a, b) { return a - b } var unsafe$3 = [ {character: '\r', inConstruct: ['mathFlowMeta']}, {character: '\r', inConstruct: ['mathFlowMeta']}, {character: '$', inConstruct: ['mathFlowMeta', 'phrasing']}, {atBreak: true, character: '$', after: '\\$'} ]; var handlers$2 = {math: math, inlineMath: inlineMath}; inlineMath.peek = inlineMathPeek; function math(node, _, context) { var raw = node.value || ''; var fence = repeatString('$', Math.max(longestStreak_1(raw, '$') + 1, 2)); var exit = context.enter('mathFlow'); var value = fence; var subexit; if (node.meta) { subexit = context.enter('mathFlowMeta'); value += safe_1$1(context, node.meta, {before: '$', after: ' ', encode: ['$']}); subexit(); } value += '\n'; if (raw) { value += raw + '\n'; } value += fence; exit(); return value } function inlineMath(node) { var value = node.value || ''; var size = 1; var pad = ''; var sequence; // If there is a single dollar sign on its own in the math, use a fence of // two. // If there are two in a row, use one. while ( new RegExp('(^|[^$])' + repeatString('\\$', size) + '([^$]|$)').test(value) ) { size++; } // If this is not just spaces or eols (tabs don’t count), and either the first // or last character are a space, eol, or dollar sign, then pad with spaces. if ( /[^ \r\n]/.test(value) && (/[ \r\n$]/.test(value.charAt(0)) || /[ \r\n$]/.test(value.charAt(value.length - 1))) ) { pad = ' '; } sequence = repeatString('$', size); return sequence + pad + value + pad + sequence } function inlineMathPeek() { return '$' } var toMarkdown$7 = { unsafe: unsafe$3, handlers: handlers$2 }; var warningIssued$1; var remarkMath = math$1; function math$1() { var data = this.data(); /* istanbul ignore next - old remark. */ if ( !warningIssued$1 && ((this.Parser && this.Parser.prototype && this.Parser.prototype.blockTokenizers) || (this.Compiler && this.Compiler.prototype && this.Compiler.prototype.visitors)) ) { warningIssued$1 = true; console.warn( '[remark-math] Warning: please upgrade to remark 13 to use this plugin' ); } add('micromarkExtensions', micromarkExtensionMath); add('fromMarkdownExtensions', fromMarkdown$7); add('toMarkdownExtensions', toMarkdown$7); function add(field, value) { /* istanbul ignore if - other extensions. */ if (data[field]) data[field].push(value); else data[field] = [value]; } } var unistUtilVisit = visit; var CONTINUE$1 = unistUtilVisitParents.CONTINUE; var SKIP$1 = unistUtilVisitParents.SKIP; var EXIT$1 = unistUtilVisitParents.EXIT; visit.CONTINUE = CONTINUE$1; visit.SKIP = SKIP$1; visit.EXIT = EXIT$1; function visit(tree, test, visitor, reverse) { if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor; visitor = test; test = null; } unistUtilVisitParents(tree, test, overload, reverse); function overload(node, parents) { var parent = parents[parents.length - 1]; var index = parent ? parent.children.indexOf(node) : null; return visitor(node, index, parent) } } var katex = createCommonjsModule(function (module, exports) { (function webpackUniversalModuleDefinition(root, factory) { module.exports = factory(); })((typeof self !== 'undefined' ? self : commonjsGlobal), function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./src/katex.less var katex = __webpack_require__(0); // CONCATENATED MODULE: ./src/SourceLocation.js /** * Lexing or parsing positional information for error reporting. * This object is immutable. */ var SourceLocation = /*#__PURE__*/ function () { // The + prefix indicates that these fields aren't writeable // Lexer holding the input string. // Start offset, zero-based inclusive. // End offset, zero-based exclusive. function SourceLocation(lexer, start, end) { this.lexer = void 0; this.start = void 0; this.end = void 0; this.lexer = lexer; this.start = start; this.end = end; } /** * Merges two `SourceLocation`s from location providers, given they are * provided in order of appearance. * - Returns the first one's location if only the first is provided. * - Returns a merged range of the first and the last if both are provided * and their lexers match. * - Otherwise, returns null. */ SourceLocation.range = function range(first, second) { if (!second) { return first && first.loc; } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { return null; } else { return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); } }; return SourceLocation; }(); // CONCATENATED MODULE: ./src/Token.js /** * Interface required to break circular dependency between Token, Lexer, and * ParseError. */ /** * The resulting token returned from `lex`. * * It consists of the token text plus some position information. * The position information is essentially a range in an input string, * but instead of referencing the bare input string, we refer to the lexer. * That way it is possible to attach extra metadata to the input string, * like for example a file name or similar. * * The position information is optional, so it is OK to construct synthetic * tokens if appropriate. Not providing available position information may * lead to degraded error reporting, though. */ var Token_Token = /*#__PURE__*/ function () { // don't expand the token // used in \noexpand function Token(text, // the text of this token loc) { this.text = void 0; this.loc = void 0; this.noexpand = void 0; this.treatAsRelax = void 0; this.text = text; this.loc = loc; } /** * Given a pair of tokens (this and endToken), compute a `Token` encompassing * the whole input range enclosed by these two. */ var _proto = Token.prototype; _proto.range = function range(endToken, // last token of the range, inclusive text) // the text of the newly constructed token { return new Token(text, SourceLocation.range(this, endToken)); }; return Token; }(); // CONCATENATED MODULE: ./src/ParseError.js /** * This is the ParseError class, which is the main error thrown by KaTeX * functions when something has gone wrong. This is used to distinguish internal * errors from errors in the expression that the user provided. * * If possible, a caller should provide a Token or ParseNode with information * about where in the source string the problem occurred. */ var ParseError = // Error position based on passed-in Token or ParseNode. function ParseError(message, // The error message token) // An object providing position information { this.position = void 0; var error = "KaTeX parse error: " + message; var start; var loc = token && token.loc; if (loc && loc.start <= loc.end) { // If we have the input and a position, make the error a bit fancier // Get the input var input = loc.lexer.input; // Prepend some information start = loc.start; var end = loc.end; if (start === input.length) { error += " at end of input: "; } else { error += " at position " + (start + 1) + ": "; } // Underline token in question using combining underscores var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error var left; if (start > 15) { left = "…" + input.slice(start - 15, start); } else { left = input.slice(0, start); } var right; if (end + 15 < input.length) { right = input.slice(end, end + 15) + "…"; } else { right = input.slice(end); } error += left + underlined + right; } // Some hackery to make ParseError a prototype of Error // See http://stackoverflow.com/a/8460753 var self = new Error(error); self.name = "ParseError"; // $FlowFixMe self.__proto__ = ParseError.prototype; // $FlowFixMe self.position = start; return self; }; // $FlowFixMe More hackery ParseError.prototype.__proto__ = Error.prototype; /* harmony default export */ var src_ParseError = (ParseError); // CONCATENATED MODULE: ./src/utils.js /** * This file contains a list of utility functions which are useful in other * files. */ /** * Return whether an element is contained in a list */ var contains = function contains(list, elem) { return list.indexOf(elem) !== -1; }; /** * Provide a default value if a setting is undefined * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. */ var deflt = function deflt(setting, defaultIfUndefined) { return setting === undefined ? defaultIfUndefined : setting; }; // hyphenate and escape adapted from Facebook's React under Apache 2 license var uppercase = /([A-Z])/g; var hyphenate = function hyphenate(str) { return str.replace(uppercase, "-$1").toLowerCase(); }; var ESCAPE_LOOKUP = { "&": "&", ">": ">", "<": "<", "\"": """, "'": "'" }; var ESCAPE_REGEX = /[&><"']/g; /** * Escapes text to prevent scripting attacks. */ function utils_escape(text) { return String(text).replace(ESCAPE_REGEX, function (match) { return ESCAPE_LOOKUP[match]; }); } /** * Sometimes we want to pull out the innermost element of a group. In most * cases, this will just be the group itself, but when ordgroups and colors have * a single element, we want to pull that out. */ var getBaseElem = function getBaseElem(group) { if (group.type === "ordgroup") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "color") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "font") { return getBaseElem(group.body); } else { return group; } }; /** * TeXbook algorithms often reference "character boxes", which are simply groups * with a single character in them. To decide if something is a character box, * we find its innermost group, and see if it is a single character. */ var utils_isCharacterBox = function isCharacterBox(group) { var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; }; var assert = function assert(value) { if (!value) { throw new Error('Expected non-null, but got ' + String(value)); } return value; }; /** * Return the protocol of a URL, or "_relative" if the URL does not specify a * protocol (and thus is relative). */ var protocolFromUrl = function protocolFromUrl(url) { var protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); return protocol != null ? protocol[1] : "_relative"; }; /* harmony default export */ var utils = ({ contains: contains, deflt: deflt, escape: utils_escape, hyphenate: hyphenate, getBaseElem: getBaseElem, isCharacterBox: utils_isCharacterBox, protocolFromUrl: protocolFromUrl }); // CONCATENATED MODULE: ./src/Settings.js /* eslint no-console:0 */ /** * This is a module for storing settings passed into KaTeX. It correctly handles * default settings. */ /** * The main Settings object * * The current options stored are: * - displayMode: Whether the expression should be typeset as inline math * (false, the default), meaning that the math starts in * \textstyle and is placed in an inline-block); or as display * math (true), meaning that the math starts in \displaystyle * and is placed in a block with vertical margin. */ var Settings_Settings = /*#__PURE__*/ function () { function Settings(options) { this.displayMode = void 0; this.output = void 0; this.leqno = void 0; this.fleqn = void 0; this.throwOnError = void 0; this.errorColor = void 0; this.macros = void 0; this.minRuleThickness = void 0; this.colorIsTextColor = void 0; this.strict = void 0; this.trust = void 0; this.maxSize = void 0; this.maxExpand = void 0; this.globalGroup = void 0; // allow null options options = options || {}; this.displayMode = utils.deflt(options.displayMode, false); this.output = utils.deflt(options.output, "htmlAndMathml"); this.leqno = utils.deflt(options.leqno, false); this.fleqn = utils.deflt(options.fleqn, false); this.throwOnError = utils.deflt(options.throwOnError, true); this.errorColor = utils.deflt(options.errorColor, "#cc0000"); this.macros = options.macros || {}; this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0)); this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); this.strict = utils.deflt(options.strict, "warn"); this.trust = utils.deflt(options.trust, false); this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity)); this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); this.globalGroup = utils.deflt(options.globalGroup, false); } /** * Report nonstrict (non-LaTeX-compatible) input. * Can safely not be called if `this.strict` is false in JavaScript. */ var _proto = Settings.prototype; _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) { var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). strict = strict(errorCode, errorMsg, token); } if (!strict || strict === "ignore") { return; } else if (strict === true || strict === "error") { throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token); } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); } } /** * Check whether to apply strict (LaTeX-adhering) behavior for unusual * input (like `\\`). Unlike `nonstrict`, will not throw an error; * instead, "error" translates to a return value of `true`, while "ignore" * translates to a return value of `false`. May still print a warning: * "warn" prints a warning and returns `false`. * This is for the second category of `errorCode`s listed in the README. */ ; _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) { var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). // But catch any exceptions thrown by function, treating them // like "error". try { strict = strict(errorCode, errorMsg, token); } catch (error) { strict = "error"; } } if (!strict || strict === "ignore") { return false; } else if (strict === true || strict === "error") { return true; } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); return false; } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); return false; } } /** * Check whether to test potentially dangerous input, and return * `true` (trusted) or `false` (untrusted). The sole argument `context` * should be an object with `command` field specifying the relevant LaTeX * command (as a string starting with `\`), and any other arguments, etc. * If `context` has a `url` field, a `protocol` field will automatically * get added by this function (changing the specified object). */ ; _proto.isTrusted = function isTrusted(context) { if (context.url && !context.protocol) { context.protocol = utils.protocolFromUrl(context.url); } var trust = typeof this.trust === "function" ? this.trust(context) : this.trust; return Boolean(trust); }; return Settings; }(); // CONCATENATED MODULE: ./src/Style.js /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information * about a specific style. It then provides instances of all the different kinds * of styles possible, and provides functions to move between them and get * information about them. */ /** * The main style class. Contains a unique id for the style, a size (which is * the same for cramped and uncramped version of a style), and a cramped flag. */ var Style = /*#__PURE__*/ function () { function Style(id, size, cramped) { this.id = void 0; this.size = void 0; this.cramped = void 0; this.id = id; this.size = size; this.cramped = cramped; } /** * Get the style of a superscript given a base in the current style. */ var _proto = Style.prototype; _proto.sup = function sup() { return Style_styles[_sup[this.id]]; } /** * Get the style of a subscript given a base in the current style. */ ; _proto.sub = function sub() { return Style_styles[_sub[this.id]]; } /** * Get the style of a fraction numerator given the fraction in the current * style. */ ; _proto.fracNum = function fracNum() { return Style_styles[_fracNum[this.id]]; } /** * Get the style of a fraction denominator given the fraction in the current * style. */ ; _proto.fracDen = function fracDen() { return Style_styles[_fracDen[this.id]]; } /** * Get the cramped version of a style (in particular, cramping a cramped style * doesn't change the style). */ ; _proto.cramp = function cramp() { return Style_styles[_cramp[this.id]]; } /** * Get a text or display version of this style. */ ; _proto.text = function text() { return Style_styles[_text[this.id]]; } /** * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) */ ; _proto.isTight = function isTight() { return this.size >= 2; }; return Style; }(); // Export an interface for type checking, but don't expose the implementation. // This way, no more styles can be generated. // IDs of the different styles var D = 0; var Dc = 1; var T = 2; var Tc = 3; var S = 4; var Sc = 5; var SS = 6; var SSc = 7; // Instances of the different styles var Style_styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. /* harmony default export */ var src_Style = ({ DISPLAY: Style_styles[D], TEXT: Style_styles[T], SCRIPT: Style_styles[S], SCRIPTSCRIPT: Style_styles[SS] }); // CONCATENATED MODULE: ./src/unicodeScripts.js /* * This file defines the Unicode scripts and script families that we * support. To add new scripts or families, just add a new entry to the * scriptData array below. Adding scripts to the scriptData array allows * characters from that script to appear in \text{} environments. */ /** * Each script or script family has a name and an array of blocks. * Each block is an array of two numbers which specify the start and * end points (inclusive) of a block of Unicode codepoints. */ /** * Unicode block data for the families of scripts we support in \text{}. * Scripts only need to appear here if they do not have font metrics. */ var scriptData = [{ // Latin characters beyond the Latin-1 characters we have metrics for. // Needed for Czech, Hungarian and Turkish text, for example. name: 'latin', blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B [0x0300, 0x036f]] }, { // The Cyrillic script used by Russian and related languages. // A Cyrillic subset used to be supported as explicitly defined // symbols in symbols.js name: 'cyrillic', blocks: [[0x0400, 0x04ff]] }, { // The Brahmic scripts of South and Southeast Asia // Devanagari (0900–097F) // Bengali (0980–09FF) // Gurmukhi (0A00–0A7F) // Gujarati (0A80–0AFF) // Oriya (0B00–0B7F) // Tamil (0B80–0BFF) // Telugu (0C00–0C7F) // Kannada (0C80–0CFF) // Malayalam (0D00–0D7F) // Sinhala (0D80–0DFF) // Thai (0E00–0E7F) // Lao (0E80–0EFF) // Tibetan (0F00–0FFF) // Myanmar (1000–109F) name: 'brahmic', blocks: [[0x0900, 0x109F]] }, { name: 'georgian', blocks: [[0x10A0, 0x10ff]] }, { // Chinese and Japanese. // The "k" in cjk is for Korean, but we've separated Korean out name: "cjk", blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana [0x4E00, 0x9FAF], // CJK ideograms [0xFF00, 0xFF60]] }, { // Korean name: 'hangul', blocks: [[0xAC00, 0xD7AF]] }]; /** * Given a codepoint, return the name of the script or script family * it is from, or null if it is not part of a known block */ function scriptFromCodepoint(codepoint) { for (var i = 0; i < scriptData.length; i++) { var script = scriptData[i]; for (var _i = 0; _i < script.blocks.length; _i++) { var block = script.blocks[_i]; if (codepoint >= block[0] && codepoint <= block[1]) { return script.name; } } } return null; } /** * A flattened version of all the supported blocks in a single array. * This is an optimization to make supportedCodepoint() fast. */ var allBlocks = []; scriptData.forEach(function (s) { return s.blocks.forEach(function (b) { return allBlocks.push.apply(allBlocks, b); }); }); /** * Given a codepoint, return true if it falls within one of the * scripts or script families defined above and false otherwise. * * Micro benchmarks shows that this is faster than * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test() * in Firefox, Chrome and Node. */ function supportedCodepoint(codepoint) { for (var i = 0; i < allBlocks.length; i += 2) { if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { return true; } } return false; } // CONCATENATED MODULE: ./src/svgGeometry.js /** * This file provides support to domTree.js and delimiter.js. * It's a storehouse of path geometry for SVG images. */ // In all paths below, the viewBox-to-em scale is 1000:1. var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option. // Think of variable extraViniculum as two detours in the SVG path. // The detour begins at the lower left of the area labeled extraViniculum below. // The detour proceeds one extraViniculum distance up and slightly to the right, // displacing the radiused corner between surd and viniculum. The radius is // traversed as usual, then the detour resumes. It goes right, to the end of // the very long viniculumn, then down one extraViniculum distance, // after which it resumes regular path geometry for the radical. /* viniculum / /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum / █████████████████████←0.04em (40 unit) std viniculum thickness / / / / / /\ / / surd */ var sqrtMain = function sqrtMain(extraViniculum, hLinePad) { // sqrtMain path geometry is from glyph U221A in the font KaTeX Main return "M95," + (622 + extraViniculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) { // size1 is from glyph U221A in the font KaTeX_Size1-Regular return "M263," + (601 + extraViniculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) { // size2 is from glyph U221A in the font KaTeX_Size2-Regular return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) { // size3 is from glyph U221A in the font KaTeX_Size3-Regular return "M424," + (2398 + extraViniculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { // size4 is from glyph U221A in the font KaTeX_Size4-Regular return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z"; }; var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular // One path edge has a variable length. It runs vertically from the viniculumn // to a point near (14 units) the bottom of the surd. The viniculum // is normally 40 units thick. So the length of the line in question is: var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum; return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraViniculum) + "H742z"; }; var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox. var path = ""; switch (size) { case "sqrtMain": path = sqrtMain(extraViniculum, hLinePad); break; case "sqrtSize1": path = sqrtSize1(extraViniculum, hLinePad); break; case "sqrtSize2": path = sqrtSize2(extraViniculum, hLinePad); break; case "sqrtSize3": path = sqrtSize3(extraViniculum, hLinePad); break; case "sqrtSize4": path = sqrtSize4(extraViniculum, hLinePad); break; case "sqrtTall": path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight); } return path; }; var svgGeometry_path = { // Two paths that cover gaps in built-up parentheses. leftParenInner: "M291 0 H417 V300 H291 z", rightParenInner: "M457 0 H583 V300 H457 z", // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", // doublerightarrow is from glyph U+21D2 in font KaTeX Main doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", // leftarrow is from glyph U+2190 in font KaTeX Main leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z", // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z", leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", // overgroup is from the MnSymbol package (public domain) leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z", leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", // Harpoons are from glyph U+21BD in font KaTeX Main leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z", leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z", leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", // hook is from glyph U+21A9 in font KaTeX Main lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z", leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", // tofrom is from glyph U+21C4 in font KaTeX AMS Regular leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z", oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z", oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z", oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z", oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z", rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z", rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z", rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z", rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z", rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z", rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z", rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z", rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z", rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z", righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z", rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z", rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z", twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", // tilde1 is a modified version of a glyph from the MnSymbol package tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", // ditto tilde2, tilde3, & tilde4 tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z", // vec is from glyph U+20D7 in font KaTeX Main vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", // widehat1 is a modified version of a glyph from the MnSymbol package widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z", // ditto widehat2, widehat3, & widehat4 widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", // widecheck paths are all inverted versions of widehat widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z", widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", // The next ten paths support reaction arrows from the mhchem package. // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z", shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" }; // CONCATENATED MODULE: ./src/tree.js /** * This node represents a document fragment, which contains elements, but when * placed into the DOM doesn't have any representation itself. It only contains * children and doesn't have any DOM node properties. */ var tree_DocumentFragment = /*#__PURE__*/ function () { // HtmlDomNode // Never used; needed for satisfying interface. function DocumentFragment(children) { this.children = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.children = children; this.classes = []; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = {}; } var _proto = DocumentFragment.prototype; _proto.hasClass = function hasClass(className) { return utils.contains(this.classes, className); } /** Convert the fragment into a node. */ ; _proto.toNode = function toNode() { var frag = document.createDocumentFragment(); for (var i = 0; i < this.children.length; i++) { frag.appendChild(this.children[i].toNode()); } return frag; } /** Convert the fragment into HTML markup. */ ; _proto.toMarkup = function toMarkup() { var markup = ""; // Simply concatenate the markup for the children together. for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } return markup; } /** * Converts the math node into a string, similar to innerText. Applies to * MathDomNode's only. */ ; _proto.toText = function toText() { // To avoid this, we would subclass documentFragment separately for // MathML, but polyfills for subclassing is expensive per PR 1469. // $FlowFixMe: Only works for ChildType = MathDomNode. var toText = function toText(child) { return child.toText(); }; return this.children.map(toText).join(""); }; return DocumentFragment; }(); // CONCATENATED MODULE: ./src/domTree.js /** * These objects store the data about the DOM nodes we create, as well as some * extra data. They can then be transformed into real DOM nodes with the * `toNode` function or HTML markup using `toMarkup`. They are useful for both * storing extra properties on the nodes, as well as providing a way to easily * work with the DOM. * * Similar functions for working with MathML nodes exist in mathMLTree.js. * * TODO: refactor `span` and `anchor` into common superclass when * target environments support class inheritance */ /** * Create an HTML className based on a list of classes. In addition to joining * with spaces, we also remove empty classes. */ var createClass = function createClass(classes) { return classes.filter(function (cls) { return cls; }).join(" "); }; var initNode = function initNode(classes, options, style) { this.classes = classes || []; this.attributes = {}; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = style || {}; if (options) { if (options.style.isTight()) { this.classes.push("mtight"); } var color = options.getColor(); if (color) { this.style.color = color; } } }; /** * Convert into an HTML node */ var _toNode = function toNode(tagName) { var node = document.createElement(tagName); // Apply the class node.className = createClass(this.classes); // Apply inline styles for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe Flow doesn't seem to understand span.style's type. node.style[style] = this.style[style]; } } // Apply attributes for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { node.setAttribute(attr, this.attributes[attr]); } } // Append the children, also as HTML nodes for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; }; /** * Convert into an HTML markup string */ var _toMarkup = function toMarkup(tagName) { var markup = "<" + tagName; // Add the class if (this.classes.length) { markup += " class=\"" + utils.escape(createClass(this.classes)) + "\""; } var styles = ""; // Add the styles, after hyphenation for (var style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { markup += " style=\"" + utils.escape(styles) + "\""; } // Add the attributes for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\""; } } markup += ">"; // Add the markup of the children, also as markup for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ""; return markup; }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // This type does not include all CSS properties. Additional properties should // be added as needed. /** * This node represents a span node, with a className, a list of children, and * an inline style. It also contains information about its height, depth, and * maxFontSize. * * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan * otherwise. This typesafety is important when HTML builders access a span's * children. */ var domTree_Span = /*#__PURE__*/ function () { function Span(classes, children, options, style) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.width = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options, style); this.children = children || []; } /** * Sets an arbitrary attribute on the span. Warning: use this wisely. Not * all browsers support attributes the same, and having too many custom * attributes is probably bad. */ var _proto = Span.prototype; _proto.setAttribute = function setAttribute(attribute, value) { this.attributes[attribute] = value; }; _proto.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto.toNode = function toNode() { return _toNode.call(this, "span"); }; _proto.toMarkup = function toMarkup() { return _toMarkup.call(this, "span"); }; return Span; }(); /** * This node represents an anchor () element with a hyperlink. See `span` * for further details. */ var domTree_Anchor = /*#__PURE__*/ function () { function Anchor(href, classes, children, options) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options); this.children = children || []; this.setAttribute('href', href); } var _proto2 = Anchor.prototype; _proto2.setAttribute = function setAttribute(attribute, value) { this.attributes[attribute] = value; }; _proto2.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto2.toNode = function toNode() { return _toNode.call(this, "a"); }; _proto2.toMarkup = function toMarkup() { return _toMarkup.call(this, "a"); }; return Anchor; }(); /** * This node represents an image embed () element. */ var domTree_Img = /*#__PURE__*/ function () { function Img(src, alt, style) { this.src = void 0; this.alt = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.alt = alt; this.src = src; this.classes = ["mord"]; this.style = style; } var _proto3 = Img.prototype; _proto3.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto3.toNode = function toNode() { var node = document.createElement("img"); node.src = this.src; node.alt = this.alt; node.className = "mord"; // Apply inline styles for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe node.style[style] = this.style[style]; } } return node; }; _proto3.toMarkup = function toMarkup() { var markup = "" + this.alt + " 0) { span = document.createElement("span"); span.style.marginRight = this.italic + "em"; } if (this.classes.length > 0) { span = span || document.createElement("span"); span.className = createClass(this.classes); } for (var style in this.style) { if (this.style.hasOwnProperty(style)) { span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. span.style[style] = this.style[style]; } } if (span) { span.appendChild(node); return span; } else { return node; } } /** * Creates markup for a symbol node. */ ; _proto4.toMarkup = function toMarkup() { // TODO(alpert): More duplication than I'd like from // span.prototype.toMarkup and symbolNode.prototype.toNode... var needsSpan = false; var markup = " 0) { styles += "margin-right:" + this.italic + "em;"; } for (var style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { needsSpan = true; markup += " style=\"" + utils.escape(styles) + "\""; } var escaped = utils.escape(this.text); if (needsSpan) { markup += ">"; markup += escaped; markup += ""; return markup; } else { return escaped; } }; return SymbolNode; }(); /** * SVG nodes are used to render stretchy wide elements. */ var SvgNode = /*#__PURE__*/ function () { function SvgNode(children, attributes) { this.children = void 0; this.attributes = void 0; this.children = children || []; this.attributes = attributes || {}; } var _proto5 = SvgNode.prototype; _proto5.toNode = function toNode() { var svgNS = "http://www.w3.org/2000/svg"; var node = document.createElementNS(svgNS, "svg"); // Apply attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; }; _proto5.toMarkup = function toMarkup() { var markup = ""; } else { return ""; } }; return PathNode; }(); var LineNode = /*#__PURE__*/ function () { function LineNode(attributes) { this.attributes = void 0; this.attributes = attributes || {}; } var _proto7 = LineNode.prototype; _proto7.toNode = function toNode() { var svgNS = "http://www.w3.org/2000/svg"; var node = document.createElementNS(svgNS, "line"); // Apply attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } return node; }; _proto7.toMarkup = function toMarkup() { var markup = " but got " + String(group) + "."); } } // CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. /* harmony default export */ var fontMetricsData = ({ "AMS-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68889, 0, 0, 0.72222], "66": [0, 0.68889, 0, 0, 0.66667], "67": [0, 0.68889, 0, 0, 0.72222], "68": [0, 0.68889, 0, 0, 0.72222], "69": [0, 0.68889, 0, 0, 0.66667], "70": [0, 0.68889, 0, 0, 0.61111], "71": [0, 0.68889, 0, 0, 0.77778], "72": [0, 0.68889, 0, 0, 0.77778], "73": [0, 0.68889, 0, 0, 0.38889], "74": [0.16667, 0.68889, 0, 0, 0.5], "75": [0, 0.68889, 0, 0, 0.77778], "76": [0, 0.68889, 0, 0, 0.66667], "77": [0, 0.68889, 0, 0, 0.94445], "78": [0, 0.68889, 0, 0, 0.72222], "79": [0.16667, 0.68889, 0, 0, 0.77778], "80": [0, 0.68889, 0, 0, 0.61111], "81": [0.16667, 0.68889, 0, 0, 0.77778], "82": [0, 0.68889, 0, 0, 0.72222], "83": [0, 0.68889, 0, 0, 0.55556], "84": [0, 0.68889, 0, 0, 0.66667], "85": [0, 0.68889, 0, 0, 0.72222], "86": [0, 0.68889, 0, 0, 0.72222], "87": [0, 0.68889, 0, 0, 1.0], "88": [0, 0.68889, 0, 0, 0.72222], "89": [0, 0.68889, 0, 0, 0.72222], "90": [0, 0.68889, 0, 0, 0.66667], "107": [0, 0.68889, 0, 0, 0.55556], "160": [0, 0, 0, 0, 0.25], "165": [0, 0.675, 0.025, 0, 0.75], "174": [0.15559, 0.69224, 0, 0, 0.94666], "240": [0, 0.68889, 0, 0, 0.55556], "295": [0, 0.68889, 0, 0, 0.54028], "710": [0, 0.825, 0, 0, 2.33334], "732": [0, 0.9, 0, 0, 2.33334], "770": [0, 0.825, 0, 0, 2.33334], "771": [0, 0.9, 0, 0, 2.33334], "989": [0.08167, 0.58167, 0, 0, 0.77778], "1008": [0, 0.43056, 0.04028, 0, 0.66667], "8245": [0, 0.54986, 0, 0, 0.275], "8463": [0, 0.68889, 0, 0, 0.54028], "8487": [0, 0.68889, 0, 0, 0.72222], "8498": [0, 0.68889, 0, 0, 0.55556], "8502": [0, 0.68889, 0, 0, 0.66667], "8503": [0, 0.68889, 0, 0, 0.44445], "8504": [0, 0.68889, 0, 0, 0.66667], "8513": [0, 0.68889, 0, 0, 0.63889], "8592": [-0.03598, 0.46402, 0, 0, 0.5], "8594": [-0.03598, 0.46402, 0, 0, 0.5], "8602": [-0.13313, 0.36687, 0, 0, 1.0], "8603": [-0.13313, 0.36687, 0, 0, 1.0], "8606": [0.01354, 0.52239, 0, 0, 1.0], "8608": [0.01354, 0.52239, 0, 0, 1.0], "8610": [0.01354, 0.52239, 0, 0, 1.11111], "8611": [0.01354, 0.52239, 0, 0, 1.11111], "8619": [0, 0.54986, 0, 0, 1.0], "8620": [0, 0.54986, 0, 0, 1.0], "8621": [-0.13313, 0.37788, 0, 0, 1.38889], "8622": [-0.13313, 0.36687, 0, 0, 1.0], "8624": [0, 0.69224, 0, 0, 0.5], "8625": [0, 0.69224, 0, 0, 0.5], "8630": [0, 0.43056, 0, 0, 1.0], "8631": [0, 0.43056, 0, 0, 1.0], "8634": [0.08198, 0.58198, 0, 0, 0.77778], "8635": [0.08198, 0.58198, 0, 0, 0.77778], "8638": [0.19444, 0.69224, 0, 0, 0.41667], "8639": [0.19444, 0.69224, 0, 0, 0.41667], "8642": [0.19444, 0.69224, 0, 0, 0.41667], "8643": [0.19444, 0.69224, 0, 0, 0.41667], "8644": [0.1808, 0.675, 0, 0, 1.0], "8646": [0.1808, 0.675, 0, 0, 1.0], "8647": [0.1808, 0.675, 0, 0, 1.0], "8648": [0.19444, 0.69224, 0, 0, 0.83334], "8649": [0.1808, 0.675, 0, 0, 1.0], "8650": [0.19444, 0.69224, 0, 0, 0.83334], "8651": [0.01354, 0.52239, 0, 0, 1.0], "8652": [0.01354, 0.52239, 0, 0, 1.0], "8653": [-0.13313, 0.36687, 0, 0, 1.0], "8654": [-0.13313, 0.36687, 0, 0, 1.0], "8655": [-0.13313, 0.36687, 0, 0, 1.0], "8666": [0.13667, 0.63667, 0, 0, 1.0], "8667": [0.13667, 0.63667, 0, 0, 1.0], "8669": [-0.13313, 0.37788, 0, 0, 1.0], "8672": [-0.064, 0.437, 0, 0, 1.334], "8674": [-0.064, 0.437, 0, 0, 1.334], "8705": [0, 0.825, 0, 0, 0.5], "8708": [0, 0.68889, 0, 0, 0.55556], "8709": [0.08167, 0.58167, 0, 0, 0.77778], "8717": [0, 0.43056, 0, 0, 0.42917], "8722": [-0.03598, 0.46402, 0, 0, 0.5], "8724": [0.08198, 0.69224, 0, 0, 0.77778], "8726": [0.08167, 0.58167, 0, 0, 0.77778], "8733": [0, 0.69224, 0, 0, 0.77778], "8736": [0, 0.69224, 0, 0, 0.72222], "8737": [0, 0.69224, 0, 0, 0.72222], "8738": [0.03517, 0.52239, 0, 0, 0.72222], "8739": [0.08167, 0.58167, 0, 0, 0.22222], "8740": [0.25142, 0.74111, 0, 0, 0.27778], "8741": [0.08167, 0.58167, 0, 0, 0.38889], "8742": [0.25142, 0.74111, 0, 0, 0.5], "8756": [0, 0.69224, 0, 0, 0.66667], "8757": [0, 0.69224, 0, 0, 0.66667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8765": [-0.13313, 0.37788, 0, 0, 0.77778], "8769": [-0.13313, 0.36687, 0, 0, 0.77778], "8770": [-0.03625, 0.46375, 0, 0, 0.77778], "8774": [0.30274, 0.79383, 0, 0, 0.77778], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8778": [0.08167, 0.58167, 0, 0, 0.77778], "8782": [0.06062, 0.54986, 0, 0, 0.77778], "8783": [0.06062, 0.54986, 0, 0, 0.77778], "8785": [0.08198, 0.58198, 0, 0, 0.77778], "8786": [0.08198, 0.58198, 0, 0, 0.77778], "8787": [0.08198, 0.58198, 0, 0, 0.77778], "8790": [0, 0.69224, 0, 0, 0.77778], "8791": [0.22958, 0.72958, 0, 0, 0.77778], "8796": [0.08198, 0.91667, 0, 0, 0.77778], "8806": [0.25583, 0.75583, 0, 0, 0.77778], "8807": [0.25583, 0.75583, 0, 0, 0.77778], "8808": [0.25142, 0.75726, 0, 0, 0.77778], "8809": [0.25142, 0.75726, 0, 0, 0.77778], "8812": [0.25583, 0.75583, 0, 0, 0.5], "8814": [0.20576, 0.70576, 0, 0, 0.77778], "8815": [0.20576, 0.70576, 0, 0, 0.77778], "8816": [0.30274, 0.79383, 0, 0, 0.77778], "8817": [0.30274, 0.79383, 0, 0, 0.77778], "8818": [0.22958, 0.72958, 0, 0, 0.77778], "8819": [0.22958, 0.72958, 0, 0, 0.77778], "8822": [0.1808, 0.675, 0, 0, 0.77778], "8823": [0.1808, 0.675, 0, 0, 0.77778], "8828": [0.13667, 0.63667, 0, 0, 0.77778], "8829": [0.13667, 0.63667, 0, 0, 0.77778], "8830": [0.22958, 0.72958, 0, 0, 0.77778], "8831": [0.22958, 0.72958, 0, 0, 0.77778], "8832": [0.20576, 0.70576, 0, 0, 0.77778], "8833": [0.20576, 0.70576, 0, 0, 0.77778], "8840": [0.30274, 0.79383, 0, 0, 0.77778], "8841": [0.30274, 0.79383, 0, 0, 0.77778], "8842": [0.13597, 0.63597, 0, 0, 0.77778], "8843": [0.13597, 0.63597, 0, 0, 0.77778], "8847": [0.03517, 0.54986, 0, 0, 0.77778], "8848": [0.03517, 0.54986, 0, 0, 0.77778], "8858": [0.08198, 0.58198, 0, 0, 0.77778], "8859": [0.08198, 0.58198, 0, 0, 0.77778], "8861": [0.08198, 0.58198, 0, 0, 0.77778], "8862": [0, 0.675, 0, 0, 0.77778], "8863": [0, 0.675, 0, 0, 0.77778], "8864": [0, 0.675, 0, 0, 0.77778], "8865": [0, 0.675, 0, 0, 0.77778], "8872": [0, 0.69224, 0, 0, 0.61111], "8873": [0, 0.69224, 0, 0, 0.72222], "8874": [0, 0.69224, 0, 0, 0.88889], "8876": [0, 0.68889, 0, 0, 0.61111], "8877": [0, 0.68889, 0, 0, 0.61111], "8878": [0, 0.68889, 0, 0, 0.72222], "8879": [0, 0.68889, 0, 0, 0.72222], "8882": [0.03517, 0.54986, 0, 0, 0.77778], "8883": [0.03517, 0.54986, 0, 0, 0.77778], "8884": [0.13667, 0.63667, 0, 0, 0.77778], "8885": [0.13667, 0.63667, 0, 0, 0.77778], "8888": [0, 0.54986, 0, 0, 1.11111], "8890": [0.19444, 0.43056, 0, 0, 0.55556], "8891": [0.19444, 0.69224, 0, 0, 0.61111], "8892": [0.19444, 0.69224, 0, 0, 0.61111], "8901": [0, 0.54986, 0, 0, 0.27778], "8903": [0.08167, 0.58167, 0, 0, 0.77778], "8905": [0.08167, 0.58167, 0, 0, 0.77778], "8906": [0.08167, 0.58167, 0, 0, 0.77778], "8907": [0, 0.69224, 0, 0, 0.77778], "8908": [0, 0.69224, 0, 0, 0.77778], "8909": [-0.03598, 0.46402, 0, 0, 0.77778], "8910": [0, 0.54986, 0, 0, 0.76042], "8911": [0, 0.54986, 0, 0, 0.76042], "8912": [0.03517, 0.54986, 0, 0, 0.77778], "8913": [0.03517, 0.54986, 0, 0, 0.77778], "8914": [0, 0.54986, 0, 0, 0.66667], "8915": [0, 0.54986, 0, 0, 0.66667], "8916": [0, 0.69224, 0, 0, 0.66667], "8918": [0.0391, 0.5391, 0, 0, 0.77778], "8919": [0.0391, 0.5391, 0, 0, 0.77778], "8920": [0.03517, 0.54986, 0, 0, 1.33334], "8921": [0.03517, 0.54986, 0, 0, 1.33334], "8922": [0.38569, 0.88569, 0, 0, 0.77778], "8923": [0.38569, 0.88569, 0, 0, 0.77778], "8926": [0.13667, 0.63667, 0, 0, 0.77778], "8927": [0.13667, 0.63667, 0, 0, 0.77778], "8928": [0.30274, 0.79383, 0, 0, 0.77778], "8929": [0.30274, 0.79383, 0, 0, 0.77778], "8934": [0.23222, 0.74111, 0, 0, 0.77778], "8935": [0.23222, 0.74111, 0, 0, 0.77778], "8936": [0.23222, 0.74111, 0, 0, 0.77778], "8937": [0.23222, 0.74111, 0, 0, 0.77778], "8938": [0.20576, 0.70576, 0, 0, 0.77778], "8939": [0.20576, 0.70576, 0, 0, 0.77778], "8940": [0.30274, 0.79383, 0, 0, 0.77778], "8941": [0.30274, 0.79383, 0, 0, 0.77778], "8994": [0.19444, 0.69224, 0, 0, 0.77778], "8995": [0.19444, 0.69224, 0, 0, 0.77778], "9416": [0.15559, 0.69224, 0, 0, 0.90222], "9484": [0, 0.69224, 0, 0, 0.5], "9488": [0, 0.69224, 0, 0, 0.5], "9492": [0, 0.37788, 0, 0, 0.5], "9496": [0, 0.37788, 0, 0, 0.5], "9585": [0.19444, 0.68889, 0, 0, 0.88889], "9586": [0.19444, 0.74111, 0, 0, 0.88889], "9632": [0, 0.675, 0, 0, 0.77778], "9633": [0, 0.675, 0, 0, 0.77778], "9650": [0, 0.54986, 0, 0, 0.72222], "9651": [0, 0.54986, 0, 0, 0.72222], "9654": [0.03517, 0.54986, 0, 0, 0.77778], "9660": [0, 0.54986, 0, 0, 0.72222], "9661": [0, 0.54986, 0, 0, 0.72222], "9664": [0.03517, 0.54986, 0, 0, 0.77778], "9674": [0.11111, 0.69224, 0, 0, 0.66667], "9733": [0.19444, 0.69224, 0, 0, 0.94445], "10003": [0, 0.69224, 0, 0, 0.83334], "10016": [0, 0.69224, 0, 0, 0.83334], "10731": [0.11111, 0.69224, 0, 0, 0.66667], "10846": [0.19444, 0.75583, 0, 0, 0.61111], "10877": [0.13667, 0.63667, 0, 0, 0.77778], "10878": [0.13667, 0.63667, 0, 0, 0.77778], "10885": [0.25583, 0.75583, 0, 0, 0.77778], "10886": [0.25583, 0.75583, 0, 0, 0.77778], "10887": [0.13597, 0.63597, 0, 0, 0.77778], "10888": [0.13597, 0.63597, 0, 0, 0.77778], "10889": [0.26167, 0.75726, 0, 0, 0.77778], "10890": [0.26167, 0.75726, 0, 0, 0.77778], "10891": [0.48256, 0.98256, 0, 0, 0.77778], "10892": [0.48256, 0.98256, 0, 0, 0.77778], "10901": [0.13667, 0.63667, 0, 0, 0.77778], "10902": [0.13667, 0.63667, 0, 0, 0.77778], "10933": [0.25142, 0.75726, 0, 0, 0.77778], "10934": [0.25142, 0.75726, 0, 0, 0.77778], "10935": [0.26167, 0.75726, 0, 0, 0.77778], "10936": [0.26167, 0.75726, 0, 0, 0.77778], "10937": [0.26167, 0.75726, 0, 0, 0.77778], "10938": [0.26167, 0.75726, 0, 0, 0.77778], "10949": [0.25583, 0.75583, 0, 0, 0.77778], "10950": [0.25583, 0.75583, 0, 0, 0.77778], "10955": [0.28481, 0.79383, 0, 0, 0.77778], "10956": [0.28481, 0.79383, 0, 0, 0.77778], "57350": [0.08167, 0.58167, 0, 0, 0.22222], "57351": [0.08167, 0.58167, 0, 0, 0.38889], "57352": [0.08167, 0.58167, 0, 0, 0.77778], "57353": [0, 0.43056, 0.04028, 0, 0.66667], "57356": [0.25142, 0.75726, 0, 0, 0.77778], "57357": [0.25142, 0.75726, 0, 0, 0.77778], "57358": [0.41951, 0.91951, 0, 0, 0.77778], "57359": [0.30274, 0.79383, 0, 0, 0.77778], "57360": [0.30274, 0.79383, 0, 0, 0.77778], "57361": [0.41951, 0.91951, 0, 0, 0.77778], "57366": [0.25142, 0.75726, 0, 0, 0.77778], "57367": [0.25142, 0.75726, 0, 0, 0.77778], "57368": [0.25142, 0.75726, 0, 0, 0.77778], "57369": [0.25142, 0.75726, 0, 0, 0.77778], "57370": [0.13597, 0.63597, 0, 0, 0.77778], "57371": [0.13597, 0.63597, 0, 0, 0.77778] }, "Caligraphic-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68333, 0, 0.19445, 0.79847], "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], "72": [0, 0.68333, 0.00965, 0.11111, 0.84452], "73": [0, 0.68333, 0.07382, 0, 0.54452], "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], "76": [0, 0.68333, 0, 0.13889, 0.68972], "77": [0, 0.68333, 0, 0.13889, 1.2009], "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], "82": [0, 0.68333, 0, 0.08334, 0.8475], "83": [0, 0.68333, 0.075, 0.13889, 0.60556], "84": [0, 0.68333, 0.25417, 0, 0.54464], "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], "86": [0, 0.68333, 0.08222, 0, 0.61278], "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], "90": [0, 0.68333, 0.07944, 0.13889, 0.72473], "160": [0, 0, 0, 0, 0.25] }, "Fraktur-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69141, 0, 0, 0.29574], "34": [0, 0.69141, 0, 0, 0.21471], "38": [0, 0.69141, 0, 0, 0.73786], "39": [0, 0.69141, 0, 0, 0.21201], "40": [0.24982, 0.74947, 0, 0, 0.38865], "41": [0.24982, 0.74947, 0, 0, 0.38865], "42": [0, 0.62119, 0, 0, 0.27764], "43": [0.08319, 0.58283, 0, 0, 0.75623], "44": [0, 0.10803, 0, 0, 0.27764], "45": [0.08319, 0.58283, 0, 0, 0.75623], "46": [0, 0.10803, 0, 0, 0.27764], "47": [0.24982, 0.74947, 0, 0, 0.50181], "48": [0, 0.47534, 0, 0, 0.50181], "49": [0, 0.47534, 0, 0, 0.50181], "50": [0, 0.47534, 0, 0, 0.50181], "51": [0.18906, 0.47534, 0, 0, 0.50181], "52": [0.18906, 0.47534, 0, 0, 0.50181], "53": [0.18906, 0.47534, 0, 0, 0.50181], "54": [0, 0.69141, 0, 0, 0.50181], "55": [0.18906, 0.47534, 0, 0, 0.50181], "56": [0, 0.69141, 0, 0, 0.50181], "57": [0.18906, 0.47534, 0, 0, 0.50181], "58": [0, 0.47534, 0, 0, 0.21606], "59": [0.12604, 0.47534, 0, 0, 0.21606], "61": [-0.13099, 0.36866, 0, 0, 0.75623], "63": [0, 0.69141, 0, 0, 0.36245], "65": [0, 0.69141, 0, 0, 0.7176], "66": [0, 0.69141, 0, 0, 0.88397], "67": [0, 0.69141, 0, 0, 0.61254], "68": [0, 0.69141, 0, 0, 0.83158], "69": [0, 0.69141, 0, 0, 0.66278], "70": [0.12604, 0.69141, 0, 0, 0.61119], "71": [0, 0.69141, 0, 0, 0.78539], "72": [0.06302, 0.69141, 0, 0, 0.7203], "73": [0, 0.69141, 0, 0, 0.55448], "74": [0.12604, 0.69141, 0, 0, 0.55231], "75": [0, 0.69141, 0, 0, 0.66845], "76": [0, 0.69141, 0, 0, 0.66602], "77": [0, 0.69141, 0, 0, 1.04953], "78": [0, 0.69141, 0, 0, 0.83212], "79": [0, 0.69141, 0, 0, 0.82699], "80": [0.18906, 0.69141, 0, 0, 0.82753], "81": [0.03781, 0.69141, 0, 0, 0.82699], "82": [0, 0.69141, 0, 0, 0.82807], "83": [0, 0.69141, 0, 0, 0.82861], "84": [0, 0.69141, 0, 0, 0.66899], "85": [0, 0.69141, 0, 0, 0.64576], "86": [0, 0.69141, 0, 0, 0.83131], "87": [0, 0.69141, 0, 0, 1.04602], "88": [0, 0.69141, 0, 0, 0.71922], "89": [0.18906, 0.69141, 0, 0, 0.83293], "90": [0.12604, 0.69141, 0, 0, 0.60201], "91": [0.24982, 0.74947, 0, 0, 0.27764], "93": [0.24982, 0.74947, 0, 0, 0.27764], "94": [0, 0.69141, 0, 0, 0.49965], "97": [0, 0.47534, 0, 0, 0.50046], "98": [0, 0.69141, 0, 0, 0.51315], "99": [0, 0.47534, 0, 0, 0.38946], "100": [0, 0.62119, 0, 0, 0.49857], "101": [0, 0.47534, 0, 0, 0.40053], "102": [0.18906, 0.69141, 0, 0, 0.32626], "103": [0.18906, 0.47534, 0, 0, 0.5037], "104": [0.18906, 0.69141, 0, 0, 0.52126], "105": [0, 0.69141, 0, 0, 0.27899], "106": [0, 0.69141, 0, 0, 0.28088], "107": [0, 0.69141, 0, 0, 0.38946], "108": [0, 0.69141, 0, 0, 0.27953], "109": [0, 0.47534, 0, 0, 0.76676], "110": [0, 0.47534, 0, 0, 0.52666], "111": [0, 0.47534, 0, 0, 0.48885], "112": [0.18906, 0.52396, 0, 0, 0.50046], "113": [0.18906, 0.47534, 0, 0, 0.48912], "114": [0, 0.47534, 0, 0, 0.38919], "115": [0, 0.47534, 0, 0, 0.44266], "116": [0, 0.62119, 0, 0, 0.33301], "117": [0, 0.47534, 0, 0, 0.5172], "118": [0, 0.52396, 0, 0, 0.5118], "119": [0, 0.52396, 0, 0, 0.77351], "120": [0.18906, 0.47534, 0, 0, 0.38865], "121": [0.18906, 0.47534, 0, 0, 0.49884], "122": [0.18906, 0.47534, 0, 0, 0.39054], "160": [0, 0, 0, 0, 0.25], "8216": [0, 0.69141, 0, 0, 0.21471], "8217": [0, 0.69141, 0, 0, 0.21471], "58112": [0, 0.62119, 0, 0, 0.49749], "58113": [0, 0.62119, 0, 0, 0.4983], "58114": [0.18906, 0.69141, 0, 0, 0.33328], "58115": [0.18906, 0.69141, 0, 0, 0.32923], "58116": [0.18906, 0.47534, 0, 0, 0.50343], "58117": [0, 0.69141, 0, 0, 0.33301], "58118": [0, 0.62119, 0, 0, 0.33409], "58119": [0, 0.47534, 0, 0, 0.50073] }, "Main-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.35], "34": [0, 0.69444, 0, 0, 0.60278], "35": [0.19444, 0.69444, 0, 0, 0.95833], "36": [0.05556, 0.75, 0, 0, 0.575], "37": [0.05556, 0.75, 0, 0, 0.95833], "38": [0, 0.69444, 0, 0, 0.89444], "39": [0, 0.69444, 0, 0, 0.31944], "40": [0.25, 0.75, 0, 0, 0.44722], "41": [0.25, 0.75, 0, 0, 0.44722], "42": [0, 0.75, 0, 0, 0.575], "43": [0.13333, 0.63333, 0, 0, 0.89444], "44": [0.19444, 0.15556, 0, 0, 0.31944], "45": [0, 0.44444, 0, 0, 0.38333], "46": [0, 0.15556, 0, 0, 0.31944], "47": [0.25, 0.75, 0, 0, 0.575], "48": [0, 0.64444, 0, 0, 0.575], "49": [0, 0.64444, 0, 0, 0.575], "50": [0, 0.64444, 0, 0, 0.575], "51": [0, 0.64444, 0, 0, 0.575], "52": [0, 0.64444, 0, 0, 0.575], "53": [0, 0.64444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0, 0.64444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0, 0.64444, 0, 0, 0.575], "58": [0, 0.44444, 0, 0, 0.31944], "59": [0.19444, 0.44444, 0, 0, 0.31944], "60": [0.08556, 0.58556, 0, 0, 0.89444], "61": [-0.10889, 0.39111, 0, 0, 0.89444], "62": [0.08556, 0.58556, 0, 0, 0.89444], "63": [0, 0.69444, 0, 0, 0.54305], "64": [0, 0.69444, 0, 0, 0.89444], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0, 0, 0.81805], "67": [0, 0.68611, 0, 0, 0.83055], "68": [0, 0.68611, 0, 0, 0.88194], "69": [0, 0.68611, 0, 0, 0.75555], "70": [0, 0.68611, 0, 0, 0.72361], "71": [0, 0.68611, 0, 0, 0.90416], "72": [0, 0.68611, 0, 0, 0.9], "73": [0, 0.68611, 0, 0, 0.43611], "74": [0, 0.68611, 0, 0, 0.59444], "75": [0, 0.68611, 0, 0, 0.90138], "76": [0, 0.68611, 0, 0, 0.69166], "77": [0, 0.68611, 0, 0, 1.09166], "78": [0, 0.68611, 0, 0, 0.9], "79": [0, 0.68611, 0, 0, 0.86388], "80": [0, 0.68611, 0, 0, 0.78611], "81": [0.19444, 0.68611, 0, 0, 0.86388], "82": [0, 0.68611, 0, 0, 0.8625], "83": [0, 0.68611, 0, 0, 0.63889], "84": [0, 0.68611, 0, 0, 0.8], "85": [0, 0.68611, 0, 0, 0.88472], "86": [0, 0.68611, 0.01597, 0, 0.86944], "87": [0, 0.68611, 0.01597, 0, 1.18888], "88": [0, 0.68611, 0, 0, 0.86944], "89": [0, 0.68611, 0.02875, 0, 0.86944], "90": [0, 0.68611, 0, 0, 0.70277], "91": [0.25, 0.75, 0, 0, 0.31944], "92": [0.25, 0.75, 0, 0, 0.575], "93": [0.25, 0.75, 0, 0, 0.31944], "94": [0, 0.69444, 0, 0, 0.575], "95": [0.31, 0.13444, 0.03194, 0, 0.575], "97": [0, 0.44444, 0, 0, 0.55902], "98": [0, 0.69444, 0, 0, 0.63889], "99": [0, 0.44444, 0, 0, 0.51111], "100": [0, 0.69444, 0, 0, 0.63889], "101": [0, 0.44444, 0, 0, 0.52708], "102": [0, 0.69444, 0.10903, 0, 0.35139], "103": [0.19444, 0.44444, 0.01597, 0, 0.575], "104": [0, 0.69444, 0, 0, 0.63889], "105": [0, 0.69444, 0, 0, 0.31944], "106": [0.19444, 0.69444, 0, 0, 0.35139], "107": [0, 0.69444, 0, 0, 0.60694], "108": [0, 0.69444, 0, 0, 0.31944], "109": [0, 0.44444, 0, 0, 0.95833], "110": [0, 0.44444, 0, 0, 0.63889], "111": [0, 0.44444, 0, 0, 0.575], "112": [0.19444, 0.44444, 0, 0, 0.63889], "113": [0.19444, 0.44444, 0, 0, 0.60694], "114": [0, 0.44444, 0, 0, 0.47361], "115": [0, 0.44444, 0, 0, 0.45361], "116": [0, 0.63492, 0, 0, 0.44722], "117": [0, 0.44444, 0, 0, 0.63889], "118": [0, 0.44444, 0.01597, 0, 0.60694], "119": [0, 0.44444, 0.01597, 0, 0.83055], "120": [0, 0.44444, 0, 0, 0.60694], "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], "122": [0, 0.44444, 0, 0, 0.51111], "123": [0.25, 0.75, 0, 0, 0.575], "124": [0.25, 0.75, 0, 0, 0.31944], "125": [0.25, 0.75, 0, 0, 0.575], "126": [0.35, 0.34444, 0, 0, 0.575], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.86853], "168": [0, 0.69444, 0, 0, 0.575], "172": [0, 0.44444, 0, 0, 0.76666], "176": [0, 0.69444, 0, 0, 0.86944], "177": [0.13333, 0.63333, 0, 0, 0.89444], "184": [0.17014, 0, 0, 0, 0.51111], "198": [0, 0.68611, 0, 0, 1.04166], "215": [0.13333, 0.63333, 0, 0, 0.89444], "216": [0.04861, 0.73472, 0, 0, 0.89444], "223": [0, 0.69444, 0, 0, 0.59722], "230": [0, 0.44444, 0, 0, 0.83055], "247": [0.13333, 0.63333, 0, 0, 0.89444], "248": [0.09722, 0.54167, 0, 0, 0.575], "305": [0, 0.44444, 0, 0, 0.31944], "338": [0, 0.68611, 0, 0, 1.16944], "339": [0, 0.44444, 0, 0, 0.89444], "567": [0.19444, 0.44444, 0, 0, 0.35139], "710": [0, 0.69444, 0, 0, 0.575], "711": [0, 0.63194, 0, 0, 0.575], "713": [0, 0.59611, 0, 0, 0.575], "714": [0, 0.69444, 0, 0, 0.575], "715": [0, 0.69444, 0, 0, 0.575], "728": [0, 0.69444, 0, 0, 0.575], "729": [0, 0.69444, 0, 0, 0.31944], "730": [0, 0.69444, 0, 0, 0.86944], "732": [0, 0.69444, 0, 0, 0.575], "733": [0, 0.69444, 0, 0, 0.575], "915": [0, 0.68611, 0, 0, 0.69166], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0, 0, 0.89444], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0, 0, 0.76666], "928": [0, 0.68611, 0, 0, 0.9], "931": [0, 0.68611, 0, 0, 0.83055], "933": [0, 0.68611, 0, 0, 0.89444], "934": [0, 0.68611, 0, 0, 0.83055], "936": [0, 0.68611, 0, 0, 0.89444], "937": [0, 0.68611, 0, 0, 0.83055], "8211": [0, 0.44444, 0.03194, 0, 0.575], "8212": [0, 0.44444, 0.03194, 0, 1.14999], "8216": [0, 0.69444, 0, 0, 0.31944], "8217": [0, 0.69444, 0, 0, 0.31944], "8220": [0, 0.69444, 0, 0, 0.60278], "8221": [0, 0.69444, 0, 0, 0.60278], "8224": [0.19444, 0.69444, 0, 0, 0.51111], "8225": [0.19444, 0.69444, 0, 0, 0.51111], "8242": [0, 0.55556, 0, 0, 0.34444], "8407": [0, 0.72444, 0.15486, 0, 0.575], "8463": [0, 0.69444, 0, 0, 0.66759], "8465": [0, 0.69444, 0, 0, 0.83055], "8467": [0, 0.69444, 0, 0, 0.47361], "8472": [0.19444, 0.44444, 0, 0, 0.74027], "8476": [0, 0.69444, 0, 0, 0.83055], "8501": [0, 0.69444, 0, 0, 0.70277], "8592": [-0.10889, 0.39111, 0, 0, 1.14999], "8593": [0.19444, 0.69444, 0, 0, 0.575], "8594": [-0.10889, 0.39111, 0, 0, 1.14999], "8595": [0.19444, 0.69444, 0, 0, 0.575], "8596": [-0.10889, 0.39111, 0, 0, 1.14999], "8597": [0.25, 0.75, 0, 0, 0.575], "8598": [0.19444, 0.69444, 0, 0, 1.14999], "8599": [0.19444, 0.69444, 0, 0, 1.14999], "8600": [0.19444, 0.69444, 0, 0, 1.14999], "8601": [0.19444, 0.69444, 0, 0, 1.14999], "8636": [-0.10889, 0.39111, 0, 0, 1.14999], "8637": [-0.10889, 0.39111, 0, 0, 1.14999], "8640": [-0.10889, 0.39111, 0, 0, 1.14999], "8641": [-0.10889, 0.39111, 0, 0, 1.14999], "8656": [-0.10889, 0.39111, 0, 0, 1.14999], "8657": [0.19444, 0.69444, 0, 0, 0.70277], "8658": [-0.10889, 0.39111, 0, 0, 1.14999], "8659": [0.19444, 0.69444, 0, 0, 0.70277], "8660": [-0.10889, 0.39111, 0, 0, 1.14999], "8661": [0.25, 0.75, 0, 0, 0.70277], "8704": [0, 0.69444, 0, 0, 0.63889], "8706": [0, 0.69444, 0.06389, 0, 0.62847], "8707": [0, 0.69444, 0, 0, 0.63889], "8709": [0.05556, 0.75, 0, 0, 0.575], "8711": [0, 0.68611, 0, 0, 0.95833], "8712": [0.08556, 0.58556, 0, 0, 0.76666], "8715": [0.08556, 0.58556, 0, 0, 0.76666], "8722": [0.13333, 0.63333, 0, 0, 0.89444], "8723": [0.13333, 0.63333, 0, 0, 0.89444], "8725": [0.25, 0.75, 0, 0, 0.575], "8726": [0.25, 0.75, 0, 0, 0.575], "8727": [-0.02778, 0.47222, 0, 0, 0.575], "8728": [-0.02639, 0.47361, 0, 0, 0.575], "8729": [-0.02639, 0.47361, 0, 0, 0.575], "8730": [0.18, 0.82, 0, 0, 0.95833], "8733": [0, 0.44444, 0, 0, 0.89444], "8734": [0, 0.44444, 0, 0, 1.14999], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.31944], "8741": [0.25, 0.75, 0, 0, 0.575], "8743": [0, 0.55556, 0, 0, 0.76666], "8744": [0, 0.55556, 0, 0, 0.76666], "8745": [0, 0.55556, 0, 0, 0.76666], "8746": [0, 0.55556, 0, 0, 0.76666], "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], "8764": [-0.10889, 0.39111, 0, 0, 0.89444], "8768": [0.19444, 0.69444, 0, 0, 0.31944], "8771": [0.00222, 0.50222, 0, 0, 0.89444], "8776": [0.02444, 0.52444, 0, 0, 0.89444], "8781": [0.00222, 0.50222, 0, 0, 0.89444], "8801": [0.00222, 0.50222, 0, 0, 0.89444], "8804": [0.19667, 0.69667, 0, 0, 0.89444], "8805": [0.19667, 0.69667, 0, 0, 0.89444], "8810": [0.08556, 0.58556, 0, 0, 1.14999], "8811": [0.08556, 0.58556, 0, 0, 1.14999], "8826": [0.08556, 0.58556, 0, 0, 0.89444], "8827": [0.08556, 0.58556, 0, 0, 0.89444], "8834": [0.08556, 0.58556, 0, 0, 0.89444], "8835": [0.08556, 0.58556, 0, 0, 0.89444], "8838": [0.19667, 0.69667, 0, 0, 0.89444], "8839": [0.19667, 0.69667, 0, 0, 0.89444], "8846": [0, 0.55556, 0, 0, 0.76666], "8849": [0.19667, 0.69667, 0, 0, 0.89444], "8850": [0.19667, 0.69667, 0, 0, 0.89444], "8851": [0, 0.55556, 0, 0, 0.76666], "8852": [0, 0.55556, 0, 0, 0.76666], "8853": [0.13333, 0.63333, 0, 0, 0.89444], "8854": [0.13333, 0.63333, 0, 0, 0.89444], "8855": [0.13333, 0.63333, 0, 0, 0.89444], "8856": [0.13333, 0.63333, 0, 0, 0.89444], "8857": [0.13333, 0.63333, 0, 0, 0.89444], "8866": [0, 0.69444, 0, 0, 0.70277], "8867": [0, 0.69444, 0, 0, 0.70277], "8868": [0, 0.69444, 0, 0, 0.89444], "8869": [0, 0.69444, 0, 0, 0.89444], "8900": [-0.02639, 0.47361, 0, 0, 0.575], "8901": [-0.02639, 0.47361, 0, 0, 0.31944], "8902": [-0.02778, 0.47222, 0, 0, 0.575], "8968": [0.25, 0.75, 0, 0, 0.51111], "8969": [0.25, 0.75, 0, 0, 0.51111], "8970": [0.25, 0.75, 0, 0, 0.51111], "8971": [0.25, 0.75, 0, 0, 0.51111], "8994": [-0.13889, 0.36111, 0, 0, 1.14999], "8995": [-0.13889, 0.36111, 0, 0, 1.14999], "9651": [0.19444, 0.69444, 0, 0, 1.02222], "9657": [-0.02778, 0.47222, 0, 0, 0.575], "9661": [0.19444, 0.69444, 0, 0, 1.02222], "9667": [-0.02778, 0.47222, 0, 0, 0.575], "9711": [0.19444, 0.69444, 0, 0, 1.14999], "9824": [0.12963, 0.69444, 0, 0, 0.89444], "9825": [0.12963, 0.69444, 0, 0, 0.89444], "9826": [0.12963, 0.69444, 0, 0, 0.89444], "9827": [0.12963, 0.69444, 0, 0, 0.89444], "9837": [0, 0.75, 0, 0, 0.44722], "9838": [0.19444, 0.69444, 0, 0, 0.44722], "9839": [0.19444, 0.69444, 0, 0, 0.44722], "10216": [0.25, 0.75, 0, 0, 0.44722], "10217": [0.25, 0.75, 0, 0, 0.44722], "10815": [0, 0.68611, 0, 0, 0.9], "10927": [0.19667, 0.69667, 0, 0, 0.89444], "10928": [0.19667, 0.69667, 0, 0, 0.89444], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Main-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.11417, 0, 0.38611], "34": [0, 0.69444, 0.07939, 0, 0.62055], "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], "37": [0.05556, 0.75, 0.12861, 0, 0.94444], "38": [0, 0.69444, 0.08528, 0, 0.88555], "39": [0, 0.69444, 0.12945, 0, 0.35555], "40": [0.25, 0.75, 0.15806, 0, 0.47333], "41": [0.25, 0.75, 0.03306, 0, 0.47333], "42": [0, 0.75, 0.14333, 0, 0.59111], "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], "44": [0.19444, 0.14722, 0, 0, 0.35555], "45": [0, 0.44444, 0.02611, 0, 0.41444], "46": [0, 0.14722, 0, 0, 0.35555], "47": [0.25, 0.75, 0.15806, 0, 0.59111], "48": [0, 0.64444, 0.13167, 0, 0.59111], "49": [0, 0.64444, 0.13167, 0, 0.59111], "50": [0, 0.64444, 0.13167, 0, 0.59111], "51": [0, 0.64444, 0.13167, 0, 0.59111], "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], "53": [0, 0.64444, 0.13167, 0, 0.59111], "54": [0, 0.64444, 0.13167, 0, 0.59111], "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], "56": [0, 0.64444, 0.13167, 0, 0.59111], "57": [0, 0.64444, 0.13167, 0, 0.59111], "58": [0, 0.44444, 0.06695, 0, 0.35555], "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], "63": [0, 0.69444, 0.11472, 0, 0.59111], "64": [0, 0.69444, 0.09208, 0, 0.88555], "65": [0, 0.68611, 0, 0, 0.86555], "66": [0, 0.68611, 0.0992, 0, 0.81666], "67": [0, 0.68611, 0.14208, 0, 0.82666], "68": [0, 0.68611, 0.09062, 0, 0.87555], "69": [0, 0.68611, 0.11431, 0, 0.75666], "70": [0, 0.68611, 0.12903, 0, 0.72722], "71": [0, 0.68611, 0.07347, 0, 0.89527], "72": [0, 0.68611, 0.17208, 0, 0.8961], "73": [0, 0.68611, 0.15681, 0, 0.47166], "74": [0, 0.68611, 0.145, 0, 0.61055], "75": [0, 0.68611, 0.14208, 0, 0.89499], "76": [0, 0.68611, 0, 0, 0.69777], "77": [0, 0.68611, 0.17208, 0, 1.07277], "78": [0, 0.68611, 0.17208, 0, 0.8961], "79": [0, 0.68611, 0.09062, 0, 0.85499], "80": [0, 0.68611, 0.0992, 0, 0.78721], "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], "82": [0, 0.68611, 0.02559, 0, 0.85944], "83": [0, 0.68611, 0.11264, 0, 0.64999], "84": [0, 0.68611, 0.12903, 0, 0.7961], "85": [0, 0.68611, 0.17208, 0, 0.88083], "86": [0, 0.68611, 0.18625, 0, 0.86555], "87": [0, 0.68611, 0.18625, 0, 1.15999], "88": [0, 0.68611, 0.15681, 0, 0.86555], "89": [0, 0.68611, 0.19803, 0, 0.86555], "90": [0, 0.68611, 0.14208, 0, 0.70888], "91": [0.25, 0.75, 0.1875, 0, 0.35611], "93": [0.25, 0.75, 0.09972, 0, 0.35611], "94": [0, 0.69444, 0.06709, 0, 0.59111], "95": [0.31, 0.13444, 0.09811, 0, 0.59111], "97": [0, 0.44444, 0.09426, 0, 0.59111], "98": [0, 0.69444, 0.07861, 0, 0.53222], "99": [0, 0.44444, 0.05222, 0, 0.53222], "100": [0, 0.69444, 0.10861, 0, 0.59111], "101": [0, 0.44444, 0.085, 0, 0.53222], "102": [0.19444, 0.69444, 0.21778, 0, 0.4], "103": [0.19444, 0.44444, 0.105, 0, 0.53222], "104": [0, 0.69444, 0.09426, 0, 0.59111], "105": [0, 0.69326, 0.11387, 0, 0.35555], "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], "107": [0, 0.69444, 0.11111, 0, 0.53222], "108": [0, 0.69444, 0.10861, 0, 0.29666], "109": [0, 0.44444, 0.09426, 0, 0.94444], "110": [0, 0.44444, 0.09426, 0, 0.64999], "111": [0, 0.44444, 0.07861, 0, 0.59111], "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], "113": [0.19444, 0.44444, 0.105, 0, 0.53222], "114": [0, 0.44444, 0.11111, 0, 0.50167], "115": [0, 0.44444, 0.08167, 0, 0.48694], "116": [0, 0.63492, 0.09639, 0, 0.385], "117": [0, 0.44444, 0.09426, 0, 0.62055], "118": [0, 0.44444, 0.11111, 0, 0.53222], "119": [0, 0.44444, 0.11111, 0, 0.76777], "120": [0, 0.44444, 0.12583, 0, 0.56055], "121": [0.19444, 0.44444, 0.105, 0, 0.56166], "122": [0, 0.44444, 0.13889, 0, 0.49055], "126": [0.35, 0.34444, 0.11472, 0, 0.59111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0.11473, 0, 0.59111], "176": [0, 0.69444, 0, 0, 0.94888], "184": [0.17014, 0, 0, 0, 0.53222], "198": [0, 0.68611, 0.11431, 0, 1.02277], "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], "223": [0.19444, 0.69444, 0.09736, 0, 0.665], "230": [0, 0.44444, 0.085, 0, 0.82666], "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], "305": [0, 0.44444, 0.09426, 0, 0.35555], "338": [0, 0.68611, 0.11431, 0, 1.14054], "339": [0, 0.44444, 0.085, 0, 0.82666], "567": [0.19444, 0.44444, 0.04611, 0, 0.385], "710": [0, 0.69444, 0.06709, 0, 0.59111], "711": [0, 0.63194, 0.08271, 0, 0.59111], "713": [0, 0.59444, 0.10444, 0, 0.59111], "714": [0, 0.69444, 0.08528, 0, 0.59111], "715": [0, 0.69444, 0, 0, 0.59111], "728": [0, 0.69444, 0.10333, 0, 0.59111], "729": [0, 0.69444, 0.12945, 0, 0.35555], "730": [0, 0.69444, 0, 0, 0.94888], "732": [0, 0.69444, 0.11472, 0, 0.59111], "733": [0, 0.69444, 0.11472, 0, 0.59111], "915": [0, 0.68611, 0.12903, 0, 0.69777], "916": [0, 0.68611, 0, 0, 0.94444], "920": [0, 0.68611, 0.09062, 0, 0.88555], "923": [0, 0.68611, 0, 0, 0.80666], "926": [0, 0.68611, 0.15092, 0, 0.76777], "928": [0, 0.68611, 0.17208, 0, 0.8961], "931": [0, 0.68611, 0.11431, 0, 0.82666], "933": [0, 0.68611, 0.10778, 0, 0.88555], "934": [0, 0.68611, 0.05632, 0, 0.82666], "936": [0, 0.68611, 0.10778, 0, 0.88555], "937": [0, 0.68611, 0.0992, 0, 0.82666], "8211": [0, 0.44444, 0.09811, 0, 0.59111], "8212": [0, 0.44444, 0.09811, 0, 1.18221], "8216": [0, 0.69444, 0.12945, 0, 0.35555], "8217": [0, 0.69444, 0.12945, 0, 0.35555], "8220": [0, 0.69444, 0.16772, 0, 0.62055], "8221": [0, 0.69444, 0.07939, 0, 0.62055] }, "Main-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.12417, 0, 0.30667], "34": [0, 0.69444, 0.06961, 0, 0.51444], "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], "37": [0.05556, 0.75, 0.13639, 0, 0.81777], "38": [0, 0.69444, 0.09694, 0, 0.76666], "39": [0, 0.69444, 0.12417, 0, 0.30667], "40": [0.25, 0.75, 0.16194, 0, 0.40889], "41": [0.25, 0.75, 0.03694, 0, 0.40889], "42": [0, 0.75, 0.14917, 0, 0.51111], "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], "44": [0.19444, 0.10556, 0, 0, 0.30667], "45": [0, 0.43056, 0.02826, 0, 0.35778], "46": [0, 0.10556, 0, 0, 0.30667], "47": [0.25, 0.75, 0.16194, 0, 0.51111], "48": [0, 0.64444, 0.13556, 0, 0.51111], "49": [0, 0.64444, 0.13556, 0, 0.51111], "50": [0, 0.64444, 0.13556, 0, 0.51111], "51": [0, 0.64444, 0.13556, 0, 0.51111], "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], "53": [0, 0.64444, 0.13556, 0, 0.51111], "54": [0, 0.64444, 0.13556, 0, 0.51111], "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], "56": [0, 0.64444, 0.13556, 0, 0.51111], "57": [0, 0.64444, 0.13556, 0, 0.51111], "58": [0, 0.43056, 0.0582, 0, 0.30667], "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], "63": [0, 0.69444, 0.1225, 0, 0.51111], "64": [0, 0.69444, 0.09597, 0, 0.76666], "65": [0, 0.68333, 0, 0, 0.74333], "66": [0, 0.68333, 0.10257, 0, 0.70389], "67": [0, 0.68333, 0.14528, 0, 0.71555], "68": [0, 0.68333, 0.09403, 0, 0.755], "69": [0, 0.68333, 0.12028, 0, 0.67833], "70": [0, 0.68333, 0.13305, 0, 0.65277], "71": [0, 0.68333, 0.08722, 0, 0.77361], "72": [0, 0.68333, 0.16389, 0, 0.74333], "73": [0, 0.68333, 0.15806, 0, 0.38555], "74": [0, 0.68333, 0.14028, 0, 0.525], "75": [0, 0.68333, 0.14528, 0, 0.76888], "76": [0, 0.68333, 0, 0, 0.62722], "77": [0, 0.68333, 0.16389, 0, 0.89666], "78": [0, 0.68333, 0.16389, 0, 0.74333], "79": [0, 0.68333, 0.09403, 0, 0.76666], "80": [0, 0.68333, 0.10257, 0, 0.67833], "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], "82": [0, 0.68333, 0.03868, 0, 0.72944], "83": [0, 0.68333, 0.11972, 0, 0.56222], "84": [0, 0.68333, 0.13305, 0, 0.71555], "85": [0, 0.68333, 0.16389, 0, 0.74333], "86": [0, 0.68333, 0.18361, 0, 0.74333], "87": [0, 0.68333, 0.18361, 0, 0.99888], "88": [0, 0.68333, 0.15806, 0, 0.74333], "89": [0, 0.68333, 0.19383, 0, 0.74333], "90": [0, 0.68333, 0.14528, 0, 0.61333], "91": [0.25, 0.75, 0.1875, 0, 0.30667], "93": [0.25, 0.75, 0.10528, 0, 0.30667], "94": [0, 0.69444, 0.06646, 0, 0.51111], "95": [0.31, 0.12056, 0.09208, 0, 0.51111], "97": [0, 0.43056, 0.07671, 0, 0.51111], "98": [0, 0.69444, 0.06312, 0, 0.46], "99": [0, 0.43056, 0.05653, 0, 0.46], "100": [0, 0.69444, 0.10333, 0, 0.51111], "101": [0, 0.43056, 0.07514, 0, 0.46], "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], "103": [0.19444, 0.43056, 0.08847, 0, 0.46], "104": [0, 0.69444, 0.07671, 0, 0.51111], "105": [0, 0.65536, 0.1019, 0, 0.30667], "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], "107": [0, 0.69444, 0.10764, 0, 0.46], "108": [0, 0.69444, 0.10333, 0, 0.25555], "109": [0, 0.43056, 0.07671, 0, 0.81777], "110": [0, 0.43056, 0.07671, 0, 0.56222], "111": [0, 0.43056, 0.06312, 0, 0.51111], "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], "113": [0.19444, 0.43056, 0.08847, 0, 0.46], "114": [0, 0.43056, 0.10764, 0, 0.42166], "115": [0, 0.43056, 0.08208, 0, 0.40889], "116": [0, 0.61508, 0.09486, 0, 0.33222], "117": [0, 0.43056, 0.07671, 0, 0.53666], "118": [0, 0.43056, 0.10764, 0, 0.46], "119": [0, 0.43056, 0.10764, 0, 0.66444], "120": [0, 0.43056, 0.12042, 0, 0.46389], "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], "122": [0, 0.43056, 0.12292, 0, 0.40889], "126": [0.35, 0.31786, 0.11585, 0, 0.51111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.66786, 0.10474, 0, 0.51111], "176": [0, 0.69444, 0, 0, 0.83129], "184": [0.17014, 0, 0, 0, 0.46], "198": [0, 0.68333, 0.12028, 0, 0.88277], "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], "230": [0, 0.43056, 0.07514, 0, 0.71555], "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], "338": [0, 0.68333, 0.12028, 0, 0.98499], "339": [0, 0.43056, 0.07514, 0, 0.71555], "710": [0, 0.69444, 0.06646, 0, 0.51111], "711": [0, 0.62847, 0.08295, 0, 0.51111], "713": [0, 0.56167, 0.10333, 0, 0.51111], "714": [0, 0.69444, 0.09694, 0, 0.51111], "715": [0, 0.69444, 0, 0, 0.51111], "728": [0, 0.69444, 0.10806, 0, 0.51111], "729": [0, 0.66786, 0.11752, 0, 0.30667], "730": [0, 0.69444, 0, 0, 0.83129], "732": [0, 0.66786, 0.11585, 0, 0.51111], "733": [0, 0.69444, 0.1225, 0, 0.51111], "915": [0, 0.68333, 0.13305, 0, 0.62722], "916": [0, 0.68333, 0, 0, 0.81777], "920": [0, 0.68333, 0.09403, 0, 0.76666], "923": [0, 0.68333, 0, 0, 0.69222], "926": [0, 0.68333, 0.15294, 0, 0.66444], "928": [0, 0.68333, 0.16389, 0, 0.74333], "931": [0, 0.68333, 0.12028, 0, 0.71555], "933": [0, 0.68333, 0.11111, 0, 0.76666], "934": [0, 0.68333, 0.05986, 0, 0.71555], "936": [0, 0.68333, 0.11111, 0, 0.76666], "937": [0, 0.68333, 0.10257, 0, 0.71555], "8211": [0, 0.43056, 0.09208, 0, 0.51111], "8212": [0, 0.43056, 0.09208, 0, 1.02222], "8216": [0, 0.69444, 0.12417, 0, 0.30667], "8217": [0, 0.69444, 0.12417, 0, 0.30667], "8220": [0, 0.69444, 0.1685, 0, 0.51444], "8221": [0, 0.69444, 0.06961, 0, 0.51444], "8463": [0, 0.68889, 0, 0, 0.54028] }, "Main-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.27778], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.77778], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.19444, 0.10556, 0, 0, 0.27778], "45": [0, 0.43056, 0, 0, 0.33333], "46": [0, 0.10556, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.64444, 0, 0, 0.5], "49": [0, 0.64444, 0, 0, 0.5], "50": [0, 0.64444, 0, 0, 0.5], "51": [0, 0.64444, 0, 0, 0.5], "52": [0, 0.64444, 0, 0, 0.5], "53": [0, 0.64444, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0, 0.64444, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0, 0.64444, 0, 0, 0.5], "58": [0, 0.43056, 0, 0, 0.27778], "59": [0.19444, 0.43056, 0, 0, 0.27778], "60": [0.0391, 0.5391, 0, 0, 0.77778], "61": [-0.13313, 0.36687, 0, 0, 0.77778], "62": [0.0391, 0.5391, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.77778], "65": [0, 0.68333, 0, 0, 0.75], "66": [0, 0.68333, 0, 0, 0.70834], "67": [0, 0.68333, 0, 0, 0.72222], "68": [0, 0.68333, 0, 0, 0.76389], "69": [0, 0.68333, 0, 0, 0.68056], "70": [0, 0.68333, 0, 0, 0.65278], "71": [0, 0.68333, 0, 0, 0.78472], "72": [0, 0.68333, 0, 0, 0.75], "73": [0, 0.68333, 0, 0, 0.36111], "74": [0, 0.68333, 0, 0, 0.51389], "75": [0, 0.68333, 0, 0, 0.77778], "76": [0, 0.68333, 0, 0, 0.625], "77": [0, 0.68333, 0, 0, 0.91667], "78": [0, 0.68333, 0, 0, 0.75], "79": [0, 0.68333, 0, 0, 0.77778], "80": [0, 0.68333, 0, 0, 0.68056], "81": [0.19444, 0.68333, 0, 0, 0.77778], "82": [0, 0.68333, 0, 0, 0.73611], "83": [0, 0.68333, 0, 0, 0.55556], "84": [0, 0.68333, 0, 0, 0.72222], "85": [0, 0.68333, 0, 0, 0.75], "86": [0, 0.68333, 0.01389, 0, 0.75], "87": [0, 0.68333, 0.01389, 0, 1.02778], "88": [0, 0.68333, 0, 0, 0.75], "89": [0, 0.68333, 0.025, 0, 0.75], "90": [0, 0.68333, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.27778], "92": [0.25, 0.75, 0, 0, 0.5], "93": [0.25, 0.75, 0, 0, 0.27778], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.31, 0.12056, 0.02778, 0, 0.5], "97": [0, 0.43056, 0, 0, 0.5], "98": [0, 0.69444, 0, 0, 0.55556], "99": [0, 0.43056, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.55556], "101": [0, 0.43056, 0, 0, 0.44445], "102": [0, 0.69444, 0.07778, 0, 0.30556], "103": [0.19444, 0.43056, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.55556], "105": [0, 0.66786, 0, 0, 0.27778], "106": [0.19444, 0.66786, 0, 0, 0.30556], "107": [0, 0.69444, 0, 0, 0.52778], "108": [0, 0.69444, 0, 0, 0.27778], "109": [0, 0.43056, 0, 0, 0.83334], "110": [0, 0.43056, 0, 0, 0.55556], "111": [0, 0.43056, 0, 0, 0.5], "112": [0.19444, 0.43056, 0, 0, 0.55556], "113": [0.19444, 0.43056, 0, 0, 0.52778], "114": [0, 0.43056, 0, 0, 0.39167], "115": [0, 0.43056, 0, 0, 0.39445], "116": [0, 0.61508, 0, 0, 0.38889], "117": [0, 0.43056, 0, 0, 0.55556], "118": [0, 0.43056, 0.01389, 0, 0.52778], "119": [0, 0.43056, 0.01389, 0, 0.72222], "120": [0, 0.43056, 0, 0, 0.52778], "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], "122": [0, 0.43056, 0, 0, 0.44445], "123": [0.25, 0.75, 0, 0, 0.5], "124": [0.25, 0.75, 0, 0, 0.27778], "125": [0.25, 0.75, 0, 0, 0.5], "126": [0.35, 0.31786, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.76909], "167": [0.19444, 0.69444, 0, 0, 0.44445], "168": [0, 0.66786, 0, 0, 0.5], "172": [0, 0.43056, 0, 0, 0.66667], "176": [0, 0.69444, 0, 0, 0.75], "177": [0.08333, 0.58333, 0, 0, 0.77778], "182": [0.19444, 0.69444, 0, 0, 0.61111], "184": [0.17014, 0, 0, 0, 0.44445], "198": [0, 0.68333, 0, 0, 0.90278], "215": [0.08333, 0.58333, 0, 0, 0.77778], "216": [0.04861, 0.73194, 0, 0, 0.77778], "223": [0, 0.69444, 0, 0, 0.5], "230": [0, 0.43056, 0, 0, 0.72222], "247": [0.08333, 0.58333, 0, 0, 0.77778], "248": [0.09722, 0.52778, 0, 0, 0.5], "305": [0, 0.43056, 0, 0, 0.27778], "338": [0, 0.68333, 0, 0, 1.01389], "339": [0, 0.43056, 0, 0, 0.77778], "567": [0.19444, 0.43056, 0, 0, 0.30556], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.62847, 0, 0, 0.5], "713": [0, 0.56778, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.66786, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.75], "732": [0, 0.66786, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.68333, 0, 0, 0.625], "916": [0, 0.68333, 0, 0, 0.83334], "920": [0, 0.68333, 0, 0, 0.77778], "923": [0, 0.68333, 0, 0, 0.69445], "926": [0, 0.68333, 0, 0, 0.66667], "928": [0, 0.68333, 0, 0, 0.75], "931": [0, 0.68333, 0, 0, 0.72222], "933": [0, 0.68333, 0, 0, 0.77778], "934": [0, 0.68333, 0, 0, 0.72222], "936": [0, 0.68333, 0, 0, 0.77778], "937": [0, 0.68333, 0, 0, 0.72222], "8211": [0, 0.43056, 0.02778, 0, 0.5], "8212": [0, 0.43056, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5], "8224": [0.19444, 0.69444, 0, 0, 0.44445], "8225": [0.19444, 0.69444, 0, 0, 0.44445], "8230": [0, 0.12, 0, 0, 1.172], "8242": [0, 0.55556, 0, 0, 0.275], "8407": [0, 0.71444, 0.15382, 0, 0.5], "8463": [0, 0.68889, 0, 0, 0.54028], "8465": [0, 0.69444, 0, 0, 0.72222], "8467": [0, 0.69444, 0, 0.11111, 0.41667], "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], "8476": [0, 0.69444, 0, 0, 0.72222], "8501": [0, 0.69444, 0, 0, 0.61111], "8592": [-0.13313, 0.36687, 0, 0, 1.0], "8593": [0.19444, 0.69444, 0, 0, 0.5], "8594": [-0.13313, 0.36687, 0, 0, 1.0], "8595": [0.19444, 0.69444, 0, 0, 0.5], "8596": [-0.13313, 0.36687, 0, 0, 1.0], "8597": [0.25, 0.75, 0, 0, 0.5], "8598": [0.19444, 0.69444, 0, 0, 1.0], "8599": [0.19444, 0.69444, 0, 0, 1.0], "8600": [0.19444, 0.69444, 0, 0, 1.0], "8601": [0.19444, 0.69444, 0, 0, 1.0], "8614": [0.011, 0.511, 0, 0, 1.0], "8617": [0.011, 0.511, 0, 0, 1.126], "8618": [0.011, 0.511, 0, 0, 1.126], "8636": [-0.13313, 0.36687, 0, 0, 1.0], "8637": [-0.13313, 0.36687, 0, 0, 1.0], "8640": [-0.13313, 0.36687, 0, 0, 1.0], "8641": [-0.13313, 0.36687, 0, 0, 1.0], "8652": [0.011, 0.671, 0, 0, 1.0], "8656": [-0.13313, 0.36687, 0, 0, 1.0], "8657": [0.19444, 0.69444, 0, 0, 0.61111], "8658": [-0.13313, 0.36687, 0, 0, 1.0], "8659": [0.19444, 0.69444, 0, 0, 0.61111], "8660": [-0.13313, 0.36687, 0, 0, 1.0], "8661": [0.25, 0.75, 0, 0, 0.61111], "8704": [0, 0.69444, 0, 0, 0.55556], "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], "8707": [0, 0.69444, 0, 0, 0.55556], "8709": [0.05556, 0.75, 0, 0, 0.5], "8711": [0, 0.68333, 0, 0, 0.83334], "8712": [0.0391, 0.5391, 0, 0, 0.66667], "8715": [0.0391, 0.5391, 0, 0, 0.66667], "8722": [0.08333, 0.58333, 0, 0, 0.77778], "8723": [0.08333, 0.58333, 0, 0, 0.77778], "8725": [0.25, 0.75, 0, 0, 0.5], "8726": [0.25, 0.75, 0, 0, 0.5], "8727": [-0.03472, 0.46528, 0, 0, 0.5], "8728": [-0.05555, 0.44445, 0, 0, 0.5], "8729": [-0.05555, 0.44445, 0, 0, 0.5], "8730": [0.2, 0.8, 0, 0, 0.83334], "8733": [0, 0.43056, 0, 0, 0.77778], "8734": [0, 0.43056, 0, 0, 1.0], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.27778], "8741": [0.25, 0.75, 0, 0, 0.5], "8743": [0, 0.55556, 0, 0, 0.66667], "8744": [0, 0.55556, 0, 0, 0.66667], "8745": [0, 0.55556, 0, 0, 0.66667], "8746": [0, 0.55556, 0, 0, 0.66667], "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8768": [0.19444, 0.69444, 0, 0, 0.27778], "8771": [-0.03625, 0.46375, 0, 0, 0.77778], "8773": [-0.022, 0.589, 0, 0, 1.0], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8781": [-0.03625, 0.46375, 0, 0, 0.77778], "8784": [-0.133, 0.67, 0, 0, 0.778], "8801": [-0.03625, 0.46375, 0, 0, 0.77778], "8804": [0.13597, 0.63597, 0, 0, 0.77778], "8805": [0.13597, 0.63597, 0, 0, 0.77778], "8810": [0.0391, 0.5391, 0, 0, 1.0], "8811": [0.0391, 0.5391, 0, 0, 1.0], "8826": [0.0391, 0.5391, 0, 0, 0.77778], "8827": [0.0391, 0.5391, 0, 0, 0.77778], "8834": [0.0391, 0.5391, 0, 0, 0.77778], "8835": [0.0391, 0.5391, 0, 0, 0.77778], "8838": [0.13597, 0.63597, 0, 0, 0.77778], "8839": [0.13597, 0.63597, 0, 0, 0.77778], "8846": [0, 0.55556, 0, 0, 0.66667], "8849": [0.13597, 0.63597, 0, 0, 0.77778], "8850": [0.13597, 0.63597, 0, 0, 0.77778], "8851": [0, 0.55556, 0, 0, 0.66667], "8852": [0, 0.55556, 0, 0, 0.66667], "8853": [0.08333, 0.58333, 0, 0, 0.77778], "8854": [0.08333, 0.58333, 0, 0, 0.77778], "8855": [0.08333, 0.58333, 0, 0, 0.77778], "8856": [0.08333, 0.58333, 0, 0, 0.77778], "8857": [0.08333, 0.58333, 0, 0, 0.77778], "8866": [0, 0.69444, 0, 0, 0.61111], "8867": [0, 0.69444, 0, 0, 0.61111], "8868": [0, 0.69444, 0, 0, 0.77778], "8869": [0, 0.69444, 0, 0, 0.77778], "8872": [0.249, 0.75, 0, 0, 0.867], "8900": [-0.05555, 0.44445, 0, 0, 0.5], "8901": [-0.05555, 0.44445, 0, 0, 0.27778], "8902": [-0.03472, 0.46528, 0, 0, 0.5], "8904": [0.005, 0.505, 0, 0, 0.9], "8942": [0.03, 0.9, 0, 0, 0.278], "8943": [-0.19, 0.31, 0, 0, 1.172], "8945": [-0.1, 0.82, 0, 0, 1.282], "8968": [0.25, 0.75, 0, 0, 0.44445], "8969": [0.25, 0.75, 0, 0, 0.44445], "8970": [0.25, 0.75, 0, 0, 0.44445], "8971": [0.25, 0.75, 0, 0, 0.44445], "8994": [-0.14236, 0.35764, 0, 0, 1.0], "8995": [-0.14236, 0.35764, 0, 0, 1.0], "9136": [0.244, 0.744, 0, 0, 0.412], "9137": [0.244, 0.744, 0, 0, 0.412], "9651": [0.19444, 0.69444, 0, 0, 0.88889], "9657": [-0.03472, 0.46528, 0, 0, 0.5], "9661": [0.19444, 0.69444, 0, 0, 0.88889], "9667": [-0.03472, 0.46528, 0, 0, 0.5], "9711": [0.19444, 0.69444, 0, 0, 1.0], "9824": [0.12963, 0.69444, 0, 0, 0.77778], "9825": [0.12963, 0.69444, 0, 0, 0.77778], "9826": [0.12963, 0.69444, 0, 0, 0.77778], "9827": [0.12963, 0.69444, 0, 0, 0.77778], "9837": [0, 0.75, 0, 0, 0.38889], "9838": [0.19444, 0.69444, 0, 0, 0.38889], "9839": [0.19444, 0.69444, 0, 0, 0.38889], "10216": [0.25, 0.75, 0, 0, 0.38889], "10217": [0.25, 0.75, 0, 0, 0.38889], "10222": [0.244, 0.744, 0, 0, 0.412], "10223": [0.244, 0.744, 0, 0, 0.412], "10229": [0.011, 0.511, 0, 0, 1.609], "10230": [0.011, 0.511, 0, 0, 1.638], "10231": [0.011, 0.511, 0, 0, 1.859], "10232": [0.024, 0.525, 0, 0, 1.609], "10233": [0.024, 0.525, 0, 0, 1.638], "10234": [0.024, 0.525, 0, 0, 1.858], "10236": [0.011, 0.511, 0, 0, 1.638], "10815": [0, 0.68333, 0, 0, 0.75], "10927": [0.13597, 0.63597, 0, 0, 0.77778], "10928": [0.13597, 0.63597, 0, 0, 0.77778], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Math-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.44444, 0, 0, 0.575], "49": [0, 0.44444, 0, 0, 0.575], "50": [0, 0.44444, 0, 0, 0.575], "51": [0.19444, 0.44444, 0, 0, 0.575], "52": [0.19444, 0.44444, 0, 0, 0.575], "53": [0.19444, 0.44444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0.19444, 0.44444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0.19444, 0.44444, 0, 0, 0.575], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0.04835, 0, 0.8664], "67": [0, 0.68611, 0.06979, 0, 0.81694], "68": [0, 0.68611, 0.03194, 0, 0.93812], "69": [0, 0.68611, 0.05451, 0, 0.81007], "70": [0, 0.68611, 0.15972, 0, 0.68889], "71": [0, 0.68611, 0, 0, 0.88673], "72": [0, 0.68611, 0.08229, 0, 0.98229], "73": [0, 0.68611, 0.07778, 0, 0.51111], "74": [0, 0.68611, 0.10069, 0, 0.63125], "75": [0, 0.68611, 0.06979, 0, 0.97118], "76": [0, 0.68611, 0, 0, 0.75555], "77": [0, 0.68611, 0.11424, 0, 1.14201], "78": [0, 0.68611, 0.11424, 0, 0.95034], "79": [0, 0.68611, 0.03194, 0, 0.83666], "80": [0, 0.68611, 0.15972, 0, 0.72309], "81": [0.19444, 0.68611, 0, 0, 0.86861], "82": [0, 0.68611, 0.00421, 0, 0.87235], "83": [0, 0.68611, 0.05382, 0, 0.69271], "84": [0, 0.68611, 0.15972, 0, 0.63663], "85": [0, 0.68611, 0.11424, 0, 0.80027], "86": [0, 0.68611, 0.25555, 0, 0.67778], "87": [0, 0.68611, 0.15972, 0, 1.09305], "88": [0, 0.68611, 0.07778, 0, 0.94722], "89": [0, 0.68611, 0.25555, 0, 0.67458], "90": [0, 0.68611, 0.06979, 0, 0.77257], "97": [0, 0.44444, 0, 0, 0.63287], "98": [0, 0.69444, 0, 0, 0.52083], "99": [0, 0.44444, 0, 0, 0.51342], "100": [0, 0.69444, 0, 0, 0.60972], "101": [0, 0.44444, 0, 0, 0.55361], "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], "104": [0, 0.69444, 0, 0, 0.66759], "105": [0, 0.69326, 0, 0, 0.4048], "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], "107": [0, 0.69444, 0.01852, 0, 0.6037], "108": [0, 0.69444, 0.0088, 0, 0.34815], "109": [0, 0.44444, 0, 0, 1.0324], "110": [0, 0.44444, 0, 0, 0.71296], "111": [0, 0.44444, 0, 0, 0.58472], "112": [0.19444, 0.44444, 0, 0, 0.60092], "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], "114": [0, 0.44444, 0.03194, 0, 0.5287], "115": [0, 0.44444, 0, 0, 0.53125], "116": [0, 0.63492, 0, 0, 0.41528], "117": [0, 0.44444, 0, 0, 0.68102], "118": [0, 0.44444, 0.03704, 0, 0.56666], "119": [0, 0.44444, 0.02778, 0, 0.83148], "120": [0, 0.44444, 0, 0, 0.65903], "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], "122": [0, 0.44444, 0.04213, 0, 0.55509], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68611, 0.15972, 0, 0.65694], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0.03194, 0, 0.86722], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0.07458, 0, 0.84125], "928": [0, 0.68611, 0.08229, 0, 0.98229], "931": [0, 0.68611, 0.05451, 0, 0.88507], "933": [0, 0.68611, 0.15972, 0, 0.67083], "934": [0, 0.68611, 0, 0, 0.76666], "936": [0, 0.68611, 0.11653, 0, 0.71402], "937": [0, 0.68611, 0.04835, 0, 0.8789], "945": [0, 0.44444, 0, 0, 0.76064], "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], "948": [0, 0.69444, 0.03819, 0, 0.52222], "949": [0, 0.44444, 0, 0, 0.52882], "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], "951": [0.19444, 0.44444, 0.03704, 0, 0.6], "952": [0, 0.69444, 0.03194, 0, 0.5618], "953": [0, 0.44444, 0, 0, 0.41204], "954": [0, 0.44444, 0, 0, 0.66759], "955": [0, 0.69444, 0, 0, 0.67083], "956": [0.19444, 0.44444, 0, 0, 0.70787], "957": [0, 0.44444, 0.06898, 0, 0.57685], "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], "959": [0, 0.44444, 0, 0, 0.58472], "960": [0, 0.44444, 0.03704, 0, 0.68241], "961": [0.19444, 0.44444, 0, 0, 0.6118], "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], "963": [0, 0.44444, 0.03704, 0, 0.68588], "964": [0, 0.44444, 0.13472, 0, 0.52083], "965": [0, 0.44444, 0.03704, 0, 0.63055], "966": [0.19444, 0.44444, 0, 0, 0.74722], "967": [0.19444, 0.44444, 0, 0, 0.71805], "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], "969": [0, 0.44444, 0.03704, 0, 0.71782], "977": [0, 0.69444, 0, 0, 0.69155], "981": [0.19444, 0.69444, 0, 0, 0.7125], "982": [0, 0.44444, 0.03194, 0, 0.975], "1009": [0.19444, 0.44444, 0, 0, 0.6118], "1013": [0, 0.44444, 0, 0, 0.48333], "57649": [0, 0.44444, 0, 0, 0.39352], "57911": [0.19444, 0.44444, 0, 0, 0.43889] }, "Math-Italic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.43056, 0, 0, 0.5], "49": [0, 0.43056, 0, 0, 0.5], "50": [0, 0.43056, 0, 0, 0.5], "51": [0.19444, 0.43056, 0, 0, 0.5], "52": [0.19444, 0.43056, 0, 0, 0.5], "53": [0.19444, 0.43056, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0.19444, 0.43056, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0.19444, 0.43056, 0, 0, 0.5], "65": [0, 0.68333, 0, 0.13889, 0.75], "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], "71": [0, 0.68333, 0, 0.08334, 0.78625], "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], "76": [0, 0.68333, 0, 0.02778, 0.68056], "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], "86": [0, 0.68333, 0.22222, 0, 0.58333], "87": [0, 0.68333, 0.13889, 0, 0.94445], "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], "89": [0, 0.68333, 0.22222, 0, 0.58056], "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], "97": [0, 0.43056, 0, 0, 0.52859], "98": [0, 0.69444, 0, 0, 0.42917], "99": [0, 0.43056, 0, 0.05556, 0.43276], "100": [0, 0.69444, 0, 0.16667, 0.52049], "101": [0, 0.43056, 0, 0.05556, 0.46563], "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], "104": [0, 0.69444, 0, 0, 0.57616], "105": [0, 0.65952, 0, 0, 0.34451], "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], "107": [0, 0.69444, 0.03148, 0, 0.5206], "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], "109": [0, 0.43056, 0, 0, 0.87801], "110": [0, 0.43056, 0, 0, 0.60023], "111": [0, 0.43056, 0, 0.05556, 0.48472], "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], "115": [0, 0.43056, 0, 0.05556, 0.46875], "116": [0, 0.61508, 0, 0.08334, 0.36111], "117": [0, 0.43056, 0, 0.02778, 0.57246], "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], "120": [0, 0.43056, 0, 0.02778, 0.57153], "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], "916": [0, 0.68333, 0, 0.16667, 0.83334], "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], "923": [0, 0.68333, 0, 0.16667, 0.69445], "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], "934": [0, 0.68333, 0, 0.08334, 0.66667], "936": [0, 0.68333, 0.11, 0.05556, 0.61222], "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], "949": [0, 0.43056, 0, 0.08334, 0.46632], "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], "953": [0, 0.43056, 0, 0.05556, 0.35394], "954": [0, 0.43056, 0, 0, 0.57616], "955": [0, 0.69444, 0, 0, 0.58334], "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], "959": [0, 0.43056, 0, 0.05556, 0.48472], "960": [0, 0.43056, 0.03588, 0, 0.57003], "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], "963": [0, 0.43056, 0.03588, 0, 0.57141], "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], "969": [0, 0.43056, 0.03588, 0, 0.62245], "977": [0, 0.69444, 0, 0.08334, 0.59144], "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], "982": [0, 0.43056, 0.02778, 0, 0.82813], "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], "1013": [0, 0.43056, 0, 0.05556, 0.4059], "57649": [0, 0.43056, 0, 0.02778, 0.32246], "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403] }, "SansSerif-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.36667], "34": [0, 0.69444, 0, 0, 0.55834], "35": [0.19444, 0.69444, 0, 0, 0.91667], "36": [0.05556, 0.75, 0, 0, 0.55], "37": [0.05556, 0.75, 0, 0, 1.02912], "38": [0, 0.69444, 0, 0, 0.83056], "39": [0, 0.69444, 0, 0, 0.30556], "40": [0.25, 0.75, 0, 0, 0.42778], "41": [0.25, 0.75, 0, 0, 0.42778], "42": [0, 0.75, 0, 0, 0.55], "43": [0.11667, 0.61667, 0, 0, 0.85556], "44": [0.10556, 0.13056, 0, 0, 0.30556], "45": [0, 0.45833, 0, 0, 0.36667], "46": [0, 0.13056, 0, 0, 0.30556], "47": [0.25, 0.75, 0, 0, 0.55], "48": [0, 0.69444, 0, 0, 0.55], "49": [0, 0.69444, 0, 0, 0.55], "50": [0, 0.69444, 0, 0, 0.55], "51": [0, 0.69444, 0, 0, 0.55], "52": [0, 0.69444, 0, 0, 0.55], "53": [0, 0.69444, 0, 0, 0.55], "54": [0, 0.69444, 0, 0, 0.55], "55": [0, 0.69444, 0, 0, 0.55], "56": [0, 0.69444, 0, 0, 0.55], "57": [0, 0.69444, 0, 0, 0.55], "58": [0, 0.45833, 0, 0, 0.30556], "59": [0.10556, 0.45833, 0, 0, 0.30556], "61": [-0.09375, 0.40625, 0, 0, 0.85556], "63": [0, 0.69444, 0, 0, 0.51945], "64": [0, 0.69444, 0, 0, 0.73334], "65": [0, 0.69444, 0, 0, 0.73334], "66": [0, 0.69444, 0, 0, 0.73334], "67": [0, 0.69444, 0, 0, 0.70278], "68": [0, 0.69444, 0, 0, 0.79445], "69": [0, 0.69444, 0, 0, 0.64167], "70": [0, 0.69444, 0, 0, 0.61111], "71": [0, 0.69444, 0, 0, 0.73334], "72": [0, 0.69444, 0, 0, 0.79445], "73": [0, 0.69444, 0, 0, 0.33056], "74": [0, 0.69444, 0, 0, 0.51945], "75": [0, 0.69444, 0, 0, 0.76389], "76": [0, 0.69444, 0, 0, 0.58056], "77": [0, 0.69444, 0, 0, 0.97778], "78": [0, 0.69444, 0, 0, 0.79445], "79": [0, 0.69444, 0, 0, 0.79445], "80": [0, 0.69444, 0, 0, 0.70278], "81": [0.10556, 0.69444, 0, 0, 0.79445], "82": [0, 0.69444, 0, 0, 0.70278], "83": [0, 0.69444, 0, 0, 0.61111], "84": [0, 0.69444, 0, 0, 0.73334], "85": [0, 0.69444, 0, 0, 0.76389], "86": [0, 0.69444, 0.01528, 0, 0.73334], "87": [0, 0.69444, 0.01528, 0, 1.03889], "88": [0, 0.69444, 0, 0, 0.73334], "89": [0, 0.69444, 0.0275, 0, 0.73334], "90": [0, 0.69444, 0, 0, 0.67223], "91": [0.25, 0.75, 0, 0, 0.34306], "93": [0.25, 0.75, 0, 0, 0.34306], "94": [0, 0.69444, 0, 0, 0.55], "95": [0.35, 0.10833, 0.03056, 0, 0.55], "97": [0, 0.45833, 0, 0, 0.525], "98": [0, 0.69444, 0, 0, 0.56111], "99": [0, 0.45833, 0, 0, 0.48889], "100": [0, 0.69444, 0, 0, 0.56111], "101": [0, 0.45833, 0, 0, 0.51111], "102": [0, 0.69444, 0.07639, 0, 0.33611], "103": [0.19444, 0.45833, 0.01528, 0, 0.55], "104": [0, 0.69444, 0, 0, 0.56111], "105": [0, 0.69444, 0, 0, 0.25556], "106": [0.19444, 0.69444, 0, 0, 0.28611], "107": [0, 0.69444, 0, 0, 0.53056], "108": [0, 0.69444, 0, 0, 0.25556], "109": [0, 0.45833, 0, 0, 0.86667], "110": [0, 0.45833, 0, 0, 0.56111], "111": [0, 0.45833, 0, 0, 0.55], "112": [0.19444, 0.45833, 0, 0, 0.56111], "113": [0.19444, 0.45833, 0, 0, 0.56111], "114": [0, 0.45833, 0.01528, 0, 0.37222], "115": [0, 0.45833, 0, 0, 0.42167], "116": [0, 0.58929, 0, 0, 0.40417], "117": [0, 0.45833, 0, 0, 0.56111], "118": [0, 0.45833, 0.01528, 0, 0.5], "119": [0, 0.45833, 0.01528, 0, 0.74445], "120": [0, 0.45833, 0, 0, 0.5], "121": [0.19444, 0.45833, 0.01528, 0, 0.5], "122": [0, 0.45833, 0, 0, 0.47639], "126": [0.35, 0.34444, 0, 0, 0.55], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0, 0, 0.55], "176": [0, 0.69444, 0, 0, 0.73334], "180": [0, 0.69444, 0, 0, 0.55], "184": [0.17014, 0, 0, 0, 0.48889], "305": [0, 0.45833, 0, 0, 0.25556], "567": [0.19444, 0.45833, 0, 0, 0.28611], "710": [0, 0.69444, 0, 0, 0.55], "711": [0, 0.63542, 0, 0, 0.55], "713": [0, 0.63778, 0, 0, 0.55], "728": [0, 0.69444, 0, 0, 0.55], "729": [0, 0.69444, 0, 0, 0.30556], "730": [0, 0.69444, 0, 0, 0.73334], "732": [0, 0.69444, 0, 0, 0.55], "733": [0, 0.69444, 0, 0, 0.55], "915": [0, 0.69444, 0, 0, 0.58056], "916": [0, 0.69444, 0, 0, 0.91667], "920": [0, 0.69444, 0, 0, 0.85556], "923": [0, 0.69444, 0, 0, 0.67223], "926": [0, 0.69444, 0, 0, 0.73334], "928": [0, 0.69444, 0, 0, 0.79445], "931": [0, 0.69444, 0, 0, 0.79445], "933": [0, 0.69444, 0, 0, 0.85556], "934": [0, 0.69444, 0, 0, 0.79445], "936": [0, 0.69444, 0, 0, 0.85556], "937": [0, 0.69444, 0, 0, 0.79445], "8211": [0, 0.45833, 0.03056, 0, 0.55], "8212": [0, 0.45833, 0.03056, 0, 1.10001], "8216": [0, 0.69444, 0, 0, 0.30556], "8217": [0, 0.69444, 0, 0, 0.30556], "8220": [0, 0.69444, 0, 0, 0.55834], "8221": [0, 0.69444, 0, 0, 0.55834] }, "SansSerif-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.05733, 0, 0.31945], "34": [0, 0.69444, 0.00316, 0, 0.5], "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], "36": [0.05556, 0.75, 0.11156, 0, 0.5], "37": [0.05556, 0.75, 0.03126, 0, 0.83334], "38": [0, 0.69444, 0.03058, 0, 0.75834], "39": [0, 0.69444, 0.07816, 0, 0.27778], "40": [0.25, 0.75, 0.13164, 0, 0.38889], "41": [0.25, 0.75, 0.02536, 0, 0.38889], "42": [0, 0.75, 0.11775, 0, 0.5], "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0.01946, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0.13164, 0, 0.5], "48": [0, 0.65556, 0.11156, 0, 0.5], "49": [0, 0.65556, 0.11156, 0, 0.5], "50": [0, 0.65556, 0.11156, 0, 0.5], "51": [0, 0.65556, 0.11156, 0, 0.5], "52": [0, 0.65556, 0.11156, 0, 0.5], "53": [0, 0.65556, 0.11156, 0, 0.5], "54": [0, 0.65556, 0.11156, 0, 0.5], "55": [0, 0.65556, 0.11156, 0, 0.5], "56": [0, 0.65556, 0.11156, 0, 0.5], "57": [0, 0.65556, 0.11156, 0, 0.5], "58": [0, 0.44444, 0.02502, 0, 0.27778], "59": [0.125, 0.44444, 0.02502, 0, 0.27778], "61": [-0.13, 0.37, 0.05087, 0, 0.77778], "63": [0, 0.69444, 0.11809, 0, 0.47222], "64": [0, 0.69444, 0.07555, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0.08293, 0, 0.66667], "67": [0, 0.69444, 0.11983, 0, 0.63889], "68": [0, 0.69444, 0.07555, 0, 0.72223], "69": [0, 0.69444, 0.11983, 0, 0.59722], "70": [0, 0.69444, 0.13372, 0, 0.56945], "71": [0, 0.69444, 0.11983, 0, 0.66667], "72": [0, 0.69444, 0.08094, 0, 0.70834], "73": [0, 0.69444, 0.13372, 0, 0.27778], "74": [0, 0.69444, 0.08094, 0, 0.47222], "75": [0, 0.69444, 0.11983, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0.08094, 0, 0.875], "78": [0, 0.69444, 0.08094, 0, 0.70834], "79": [0, 0.69444, 0.07555, 0, 0.73611], "80": [0, 0.69444, 0.08293, 0, 0.63889], "81": [0.125, 0.69444, 0.07555, 0, 0.73611], "82": [0, 0.69444, 0.08293, 0, 0.64584], "83": [0, 0.69444, 0.09205, 0, 0.55556], "84": [0, 0.69444, 0.13372, 0, 0.68056], "85": [0, 0.69444, 0.08094, 0, 0.6875], "86": [0, 0.69444, 0.1615, 0, 0.66667], "87": [0, 0.69444, 0.1615, 0, 0.94445], "88": [0, 0.69444, 0.13372, 0, 0.66667], "89": [0, 0.69444, 0.17261, 0, 0.66667], "90": [0, 0.69444, 0.11983, 0, 0.61111], "91": [0.25, 0.75, 0.15942, 0, 0.28889], "93": [0.25, 0.75, 0.08719, 0, 0.28889], "94": [0, 0.69444, 0.0799, 0, 0.5], "95": [0.35, 0.09444, 0.08616, 0, 0.5], "97": [0, 0.44444, 0.00981, 0, 0.48056], "98": [0, 0.69444, 0.03057, 0, 0.51667], "99": [0, 0.44444, 0.08336, 0, 0.44445], "100": [0, 0.69444, 0.09483, 0, 0.51667], "101": [0, 0.44444, 0.06778, 0, 0.44445], "102": [0, 0.69444, 0.21705, 0, 0.30556], "103": [0.19444, 0.44444, 0.10836, 0, 0.5], "104": [0, 0.69444, 0.01778, 0, 0.51667], "105": [0, 0.67937, 0.09718, 0, 0.23889], "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], "107": [0, 0.69444, 0.08336, 0, 0.48889], "108": [0, 0.69444, 0.09483, 0, 0.23889], "109": [0, 0.44444, 0.01778, 0, 0.79445], "110": [0, 0.44444, 0.01778, 0, 0.51667], "111": [0, 0.44444, 0.06613, 0, 0.5], "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], "114": [0, 0.44444, 0.10836, 0, 0.34167], "115": [0, 0.44444, 0.0778, 0, 0.38333], "116": [0, 0.57143, 0.07225, 0, 0.36111], "117": [0, 0.44444, 0.04169, 0, 0.51667], "118": [0, 0.44444, 0.10836, 0, 0.46111], "119": [0, 0.44444, 0.10836, 0, 0.68334], "120": [0, 0.44444, 0.09169, 0, 0.46111], "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], "122": [0, 0.44444, 0.08752, 0, 0.43472], "126": [0.35, 0.32659, 0.08826, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0.06385, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.73752], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0.04169, 0, 0.23889], "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], "710": [0, 0.69444, 0.0799, 0, 0.5], "711": [0, 0.63194, 0.08432, 0, 0.5], "713": [0, 0.60889, 0.08776, 0, 0.5], "714": [0, 0.69444, 0.09205, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0.09483, 0, 0.5], "729": [0, 0.67937, 0.07774, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.73752], "732": [0, 0.67659, 0.08826, 0, 0.5], "733": [0, 0.69444, 0.09205, 0, 0.5], "915": [0, 0.69444, 0.13372, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0.07555, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0.12816, 0, 0.66667], "928": [0, 0.69444, 0.08094, 0, 0.70834], "931": [0, 0.69444, 0.11983, 0, 0.72222], "933": [0, 0.69444, 0.09031, 0, 0.77778], "934": [0, 0.69444, 0.04603, 0, 0.72222], "936": [0, 0.69444, 0.09031, 0, 0.77778], "937": [0, 0.69444, 0.08293, 0, 0.72222], "8211": [0, 0.44444, 0.08616, 0, 0.5], "8212": [0, 0.44444, 0.08616, 0, 1.0], "8216": [0, 0.69444, 0.07816, 0, 0.27778], "8217": [0, 0.69444, 0.07816, 0, 0.27778], "8220": [0, 0.69444, 0.14205, 0, 0.5], "8221": [0, 0.69444, 0.00316, 0, 0.5] }, "SansSerif-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.31945], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.75834], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.65556, 0, 0, 0.5], "49": [0, 0.65556, 0, 0, 0.5], "50": [0, 0.65556, 0, 0, 0.5], "51": [0, 0.65556, 0, 0, 0.5], "52": [0, 0.65556, 0, 0, 0.5], "53": [0, 0.65556, 0, 0, 0.5], "54": [0, 0.65556, 0, 0, 0.5], "55": [0, 0.65556, 0, 0, 0.5], "56": [0, 0.65556, 0, 0, 0.5], "57": [0, 0.65556, 0, 0, 0.5], "58": [0, 0.44444, 0, 0, 0.27778], "59": [0.125, 0.44444, 0, 0, 0.27778], "61": [-0.13, 0.37, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0, 0, 0.66667], "67": [0, 0.69444, 0, 0, 0.63889], "68": [0, 0.69444, 0, 0, 0.72223], "69": [0, 0.69444, 0, 0, 0.59722], "70": [0, 0.69444, 0, 0, 0.56945], "71": [0, 0.69444, 0, 0, 0.66667], "72": [0, 0.69444, 0, 0, 0.70834], "73": [0, 0.69444, 0, 0, 0.27778], "74": [0, 0.69444, 0, 0, 0.47222], "75": [0, 0.69444, 0, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0, 0, 0.875], "78": [0, 0.69444, 0, 0, 0.70834], "79": [0, 0.69444, 0, 0, 0.73611], "80": [0, 0.69444, 0, 0, 0.63889], "81": [0.125, 0.69444, 0, 0, 0.73611], "82": [0, 0.69444, 0, 0, 0.64584], "83": [0, 0.69444, 0, 0, 0.55556], "84": [0, 0.69444, 0, 0, 0.68056], "85": [0, 0.69444, 0, 0, 0.6875], "86": [0, 0.69444, 0.01389, 0, 0.66667], "87": [0, 0.69444, 0.01389, 0, 0.94445], "88": [0, 0.69444, 0, 0, 0.66667], "89": [0, 0.69444, 0.025, 0, 0.66667], "90": [0, 0.69444, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.28889], "93": [0.25, 0.75, 0, 0, 0.28889], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.35, 0.09444, 0.02778, 0, 0.5], "97": [0, 0.44444, 0, 0, 0.48056], "98": [0, 0.69444, 0, 0, 0.51667], "99": [0, 0.44444, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.51667], "101": [0, 0.44444, 0, 0, 0.44445], "102": [0, 0.69444, 0.06944, 0, 0.30556], "103": [0.19444, 0.44444, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.51667], "105": [0, 0.67937, 0, 0, 0.23889], "106": [0.19444, 0.67937, 0, 0, 0.26667], "107": [0, 0.69444, 0, 0, 0.48889], "108": [0, 0.69444, 0, 0, 0.23889], "109": [0, 0.44444, 0, 0, 0.79445], "110": [0, 0.44444, 0, 0, 0.51667], "111": [0, 0.44444, 0, 0, 0.5], "112": [0.19444, 0.44444, 0, 0, 0.51667], "113": [0.19444, 0.44444, 0, 0, 0.51667], "114": [0, 0.44444, 0.01389, 0, 0.34167], "115": [0, 0.44444, 0, 0, 0.38333], "116": [0, 0.57143, 0, 0, 0.36111], "117": [0, 0.44444, 0, 0, 0.51667], "118": [0, 0.44444, 0.01389, 0, 0.46111], "119": [0, 0.44444, 0.01389, 0, 0.68334], "120": [0, 0.44444, 0, 0, 0.46111], "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], "122": [0, 0.44444, 0, 0, 0.43472], "126": [0.35, 0.32659, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.66667], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0, 0, 0.23889], "567": [0.19444, 0.44444, 0, 0, 0.26667], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.63194, 0, 0, 0.5], "713": [0, 0.60889, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.67937, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.66667], "732": [0, 0.67659, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.69444, 0, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0, 0, 0.66667], "928": [0, 0.69444, 0, 0, 0.70834], "931": [0, 0.69444, 0, 0, 0.72222], "933": [0, 0.69444, 0, 0, 0.77778], "934": [0, 0.69444, 0, 0, 0.72222], "936": [0, 0.69444, 0, 0, 0.77778], "937": [0, 0.69444, 0, 0, 0.72222], "8211": [0, 0.44444, 0.02778, 0, 0.5], "8212": [0, 0.44444, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5] }, "Script-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.7, 0.22925, 0, 0.80253], "66": [0, 0.7, 0.04087, 0, 0.90757], "67": [0, 0.7, 0.1689, 0, 0.66619], "68": [0, 0.7, 0.09371, 0, 0.77443], "69": [0, 0.7, 0.18583, 0, 0.56162], "70": [0, 0.7, 0.13634, 0, 0.89544], "71": [0, 0.7, 0.17322, 0, 0.60961], "72": [0, 0.7, 0.29694, 0, 0.96919], "73": [0, 0.7, 0.19189, 0, 0.80907], "74": [0.27778, 0.7, 0.19189, 0, 1.05159], "75": [0, 0.7, 0.31259, 0, 0.91364], "76": [0, 0.7, 0.19189, 0, 0.87373], "77": [0, 0.7, 0.15981, 0, 1.08031], "78": [0, 0.7, 0.3525, 0, 0.9015], "79": [0, 0.7, 0.08078, 0, 0.73787], "80": [0, 0.7, 0.08078, 0, 1.01262], "81": [0, 0.7, 0.03305, 0, 0.88282], "82": [0, 0.7, 0.06259, 0, 0.85], "83": [0, 0.7, 0.19189, 0, 0.86767], "84": [0, 0.7, 0.29087, 0, 0.74697], "85": [0, 0.7, 0.25815, 0, 0.79996], "86": [0, 0.7, 0.27523, 0, 0.62204], "87": [0, 0.7, 0.27523, 0, 0.80532], "88": [0, 0.7, 0.26006, 0, 0.94445], "89": [0, 0.7, 0.2939, 0, 0.70961], "90": [0, 0.7, 0.24037, 0, 0.8212], "160": [0, 0, 0, 0, 0.25] }, "Size1-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.35001, 0.85, 0, 0, 0.45834], "41": [0.35001, 0.85, 0, 0, 0.45834], "47": [0.35001, 0.85, 0, 0, 0.57778], "91": [0.35001, 0.85, 0, 0, 0.41667], "92": [0.35001, 0.85, 0, 0, 0.57778], "93": [0.35001, 0.85, 0, 0, 0.41667], "123": [0.35001, 0.85, 0, 0, 0.58334], "125": [0.35001, 0.85, 0, 0, 0.58334], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.72222, 0, 0, 0.55556], "732": [0, 0.72222, 0, 0, 0.55556], "770": [0, 0.72222, 0, 0, 0.55556], "771": [0, 0.72222, 0, 0, 0.55556], "8214": [-0.00099, 0.601, 0, 0, 0.77778], "8593": [1e-05, 0.6, 0, 0, 0.66667], "8595": [1e-05, 0.6, 0, 0, 0.66667], "8657": [1e-05, 0.6, 0, 0, 0.77778], "8659": [1e-05, 0.6, 0, 0, 0.77778], "8719": [0.25001, 0.75, 0, 0, 0.94445], "8720": [0.25001, 0.75, 0, 0, 0.94445], "8721": [0.25001, 0.75, 0, 0, 1.05556], "8730": [0.35001, 0.85, 0, 0, 1.0], "8739": [-0.00599, 0.606, 0, 0, 0.33333], "8741": [-0.00599, 0.606, 0, 0, 0.55556], "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], "8748": [0.306, 0.805, 0.19445, 0, 0.47222], "8749": [0.306, 0.805, 0.19445, 0, 0.47222], "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], "8896": [0.25001, 0.75, 0, 0, 0.83334], "8897": [0.25001, 0.75, 0, 0, 0.83334], "8898": [0.25001, 0.75, 0, 0, 0.83334], "8899": [0.25001, 0.75, 0, 0, 0.83334], "8968": [0.35001, 0.85, 0, 0, 0.47222], "8969": [0.35001, 0.85, 0, 0, 0.47222], "8970": [0.35001, 0.85, 0, 0, 0.47222], "8971": [0.35001, 0.85, 0, 0, 0.47222], "9168": [-0.00099, 0.601, 0, 0, 0.66667], "10216": [0.35001, 0.85, 0, 0, 0.47222], "10217": [0.35001, 0.85, 0, 0, 0.47222], "10752": [0.25001, 0.75, 0, 0, 1.11111], "10753": [0.25001, 0.75, 0, 0, 1.11111], "10754": [0.25001, 0.75, 0, 0, 1.11111], "10756": [0.25001, 0.75, 0, 0, 0.83334], "10758": [0.25001, 0.75, 0, 0, 0.83334] }, "Size2-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.65002, 1.15, 0, 0, 0.59722], "41": [0.65002, 1.15, 0, 0, 0.59722], "47": [0.65002, 1.15, 0, 0, 0.81111], "91": [0.65002, 1.15, 0, 0, 0.47222], "92": [0.65002, 1.15, 0, 0, 0.81111], "93": [0.65002, 1.15, 0, 0, 0.47222], "123": [0.65002, 1.15, 0, 0, 0.66667], "125": [0.65002, 1.15, 0, 0, 0.66667], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.0], "732": [0, 0.75, 0, 0, 1.0], "770": [0, 0.75, 0, 0, 1.0], "771": [0, 0.75, 0, 0, 1.0], "8719": [0.55001, 1.05, 0, 0, 1.27778], "8720": [0.55001, 1.05, 0, 0, 1.27778], "8721": [0.55001, 1.05, 0, 0, 1.44445], "8730": [0.65002, 1.15, 0, 0, 1.0], "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], "8748": [0.862, 1.36, 0.44445, 0, 0.55556], "8749": [0.862, 1.36, 0.44445, 0, 0.55556], "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], "8896": [0.55001, 1.05, 0, 0, 1.11111], "8897": [0.55001, 1.05, 0, 0, 1.11111], "8898": [0.55001, 1.05, 0, 0, 1.11111], "8899": [0.55001, 1.05, 0, 0, 1.11111], "8968": [0.65002, 1.15, 0, 0, 0.52778], "8969": [0.65002, 1.15, 0, 0, 0.52778], "8970": [0.65002, 1.15, 0, 0, 0.52778], "8971": [0.65002, 1.15, 0, 0, 0.52778], "10216": [0.65002, 1.15, 0, 0, 0.61111], "10217": [0.65002, 1.15, 0, 0, 0.61111], "10752": [0.55001, 1.05, 0, 0, 1.51112], "10753": [0.55001, 1.05, 0, 0, 1.51112], "10754": [0.55001, 1.05, 0, 0, 1.51112], "10756": [0.55001, 1.05, 0, 0, 1.11111], "10758": [0.55001, 1.05, 0, 0, 1.11111] }, "Size3-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.95003, 1.45, 0, 0, 0.73611], "41": [0.95003, 1.45, 0, 0, 0.73611], "47": [0.95003, 1.45, 0, 0, 1.04445], "91": [0.95003, 1.45, 0, 0, 0.52778], "92": [0.95003, 1.45, 0, 0, 1.04445], "93": [0.95003, 1.45, 0, 0, 0.52778], "123": [0.95003, 1.45, 0, 0, 0.75], "125": [0.95003, 1.45, 0, 0, 0.75], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.44445], "732": [0, 0.75, 0, 0, 1.44445], "770": [0, 0.75, 0, 0, 1.44445], "771": [0, 0.75, 0, 0, 1.44445], "8730": [0.95003, 1.45, 0, 0, 1.0], "8968": [0.95003, 1.45, 0, 0, 0.58334], "8969": [0.95003, 1.45, 0, 0, 0.58334], "8970": [0.95003, 1.45, 0, 0, 0.58334], "8971": [0.95003, 1.45, 0, 0, 0.58334], "10216": [0.95003, 1.45, 0, 0, 0.75], "10217": [0.95003, 1.45, 0, 0, 0.75] }, "Size4-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [1.25003, 1.75, 0, 0, 0.79167], "41": [1.25003, 1.75, 0, 0, 0.79167], "47": [1.25003, 1.75, 0, 0, 1.27778], "91": [1.25003, 1.75, 0, 0, 0.58334], "92": [1.25003, 1.75, 0, 0, 1.27778], "93": [1.25003, 1.75, 0, 0, 0.58334], "123": [1.25003, 1.75, 0, 0, 0.80556], "125": [1.25003, 1.75, 0, 0, 0.80556], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.825, 0, 0, 1.8889], "732": [0, 0.825, 0, 0, 1.8889], "770": [0, 0.825, 0, 0, 1.8889], "771": [0, 0.825, 0, 0, 1.8889], "8730": [1.25003, 1.75, 0, 0, 1.0], "8968": [1.25003, 1.75, 0, 0, 0.63889], "8969": [1.25003, 1.75, 0, 0, 0.63889], "8970": [1.25003, 1.75, 0, 0, 0.63889], "8971": [1.25003, 1.75, 0, 0, 0.63889], "9115": [0.64502, 1.155, 0, 0, 0.875], "9116": [1e-05, 0.6, 0, 0, 0.875], "9117": [0.64502, 1.155, 0, 0, 0.875], "9118": [0.64502, 1.155, 0, 0, 0.875], "9119": [1e-05, 0.6, 0, 0, 0.875], "9120": [0.64502, 1.155, 0, 0, 0.875], "9121": [0.64502, 1.155, 0, 0, 0.66667], "9122": [-0.00099, 0.601, 0, 0, 0.66667], "9123": [0.64502, 1.155, 0, 0, 0.66667], "9124": [0.64502, 1.155, 0, 0, 0.66667], "9125": [-0.00099, 0.601, 0, 0, 0.66667], "9126": [0.64502, 1.155, 0, 0, 0.66667], "9127": [1e-05, 0.9, 0, 0, 0.88889], "9128": [0.65002, 1.15, 0, 0, 0.88889], "9129": [0.90001, 0, 0, 0, 0.88889], "9130": [0, 0.3, 0, 0, 0.88889], "9131": [1e-05, 0.9, 0, 0, 0.88889], "9132": [0.65002, 1.15, 0, 0, 0.88889], "9133": [0.90001, 0, 0, 0, 0.88889], "9143": [0.88502, 0.915, 0, 0, 1.05556], "10216": [1.25003, 1.75, 0, 0, 0.80556], "10217": [1.25003, 1.75, 0, 0, 0.80556], "57344": [-0.00499, 0.605, 0, 0, 1.05556], "57345": [-0.00499, 0.605, 0, 0, 1.05556], "57680": [0, 0.12, 0, 0, 0.45], "57681": [0, 0.12, 0, 0, 0.45], "57682": [0, 0.12, 0, 0, 0.45], "57683": [0, 0.12, 0, 0, 0.45] }, "Typewriter-Regular": { "32": [0, 0, 0, 0, 0.525], "33": [0, 0.61111, 0, 0, 0.525], "34": [0, 0.61111, 0, 0, 0.525], "35": [0, 0.61111, 0, 0, 0.525], "36": [0.08333, 0.69444, 0, 0, 0.525], "37": [0.08333, 0.69444, 0, 0, 0.525], "38": [0, 0.61111, 0, 0, 0.525], "39": [0, 0.61111, 0, 0, 0.525], "40": [0.08333, 0.69444, 0, 0, 0.525], "41": [0.08333, 0.69444, 0, 0, 0.525], "42": [0, 0.52083, 0, 0, 0.525], "43": [-0.08056, 0.53055, 0, 0, 0.525], "44": [0.13889, 0.125, 0, 0, 0.525], "45": [-0.08056, 0.53055, 0, 0, 0.525], "46": [0, 0.125, 0, 0, 0.525], "47": [0.08333, 0.69444, 0, 0, 0.525], "48": [0, 0.61111, 0, 0, 0.525], "49": [0, 0.61111, 0, 0, 0.525], "50": [0, 0.61111, 0, 0, 0.525], "51": [0, 0.61111, 0, 0, 0.525], "52": [0, 0.61111, 0, 0, 0.525], "53": [0, 0.61111, 0, 0, 0.525], "54": [0, 0.61111, 0, 0, 0.525], "55": [0, 0.61111, 0, 0, 0.525], "56": [0, 0.61111, 0, 0, 0.525], "57": [0, 0.61111, 0, 0, 0.525], "58": [0, 0.43056, 0, 0, 0.525], "59": [0.13889, 0.43056, 0, 0, 0.525], "60": [-0.05556, 0.55556, 0, 0, 0.525], "61": [-0.19549, 0.41562, 0, 0, 0.525], "62": [-0.05556, 0.55556, 0, 0, 0.525], "63": [0, 0.61111, 0, 0, 0.525], "64": [0, 0.61111, 0, 0, 0.525], "65": [0, 0.61111, 0, 0, 0.525], "66": [0, 0.61111, 0, 0, 0.525], "67": [0, 0.61111, 0, 0, 0.525], "68": [0, 0.61111, 0, 0, 0.525], "69": [0, 0.61111, 0, 0, 0.525], "70": [0, 0.61111, 0, 0, 0.525], "71": [0, 0.61111, 0, 0, 0.525], "72": [0, 0.61111, 0, 0, 0.525], "73": [0, 0.61111, 0, 0, 0.525], "74": [0, 0.61111, 0, 0, 0.525], "75": [0, 0.61111, 0, 0, 0.525], "76": [0, 0.61111, 0, 0, 0.525], "77": [0, 0.61111, 0, 0, 0.525], "78": [0, 0.61111, 0, 0, 0.525], "79": [0, 0.61111, 0, 0, 0.525], "80": [0, 0.61111, 0, 0, 0.525], "81": [0.13889, 0.61111, 0, 0, 0.525], "82": [0, 0.61111, 0, 0, 0.525], "83": [0, 0.61111, 0, 0, 0.525], "84": [0, 0.61111, 0, 0, 0.525], "85": [0, 0.61111, 0, 0, 0.525], "86": [0, 0.61111, 0, 0, 0.525], "87": [0, 0.61111, 0, 0, 0.525], "88": [0, 0.61111, 0, 0, 0.525], "89": [0, 0.61111, 0, 0, 0.525], "90": [0, 0.61111, 0, 0, 0.525], "91": [0.08333, 0.69444, 0, 0, 0.525], "92": [0.08333, 0.69444, 0, 0, 0.525], "93": [0.08333, 0.69444, 0, 0, 0.525], "94": [0, 0.61111, 0, 0, 0.525], "95": [0.09514, 0, 0, 0, 0.525], "96": [0, 0.61111, 0, 0, 0.525], "97": [0, 0.43056, 0, 0, 0.525], "98": [0, 0.61111, 0, 0, 0.525], "99": [0, 0.43056, 0, 0, 0.525], "100": [0, 0.61111, 0, 0, 0.525], "101": [0, 0.43056, 0, 0, 0.525], "102": [0, 0.61111, 0, 0, 0.525], "103": [0.22222, 0.43056, 0, 0, 0.525], "104": [0, 0.61111, 0, 0, 0.525], "105": [0, 0.61111, 0, 0, 0.525], "106": [0.22222, 0.61111, 0, 0, 0.525], "107": [0, 0.61111, 0, 0, 0.525], "108": [0, 0.61111, 0, 0, 0.525], "109": [0, 0.43056, 0, 0, 0.525], "110": [0, 0.43056, 0, 0, 0.525], "111": [0, 0.43056, 0, 0, 0.525], "112": [0.22222, 0.43056, 0, 0, 0.525], "113": [0.22222, 0.43056, 0, 0, 0.525], "114": [0, 0.43056, 0, 0, 0.525], "115": [0, 0.43056, 0, 0, 0.525], "116": [0, 0.55358, 0, 0, 0.525], "117": [0, 0.43056, 0, 0, 0.525], "118": [0, 0.43056, 0, 0, 0.525], "119": [0, 0.43056, 0, 0, 0.525], "120": [0, 0.43056, 0, 0, 0.525], "121": [0.22222, 0.43056, 0, 0, 0.525], "122": [0, 0.43056, 0, 0, 0.525], "123": [0.08333, 0.69444, 0, 0, 0.525], "124": [0.08333, 0.69444, 0, 0, 0.525], "125": [0.08333, 0.69444, 0, 0, 0.525], "126": [0, 0.61111, 0, 0, 0.525], "127": [0, 0.61111, 0, 0, 0.525], "160": [0, 0, 0, 0, 0.525], "176": [0, 0.61111, 0, 0, 0.525], "184": [0.19445, 0, 0, 0, 0.525], "305": [0, 0.43056, 0, 0, 0.525], "567": [0.22222, 0.43056, 0, 0, 0.525], "711": [0, 0.56597, 0, 0, 0.525], "713": [0, 0.56555, 0, 0, 0.525], "714": [0, 0.61111, 0, 0, 0.525], "715": [0, 0.61111, 0, 0, 0.525], "728": [0, 0.61111, 0, 0, 0.525], "730": [0, 0.61111, 0, 0, 0.525], "770": [0, 0.61111, 0, 0, 0.525], "771": [0, 0.61111, 0, 0, 0.525], "776": [0, 0.61111, 0, 0, 0.525], "915": [0, 0.61111, 0, 0, 0.525], "916": [0, 0.61111, 0, 0, 0.525], "920": [0, 0.61111, 0, 0, 0.525], "923": [0, 0.61111, 0, 0, 0.525], "926": [0, 0.61111, 0, 0, 0.525], "928": [0, 0.61111, 0, 0, 0.525], "931": [0, 0.61111, 0, 0, 0.525], "933": [0, 0.61111, 0, 0, 0.525], "934": [0, 0.61111, 0, 0, 0.525], "936": [0, 0.61111, 0, 0, 0.525], "937": [0, 0.61111, 0, 0, 0.525], "8216": [0, 0.61111, 0, 0, 0.525], "8217": [0, 0.61111, 0, 0, 0.525], "8242": [0, 0.61111, 0, 0, 0.525], "9251": [0.11111, 0.21944, 0, 0, 0.525] } }); // CONCATENATED MODULE: ./src/fontMetrics.js /** * This file contains metrics regarding fonts and individual symbols. The sigma * and xi variables, as well as the metricMap map contain data extracted from * TeX, TeX font metrics, and the TTF files. These data are then exposed via the * `metrics` variable and the getCharacterMetrics function. */ // In TeX, there are actually three sets of dimensions, one for each of // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are // provided in the the arrays below, in that order. // // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. // This was determined by running the following script: // // latex -interaction=nonstopmode \ // '\documentclass{article}\usepackage{amsmath}\begin{document}' \ // '$a$ \expandafter\show\the\textfont2' \ // '\expandafter\show\the\scriptfont2' \ // '\expandafter\show\the\scriptscriptfont2' \ // '\stop' // // The metrics themselves were retreived using the following commands: // // tftopl cmsy10 // tftopl cmsy7 // tftopl cmsy5 // // The output of each of these commands is quite lengthy. The only part we // care about is the FONTDIMEN section. Each value is measured in EMs. var sigmasAndXis = { slant: [0.250, 0.250, 0.250], // sigma1 space: [0.000, 0.000, 0.000], // sigma2 stretch: [0.000, 0.000, 0.000], // sigma3 shrink: [0.000, 0.000, 0.000], // sigma4 xHeight: [0.431, 0.431, 0.431], // sigma5 quad: [1.000, 1.171, 1.472], // sigma6 extraSpace: [0.000, 0.000, 0.000], // sigma7 num1: [0.677, 0.732, 0.925], // sigma8 num2: [0.394, 0.384, 0.387], // sigma9 num3: [0.444, 0.471, 0.504], // sigma10 denom1: [0.686, 0.752, 1.025], // sigma11 denom2: [0.345, 0.344, 0.532], // sigma12 sup1: [0.413, 0.503, 0.504], // sigma13 sup2: [0.363, 0.431, 0.404], // sigma14 sup3: [0.289, 0.286, 0.294], // sigma15 sub1: [0.150, 0.143, 0.200], // sigma16 sub2: [0.247, 0.286, 0.400], // sigma17 supDrop: [0.386, 0.353, 0.494], // sigma18 subDrop: [0.050, 0.071, 0.100], // sigma19 delim1: [2.390, 1.700, 1.980], // sigma20 delim2: [1.010, 1.157, 1.420], // sigma21 axisHeight: [0.250, 0.250, 0.250], // sigma22 // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; // they correspond to the font parameters of the extension fonts (family 3). // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to // match cmex7, we'd use cmex7.tfm values for script and scriptscript // values. defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049 bigOpSpacing1: [0.111, 0.111, 0.111], // xi9 bigOpSpacing2: [0.166, 0.166, 0.166], // xi10 bigOpSpacing3: [0.2, 0.2, 0.2], // xi11 bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611 bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143 // The \sqrt rule width is taken from the height of the surd character. // Since we use the same font at all sizes, this thickness doesn't scale. sqrtRuleThickness: [0.04, 0.04, 0.04], // This value determines how large a pt is, for metrics which are defined // in terms of pts. // This value is also used in katex.less; if you change it make sure the // values match. ptPerEm: [10.0, 10.0, 10.0], // The space between adjacent `|` columns in an array definition. From // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. doubleRuleSep: [0.2, 0.2, 0.2], // The width of separator lines in {array} environments. From // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm. arrayRuleWidth: [0.04, 0.04, 0.04], // Two values from LaTeX source2e: fboxsep: [0.3, 0.3, 0.3], // 3 pt / ptPerEm fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm }; // This map contains a mapping from font name and character code to character // metrics, including height, depth, italic correction, and skew (kern from the // character to the corresponding \skewchar) // This map is generated via `make metrics`. It should not be changed manually. // These are very rough approximations. We default to Times New Roman which // should have Latin-1 and Cyrillic characters, but may not depending on the // operating system. The metrics do not account for extra height from the // accents. In the case of Cyrillic characters which have both ascenders and // descenders we prefer approximations with ascenders, primarily to prevent // the fraction bar or root line from intersecting the glyph. // TODO(kevinb) allow union of multiple glyph metrics for better accuracy. var extraCharacterMap = { // Latin-1 'Å': 'A', 'Ç': 'C', 'Ð': 'D', 'Þ': 'o', 'å': 'a', 'ç': 'c', 'ð': 'd', 'þ': 'o', // Cyrillic 'А': 'A', 'Б': 'B', 'В': 'B', 'Г': 'F', 'Д': 'A', 'Е': 'E', 'Ж': 'K', 'З': '3', 'И': 'N', 'Й': 'N', 'К': 'K', 'Л': 'N', 'М': 'M', 'Н': 'H', 'О': 'O', 'П': 'N', 'Р': 'P', 'С': 'C', 'Т': 'T', 'У': 'y', 'Ф': 'O', 'Х': 'X', 'Ц': 'U', 'Ч': 'h', 'Ш': 'W', 'Щ': 'W', 'Ъ': 'B', 'Ы': 'X', 'Ь': 'B', 'Э': '3', 'Ю': 'X', 'Я': 'R', 'а': 'a', 'б': 'b', 'в': 'a', 'г': 'r', 'д': 'y', 'е': 'e', 'ж': 'm', 'з': 'e', 'и': 'n', 'й': 'n', 'к': 'n', 'л': 'n', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'n', 'р': 'p', 'с': 'c', 'т': 'o', 'у': 'y', 'ф': 'b', 'х': 'x', 'ц': 'n', 'ч': 'n', 'ш': 'w', 'щ': 'w', 'ъ': 'a', 'ы': 'm', 'ь': 'a', 'э': 'e', 'ю': 'm', 'я': 'r' }; /** * This function adds new font metrics to default metricMap * It can also override existing metrics */ function setFontMetrics(fontName, metrics) { fontMetricsData[fontName] = metrics; } /** * This function is a convenience function for looking up information in the * metricMap table. It takes a character as a string, and a font. * * Note: the `width` property may be undefined if fontMetricsData.js wasn't * built using `Make extended_metrics`. */ function getCharacterMetrics(character, font, mode) { if (!fontMetricsData[font]) { throw new Error("Font metrics not found for font: " + font + "."); } var ch = character.charCodeAt(0); var metrics = fontMetricsData[font][ch]; if (!metrics && character[0] in extraCharacterMap) { ch = extraCharacterMap[character[0]].charCodeAt(0); metrics = fontMetricsData[font][ch]; } if (!metrics && mode === 'text') { // We don't typically have font metrics for Asian scripts. // But since we support them in text mode, we need to return // some sort of metrics. // So if the character is in a script we support but we // don't have metrics for it, just use the metrics for // the Latin capital letter M. This is close enough because // we (currently) only care about the height of the glpyh // not its width. if (supportedCodepoint(ch)) { metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M' } } if (metrics) { return { depth: metrics[0], height: metrics[1], italic: metrics[2], skew: metrics[3], width: metrics[4] }; } } var fontMetricsBySizeIndex = {}; /** * Get the font metrics for a given size. */ function getGlobalMetrics(size) { var sizeIndex; if (size >= 5) { sizeIndex = 0; } else if (size >= 3) { sizeIndex = 1; } else { sizeIndex = 2; } if (!fontMetricsBySizeIndex[sizeIndex]) { var metrics = fontMetricsBySizeIndex[sizeIndex] = { cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 }; for (var key in sigmasAndXis) { if (sigmasAndXis.hasOwnProperty(key)) { metrics[key] = sigmasAndXis[key][sizeIndex]; } } } return fontMetricsBySizeIndex[sizeIndex]; } // CONCATENATED MODULE: ./src/symbols.js /** * This file holds a list of all no-argument functions and single-character * symbols (like 'a' or ';'). * * For each of the symbols, there are three properties they can have: * - font (required): the font to be used for this symbol. Either "main" (the normal font), or "ams" (the ams fonts). * - group (required): the ParseNode group type the symbol should have (i.e. "textord", "mathord", etc). See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types * - replace: the character that this symbol or function should be * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi * character in the main font). * * The outermost map in the table indicates what mode the symbols should be * accepted in (e.g. "math" or "text"). */ // Some of these have a "-token" suffix since these are also used as `ParseNode` // types for raw text tokens, and we want to avoid conflicts with higher-level // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by // looking up the `symbols` map. var ATOMS = { "bin": 1, "close": 1, "inner": 1, "open": 1, "punct": 1, "rel": 1 }; var NON_ATOMS = { "accent-token": 1, "mathord": 1, "op-token": 1, "spacing": 1, "textord": 1 }; var symbols = { "math": {}, "text": {} }; /* harmony default export */ var src_symbols = (symbols); /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { symbols[mode][name] = { font: font, group: group, replace: replace }; if (acceptUnicodeChar && replace) { symbols[mode][replace] = symbols[mode][name]; } } // Some abbreviations for commonly used strings. // This helps minify the code, and also spotting typos using jshint. // modes: var symbols_math = "math"; var symbols_text = "text"; // fonts: var main = "main"; var ams = "ams"; // groups: var symbols_accent = "accent-token"; var bin = "bin"; var symbols_close = "close"; var symbols_inner = "inner"; var mathord = "mathord"; var op = "op-token"; var symbols_open = "open"; var punct = "punct"; var rel = "rel"; var symbols_spacing = "spacing"; var symbols_textord = "textord"; // Now comes the symbol table // Relation Symbols defineSymbol(symbols_math, main, rel, "\u2261", "\\equiv", true); defineSymbol(symbols_math, main, rel, "\u227A", "\\prec", true); defineSymbol(symbols_math, main, rel, "\u227B", "\\succ", true); defineSymbol(symbols_math, main, rel, "\u223C", "\\sim", true); defineSymbol(symbols_math, main, rel, "\u22A5", "\\perp"); defineSymbol(symbols_math, main, rel, "\u2AAF", "\\preceq", true); defineSymbol(symbols_math, main, rel, "\u2AB0", "\\succeq", true); defineSymbol(symbols_math, main, rel, "\u2243", "\\simeq", true); defineSymbol(symbols_math, main, rel, "\u2223", "\\mid", true); defineSymbol(symbols_math, main, rel, "\u226A", "\\ll", true); defineSymbol(symbols_math, main, rel, "\u226B", "\\gg", true); defineSymbol(symbols_math, main, rel, "\u224D", "\\asymp", true); defineSymbol(symbols_math, main, rel, "\u2225", "\\parallel"); defineSymbol(symbols_math, main, rel, "\u22C8", "\\bowtie", true); defineSymbol(symbols_math, main, rel, "\u2323", "\\smile", true); defineSymbol(symbols_math, main, rel, "\u2291", "\\sqsubseteq", true); defineSymbol(symbols_math, main, rel, "\u2292", "\\sqsupseteq", true); defineSymbol(symbols_math, main, rel, "\u2250", "\\doteq", true); defineSymbol(symbols_math, main, rel, "\u2322", "\\frown", true); defineSymbol(symbols_math, main, rel, "\u220B", "\\ni", true); defineSymbol(symbols_math, main, rel, "\u221D", "\\propto", true); defineSymbol(symbols_math, main, rel, "\u22A2", "\\vdash", true); defineSymbol(symbols_math, main, rel, "\u22A3", "\\dashv", true); defineSymbol(symbols_math, main, rel, "\u220B", "\\owns"); // Punctuation defineSymbol(symbols_math, main, punct, ".", "\\ldotp"); defineSymbol(symbols_math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols defineSymbol(symbols_math, main, symbols_textord, "#", "\\#"); defineSymbol(symbols_text, main, symbols_textord, "#", "\\#"); defineSymbol(symbols_math, main, symbols_textord, "&", "\\&"); defineSymbol(symbols_text, main, symbols_textord, "&", "\\&"); defineSymbol(symbols_math, main, symbols_textord, "\u2135", "\\aleph", true); defineSymbol(symbols_math, main, symbols_textord, "\u2200", "\\forall", true); defineSymbol(symbols_math, main, symbols_textord, "\u210F", "\\hbar", true); defineSymbol(symbols_math, main, symbols_textord, "\u2203", "\\exists", true); defineSymbol(symbols_math, main, symbols_textord, "\u2207", "\\nabla", true); defineSymbol(symbols_math, main, symbols_textord, "\u266D", "\\flat", true); defineSymbol(symbols_math, main, symbols_textord, "\u2113", "\\ell", true); defineSymbol(symbols_math, main, symbols_textord, "\u266E", "\\natural", true); defineSymbol(symbols_math, main, symbols_textord, "\u2663", "\\clubsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u2118", "\\wp", true); defineSymbol(symbols_math, main, symbols_textord, "\u266F", "\\sharp", true); defineSymbol(symbols_math, main, symbols_textord, "\u2662", "\\diamondsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u211C", "\\Re", true); defineSymbol(symbols_math, main, symbols_textord, "\u2661", "\\heartsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u2111", "\\Im", true); defineSymbol(symbols_math, main, symbols_textord, "\u2660", "\\spadesuit", true); defineSymbol(symbols_text, main, symbols_textord, "\xA7", "\\S", true); defineSymbol(symbols_text, main, symbols_textord, "\xB6", "\\P", true); // Math and Text defineSymbol(symbols_math, main, symbols_textord, "\u2020", "\\dag"); defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\dag"); defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\textdagger"); defineSymbol(symbols_math, main, symbols_textord, "\u2021", "\\ddag"); defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\ddag"); defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters defineSymbol(symbols_math, main, symbols_close, "\u23B1", "\\rmoustache", true); defineSymbol(symbols_math, main, symbols_open, "\u23B0", "\\lmoustache", true); defineSymbol(symbols_math, main, symbols_close, "\u27EF", "\\rgroup", true); defineSymbol(symbols_math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators defineSymbol(symbols_math, main, bin, "\u2213", "\\mp", true); defineSymbol(symbols_math, main, bin, "\u2296", "\\ominus", true); defineSymbol(symbols_math, main, bin, "\u228E", "\\uplus", true); defineSymbol(symbols_math, main, bin, "\u2293", "\\sqcap", true); defineSymbol(symbols_math, main, bin, "\u2217", "\\ast"); defineSymbol(symbols_math, main, bin, "\u2294", "\\sqcup", true); defineSymbol(symbols_math, main, bin, "\u25EF", "\\bigcirc"); defineSymbol(symbols_math, main, bin, "\u2219", "\\bullet"); defineSymbol(symbols_math, main, bin, "\u2021", "\\ddagger"); defineSymbol(symbols_math, main, bin, "\u2240", "\\wr", true); defineSymbol(symbols_math, main, bin, "\u2A3F", "\\amalg"); defineSymbol(symbols_math, main, bin, "&", "\\And"); // from amsmath // Arrow Symbols defineSymbol(symbols_math, main, rel, "\u27F5", "\\longleftarrow", true); defineSymbol(symbols_math, main, rel, "\u21D0", "\\Leftarrow", true); defineSymbol(symbols_math, main, rel, "\u27F8", "\\Longleftarrow", true); defineSymbol(symbols_math, main, rel, "\u27F6", "\\longrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21D2", "\\Rightarrow", true); defineSymbol(symbols_math, main, rel, "\u27F9", "\\Longrightarrow", true); defineSymbol(symbols_math, main, rel, "\u2194", "\\leftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u27F7", "\\longleftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21D4", "\\Leftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u27FA", "\\Longleftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21A6", "\\mapsto", true); defineSymbol(symbols_math, main, rel, "\u27FC", "\\longmapsto", true); defineSymbol(symbols_math, main, rel, "\u2197", "\\nearrow", true); defineSymbol(symbols_math, main, rel, "\u21A9", "\\hookleftarrow", true); defineSymbol(symbols_math, main, rel, "\u21AA", "\\hookrightarrow", true); defineSymbol(symbols_math, main, rel, "\u2198", "\\searrow", true); defineSymbol(symbols_math, main, rel, "\u21BC", "\\leftharpoonup", true); defineSymbol(symbols_math, main, rel, "\u21C0", "\\rightharpoonup", true); defineSymbol(symbols_math, main, rel, "\u2199", "\\swarrow", true); defineSymbol(symbols_math, main, rel, "\u21BD", "\\leftharpoondown", true); defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true); defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true); defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro. defineSymbol(symbols_math, ams, rel, "\uE010", "\\@nleqslant"); defineSymbol(symbols_math, ams, rel, "\uE011", "\\@nleqq"); defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true); defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true); defineSymbol(symbols_math, ams, rel, "\uE00C", "\\@lvertneqq"); defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true); defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true); defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true); defineSymbol(symbols_math, ams, rel, "\uE006", "\\@nshortmid"); defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true); defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true); defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true); defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft"); defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true); defineSymbol(symbols_math, ams, rel, "\uE01A", "\\@varsubsetneq"); defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true); defineSymbol(symbols_math, ams, rel, "\uE017", "\\@varsubsetneqq"); defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true); defineSymbol(symbols_math, ams, rel, "\uE00F", "\\@ngeqslant"); defineSymbol(symbols_math, ams, rel, "\uE00E", "\\@ngeqq"); defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true); defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true); defineSymbol(symbols_math, ams, rel, "\uE00D", "\\@gvertneqq"); defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true); defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u22E1", "\\nsucceq", true); defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true); defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true); defineSymbol(symbols_math, ams, rel, "\uE007", "\\@nshortparallel"); defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true); defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true); defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright"); defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); defineSymbol(symbols_math, ams, rel, "\uE018", "\\@nsupseteqq"); defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true); defineSymbol(symbols_math, ams, rel, "\uE01B", "\\@varsupsetneq"); defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true); defineSymbol(symbols_math, ams, rel, "\uE019", "\\@varsupsetneqq"); defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true); defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true); defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true); defineSymbol(symbols_math, ams, rel, "\uE016", "\\@nsubseteqq"); defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd"); defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows defineSymbol(symbols_math, ams, rel, "\u219A", "\\nleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u219B", "\\nrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CD", "\\nLeftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CF", "\\nRightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21AE", "\\nleftrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc defineSymbol(symbols_math, ams, rel, "\u25B3", "\\vartriangle"); defineSymbol(symbols_math, ams, symbols_textord, "\u210F", "\\hslash"); defineSymbol(symbols_math, ams, symbols_textord, "\u25BD", "\\triangledown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\lozenge"); defineSymbol(symbols_math, ams, symbols_textord, "\u24C8", "\\circledS"); defineSymbol(symbols_math, ams, symbols_textord, "\xAE", "\\circledR"); defineSymbol(symbols_text, ams, symbols_textord, "\xAE", "\\circledR"); defineSymbol(symbols_math, ams, symbols_textord, "\u2221", "\\measuredangle", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists"); defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho"); defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime"); defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle"); defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A0", "\\blacksquare"); defineSymbol(symbols_math, ams, symbols_textord, "\u29EB", "\\blacklozenge"); defineSymbol(symbols_math, ams, symbols_textord, "\u2605", "\\bigstar"); defineSymbol(symbols_math, ams, symbols_textord, "\u2222", "\\sphericalangle", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth defineSymbol(symbols_math, ams, symbols_textord, "\xF0", "\\eth", true); defineSymbol(symbols_text, main, symbols_textord, "\xF0", "\xF0"); defineSymbol(symbols_math, ams, symbols_textord, "\u2571", "\\diagup"); defineSymbol(symbols_math, ams, symbols_textord, "\u2572", "\\diagdown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\square"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\Box"); defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen defineSymbol(symbols_math, ams, symbols_textord, "\xA5", "\\yen", true); defineSymbol(symbols_text, ams, symbols_textord, "\xA5", "\\yen", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2713", "\\checkmark", true); defineSymbol(symbols_text, ams, symbols_textord, "\u2713", "\\checkmark"); // AMS Hebrew defineSymbol(symbols_math, ams, symbols_textord, "\u2136", "\\beth", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2138", "\\daleth", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2137", "\\gimel", true); // AMS Greek defineSymbol(symbols_math, ams, symbols_textord, "\u03DD", "\\digamma", true); defineSymbol(symbols_math, ams, symbols_textord, "\u03F0", "\\varkappa"); // AMS Delimiters defineSymbol(symbols_math, ams, symbols_open, "\u250C", "\\@ulcorner", true); defineSymbol(symbols_math, ams, symbols_close, "\u2510", "\\@urcorner", true); defineSymbol(symbols_math, ams, symbols_open, "\u2514", "\\@llcorner", true); defineSymbol(symbols_math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations defineSymbol(symbols_math, ams, rel, "\u2266", "\\leqq", true); defineSymbol(symbols_math, ams, rel, "\u2A7D", "\\leqslant", true); defineSymbol(symbols_math, ams, rel, "\u2A95", "\\eqslantless", true); defineSymbol(symbols_math, ams, rel, "\u2272", "\\lesssim", true); defineSymbol(symbols_math, ams, rel, "\u2A85", "\\lessapprox", true); defineSymbol(symbols_math, ams, rel, "\u224A", "\\approxeq", true); defineSymbol(symbols_math, ams, bin, "\u22D6", "\\lessdot"); defineSymbol(symbols_math, ams, rel, "\u22D8", "\\lll", true); defineSymbol(symbols_math, ams, rel, "\u2276", "\\lessgtr", true); defineSymbol(symbols_math, ams, rel, "\u22DA", "\\lesseqgtr", true); defineSymbol(symbols_math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); defineSymbol(symbols_math, ams, rel, "\u2251", "\\doteqdot"); defineSymbol(symbols_math, ams, rel, "\u2253", "\\risingdotseq", true); defineSymbol(symbols_math, ams, rel, "\u2252", "\\fallingdotseq", true); defineSymbol(symbols_math, ams, rel, "\u223D", "\\backsim", true); defineSymbol(symbols_math, ams, rel, "\u22CD", "\\backsimeq", true); defineSymbol(symbols_math, ams, rel, "\u2AC5", "\\subseteqq", true); defineSymbol(symbols_math, ams, rel, "\u22D0", "\\Subset", true); defineSymbol(symbols_math, ams, rel, "\u228F", "\\sqsubset", true); defineSymbol(symbols_math, ams, rel, "\u227C", "\\preccurlyeq", true); defineSymbol(symbols_math, ams, rel, "\u22DE", "\\curlyeqprec", true); defineSymbol(symbols_math, ams, rel, "\u227E", "\\precsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB7", "\\precapprox", true); defineSymbol(symbols_math, ams, rel, "\u22B2", "\\vartriangleleft"); defineSymbol(symbols_math, ams, rel, "\u22B4", "\\trianglelefteq"); defineSymbol(symbols_math, ams, rel, "\u22A8", "\\vDash", true); defineSymbol(symbols_math, ams, rel, "\u22AA", "\\Vvdash", true); defineSymbol(symbols_math, ams, rel, "\u2323", "\\smallsmile"); defineSymbol(symbols_math, ams, rel, "\u2322", "\\smallfrown"); defineSymbol(symbols_math, ams, rel, "\u224F", "\\bumpeq", true); defineSymbol(symbols_math, ams, rel, "\u224E", "\\Bumpeq", true); defineSymbol(symbols_math, ams, rel, "\u2267", "\\geqq", true); defineSymbol(symbols_math, ams, rel, "\u2A7E", "\\geqslant", true); defineSymbol(symbols_math, ams, rel, "\u2A96", "\\eqslantgtr", true); defineSymbol(symbols_math, ams, rel, "\u2273", "\\gtrsim", true); defineSymbol(symbols_math, ams, rel, "\u2A86", "\\gtrapprox", true); defineSymbol(symbols_math, ams, bin, "\u22D7", "\\gtrdot"); defineSymbol(symbols_math, ams, rel, "\u22D9", "\\ggg", true); defineSymbol(symbols_math, ams, rel, "\u2277", "\\gtrless", true); defineSymbol(symbols_math, ams, rel, "\u22DB", "\\gtreqless", true); defineSymbol(symbols_math, ams, rel, "\u2A8C", "\\gtreqqless", true); defineSymbol(symbols_math, ams, rel, "\u2256", "\\eqcirc", true); defineSymbol(symbols_math, ams, rel, "\u2257", "\\circeq", true); defineSymbol(symbols_math, ams, rel, "\u225C", "\\triangleq", true); defineSymbol(symbols_math, ams, rel, "\u223C", "\\thicksim"); defineSymbol(symbols_math, ams, rel, "\u2248", "\\thickapprox"); defineSymbol(symbols_math, ams, rel, "\u2AC6", "\\supseteqq", true); defineSymbol(symbols_math, ams, rel, "\u22D1", "\\Supset", true); defineSymbol(symbols_math, ams, rel, "\u2290", "\\sqsupset", true); defineSymbol(symbols_math, ams, rel, "\u227D", "\\succcurlyeq", true); defineSymbol(symbols_math, ams, rel, "\u22DF", "\\curlyeqsucc", true); defineSymbol(symbols_math, ams, rel, "\u227F", "\\succsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB8", "\\succapprox", true); defineSymbol(symbols_math, ams, rel, "\u22B3", "\\vartriangleright"); defineSymbol(symbols_math, ams, rel, "\u22B5", "\\trianglerighteq"); defineSymbol(symbols_math, ams, rel, "\u22A9", "\\Vdash", true); defineSymbol(symbols_math, ams, rel, "\u2223", "\\shortmid"); defineSymbol(symbols_math, ams, rel, "\u2225", "\\shortparallel"); defineSymbol(symbols_math, ams, rel, "\u226C", "\\between", true); defineSymbol(symbols_math, ams, rel, "\u22D4", "\\pitchfork", true); defineSymbol(symbols_math, ams, rel, "\u221D", "\\varpropto"); defineSymbol(symbols_math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(symbols_math, ams, rel, "\u2234", "\\therefore", true); defineSymbol(symbols_math, ams, rel, "\u220D", "\\backepsilon"); defineSymbol(symbols_math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(symbols_math, ams, rel, "\u2235", "\\because", true); defineSymbol(symbols_math, ams, rel, "\u22D8", "\\llless"); defineSymbol(symbols_math, ams, rel, "\u22D9", "\\gggtr"); defineSymbol(symbols_math, ams, bin, "\u22B2", "\\lhd"); defineSymbol(symbols_math, ams, bin, "\u22B3", "\\rhd"); defineSymbol(symbols_math, ams, rel, "\u2242", "\\eqsim", true); defineSymbol(symbols_math, main, rel, "\u22C8", "\\Join"); defineSymbol(symbols_math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators defineSymbol(symbols_math, ams, bin, "\u2214", "\\dotplus", true); defineSymbol(symbols_math, ams, bin, "\u2216", "\\smallsetminus"); defineSymbol(symbols_math, ams, bin, "\u22D2", "\\Cap", true); defineSymbol(symbols_math, ams, bin, "\u22D3", "\\Cup", true); defineSymbol(symbols_math, ams, bin, "\u2A5E", "\\doublebarwedge", true); defineSymbol(symbols_math, ams, bin, "\u229F", "\\boxminus", true); defineSymbol(symbols_math, ams, bin, "\u229E", "\\boxplus", true); defineSymbol(symbols_math, ams, bin, "\u22C7", "\\divideontimes", true); defineSymbol(symbols_math, ams, bin, "\u22C9", "\\ltimes", true); defineSymbol(symbols_math, ams, bin, "\u22CA", "\\rtimes", true); defineSymbol(symbols_math, ams, bin, "\u22CB", "\\leftthreetimes", true); defineSymbol(symbols_math, ams, bin, "\u22CC", "\\rightthreetimes", true); defineSymbol(symbols_math, ams, bin, "\u22CF", "\\curlywedge", true); defineSymbol(symbols_math, ams, bin, "\u22CE", "\\curlyvee", true); defineSymbol(symbols_math, ams, bin, "\u229D", "\\circleddash", true); defineSymbol(symbols_math, ams, bin, "\u229B", "\\circledast", true); defineSymbol(symbols_math, ams, bin, "\u22C5", "\\centerdot"); defineSymbol(symbols_math, ams, bin, "\u22BA", "\\intercal", true); defineSymbol(symbols_math, ams, bin, "\u22D2", "\\doublecap"); defineSymbol(symbols_math, ams, bin, "\u22D3", "\\doublecup"); defineSymbol(symbols_math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows // Note: unicode-math maps \u21e2 to their own function \rightdasharrow. // We'll map it to AMS function \dashrightarrow. It produces the same atom. defineSymbol(symbols_math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21E0", "\\dashleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21C7", "\\leftleftarrows", true); defineSymbol(symbols_math, ams, rel, "\u21C6", "\\leftrightarrows", true); defineSymbol(symbols_math, ams, rel, "\u21DA", "\\Lleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u219E", "\\twoheadleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21A2", "\\leftarrowtail", true); defineSymbol(symbols_math, ams, rel, "\u21AB", "\\looparrowleft", true); defineSymbol(symbols_math, ams, rel, "\u21CB", "\\leftrightharpoons", true); defineSymbol(symbols_math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21BA", "\\circlearrowleft", true); defineSymbol(symbols_math, ams, rel, "\u21B0", "\\Lsh", true); defineSymbol(symbols_math, ams, rel, "\u21C8", "\\upuparrows", true); defineSymbol(symbols_math, ams, rel, "\u21BF", "\\upharpoonleft", true); defineSymbol(symbols_math, ams, rel, "\u21C3", "\\downharpoonleft", true); defineSymbol(symbols_math, ams, rel, "\u22B8", "\\multimap", true); defineSymbol(symbols_math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); defineSymbol(symbols_math, ams, rel, "\u21C9", "\\rightrightarrows", true); defineSymbol(symbols_math, ams, rel, "\u21C4", "\\rightleftarrows", true); defineSymbol(symbols_math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21A3", "\\rightarrowtail", true); defineSymbol(symbols_math, ams, rel, "\u21AC", "\\looparrowright", true); defineSymbol(symbols_math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21BB", "\\circlearrowright", true); defineSymbol(symbols_math, ams, rel, "\u21B1", "\\Rsh", true); defineSymbol(symbols_math, ams, rel, "\u21CA", "\\downdownarrows", true); defineSymbol(symbols_math, ams, rel, "\u21BE", "\\upharpoonright", true); defineSymbol(symbols_math, ams, rel, "\u21C2", "\\downharpoonright", true); defineSymbol(symbols_math, ams, rel, "\u21DD", "\\rightsquigarrow", true); defineSymbol(symbols_math, ams, rel, "\u21DD", "\\leadsto"); defineSymbol(symbols_math, ams, rel, "\u21DB", "\\Rrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21BE", "\\restriction"); defineSymbol(symbols_math, main, symbols_textord, "\u2018", "`"); defineSymbol(symbols_math, main, symbols_textord, "$", "\\$"); defineSymbol(symbols_text, main, symbols_textord, "$", "\\$"); defineSymbol(symbols_text, main, symbols_textord, "$", "\\textdollar"); defineSymbol(symbols_math, main, symbols_textord, "%", "\\%"); defineSymbol(symbols_text, main, symbols_textord, "%", "\\%"); defineSymbol(symbols_math, main, symbols_textord, "_", "\\_"); defineSymbol(symbols_text, main, symbols_textord, "_", "\\_"); defineSymbol(symbols_text, main, symbols_textord, "_", "\\textunderscore"); defineSymbol(symbols_math, main, symbols_textord, "\u2220", "\\angle", true); defineSymbol(symbols_math, main, symbols_textord, "\u221E", "\\infty", true); defineSymbol(symbols_math, main, symbols_textord, "\u2032", "\\prime"); defineSymbol(symbols_math, main, symbols_textord, "\u25B3", "\\triangle"); defineSymbol(symbols_math, main, symbols_textord, "\u0393", "\\Gamma", true); defineSymbol(symbols_math, main, symbols_textord, "\u0394", "\\Delta", true); defineSymbol(symbols_math, main, symbols_textord, "\u0398", "\\Theta", true); defineSymbol(symbols_math, main, symbols_textord, "\u039B", "\\Lambda", true); defineSymbol(symbols_math, main, symbols_textord, "\u039E", "\\Xi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A0", "\\Pi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A3", "\\Sigma", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A5", "\\Upsilon", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A6", "\\Phi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A8", "\\Psi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A9", "\\Omega", true); defineSymbol(symbols_math, main, symbols_textord, "A", "\u0391"); defineSymbol(symbols_math, main, symbols_textord, "B", "\u0392"); defineSymbol(symbols_math, main, symbols_textord, "E", "\u0395"); defineSymbol(symbols_math, main, symbols_textord, "Z", "\u0396"); defineSymbol(symbols_math, main, symbols_textord, "H", "\u0397"); defineSymbol(symbols_math, main, symbols_textord, "I", "\u0399"); defineSymbol(symbols_math, main, symbols_textord, "K", "\u039A"); defineSymbol(symbols_math, main, symbols_textord, "M", "\u039C"); defineSymbol(symbols_math, main, symbols_textord, "N", "\u039D"); defineSymbol(symbols_math, main, symbols_textord, "O", "\u039F"); defineSymbol(symbols_math, main, symbols_textord, "P", "\u03A1"); defineSymbol(symbols_math, main, symbols_textord, "T", "\u03A4"); defineSymbol(symbols_math, main, symbols_textord, "X", "\u03A7"); defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\neg", true); defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\lnot"); defineSymbol(symbols_math, main, symbols_textord, "\u22A4", "\\top"); defineSymbol(symbols_math, main, symbols_textord, "\u22A5", "\\bot"); defineSymbol(symbols_math, main, symbols_textord, "\u2205", "\\emptyset"); defineSymbol(symbols_math, ams, symbols_textord, "\u2205", "\\varnothing"); defineSymbol(symbols_math, main, mathord, "\u03B1", "\\alpha", true); defineSymbol(symbols_math, main, mathord, "\u03B2", "\\beta", true); defineSymbol(symbols_math, main, mathord, "\u03B3", "\\gamma", true); defineSymbol(symbols_math, main, mathord, "\u03B4", "\\delta", true); defineSymbol(symbols_math, main, mathord, "\u03F5", "\\epsilon", true); defineSymbol(symbols_math, main, mathord, "\u03B6", "\\zeta", true); defineSymbol(symbols_math, main, mathord, "\u03B7", "\\eta", true); defineSymbol(symbols_math, main, mathord, "\u03B8", "\\theta", true); defineSymbol(symbols_math, main, mathord, "\u03B9", "\\iota", true); defineSymbol(symbols_math, main, mathord, "\u03BA", "\\kappa", true); defineSymbol(symbols_math, main, mathord, "\u03BB", "\\lambda", true); defineSymbol(symbols_math, main, mathord, "\u03BC", "\\mu", true); defineSymbol(symbols_math, main, mathord, "\u03BD", "\\nu", true); defineSymbol(symbols_math, main, mathord, "\u03BE", "\\xi", true); defineSymbol(symbols_math, main, mathord, "\u03BF", "\\omicron", true); defineSymbol(symbols_math, main, mathord, "\u03C0", "\\pi", true); defineSymbol(symbols_math, main, mathord, "\u03C1", "\\rho", true); defineSymbol(symbols_math, main, mathord, "\u03C3", "\\sigma", true); defineSymbol(symbols_math, main, mathord, "\u03C4", "\\tau", true); defineSymbol(symbols_math, main, mathord, "\u03C5", "\\upsilon", true); defineSymbol(symbols_math, main, mathord, "\u03D5", "\\phi", true); defineSymbol(symbols_math, main, mathord, "\u03C7", "\\chi", true); defineSymbol(symbols_math, main, mathord, "\u03C8", "\\psi", true); defineSymbol(symbols_math, main, mathord, "\u03C9", "\\omega", true); defineSymbol(symbols_math, main, mathord, "\u03B5", "\\varepsilon", true); defineSymbol(symbols_math, main, mathord, "\u03D1", "\\vartheta", true); defineSymbol(symbols_math, main, mathord, "\u03D6", "\\varpi", true); defineSymbol(symbols_math, main, mathord, "\u03F1", "\\varrho", true); defineSymbol(symbols_math, main, mathord, "\u03C2", "\\varsigma", true); defineSymbol(symbols_math, main, mathord, "\u03C6", "\\varphi", true); defineSymbol(symbols_math, main, bin, "\u2217", "*"); defineSymbol(symbols_math, main, bin, "+", "+"); defineSymbol(symbols_math, main, bin, "\u2212", "-"); defineSymbol(symbols_math, main, bin, "\u22C5", "\\cdot", true); defineSymbol(symbols_math, main, bin, "\u2218", "\\circ"); defineSymbol(symbols_math, main, bin, "\xF7", "\\div", true); defineSymbol(symbols_math, main, bin, "\xB1", "\\pm", true); defineSymbol(symbols_math, main, bin, "\xD7", "\\times", true); defineSymbol(symbols_math, main, bin, "\u2229", "\\cap", true); defineSymbol(symbols_math, main, bin, "\u222A", "\\cup", true); defineSymbol(symbols_math, main, bin, "\u2216", "\\setminus"); defineSymbol(symbols_math, main, bin, "\u2227", "\\land"); defineSymbol(symbols_math, main, bin, "\u2228", "\\lor"); defineSymbol(symbols_math, main, bin, "\u2227", "\\wedge", true); defineSymbol(symbols_math, main, bin, "\u2228", "\\vee", true); defineSymbol(symbols_math, main, symbols_textord, "\u221A", "\\surd"); defineSymbol(symbols_math, main, symbols_open, "\u27E8", "\\langle", true); defineSymbol(symbols_math, main, symbols_open, "\u2223", "\\lvert"); defineSymbol(symbols_math, main, symbols_open, "\u2225", "\\lVert"); defineSymbol(symbols_math, main, symbols_close, "?", "?"); defineSymbol(symbols_math, main, symbols_close, "!", "!"); defineSymbol(symbols_math, main, symbols_close, "\u27E9", "\\rangle", true); defineSymbol(symbols_math, main, symbols_close, "\u2223", "\\rvert"); defineSymbol(symbols_math, main, symbols_close, "\u2225", "\\rVert"); defineSymbol(symbols_math, main, rel, "=", "="); defineSymbol(symbols_math, main, rel, ":", ":"); defineSymbol(symbols_math, main, rel, "\u2248", "\\approx", true); defineSymbol(symbols_math, main, rel, "\u2245", "\\cong", true); defineSymbol(symbols_math, main, rel, "\u2265", "\\ge"); defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true); defineSymbol(symbols_math, main, rel, "\u2190", "\\gets"); defineSymbol(symbols_math, main, rel, ">", "\\gt", true); defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true); defineSymbol(symbols_math, main, rel, "\uE020", "\\@not"); defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true); defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true); defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true); defineSymbol(symbols_math, main, rel, "\u2287", "\\supseteq", true); defineSymbol(symbols_math, ams, rel, "\u2288", "\\nsubseteq", true); defineSymbol(symbols_math, ams, rel, "\u2289", "\\nsupseteq", true); defineSymbol(symbols_math, main, rel, "\u22A8", "\\models"); defineSymbol(symbols_math, main, rel, "\u2190", "\\leftarrow", true); defineSymbol(symbols_math, main, rel, "\u2264", "\\le"); defineSymbol(symbols_math, main, rel, "\u2264", "\\leq", true); defineSymbol(symbols_math, main, rel, "<", "\\lt", true); defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true); defineSymbol(symbols_math, main, rel, "\u2192", "\\to"); defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true); defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\ "); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "~"); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\nobreakspace"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ "); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", " "); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\space"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\nobreakspace"); defineSymbol(symbols_math, main, symbols_spacing, null, "\\nobreak"); defineSymbol(symbols_math, main, symbols_spacing, null, "\\allowbreak"); defineSymbol(symbols_math, main, punct, ",", ","); defineSymbol(symbols_math, main, punct, ";", ";"); defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true); defineSymbol(symbols_math, ams, bin, "\u22BB", "\\veebar", true); defineSymbol(symbols_math, main, bin, "\u2299", "\\odot", true); defineSymbol(symbols_math, main, bin, "\u2295", "\\oplus", true); defineSymbol(symbols_math, main, bin, "\u2297", "\\otimes", true); defineSymbol(symbols_math, main, symbols_textord, "\u2202", "\\partial", true); defineSymbol(symbols_math, main, bin, "\u2298", "\\oslash", true); defineSymbol(symbols_math, ams, bin, "\u229A", "\\circledcirc", true); defineSymbol(symbols_math, ams, bin, "\u22A1", "\\boxdot", true); defineSymbol(symbols_math, main, bin, "\u25B3", "\\bigtriangleup"); defineSymbol(symbols_math, main, bin, "\u25BD", "\\bigtriangledown"); defineSymbol(symbols_math, main, bin, "\u2020", "\\dagger"); defineSymbol(symbols_math, main, bin, "\u22C4", "\\diamond"); defineSymbol(symbols_math, main, bin, "\u22C6", "\\star"); defineSymbol(symbols_math, main, bin, "\u25C3", "\\triangleleft"); defineSymbol(symbols_math, main, bin, "\u25B9", "\\triangleright"); defineSymbol(symbols_math, main, symbols_open, "{", "\\{"); defineSymbol(symbols_text, main, symbols_textord, "{", "\\{"); defineSymbol(symbols_text, main, symbols_textord, "{", "\\textbraceleft"); defineSymbol(symbols_math, main, symbols_close, "}", "\\}"); defineSymbol(symbols_text, main, symbols_textord, "}", "\\}"); defineSymbol(symbols_text, main, symbols_textord, "}", "\\textbraceright"); defineSymbol(symbols_math, main, symbols_open, "{", "\\lbrace"); defineSymbol(symbols_math, main, symbols_close, "}", "\\rbrace"); defineSymbol(symbols_math, main, symbols_open, "[", "\\lbrack", true); defineSymbol(symbols_text, main, symbols_textord, "[", "\\lbrack", true); defineSymbol(symbols_math, main, symbols_close, "]", "\\rbrack", true); defineSymbol(symbols_text, main, symbols_textord, "]", "\\rbrack", true); defineSymbol(symbols_math, main, symbols_open, "(", "\\lparen", true); defineSymbol(symbols_math, main, symbols_close, ")", "\\rparen", true); defineSymbol(symbols_text, main, symbols_textord, "<", "\\textless", true); // in T1 fontenc defineSymbol(symbols_text, main, symbols_textord, ">", "\\textgreater", true); // in T1 fontenc defineSymbol(symbols_math, main, symbols_open, "\u230A", "\\lfloor", true); defineSymbol(symbols_math, main, symbols_close, "\u230B", "\\rfloor", true); defineSymbol(symbols_math, main, symbols_open, "\u2308", "\\lceil", true); defineSymbol(symbols_math, main, symbols_close, "\u2309", "\\rceil", true); defineSymbol(symbols_math, main, symbols_textord, "\\", "\\backslash"); defineSymbol(symbols_math, main, symbols_textord, "\u2223", "|"); defineSymbol(symbols_math, main, symbols_textord, "\u2223", "\\vert"); defineSymbol(symbols_text, main, symbols_textord, "|", "\\textbar", true); // in T1 fontenc defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|"); defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert"); defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl"); defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde"); defineSymbol(symbols_text, main, symbols_textord, "\\", "\\textbackslash"); defineSymbol(symbols_text, main, symbols_textord, "^", "\\textasciicircum"); defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true); defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true); defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true); defineSymbol(symbols_math, main, rel, "\u21D3", "\\Downarrow", true); defineSymbol(symbols_math, main, rel, "\u2195", "\\updownarrow", true); defineSymbol(symbols_math, main, rel, "\u21D5", "\\Updownarrow", true); defineSymbol(symbols_math, main, op, "\u2210", "\\coprod"); defineSymbol(symbols_math, main, op, "\u22C1", "\\bigvee"); defineSymbol(symbols_math, main, op, "\u22C0", "\\bigwedge"); defineSymbol(symbols_math, main, op, "\u2A04", "\\biguplus"); defineSymbol(symbols_math, main, op, "\u22C2", "\\bigcap"); defineSymbol(symbols_math, main, op, "\u22C3", "\\bigcup"); defineSymbol(symbols_math, main, op, "\u222B", "\\int"); defineSymbol(symbols_math, main, op, "\u222B", "\\intop"); defineSymbol(symbols_math, main, op, "\u222C", "\\iint"); defineSymbol(symbols_math, main, op, "\u222D", "\\iiint"); defineSymbol(symbols_math, main, op, "\u220F", "\\prod"); defineSymbol(symbols_math, main, op, "\u2211", "\\sum"); defineSymbol(symbols_math, main, op, "\u2A02", "\\bigotimes"); defineSymbol(symbols_math, main, op, "\u2A01", "\\bigoplus"); defineSymbol(symbols_math, main, op, "\u2A00", "\\bigodot"); defineSymbol(symbols_math, main, op, "\u222E", "\\oint"); defineSymbol(symbols_math, main, op, "\u2A06", "\\bigsqcup"); defineSymbol(symbols_math, main, op, "\u222B", "\\smallint"); defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\textellipsis"); defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\mathellipsis"); defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\ldots", true); defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\ldots", true); defineSymbol(symbols_math, main, symbols_inner, "\u22EF", "\\@cdots", true); defineSymbol(symbols_math, main, symbols_inner, "\u22F1", "\\ddots", true); defineSymbol(symbols_math, main, symbols_textord, "\u22EE", "\\varvdots"); // \vdots is a macro defineSymbol(symbols_math, main, symbols_accent, "\u02CA", "\\acute"); defineSymbol(symbols_math, main, symbols_accent, "\u02CB", "\\grave"); defineSymbol(symbols_math, main, symbols_accent, "\xA8", "\\ddot"); defineSymbol(symbols_math, main, symbols_accent, "~", "\\tilde"); defineSymbol(symbols_math, main, symbols_accent, "\u02C9", "\\bar"); defineSymbol(symbols_math, main, symbols_accent, "\u02D8", "\\breve"); defineSymbol(symbols_math, main, symbols_accent, "\u02C7", "\\check"); defineSymbol(symbols_math, main, symbols_accent, "^", "\\hat"); defineSymbol(symbols_math, main, symbols_accent, "\u20D7", "\\vec"); defineSymbol(symbols_math, main, symbols_accent, "\u02D9", "\\dot"); defineSymbol(symbols_math, main, symbols_accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA defineSymbol(symbols_math, main, mathord, "\uE131", "\\@imath"); defineSymbol(symbols_math, main, mathord, "\uE237", "\\@jmath"); defineSymbol(symbols_math, main, symbols_textord, "\u0131", "\u0131"); defineSymbol(symbols_math, main, symbols_textord, "\u0237", "\u0237"); defineSymbol(symbols_text, main, symbols_textord, "\u0131", "\\i", true); defineSymbol(symbols_text, main, symbols_textord, "\u0237", "\\j", true); defineSymbol(symbols_text, main, symbols_textord, "\xDF", "\\ss", true); defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true); defineSymbol(symbols_text, main, symbols_textord, "\u0153", "\\oe", true); defineSymbol(symbols_text, main, symbols_textord, "\xF8", "\\o", true); defineSymbol(symbols_text, main, symbols_textord, "\xC6", "\\AE", true); defineSymbol(symbols_text, main, symbols_textord, "\u0152", "\\OE", true); defineSymbol(symbols_text, main, symbols_textord, "\xD8", "\\O", true); defineSymbol(symbols_text, main, symbols_accent, "\u02CA", "\\'"); // acute defineSymbol(symbols_text, main, symbols_accent, "\u02CB", "\\`"); // grave defineSymbol(symbols_text, main, symbols_accent, "\u02C6", "\\^"); // circumflex defineSymbol(symbols_text, main, symbols_accent, "\u02DC", "\\~"); // tilde defineSymbol(symbols_text, main, symbols_accent, "\u02C9", "\\="); // macron defineSymbol(symbols_text, main, symbols_accent, "\u02D8", "\\u"); // breve defineSymbol(symbols_text, main, symbols_accent, "\u02D9", "\\."); // dot above defineSymbol(symbols_text, main, symbols_accent, "\u02DA", "\\r"); // ring above defineSymbol(symbols_text, main, symbols_accent, "\u02C7", "\\v"); // caron defineSymbol(symbols_text, main, symbols_accent, "\xA8", '\\"'); // diaresis defineSymbol(symbols_text, main, symbols_accent, "\u02DD", "\\H"); // double acute defineSymbol(symbols_text, main, symbols_accent, "\u25EF", "\\textcircled"); // \bigcirc glyph // These ligatures are detected and created in Parser.js's `formLigatures`. var ligatures = { "--": true, "---": true, "``": true, "''": true }; defineSymbol(symbols_text, main, symbols_textord, "\u2013", "--", true); defineSymbol(symbols_text, main, symbols_textord, "\u2013", "\\textendash"); defineSymbol(symbols_text, main, symbols_textord, "\u2014", "---", true); defineSymbol(symbols_text, main, symbols_textord, "\u2014", "\\textemdash"); defineSymbol(symbols_text, main, symbols_textord, "\u2018", "`", true); defineSymbol(symbols_text, main, symbols_textord, "\u2018", "\\textquoteleft"); defineSymbol(symbols_text, main, symbols_textord, "\u2019", "'", true); defineSymbol(symbols_text, main, symbols_textord, "\u2019", "\\textquoteright"); defineSymbol(symbols_text, main, symbols_textord, "\u201C", "``", true); defineSymbol(symbols_text, main, symbols_textord, "\u201C", "\\textquotedblleft"); defineSymbol(symbols_text, main, symbols_textord, "\u201D", "''", true); defineSymbol(symbols_text, main, symbols_textord, "\u201D", "\\textquotedblright"); // \degree from gensymb package defineSymbol(symbols_math, main, symbols_textord, "\xB0", "\\degree", true); defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\degree"); // \textdegree from inputenc package defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math // mode, but among our fonts, only Main-Regular defines this character "163". defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\pounds"); defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\mathsterling", true); defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\pounds"); defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\textsterling", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese"); defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. // All of these are textords in math mode var mathTextSymbols = "0123456789/@.\""; for (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) { var symbols_ch = mathTextSymbols.charAt(symbols_i); defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch); } // All of these are textords in text mode var textSymbols = "0123456789!@*()-=+\";:?/.,"; for (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) { var _ch = textSymbols.charAt(src_symbols_i); defineSymbol(symbols_text, main, symbols_textord, _ch, _ch); } // All of these are textords in text mode, and mathords in math mode var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) { var _ch2 = letters.charAt(symbols_i2); defineSymbol(symbols_math, main, mathord, _ch2, _ch2); defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2); } // Blackboard bold and script letters in Unicode range defineSymbol(symbols_math, ams, symbols_textord, "C", "\u2102"); // blackboard bold defineSymbol(symbols_text, ams, symbols_textord, "C", "\u2102"); defineSymbol(symbols_math, ams, symbols_textord, "H", "\u210D"); defineSymbol(symbols_text, ams, symbols_textord, "H", "\u210D"); defineSymbol(symbols_math, ams, symbols_textord, "N", "\u2115"); defineSymbol(symbols_text, ams, symbols_textord, "N", "\u2115"); defineSymbol(symbols_math, ams, symbols_textord, "P", "\u2119"); defineSymbol(symbols_text, ams, symbols_textord, "P", "\u2119"); defineSymbol(symbols_math, ams, symbols_textord, "Q", "\u211A"); defineSymbol(symbols_text, ams, symbols_textord, "Q", "\u211A"); defineSymbol(symbols_math, ams, symbols_textord, "R", "\u211D"); defineSymbol(symbols_text, ams, symbols_textord, "R", "\u211D"); defineSymbol(symbols_math, ams, symbols_textord, "Z", "\u2124"); defineSymbol(symbols_text, ams, symbols_textord, "Z", "\u2124"); defineSymbol(symbols_math, main, mathord, "h", "\u210E"); // italic h, Planck constant defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters. // We support some letters in the Unicode range U+1D400 to U+1D7FF, // Mathematical Alphanumeric Symbols. // Some editors do not deal well with wide characters. So don't write the // string into this file. Instead, create the string from the surrogate pair. var symbols_wideChar = ""; for (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) { var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair. // 0xD835 is the high surrogate for all letters in the range we support. // 0xDC00 is the low surrogate for bold A. symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); if (symbols_i3 < 26) { // KaTeX fonts have only capital letters for blackboard bold and script. // See exception for k below. symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); } // TODO: Add bold script when it is supported by a KaTeX font. } // "k" is the only double struck lower case letter in the KaTeX fonts. symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals for (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) { var _ch4 = symbols_i4.toString(); symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); } // We add these Latin-1 letters as symbols for backwards-compatibility, // but they are not actually in the font, nor are they supported by the // Unicode accent mechanism, so they fall back to Times font and look ugly. // TODO(edemaine): Fix this. var extraLatin = "\xC7\xD0\xDE\xE7\xFE"; for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { var _ch5 = extraLatin.charAt(_i5); defineSymbol(symbols_math, main, mathord, _ch5, _ch5); defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5); } // CONCATENATED MODULE: ./src/wide-character.js /** * This file provides support for Unicode range U+1D400 to U+1D7FF, * Mathematical Alphanumeric Symbols. * * Function wideCharacterFont takes a wide character as input and returns * the font information necessary to render it properly. */ /** * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf * That document sorts characters into groups by font type, say bold or italic. * * In the arrays below, each subarray consists three elements: * * The CSS class of that group when in math mode. * * The CSS class of that group when in text mode. * * The font name, so that KaTeX can get font metrics. */ var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright ["mathbf", "textbf", "Main-Bold"], // a-z bold upright ["mathnormal", "textit", "Math-Italic"], // A-Z italic ["mathnormal", "textit", "Math-Italic"], // a-z italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic // Map fancy A-Z letters to script, not calligraphic. // This aligns with unicode-math and math fonts (except Cambria Math). ["mathscr", "textscr", "Script-Regular"], // A-Z script ["", "", ""], // a-z script. No font ["", "", ""], // A-Z bold script. No font ["", "", ""], // a-z bold script. No font ["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur ["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur ["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck ["mathbb", "textbb", "AMS-Regular"], // k double-struck ["", "", ""], // A-Z bold Fraktur No font metrics ["", "", ""], // a-z bold Fraktur. No font. ["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif ["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif ["", "", ""], // A-Z bold italic sans. No font ["", "", ""], // a-z bold italic sans. No font ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace ["mathtt", "texttt", "Typewriter-Regular"]]; var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold ["", "", ""], // 0-9 double-struck. No KaTeX font. ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif ["mathtt", "texttt", "Typewriter-Regular"]]; var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) { // IE doesn't support codePointAt(). So work with the surrogate pair. var H = wideChar.charCodeAt(0); // high surrogate var L = wideChar.charCodeAt(1); // low surrogate var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; var j = mode === "math" ? 0 : 1; // column index for CSS class. if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { // wideLatinLetterData contains exactly 26 chars on each row. // So we can calculate the relevant row. No traverse necessary. var i = Math.floor((codePoint - 0x1D400) / 26); return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { // Numerals, ten per row. var _i = Math.floor((codePoint - 0x1D7CE) / 10); return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { // dotless i or j return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) { // Greek letters. Not supported, yet. return ["", ""]; } else { // We don't support any wide characters outside 1D400–1D7FF. throw new src_ParseError("Unsupported character: " + wideChar); } }; // CONCATENATED MODULE: ./src/Options.js /** * This file contains information about the options that the Parser carries * around with it while parsing. Data is held in an `Options` object, and when * recursing, a new `Options` object can be created with the `.with*` and * `.reset` functions. */ var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. // The size mappings are taken from TeX with \normalsize=10pt. [1, 1, 1], // size1: [5, 5, 5] \tiny [2, 1, 1], // size2: [6, 5, 5] [3, 1, 1], // size3: [7, 5, 5] \scriptsize [4, 2, 1], // size4: [8, 6, 5] \footnotesize [5, 2, 1], // size5: [9, 6, 5] \small [6, 3, 1], // size6: [10, 7, 5] \normalsize [7, 4, 2], // size7: [12, 8, 6] \large [8, 6, 3], // size8: [14.4, 10, 7] \Large [9, 7, 6], // size9: [17.28, 12, 10] \LARGE [10, 8, 7], // size10: [20.74, 14.4, 12] \huge [11, 10, 9]]; var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if // you change size indexes, change that function. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; var sizeAtStyle = function sizeAtStyle(size, style) { return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; }; // In these types, "" (empty string) means "no change". /** * This is the main options class. It contains the current style, size, color, * and font. * * Options objects should not be modified. To create a new Options with * different properties, call a `.having*` method. */ var Options_Options = /*#__PURE__*/ function () { // A font family applies to a group of fonts (i.e. SansSerif), while a font // represents a specific font (i.e. SansSerif Bold). // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm /** * The base size index. */ function Options(data) { this.style = void 0; this.color = void 0; this.size = void 0; this.textSize = void 0; this.phantom = void 0; this.font = void 0; this.fontFamily = void 0; this.fontWeight = void 0; this.fontShape = void 0; this.sizeMultiplier = void 0; this.maxSize = void 0; this.minRuleThickness = void 0; this._fontMetrics = void 0; this.style = data.style; this.color = data.color; this.size = data.size || Options.BASESIZE; this.textSize = data.textSize || this.size; this.phantom = !!data.phantom; this.font = data.font || ""; this.fontFamily = data.fontFamily || ""; this.fontWeight = data.fontWeight || ''; this.fontShape = data.fontShape || ''; this.sizeMultiplier = sizeMultipliers[this.size - 1]; this.maxSize = data.maxSize; this.minRuleThickness = data.minRuleThickness; this._fontMetrics = undefined; } /** * Returns a new options object with the same properties as "this". Properties * from "extension" will be copied to the new options object. */ var _proto = Options.prototype; _proto.extend = function extend(extension) { var data = { style: this.style, size: this.size, textSize: this.textSize, color: this.color, phantom: this.phantom, font: this.font, fontFamily: this.fontFamily, fontWeight: this.fontWeight, fontShape: this.fontShape, maxSize: this.maxSize, minRuleThickness: this.minRuleThickness }; for (var key in extension) { if (extension.hasOwnProperty(key)) { data[key] = extension[key]; } } return new Options(data); } /** * Return an options object with the given style. If `this.style === style`, * returns `this`. */ ; _proto.havingStyle = function havingStyle(style) { if (this.style === style) { return this; } else { return this.extend({ style: style, size: sizeAtStyle(this.textSize, style) }); } } /** * Return an options object with a cramped version of the current style. If * the current style is cramped, returns `this`. */ ; _proto.havingCrampedStyle = function havingCrampedStyle() { return this.havingStyle(this.style.cramp()); } /** * Return an options object with the given size and in at least `\textstyle`. * Returns `this` if appropriate. */ ; _proto.havingSize = function havingSize(size) { if (this.size === size && this.textSize === size) { return this; } else { return this.extend({ style: this.style.text(), size: size, textSize: size, sizeMultiplier: sizeMultipliers[size - 1] }); } } /** * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, * changes to at least `\textstyle`. */ ; _proto.havingBaseStyle = function havingBaseStyle(style) { style = style || this.style.text(); var wantSize = sizeAtStyle(Options.BASESIZE, style); if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { return this; } else { return this.extend({ style: style, size: wantSize }); } } /** * Remove the effect of sizing changes such as \Huge. * Keep the effect of the current style, such as \scriptstyle. */ ; _proto.havingBaseSizing = function havingBaseSizing() { var size; switch (this.style.id) { case 4: case 5: size = 3; // normalsize in scriptstyle break; case 6: case 7: size = 1; // normalsize in scriptscriptstyle break; default: size = 6; // normalsize in textstyle or displaystyle } return this.extend({ style: this.style.text(), size: size }); } /** * Create a new options object with the given color. */ ; _proto.withColor = function withColor(color) { return this.extend({ color: color }); } /** * Create a new options object with "phantom" set to true. */ ; _proto.withPhantom = function withPhantom() { return this.extend({ phantom: true }); } /** * Creates a new options object with the given math font or old text font. * @type {[type]} */ ; _proto.withFont = function withFont(font) { return this.extend({ font: font }); } /** * Create a new options objects with the given fontFamily. */ ; _proto.withTextFontFamily = function withTextFontFamily(fontFamily) { return this.extend({ fontFamily: fontFamily, font: "" }); } /** * Creates a new options object with the given font weight */ ; _proto.withTextFontWeight = function withTextFontWeight(fontWeight) { return this.extend({ fontWeight: fontWeight, font: "" }); } /** * Creates a new options object with the given font weight */ ; _proto.withTextFontShape = function withTextFontShape(fontShape) { return this.extend({ fontShape: fontShape, font: "" }); } /** * Return the CSS sizing classes required to switch from enclosing options * `oldOptions` to `this`. Returns an array of classes. */ ; _proto.sizingClasses = function sizingClasses(oldOptions) { if (oldOptions.size !== this.size) { return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; } else { return []; } } /** * Return the CSS sizing classes required to switch to the base size. Like * `this.havingSize(BASESIZE).sizingClasses(this)`. */ ; _proto.baseSizingClasses = function baseSizingClasses() { if (this.size !== Options.BASESIZE) { return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; } else { return []; } } /** * Return the font metrics for this size. */ ; _proto.fontMetrics = function fontMetrics() { if (!this._fontMetrics) { this._fontMetrics = getGlobalMetrics(this.size); } return this._fontMetrics; } /** * Gets the CSS color of the current options object */ ; _proto.getColor = function getColor() { if (this.phantom) { return "transparent"; } else { return this.color; } }; return Options; }(); Options_Options.BASESIZE = 6; /* harmony default export */ var src_Options = (Options_Options); // CONCATENATED MODULE: ./src/units.js /** * This file does conversion between units. In particular, it provides * calculateSize to convert other units into ems. */ // This table gives the number of TeX pts in one of each *absolute* TeX unit. // Thus, multiplying a length by this number converts the length from units // into pts. Dividing the result by ptPerEm gives the number of ems // *assuming* a font size of ptPerEm (normal size, normal style). var ptPerUnit = { // https://en.wikibooks.org/wiki/LaTeX/Lengths and // https://tex.stackexchange.com/a/8263 "pt": 1, // TeX point "mm": 7227 / 2540, // millimeter "cm": 7227 / 254, // centimeter "in": 72.27, // inch "bp": 803 / 800, // big (PostScript) points "pc": 12, // pica "dd": 1238 / 1157, // didot "cc": 14856 / 1157, // cicero (12 didot) "nd": 685 / 642, // new didot "nc": 1370 / 107, // new cicero (12 new didot) "sp": 1 / 65536, // scaled point (TeX's internal smallest unit) // https://tex.stackexchange.com/a/41371 "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX }; // Dictionary of relative units, for fast validity testing. var relativeUnit = { "ex": true, "em": true, "mu": true }; /** * Determine whether the specified unit (either a string defining the unit * or a "size" parse node containing a unit field) is valid. */ var validUnit = function validUnit(unit) { if (typeof unit !== "string") { unit = unit.unit; } return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; }; /* * Convert a "size" parse node (with numeric "number" and string "unit" fields, * as parsed by functions.js argType "size") into a CSS em value for the * current style/scale. `options` gives the current options. */ var units_calculateSize = function calculateSize(sizeValue, options) { var scale; if (sizeValue.unit in ptPerUnit) { // Absolute units scale = ptPerUnit[sizeValue.unit] // Convert unit to pt / options.fontMetrics().ptPerEm // Convert pt to CSS em / options.sizeMultiplier; // Unscale to make absolute units } else if (sizeValue.unit === "mu") { // `mu` units scale with scriptstyle/scriptscriptstyle. scale = options.fontMetrics().cssEmPerMu; } else { // Other relative units always refer to the *textstyle* font // in the current size. var unitOptions; if (options.style.isTight()) { // isTight() means current style is script/scriptscript. unitOptions = options.havingStyle(options.style.text()); } else { unitOptions = options; } // TODO: In TeX these units are relative to the quad of the current // *text* font, e.g. cmr10. KaTeX instead uses values from the // comparably-sized *Computer Modern symbol* font. At 10pt, these // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. // TeX \showlists shows a kern of 1.13889 * fontsize; // KaTeX shows a kern of 1.171 * fontsize. if (sizeValue.unit === "ex") { scale = unitOptions.fontMetrics().xHeight; } else if (sizeValue.unit === "em") { scale = unitOptions.fontMetrics().quad; } else { throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'"); } if (unitOptions !== options) { scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; } } return Math.min(sizeValue.number * scale, options.maxSize); }; // CONCATENATED MODULE: ./src/buildCommon.js /* eslint no-console:0 */ /** * This module contains general functions that can be used for building * different kinds of domTree nodes in a consistent manner. */ /** * Looks up the given symbol in fontMetrics, after applying any symbol * replacements defined in symbol.js */ var buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. fontName, mode) { // Replace the value with its replaced value from symbol.js if (src_symbols[mode][value] && src_symbols[mode][value].replace) { value = src_symbols[mode][value].replace; } return { value: value, metrics: getCharacterMetrics(value, fontName, mode) }; }; /** * Makes a symbolNode after translation via the list of symbols in symbols.js. * Correctly pulls out metrics for the character, and optionally takes a list of * classes to be attached to the node. * * TODO: make argument order closer to makeSpan * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. * TODO(#953): Make `options` mandatory and always pass it in. */ var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { var lookup = buildCommon_lookupSymbol(value, fontName, mode); var metrics = lookup.metrics; value = lookup.value; var symbolNode; if (metrics) { var italic = metrics.italic; if (mode === "text" || options && options.font === "mathit") { italic = 0; } symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); } else { // TODO(emily): Figure out a good way to only print this in development typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'")); symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes); } if (options) { symbolNode.maxFontSize = options.sizeMultiplier; if (options.style.isTight()) { symbolNode.classes.push("mtight"); } var color = options.getColor(); if (color) { symbolNode.style.color = color; } } return symbolNode; }; /** * Makes a symbol in Main-Regular or AMS-Regular. * Used for rel, bin, open, close, inner, and punct. */ var buildCommon_mathsym = function mathsym(value, mode, options, classes) { if (classes === void 0) { classes = []; } // Decide what font to render the symbol in by its entry in the symbols // table. // Have a special case for when the value = \ because the \ is used as a // textord in unsupported command errors but cannot be parsed as a regular // text ordinal and is therefore not present as a symbol in the symbols // table for text, as well as a special case for boldsymbol because it // can be used for bold + and - if (options.font === "boldsymbol" && buildCommon_lookupSymbol(value, "Main-Bold", mode).metrics) { return buildCommon_makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); } else if (value === "\\" || src_symbols[mode][value].font === "main") { return buildCommon_makeSymbol(value, "Main-Regular", mode, options, classes); } else { return buildCommon_makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); } }; /** * Determines which of the two font names (Main-Bold and Math-BoldItalic) and * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol", * depending on the symbol. Use this function instead of fontMap for font * "boldsymbol". */ var boldsymbol = function boldsymbol(value, mode, options, classes, type) { if (type !== "textord" && buildCommon_lookupSymbol(value, "Math-BoldItalic", mode).metrics) { return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" }; } else { // Some glyphs do not exist in Math-BoldItalic so we need to use // Main-Bold instead. return { fontName: "Main-Bold", fontClass: "mathbf" }; } }; /** * Makes either a mathord or textord in the correct font and color. */ var buildCommon_makeOrd = function makeOrd(group, options, type) { var mode = group.mode; var text = group.text; var classes = ["mord"]; // Math mode or Old font (i.e. \rm) var isFont = mode === "math" || mode === "text" && options.font; var fontOrFamily = isFont ? options.font : options.fontFamily; if (text.charCodeAt(0) === 0xD835) { // surrogate pairs get special treatment var _wideCharacterFont = wide_character_wideCharacterFont(text, mode), wideFontName = _wideCharacterFont[0], wideFontClass = _wideCharacterFont[1]; return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); } else if (fontOrFamily) { var fontName; var fontClasses; if (fontOrFamily === "boldsymbol") { var fontData = boldsymbol(text, mode, options, classes, type); fontName = fontData.fontName; fontClasses = [fontData.fontClass]; } else if (isFont) { fontName = fontMap[fontOrFamily].fontName; fontClasses = [fontOrFamily]; } else { fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; } if (buildCommon_lookupSymbol(text, fontName, mode).metrics) { return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { // Deconstruct ligatures in monospace fonts (\texttt, \tt). var parts = []; for (var i = 0; i < text.length; i++) { parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); } return buildCommon_makeFragment(parts); } } // Makes a symbol in the default font for mathords and textords. if (type === "mathord") { return buildCommon_makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); } else if (type === "textord") { var font = src_symbols[mode][text] && src_symbols[mode][text].font; if (font === "ams") { var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); } else if (font === "main" || !font) { var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); } else { // fonts added by plugins var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); } } else { throw new Error("unexpected type: " + type + " in makeOrd"); } }; /** * Returns true if subsequent symbolNodes have the same classes, skew, maxFont, * and styles. */ var buildCommon_canCombine = function canCombine(prev, next) { if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { return false; } for (var style in prev.style) { if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { return false; } } for (var _style in next.style) { if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) { return false; } } return true; }; /** * Combine consequetive domTree.symbolNodes into a single symbolNode. * Note: this function mutates the argument. */ var buildCommon_tryCombineChars = function tryCombineChars(chars) { for (var i = 0; i < chars.length - 1; i++) { var prev = chars[i]; var next = chars[i + 1]; if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) { prev.text += next.text; prev.height = Math.max(prev.height, next.height); prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use // it to add padding to the right of the span created from // the combined characters. prev.italic = next.italic; chars.splice(i + 1, 1); i--; } } return chars; }; /** * Calculate the height, depth, and maxFontSize of an element based on its * children. */ var sizeElementFromChildren = function sizeElementFromChildren(elem) { var height = 0; var depth = 0; var maxFontSize = 0; for (var i = 0; i < elem.children.length; i++) { var child = elem.children[i]; if (child.height > height) { height = child.height; } if (child.depth > depth) { depth = child.depth; } if (child.maxFontSize > maxFontSize) { maxFontSize = child.maxFontSize; } } elem.height = height; elem.depth = depth; elem.maxFontSize = maxFontSize; }; /** * Makes a span with the given list of classes, list of children, and options. * * TODO(#953): Ensure that `options` is always provided (currently some call * sites don't pass it) and make the type below mandatory. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. */ var buildCommon_makeSpan = function makeSpan(classes, children, options, style) { var span = new domTree_Span(classes, children, options, style); sizeElementFromChildren(span); return span; }; // SVG one is simpler -- doesn't require height, depth, max-font setting. // This is also a separate method for typesafety. var buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) { return new domTree_Span(classes, children, options, style); }; var makeLineSpan = function makeLineSpan(className, options, thickness) { var line = buildCommon_makeSpan([className], [], options); line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness); line.style.borderBottomWidth = line.height + "em"; line.maxFontSize = 1.0; return line; }; /** * Makes an anchor with the given href, list of classes, list of children, * and options. */ var buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) { var anchor = new domTree_Anchor(href, classes, children, options); sizeElementFromChildren(anchor); return anchor; }; /** * Makes a document fragment with the given list of children. */ var buildCommon_makeFragment = function makeFragment(children) { var fragment = new tree_DocumentFragment(children); sizeElementFromChildren(fragment); return fragment; }; /** * Wraps group in a span if it's a document fragment, allowing to apply classes * and styles */ var buildCommon_wrapFragment = function wrapFragment(group, options) { if (group instanceof tree_DocumentFragment) { return buildCommon_makeSpan([], [group], options); } return group; }; // These are exact object types to catch typos in the names of the optional fields. // Computes the updated `children` list and the overall depth. // // This helper function for makeVList makes it easier to enforce type safety by // allowing early exits (returns) in the logic. var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { if (params.positionType === "individualShift") { var oldChildren = params.children; var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be // shifted to the correct specified shift var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; var currPos = _depth; for (var i = 1; i < oldChildren.length; i++) { var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); currPos = currPos + diff; children.push({ type: "kern", size: size }); children.push(oldChildren[i]); } return { children: children, depth: _depth }; } var depth; if (params.positionType === "top") { // We always start at the bottom, so calculate the bottom by adding up // all the sizes var bottom = params.positionData; for (var _i = 0; _i < params.children.length; _i++) { var child = params.children[_i]; bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; } depth = bottom; } else if (params.positionType === "bottom") { depth = -params.positionData; } else { var firstChild = params.children[0]; if (firstChild.type !== "elem") { throw new Error('First child must have type "elem".'); } if (params.positionType === "shift") { depth = -firstChild.elem.depth - params.positionData; } else if (params.positionType === "firstBaseline") { depth = -firstChild.elem.depth; } else { throw new Error("Invalid positionType " + params.positionType + "."); } } return { children: params.children, depth: depth }; }; /** * Makes a vertical list by stacking elements and kerns on top of each other. * Allows for many different ways of specifying the positioning method. * * See VListParam documentation above. */ var buildCommon_makeVList = function makeVList(params, options) { var _getVListChildrenAndD = getVListChildrenAndDepth(params), children = _getVListChildrenAndD.children, depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to // each item, where it will determine the item's baseline. Since it has // `overflow:hidden`, the strut's top edge will sit on the item's line box's // top edge and the strut's bottom edge will sit on the item's baseline, // with no additional line-height spacing. This allows the item baseline to // be positioned precisely without worrying about font ascent and // line-height. var pstrutSize = 0; for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.type === "elem") { var elem = child.elem; pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); } } pstrutSize += 2; var pstrut = buildCommon_makeSpan(["pstrut"], []); pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets var realChildren = []; var minPos = depth; var maxPos = depth; var currPos = depth; for (var _i2 = 0; _i2 < children.length; _i2++) { var _child = children[_i2]; if (_child.type === "kern") { currPos += _child.size; } else { var _elem = _child.elem; var classes = _child.wrapperClasses || []; var style = _child.wrapperStyle || {}; var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style); childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em"; if (_child.marginLeft) { childWrap.style.marginLeft = _child.marginLeft; } if (_child.marginRight) { childWrap.style.marginRight = _child.marginRight; } realChildren.push(childWrap); currPos += _elem.height + _elem.depth; } minPos = Math.min(minPos, currPos); maxPos = Math.max(maxPos, currPos); } // The vlist contents go in a table-cell with `vertical-align:bottom`. // This cell's bottom edge will determine the containing table's baseline // without overly expanding the containing line-box. var vlist = buildCommon_makeSpan(["vlist"], realChildren); vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. var rows; if (minPos < 0) { // We will define depth in an empty span with display: table-cell. // It should render with the height that we define. But Chrome, in // contenteditable mode only, treats that span as if it contains some // text content. And that min-height over-rides our desired height. // So we put another empty span inside the depth strut span. var emptySpan = buildCommon_makeSpan([], []); var depthStrut = buildCommon_makeSpan(["vlist"], [emptySpan]); depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it // puts the bottom of the *second* row on the baseline. var topStrut = buildCommon_makeSpan(["vlist-s"], [new domTree_SymbolNode("\u200B")]); rows = [buildCommon_makeSpan(["vlist-r"], [vlist, topStrut]), buildCommon_makeSpan(["vlist-r"], [depthStrut])]; } else { rows = [buildCommon_makeSpan(["vlist-r"], [vlist])]; } var vtable = buildCommon_makeSpan(["vlist-t"], rows); if (rows.length === 2) { vtable.classes.push("vlist-t2"); } vtable.height = maxPos; vtable.depth = -minPos; return vtable; }; // Glue is a concept from TeX which is a flexible space between elements in // either a vertical or horizontal list. In KaTeX, at least for now, it's // static space between elements in a horizontal layout. var buildCommon_makeGlue = function makeGlue(measurement, options) { // Make an empty span for the space var rule = buildCommon_makeSpan(["mspace"], [], options); var size = units_calculateSize(measurement, options); rule.style.marginRight = size + "em"; return rule; }; // Takes font options, and returns the appropriate fontLookup name var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { var baseFontName = ""; switch (fontFamily) { case "amsrm": baseFontName = "AMS"; break; case "textrm": baseFontName = "Main"; break; case "textsf": baseFontName = "SansSerif"; break; case "texttt": baseFontName = "Typewriter"; break; default: baseFontName = fontFamily; // use fonts added by a plugin } var fontStylesName; if (fontWeight === "textbf" && fontShape === "textit") { fontStylesName = "BoldItalic"; } else if (fontWeight === "textbf") { fontStylesName = "Bold"; } else if (fontWeight === "textit") { fontStylesName = "Italic"; } else { fontStylesName = "Regular"; } return baseFontName + "-" + fontStylesName; }; /** * Maps TeX font commands to objects containing: * - variant: string used for "mathvariant" attribute in buildMathML.js * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics */ // A map between tex font commands an MathML mathvariant attribute values var fontMap = { // styles "mathbf": { variant: "bold", fontName: "Main-Bold" }, "mathrm": { variant: "normal", fontName: "Main-Regular" }, "textit": { variant: "italic", fontName: "Main-Italic" }, "mathit": { variant: "italic", fontName: "Main-Italic" }, "mathnormal": { variant: "italic", fontName: "Math-Italic" }, // "boldsymbol" is missing because they require the use of multiple fonts: // Math-BoldItalic and Main-Bold. This is handled by a special case in // makeOrd which ends up calling boldsymbol. // families "mathbb": { variant: "double-struck", fontName: "AMS-Regular" }, "mathcal": { variant: "script", fontName: "Caligraphic-Regular" }, "mathfrak": { variant: "fraktur", fontName: "Fraktur-Regular" }, "mathscr": { variant: "script", fontName: "Script-Regular" }, "mathsf": { variant: "sans-serif", fontName: "SansSerif-Regular" }, "mathtt": { variant: "monospace", fontName: "Typewriter-Regular" } }; var svgData = { // path, width, height vec: ["vec", 0.471, 0.714], // values from the font glyph oiintSize1: ["oiintSize1", 0.957, 0.499], // oval to overlay the integrand oiintSize2: ["oiintSize2", 1.472, 0.659], oiiintSize1: ["oiiintSize1", 1.304, 0.499], oiiintSize2: ["oiiintSize2", 1.98, 0.659], leftParenInner: ["leftParenInner", 0.875, 0.3], rightParenInner: ["rightParenInner", 0.875, 0.3] }; var buildCommon_staticSvg = function staticSvg(value, options) { // Create a span with inline SVG for the element. var _svgData$value = svgData[value], pathName = _svgData$value[0], width = _svgData$value[1], height = _svgData$value[2]; var path = new domTree_PathNode(pathName); var svgNode = new SvgNode([path], { "width": width + "em", "height": height + "em", // Override CSS rule `.katex svg { width: 100% }` "style": "width:" + width + "em", "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, "preserveAspectRatio": "xMinYMin" }); var span = buildCommon_makeSvgSpan(["overlay"], [svgNode], options); span.height = height; span.style.height = height + "em"; span.style.width = width + "em"; return span; }; /* harmony default export */ var buildCommon = ({ fontMap: fontMap, makeSymbol: buildCommon_makeSymbol, mathsym: buildCommon_mathsym, makeSpan: buildCommon_makeSpan, makeSvgSpan: buildCommon_makeSvgSpan, makeLineSpan: makeLineSpan, makeAnchor: buildCommon_makeAnchor, makeFragment: buildCommon_makeFragment, wrapFragment: buildCommon_wrapFragment, makeVList: buildCommon_makeVList, makeOrd: buildCommon_makeOrd, makeGlue: buildCommon_makeGlue, staticSvg: buildCommon_staticSvg, svgData: svgData, tryCombineChars: buildCommon_tryCombineChars }); // CONCATENATED MODULE: ./src/spacingData.js /** * Describes spaces between different classes of atoms. */ var thinspace = { number: 3, unit: "mu" }; var mediumspace = { number: 4, unit: "mu" }; var thickspace = { number: 5, unit: "mu" }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // Spacing relationships for display and text styles var spacings = { mord: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mop: { mord: thinspace, mop: thinspace, mrel: thickspace, minner: thinspace }, mbin: { mord: mediumspace, mop: mediumspace, mopen: mediumspace, minner: mediumspace }, mrel: { mord: thickspace, mop: thickspace, mopen: thickspace, minner: thickspace }, mopen: {}, mclose: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mpunct: { mord: thinspace, mop: thinspace, mrel: thickspace, mopen: thinspace, mclose: thinspace, mpunct: thinspace, minner: thinspace }, minner: { mord: thinspace, mop: thinspace, mbin: mediumspace, mrel: thickspace, mopen: thinspace, mpunct: thinspace, minner: thinspace } }; // Spacing relationships for script and scriptscript styles var tightSpacings = { mord: { mop: thinspace }, mop: { mord: thinspace, mop: thinspace }, mbin: {}, mrel: {}, mopen: {}, mclose: { mop: thinspace }, mpunct: {}, minner: { mop: thinspace } }; // CONCATENATED MODULE: ./src/defineFunction.js /** Context provided to function handlers for error messages. */ // Note: reverse the order of the return type union will cause a flow error. // See https://github.com/facebook/flow/issues/3663. // More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types) // whose presence impacts super/subscripting. In this case, ParseNode<"supsub"> // delegates its HTML building to the HtmlBuilder corresponding to these nodes. /** * Final function spec for use at parse time. * This is almost identical to `FunctionPropSpec`, except it * 1. includes the function handler, and * 2. requires all arguments except argTypes. * It is generated by `defineFunction()` below. */ /** * All registered functions. * `functions.js` just exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary. */ var _functions = {}; /** * All HTML builders. Should be only used in the `define*` and the `build*ML` * functions. */ var _htmlGroupBuilders = {}; /** * All MathML builders. Should be only used in the `define*` and the `build*ML` * functions. */ var _mathmlGroupBuilders = {}; function defineFunction(_ref) { var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of functions var data = { type: type, numArgs: props.numArgs, argTypes: props.argTypes, greediness: props.greediness === undefined ? 1 : props.greediness, allowedInText: !!props.allowedInText, allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, numOptionalArgs: props.numOptionalArgs || 0, infix: !!props.infix, handler: handler }; for (var i = 0; i < names.length; ++i) { _functions[names[i]] = data; } if (type) { if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } } /** * Use this to register only the HTML and MathML builders for a function (e.g. * if the function's ParseNode is generated in Parser.js rather than via a * stand-alone handler provided to `defineFunction`). */ function defineFunctionBuilders(_ref2) { var type = _ref2.type, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder; defineFunction({ type: type, names: [], props: { numArgs: 0 }, handler: function handler() { throw new Error('Should never be called.'); }, htmlBuilder: htmlBuilder, mathmlBuilder: mathmlBuilder }); } // Since the corresponding buildHTML/buildMathML function expects a // list of elements, we normalize for different kinds of arguments var ordargument = function ordargument(arg) { return arg.type === "ordgroup" ? arg.body : [arg]; }; // CONCATENATED MODULE: ./src/buildHTML.js /** * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. * Then, the buildExpression, buildGroup, and various groupBuilders functions * are called, to produce a final HTML tree. */ var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, // and the text before Rule 19. var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; var styleMap = { "display": src_Style.DISPLAY, "text": src_Style.TEXT, "script": src_Style.SCRIPT, "scriptscript": src_Style.SCRIPTSCRIPT }; var DomEnum = { mord: "mord", mop: "mop", mbin: "mbin", mrel: "mrel", mopen: "mopen", mclose: "mclose", mpunct: "mpunct", minner: "minner" }; /** * Take a list of nodes, build them in order, and return a list of the built * nodes. documentFragments are flattened into their contents, so the * returned list contains no fragments. `isRealGroup` is true if `expression` * is a real group (no atoms will be added on either side), as opposed to * a partial group (e.g. one created by \color). `surrounding` is an array * consisting type of nodes that will be added to the left and right. */ var buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { if (surrounding === void 0) { surrounding = [null, null]; } // Parse expressions into `groups`. var groups = []; for (var i = 0; i < expression.length; i++) { var output = buildHTML_buildGroup(expression[i], options); if (output instanceof tree_DocumentFragment) { var children = output.children; groups.push.apply(groups, children); } else { groups.push(output); } } // If `expression` is a partial group, let the parent handle spacings // to avoid processing groups multiple times. if (!isRealGroup) { return groups; } var glueOptions = options; if (expression.length === 1) { var node = expression[0]; if (node.type === "sizing") { glueOptions = options.havingSize(node.size); } else if (node.type === "styling") { glueOptions = options.havingStyle(styleMap[node.style]); } } // Dummy spans for determining spacings between surrounding atoms. // If `expression` has no atoms on the left or right, class "leftmost" // or "rightmost", respectively, is used to indicate it. var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options); var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element // of its `classes` array. A later cleanup should ensure this, for // instance by changing the signature of `makeSpan`. // Before determining what spaces to insert, perform bin cancellation. // Binary operators change to ordinary symbols in some contexts. var isRoot = isRealGroup === "root"; traverseNonSpaceNodes(groups, function (node, prev) { var prevType = prev.classes[0]; var type = node.classes[0]; if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { prev.classes[0] = "mord"; } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) { node.classes[0] = "mord"; } }, { node: dummyPrev }, dummyNext, isRoot); traverseNonSpaceNodes(groups, function (node, prev) { var prevType = getTypeOfDomTree(prev); var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style. var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null; if (space) { // Insert glue (spacing) after the `prev`. return buildCommon.makeGlue(space, glueOptions); } }, { node: dummyPrev }, dummyNext, isRoot); return groups; }; // Depth-first traverse non-space `nodes`, calling `callback` with the current and // previous node as arguments, optionally returning a node to insert after the // previous node. `prev` is an object with the previous node and `insertAfter` // function to insert after it. `next` is a node that will be added to the right. // Used for bin cancellation and inserting spacings. var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) { if (next) { // temporarily append the right node, if exists nodes.push(next); } var i = 0; for (; i < nodes.length; i++) { var node = nodes[i]; var partialGroup = buildHTML_checkPartialGroup(node); if (partialGroup) { // Recursive DFS // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot); continue; } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit // spacing should go between atoms of different classes var nonspace = !node.hasClass("mspace"); if (nonspace) { var result = callback(node, prev.node); if (result) { if (prev.insertAfter) { prev.insertAfter(result); } else { // insert at front nodes.unshift(result); i++; } } } if (nonspace) { prev.node = node; } else if (isRoot && node.hasClass("newline")) { prev.node = buildHTML_makeSpan(["leftmost"]); // treat like beginning of line } prev.insertAfter = function (index) { return function (n) { nodes.splice(index + 1, 0, n); i++; }; }(i); } if (next) { nodes.pop(); } }; // Check if given node is a partial group, i.e., does not affect spacing around. var buildHTML_checkPartialGroup = function checkPartialGroup(node) { if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor || node instanceof domTree_Span && node.hasClass("enclosing")) { return node; } return null; }; // Return the outermost node of a domTree. var getOutermostNode = function getOutermostNode(node, side) { var partialGroup = buildHTML_checkPartialGroup(node); if (partialGroup) { var children = partialGroup.children; if (children.length) { if (side === "right") { return getOutermostNode(children[children.length - 1], "right"); } else if (side === "left") { return getOutermostNode(children[0], "left"); } } } return node; }; // Return math atom class (mclass) of a domTree. // If `side` is given, it will get the type of the outermost node at given side. var getTypeOfDomTree = function getTypeOfDomTree(node, side) { if (!node) { return null; } if (side) { node = getOutermostNode(node, side); } // This makes a lot of assumptions as to where the type of atom // appears. We should do a better job of enforcing this. return DomEnum[node.classes[0]] || null; }; var makeNullDelimiter = function makeNullDelimiter(options, classes) { var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); return buildHTML_makeSpan(classes.concat(moreClasses)); }; /** * buildGroup is the function that takes a group and calls the correct groupType * function for it. It also handles the interaction of size and style changes * between parents and children. */ var buildHTML_buildGroup = function buildGroup(group, options, baseOptions) { if (!group) { return buildHTML_makeSpan(); } if (_htmlGroupBuilders[group.type]) { // Call the groupBuilders function var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account // for that size difference. if (baseOptions && options.size !== baseOptions.size) { groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options); var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; groupNode.height *= multiplier; groupNode.depth *= multiplier; } return groupNode; } else { throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) * into an unbreakable HTML node of class .base, with proper struts to * guarantee correct vertical extent. `buildHTML` calls this repeatedly to * make up the entire expression as a sequence of unbreakable units. */ function buildHTMLUnbreakable(children, options) { // Compute height and depth of this chunk. var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at // the height of the expression, and the bottom of the HTML element // falls at the depth of the expression. var strut = buildHTML_makeSpan(["strut"]); strut.style.height = body.height + body.depth + "em"; strut.style.verticalAlign = -body.depth + "em"; body.children.unshift(strut); return body; } /** * Take an entire parse tree, and build it into an appropriate set of HTML * nodes. */ function buildHTML(tree, options) { // Strip off outer tag wrapper for processing below. var tag = null; if (tree.length === 1 && tree[0].type === "tag") { tag = tree[0].tag; tree = tree[0].body; } // Build the expression contained in the tree var expression = buildHTML_buildExpression(tree, options, "root"); var children = []; // Create one base node for each chunk between potential line breaks. // The TeXBook [p.173] says "A formula will be broken only after a // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary // operation symbol like $+$ or $-$ or $\times$, where the relation or // binary operation is on the ``outer level'' of the formula (i.e., not // enclosed in {...} and not part of an \over construction)." var parts = []; for (var i = 0; i < expression.length; i++) { parts.push(expression[i]); if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { // Put any post-operator glue on same line as operator. // Watch for \nobreak along the way, and stop at \newline. var nobreak = false; while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) { i++; parts.push(expression[i]); if (expression[i].hasClass("nobreak")) { nobreak = true; } } // Don't allow break if \nobreak among the post-operator glue. if (!nobreak) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } } else if (expression[i].hasClass("newline")) { // Write the line except the newline parts.pop(); if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } // Put the newline at the top level children.push(expression[i]); } } if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); } // Now, if there was a tag, build it too and append it as a final child. var tagChild; if (tag) { tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true)); tagChild.classes = ["tag"]; children.push(tagChild); } var htmlNode = buildHTML_makeSpan(["katex-html"], children); htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children // (the height of the enclosing htmlNode) for proper vertical alignment. if (tagChild) { var strut = tagChild.children[0]; strut.style.height = htmlNode.height + htmlNode.depth + "em"; strut.style.verticalAlign = -htmlNode.depth + "em"; } return htmlNode; } // CONCATENATED MODULE: ./src/mathMLTree.js /** * These objects store data about MathML nodes. This is the MathML equivalent * of the types in domTree.js. Since MathML handles its own rendering, and * since we're mainly using MathML to improve accessibility, we don't manage * any of the styling state that the plain DOM nodes do. * * The `toNode` and `toMarkup` functions work simlarly to how they do in * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. */ function newDocumentFragment(children) { return new tree_DocumentFragment(children); } /** * This node represents a general purpose MathML node of any type. The * constructor requires the type of node to create (for example, `"mo"` or * `"mspace"`, corresponding to `` and `` tags). */ var mathMLTree_MathNode = /*#__PURE__*/ function () { function MathNode(type, children) { this.type = void 0; this.attributes = void 0; this.children = void 0; this.type = type; this.attributes = {}; this.children = children || []; } /** * Sets an attribute on a MathML node. MathML depends on attributes to convey a * semantic content, so this is used heavily. */ var _proto = MathNode.prototype; _proto.setAttribute = function setAttribute(name, value) { this.attributes[name] = value; } /** * Gets an attribute on a MathML node. */ ; _proto.getAttribute = function getAttribute(name) { return this.attributes[name]; } /** * Converts the math node into a MathML-namespaced DOM element. */ ; _proto.toNode = function toNode() { var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; } /** * Converts the math node into an HTML markup string. */ ; _proto.toMarkup = function toMarkup() { var markup = "<" + this.type; // Add the attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { markup += " " + attr + "=\""; markup += utils.escape(this.attributes[attr]); markup += "\""; } } markup += ">"; for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ""; return markup; } /** * Converts the math node into a string, similar to innerText, but escaped. */ ; _proto.toText = function toText() { return this.children.map(function (child) { return child.toText(); }).join(""); }; return MathNode; }(); /** * This node represents a piece of text. */ var mathMLTree_TextNode = /*#__PURE__*/ function () { function TextNode(text) { this.text = void 0; this.text = text; } /** * Converts the text node into a DOM text node. */ var _proto2 = TextNode.prototype; _proto2.toNode = function toNode() { return document.createTextNode(this.text); } /** * Converts the text node into escaped HTML markup * (representing the text itself). */ ; _proto2.toMarkup = function toMarkup() { return utils.escape(this.toText()); } /** * Converts the text node into a string * (representing the text iteself). */ ; _proto2.toText = function toText() { return this.text; }; return TextNode; }(); /** * This node represents a space, but may render as or as text, * depending on the width. */ var SpaceNode = /*#__PURE__*/ function () { /** * Create a Space node with width given in CSS ems. */ function SpaceNode(width) { this.width = void 0; this.character = void 0; this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html // for a table of space-like characters. We use Unicode // representations instead of &LongNames; as it's not clear how to // make the latter via document.createTextNode. if (width >= 0.05555 && width <= 0.05556) { this.character = "\u200A"; //   } else if (width >= 0.1666 && width <= 0.1667) { this.character = "\u2009"; //   } else if (width >= 0.2222 && width <= 0.2223) { this.character = "\u2005"; //   } else if (width >= 0.2777 && width <= 0.2778) { this.character = "\u2005\u200A"; //    } else if (width >= -0.05556 && width <= -0.05555) { this.character = "\u200A\u2063"; // ​ } else if (width >= -0.1667 && width <= -0.1666) { this.character = "\u2009\u2063"; // ​ } else if (width >= -0.2223 && width <= -0.2222) { this.character = "\u205F\u2063"; // ​ } else if (width >= -0.2778 && width <= -0.2777) { this.character = "\u2005\u2063"; // ​ } else { this.character = null; } } /** * Converts the math node into a MathML-namespaced DOM element. */ var _proto3 = SpaceNode.prototype; _proto3.toNode = function toNode() { if (this.character) { return document.createTextNode(this.character); } else { var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); node.setAttribute("width", this.width + "em"); return node; } } /** * Converts the math node into an HTML markup string. */ ; _proto3.toMarkup = function toMarkup() { if (this.character) { return "" + this.character + ""; } else { return ""; } } /** * Converts the math node into a string, similar to innerText. */ ; _proto3.toText = function toText() { if (this.character) { return this.character; } else { return " "; } }; return SpaceNode; }(); /* harmony default export */ var mathMLTree = ({ MathNode: mathMLTree_MathNode, TextNode: mathMLTree_TextNode, SpaceNode: SpaceNode, newDocumentFragment: newDocumentFragment }); // CONCATENATED MODULE: ./src/buildMathML.js /** * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the * parser. */ /** * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ var buildMathML_makeText = function makeText(text, mode, options) { if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { text = src_symbols[mode][text].replace; } return new mathMLTree.TextNode(text); }; /** * Wrap the given array of nodes in an node if needed, i.e., * unless the array has length 1. Always returns a single node. */ var buildMathML_makeRow = function makeRow(body) { if (body.length === 1) { return body[0]; } else { return new mathMLTree.MathNode("mrow", body); } }; /** * Returns the math variant as a string or null if none is required. */ var buildMathML_getVariant = function getVariant(group, options) { // Handle \text... font specifiers as best we can. // MathML has a limited list of allowable mathvariant specifiers; see // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt if (options.fontFamily === "texttt") { return "monospace"; } else if (options.fontFamily === "textsf") { if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "sans-serif-bold-italic"; } else if (options.fontShape === "textit") { return "sans-serif-italic"; } else if (options.fontWeight === "textbf") { return "bold-sans-serif"; } else { return "sans-serif"; } } else if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "bold-italic"; } else if (options.fontShape === "textit") { return "italic"; } else if (options.fontWeight === "textbf") { return "bold"; } var font = options.font; if (!font || font === "mathnormal") { return null; } var mode = group.mode; if (font === "mathit") { return "italic"; } else if (font === "boldsymbol") { return group.type === "textord" ? "bold" : "bold-italic"; } else if (font === "mathbf") { return "bold"; } else if (font === "mathbb") { return "double-struck"; } else if (font === "mathfrak") { return "fraktur"; } else if (font === "mathscr" || font === "mathcal") { // MathML makes no distinction between script and caligrahpic return "script"; } else if (font === "mathsf") { return "sans-serif"; } else if (font === "mathtt") { return "monospace"; } var text = group.text; if (utils.contains(["\\imath", "\\jmath"], text)) { return null; } if (src_symbols[mode][text] && src_symbols[mode][text].replace) { text = src_symbols[mode][text].replace; } var fontName = buildCommon.fontMap[font].fontName; if (getCharacterMetrics(text, fontName, mode)) { return buildCommon.fontMap[font].variant; } return null; }; /** * Takes a list of nodes, builds them, and returns a list of the generated * MathML nodes. Also combine consecutive outputs into a single * tag. */ var buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) { if (expression.length === 1) { var group = buildMathML_buildGroup(expression[0], options); if (isOrdgroup && group instanceof mathMLTree_MathNode && group.type === "mo") { // When TeX writers want to suppress spacing on an operator, // they often put the operator by itself inside braces. group.setAttribute("lspace", "0em"); group.setAttribute("rspace", "0em"); } return [group]; } var groups = []; var lastGroup; for (var i = 0; i < expression.length; i++) { var _group = buildMathML_buildGroup(expression[i], options); if (_group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) { // Concatenate adjacent s if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { var _lastGroup$children; (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children); continue; // Concatenate adjacent s } else if (_group.type === 'mn' && lastGroup.type === 'mn') { var _lastGroup$children2; (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children); continue; // Concatenate ... followed by . } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') { var child = _group.children[0]; if (child instanceof mathMLTree_TextNode && child.text === '.') { var _lastGroup$children3; (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children); continue; } } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) { var lastChild = lastGroup.children[0]; if (lastChild instanceof mathMLTree_TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) { var _child = _group.children[0]; if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) { // Overlay with combining character long solidus _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1); groups.pop(); } } } } groups.push(_group); lastGroup = _group; } return groups; }; /** * Equivalent to buildExpression, but wraps the elements in an * if there's more than one. Returns a single node instead of an array. */ var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { return buildMathML_makeRow(buildMathML_buildExpression(expression, options, isOrdgroup)); }; /** * Takes a group from the parser and calls the appropriate groupBuilders function * on it to produce a MathML node. */ var buildMathML_buildGroup = function buildGroup(group, options) { if (!group) { return new mathMLTree.MathNode("mrow"); } if (_mathmlGroupBuilders[group.type]) { // Call the groupBuilders function var result = _mathmlGroupBuilders[group.type](group, options); return result; } else { throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Takes a full parse tree and settings and builds a MathML representation of * it. In particular, we put the elements from building the parse tree into a * tag so we can also include that TeX source as an annotation. * * Note that we actually return a domTree element with a `` inside it so * we can do appropriate styling. */ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) { var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly, unless it's a single or . var wrapper; if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { wrapper = expression[0]; } else { wrapper = new mathMLTree.MathNode("mrow", expression); } // Build a TeX annotation of the source var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); annotation.setAttribute("encoding", "application/x-tex"); var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); var math = new mathMLTree.MathNode("math", [semantics]); math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); if (isDisplayMode) { math.setAttribute("display", "block"); } // You can't style nodes, so we wrap the node in a span. // NOTE: The span class is not typed to have nodes as children, and // we don't want to make the children type more generic since the children // of span are expected to have more fields in `buildHtml` contexts. var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe return buildCommon.makeSpan([wrapperClass], [math]); } // CONCATENATED MODULE: ./src/buildTree.js var buildTree_optionsFromSettings = function optionsFromSettings(settings) { return new src_Options({ style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT, maxSize: settings.maxSize, minRuleThickness: settings.minRuleThickness }); }; var buildTree_displayWrap = function displayWrap(node, settings) { if (settings.displayMode) { var classes = ["katex-display"]; if (settings.leqno) { classes.push("leqno"); } if (settings.fleqn) { classes.push("fleqn"); } node = buildCommon.makeSpan(classes, [node]); } return node; }; var buildTree_buildTree = function buildTree(tree, expression, settings) { var options = buildTree_optionsFromSettings(settings); var katexNode; if (settings.output === "mathml") { return buildMathML(tree, expression, options, settings.displayMode, true); } else if (settings.output === "html") { var htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); } else { var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false); var _htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); } return buildTree_displayWrap(katexNode, settings); }; var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) { var options = buildTree_optionsFromSettings(settings); var htmlNode = buildHTML(tree, options); var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); return buildTree_displayWrap(katexNode, settings); }; // CONCATENATED MODULE: ./src/stretchy.js /** * This file provides support to buildMathML.js and buildHTML.js * for stretchy wide elements rendered from SVG files * and other CSS trickery. */ var stretchyCodePoint = { widehat: "^", widecheck: "ˇ", widetilde: "~", utilde: "~", overleftarrow: "\u2190", underleftarrow: "\u2190", xleftarrow: "\u2190", overrightarrow: "\u2192", underrightarrow: "\u2192", xrightarrow: "\u2192", underbrace: "\u23DF", overbrace: "\u23DE", overgroup: "\u23E0", undergroup: "\u23E1", overleftrightarrow: "\u2194", underleftrightarrow: "\u2194", xleftrightarrow: "\u2194", Overrightarrow: "\u21D2", xRightarrow: "\u21D2", overleftharpoon: "\u21BC", xleftharpoonup: "\u21BC", overrightharpoon: "\u21C0", xrightharpoonup: "\u21C0", xLeftarrow: "\u21D0", xLeftrightarrow: "\u21D4", xhookleftarrow: "\u21A9", xhookrightarrow: "\u21AA", xmapsto: "\u21A6", xrightharpoondown: "\u21C1", xleftharpoondown: "\u21BD", xrightleftharpoons: "\u21CC", xleftrightharpoons: "\u21CB", xtwoheadleftarrow: "\u219E", xtwoheadrightarrow: "\u21A0", xlongequal: "=", xtofrom: "\u21C4", xrightleftarrows: "\u21C4", xrightequilibrium: "\u21CC", // Not a perfect match. xleftequilibrium: "\u21CB" // None better available. }; var stretchy_mathMLnode = function mathMLnode(label) { var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); node.setAttribute("stretchy", "true"); return node; }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. // Copyright (c) 2009-2010, Design Science, Inc. () // Copyright (c) 2014-2017 Khan Academy () // Licensed under the SIL Open Font License, Version 1.1. // See \nhttp://scripts.sil.org/OFL // Very Long SVGs // Many of the KaTeX stretchy wide elements use a long SVG image and an // overflow: hidden tactic to achieve a stretchy image while avoiding // distortion of arrowheads or brace corners. // The SVG typically contains a very long (400 em) arrow. // The SVG is in a container span that has overflow: hidden, so the span // acts like a window that exposes only part of the SVG. // The SVG always has a longer, thinner aspect ratio than the container span. // After the SVG fills 100% of the height of the container span, // there is a long arrow shaft left over. That left-over shaft is not shown. // Instead, it is sliced off because the span's CSS has overflow: hidden. // Thus, the reader sees an arrow that matches the subject matter width // without distortion. // Some functions, such as \cancel, need to vary their aspect ratio. These // functions do not get the overflow SVG treatment. // Second Brush Stroke // Low resolution monitors struggle to display images in fine detail. // So browsers apply anti-aliasing. A long straight arrow shaft therefore // will sometimes appear as if it has a blurred edge. // To mitigate this, these SVG files contain a second "brush-stroke" on the // arrow shafts. That is, a second long thin rectangular SVG path has been // written directly on top of each arrow shaft. This reinforcement causes // some of the screen pixels to display as black instead of the anti-aliased // gray pixel that a single path would generate. So we get arrow shafts // whose edges appear to be sharper. // In the katexImagesData object just below, the dimensions all // correspond to path geometry inside the relevant SVG. // For example, \overrightarrow uses the same arrowhead as glyph U+2192 // from the KaTeX Main font. The scaling factor is 1000. // That is, inside the font, that arrowhead is 522 units tall, which // corresponds to 0.522 em inside the document. var katexImagesData = { // path(s), minWidth, height, align overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], overgroup: [["leftgroup", "rightgroup"], 0.888, 342], undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], // The next three arrows are from the mhchem package. // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the // document as \xrightarrow or \xrightleftharpoons. Those have // min-length = 1.75em, so we set min-length on these next three to match. xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] }; var groupLength = function groupLength(arg) { if (arg.type === "ordgroup") { return arg.body.length; } else { return 1; } }; var stretchy_svgSpan = function svgSpan(group, options) { // Create a span with inline SVG for the element. function buildSvgSpan_() { var viewBoxWidth = 400000; // default var label = group.label.substr(1); if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { // Each type in the `if` statement corresponds to one of the ParseNode // types below. This narrowing is required to access `grp.base`. var grp = group; // There are four SVG images available for each function. // Choose a taller image when there are more characters. var numChars = groupLength(grp.base); var viewBoxHeight; var pathName; var _height; if (numChars > 5) { if (label === "widehat" || label === "widecheck") { viewBoxHeight = 420; viewBoxWidth = 2364; _height = 0.42; pathName = label + "4"; } else { viewBoxHeight = 312; viewBoxWidth = 2340; _height = 0.34; pathName = "tilde4"; } } else { var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; if (label === "widehat" || label === "widecheck") { viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; pathName = label + imgIndex; } else { viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; pathName = "tilde" + imgIndex; } } var path = new domTree_PathNode(pathName); var svgNode = new SvgNode([path], { "width": "100%", "height": _height + "em", "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, "preserveAspectRatio": "none" }); return { span: buildCommon.makeSvgSpan([], [svgNode], options), minWidth: 0, height: _height }; } else { var spans = []; var data = katexImagesData[label]; var paths = data[0], _minWidth = data[1], _viewBoxHeight = data[2]; var _height2 = _viewBoxHeight / 1000; var numSvgChildren = paths.length; var widthClasses; var aligns; if (numSvgChildren === 1) { // $FlowFixMe: All these cases must be of the 4-tuple type. var align1 = data[3]; widthClasses = ["hide-tail"]; aligns = [align1]; } else if (numSvgChildren === 2) { widthClasses = ["halfarrow-left", "halfarrow-right"]; aligns = ["xMinYMin", "xMaxYMin"]; } else if (numSvgChildren === 3) { widthClasses = ["brace-left", "brace-center", "brace-right"]; aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; } else { throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); } for (var i = 0; i < numSvgChildren; i++) { var _path = new domTree_PathNode(paths[i]); var _svgNode = new SvgNode([_path], { "width": "400em", "height": _height2 + "em", "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, "preserveAspectRatio": aligns[i] + " slice" }); var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options); if (numSvgChildren === 1) { return { span: _span, minWidth: _minWidth, height: _height2 }; } else { _span.style.height = _height2 + "em"; spans.push(_span); } } return { span: buildCommon.makeSpan(["stretchy"], spans, options), minWidth: _minWidth, height: _height2 }; } } // buildSvgSpan_() var _buildSvgSpan_ = buildSvgSpan_(), span = _buildSvgSpan_.span, minWidth = _buildSvgSpan_.minWidth, height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. // Any adjustments relative to the baseline must be done in buildHTML. span.height = height; span.style.height = height + "em"; if (minWidth > 0) { span.style.minWidth = minWidth + "em"; } return span; }; var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { // Return an image span for \cancel, \bcancel, \xcancel, or \fbox var img; var totalHeight = inner.height + inner.depth + 2 * pad; if (/fbox|color/.test(label)) { img = buildCommon.makeSpan(["stretchy", label], [], options); if (label === "fbox") { var color = options.color && options.getColor(); if (color) { img.style.borderColor = color; } } } else { // \cancel, \bcancel, or \xcancel // Since \cancel's SVG is inline and it omits the viewBox attribute, // its stroke-width will not vary with span area. var lines = []; if (/^[bx]cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "0", "x2": "100%", "y2": "100%", "stroke-width": "0.046em" })); } if (/^x?cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "100%", "x2": "100%", "y2": "0", "stroke-width": "0.046em" })); } var svgNode = new SvgNode(lines, { "width": "100%", "height": totalHeight + "em" }); img = buildCommon.makeSvgSpan([], [svgNode], options); } img.height = totalHeight; img.style.height = totalHeight + "em"; return img; }; /* harmony default export */ var stretchy = ({ encloseSpan: stretchy_encloseSpan, mathMLnode: stretchy_mathMLnode, svgSpan: stretchy_svgSpan }); // CONCATENATED MODULE: ./src/parseNode.js /** * Asserts that the node is of the given type and returns it with stricter * typing. Throws if the node's type does not match. */ function assertNodeType(node, type) { if (!node || node.type !== type) { throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node))); } return node; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function assertSymbolNodeType(node) { var typedNode = checkSymbolNodeType(node); if (!typedNode) { throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node))); } return typedNode; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function checkSymbolNodeType(node) { if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { // $FlowFixMe return node; } return null; } // CONCATENATED MODULE: ./src/functions/accent.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but var accent_htmlBuilder = function htmlBuilder(grp, options) { // Accents are handled in the TeXbook pg. 443, rule 12. var base; var group; var supSubGroup; if (grp && grp.type === "supsub") { // If our base is a character box, and we have superscripts and // subscripts, the supsub will defer to us. In particular, we want // to attach the superscripts and subscripts to the inner body (so // that the position of the superscripts and subscripts won't be // affected by the height of the accent). We accomplish this by // sticking the base of the accent into the base of the supsub, and // rendering that, while keeping track of where the accent is. // The real accent group is the base of the supsub group group = assertNodeType(grp.base, "accent"); // The character box is the base of the accent group base = group.base; // Stick the character box into the base of the supsub group grp.base = base; // Rerender the supsub group with its new base, and store that // result. supSubGroup = assertSpan(buildHTML_buildGroup(grp, options)); // reset original base grp.base = group; } else { group = assertNodeType(grp, "accent"); base = group.base; } // Build the base group var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the // nucleus is not a single character, let s = 0; otherwise set s to the // kern amount for the nucleus followed by the \skewchar of its font." // Note that our skew metrics are just the kern between each character // and the skewchar. var skew = 0; if (mustShift) { // If the base is a character box, then we want the skew of the // innermost character. To do that, we find the innermost character: var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we // removed with getBaseElem might contain things like \color which // we can't get rid of. // TODO(emily): Find a better way to get the skew } // calculate the amount of space between the body and the accent var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent var accentBody; if (!group.isStretchy) { var accent; var width; if (group.label === "\\vec") { // Before version 0.9, \vec used the combining font glyph U+20D7. // But browsers, especially Safari, are not consistent in how they // render combining characters when not preceded by a character. // So now we use an SVG. // If Safari reforms, we should consider reverting to the glyph. accent = buildCommon.staticSvg("vec", options); width = buildCommon.svgData.vec[1]; } else { accent = buildCommon.makeOrd({ mode: group.mode, text: group.label }, options, "textord"); accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to // shift the accent over to a place we don't want. accent.italic = 0; width = accent.width; } accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be // at least the width of the accent, and overlap directly onto the // character without any vertical offset. var accentFull = group.label === "\\textcircled"; if (accentFull) { accentBody.classes.push('accent-full'); clearance = body.height; } // Shift the accent over by the skew. var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` // so that the accent doesn't contribute to the bounding box. // We need to shift the character by its width (effectively half // its width) to compensate. if (!accentFull) { left -= width / 2; } accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some // vertical adjustment to match LaTeX. if (group.label === "\\textcircled") { accentBody.style.top = ".2em"; } accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }] }, options); } else { accentBody = stretchy.svgSpan(group, options); accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "elem", elem: accentBody, wrapperClasses: ["svg-align"], wrapperStyle: skew > 0 ? { width: "calc(100% - " + 2 * skew + "em)", marginLeft: 2 * skew + "em" } : undefined }] }, options); } var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); if (supSubGroup) { // Here, we replace the "base" child of the supsub with our newly // generated accent. supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the // accent, we manually recalculate height. supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not. supSubGroup.classes[0] = "mord"; return supSubGroup; } else { return accentWrap; } }; var accent_mathmlBuilder = function mathmlBuilder(group, options) { var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [buildMathML_makeText(group.label, group.mode)]); var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]); node.setAttribute("accent", "true"); return node; }; var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) { return "\\" + accent; }).join("|")); // Accents defineFunction({ type: "accent", names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], props: { numArgs: 1 }, handler: function handler(context, args) { var base = args[0]; var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: isStretchy, isShifty: isShifty, base: base }; }, htmlBuilder: accent_htmlBuilder, mathmlBuilder: accent_mathmlBuilder }); // Text-mode accents defineFunction({ type: "accent", names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"], props: { numArgs: 1, allowedInText: true, allowedInMath: false }, handler: function handler(context, args) { var base = args[0]; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: false, isShifty: true, base: base }; }, htmlBuilder: accent_htmlBuilder, mathmlBuilder: accent_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/accentunder.js // Horizontal overlap functions defineFunction({ type: "accentUnder", names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var base = args[0]; return { type: "accentUnder", mode: parser.mode, label: funcName, base: base }; }, htmlBuilder: function htmlBuilder(group, options) { // Treat under accents much like underlines. var innerGroup = buildHTML_buildGroup(group.base, options); var accentBody = stretchy.svgSpan(group, options); var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "elem", elem: accentBody, wrapperClasses: ["svg-align"] }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var accentNode = stretchy.mathMLnode(group.label); var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]); node.setAttribute("accentunder", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/arrow.js // Helper function var arrow_paddedNode = function paddedNode(group) { var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); node.setAttribute("width", "+0.6em"); node.setAttribute("lspace", "0.3em"); return node; }; // Stretchy arrows with an optional argument defineFunction({ type: "xArrow", names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. // Direct use of these functions is discouraged and may break someday. "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], props: { numArgs: 1, numOptionalArgs: 1 }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; return { type: "xArrow", mode: parser.mode, label: funcName, body: args[0], below: optArgs[0] }; }, // Flow is unable to correctly infer the type of `group`, even though it's // unamibiguously determined from the passed-in `type` above. htmlBuilder: function htmlBuilder(group, options) { var style = options.style; // Build the argument groups in the appropriate style. // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% // Some groups can return document fragments. Handle those by wrapping // them in a span. var newOptions = options.havingStyle(style.sup()); var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options); upperGroup.classes.push("x-arrow-pad"); var lowerGroup; if (group.below) { // Build the lower group newOptions = options.havingStyle(style.sub()); lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options); lowerGroup.classes.push("x-arrow-pad"); } var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. // The point we want on the math axis is at 0.5 * arrowBody.height. var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { upperShift -= upperGroup.depth; // shift up if depth encroaches } // Generate the vlist var vlist; if (lowerGroup) { var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }] }, options); } // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var arrowNode = stretchy.mathMLnode(group.label); var node; if (group.body) { var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options)); if (group.below) { var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); } else { node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); } } else if (group.below) { var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); } else { // This should never happen. // Parser.js throws an error if there is no argument. node = arrow_paddedNode(); node = new mathMLTree.MathNode("mover", [arrowNode, node]); } return node; } }); // CONCATENATED MODULE: ./src/functions/char.js // \@char is an internal function that takes a grouped decimal argument like // {123} and converts into symbol with code 123. It is used by the *macro* // \char defined in macros.js. defineFunction({ type: "textord", names: ["\\@char"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var arg = assertNodeType(args[0], "ordgroup"); var group = arg.body; var number = ""; for (var i = 0; i < group.length; i++) { var node = assertNodeType(group[i], "textord"); number += node.text; } var code = parseInt(number); if (isNaN(code)) { throw new src_ParseError("\\@char has non-numeric argument " + number); } return { type: "textord", mode: parser.mode, text: String.fromCharCode(code) }; } }); // CONCATENATED MODULE: ./src/functions/color.js var color_htmlBuilder = function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. // To accomplish this, we wrap the results in a fragment, so the inner // elements will be able to directly interact with their neighbors. For // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` return buildCommon.makeFragment(elements); }; var color_mathmlBuilder = function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(group.body, options.withColor(group.color)); var node = new mathMLTree.MathNode("mstyle", inner); node.setAttribute("mathcolor", group.color); return node; }; defineFunction({ type: "color", names: ["\\textcolor"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "original"] }, handler: function handler(_ref, args) { var parser = _ref.parser; var color = assertNodeType(args[0], "color-token").color; var body = args[1]; return { type: "color", mode: parser.mode, color: color, body: ordargument(body) }; }, htmlBuilder: color_htmlBuilder, mathmlBuilder: color_mathmlBuilder }); defineFunction({ type: "color", names: ["\\color"], props: { numArgs: 1, allowedInText: true, greediness: 3, argTypes: ["color"] }, handler: function handler(_ref2, args) { var parser = _ref2.parser, breakOnTokenText = _ref2.breakOnTokenText; var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current // color, mimicking the behavior of color.sty. // This is currently used just to correctly color a \right // that follows a \color command. parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored. var body = parser.parseExpression(true, breakOnTokenText); return { type: "color", mode: parser.mode, color: color, body: body }; }, htmlBuilder: color_htmlBuilder, mathmlBuilder: color_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/cr.js // Row breaks within tabular environments, and line breaks at top level // \\ is a macro mapping to either \cr or \newline. Because they have the // same signature, we implement them as one megafunction, with newRow // indicating whether we're in the \cr case, and newLine indicating whether // to break the line in the \newline case. defineFunction({ type: "cr", names: ["\\cr", "\\newline"], props: { numArgs: 0, numOptionalArgs: 1, argTypes: ["size"], allowedInText: true }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; var size = optArgs[0]; var newRow = funcName === "\\cr"; var newLine = false; if (!newRow) { if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { newLine = false; } else { newLine = true; } } return { type: "cr", mode: parser.mode, newLine: newLine, newRow: newRow, size: size && assertNodeType(size, "size").value }; }, // The following builders are called only at the top level, // not within tabular/array environments. htmlBuilder: function htmlBuilder(group, options) { if (group.newRow) { throw new src_ParseError("\\cr valid only within a tabular/array environment"); } var span = buildCommon.makeSpan(["mspace"], [], options); if (group.newLine) { span.classes.push("newline"); if (group.size) { span.style.marginTop = units_calculateSize(group.size, options) + "em"; } } return span; }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mspace"); if (group.newLine) { node.setAttribute("linebreak", "newline"); if (group.size) { node.setAttribute("height", units_calculateSize(group.size, options) + "em"); } } return node; } }); // CONCATENATED MODULE: ./src/functions/def.js var globalMap = { "\\global": "\\global", "\\long": "\\\\globallong", "\\\\globallong": "\\\\globallong", "\\def": "\\gdef", "\\gdef": "\\gdef", "\\edef": "\\xdef", "\\xdef": "\\xdef", "\\let": "\\\\globallet", "\\futurelet": "\\\\globalfuture" }; var def_checkControlSequence = function checkControlSequence(tok) { var name = tok.text; if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { throw new src_ParseError("Expected a control sequence", tok); } return name; }; var getRHS = function getRHS(parser) { var tok = parser.gullet.popToken(); if (tok.text === "=") { // consume optional equals tok = parser.gullet.popToken(); if (tok.text === " ") { // consume one optional space tok = parser.gullet.popToken(); } } return tok; }; var letCommand = function letCommand(parser, name, tok, global) { var macro = parser.gullet.macros.get(tok.text); if (macro == null) { // don't expand it later even if a macro with the same name is defined // e.g., \let\foo=\frac \def\frac{\relax} \frac12 tok.noexpand = true; macro = { tokens: [tok], numArgs: 0, // reproduce the same behavior in expansion unexpandable: !parser.gullet.isExpandable(tok.text) }; } parser.gullet.macros.set(name, macro, global); }; // -> | // -> |\global // -> | // -> \global|\long|\outer defineFunction({ type: "internal", names: ["\\global", "\\long", "\\\\globallong"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref) { var parser = _ref.parser, funcName = _ref.funcName; parser.consumeSpaces(); var token = parser.fetch(); if (globalMap[token.text]) { // KaTeX doesn't have \par, so ignore \long if (funcName === "\\global" || funcName === "\\\\globallong") { token.text = globalMap[token.text]; } return assertNodeType(parser.parseFunction(), "internal"); } throw new src_ParseError("Invalid token after macro prefix", token); } }); // Basic support for macro definitions: \def, \gdef, \edef, \xdef // -> // -> \def|\gdef|\edef|\xdef // -> defineFunction({ type: "internal", names: ["\\def", "\\gdef", "\\edef", "\\xdef"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref2) { var parser = _ref2.parser, funcName = _ref2.funcName; var arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("\\gdef's first argument must be a macro name"); } var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... var numArgs = 0; arg = parser.gullet.consumeArgs(1)[0]; while (arg.length === 1 && arg[0].text === "#") { arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("Invalid argument number length \"" + arg.length + "\""); } if (!/^[1-9]$/.test(arg[0].text)) { throw new src_ParseError("Invalid argument number \"" + arg[0].text + "\""); } numArgs++; if (parseInt(arg[0].text) !== numArgs) { throw new src_ParseError("Argument number \"" + arg[0].text + "\" out of order"); } arg = parser.gullet.consumeArgs(1)[0]; } if (funcName === "\\edef" || funcName === "\\xdef") { arg = parser.gullet.expandTokens(arg); arg.reverse(); // to fit in with stack order } // Final arg is the expansion of the macro parser.gullet.macros.set(name, { tokens: arg, numArgs: numArgs }, funcName === globalMap[funcName]); return { type: "internal", mode: parser.mode }; } }); // -> // -> \futurelet // | \let // -> |= defineFunction({ type: "internal", names: ["\\let", "\\\\globallet"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref3) { var parser = _ref3.parser, funcName = _ref3.funcName; var name = def_checkControlSequence(parser.gullet.popToken()); parser.gullet.consumeSpaces(); var tok = getRHS(parser); letCommand(parser, name, tok, funcName === "\\\\globallet"); return { type: "internal", mode: parser.mode }; } }); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf defineFunction({ type: "internal", names: ["\\futurelet", "\\\\globalfuture"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref4) { var parser = _ref4.parser, funcName = _ref4.funcName; var name = def_checkControlSequence(parser.gullet.popToken()); var middle = parser.gullet.popToken(); var tok = parser.gullet.popToken(); letCommand(parser, name, tok, funcName === "\\\\globalfuture"); parser.gullet.pushToken(tok); parser.gullet.pushToken(middle); return { type: "internal", mode: parser.mode }; } }); // CONCATENATED MODULE: ./src/delimiter.js /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box * x to a specified variable delimiter" paragraph. * * There are three main routines here. `makeSmallDelim` makes a delimiter in the * normal font, but in either text, script, or scriptscript style. * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1, * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of * smaller pieces that are stacked on top of one another. * * The functions take a parameter `center`, which determines if the delimiter * should be centered around the axis. * * Then, there are three exposed functions. `sizedDelim` makes a delimiter in * one of the given sizes. This is used for things like `\bigl`. * `customSizedDelim` makes a delimiter with a given total height+depth. It is * called in places like `\sqrt`. `leftRightDelim` makes an appropriate * delimiter which surrounds an expression of a given height an depth. It is * used in `\left` and `\right`. */ /** * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ var delimiter_getMetrics = function getMetrics(symbol, font, mode) { var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace; var metrics = getCharacterMetrics(replace || symbol, font, mode); if (!metrics) { throw new Error("Unsupported symbol " + symbol + " and font size " + font + "."); } return metrics; }; /** * Puts a delimiter span in a given style, and adds appropriate height, depth, * and maxFontSizes. */ var delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) { var newOptions = options.havingBaseStyle(toStyle); var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; span.height *= delimSizeMultiplier; span.depth *= delimSizeMultiplier; span.maxFontSize = newOptions.sizeMultiplier; return span; }; var centerSpan = function centerSpan(span, options, style) { var newOptions = options.havingBaseStyle(style); var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; span.classes.push("delimcenter"); span.style.top = shift + "em"; span.height -= shift; span.depth += shift; }; /** * Makes a small delimiter. This is a delimiter that comes in the Main-Regular * font, but is restyled to either be in textstyle, scriptstyle, or * scriptscriptstyle. */ var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); var span = delimiter_styleWrap(text, style, options, classes); if (center) { centerSpan(span, options, style); } return span; }; /** * Builds a symbol in the given font size (note size is an integer) */ var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) { return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); }; /** * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, * Size3, or Size4 fonts. It is always rendered in textstyle. */ var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { var inner = delimiter_mathrmSize(delim, size, mode, options); var span = delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes); if (center) { centerSpan(span, options, src_Style.TEXT); } return span; }; /** * Make an inner span with the given offset and in the given font. This is used * in `makeStackedDelim` to make the stacking pieces for the delimiter. */ var delimiter_makeInner = function makeInner(symbol, font, mode) { var sizeClass; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { sizeClass = "delim-size1"; } else /* if (font === "Size4-Regular") */ { sizeClass = "delim-size4"; } var inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. return { type: "elem", elem: inner }; }; // Helper for makeStackedDelim var lap = { type: "kern", size: -0.005 }; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. var top; var middle; var repeat; var bottom; top = repeat = bottom = delim; middle = null; // Also keep track of what font the delimiters are in var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the // repeats of the arrows if (delim === "\\uparrow") { repeat = bottom = "\u23D0"; } else if (delim === "\\Uparrow") { repeat = bottom = "\u2016"; } else if (delim === "\\downarrow") { top = repeat = "\u23D0"; } else if (delim === "\\Downarrow") { top = repeat = "\u2016"; } else if (delim === "\\updownarrow") { top = "\\uparrow"; repeat = "\u23D0"; bottom = "\\downarrow"; } else if (delim === "\\Updownarrow") { top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; } else if (delim === "[" || delim === "\\lbrack") { top = "\u23A1"; repeat = "\u23A2"; bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "]" || delim === "\\rbrack") { top = "\u23A4"; repeat = "\u23A5"; bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\lfloor" || delim === "\u230A") { repeat = top = "\u23A2"; bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "\\lceil" || delim === "\u2308") { top = "\u23A1"; repeat = bottom = "\u23A2"; font = "Size4-Regular"; } else if (delim === "\\rfloor" || delim === "\u230B") { repeat = top = "\u23A5"; bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\rceil" || delim === "\u2309") { top = "\u23A4"; repeat = bottom = "\u23A5"; font = "Size4-Regular"; } else if (delim === "(" || delim === "\\lparen") { top = "\u239B"; repeat = "\u239C"; bottom = "\u239D"; font = "Size4-Regular"; } else if (delim === ")" || delim === "\\rparen") { top = "\u239E"; repeat = "\u239F"; bottom = "\u23A0"; font = "Size4-Regular"; } else if (delim === "\\{" || delim === "\\lbrace") { top = "\u23A7"; middle = "\u23A8"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\}" || delim === "\\rbrace") { top = "\u23AB"; middle = "\u23AC"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lgroup" || delim === "\u27EE") { top = "\u23A7"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rgroup" || delim === "\u27EF") { top = "\u23AB"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lmoustache" || delim === "\u23B0") { top = "\u23A7"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rmoustache" || delim === "\u23B1") { top = "\u23AB"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } // Get the metrics of the four sections var topMetrics = delimiter_getMetrics(top, font, mode); var topHeightTotal = topMetrics.height + topMetrics.depth; var repeatMetrics = delimiter_getMetrics(repeat, font, mode); var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; var bottomMetrics = delimiter_getMetrics(bottom, font, mode); var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; var middleHeightTotal = 0; var middleFactor = 1; if (middle !== null) { var middleMetrics = delimiter_getMetrics(middle, font, mode); middleHeightTotal = middleMetrics.height + middleMetrics.depth; middleFactor = 2; // repeat symmetrically above and below middle } // Calcuate the minimal height that the delimiter can have. // It is at least the size of the top, bottom, and optional middle combined. var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note // that in this context, "center" means that the delimiter should be // centered around the axis in the current style, while normally it is // centered around the axis in textstyle. var axisHeight = options.fontMetrics().axisHeight; if (center) { axisHeight *= options.sizeMultiplier; } // Calculate the depth var depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way. // We shift each repeat element downwards by 0.005em, to prevent a gap // due to browser floating point rounding error. // Then, at the last element-to element joint, we add one extra repeat // element to cover the gap created by the shifts. // Find the shift needed to align the upper end of the extra element at a point // 0.005em above the lower end of the top element. var shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist // Keep a list of the inner pieces var inners = []; // Add the bottom symbol inners.push(delimiter_makeInner(bottom, font, mode)); if (middle === null) { // Add that many symbols for (var i = 0; i < repeatCount; i++) { inners.push(lap); // overlap inners.push(delimiter_makeInner(repeat, font, mode)); } } else { // When there is a middle bit, we need the middle part and two repeated // sections for (var _i = 0; _i < repeatCount; _i++) { inners.push(lap); inners.push(delimiter_makeInner(repeat, font, mode)); } // Insert one extra repeat element. inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(delimiter_makeInner(repeat, font, mode)); inners.push(lap); // Now insert the middle of the brace. inners.push(delimiter_makeInner(middle, font, mode)); for (var _i2 = 0; _i2 < repeatCount; _i2++) { inners.push(lap); inners.push(delimiter_makeInner(repeat, font, mode)); } } // To cover the gap create by the overlaps, insert one more repeat element, // at a position that juts 0.005 above the bottom of the top element. if ((repeat === "\u239C" || repeat === "\u239F") && repeatCount === 0) { // Parentheses need a short repeat element in order to avoid an overrun. // We'll make a 0.3em tall element from a SVG. var overlap = buildCommon.svgData.leftParenInner[2] / 2; inners.push({ type: "kern", size: -overlap }); var pathName = repeat === "\u239C" ? "leftParenInner" : "rightParenInner"; var innerSpan = buildCommon.staticSvg(pathName, options); inners.push({ type: "elem", elem: innerSpan }); inners.push({ type: "kern", size: -overlap }); } else { inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(delimiter_makeInner(repeat, font, mode)); inners.push(lap); } // Add the top symbol inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist var newOptions = options.havingBaseStyle(src_Style.TEXT); var inner = buildCommon.makeVList({ positionType: "bottom", positionData: depth, children: inners }, newOptions); return delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes); }; // All surds have 0.08em padding above the viniculum inside the SVG. // That keeps browser span height rounding error from pinching the line. var vbPad = 80; // padding above the surd, measured inside the viewBox. var emPad = 0.08; // padding, in ems, measured in the document. var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); var pathNode = new domTree_PathNode(sqrtName, path); var svg = new SvgNode([pathNode], { // Note: 1000:1 ratio of viewBox to document em width. "width": "400em", "height": height + "em", "viewBox": "0 0 400000 " + viewBoxHeight, "preserveAspectRatio": "xMinYMin slice" }); return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); }; /** * Make a sqrt image of the given height, */ var makeSqrtImage = function makeSqrtImage(height, options) { // Define a newOptions that removes the effect of size changes such as \Huge. // We don't pick different a height surd for \Huge. For it, we scale up. var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); var sizeMultiplier = newOptions.sizeMultiplier; // default // The standard sqrt SVGs each have a 0.04em thick viniculum. // If Settings.minRuleThickness is larger than that, we add extraViniculum. var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol. var span; var spanHeight = 0; var texHeight = 0; var viewBoxHeight = 0; var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. // Then browser rounding error on the parent span height will not // encroach on the ink of the viniculum. But that padding is not // included in the TeX-like `height` used for calculation of // vertical alignment. So texHeight = span.height < span.style.height. if (delim.type === "small") { // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. // 1000 unit normal glyph height. viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad; if (height < 1.0) { sizeMultiplier = 1.0; // mimic a \textfont radical } else if (height < 1.4) { sizeMultiplier = 0.7; // mimic a \scriptfont radical } spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier; texHeight = (1.00 + extraViniculum) / sizeMultiplier; span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.853em"; advanceWidth = 0.833 / sizeMultiplier; // from the font. } else if (delim.type === "large") { // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier; spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier; span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "1.02em"; advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. } else { // Tall sqrt. In TeX, this would be stacked using multiple glyphs. // We'll use a single SVG to accomplish the same thing. spanHeight = height + extraViniculum + emPad; texHeight = height + extraViniculum; viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad; span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.742em"; advanceWidth = 1.056; } span.height = texHeight; span.style.height = spanHeight + "em"; return { span: span, advanceWidth: advanceWidth, // Calculate the actual line width. // This actually should depend on the chosen font -- e.g. \boldmath // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and // have thicker rules. ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier }; }; // There are three kinds of delimiters, delimiters that stack when they become // too large var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; // and delimiters that never stack var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ // Used to create stacked delimiters of appropriate sizes in makeSizedDelim. var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { delim = "\\rangle"; } // Sized delimiters are never centered. if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { return delimiter_makeLargeDelim(delim, size, false, options, mode, classes); } else if (utils.contains(stackAlwaysDelimiters, delim)) { return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); } else { throw new src_ParseError("Illegal delimiter: '" + delim + "'"); } }; /** * There are three different sequences of delimiter sizes that the delimiters * follow depending on the kind of delimiter. This is used when creating custom * sized delimiters to decide whether to create a small, large, or stacked * delimiter. * * In real TeX, these sequences aren't explicitly defined, but are instead * defined inside the font metrics. Since there are only three sequences that * are possible for the delimiters that TeX defines, it is easier to just encode * them explicitly here. */ // Delimiters that never stack try small delimiters and large delimiters only var stackNeverDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }]; // Delimiters that always stack try the small delimiters first, then stack var stackAlwaysDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "stack" }]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards var stackLargeDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }]; /** * Get the font used in a delimiter based on what kind of delimiter it is. * TODO(#963) Use more specific font family return type once that is introduced. */ var delimTypeToFont = function delimTypeToFont(type) { if (type.type === "small") { return "Main-Regular"; } else if (type.type === "large") { return "Size" + type.size + "-Regular"; } else if (type.type === "stack") { return "Size4-Regular"; } else { throw new Error("Add support for delim type '" + type.type + "' here."); } }; /** * Traverse a sequence of types of delimiters to decide what kind of delimiter * should be used to create a delimiter of the given height+depth. */ var traverseSequence = function traverseSequence(delim, height, sequence, options) { // Here, we choose the index we should start at in the sequences. In smaller // sizes (which correspond to larger numbers in style.size) we start earlier // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 var start = Math.min(2, 3 - options.style.size); for (var i = start; i < sequence.length; i++) { if (sequence[i].type === "stack") { // This is always the last delimiter, so we just break the loop now. break; } var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), "math"); var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we // account for the style change size. if (sequence[i].type === "small") { var newOptions = options.havingBaseStyle(sequence[i].style); heightDepth *= newOptions.sizeMultiplier; } // Check if the delimiter at this size works for the given height. if (heightDepth > height) { return sequence[i]; } } // If we reached the end of the sequence, return the last sequence element. return sequence[sequence.length - 1]; }; /** * Make a delimiter of a given height+depth, with optional centering. Here, we * traverse the sequences, and create a delimiter that the sequence tells us to. */ var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { delim = "\\rangle"; } // Decide what sequence to use var sequence; if (utils.contains(stackNeverDelimiters, delim)) { sequence = stackNeverDelimiterSequence; } else if (utils.contains(stackLargeDelimiters, delim)) { sequence = stackLargeDelimiterSequence; } else { sequence = stackAlwaysDelimiterSequence; } // Look through the sequence var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. // Depending on the sequence element we decided on, call the // appropriate function. if (delimType.type === "small") { return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes); } else if (delimType.type === "large") { return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes); } else /* if (delimType.type === "stack") */ { return delimiter_makeStackedDelim(delim, height, center, options, mode, classes); } }; /** * Make a delimiter for use with `\left` and `\right`, given a height and depth * of an expression that the delimiters surround. */ var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { // We always center \left/\right delimiters, so the axis is always shifted var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right var delimiterFactor = 901; var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are // 65536 per pt, or 655360 per em. So, the division here truncates in // TeX but doesn't here, producing different results. If we wanted to // exactly match TeX's calculation, we could do // Math.floor(655360 * maxDistFromAxis / 500) * // delimiterFactor / 655360 // (To see the difference, compare // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} // in TeX and KaTeX) maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total // height return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; /* harmony default export */ var delimiter = ({ sqrtImage: makeSqrtImage, sizedDelim: delimiter_makeSizedDelim, customSizedDelim: delimiter_makeCustomSizedDelim, leftRightDelim: makeLeftRightDelim }); // CONCATENATED MODULE: ./src/functions/delimsizing.js // Extra data needed for the delimiter handler down below var delimiterSizes = { "\\bigl": { mclass: "mopen", size: 1 }, "\\Bigl": { mclass: "mopen", size: 2 }, "\\biggl": { mclass: "mopen", size: 3 }, "\\Biggl": { mclass: "mopen", size: 4 }, "\\bigr": { mclass: "mclose", size: 1 }, "\\Bigr": { mclass: "mclose", size: 2 }, "\\biggr": { mclass: "mclose", size: 3 }, "\\Biggr": { mclass: "mclose", size: 4 }, "\\bigm": { mclass: "mrel", size: 1 }, "\\Bigm": { mclass: "mrel", size: 2 }, "\\biggm": { mclass: "mrel", size: 3 }, "\\Biggm": { mclass: "mrel", size: 4 }, "\\big": { mclass: "mord", size: 1 }, "\\Big": { mclass: "mord", size: 2 }, "\\bigg": { mclass: "mord", size: 3 }, "\\Bigg": { mclass: "mord", size: 4 } }; var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; // Delimiter functions function checkDelimiter(delim, context) { var symDelim = checkSymbolNodeType(delim); if (symDelim && utils.contains(delimiters, symDelim.text)) { return symDelim; } else if (symDelim) { throw new src_ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim); } else { throw new src_ParseError("Invalid delimiter type '" + delim.type + "'", delim); } } defineFunction({ type: "delimsizing", names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); return { type: "delimsizing", mode: context.parser.mode, size: delimiterSizes[context.funcName].size, mclass: delimiterSizes[context.funcName].mclass, delim: delim.text }; }, htmlBuilder: function htmlBuilder(group, options) { if (group.delim === ".") { // Empty delimiters still count as elements, even though they don't // show anything. return buildCommon.makeSpan([group.mclass]); } // Use delimiter.sizedDelim to generate the delimiter. return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); }, mathmlBuilder: function mathmlBuilder(group) { var children = []; if (group.delim !== ".") { children.push(buildMathML_makeText(group.delim, group.mode)); } var node = new mathMLTree.MathNode("mo", children); if (group.mclass === "mopen" || group.mclass === "mclose") { // Only some of the delimsizing functions act as fences, and they // return "mopen" or "mclose" mclass. node.setAttribute("fence", "true"); } else { // Explicitly disable fencing if it's not a fence, to override the // defaults. node.setAttribute("fence", "false"); } return node; } }); function assertParsed(group) { if (!group.body) { throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); } } defineFunction({ type: "leftright-right", names: ["\\right"], props: { numArgs: 1 }, handler: function handler(context, args) { // \left case below triggers parsing of \right in // `const right = parser.parseFunction();` // uses this return value. var color = context.parser.gullet.macros.get("\\current@color"); if (color && typeof color !== "string") { throw new src_ParseError("\\current@color set to non-string in \\right"); } return { type: "leftright-right", mode: context.parser.mode, delim: checkDelimiter(args[0], context).text, color: color // undefined if not set via \color }; } }); defineFunction({ type: "leftright", names: ["\\left"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); var parser = context.parser; // Parse out the implicit body ++parser.leftrightDepth; // parseExpression stops before '\\right' var body = parser.parseExpression(false); --parser.leftrightDepth; // Check the next token parser.expect("\\right", false); var right = assertNodeType(parser.parseFunction(), "leftright-right"); return { type: "leftright", mode: parser.mode, body: body, left: delim.text, right: right.delim, rightColor: right.color }; }, htmlBuilder: function htmlBuilder(group, options) { assertParsed(group); // Build the inner expression var inner = buildHTML_buildExpression(group.body, options, true, ["mopen", "mclose"]); var innerHeight = 0; var innerDepth = 0; var hadMiddle = false; // Calculate its height and depth for (var i = 0; i < inner.length; i++) { // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe if (inner[i].isMiddle) { hadMiddle = true; } else { innerHeight = Math.max(inner[i].height, innerHeight); innerDepth = Math.max(inner[i].depth, innerDepth); } } // The size of delimiters is the same, regardless of what style we are // in. Thus, to correctly calculate the size of delimiter we need around // a group, we scale down the inner size based on the size. innerHeight *= options.sizeMultiplier; innerDepth *= options.sizeMultiplier; var leftDelim; if (group.left === ".") { // Empty delimiters in \left and \right make null delimiter spaces. leftDelim = makeNullDelimiter(options, ["mopen"]); } else { // Otherwise, use leftRightDelim to generate the correct sized // delimiter. leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); } // Add it to the beginning of the expression inner.unshift(leftDelim); // Handle middle delimiters if (hadMiddle) { for (var _i = 1; _i < inner.length; _i++) { var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe var isMiddle = middleDelim.isMiddle; if (isMiddle) { // Apply the options that were active when \middle was called inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); } } } var rightDelim; // Same for the right delimiter, but using color specified by \color if (group.right === ".") { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options; rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]); } // Add it to the end of the expression. inner.push(rightDelim); return buildCommon.makeSpan(["minner"], inner, options); }, mathmlBuilder: function mathmlBuilder(group, options) { assertParsed(group); var inner = buildMathML_buildExpression(group.body, options); if (group.left !== ".") { var leftNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.left, group.mode)]); leftNode.setAttribute("fence", "true"); inner.unshift(leftNode); } if (group.right !== ".") { var rightNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.right, group.mode)]); rightNode.setAttribute("fence", "true"); if (group.rightColor) { rightNode.setAttribute("mathcolor", group.rightColor); } inner.push(rightNode); } return buildMathML_makeRow(inner); } }); defineFunction({ type: "middle", names: ["\\middle"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); if (!context.parser.leftrightDepth) { throw new src_ParseError("\\middle without preceding \\left", delim); } return { type: "middle", mode: context.parser.mode, delim: delim.text }; }, htmlBuilder: function htmlBuilder(group, options) { var middleDelim; if (group.delim === ".") { middleDelim = makeNullDelimiter(options, []); } else { middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); var isMiddle = { delim: group.delim, options: options }; // Property `isMiddle` not defined on `span`. It is only used in // this file above. // TODO: Fix this violation of the `span` type and possibly rename // things since `isMiddle` sounds like a boolean, but is a struct. // $FlowFixMe middleDelim.isMiddle = isMiddle; } return middleDelim; }, mathmlBuilder: function mathmlBuilder(group, options) { // A Firefox \middle will strech a character vertically only if it // is in the fence part of the operator dictionary at: // https://www.w3.org/TR/MathML3/appendixc.html. // So we need to avoid U+2223 and use plain "|" instead. var textNode = group.delim === "\\vert" || group.delim === "|" ? buildMathML_makeText("|", "text") : buildMathML_makeText(group.delim, group.mode); var middleNode = new mathMLTree.MathNode("mo", [textNode]); middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each element. // \middle should get delimiter spacing instead. middleNode.setAttribute("lspace", "0.05em"); middleNode.setAttribute("rspace", "0.05em"); return middleNode; } }); // CONCATENATED MODULE: ./src/functions/enclose.js var enclose_htmlBuilder = function htmlBuilder(group, options) { // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox // Some groups can return document fragments. Handle those by wrapping // them in a span. var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options); var label = group.label.substr(1); var scale = options.sizeMultiplier; var img; var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different // depending on whether the subject is wider than it is tall, or vice versa. // We don't know the width of a group, so as a proxy, we test if // the subject is a single character. This captures most of the // subjects that should get the "tall" treatment. var isSingleChar = utils.isCharacterBox(group.body); if (label === "sout") { img = buildCommon.makeSpan(["stretchy", "sout"]); img.height = options.fontMetrics().defaultRuleThickness / scale; imgShift = -0.5 * options.fontMetrics().xHeight; } else { // Add horizontal padding if (/cancel/.test(label)) { if (!isSingleChar) { inner.classes.push("cancel-pad"); } } else { inner.classes.push("boxpad"); } // Add vertical padding var vertPad = 0; var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" if (/box/.test(label)) { ruleThickness = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // User override. ); vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); } else { vertPad = isSingleChar ? 0.2 : 0; } img = stretchy.encloseSpan(inner, label, vertPad, options); if (/fbox|boxed|fcolorbox/.test(label)) { img.style.borderStyle = "solid"; img.style.borderWidth = ruleThickness + "em"; } imgShift = inner.depth + vertPad; if (group.backgroundColor) { img.style.backgroundColor = group.backgroundColor; if (group.borderColor) { img.style.borderColor = group.borderColor; } } } var vlist; if (group.backgroundColor) { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Put the color background behind inner; { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Write the \cancel stroke on top of inner. { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift, wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] }] }, options); } if (/cancel/.test(label)) { // The cancel package documentation says that cancel lines add their height // to the expression, but tests show that isn't how it actually works. vlist.height = inner.height; vlist.depth = inner.depth; } if (/cancel/.test(label) && !isSingleChar) { // cancel does not create horiz space for its line extension. return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); } else { return buildCommon.makeSpan(["mord"], [vlist], options); } }; var enclose_mathmlBuilder = function mathmlBuilder(group, options) { var fboxsep = 0; var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]); switch (group.label) { case "\\cancel": node.setAttribute("notation", "updiagonalstrike"); break; case "\\bcancel": node.setAttribute("notation", "downdiagonalstrike"); break; case "\\sout": node.setAttribute("notation", "horizontalstrike"); break; case "\\fbox": node.setAttribute("notation", "box"); break; case "\\fcolorbox": case "\\colorbox": // doesn't have a good notation option. So use // instead. Set some attributes that come included with . fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; node.setAttribute("width", "+" + 2 * fboxsep + "pt"); node.setAttribute("height", "+" + 2 * fboxsep + "pt"); node.setAttribute("lspace", fboxsep + "pt"); // node.setAttribute("voffset", fboxsep + "pt"); if (group.label === "\\fcolorbox") { var thk = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // user override ); node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor)); } break; case "\\xcancel": node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); break; } if (group.backgroundColor) { node.setAttribute("mathbackground", group.backgroundColor); } return node; }; defineFunction({ type: "enclose", names: ["\\colorbox"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "text"] }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; var color = assertNodeType(args[0], "color-token").color; var body = args[1]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor: color, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); defineFunction({ type: "enclose", names: ["\\fcolorbox"], props: { numArgs: 3, allowedInText: true, greediness: 3, argTypes: ["color", "color", "text"] }, handler: function handler(_ref2, args, optArgs) { var parser = _ref2.parser, funcName = _ref2.funcName; var borderColor = assertNodeType(args[0], "color-token").color; var backgroundColor = assertNodeType(args[1], "color-token").color; var body = args[2]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor: backgroundColor, borderColor: borderColor, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); defineFunction({ type: "enclose", names: ["\\fbox"], props: { numArgs: 1, argTypes: ["hbox"], allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser; return { type: "enclose", mode: parser.mode, label: "\\fbox", body: args[0] }; } }); defineFunction({ type: "enclose", names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], props: { numArgs: 1 }, handler: function handler(_ref4, args, optArgs) { var parser = _ref4.parser, funcName = _ref4.funcName; var body = args[0]; return { type: "enclose", mode: parser.mode, label: funcName, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); // CONCATENATED MODULE: ./src/defineEnvironment.js /** * All registered environments. * `environments.js` exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary via `environments.js`. */ var _environments = {}; function defineEnvironment(_ref) { var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of environments. var data = { type: type, numArgs: props.numArgs || 0, greediness: 1, allowedInText: false, numOptionalArgs: 0, handler: handler }; for (var i = 0; i < names.length; ++i) { // TODO: The value type of _environments should be a type union of all // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is // an existential type. // $FlowFixMe _environments[names[i]] = data; } if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } // CONCATENATED MODULE: ./src/environments/array.js function getHLines(parser) { // Return an array. The array length = number of hlines. // Each element in the array tells if the line is dashed. var hlineInfo = []; parser.consumeSpaces(); var nxt = parser.fetch().text; while (nxt === "\\hline" || nxt === "\\hdashline") { parser.consume(); hlineInfo.push(nxt === "\\hdashline"); parser.consumeSpaces(); nxt = parser.fetch().text; } return hlineInfo; } /** * Parse the body of the environment, with rows delimited by \\ and * columns delimited by &, and create a nested list in row-major order * with one group per cell. If given an optional argument style * ("text", "display", etc.), then each cell is cast into that style. */ function parseArray(parser, _ref, style) { var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType; // Parse body of array with \\ temporarily mapped to \cr parser.gullet.beginGroup(); parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment if (!arraystretch) { var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); if (stretch == null) { // Default \arraystretch from lttab.dtx arraystretch = 1; } else { arraystretch = parseFloat(stretch); if (!arraystretch || arraystretch < 0) { throw new src_ParseError("Invalid \\arraystretch: " + stretch); } } } // Start group for first cell parser.gullet.beginGroup(); var row = []; var body = [row]; var rowGaps = []; var hLinesBeforeRow = []; // Test for \hline at the top of the array. hLinesBeforeRow.push(getHLines(parser)); while (true) { // eslint-disable-line no-constant-condition // Parse each cell in its own group (namespace) var cell = parser.parseExpression(false, "\\cr"); parser.gullet.endGroup(); parser.gullet.beginGroup(); cell = { type: "ordgroup", mode: parser.mode, body: cell }; if (style) { cell = { type: "styling", mode: parser.mode, style: style, body: [cell] }; } row.push(cell); var next = parser.fetch().text; if (next === "&") { parser.consume(); } else if (next === "\\end") { // Arrays terminate newlines with `\crcr` which consumes a `\cr` if // the last line is empty. // NOTE: Currently, `cell` is the last item added into `row`. if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) { body.pop(); } if (hLinesBeforeRow.length < body.length + 1) { hLinesBeforeRow.push([]); } break; } else if (next === "\\cr") { var cr = assertNodeType(parser.parseFunction(), "cr"); rowGaps.push(cr.size); // check for \hline(s) following the row separator hLinesBeforeRow.push(getHLines(parser)); row = []; body.push(row); } else { throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken); } } // End cell group parser.gullet.endGroup(); // End array group defining \\ parser.gullet.endGroup(); return { type: "array", mode: parser.mode, addJot: addJot, arraystretch: arraystretch, body: body, cols: cols, rowGaps: rowGaps, hskipBeforeAndAfter: hskipBeforeAndAfter, hLinesBeforeRow: hLinesBeforeRow, colSeparationType: colSeparationType }; } // Decides on a style for cells in an array according to whether the given // environment name starts with the letter 'd'. function dCellStyle(envName) { if (envName.substr(0, 1) === "d") { return "display"; } else { return "text"; } } var array_htmlBuilder = function htmlBuilder(group, options) { var r; var c; var nr = group.body.length; var hLinesBeforeRow = group.hLinesBeforeRow; var nc = 0; var body = new Array(nr); var hlines = []; var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override. ); // Horizontal spacing var pt = 1 / options.fontMetrics().ptPerEm; var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls if (group.colSeparationType && group.colSeparationType === "small") { // We're in a {smallmatrix}. Default column space is \thickspace, // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}. // But that needs adjustment because LaTeX applies \scriptstyle to the // entire array, including the colspace, but this function applies // \scriptstyle only inside each element. var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier; arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); } // Vertical spacing var baselineskip = 12 * pt; // see size10.clo // Default \jot from ltmath.dtx // TODO(edemaine): allow overriding \jot via \setlength (#687) var jot = 3 * pt; var arrayskip = group.arraystretch * baselineskip; var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. function setHLinePos(hlinesInGap) { for (var i = 0; i < hlinesInGap.length; ++i) { if (i > 0) { totalHeight += 0.25; } hlines.push({ pos: totalHeight, isDashed: hlinesInGap[i] }); } } setHLinePos(hLinesBeforeRow[0]); for (r = 0; r < group.body.length; ++r) { var inrow = group.body[r]; var height = arstrutHeight; // \@array adds an \@arstrut var depth = arstrutDepth; // to each tow (via the template) if (nc < inrow.length) { nc = inrow.length; } var outrow = new Array(inrow.length); for (c = 0; c < inrow.length; ++c) { var elt = buildHTML_buildGroup(inrow[c], options); if (depth < elt.depth) { depth = elt.depth; } if (height < elt.height) { height = elt.height; } outrow[c] = elt; } var rowGap = group.rowGaps[r]; var gap = 0; if (rowGap) { gap = units_calculateSize(rowGap, options); if (gap > 0) { // \@argarraycr gap += arstrutDepth; if (depth < gap) { depth = gap; // \@xargarraycr } gap = 0; } } // In AMS multiline environments such as aligned and gathered, rows // correspond to lines that have additional \jot added to the // \baselineskip via \openup. if (group.addJot) { depth += jot; } outrow.height = height; outrow.depth = depth; totalHeight += height; outrow.pos = totalHeight; totalHeight += depth + gap; // \@yargarraycr body[r] = outrow; // Set a position for \hline(s), if any. setHLinePos(hLinesBeforeRow[r + 1]); } var offset = totalHeight / 2 + options.fontMetrics().axisHeight; var colDescriptions = group.cols || []; var cols = []; var colSep; var colDescrNum; for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column // descriptions, so trailing separators don't get lost. c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { var colDescr = colDescriptions[colDescrNum] || {}; var firstSeparator = true; while (colDescr.type === "separator") { // If there is more than one separator in a row, add a space // between them. if (!firstSeparator) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; cols.push(colSep); } if (colDescr.separator === "|" || colDescr.separator === ":") { var lineType = colDescr.separator === "|" ? "solid" : "dashed"; var separator = buildCommon.makeSpan(["vertical-separator"], [], options); separator.style.height = totalHeight + "em"; separator.style.borderRightWidth = ruleThickness + "em"; separator.style.borderRightStyle = lineType; separator.style.margin = "0 -" + ruleThickness / 2 + "em"; separator.style.verticalAlign = -(totalHeight - offset) + "em"; cols.push(separator); } else { throw new src_ParseError("Invalid separator type: " + colDescr.separator); } colDescrNum++; colDescr = colDescriptions[colDescrNum] || {}; firstSeparator = false; } if (c >= nc) { continue; } var sepwidth = void 0; if (c > 0 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.pregap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } var col = []; for (r = 0; r < nr; ++r) { var row = body[r]; var elem = row[c]; if (!elem) { continue; } var shift = row.pos - offset; elem.depth = row.depth; elem.height = row.height; col.push({ type: "elem", elem: elem, shift: shift }); } col = buildCommon.makeVList({ positionType: "individualShift", children: col }, options); col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); cols.push(col); if (c < nc - 1 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.postgap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } } body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. if (hlines.length > 0) { var line = buildCommon.makeLineSpan("hline", options, ruleThickness); var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness); var vListElems = [{ type: "elem", elem: body, shift: 0 }]; while (hlines.length > 0) { var hline = hlines.pop(); var lineShift = hline.pos - offset; if (hline.isDashed) { vListElems.push({ type: "elem", elem: dashes, shift: lineShift }); } else { vListElems.push({ type: "elem", elem: line, shift: lineShift }); } } body = buildCommon.makeVList({ positionType: "individualShift", children: vListElems }, options); } return buildCommon.makeSpan(["mord"], [body], options); }; var alignMap = { c: "center ", l: "left ", r: "right " }; var array_mathmlBuilder = function mathmlBuilder(group, options) { var table = new mathMLTree.MathNode("mtable", group.body.map(function (row) { return new mathMLTree.MathNode("mtr", row.map(function (cell) { return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]); })); })); // Set column alignment, row spacing, column spacing, and // array lines by setting attributes on the table element. // Set the row spacing. In MathML, we specify a gap distance. // We do not use rowGap[] because MathML automatically increases // cell height with the height/depth of the element content. // LaTeX \arraystretch multiplies the row baseline-to-baseline distance. // We simulate this by adding (arraystretch - 1)em to the gap. This // does a reasonable job of adjusting arrays containing 1 em tall content. // The 0.16 and 0.09 values are found emprically. They produce an array // similar to LaTeX and in which content does not interfere with \hines. var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells. // To place a line on an edge we'll use , if necessary. var menclose = ""; var align = ""; if (group.cols && group.cols.length > 0) { // Find column alignment, column spacing, and vertical lines. var cols = group.cols; var columnLines = ""; var prevTypeWasAlign = false; var iStart = 0; var iEnd = cols.length; if (cols[0].type === "separator") { menclose += "top "; iStart = 1; } if (cols[cols.length - 1].type === "separator") { menclose += "bottom "; iEnd -= 1; } for (var i = iStart; i < iEnd; i++) { if (cols[i].type === "align") { align += alignMap[cols[i].align]; if (prevTypeWasAlign) { columnLines += "none "; } prevTypeWasAlign = true; } else if (cols[i].type === "separator") { // MathML accepts only single lines between cells. // So we read only the first of consecutive separators. if (prevTypeWasAlign) { columnLines += cols[i].separator === "|" ? "solid " : "dashed "; prevTypeWasAlign = false; } } } table.setAttribute("columnalign", align.trim()); if (/[sd]/.test(columnLines)) { table.setAttribute("columnlines", columnLines.trim()); } } // Set column spacing. if (group.colSeparationType === "align") { var _cols = group.cols || []; var spacing = ""; for (var _i = 1; _i < _cols.length; _i++) { spacing += _i % 2 ? "0em " : "1em "; } table.setAttribute("columnspacing", spacing.trim()); } else if (group.colSeparationType === "alignat") { table.setAttribute("columnspacing", "0em"); } else if (group.colSeparationType === "small") { table.setAttribute("columnspacing", "0.2778em"); } else { table.setAttribute("columnspacing", "1em"); } // Address \hline and \hdashline var rowLines = ""; var hlines = group.hLinesBeforeRow; menclose += hlines[0].length > 0 ? "left " : ""; menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) { rowLines += hlines[_i2].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. : hlines[_i2][0] ? "dashed " : "solid "; } if (/[sd]/.test(rowLines)) { table.setAttribute("rowlines", rowLines.trim()); } if (menclose !== "") { table = new mathMLTree.MathNode("menclose", [table]); table.setAttribute("notation", menclose.trim()); } if (group.arraystretch && group.arraystretch < 1) { // A small array. Wrap in scriptstyle so row gap is not too large. table = new mathMLTree.MathNode("mstyle", [table]); table.setAttribute("scriptlevel", "1"); } return table; }; // Convenience function for aligned and alignedat environments. var array_alignedHandler = function alignedHandler(context, args) { var cols = []; var res = parseArray(context.parser, { cols: cols, addJot: true }, "display"); // Determining number of columns. // 1. If the first argument is given, we use it as a number of columns, // and makes sure that each row doesn't exceed that number. // 2. Otherwise, just count number of columns = maximum number // of cells in each row ("aligned" mode -- isAligned will be true). // // At the same time, prepend empty group {} at beginning of every second // cell in each row (starting with second cell) so that operators become // binary. This behavior is implemented in amsmath's \start@aligned. var numMaths; var numCols = 0; var emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; if (args[0] && args[0].type === "ordgroup") { var arg0 = ""; for (var i = 0; i < args[0].body.length; i++) { var textord = assertNodeType(args[0].body[i], "textord"); arg0 += textord.text; } numMaths = Number(arg0); numCols = numMaths * 2; } var isAligned = !numCols; res.body.forEach(function (row) { for (var _i3 = 1; _i3 < row.length; _i3 += 2) { // Modify ordgroup node within styling node var styling = assertNodeType(row[_i3], "styling"); var ordgroup = assertNodeType(styling.body[0], "ordgroup"); ordgroup.body.unshift(emptyGroup); } if (!isAligned) { // Case 1 var curMaths = row.length / 2; if (numMaths < curMaths) { throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]); } } else if (numCols < row.length) { // Case 2 numCols = row.length; } }); // Adjusting alignment. // In aligned mode, we add one \qquad between columns; // otherwise we add nothing. for (var _i4 = 0; _i4 < numCols; ++_i4) { var align = "r"; var pregap = 0; if (_i4 % 2 === 1) { align = "l"; } else if (_i4 > 0 && isAligned) { // "aligned" mode. pregap = 1; // add one \quad } cols[_i4] = { type: "align", align: align, pregap: pregap, postgap: 0 }; } res.colSeparationType = isAligned ? "align" : "alignat"; return res; }; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation // is part of the source2e.pdf file of LaTeX2e source documentation. // {darray} is an {array} environment where cells are set in \displaystyle, // as defined in nccmath.sty. defineEnvironment({ type: "array", names: ["array", "darray"], props: { numArgs: 1 }, handler: function handler(context, args) { // Since no types are specified above, the two possibilities are // - The argument is wrapped in {} or [], in which case Parser's // parseGroup() returns an "ordgroup" wrapping some symbol node. // - The argument is a bare symbol node. var symNode = checkSymbolNodeType(args[0]); var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; var cols = colalign.map(function (nde) { var node = assertSymbolNodeType(nde); var ca = node.text; if ("lcr".indexOf(ca) !== -1) { return { type: "align", align: ca }; } else if (ca === "|") { return { type: "separator", separator: "|" }; } else if (ca === ":") { return { type: "separator", separator: ":" }; } throw new src_ParseError("Unknown column alignment: " + ca, nde); }); var res = { cols: cols, hskipBeforeAndAfter: true // \@preamble in lttab.dtx }; return parseArray(context.parser, res, dCellStyle(context.envName)); }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // The matrix environments of amsmath builds on the array environment // of LaTeX, which is discussed above. defineEnvironment({ type: "array", names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], props: { numArgs: 0 }, handler: function handler(context) { var delimiters = { "matrix": null, "pmatrix": ["(", ")"], "bmatrix": ["[", "]"], "Bmatrix": ["\\{", "\\}"], "vmatrix": ["|", "|"], "Vmatrix": ["\\Vert", "\\Vert"] }[context.envName]; // \hskip -\arraycolsep in amsmath var payload = { hskipBeforeAndAfter: false }; var res = parseArray(context.parser, payload, dCellStyle(context.envName)); return delimiters ? { type: "leftright", mode: context.mode, body: [res], left: delimiters[0], right: delimiters[1], rightColor: undefined // \right uninfluenced by \color in array } : res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); defineEnvironment({ type: "array", names: ["smallmatrix"], props: { numArgs: 0 }, handler: function handler(context) { var payload = { arraystretch: 0.5 }; var res = parseArray(context.parser, payload, "script"); res.colSeparationType = "small"; return res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); defineEnvironment({ type: "array", names: ["subarray"], props: { numArgs: 1 }, handler: function handler(context, args) { // Parsing of {subarray} is similar to {array} var symNode = checkSymbolNodeType(args[0]); var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; var cols = colalign.map(function (nde) { var node = assertSymbolNodeType(nde); var ca = node.text; // {subarray} only recognizes "l" & "c" if ("lc".indexOf(ca) !== -1) { return { type: "align", align: ca }; } throw new src_ParseError("Unknown column alignment: " + ca, nde); }); if (cols.length > 1) { throw new src_ParseError("{subarray} can contain only one column"); } var res = { cols: cols, hskipBeforeAndAfter: false, arraystretch: 0.5 }; res = parseArray(context.parser, res, "script"); if (res.body.length > 0 && res.body[0].length > 1) { throw new src_ParseError("{subarray} can contain only one column"); } return res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // A cases environment (in amsmath.sty) is almost equivalent to // \def\arraystretch{1.2}% // \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. // {dcases} is a {cases} environment where cells are set in \displaystyle, // as defined in mathtools.sty. // {rcases} is another mathtools environment. It's brace is on the right side. defineEnvironment({ type: "array", names: ["cases", "dcases", "rcases", "drcases"], props: { numArgs: 0 }, handler: function handler(context) { var payload = { arraystretch: 1.2, cols: [{ type: "align", align: "l", pregap: 0, // TODO(kevinb) get the current style. // For now we use the metrics for TEXT style which is what we were // doing before. Before attempting to get the current style we // should look at TeX's behavior especially for \over and matrices. postgap: 1.0 /* 1em quad */ }, { type: "align", align: "l", pregap: 0, postgap: 0 }] }; var res = parseArray(context.parser, payload, dCellStyle(context.envName)); return { type: "leftright", mode: context.mode, body: [res], left: context.envName.indexOf("r") > -1 ? "." : "\\{", right: context.envName.indexOf("r") > -1 ? "\\}" : ".", rightColor: undefined }; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // An aligned environment is like the align* environment // except it operates within math mode. // Note that we assume \nomallineskiplimit to be zero, // so that \strut@ is the same as \strut. defineEnvironment({ type: "array", names: ["aligned"], props: { numArgs: 0 }, handler: array_alignedHandler, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // A gathered environment is like an array environment with one centered // column, but where rows are considered lines so get \jot line spacing // and contents are set in \displaystyle. defineEnvironment({ type: "array", names: ["gathered"], props: { numArgs: 0 }, handler: function handler(context) { var res = { cols: [{ type: "align", align: "c" }], addJot: true }; return parseArray(context.parser, res, "display"); }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // alignat environment is like an align environment, but one must explicitly // specify maximum number of columns in each row, and can adjust spacing between // each columns. defineEnvironment({ type: "array", names: ["alignedat"], // One for numbered and for unnumbered; // but, KaTeX doesn't supports math numbering yet, // they make no difference for now. props: { numArgs: 1 }, handler: array_alignedHandler, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // Catch \hline outside array environment defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\hline", "\\hdashline"], props: { numArgs: 0, allowedInText: true, allowedInMath: true }, handler: function handler(context, args) { throw new src_ParseError(context.funcName + " valid only within array environment"); } }); // CONCATENATED MODULE: ./src/environments.js var environments = _environments; /* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below // CONCATENATED MODULE: ./src/functions/environment.js // Environment delimiters. HTML/MathML rendering is defined in the corresponding // defineEnvironment definitions. // $FlowFixMe, "environment" handler returns an environment ParseNode defineFunction({ type: "environment", names: ["\\begin", "\\end"], props: { numArgs: 1, argTypes: ["text"] }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var nameGroup = args[0]; if (nameGroup.type !== "ordgroup") { throw new src_ParseError("Invalid environment name", nameGroup); } var envName = ""; for (var i = 0; i < nameGroup.body.length; ++i) { envName += assertNodeType(nameGroup.body[i], "textord").text; } if (funcName === "\\begin") { // begin...end is similar to left...right if (!src_environments.hasOwnProperty(envName)) { throw new src_ParseError("No such environment: " + envName, nameGroup); } // Build the environment object. Arguments and other information will // be made available to the begin and end methods using properties. var env = src_environments[envName]; var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), _args = _parser$parseArgument.args, optArgs = _parser$parseArgument.optArgs; var context = { mode: parser.mode, envName: envName, parser: parser }; var result = env.handler(context, _args, optArgs); parser.expect("\\end", false); var endNameToken = parser.nextToken; var end = assertNodeType(parser.parseFunction(), "environment"); if (end.name !== envName) { throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken); } return result; } return { type: "environment", mode: parser.mode, name: envName, nameGroup: nameGroup }; } }); // CONCATENATED MODULE: ./src/functions/mclass.js var mclass_makeSpan = buildCommon.makeSpan; function mclass_htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, true); return mclass_makeSpan([group.mclass], elements, options); } function mclass_mathmlBuilder(group, options) { var node; var inner = buildMathML_buildExpression(group.body, options); if (group.mclass === "minner") { return mathMLTree.newDocumentFragment(inner); } else if (group.mclass === "mord") { if (group.isCharacterBox) { node = inner[0]; node.type = "mi"; } else { node = new mathMLTree.MathNode("mi", inner); } } else { if (group.isCharacterBox) { node = inner[0]; node.type = "mo"; } else { node = new mathMLTree.MathNode("mo", inner); } // Set spacing based on what is the most likely adjacent atom type. // See TeXbook p170. if (group.mclass === "mbin") { node.attributes.lspace = "0.22em"; // medium space node.attributes.rspace = "0.22em"; } else if (group.mclass === "mpunct") { node.attributes.lspace = "0em"; node.attributes.rspace = "0.17em"; // thinspace } else if (group.mclass === "mopen" || group.mclass === "mclose") { node.attributes.lspace = "0em"; node.attributes.rspace = "0em"; } // MathML default space is 5/18 em, so needs no action. // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo } return node; } // Math class commands except \mathop defineFunction({ type: "mclass", names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "mclass", mode: parser.mode, mclass: "m" + funcName.substr(5), // TODO(kevinb): don't prefix with 'm' body: ordargument(body), isCharacterBox: utils.isCharacterBox(body) }; }, htmlBuilder: mclass_htmlBuilder, mathmlBuilder: mclass_mathmlBuilder }); var binrelClass = function binrelClass(arg) { // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. // (by rendering separately and with {}s before and after, and measuring // the change in spacing). We'll do roughly the same by detecting the // atom type directly. var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { return "m" + atom.family; } else { return "mord"; } }; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord. // This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX. defineFunction({ type: "mclass", names: ["\\@binrel"], props: { numArgs: 2 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; return { type: "mclass", mode: parser.mode, mclass: binrelClass(args[0]), body: [args[1]], isCharacterBox: utils.isCharacterBox(args[1]) }; } }); // Build a relation or stacked op by placing one symbol on top of another defineFunction({ type: "mclass", names: ["\\stackrel", "\\overset", "\\underset"], props: { numArgs: 2 }, handler: function handler(_ref3, args) { var parser = _ref3.parser, funcName = _ref3.funcName; var baseArg = args[1]; var shiftedArg = args[0]; var mclass; if (funcName !== "\\stackrel") { // LaTeX applies \binrel spacing to \overset and \underset. mclass = binrelClass(baseArg); } else { mclass = "mrel"; // for \stackrel } var baseOp = { type: "op", mode: baseArg.mode, limits: true, alwaysHandleSupSub: true, parentIsSupSub: false, symbol: false, suppressBaseShift: funcName !== "\\stackrel", body: ordargument(baseArg) }; var supsub = { type: "supsub", mode: shiftedArg.mode, base: baseOp, sup: funcName === "\\underset" ? null : shiftedArg, sub: funcName === "\\underset" ? shiftedArg : null }; return { type: "mclass", mode: parser.mode, mclass: mclass, body: [supsub], isCharacterBox: utils.isCharacterBox(supsub) }; }, htmlBuilder: mclass_htmlBuilder, mathmlBuilder: mclass_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/font.js // TODO(kevinb): implement \\sl and \\sc var font_htmlBuilder = function htmlBuilder(group, options) { var font = group.font; var newOptions = options.withFont(font); return buildHTML_buildGroup(group.body, newOptions); }; var font_mathmlBuilder = function mathmlBuilder(group, options) { var font = group.font; var newOptions = options.withFont(font); return buildMathML_buildGroup(group.body, newOptions); }; var fontAliases = { "\\Bbb": "\\mathbb", "\\bold": "\\mathbf", "\\frak": "\\mathfrak", "\\bm": "\\boldsymbol" }; defineFunction({ type: "font", names: [// styles, except \boldsymbol defined below "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below "\\Bbb", "\\bold", "\\frak"], props: { numArgs: 1, greediness: 2 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; var func = funcName; if (func in fontAliases) { func = fontAliases[func]; } return { type: "font", mode: parser.mode, font: func.slice(1), body: body }; }, htmlBuilder: font_htmlBuilder, mathmlBuilder: font_mathmlBuilder }); defineFunction({ type: "mclass", names: ["\\boldsymbol", "\\bm"], props: { numArgs: 1, greediness: 2 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the // argument's bin|rel|ord status return { type: "mclass", mode: parser.mode, mclass: binrelClass(body), body: [{ type: "font", mode: parser.mode, font: "boldsymbol", body: body }], isCharacterBox: isCharacterBox }; } }); // Old font changing functions defineFunction({ type: "font", names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser, funcName = _ref3.funcName, breakOnTokenText = _ref3.breakOnTokenText; var mode = parser.mode; var body = parser.parseExpression(true, breakOnTokenText); var style = "math" + funcName.slice(1); return { type: "font", mode: mode, font: style, body: { type: "ordgroup", mode: parser.mode, body: body } }; }, htmlBuilder: font_htmlBuilder, mathmlBuilder: font_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/genfrac.js var genfrac_adjustStyle = function adjustStyle(size, originalStyle) { // Figure out what style this fraction should be in based on the // function used var style = originalStyle; if (size === "display") { // Get display style as a default. // If incoming style is sub/sup, use style.text() to get correct size. style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY; } else if (size === "text" && style.size === src_Style.DISPLAY.size) { // We're in a \tfrac but incoming style is displaystyle, so: style = src_Style.TEXT; } else if (size === "script") { style = src_Style.SCRIPT; } else if (size === "scriptscript") { style = src_Style.SCRIPTSCRIPT; } return style; }; var genfrac_htmlBuilder = function htmlBuilder(group, options) { // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). var style = genfrac_adjustStyle(group.size, options.style); var nstyle = style.fracNum(); var dstyle = style.fracDen(); var newOptions; newOptions = options.havingStyle(nstyle); var numerm = buildHTML_buildGroup(group.numer, newOptions, options); if (group.continued) { // \cfrac inserts a \strut into the numerator. // Get \strut dimensions from TeXbook page 353. var hStrut = 8.5 / options.fontMetrics().ptPerEm; var dStrut = 3.5 / options.fontMetrics().ptPerEm; numerm.height = numerm.height < hStrut ? hStrut : numerm.height; numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; } newOptions = options.havingStyle(dstyle); var denomm = buildHTML_buildGroup(group.denom, newOptions, options); var rule; var ruleWidth; var ruleSpacing; if (group.hasBarLine) { if (group.barSize) { ruleWidth = units_calculateSize(group.barSize, options); rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); } else { rule = buildCommon.makeLineSpan("frac-line", options); } ruleWidth = rule.height; ruleSpacing = rule.height; } else { rule = null; ruleWidth = 0; ruleSpacing = options.fontMetrics().defaultRuleThickness; } // Rule 15b var numShift; var clearance; var denomShift; if (style.size === src_Style.DISPLAY.size || group.size === "display") { numShift = options.fontMetrics().num1; if (ruleWidth > 0) { clearance = 3 * ruleSpacing; } else { clearance = 7 * ruleSpacing; } denomShift = options.fontMetrics().denom1; } else { if (ruleWidth > 0) { numShift = options.fontMetrics().num2; clearance = ruleSpacing; } else { numShift = options.fontMetrics().num3; clearance = 3 * ruleSpacing; } denomShift = options.fontMetrics().denom2; } var frac; if (!rule) { // Rule 15c var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); if (candidateClearance < clearance) { numShift += 0.5 * (clearance - candidateClearance); denomShift += 0.5 * (clearance - candidateClearance); } frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } else { // Rule 15d var axisHeight = options.fontMetrics().axisHeight; if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); } if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); } var midShift = -(axisHeight - 0.5 * ruleWidth); frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } // Since we manually change the style sometimes (with \dfrac or \tfrac), // account for the possible size change here. newOptions = options.havingStyle(style); frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e var delimSize; if (style.size === src_Style.DISPLAY.size) { delimSize = options.fontMetrics().delim1; } else { delimSize = options.fontMetrics().delim2; } var leftDelim; var rightDelim; if (group.leftDelim == null) { leftDelim = makeNullDelimiter(options, ["mopen"]); } else { leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); } if (group.continued) { rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac } else if (group.rightDelim == null) { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); } return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); }; var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]); if (!group.hasBarLine) { node.setAttribute("linethickness", "0px"); } else if (group.barSize) { var ruleWidth = units_calculateSize(group.barSize, options); node.setAttribute("linethickness", ruleWidth + "em"); } var style = genfrac_adjustStyle(group.size, options.style); if (style.size !== options.style.size) { node = new mathMLTree.MathNode("mstyle", [node]); var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false"; node.setAttribute("displaystyle", isDisplay); node.setAttribute("scriptlevel", "0"); } if (group.leftDelim != null || group.rightDelim != null) { var withDelims = []; if (group.leftDelim != null) { var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]); leftOp.setAttribute("fence", "true"); withDelims.push(leftOp); } withDelims.push(node); if (group.rightDelim != null) { var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]); rightOp.setAttribute("fence", "true"); withDelims.push(rightOp); } return buildMathML_makeRow(withDelims); } return node; }; defineFunction({ type: "genfrac", names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly "\\\\bracefrac", "\\\\brackfrac"], props: { numArgs: 2, greediness: 2 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var numer = args[0]; var denom = args[1]; var hasBarLine; var leftDelim = null; var rightDelim = null; var size = "auto"; switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\frac": case "\\tfrac": hasBarLine = true; break; case "\\\\atopfrac": hasBarLine = false; break; case "\\dbinom": case "\\binom": case "\\tbinom": hasBarLine = false; leftDelim = "("; rightDelim = ")"; break; case "\\\\bracefrac": hasBarLine = false; leftDelim = "\\{"; rightDelim = "\\}"; break; case "\\\\brackfrac": hasBarLine = false; leftDelim = "["; rightDelim = "]"; break; default: throw new Error("Unrecognized genfrac command"); } switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\dbinom": size = "display"; break; case "\\tfrac": case "\\tbinom": size = "text"; break; } return { type: "genfrac", mode: parser.mode, continued: funcName === "\\cfrac", numer: numer, denom: denom, hasBarLine: hasBarLine, leftDelim: leftDelim, rightDelim: rightDelim, size: size, barSize: null }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // Infix generalized fractions -- these are not rendered directly, but replaced // immediately by one of the variants above. defineFunction({ type: "infix", names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], props: { numArgs: 0, infix: true }, handler: function handler(_ref2) { var parser = _ref2.parser, funcName = _ref2.funcName, token = _ref2.token; var replaceWith; switch (funcName) { case "\\over": replaceWith = "\\frac"; break; case "\\choose": replaceWith = "\\binom"; break; case "\\atop": replaceWith = "\\\\atopfrac"; break; case "\\brace": replaceWith = "\\\\bracefrac"; break; case "\\brack": replaceWith = "\\\\brackfrac"; break; default: throw new Error("Unrecognized infix genfrac command"); } return { type: "infix", mode: parser.mode, replaceWith: replaceWith, token: token }; } }); var stylArray = ["display", "text", "script", "scriptscript"]; var delimFromValue = function delimFromValue(delimString) { var delim = null; if (delimString.length > 0) { delim = delimString; delim = delim === "." ? null : delim; } return delim; }; defineFunction({ type: "genfrac", names: ["\\genfrac"], props: { numArgs: 6, greediness: 6, argTypes: ["math", "math", "size", "text", "math", "math"] }, handler: function handler(_ref3, args) { var parser = _ref3.parser; var numer = args[4]; var denom = args[5]; // Look into the parse nodes to get the desired delimiters. var leftDelim = args[0].type === "atom" && args[0].family === "open" ? delimFromValue(args[0].text) : null; var rightDelim = args[1].type === "atom" && args[1].family === "close" ? delimFromValue(args[1].text) : null; var barNode = assertNodeType(args[2], "size"); var hasBarLine; var barSize = null; if (barNode.isBlank) { // \genfrac acts differently than \above. // \genfrac treats an empty size group as a signal to use a // standard bar size. \above would see size = 0 and omit the bar. hasBarLine = true; } else { barSize = barNode.value; hasBarLine = barSize.number > 0; } // Find out if we want displaystyle, textstyle, etc. var size = "auto"; var styl = args[3]; if (styl.type === "ordgroup") { if (styl.body.length > 0) { var textOrd = assertNodeType(styl.body[0], "textord"); size = stylArray[Number(textOrd.text)]; } } else { styl = assertNodeType(styl, "textord"); size = stylArray[Number(styl.text)]; } return { type: "genfrac", mode: parser.mode, numer: numer, denom: denom, continued: false, hasBarLine: hasBarLine, barSize: barSize, leftDelim: leftDelim, rightDelim: rightDelim, size: size }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // \above is an infix fraction that also defines a fraction bar size. defineFunction({ type: "infix", names: ["\\above"], props: { numArgs: 1, argTypes: ["size"], infix: true }, handler: function handler(_ref4, args) { var parser = _ref4.parser, funcName = _ref4.funcName, token = _ref4.token; return { type: "infix", mode: parser.mode, replaceWith: "\\\\abovefrac", size: assertNodeType(args[0], "size").value, token: token }; } }); defineFunction({ type: "genfrac", names: ["\\\\abovefrac"], props: { numArgs: 3, argTypes: ["math", "size", "math"] }, handler: function handler(_ref5, args) { var parser = _ref5.parser, funcName = _ref5.funcName; var numer = args[0]; var barSize = assert(assertNodeType(args[1], "infix").size); var denom = args[2]; var hasBarLine = barSize.number > 0; return { type: "genfrac", mode: parser.mode, numer: numer, denom: denom, continued: false, hasBarLine: hasBarLine, barSize: barSize, leftDelim: null, rightDelim: null, size: "auto" }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/horizBrace.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but var horizBrace_htmlBuilder = function htmlBuilder(grp, options) { var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. var supSubGroup; var group; if (grp.type === "supsub") { // Ref: LaTeX source2e: }}}}\limits} // i.e. LaTeX treats the brace similar to an op and passes it // with \limits, so we need to assign supsub style. supSubGroup = grp.sup ? buildHTML_buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(grp.sub, options.havingStyle(style.sub()), options); group = assertNodeType(grp.base, "horizBrace"); } else { group = assertNodeType(grp, "horizBrace"); } // Build the base group var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ // This first vlist contains the content and the brace: equation var vlist; if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: body.depth + 0.1 + braceBody.height, children: [{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[0].classes.push("svg-align"); } if (supSubGroup) { // To write the supsub, wrap the first vlist in another vlist: // They can't all go in the same vlist, because the note might be // wider than the equation. We want the equation to control the // brace width. // note long note long note // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ // equation eqn eqn var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, children: [{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }] }, options); } } return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); }; var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) { var accentNode = stretchy.mathMLnode(group.label); return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]); }; // Horizontal stretchy braces defineFunction({ type: "horizBrace", names: ["\\overbrace", "\\underbrace"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; return { type: "horizBrace", mode: parser.mode, label: funcName, isOver: /^\\over/.test(funcName), base: args[0] }; }, htmlBuilder: horizBrace_htmlBuilder, mathmlBuilder: horizBrace_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/href.js defineFunction({ type: "href", names: ["\\href"], props: { numArgs: 2, argTypes: ["url", "original"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[1]; var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\href", url: href })) { return parser.formatUnsupportedCmd("\\href"); } return { type: "href", mode: parser.mode, href: href, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, false); return buildCommon.makeAnchor(group.href, [], elements, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var math = buildExpressionRow(group.body, options); if (!(math instanceof mathMLTree_MathNode)) { math = new mathMLTree_MathNode("mrow", [math]); } math.setAttribute("href", group.href); return math; } }); defineFunction({ type: "href", names: ["\\url"], props: { numArgs: 1, argTypes: ["url"], allowedInText: true }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\url", url: href })) { return parser.formatUnsupportedCmd("\\url"); } var chars = []; for (var i = 0; i < href.length; i++) { var c = href[i]; if (c === "~") { c = "\\textasciitilde"; } chars.push({ type: "textord", mode: "text", text: c }); } var body = { type: "text", mode: parser.mode, font: "\\texttt", body: chars }; return { type: "href", mode: parser.mode, href: href, body: ordargument(body) }; } }); // CONCATENATED MODULE: ./src/functions/html.js defineFunction({ type: "html", names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], props: { numArgs: 2, argTypes: ["raw", "original"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName, token = _ref.token; var value = assertNodeType(args[0], "raw").string; var body = args[1]; if (parser.settings.strict) { parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); } var trustContext; var attributes = {}; switch (funcName) { case "\\htmlClass": attributes.class = value; trustContext = { command: "\\htmlClass", class: value }; break; case "\\htmlId": attributes.id = value; trustContext = { command: "\\htmlId", id: value }; break; case "\\htmlStyle": attributes.style = value; trustContext = { command: "\\htmlStyle", style: value }; break; case "\\htmlData": { var data = value.split(","); for (var i = 0; i < data.length; i++) { var keyVal = data[i].split("="); if (keyVal.length !== 2) { throw new src_ParseError("Error parsing key-value for \\htmlData"); } attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); } trustContext = { command: "\\htmlData", attributes: attributes }; break; } default: throw new Error("Unrecognized html command"); } if (!parser.settings.isTrusted(trustContext)) { return parser.formatUnsupportedCmd(funcName); } return { type: "html", mode: parser.mode, attributes: attributes, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, false); var classes = ["enclosing"]; if (group.attributes.class) { classes.push.apply(classes, group.attributes.class.trim().split(/\s+/)); } var span = buildCommon.makeSpan(classes, elements, options); for (var attr in group.attributes) { if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { span.setAttribute(attr, group.attributes[attr]); } } return span; }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.body, options); } }); // CONCATENATED MODULE: ./src/functions/htmlmathml.js defineFunction({ type: "htmlmathml", names: ["\\html@mathml"], props: { numArgs: 2, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "htmlmathml", mode: parser.mode, html: ordargument(args[0]), mathml: ordargument(args[1]) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.html, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.mathml, options); } }); // CONCATENATED MODULE: ./src/functions/includegraphics.js var includegraphics_sizeData = function sizeData(str) { if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { // str is a number with no unit specified. // default unit is bp, per graphix package. return { number: +str, unit: "bp" }; } else { var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); if (!match) { throw new src_ParseError("Invalid size: '" + str + "' in \\includegraphics"); } var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new src_ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics."); } return data; } }; defineFunction({ type: "includegraphics", names: ["\\includegraphics"], props: { numArgs: 1, numOptionalArgs: 1, argTypes: ["raw", "url"], allowedInText: false }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var width = { number: 0, unit: "em" }; var height = { number: 0.9, unit: "em" }; // sorta character sized. var totalheight = { number: 0, unit: "em" }; var alt = ""; if (optArgs[0]) { var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string. var attributes = attributeStr.split(","); for (var i = 0; i < attributes.length; i++) { var keyVal = attributes[i].split("="); if (keyVal.length === 2) { var str = keyVal[1].trim(); switch (keyVal[0].trim()) { case "alt": alt = str; break; case "width": width = includegraphics_sizeData(str); break; case "height": height = includegraphics_sizeData(str); break; case "totalheight": totalheight = includegraphics_sizeData(str); break; default: throw new src_ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics."); } } } } var src = assertNodeType(args[0], "url").url; if (alt === "") { // No alt given. Use the file name. Strip away the path. alt = src; alt = alt.replace(/^.*[\\/]/, ''); alt = alt.substring(0, alt.lastIndexOf('.')); } if (!parser.settings.isTrusted({ command: "\\includegraphics", url: src })) { return parser.formatUnsupportedCmd("\\includegraphics"); } return { type: "includegraphics", mode: parser.mode, alt: alt, width: width, height: height, totalheight: totalheight, src: src }; }, htmlBuilder: function htmlBuilder(group, options) { var height = units_calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { depth = units_calculateSize(group.totalheight, options) - height; depth = Number(depth.toFixed(2)); } var width = 0; if (group.width.number > 0) { width = units_calculateSize(group.width, options); } var style = { height: height + depth + "em" }; if (width > 0) { style.width = width + "em"; } if (depth > 0) { style.verticalAlign = -depth + "em"; } var node = new domTree_Img(group.src, group.alt, style); node.height = height; node.depth = depth; return node; }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mglyph", []); node.setAttribute("alt", group.alt); var height = units_calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { depth = units_calculateSize(group.totalheight, options) - height; depth = depth.toFixed(2); node.setAttribute("valign", "-" + depth + "em"); } node.setAttribute("height", height + depth + "em"); if (group.width.number > 0) { var width = units_calculateSize(group.width, options); node.setAttribute("width", width + "em"); } node.setAttribute("src", group.src); return node; } }); // CONCATENATED MODULE: ./src/functions/kern.js // Horizontal spacing commands // TODO: \hskip and \mskip should support plus and minus in lengths defineFunction({ type: "kern", names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], props: { numArgs: 1, argTypes: ["size"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var size = assertNodeType(args[0], "size"); if (parser.settings.strict) { var mathFunction = funcName[1] === 'm'; // \mkern, \mskip var muUnit = size.value.unit === 'mu'; if (mathFunction) { if (!muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units")); } if (parser.mode !== "math") { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode"); } } else { // !mathFunction if (muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units"); } } } return { type: "kern", mode: parser.mode, dimension: size.value }; }, htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeGlue(group.dimension, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var dimension = units_calculateSize(group.dimension, options); return new mathMLTree.SpaceNode(dimension); } }); // CONCATENATED MODULE: ./src/functions/lap.js // Horizontal overlap functions defineFunction({ type: "lap", names: ["\\mathllap", "\\mathrlap", "\\mathclap"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "lap", mode: parser.mode, alignment: funcName.slice(5), body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // mathllap, mathrlap, mathclap var inner; if (group.alignment === "clap") { // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span inner = buildCommon.makeSpan(["inner"], [inner], options); } else { inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options)]); } var fix = buildCommon.makeSpan(["fix"], []); var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the // two items involved in the lap. // Next, use a strut to set the height of the HTML bounding box. // Otherwise, a tall argument may be misplaced. // This code resolved issue #1153 var strut = buildCommon.makeSpan(["strut"]); strut.style.height = node.height + node.depth + "em"; strut.style.verticalAlign = -node.depth + "em"; node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. // This code resolves issue #1234 node = buildCommon.makeSpan(["thinbox"], [node], options); return buildCommon.makeSpan(["mord", "vbox"], [node], options); }, mathmlBuilder: function mathmlBuilder(group, options) { // mathllap, mathrlap, mathclap var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); if (group.alignment !== "rlap") { var offset = group.alignment === "llap" ? "-1" : "-0.5"; node.setAttribute("lspace", offset + "width"); } node.setAttribute("width", "0px"); return node; } }); // CONCATENATED MODULE: ./src/functions/math.js // Switching from text mode back to math mode defineFunction({ type: "styling", names: ["\\(", "$"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler: function handler(_ref, args) { var funcName = _ref.funcName, parser = _ref.parser; var outerMode = parser.mode; parser.switchMode("math"); var close = funcName === "\\(" ? "\\)" : "$"; var body = parser.parseExpression(false, close); parser.expect(close); parser.switchMode(outerMode); return { type: "styling", mode: parser.mode, style: "text", body: body }; } }); // Check for extra closing math delimiters defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\)", "\\]"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler: function handler(context, args) { throw new src_ParseError("Mismatched " + context.funcName); } }); // CONCATENATED MODULE: ./src/functions/mathchoice.js var mathchoice_chooseMathStyle = function chooseMathStyle(group, options) { switch (options.style.size) { case src_Style.DISPLAY.size: return group.display; case src_Style.TEXT.size: return group.text; case src_Style.SCRIPT.size: return group.script; case src_Style.SCRIPTSCRIPT.size: return group.scriptscript; default: return group.text; } }; defineFunction({ type: "mathchoice", names: ["\\mathchoice"], props: { numArgs: 4 }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "mathchoice", mode: parser.mode, display: ordargument(args[0]), text: ordargument(args[1]), script: ordargument(args[2]), scriptscript: ordargument(args[3]) }; }, htmlBuilder: function htmlBuilder(group, options) { var body = mathchoice_chooseMathStyle(group, options); var elements = buildHTML_buildExpression(body, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { var body = mathchoice_chooseMathStyle(group, options); return buildExpressionRow(body, options); } }); // CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js // For an operator with limits, assemble the base, sup, and sub into a span. var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) { base = buildCommon.makeSpan([], [base]); var sub; var sup; // We manually have to handle the superscripts and subscripts. This, // aside from the kern calculations, is copied from supsub. if (supGroup) { var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options); sup = { elem: elem, kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) }; } if (subGroup) { var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options); sub = { elem: _elem, kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) }; } // Build the final group as a vlist of the possible subscript, base, // and possible superscript. var finalGroup; if (sup && sub) { var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: bottom, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else if (sub) { var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note // that we are supposed to shift the limits by 1/2 of the slant, // but since we are centering the limits adding a full slant of // margin will shift by 1/2 that. finalGroup = buildCommon.makeVList({ positionType: "top", positionData: top, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }] }, options); } else if (sup) { var _bottom = base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: _bottom, children: [{ type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else { // This case probably shouldn't occur (this would mean the // supsub was sending us a group with no superscript or // subscript) but be safe. return base; } return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); }; // CONCATENATED MODULE: ./src/functions/op.js // Limits, symbols // Most operators have a large successor symbol, but these don't. var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also // "supsub" since some of them (like \int) can affect super/subscripting. var op_htmlBuilder = function htmlBuilder(grp, options) { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). var supGroup; var subGroup; var hasLimits = false; var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "op"); hasLimits = true; } else { group = assertNodeType(grp, "op"); } var style = options.style; var large = false; if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { // Most symbol operators get larger in displaystyle (rule 13) large = true; } var base; if (group.symbol) { // If this is a symbol, create the symbol. var fontName = large ? "Size2-Regular" : "Size1-Regular"; var stash = ""; if (group.name === "\\oiint" || group.name === "\\oiiint") { // No font glyphs yet, so use a glyph w/o the oval. // TODO: When font glyphs are available, delete this code. stash = group.name.substr(1); // $FlowFixMe group.name = stash === "oiint" ? "\\iint" : "\\iiint"; } base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); if (stash.length > 0) { // We're in \oiint or \oiiint. Overlay the oval. // TODO: When font glyphs are available, delete this code. var italic = base.italic; var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); base = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: base, shift: 0 }, { type: "elem", elem: oval, shift: large ? 0.08 : 0 }] }, options); // $FlowFixMe group.name = "\\" + stash; base.classes.unshift("mop"); // $FlowFixMe base.italic = italic; } } else if (group.body) { // If this is a list, compose that list. var inner = buildHTML_buildExpression(group.body, options, true); if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) { base = inner[0]; base.classes[0] = "mop"; // replace old mclass } else { base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); } } else { // Otherwise, this is a text operator. Build the text from the // operator's name. // TODO(emily): Add a space in the middle of some of these // operators, like \limsup var output = []; for (var i = 1; i < group.name.length; i++) { output.push(buildCommon.mathsym(group.name[i], group.mode, options)); } base = buildCommon.makeSpan(["mop"], output, options); } // If content of op is a single symbol, shift it vertically. var baseShift = 0; var slant = 0; if ((base instanceof domTree_SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { // We suppress the shift of the base of \overset and \underset. Otherwise, // shift the symbol so its center lies on the axis (rule 13). It // appears that our fonts have the centers of the symbols already // almost on the axis, so these numbers are very small. Note we // don't actually apply this here, but instead it is used either in // the vlist creation or separately when there are no limits. baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction. // $FlowFixMe slant = base.italic; } if (hasLimits) { return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift); } else { if (baseShift) { base.style.position = "relative"; base.style.top = baseShift + "em"; } return base; } }; var op_mathmlBuilder = function mathmlBuilder(group, options) { var node; if (group.symbol) { // This is a symbol. Just add the symbol. node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]); if (utils.contains(noSuccessor, group.name)) { node.setAttribute("largeop", "false"); } } else if (group.body) { // This is an operator with children. Add them. node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options)); } else { // This is a text operator. Add all of the characters from the // operator's name. node = new mathMLTree_MathNode("mi", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an . // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]); if (group.parentIsSupSub) { node = new mathMLTree_MathNode("mo", [node, operator]); } else { node = newDocumentFragment([node, operator]); } } return node; }; var singleCharBigOps = { "\u220F": "\\prod", "\u2210": "\\coprod", "\u2211": "\\sum", "\u22C0": "\\bigwedge", "\u22C1": "\\bigvee", "\u22C2": "\\bigcap", "\u22C3": "\\bigcup", "\u2A00": "\\bigodot", "\u2A01": "\\bigoplus", "\u2A02": "\\bigotimes", "\u2A04": "\\biguplus", "\u2A06": "\\bigsqcup" }; defineFunction({ type: "op", names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], props: { numArgs: 0 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var fName = funcName; if (fName.length === 1) { fName = singleCharBigOps[fName]; } return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // Note: calling defineFunction with a type that's already been defined only // works because the same htmlBuilder and mathmlBuilder are being used. defineFunction({ type: "op", names: ["\\mathop"], props: { numArgs: 1 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, body: ordargument(body) }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // There are 2 flags for operators; whether they produce limits in // displaystyle, and whether they are symbols and should grow in // displaystyle. These four groups cover the four possible choices. var singleCharIntegrals = { "\u222B": "\\int", "\u222C": "\\iint", "\u222D": "\\iiint", "\u222E": "\\oint", "\u222F": "\\oiint", "\u2230": "\\oiiint" }; // No limits, not symbols defineFunction({ type: "op", names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], props: { numArgs: 0 }, handler: function handler(_ref3) { var parser = _ref3.parser, funcName = _ref3.funcName; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // Limits, not symbols defineFunction({ type: "op", names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], props: { numArgs: 0 }, handler: function handler(_ref4) { var parser = _ref4.parser, funcName = _ref4.funcName; return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // No limits, symbols defineFunction({ type: "op", names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"], props: { numArgs: 0 }, handler: function handler(_ref5) { var parser = _ref5.parser, funcName = _ref5.funcName; var fName = funcName; if (fName.length === 1) { fName = singleCharIntegrals[fName]; } return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/operatorname.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only // "operatorname", but also "supsub" since \operatorname* can var operatorname_htmlBuilder = function htmlBuilder(grp, options) { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). var supGroup; var subGroup; var hasLimits = false; var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "operatorname"); hasLimits = true; } else { group = assertNodeType(grp, "operatorname"); } var base; if (group.body.length > 0) { var body = group.body.map(function (child) { // $FlowFixMe: Check if the node has a string `text` property. var childText = child.text; if (typeof childText === "string") { return { type: "textord", mode: child.mode, text: childText }; } else { return child; } }); // Consolidate function names into symbol characters. var expression = buildHTML_buildExpression(body, options.withFont("mathrm"), true); for (var i = 0; i < expression.length; i++) { var child = expression[i]; if (child instanceof domTree_SymbolNode) { // Per amsopn package, // change minus to hyphen and \ast to asterisk child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } } base = buildCommon.makeSpan(["mop"], expression, options); } else { base = buildCommon.makeSpan(["mop"], [], options); } if (hasLimits) { return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0); } else { return base; } }; var operatorname_mathmlBuilder = function mathmlBuilder(group, options) { // The steps taken here are similar to the html version. var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? var isAllString = true; // default for (var i = 0; i < expression.length; i++) { var node = expression[i]; if (node instanceof mathMLTree.SpaceNode) ; else if (node instanceof mathMLTree.MathNode) { switch (node.type) { case "mi": case "mn": case "ms": case "mspace": case "mtext": break; // Do nothing yet. case "mo": { var child = node.children[0]; if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } else { isAllString = false; } break; } default: isAllString = false; } } else { isAllString = false; } } if (isAllString) { // Write a single TextNode instead of multiple nested tags. var word = expression.map(function (node) { return node.toText(); }).join(""); expression = [new mathMLTree.TextNode(word)]; } var identifier = new mathMLTree.MathNode("mi", expression); identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp var operator = new mathMLTree.MathNode("mo", [buildMathML_makeText("\u2061", "text")]); if (group.parentIsSupSub) { return new mathMLTree.MathNode("mo", [identifier, operator]); } else { return mathMLTree.newDocumentFragment([identifier, operator]); } }; // \operatorname // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ defineFunction({ type: "operatorname", names: ["\\operatorname", "\\operatorname*"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "operatorname", mode: parser.mode, body: ordargument(body), alwaysHandleSupSub: funcName === "\\operatorname*", limits: false, parentIsSupSub: false }; }, htmlBuilder: operatorname_htmlBuilder, mathmlBuilder: operatorname_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/ordgroup.js defineFunctionBuilders({ type: "ordgroup", htmlBuilder: function htmlBuilder(group, options) { if (group.semisimple) { return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false)); } return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.body, options, true); } }); // CONCATENATED MODULE: ./src/functions/overline.js defineFunction({ type: "overline", names: ["\\overline"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[0]; return { type: "overline", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // Overlines are handled in the TeXbook pg 443, Rule 9. // Build the inner group in the cramped style. var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; var vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: defaultRuleThickness }] }, options); return buildCommon.makeSpan(["mord", "overline"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); operator.setAttribute("stretchy", "true"); var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]); node.setAttribute("accent", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/phantom.js defineFunction({ type: "phantom", names: ["\\phantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[0]; return { type: "phantom", mode: parser.mode, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. // See "color" for more details. return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(group.body, options); return new mathMLTree.MathNode("mphantom", inner); } }); defineFunction({ type: "hphantom", names: ["\\hphantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; return { type: "hphantom", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]); node.height = 0; node.depth = 0; if (node.children) { for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; node.children[i].depth = 0; } } // See smash for comment re: use of makeVList node = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [node], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(ordargument(group.body), options); var phantom = new mathMLTree.MathNode("mphantom", inner); var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("height", "0px"); node.setAttribute("depth", "0px"); return node; } }); defineFunction({ type: "vphantom", names: ["\\vphantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser; var body = args[0]; return { type: "vphantom", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options.withPhantom())]); var fix = buildCommon.makeSpan(["fix"], []); return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(ordargument(group.body), options); var phantom = new mathMLTree.MathNode("mphantom", inner); var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("width", "0px"); return node; } }); // CONCATENATED MODULE: ./src/functions/raisebox.js // Box manipulation defineFunction({ type: "raisebox", names: ["\\raisebox"], props: { numArgs: 2, argTypes: ["size", "hbox"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var amount = assertNodeType(args[0], "size").value; var body = args[1]; return { type: "raisebox", mode: parser.mode, dy: amount, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var body = buildHTML_buildGroup(group.body, options); var dy = units_calculateSize(group.dy, options); return buildCommon.makeVList({ positionType: "shift", positionData: -dy, children: [{ type: "elem", elem: body }] }, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); var dy = group.dy.number + group.dy.unit; node.setAttribute("voffset", dy); return node; } }); // CONCATENATED MODULE: ./src/functions/rule.js defineFunction({ type: "rule", names: ["\\rule"], props: { numArgs: 2, numOptionalArgs: 1, argTypes: ["size", "size", "size"] }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var shift = optArgs[0]; var width = assertNodeType(args[0], "size"); var height = assertNodeType(args[1], "size"); return { type: "rule", mode: parser.mode, shift: shift && assertNodeType(shift, "size").value, width: width.value, height: height.value }; }, htmlBuilder: function htmlBuilder(group, options) { // Make an empty span for the rule var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units var width = units_calculateSize(group.width, options); var height = units_calculateSize(group.height, options); var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size rule.style.borderRightWidth = width + "em"; rule.style.borderTopWidth = height + "em"; rule.style.bottom = shift + "em"; // Record the height and width rule.width = width; rule.height = height + shift; rule.depth = -shift; // Font size is the number large enough that the browser will // reserve at least `absHeight` space above the baseline. // The 1.125 factor was empirically determined rule.maxFontSize = height * 1.125 * options.sizeMultiplier; return rule; }, mathmlBuilder: function mathmlBuilder(group, options) { var width = units_calculateSize(group.width, options); var height = units_calculateSize(group.height, options); var shift = group.shift ? units_calculateSize(group.shift, options) : 0; var color = options.color && options.getColor() || "black"; var rule = new mathMLTree.MathNode("mspace"); rule.setAttribute("mathbackground", color); rule.setAttribute("width", width + "em"); rule.setAttribute("height", height + "em"); var wrapper = new mathMLTree.MathNode("mpadded", [rule]); if (shift >= 0) { wrapper.setAttribute("height", "+" + shift + "em"); } else { wrapper.setAttribute("height", shift + "em"); wrapper.setAttribute("depth", "+" + -shift + "em"); } wrapper.setAttribute("voffset", shift + "em"); return wrapper; } }); // CONCATENATED MODULE: ./src/functions/sizing.js function sizingGroup(value, options, baseOptions) { var inner = buildHTML_buildExpression(value, options, false); var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize // manually. Handle nested size changes. for (var i = 0; i < inner.length; i++) { var pos = inner[i].classes.indexOf("sizing"); if (pos < 0) { Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { // This is a nested size change: e.g., inner[i] is the "b" in // `\Huge a \small b`. Override the old size (the `reset-` class) // but not the new size. inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; } inner[i].height *= multiplier; inner[i].depth *= multiplier; } return buildCommon.makeFragment(inner); } var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; var sizing_htmlBuilder = function htmlBuilder(group, options) { // Handle sizing operators like \Huge. Real TeX doesn't actually allow // these functions inside of math expressions, so we do some special // handling. var newOptions = options.havingSize(group.size); return sizingGroup(group.body, newOptions, options); }; defineFunction({ type: "sizing", names: sizeFuncs, props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref, args) { var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; var body = parser.parseExpression(false, breakOnTokenText); return { type: "sizing", mode: parser.mode, // Figure out what size to use based on the list of functions above size: sizeFuncs.indexOf(funcName) + 1, body: body }; }, htmlBuilder: sizing_htmlBuilder, mathmlBuilder: function mathmlBuilder(group, options) { var newOptions = options.havingSize(group.size); var inner = buildMathML_buildExpression(group.body, newOptions); var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size // changes, because we don't keep state of what style we're currently // in, so we can't reset the size to normal before changing it. Now // that we're passing an options parameter we should be able to fix // this. node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); return node; } }); // CONCATENATED MODULE: ./src/functions/smash.js // smash, with optional [tb], as in AMS defineFunction({ type: "smash", names: ["\\smash"], props: { numArgs: 1, numOptionalArgs: 1, allowedInText: true }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var smashHeight = false; var smashDepth = false; var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); if (tbArg) { // Optional [tb] argument is engaged. // ref: amsmath: \renewcommand{\smash}[1][tb]{% // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% var letter = ""; for (var i = 0; i < tbArg.body.length; ++i) { var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. letter = node.text; if (letter === "t") { smashHeight = true; } else if (letter === "b") { smashDepth = true; } else { smashHeight = false; smashDepth = false; break; } } } else { smashHeight = true; smashDepth = true; } var body = args[0]; return { type: "smash", mode: parser.mode, body: body, smashHeight: smashHeight, smashDepth: smashDepth }; }, htmlBuilder: function htmlBuilder(group, options) { var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); if (!group.smashHeight && !group.smashDepth) { return node; } if (group.smashHeight) { node.height = 0; // In order to influence makeVList, we have to reset the children. if (node.children) { for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; } } } if (group.smashDepth) { node.depth = 0; if (node.children) { for (var _i = 0; _i < node.children.length; _i++) { node.children[_i].depth = 0; } } } // At this point, we've reset the TeX-like height and depth values. // But the span still has an HTML line height. // makeVList applies "display: table-cell", which prevents the browser // from acting on that line height. So we'll call makeVList now. var smashedNode = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [smashedNode], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); if (group.smashHeight) { node.setAttribute("height", "0px"); } if (group.smashDepth) { node.setAttribute("depth", "0px"); } return node; } }); // CONCATENATED MODULE: ./src/functions/sqrt.js defineFunction({ type: "sqrt", names: ["\\sqrt"], props: { numArgs: 1, numOptionalArgs: 1 }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var index = optArgs[0]; var body = args[0]; return { type: "sqrt", mode: parser.mode, body: body, index: index }; }, htmlBuilder: function htmlBuilder(group, options) { // Square roots are handled in the TeXbook pg. 443, Rule 11. // First, we do the same steps as in overline to build the inner group // and line var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); if (inner.height === 0) { // Render a small surd. inner.height = options.fontMetrics().xHeight; } // Some groups can return document fragments. Handle those by wrapping // them in a span. inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter var metrics = options.fontMetrics(); var theta = metrics.defaultRuleThickness; var phi = theta; if (options.style.id < src_Style.TEXT.id) { phi = options.fontMetrics().xHeight; } // Calculate the clearance between the body and line var lineClearance = theta + phi / 4; var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), img = _delimiter$sqrtImage.span, ruleWidth = _delimiter$sqrtImage.ruleWidth, advanceWidth = _delimiter$sqrtImage.advanceWidth; var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size if (delimDepth > inner.height + inner.depth + lineClearance) { lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; } // Shift the sqrt image var imgShift = img.height - inner.height - lineClearance - ruleWidth; inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. var body = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: inner, wrapperClasses: ["svg-align"] }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }] }, options); if (!group.index) { return buildCommon.makeSpan(["mord", "sqrt"], [body], options); } else { // Handle the optional root index // The index is always in scriptscript style var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT); var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX // source, in the definition of `\r@@t`. var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly var rootVList = buildCommon.makeVList({ positionType: "shift", positionData: -toShift, children: [{ type: "elem", elem: rootm }] }, options); // Add a class surrounding it so we can add on the appropriate // kerning var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); } }, mathmlBuilder: function mathmlBuilder(group, options) { var body = group.body, index = group.index; return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]); } }); // CONCATENATED MODULE: ./src/functions/styling.js var styling_styleMap = { "display": src_Style.DISPLAY, "text": src_Style.TEXT, "script": src_Style.SCRIPT, "scriptscript": src_Style.SCRIPTSCRIPT }; defineFunction({ type: "styling", names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref, args) { var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; // parse out the implicit body var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. // here and in buildHTML and de-dupe the enumeration of all the styles). // $FlowFixMe: The names above exactly match the styles. var style = funcName.slice(1, funcName.length - 5); return { type: "styling", mode: parser.mode, // Figure out what style to use by pulling out the style from // the function name style: style, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // Style changes are handled in the TeXbook on pg. 442, Rule 3. var newStyle = styling_styleMap[group.style]; var newOptions = options.havingStyle(newStyle).withFont(''); return sizingGroup(group.body, newOptions, options); }, mathmlBuilder: function mathmlBuilder(group, options) { // Figure out what style we're changing to. var newStyle = styling_styleMap[group.style]; var newOptions = options.havingStyle(newStyle); var inner = buildMathML_buildExpression(group.body, newOptions); var node = new mathMLTree.MathNode("mstyle", inner); var styleAttributes = { "display": ["0", "true"], "text": ["0", "false"], "script": ["1", "false"], "scriptscript": ["2", "false"] }; var attr = styleAttributes[group.style]; node.setAttribute("scriptlevel", attr[0]); node.setAttribute("displaystyle", attr[1]); return node; } }); // CONCATENATED MODULE: ./src/functions/supsub.js /** * Sometimes, groups perform special rules when they have superscripts or * subscripts attached to them. This function lets the `supsub` group know that * Sometimes, groups perform special rules when they have superscripts or * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { var base = group.base; if (!base) { return null; } else if (base.type === "op") { // Operators handle supsubs differently when they have limits // (e.g. `\displaystyle\sum_2^3`) var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub); return delegate ? op_htmlBuilder : null; } else if (base.type === "operatorname") { var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits); return _delegate ? operatorname_htmlBuilder : null; } else if (base.type === "accent") { return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null; } else if (base.type === "horizBrace") { var isSup = !group.sub; return isSup === base.isOver ? horizBrace_htmlBuilder : null; } else { return null; } }; // Super scripts and subscripts, whose precise placement can depend on other // functions that precede them. defineFunctionBuilders({ type: "supsub", htmlBuilder: function htmlBuilder(group, options) { // Superscript and subscripts are handled in the TeXbook on page // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. var builderDelegate = supsub_htmlBuilderDelegate(group, options); if (builderDelegate) { return builderDelegate(group, options); } var valueBase = group.base, valueSup = group.sup, valueSub = group.sub; var base = buildHTML_buildGroup(valueBase, options); var supm; var subm; var metrics = options.fontMetrics(); // Rule 18a var supShift = 0; var subShift = 0; var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); if (valueSup) { var newOptions = options.havingStyle(options.style.sup()); supm = buildHTML_buildGroup(valueSup, newOptions, options); if (!isCharacterBox) { supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; } } if (valueSub) { var _newOptions = options.havingStyle(options.style.sub()); subm = buildHTML_buildGroup(valueSub, _newOptions, options); if (!isCharacterBox) { subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier; } } // Rule 18c var minSupShift; if (options.style === src_Style.DISPLAY) { minSupShift = metrics.sup1; } else if (options.style.cramped) { minSupShift = metrics.sup3; } else { minSupShift = metrics.sup2; } // scriptspace is a font-size-independent size, so scale it // appropriately for use as the marginRight. var multiplier = options.sizeMultiplier; var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; var marginLeft = null; if (subm) { // Subscripts shouldn't be shifted by the base's italic correction. // Account for that by shifting the subscript back the appropriate // amount. Note we only do this when the base is a single symbol. var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); if (base instanceof domTree_SymbolNode || isOiint) { // $FlowFixMe marginLeft = -base.italic + "em"; } } var supsub; if (supm && subm) { supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); subShift = Math.max(subShift, metrics.sub2); var ruleWidth = metrics.defaultRuleThickness; // Rule 18e var maxWidth = 4 * ruleWidth; if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { subShift = maxWidth - (supShift - supm.depth) + subm.height; var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); if (psi > 0) { supShift += psi; subShift -= psi; } } var vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight: marginRight, marginLeft: marginLeft }, { type: "elem", elem: supm, shift: -supShift, marginRight: marginRight }]; supsub = buildCommon.makeVList({ positionType: "individualShift", children: vlistElem }, options); } else if (subm) { // Rule 18b subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); var _vlistElem = [{ type: "elem", elem: subm, marginLeft: marginLeft, marginRight: marginRight }]; supsub = buildCommon.makeVList({ positionType: "shift", positionData: subShift, children: _vlistElem }, options); } else if (supm) { // Rule 18c, d supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); supsub = buildCommon.makeVList({ positionType: "shift", positionData: -supShift, children: [{ type: "elem", elem: supm, marginRight: marginRight }] }, options); } else { throw new Error("supsub must have either sup or sub."); } // Wrap the supsub vlist in a span.msupsub to reset text-align. var mclass = getTypeOfDomTree(base, "right") || "mord"; return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); }, mathmlBuilder: function mathmlBuilder(group, options) { // Is the inner group a relevant horizonal brace? var isBrace = false; var isOver; var isSup; if (group.base && group.base.type === "horizBrace") { isSup = !!group.sup; if (isSup === group.base.isOver) { isBrace = true; isOver = group.base.isOver; } } if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) { group.base.parentIsSupSub = true; } var children = [buildMathML_buildGroup(group.base, options)]; if (group.sub) { children.push(buildMathML_buildGroup(group.sub, options)); } if (group.sup) { children.push(buildMathML_buildGroup(group.sup, options)); } var nodeType; if (isBrace) { nodeType = isOver ? "mover" : "munder"; } else if (!group.sub) { var base = group.base; if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) { nodeType = "mover"; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) { nodeType = "mover"; } else { nodeType = "msup"; } } else if (!group.sup) { var _base = group.base; if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) { nodeType = "munder"; } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) { nodeType = "munder"; } else { nodeType = "msub"; } } else { var _base2 = group.base; if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) { nodeType = "munderover"; } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) { nodeType = "munderover"; } else { nodeType = "msubsup"; } } var node = new mathMLTree.MathNode(nodeType, children); return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsOp.js // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js. defineFunctionBuilders({ type: "atom", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.text, group.mode)]); if (group.family === "bin") { var variant = buildMathML_getVariant(group, options); if (variant === "bold-italic") { node.setAttribute("mathvariant", variant); } } else if (group.family === "punct") { node.setAttribute("separator", "true"); } else if (group.family === "open" || group.family === "close") { // Delims built here should not stretch vertically. // See delimsizing.js for stretchy delims. node.setAttribute("stretchy", "false"); } return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsOrd.js // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in var defaultVariant = { "mi": "italic", "mn": "normal", "mtext": "normal" }; defineFunctionBuilders({ type: "mathord", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "mathord"); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mi", [buildMathML_makeText(group.text, group.mode, options)]); var variant = buildMathML_getVariant(group, options) || "italic"; if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); defineFunctionBuilders({ type: "textord", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "textord"); }, mathmlBuilder: function mathmlBuilder(group, options) { var text = buildMathML_makeText(group.text, group.mode, options); var variant = buildMathML_getVariant(group, options) || "normal"; var node; if (group.mode === 'text') { node = new mathMLTree.MathNode("mtext", [text]); } else if (/[0-9]/.test(group.text)) { // TODO(kevinb) merge adjacent nodes // do it as a post processing step node = new mathMLTree.MathNode("mn", [text]); } else if (group.text === "\\prime") { node = new mathMLTree.MathNode("mo", [text]); } else { node = new mathMLTree.MathNode("mi", [text]); } if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsSpacing.js // A map of CSS-based spacing functions to their CSS class. var cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; // A lookup table to determine whether a spacing function/symbol should be // treated like a regular space character. If a symbol or command is a key // in this table, then it should be a regular space character. Furthermore, // the associated value may have a `className` specifying an extra CSS class // to add to the created `span`. var regularSpace = { " ": {}, "\\ ": {}, "~": { className: "nobreak" }, "\\space": {}, "\\nobreakspace": { className: "nobreak" } }; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in // src/symbols.js. defineFunctionBuilders({ type: "spacing", htmlBuilder: function htmlBuilder(group, options) { if (regularSpace.hasOwnProperty(group.text)) { var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these // things has an entry in the symbols table, so these will be turned // into appropriate outputs. if (group.mode === "text") { var ord = buildCommon.makeOrd(group, options, "textord"); ord.classes.push(className); return ord; } else { return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options); } } else if (cssSpace.hasOwnProperty(group.text)) { // Spaces based on just a CSS class. return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); } else { throw new src_ParseError("Unknown type of space \"" + group.text + "\""); } }, mathmlBuilder: function mathmlBuilder(group, options) { var node; if (regularSpace.hasOwnProperty(group.text)) { node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]); } else if (cssSpace.hasOwnProperty(group.text)) { // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored return new mathMLTree.MathNode("mspace"); } else { throw new src_ParseError("Unknown type of space \"" + group.text + "\""); } return node; } }); // CONCATENATED MODULE: ./src/functions/tag.js var tag_pad = function pad() { var padNode = new mathMLTree.MathNode("mtd", []); padNode.setAttribute("width", "50%"); return padNode; }; defineFunctionBuilders({ type: "tag", mathmlBuilder: function mathmlBuilder(group, options) { var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); table.setAttribute("width", "100%"); return table; // TODO: Left-aligned tags. // Currently, the group and options passed here do not contain // enough info to set tag alignment. `leqno` is in Settings but it is // not passed to Options. On the HTML side, leqno is // set by a CSS class applied in buildTree.js. That would have worked // in MathML if browsers supported . Since they don't, we // need to rewrite the way this function is called. } }); // CONCATENATED MODULE: ./src/functions/text.js // Non-mathy text, possibly in a font var textFontFamilies = { "\\text": undefined, "\\textrm": "textrm", "\\textsf": "textsf", "\\texttt": "texttt", "\\textnormal": "textrm" }; var textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; var textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; var optionsWithFont = function optionsWithFont(group, options) { var font = group.font; // Checks if the argument is a font family or a font style. if (!font) { return options; } else if (textFontFamilies[font]) { return options.withTextFontFamily(textFontFamilies[font]); } else if (textFontWeights[font]) { return options.withTextFontWeight(textFontWeights[font]); } else { return options.withTextFontShape(textFontShapes[font]); } }; defineFunction({ type: "text", names: [// Font families "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights "\\textbf", "\\textmd", // Font Shapes "\\textit", "\\textup"], props: { numArgs: 1, argTypes: ["text"], greediness: 2, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "text", mode: parser.mode, body: ordargument(body), font: funcName }; }, htmlBuilder: function htmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); var inner = buildHTML_buildExpression(group.body, newOptions, true); return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); }, mathmlBuilder: function mathmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); return buildExpressionRow(group.body, newOptions); } }); // CONCATENATED MODULE: ./src/functions/underline.js defineFunction({ type: "underline", names: ["\\underline"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "underline", mode: parser.mode, body: args[0] }; }, htmlBuilder: function htmlBuilder(group, options) { // Underlines are handled in the TeXbook pg 443, Rule 10. // Build the inner group. var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "kern", size: defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "underline"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); operator.setAttribute("stretchy", "true"); var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]); node.setAttribute("accentunder", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/verb.js defineFunction({ type: "verb", names: ["\\verb"], props: { numArgs: 0, allowedInText: true }, handler: function handler(context, args, optArgs) { // \verb and \verb* are dealt with directly in Parser.js. // If we end up here, it's because of a failure to match the two delimiters // in the regex in Lexer.js. LaTeX raises the following error when \verb is // terminated by end of line (or file). throw new src_ParseError("\\verb ended by end of line instead of matching delimiter"); }, htmlBuilder: function htmlBuilder(group, options) { var text = makeVerb(group); var body = []; // \verb enters text mode and therefore is sized like \textstyle var newOptions = options.havingStyle(options.style.text()); for (var i = 0; i < text.length; i++) { var c = text[i]; if (c === '~') { c = '\\textasciitilde'; } body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"])); } return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions); }, mathmlBuilder: function mathmlBuilder(group, options) { var text = new mathMLTree.TextNode(makeVerb(group)); var node = new mathMLTree.MathNode("mtext", [text]); node.setAttribute("mathvariant", "monospace"); return node; } }); /** * Converts verb group into body string. * * \verb* replaces each space with an open box \u2423 * \verb replaces each space with a no-break space \xA0 */ var makeVerb = function makeVerb(group) { return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0'); }; // CONCATENATED MODULE: ./src/functions.js /** Include this to ensure that all functions are defined. */ var functions = _functions; /* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with // that object in this file instead of relying on side-effects. // CONCATENATED MODULE: ./src/Lexer.js /** * The Lexer class handles tokenizing the input in various ways. Since our * parser expects us to be able to backtrack, the lexer allows lexing from any * given starting point. * * Its main exposed function is the `lex` function, which takes a position to * lex from and a type of token to lex. It defers to the appropriate `_innerLex` * function. * * The various `_innerLex` functions perform the actual lexing of different * kinds. */ /* The following tokenRegex * - matches typical whitespace (but not NBSP etc.) using its first group * - does not match any control character \x00-\x1f except whitespace * - does not match a bare backslash * - matches any ASCII character except those just mentioned * - does not match the BMP private use area \uE000-\uF8FF * - does not match bare surrogate code units * - matches any BMP character except for those just described * - matches any valid Unicode surrogate pair * - matches a backslash followed by one or more letters * - matches a backslash followed by any BMP character, including newline * Just because the Lexer matches something doesn't mean it's valid input: * If there is no matching function or symbol definition, the Parser will * still reject the input. */ var spaceRegexString = "[ \r\n\t]"; var controlWordRegexString = "\\\\[a-zA-Z@]+"; var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*"; var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$"); var combiningDiacriticalMarkString = "[\u0300-\u036F]"; var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"); var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint combiningDiacriticalMarkString + "*") + // ...plus accents "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair combiningDiacriticalMarkString + "*") + // ...plus accents "|\\\\verb\\*([^]).*?\\3" + // \verb* "|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred "|\\\\operatorname\\*" + ( // \operatorname* "|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces "|" + controlSymbolRegexString + ")"); // \\, \', etc. /** Main Lexer class */ var Lexer_Lexer = /*#__PURE__*/ function () { // category codes, only supports comment characters (14) for now function Lexer(input, settings) { this.input = void 0; this.settings = void 0; this.tokenRegex = void 0; this.catcodes = void 0; // Separate accents from characters this.input = input; this.settings = settings; this.tokenRegex = new RegExp(tokenRegexString, 'g'); this.catcodes = { "%": 14 // comment character }; } var _proto = Lexer.prototype; _proto.setCatcode = function setCatcode(char, code) { this.catcodes[char] = code; } /** * This function lexes a single token. */ ; _proto.lex = function lex() { var input = this.input; var pos = this.tokenRegex.lastIndex; if (pos === input.length) { return new Token_Token("EOF", new SourceLocation(this, pos, pos)); } var match = this.tokenRegex.exec(input); if (match === null || match.index !== pos) { throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1))); } var text = match[2] || " "; if (this.catcodes[text] === 14) { // comment character var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex); if (nlIndex === -1) { this.tokenRegex.lastIndex = input.length; // EOF this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)"); } else { this.tokenRegex.lastIndex = nlIndex + 1; } return this.lex(); } // Trim any trailing whitespace from control word match var controlMatch = text.match(controlWordWhitespaceRegex); if (controlMatch) { text = controlMatch[1]; } return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); }; return Lexer; }(); // CONCATENATED MODULE: ./src/Namespace.js /** * A `Namespace` refers to a space of nameable things like macros or lengths, * which can be `set` either globally or local to a nested group, using an * undo stack similar to how TeX implements this functionality. * Performance-wise, `get` and local `set` take constant time, while global * `set` takes time proportional to the depth of group nesting. */ var Namespace_Namespace = /*#__PURE__*/ function () { /** * Both arguments are optional. The first argument is an object of * built-in mappings which never change. The second argument is an object * of initial (global-level) mappings, which will constantly change * according to any global/top-level `set`s done. */ function Namespace(builtins, globalMacros) { if (builtins === void 0) { builtins = {}; } if (globalMacros === void 0) { globalMacros = {}; } this.current = void 0; this.builtins = void 0; this.undefStack = void 0; this.current = globalMacros; this.builtins = builtins; this.undefStack = []; } /** * Start a new nested group, affecting future local `set`s. */ var _proto = Namespace.prototype; _proto.beginGroup = function beginGroup() { this.undefStack.push({}); } /** * End current nested group, restoring values before the group began. */ ; _proto.endGroup = function endGroup() { if (this.undefStack.length === 0) { throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); } var undefs = this.undefStack.pop(); for (var undef in undefs) { if (undefs.hasOwnProperty(undef)) { if (undefs[undef] === undefined) { delete this.current[undef]; } else { this.current[undef] = undefs[undef]; } } } } /** * Detect whether `name` has a definition. Equivalent to * `get(name) != null`. */ ; _proto.has = function has(name) { return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); } /** * Get the current value of a name, or `undefined` if there is no value. * * Note: Do not use `if (namespace.get(...))` to detect whether a macro * is defined, as the definition may be the empty string which evaluates * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or * `if (namespace.has(...))`. */ ; _proto.get = function get(name) { if (this.current.hasOwnProperty(name)) { return this.current[name]; } else { return this.builtins[name]; } } /** * Set the current value of a name, and optionally set it globally too. * Local set() sets the current value and (when appropriate) adds an undo * operation to the undo stack. Global set() may change the undo * operation at every level, so takes time linear in their number. */ ; _proto.set = function set(name, value, global) { if (global === void 0) { global = false; } if (global) { // Global set is equivalent to setting in all groups. Simulate this // by destroying any undos currently scheduled for this name, // and adding an undo with the *new* value (in case it later gets // locally reset within this environment). for (var i = 0; i < this.undefStack.length; i++) { delete this.undefStack[i][name]; } if (this.undefStack.length > 0) { this.undefStack[this.undefStack.length - 1][name] = value; } } else { // Undo this set at end of this group (possibly to `undefined`), // unless an undo is already in place, in which case that older // value is the correct one. var top = this.undefStack[this.undefStack.length - 1]; if (top && !top.hasOwnProperty(name)) { top[name] = this.current[name]; } } this.current[name] = value; }; return Namespace; }(); // CONCATENATED MODULE: ./src/macros.js /** * Predefined macros for KaTeX. * This can be used to define some commands in terms of others. */ var builtinMacros = {}; /* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things. function defineMacro(name, body) { builtinMacros[name] = body; } ////////////////////////////////////////////////////////////////////// // macro tools defineMacro("\\noexpand", function (context) { // The expansion is the token itself; but that token is interpreted // as if its meaning were ‘\relax’ if it is a control sequence that // would ordinarily be expanded by TeX’s expansion rules. var t = context.popToken(); if (context.isExpandable(t.text)) { t.noexpand = true; t.treatAsRelax = true; } return { tokens: [t], numArgs: 0 }; }); defineMacro("\\expandafter", function (context) { // TeX first reads the token that comes immediately after \expandafter, // without expanding it; let’s call this token t. Then TeX reads the // token that comes after t (and possibly more tokens, if that token // has an argument), replacing it by its expansion. Finally TeX puts // t back in front of that expansion. var t = context.popToken(); context.expandOnce(true); // expand only an expandable token return { tokens: [t], numArgs: 0 }; }); // LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2 // TeX source: \long\def\@firstoftwo#1#2{#1} defineMacro("\\@firstoftwo", function (context) { var args = context.consumeArgs(2); return { tokens: args[0], numArgs: 0 }; }); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1 // TeX source: \long\def\@secondoftwo#1#2{#2} defineMacro("\\@secondoftwo", function (context) { var args = context.consumeArgs(2); return { tokens: args[1], numArgs: 0 }; }); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded) // symbol that isn't a space, consuming any spaces but not consuming the // first nonspace character. If that nonspace character matches #1, then // the macro expands to #2; otherwise, it expands to #3. defineMacro("\\@ifnextchar", function (context) { var args = context.consumeArgs(3); // symbol, if, else context.consumeSpaces(); var nextToken = context.future(); if (args[0].length === 1 && args[0][0].text === nextToken.text) { return { tokens: args[1], numArgs: 0 }; } else { return { tokens: args[2], numArgs: 0 }; } }); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol. // If it is `*`, then it consumes the symbol, and the macro expands to #1; // otherwise, the macro expands to #2 (without consuming the symbol). // TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode defineMacro("\\TextOrMath", function (context) { var args = context.consumeArgs(2); if (context.mode === 'text') { return { tokens: args[0], numArgs: 0 }; } else { return { tokens: args[1], numArgs: 0 }; } }); // Lookup table for parsing numbers in base 8 through 16 var digitToNumber = { "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "a": 10, "A": 10, "b": 11, "B": 11, "c": 12, "C": 12, "d": 13, "D": 13, "e": 14, "E": 14, "f": 15, "F": 15 }; // TeX \char makes a literal character (catcode 12) using the following forms: // (see The TeXBook, p. 43) // \char123 -- decimal // \char'123 -- octal // \char"123 -- hex // \char`x -- character that can be written (i.e. isn't active) // \char`\x -- character that cannot be written (e.g. %) // These all refer to characters from the font, so we turn them into special // calls to a function \@char dealt with in the Parser. defineMacro("\\char", function (context) { var token = context.popToken(); var base; var number = ''; if (token.text === "'") { base = 8; token = context.popToken(); } else if (token.text === '"') { base = 16; token = context.popToken(); } else if (token.text === "`") { token = context.popToken(); if (token.text[0] === "\\") { number = token.text.charCodeAt(1); } else if (token.text === "EOF") { throw new src_ParseError("\\char` missing argument"); } else { number = token.text.charCodeAt(0); } } else { base = 10; } if (base) { // Parse a number in the given base, starting with first `token`. number = digitToNumber[token.text]; if (number == null || number >= base) { throw new src_ParseError("Invalid base-" + base + " digit " + token.text); } var digit; while ((digit = digitToNumber[context.future().text]) != null && digit < base) { number *= base; number += digit; context.popToken(); } } return "\\@char{" + number + "}"; }); // \newcommand{\macro}[args]{definition} // \renewcommand{\macro}[args]{definition} // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { var arg = context.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("\\newcommand's first argument must be a macro name"); } var name = arg[0].text; var exists = context.isDefined(name); if (exists && !existsOK) { throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand")); } if (!exists && !nonexistsOK) { throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand"); } var numArgs = 0; arg = context.consumeArgs(1)[0]; if (arg.length === 1 && arg[0].text === "[") { var argText = ''; var token = context.expandNextToken(); while (token.text !== "]" && token.text !== "EOF") { // TODO: Should properly expand arg, e.g., ignore {}s argText += token.text; token = context.expandNextToken(); } if (!argText.match(/^\s*[0-9]+\s*$/)) { throw new src_ParseError("Invalid number of arguments: " + argText); } numArgs = parseInt(argText); arg = context.consumeArgs(1)[0]; } // Final arg is the expansion of the macro context.macros.set(name, { tokens: arg, numArgs: numArgs }); return ''; }; defineMacro("\\newcommand", function (context) { return macros_newcommand(context, false, true); }); defineMacro("\\renewcommand", function (context) { return macros_newcommand(context, true, false); }); defineMacro("\\providecommand", function (context) { return macros_newcommand(context, true, true); }); // terminal (console) tools defineMacro("\\message", function (context) { var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.log(arg.reverse().map(function (token) { return token.text; }).join("")); return ''; }); defineMacro("\\errmessage", function (context) { var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.error(arg.reverse().map(function (token) { return token.text; }).join("")); return ''; }); defineMacro("\\show", function (context) { var tok = context.popToken(); var name = tok.text; // eslint-disable-next-line no-console console.log(tok, context.macros.get(name), src_functions[name], src_symbols.math[name], src_symbols.text[name]); return ''; }); ////////////////////////////////////////////////////////////////////// // Grouping // \let\bgroup={ \let\egroup=} defineMacro("\\bgroup", "{"); defineMacro("\\egroup", "}"); // Symbols from latex.ltx: // \def\lq{`} // \def\rq{'} // \def \aa {\r a} // \def \AA {\r A} defineMacro("\\lq", "`"); defineMacro("\\rq", "'"); defineMacro("\\aa", "\\r a"); defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML. // \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} // \DeclareTextCommandDefault{\textregistered}{\textcircled{% // \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} // \DeclareRobustCommand{\copyright}{% // \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF defineMacro("\u212C", "\\mathscr{B}"); // script defineMacro("\u2130", "\\mathscr{E}"); defineMacro("\u2131", "\\mathscr{F}"); defineMacro("\u210B", "\\mathscr{H}"); defineMacro("\u2110", "\\mathscr{I}"); defineMacro("\u2112", "\\mathscr{L}"); defineMacro("\u2133", "\\mathscr{M}"); defineMacro("\u211B", "\\mathscr{R}"); defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur defineMacro("\u210C", "\\mathfrak{H}"); defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML. defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot // The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays // the dot at U+22C5 and gives it punct spacing. defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} // It's thus treated like a \mathrel, but defined by a symbol that has zero // width but extends to the right. We use \rlap to get that spacing. // For MathML we write U+0338 here. buildMathML.js will then do the overlay. defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx: // \def\neq{\not=} \let\ne=\neq // \DeclareRobustCommand // \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} // \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); defineMacro("\\ne", "\\neq"); defineMacro("\u2260", "\\neq"); defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}"); defineMacro("\u2209", "\\notin"); // Unicode stacked relations defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}"); defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}"); defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}"); defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}"); defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode defineMacro("\u27C2", "\\perp"); defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); defineMacro("\u220C", "\\notni"); defineMacro("\u231C", "\\ulcorner"); defineMacro("\u231D", "\\urcorner"); defineMacro("\u231E", "\\llcorner"); defineMacro("\u231F", "\\lrcorner"); defineMacro("\xA9", "\\copyright"); defineMacro("\xAE", "\\textregistered"); defineMacro("\uFE0F", "\\textregistered"); // The KaTeX fonts have corners at codepoints that don't match Unicode. // For MathML purposes, use the Unicode code point. defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}"); defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}"); defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}"); defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}"); ////////////////////////////////////////////////////////////////////// // LaTeX_2ε // \vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ // \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} // We'll call \varvdots, which gets a glyph from symbols.js. // The zero-width rule gets us an equivalent to the vertical 6pt kern. defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); defineMacro("\u22EE", "\\vdots"); ////////////////////////////////////////////////////////////////////// // amsmath.sty // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf // Italic Greek capital letters. AMS defines these with \DeclareMathSymbol, // but they are equivalent to \mathit{\Letter}. defineMacro("\\varGamma", "\\mathit{\\Gamma}"); defineMacro("\\varDelta", "\\mathit{\\Delta}"); defineMacro("\\varTheta", "\\mathit{\\Theta}"); defineMacro("\\varLambda", "\\mathit{\\Lambda}"); defineMacro("\\varXi", "\\mathit{\\Xi}"); defineMacro("\\varPi", "\\mathit{\\Pi}"); defineMacro("\\varSigma", "\\mathit{\\Sigma}"); defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); defineMacro("\\varPhi", "\\mathit{\\Phi}"); defineMacro("\\varPsi", "\\mathit{\\Psi}"); defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray} defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript // \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;} // \def\implies{\DOTSB\;\Longrightarrow\;} // \def\impliedby{\DOTSB\;\Longleftarrow\;} defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. var dotsByToken = { ',': '\\dotsc', '\\not': '\\dotsb', // \keybin@ checks for the following: '+': '\\dotsb', '=': '\\dotsb', '<': '\\dotsb', '>': '\\dotsb', '-': '\\dotsb', '*': '\\dotsb', ':': '\\dotsb', // Symbols whose definition starts with \DOTSB: '\\DOTSB': '\\dotsb', '\\coprod': '\\dotsb', '\\bigvee': '\\dotsb', '\\bigwedge': '\\dotsb', '\\biguplus': '\\dotsb', '\\bigcap': '\\dotsb', '\\bigcup': '\\dotsb', '\\prod': '\\dotsb', '\\sum': '\\dotsb', '\\bigotimes': '\\dotsb', '\\bigoplus': '\\dotsb', '\\bigodot': '\\dotsb', '\\bigsqcup': '\\dotsb', '\\And': '\\dotsb', '\\longrightarrow': '\\dotsb', '\\Longrightarrow': '\\dotsb', '\\longleftarrow': '\\dotsb', '\\Longleftarrow': '\\dotsb', '\\longleftrightarrow': '\\dotsb', '\\Longleftrightarrow': '\\dotsb', '\\mapsto': '\\dotsb', '\\longmapsto': '\\dotsb', '\\hookrightarrow': '\\dotsb', '\\doteq': '\\dotsb', // Symbols whose definition starts with \mathbin: '\\mathbin': '\\dotsb', // Symbols whose definition starts with \mathrel: '\\mathrel': '\\dotsb', '\\relbar': '\\dotsb', '\\Relbar': '\\dotsb', '\\xrightarrow': '\\dotsb', '\\xleftarrow': '\\dotsb', // Symbols whose definition starts with \DOTSI: '\\DOTSI': '\\dotsi', '\\int': '\\dotsi', '\\oint': '\\dotsi', '\\iint': '\\dotsi', '\\iiint': '\\dotsi', '\\iiiint': '\\dotsi', '\\idotsint': '\\dotsi', // Symbols whose definition starts with \DOTSX: '\\DOTSX': '\\dotsx' }; defineMacro("\\dots", function (context) { // TODO: If used in text mode, should expand to \textellipsis. // However, in KaTeX, \textellipsis and \ldots behave the same // (in text mode), and it's unlikely we'd see any of the math commands // that affect the behavior of \dots when in text mode. So fine for now // (until we support \ifmmode ... \else ... \fi). var thedots = '\\dotso'; var next = context.expandAfterFuture().text; if (next in dotsByToken) { thedots = dotsByToken[next]; } else if (next.substr(0, 4) === '\\not') { thedots = '\\dotsb'; } else if (next in src_symbols.math) { if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) { thedots = '\\dotsb'; } } return thedots; }); var spaceAfterDots = { // \rightdelim@ checks for the following: ')': true, ']': true, '\\rbrack': true, '\\}': true, '\\rbrace': true, '\\rangle': true, '\\rceil': true, '\\rfloor': true, '\\rgroup': true, '\\rmoustache': true, '\\right': true, '\\bigr': true, '\\biggr': true, '\\Bigr': true, '\\Biggr': true, // \extra@ also tests for the following: '$': true, // \extrap@ checks for the following: ';': true, '.': true, ',': true }; defineMacro("\\dotso", function (context) { var next = context.future().text; if (next in spaceAfterDots) { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\dotsc", function (context) { var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for // ';' and '.', but doesn't check for ','. if (next in spaceAfterDots && next !== ',') { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\cdots", function (context) { var next = context.future().text; if (next in spaceAfterDots) { return "\\@cdots\\,"; } else { return "\\@cdots"; } }); defineMacro("\\dotsb", "\\cdots"); defineMacro("\\dotsm", "\\cdots"); defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro // starting with \DOTSX implies \dotso, and then \extra@ detects this case // and forces the added `\,`. defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax // \let\DOTSB\relax // \let\DOTSX\relax defineMacro("\\DOTSI", "\\relax"); defineMacro("\\DOTSB", "\\relax"); defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults // \DeclareRobustCommand{\tmspace}[3]{% // \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\, defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip} // \renewcommand{\:}{\tmspace+\medmuskip{.2222em}} // TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\>", "\\mskip{4mu}"); defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\: defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip = 5mu plus 5mu defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\; defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\! defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} // TODO: math mode should use \medmuskip defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em } defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax} defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax} defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax} defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); defineMacro("\\tag@literal", function (context) { if (context.macros.get("\\df@tag")) { throw new src_ParseError("Multiple \\tag"); } return "\\gdef\\df@tag{\\text{#1}}"; }); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin // {\operator@font mod}\penalty900 // \mkern5mu\nonscript\mskip-\medmuskip} // \newcommand{\pod}[1]{\allowbreak // \if@display\mkern18mu\else\mkern8mu\fi(#1)} // \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} // \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu // \else\mkern12mu\fi{\operator@font mod}\,\,#1} // TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb -- A simulation of bold. // The version in ambsy.sty works by typesetting three copies of the argument // with small offsets. We use two copies. We omit the vertical offset because // of rendering problems that makeVList encounters in Safari. defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// // LaTeX source2e // \\ defaults to \newline, but changes to \cr within array environment defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} // TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't // support \@ yet, so that's omitted, and we add \text so that the result // doesn't look funny in math mode. defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em% // {\sbox\z@ T% // \vbox to\ht\z@{\hbox{\check@mathfonts // \fontsize\sf@size\z@ // \math@fontsfalse\selectfont // A}% // \vss}% // }% // \kern-.15em% // \TeX} // This code aligns the top of the A with the T (from the perspective of TeX's // boxes, though visually the A appears to extend above slightly). // We compute the corresponding \raisebox when A is rendered in \normalsize // \scriptstyle, which has a scale factor of 0.7 (see Options.js). var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em"; defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} // \def\@hspace#1{\hskip #1\relax} // \def\@hspacer#1{\vrule \@width\z@\nobreak // \hskip #1\hskip \z@skip} defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); defineMacro("\\@hspace", "\\hskip #1\\relax"); defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); ////////////////////////////////////////////////////////////////////// // mathtools.sty //\providecommand\ordinarycolon{:} defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} //TODO(edemaine): Not yet centered. Fix via \raisebox or #726 defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔ // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕ // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions. defineMacro("\u2237", "\\dblcolon"); // :: defineMacro("\u2239", "\\eqcolon"); // -: defineMacro("\u2254", "\\coloneqq"); // := defineMacro("\u2255", "\\eqqcolon"); // =: defineMacro("\u2A74", "\\Coloneqq"); // ::= ////////////////////////////////////////////////////////////////////// // colonequals.sty // Alternate names for mathtools's macros: defineMacro("\\ratio", "\\vcentcolon"); defineMacro("\\coloncolon", "\\dblcolon"); defineMacro("\\colonequals", "\\coloneqq"); defineMacro("\\coloncolonequals", "\\Coloneqq"); defineMacro("\\equalscolon", "\\eqqcolon"); defineMacro("\\equalscoloncolon", "\\Eqqcolon"); defineMacro("\\colonminus", "\\coloneq"); defineMacro("\\coloncolonminus", "\\Coloneq"); defineMacro("\\minuscolon", "\\eqcolon"); defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals. defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals. defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions: defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); ////////////////////////////////////////////////////////////////////// // MathML alternates for KaTeX glyphs in the Unicode private area defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}"); defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}"); defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}"); defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}"); defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}"); defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); ////////////////////////////////////////////////////////////////////// // stmaryrd and semantic // The stmaryrd and semantic packages render the next four items by calling a // glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros. defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}"); defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}"); defineMacro("\u27E6", "\\llbracket"); // blackboard bold [ defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ] defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}"); defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}"); defineMacro("\u2983", "\\lBrace"); // blackboard bold { defineMacro("\u2984", "\\rBrace"); // blackboard bold } // TODO: Create variable sized versions of the last two items. I believe that // will require new font glyphs. // The stmaryrd function `\minuso` provides a "Plimsoll" symbol that // superimposes the characters \circ and \mathminus. Used in chemistry. defineMacro("\\minuso", "\\mathbin{\\html@mathml{" + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + "{\\char`⦵}}"); defineMacro("⦵", "\\minuso"); ////////////////////////////////////////////////////////////////////// // texvc.sty // The texvc package contains macros available in mediawiki pages. // We omit the functions deprecated at // https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax // We also omit texvc's \O, which conflicts with \text{\O} defineMacro("\\darr", "\\downarrow"); defineMacro("\\dArr", "\\Downarrow"); defineMacro("\\Darr", "\\Downarrow"); defineMacro("\\lang", "\\langle"); defineMacro("\\rang", "\\rangle"); defineMacro("\\uarr", "\\uparrow"); defineMacro("\\uArr", "\\Uparrow"); defineMacro("\\Uarr", "\\Uparrow"); defineMacro("\\N", "\\mathbb{N}"); defineMacro("\\R", "\\mathbb{R}"); defineMacro("\\Z", "\\mathbb{Z}"); defineMacro("\\alef", "\\aleph"); defineMacro("\\alefsym", "\\aleph"); defineMacro("\\Alpha", "\\mathrm{A}"); defineMacro("\\Beta", "\\mathrm{B}"); defineMacro("\\bull", "\\bullet"); defineMacro("\\Chi", "\\mathrm{X}"); defineMacro("\\clubs", "\\clubsuit"); defineMacro("\\cnums", "\\mathbb{C}"); defineMacro("\\Complex", "\\mathbb{C}"); defineMacro("\\Dagger", "\\ddagger"); defineMacro("\\diamonds", "\\diamondsuit"); defineMacro("\\empty", "\\emptyset"); defineMacro("\\Epsilon", "\\mathrm{E}"); defineMacro("\\Eta", "\\mathrm{H}"); defineMacro("\\exist", "\\exists"); defineMacro("\\harr", "\\leftrightarrow"); defineMacro("\\hArr", "\\Leftrightarrow"); defineMacro("\\Harr", "\\Leftrightarrow"); defineMacro("\\hearts", "\\heartsuit"); defineMacro("\\image", "\\Im"); defineMacro("\\infin", "\\infty"); defineMacro("\\Iota", "\\mathrm{I}"); defineMacro("\\isin", "\\in"); defineMacro("\\Kappa", "\\mathrm{K}"); defineMacro("\\larr", "\\leftarrow"); defineMacro("\\lArr", "\\Leftarrow"); defineMacro("\\Larr", "\\Leftarrow"); defineMacro("\\lrarr", "\\leftrightarrow"); defineMacro("\\lrArr", "\\Leftrightarrow"); defineMacro("\\Lrarr", "\\Leftrightarrow"); defineMacro("\\Mu", "\\mathrm{M}"); defineMacro("\\natnums", "\\mathbb{N}"); defineMacro("\\Nu", "\\mathrm{N}"); defineMacro("\\Omicron", "\\mathrm{O}"); defineMacro("\\plusmn", "\\pm"); defineMacro("\\rarr", "\\rightarrow"); defineMacro("\\rArr", "\\Rightarrow"); defineMacro("\\Rarr", "\\Rightarrow"); defineMacro("\\real", "\\Re"); defineMacro("\\reals", "\\mathbb{R}"); defineMacro("\\Reals", "\\mathbb{R}"); defineMacro("\\Rho", "\\mathrm{P}"); defineMacro("\\sdot", "\\cdot"); defineMacro("\\sect", "\\S"); defineMacro("\\spades", "\\spadesuit"); defineMacro("\\sub", "\\subset"); defineMacro("\\sube", "\\subseteq"); defineMacro("\\supe", "\\supseteq"); defineMacro("\\Tau", "\\mathrm{T}"); defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); defineMacro("\\weierp", "\\wp"); defineMacro("\\Zeta", "\\mathrm{Z}"); ////////////////////////////////////////////////////////////////////// // statmath.sty // https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); ////////////////////////////////////////////////////////////////////// // braket.sty // http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); defineMacro("\\Bra", "\\left\\langle#1\\right|"); defineMacro("\\Ket", "\\left|#1\\right\\rangle"); // Custom Khan Academy colors, should be moved to an optional package defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); defineMacro("\\red", "\\textcolor{##df0030}{#1}"); defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); defineMacro("\\gray", "\\textcolor{gray}{#1}"); defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); // CONCATENATED MODULE: ./src/MacroExpander.js /** * This file contains the “gullet” where macros are expanded * until only non-macro tokens remain. */ // List of commands that act like macros but aren't defined as a macro, // function, or symbol. Used in `isDefined`. var implicitCommands = { "\\relax": true, // MacroExpander.js "^": true, // Parser.js "_": true, // Parser.js "\\limits": true, // Parser.js "\\nolimits": true // Parser.js }; var MacroExpander_MacroExpander = /*#__PURE__*/ function () { function MacroExpander(input, settings, mode) { this.settings = void 0; this.expansionCount = void 0; this.lexer = void 0; this.macros = void 0; this.stack = void 0; this.mode = void 0; this.settings = settings; this.expansionCount = 0; this.feed(input); // Make new global namespace this.macros = new Namespace_Namespace(macros, settings.macros); this.mode = mode; this.stack = []; // contains tokens in REVERSE order } /** * Feed a new input string to the same MacroExpander * (with existing macros etc.). */ var _proto = MacroExpander.prototype; _proto.feed = function feed(input) { this.lexer = new Lexer_Lexer(input, this.settings); } /** * Switches between "text" and "math" modes. */ ; _proto.switchMode = function switchMode(newMode) { this.mode = newMode; } /** * Start a new group nesting within all namespaces. */ ; _proto.beginGroup = function beginGroup() { this.macros.beginGroup(); } /** * End current group nesting within all namespaces. */ ; _proto.endGroup = function endGroup() { this.macros.endGroup(); } /** * Returns the topmost token on the stack, without expanding it. * Similar in behavior to TeX's `\futurelet`. */ ; _proto.future = function future() { if (this.stack.length === 0) { this.pushToken(this.lexer.lex()); } return this.stack[this.stack.length - 1]; } /** * Remove and return the next unexpanded token. */ ; _proto.popToken = function popToken() { this.future(); // ensure non-empty stack return this.stack.pop(); } /** * Add a given token to the token stack. In particular, this get be used * to put back a token returned from one of the other methods. */ ; _proto.pushToken = function pushToken(token) { this.stack.push(token); } /** * Append an array of tokens to the token stack. */ ; _proto.pushTokens = function pushTokens(tokens) { var _this$stack; (_this$stack = this.stack).push.apply(_this$stack, tokens); } /** * Consume all following space tokens, without expansion. */ ; _proto.consumeSpaces = function consumeSpaces() { for (;;) { var token = this.future(); if (token.text === " ") { this.stack.pop(); } else { break; } } } /** * Consume the specified number of arguments from the token stream, * and return the resulting array of arguments. */ ; _proto.consumeArgs = function consumeArgs(numArgs) { var args = []; // obtain arguments, either single token or balanced {…} group for (var i = 0; i < numArgs; ++i) { this.consumeSpaces(); // ignore spaces before each argument var startOfArg = this.popToken(); if (startOfArg.text === "{") { var arg = []; var depth = 1; while (depth !== 0) { var tok = this.popToken(); arg.push(tok); if (tok.text === "{") { ++depth; } else if (tok.text === "}") { --depth; } else if (tok.text === "EOF") { throw new src_ParseError("End of input in macro argument", startOfArg); } } arg.pop(); // remove last } arg.reverse(); // like above, to fit in with stack order args[i] = arg; } else if (startOfArg.text === "EOF") { throw new src_ParseError("End of input expecting macro argument"); } else { args[i] = [startOfArg]; } } return args; } /** * Expand the next token only once if possible. * * If the token is expanded, the resulting tokens will be pushed onto * the stack in reverse order and will be returned as an array, * also in reverse order. * * If not, the next token will be returned without removing it * from the stack. This case can be detected by a `Token` return value * instead of an `Array` return value. * * In either case, the next token will be on the top of the stack, * or the stack will be empty. * * Used to implement `expandAfterFuture` and `expandNextToken`. * * At the moment, macro expansion doesn't handle delimited macros, * i.e. things like those defined by \def\foo#1\end{…}. * See the TeX book page 202ff. for details on how those should behave. * * If expandableOnly, only expandable tokens are expanded and * an undefined control sequence results in an error. */ ; _proto.expandOnce = function expandOnce(expandableOnly) { var topToken = this.popToken(); var name = topToken.text; var expansion = !topToken.noexpand ? this._getExpansion(name) : null; if (expansion == null || expandableOnly && expansion.unexpandable) { if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) { throw new src_ParseError("Undefined control sequence: " + name); } this.pushToken(topToken); return topToken; } this.expansionCount++; if (this.expansionCount > this.settings.maxExpand) { throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); } var tokens = expansion.tokens; if (expansion.numArgs) { var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders tokens = tokens.slice(); // make a shallow copy for (var i = tokens.length - 1; i >= 0; --i) { var tok = tokens[i]; if (tok.text === "#") { if (i === 0) { throw new src_ParseError("Incomplete placeholder at end of macro body", tok); } tok = tokens[--i]; // next token on stack if (tok.text === "#") { // ## → # tokens.splice(i + 1, 1); // drop first # } else if (/^[1-9]$/.test(tok.text)) { var _tokens; // replace the placeholder with the indicated argument (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1])); } else { throw new src_ParseError("Not a valid argument number", tok); } } } } // Concatenate expansion onto top of stack. this.pushTokens(tokens); return tokens; } /** * Expand the next token only once (if possible), and return the resulting * top token on the stack (without removing anything from the stack). * Similar in behavior to TeX's `\expandafter\futurelet`. * Equivalent to expandOnce() followed by future(). */ ; _proto.expandAfterFuture = function expandAfterFuture() { this.expandOnce(); return this.future(); } /** * Recursively expand first token, then return first non-expandable token. */ ; _proto.expandNextToken = function expandNextToken() { for (;;) { var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token_Token) { // \relax stops the expansion, but shouldn't get returned (a // null return value couldn't get implemented as a function). // the token after \noexpand is interpreted as if its meaning // were ‘\relax’ if (expanded.text === "\\relax" || expanded.treatAsRelax) { this.stack.pop(); } else { return this.stack.pop(); // === expanded } } } // Flow unable to figure out that this pathway is impossible. // https://github.com/facebook/flow/issues/4808 throw new Error(); // eslint-disable-line no-unreachable } /** * Fully expand the given macro name and return the resulting list of * tokens, or return `undefined` if no such macro is defined. */ ; _proto.expandMacro = function expandMacro(name) { return this.macros.has(name) ? this.expandTokens([new Token_Token(name)]) : undefined; } /** * Fully expand the given token stream and return the resulting list of tokens */ ; _proto.expandTokens = function expandTokens(tokens) { var output = []; var oldStackLength = this.stack.length; this.pushTokens(tokens); while (this.stack.length > oldStackLength) { var expanded = this.expandOnce(true); // expand only expandable tokens // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token_Token) { if (expanded.treatAsRelax) { // the expansion of \noexpand is the token itself expanded.noexpand = false; expanded.treatAsRelax = false; } output.push(this.stack.pop()); } } return output; } /** * Fully expand the given macro name and return the result as a string, * or return `undefined` if no such macro is defined. */ ; _proto.expandMacroAsText = function expandMacroAsText(name) { var tokens = this.expandMacro(name); if (tokens) { return tokens.map(function (token) { return token.text; }).join(""); } else { return tokens; } } /** * Returns the expanded macro as a reversed array of tokens and a macro * argument count. Or returns `null` if no such macro. */ ; _proto._getExpansion = function _getExpansion(name) { var definition = this.macros.get(name); if (definition == null) { // mainly checking for undefined here return definition; } var expansion = typeof definition === "function" ? definition(this) : definition; if (typeof expansion === "string") { var numArgs = 0; if (expansion.indexOf("#") !== -1) { var stripped = expansion.replace(/##/g, ""); while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { ++numArgs; } } var bodyLexer = new Lexer_Lexer(expansion, this.settings); var tokens = []; var tok = bodyLexer.lex(); while (tok.text !== "EOF") { tokens.push(tok); tok = bodyLexer.lex(); } tokens.reverse(); // to fit in with stack using push and pop var expanded = { tokens: tokens, numArgs: numArgs }; return expanded; } return expansion; } /** * Determine whether a command is currently "defined" (has some * functionality), meaning that it's a macro (in the current group), * a function, a symbol, or one of the special commands listed in * `implicitCommands`. */ ; _proto.isDefined = function isDefined(name) { return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); } /** * Determine whether a command is expandable. */ ; _proto.isExpandable = function isExpandable(name) { var macro = this.macros.get(name); return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable // TODO(ylem): #2085 : src_functions.hasOwnProperty(name) /* && !functions[name].primitive*/ ; }; return MacroExpander; }(); // CONCATENATED MODULE: ./src/Parser.js /* eslint no-constant-condition:0 */ // Pre-evaluate both modules as unicodeSymbols require String.normalize() var unicodeAccents = { "́": { "text": "\\'", "math": "\\acute" }, "̀": { "text": "\\`", "math": "\\grave" }, "̈": { "text": "\\\"", "math": "\\ddot" }, "̃": { "text": "\\~", "math": "\\tilde" }, "̄": { "text": "\\=", "math": "\\bar" }, "̆": { "text": "\\u", "math": "\\breve" }, "̌": { "text": "\\v", "math": "\\check" }, "̂": { "text": "\\^", "math": "\\hat" }, "̇": { "text": "\\.", "math": "\\dot" }, "̊": { "text": "\\r", "math": "\\mathring" }, "̋": { "text": "\\H" } }; var unicodeSymbols = { "á": "á", "à": "à", "ä": "ä", "ǟ": "ǟ", "ã": "ã", "ā": "ā", "ă": "ă", "ắ": "ắ", "ằ": "ằ", "ẵ": "ẵ", "ǎ": "ǎ", "â": "â", "ấ": "ấ", "ầ": "ầ", "ẫ": "ẫ", "ȧ": "ȧ", "ǡ": "ǡ", "å": "å", "ǻ": "ǻ", "ḃ": "ḃ", "ć": "ć", "č": "č", "ĉ": "ĉ", "ċ": "ċ", "ď": "ď", "ḋ": "ḋ", "é": "é", "è": "è", "ë": "ë", "ẽ": "ẽ", "ē": "ē", "ḗ": "ḗ", "ḕ": "ḕ", "ĕ": "ĕ", "ě": "ě", "ê": "ê", "ế": "ế", "ề": "ề", "ễ": "ễ", "ė": "ė", "ḟ": "ḟ", "ǵ": "ǵ", "ḡ": "ḡ", "ğ": "ğ", "ǧ": "ǧ", "ĝ": "ĝ", "ġ": "ġ", "ḧ": "ḧ", "ȟ": "ȟ", "ĥ": "ĥ", "ḣ": "ḣ", "í": "í", "ì": "ì", "ï": "ï", "ḯ": "ḯ", "ĩ": "ĩ", "ī": "ī", "ĭ": "ĭ", "ǐ": "ǐ", "î": "î", "ǰ": "ǰ", "ĵ": "ĵ", "ḱ": "ḱ", "ǩ": "ǩ", "ĺ": "ĺ", "ľ": "ľ", "ḿ": "ḿ", "ṁ": "ṁ", "ń": "ń", "ǹ": "ǹ", "ñ": "ñ", "ň": "ň", "ṅ": "ṅ", "ó": "ó", "ò": "ò", "ö": "ö", "ȫ": "ȫ", "õ": "õ", "ṍ": "ṍ", "ṏ": "ṏ", "ȭ": "ȭ", "ō": "ō", "ṓ": "ṓ", "ṑ": "ṑ", "ŏ": "ŏ", "ǒ": "ǒ", "ô": "ô", "ố": "ố", "ồ": "ồ", "ỗ": "ỗ", "ȯ": "ȯ", "ȱ": "ȱ", "ő": "ő", "ṕ": "ṕ", "ṗ": "ṗ", "ŕ": "ŕ", "ř": "ř", "ṙ": "ṙ", "ś": "ś", "ṥ": "ṥ", "š": "š", "ṧ": "ṧ", "ŝ": "ŝ", "ṡ": "ṡ", "ẗ": "ẗ", "ť": "ť", "ṫ": "ṫ", "ú": "ú", "ù": "ù", "ü": "ü", "ǘ": "ǘ", "ǜ": "ǜ", "ǖ": "ǖ", "ǚ": "ǚ", "ũ": "ũ", "ṹ": "ṹ", "ū": "ū", "ṻ": "ṻ", "ŭ": "ŭ", "ǔ": "ǔ", "û": "û", "ů": "ů", "ű": "ű", "ṽ": "ṽ", "ẃ": "ẃ", "ẁ": "ẁ", "ẅ": "ẅ", "ŵ": "ŵ", "ẇ": "ẇ", "ẘ": "ẘ", "ẍ": "ẍ", "ẋ": "ẋ", "ý": "ý", "ỳ": "ỳ", "ÿ": "ÿ", "ỹ": "ỹ", "ȳ": "ȳ", "ŷ": "ŷ", "ẏ": "ẏ", "ẙ": "ẙ", "ź": "ź", "ž": "ž", "ẑ": "ẑ", "ż": "ż", "Á": "Á", "À": "À", "Ä": "Ä", "Ǟ": "Ǟ", "Ã": "Ã", "Ā": "Ā", "Ă": "Ă", "Ắ": "Ắ", "Ằ": "Ằ", "Ẵ": "Ẵ", "Ǎ": "Ǎ", "Â": "Â", "Ấ": "Ấ", "Ầ": "Ầ", "Ẫ": "Ẫ", "Ȧ": "Ȧ", "Ǡ": "Ǡ", "Å": "Å", "Ǻ": "Ǻ", "Ḃ": "Ḃ", "Ć": "Ć", "Č": "Č", "Ĉ": "Ĉ", "Ċ": "Ċ", "Ď": "Ď", "Ḋ": "Ḋ", "É": "É", "È": "È", "Ë": "Ë", "Ẽ": "Ẽ", "Ē": "Ē", "Ḗ": "Ḗ", "Ḕ": "Ḕ", "Ĕ": "Ĕ", "Ě": "Ě", "Ê": "Ê", "Ế": "Ế", "Ề": "Ề", "Ễ": "Ễ", "Ė": "Ė", "Ḟ": "Ḟ", "Ǵ": "Ǵ", "Ḡ": "Ḡ", "Ğ": "Ğ", "Ǧ": "Ǧ", "Ĝ": "Ĝ", "Ġ": "Ġ", "Ḧ": "Ḧ", "Ȟ": "Ȟ", "Ĥ": "Ĥ", "Ḣ": "Ḣ", "Í": "Í", "Ì": "Ì", "Ï": "Ï", "Ḯ": "Ḯ", "Ĩ": "Ĩ", "Ī": "Ī", "Ĭ": "Ĭ", "Ǐ": "Ǐ", "Î": "Î", "İ": "İ", "Ĵ": "Ĵ", "Ḱ": "Ḱ", "Ǩ": "Ǩ", "Ĺ": "Ĺ", "Ľ": "Ľ", "Ḿ": "Ḿ", "Ṁ": "Ṁ", "Ń": "Ń", "Ǹ": "Ǹ", "Ñ": "Ñ", "Ň": "Ň", "Ṅ": "Ṅ", "Ó": "Ó", "Ò": "Ò", "Ö": "Ö", "Ȫ": "Ȫ", "Õ": "Õ", "Ṍ": "Ṍ", "Ṏ": "Ṏ", "Ȭ": "Ȭ", "Ō": "Ō", "Ṓ": "Ṓ", "Ṑ": "Ṑ", "Ŏ": "Ŏ", "Ǒ": "Ǒ", "Ô": "Ô", "Ố": "Ố", "Ồ": "Ồ", "Ỗ": "Ỗ", "Ȯ": "Ȯ", "Ȱ": "Ȱ", "Ő": "Ő", "Ṕ": "Ṕ", "Ṗ": "Ṗ", "Ŕ": "Ŕ", "Ř": "Ř", "Ṙ": "Ṙ", "Ś": "Ś", "Ṥ": "Ṥ", "Š": "Š", "Ṧ": "Ṧ", "Ŝ": "Ŝ", "Ṡ": "Ṡ", "Ť": "Ť", "Ṫ": "Ṫ", "Ú": "Ú", "Ù": "Ù", "Ü": "Ü", "Ǘ": "Ǘ", "Ǜ": "Ǜ", "Ǖ": "Ǖ", "Ǚ": "Ǚ", "Ũ": "Ũ", "Ṹ": "Ṹ", "Ū": "Ū", "Ṻ": "Ṻ", "Ŭ": "Ŭ", "Ǔ": "Ǔ", "Û": "Û", "Ů": "Ů", "Ű": "Ű", "Ṽ": "Ṽ", "Ẃ": "Ẃ", "Ẁ": "Ẁ", "Ẅ": "Ẅ", "Ŵ": "Ŵ", "Ẇ": "Ẇ", "Ẍ": "Ẍ", "Ẋ": "Ẋ", "Ý": "Ý", "Ỳ": "Ỳ", "Ÿ": "Ÿ", "Ỹ": "Ỹ", "Ȳ": "Ȳ", "Ŷ": "Ŷ", "Ẏ": "Ẏ", "Ź": "Ź", "Ž": "Ž", "Ẑ": "Ẑ", "Ż": "Ż", "ά": "ά", "ὰ": "ὰ", "ᾱ": "ᾱ", "ᾰ": "ᾰ", "έ": "έ", "ὲ": "ὲ", "ή": "ή", "ὴ": "ὴ", "ί": "ί", "ὶ": "ὶ", "ϊ": "ϊ", "ΐ": "ΐ", "ῒ": "ῒ", "ῑ": "ῑ", "ῐ": "ῐ", "ό": "ό", "ὸ": "ὸ", "ύ": "ύ", "ὺ": "ὺ", "ϋ": "ϋ", "ΰ": "ΰ", "ῢ": "ῢ", "ῡ": "ῡ", "ῠ": "ῠ", "ώ": "ώ", "ὼ": "ὼ", "Ύ": "Ύ", "Ὺ": "Ὺ", "Ϋ": "Ϋ", "Ῡ": "Ῡ", "Ῠ": "Ῠ", "Ώ": "Ώ", "Ὼ": "Ὼ" }; /** * This file contains the parser used to parse out a TeX expression from the * input. Since TeX isn't context-free, standard parsers don't work particularly * well. * * The strategy of this parser is as such: * * The main functions (the `.parse...` ones) take a position in the current * parse string to parse tokens from. The lexer (found in Lexer.js, stored at * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When * individual tokens are needed at a position, the lexer is called to pull out a * token, which is then used. * * The parser has a property called "mode" indicating the mode that * the parser is currently in. Currently it has to be one of "math" or * "text", which denotes whether the current environment is a math-y * one or a text-y one (e.g. inside \text). Currently, this serves to * limit the functions which can be used in text mode. * * The main functions then return an object which contains the useful data that * was parsed at its given point, and a new position at the end of the parsed * data. The main functions can call each other and continue the parsing by * using the returned position as a new starting point. * * There are also extra `.handle...` functions, which pull out some reused * functionality into self-contained functions. * * The functions return ParseNodes. */ var Parser_Parser = /*#__PURE__*/ function () { function Parser(input, settings) { this.mode = void 0; this.gullet = void 0; this.settings = void 0; this.leftrightDepth = void 0; this.nextToken = void 0; // Start in math mode this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a // new lexer (mouth) for this parser (stomach, in the language of TeX) this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing this.settings = settings; // Count leftright depth (for \middle errors) this.leftrightDepth = 0; } /** * Checks a result to make sure it has the right type, and throws an * appropriate error otherwise. */ var _proto = Parser.prototype; _proto.expect = function expect(text, consume) { if (consume === void 0) { consume = true; } if (this.fetch().text !== text) { throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch()); } if (consume) { this.consume(); } } /** * Discards the current lookahead token, considering it consumed. */ ; _proto.consume = function consume() { this.nextToken = null; } /** * Return the current lookahead token, or if there isn't one (at the * beginning, or if the previous lookahead token was consume()d), * fetch the next token as the new lookahead token and return it. */ ; _proto.fetch = function fetch() { if (this.nextToken == null) { this.nextToken = this.gullet.expandNextToken(); } return this.nextToken; } /** * Switches between "text" and "math" modes. */ ; _proto.switchMode = function switchMode(newMode) { this.mode = newMode; this.gullet.switchMode(newMode); } /** * Main parsing function, which parses an entire input. */ ; _proto.parse = function parse() { if (!this.settings.globalGroup) { // Create a group namespace for the math expression. // (LaTeX creates a new group for every $...$, $$...$$, \[...\].) this.gullet.beginGroup(); } // Use old \color behavior (same as LaTeX's \textcolor) if requested. // We do this within the group for the math expression, so it doesn't // pollute settings.macros. if (this.settings.colorIsTextColor) { this.gullet.macros.set("\\color", "\\textcolor"); } // Try to parse the input var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end this.expect("EOF"); // End the group namespace for the expression if (!this.settings.globalGroup) { this.gullet.endGroup(); } return parse; }; _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) { var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either // we reached the end, a }, or a \right) while (true) { // Ignore spaces in math mode if (this.mode === "math") { this.consumeSpaces(); } var lex = this.fetch(); if (Parser.endOfExpression.indexOf(lex.text) !== -1) { break; } if (breakOnTokenText && lex.text === breakOnTokenText) { break; } if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) { break; } var atom = this.parseAtom(breakOnTokenText); if (!atom) { break; } else if (atom.type === "internal") { continue; } body.push(atom); } if (this.mode === "text") { this.formLigatures(body); } return this.handleInfixNodes(body); } /** * Rewrites infix operators such as \over with corresponding commands such * as \frac. * * There can only be one infix operator per group. If there's more than one * then the expression is ambiguous. This can be resolved by adding {}. */ ; _proto.handleInfixNodes = function handleInfixNodes(body) { var overIndex = -1; var funcName; for (var i = 0; i < body.length; i++) { if (body[i].type === "infix") { if (overIndex !== -1) { throw new src_ParseError("only one infix operator per group", body[i].token); } overIndex = i; funcName = body[i].replaceWith; } } if (overIndex !== -1 && funcName) { var numerNode; var denomNode; var numerBody = body.slice(0, overIndex); var denomBody = body.slice(overIndex + 1); if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { numerNode = numerBody[0]; } else { numerNode = { type: "ordgroup", mode: this.mode, body: numerBody }; } if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { denomNode = denomBody[0]; } else { denomNode = { type: "ordgroup", mode: this.mode, body: denomBody }; } var node; if (funcName === "\\\\abovefrac") { node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); } else { node = this.callFunction(funcName, [numerNode, denomNode], []); } return [node]; } else { return body; } } // The greediness of a superscript or subscript ; /** * Handle a subscript or superscript with nice errors. */ _proto.handleSupSubscript = function handleSupSubscript(name) { var symbolToken = this.fetch(); var symbol = symbolToken.text; this.consume(); var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument if (!group) { throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken); } return group; } /** * Converts the textual input of an unsupported command into a text node * contained within a color node whose color is determined by errorColor */ ; _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) { var textordArray = []; for (var i = 0; i < text.length; i++) { textordArray.push({ type: "textord", mode: "text", text: text[i] }); } var textNode = { type: "text", mode: this.mode, body: textordArray }; var colorNode = { type: "color", mode: this.mode, color: this.settings.errorColor, body: [textNode] }; return colorNode; } /** * Parses a group with optional super/subscripts. */ ; _proto.parseAtom = function parseAtom(breakOnTokenText) { // The body of an atom is an implicit group, so that things like // \left(x\right)^2 work correctly. var base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts if (this.mode === "text") { return base; } // Note that base may be empty (i.e. null) at this point. var superscript; var subscript; while (true) { // Guaranteed in math mode, so eat any spaces first. this.consumeSpaces(); // Lex the first token var lex = this.fetch(); if (lex.text === "\\limits" || lex.text === "\\nolimits") { // We got a limit control if (base && base.type === "op") { var limits = lex.text === "\\limits"; base.limits = limits; base.alwaysHandleSupSub = true; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub) { var _limits = lex.text === "\\limits"; base.limits = _limits; } else { throw new src_ParseError("Limit controls must follow a math operator", lex); } this.consume(); } else if (lex.text === "^") { // We got a superscript start if (superscript) { throw new src_ParseError("Double superscript", lex); } superscript = this.handleSupSubscript("superscript"); } else if (lex.text === "_") { // We got a subscript start if (subscript) { throw new src_ParseError("Double subscript", lex); } subscript = this.handleSupSubscript("subscript"); } else if (lex.text === "'") { // We got a prime if (superscript) { throw new src_ParseError("Double superscript", lex); } var prime = { type: "textord", mode: this.mode, text: "\\prime" }; // Many primes can be grouped together, so we handle this here var primes = [prime]; this.consume(); // Keep lexing tokens until we get something that's not a prime while (this.fetch().text === "'") { // For each one, add another prime to the list primes.push(prime); this.consume(); } // If there's a superscript following the primes, combine that // superscript in with the primes. if (this.fetch().text === "^") { primes.push(this.handleSupSubscript("superscript")); } // Put everything into an ordgroup as the superscript superscript = { type: "ordgroup", mode: this.mode, body: primes }; } else { // If it wasn't ^, _, or ', stop parsing super/subscripts break; } } // Base must be set if superscript or subscript are set per logic above, // but need to check here for type check to pass. if (superscript || subscript) { // If we got either a superscript or subscript, create a supsub return { type: "supsub", mode: this.mode, base: base, sup: superscript, sub: subscript }; } else { // Otherwise return the original body return base; } } /** * Parses an entire function, including its base and all of its arguments. */ ; _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting. greediness) { var token = this.fetch(); var func = token.text; var funcData = src_functions[func]; if (!funcData) { return null; } this.consume(); // consume command token if (greediness != null && funcData.greediness <= greediness) { throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); } else if (this.mode === "text" && !funcData.allowedInText) { throw new src_ParseError("Can't use function '" + func + "' in text mode", token); } else if (this.mode === "math" && funcData.allowedInMath === false) { throw new src_ParseError("Can't use function '" + func + "' in math mode", token); } var _this$parseArguments = this.parseArguments(func, funcData), args = _this$parseArguments.args, optArgs = _this$parseArguments.optArgs; return this.callFunction(func, args, optArgs, token, breakOnTokenText); } /** * Call a function handler with a suitable context and arguments. */ ; _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) { var context = { funcName: name, parser: this, token: token, breakOnTokenText: breakOnTokenText }; var func = src_functions[name]; if (func && func.handler) { return func.handler(context, args, optArgs); } else { throw new src_ParseError("No function handler for " + name); } } /** * Parses the arguments of a function or environment */ ; _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}". funcData) { var totalArgs = funcData.numArgs + funcData.numOptionalArgs; if (totalArgs === 0) { return { args: [], optArgs: [] }; } var baseGreediness = funcData.greediness; var args = []; var optArgs = []; for (var i = 0; i < totalArgs; i++) { var argType = funcData.argTypes && funcData.argTypes[i]; var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: // "After you have said ‘\def\row#1#2{...}’, you are allowed to // put spaces between the arguments (e.g., ‘\row x n’), because // TeX doesn’t use single spaces as undelimited arguments." var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol // won't know what to do with them. This can only happen with // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. // In LaTeX, the \foo's get treated as (blank) arguments. // In KaTeX, for now, both spaces will get consumed. // TODO(edemaine) i === 0 && !isOptional && this.mode === "math"; var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness, consumeSpaces); if (!arg) { if (isOptional) { optArgs.push(null); continue; } throw new src_ParseError("Expected group after '" + func + "'", this.fetch()); } (isOptional ? optArgs : args).push(arg); } return { args: args, optArgs: optArgs }; } /** * Parses a group when the mode is changing. */ ; _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) { switch (type) { case "color": if (consumeSpaces) { this.consumeSpaces(); } return this.parseColorGroup(optional); case "size": if (consumeSpaces) { this.consumeSpaces(); } return this.parseSizeGroup(optional); case "url": return this.parseUrlGroup(optional, consumeSpaces); case "math": case "text": return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces); case "hbox": { // hbox argument type wraps the argument in the equivalent of // \hbox, which is like \text but switching to \textstyle size. var group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces); if (!group) { return group; } var styledGroup = { type: "styling", mode: group.mode, body: [group], style: "text" // simulate \textstyle }; return styledGroup; } case "raw": { if (consumeSpaces) { this.consumeSpaces(); } if (optional && this.fetch().text === "{") { return null; } var token = this.parseStringGroup("raw", optional, true); if (token) { return { type: "raw", mode: "text", string: token.text }; } else { throw new src_ParseError("Expected raw group", this.fetch()); } } case "original": case null: case undefined: return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces); default: throw new src_ParseError("Unknown group type as " + name, this.fetch()); } } /** * Discard any space tokens, fetching the next non-space token. */ ; _proto.consumeSpaces = function consumeSpaces() { while (this.fetch().text === " ") { this.consume(); } } /** * Parses a group, essentially returning the string formed by the * brace-enclosed tokens plus some position information. */ ; _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages. optional, raw) { var groupBegin = optional ? "[" : "{"; var groupEnd = optional ? "]" : "}"; var beginToken = this.fetch(); if (beginToken.text !== groupBegin) { if (optional) { return null; } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) { this.consume(); return beginToken; } } var outerMode = this.mode; this.mode = "text"; this.expect(groupBegin); var str = ""; var firstToken = this.fetch(); var nested = 0; // allow nested braces in raw string group var lastToken = firstToken; var nextToken; while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) { switch (nextToken.text) { case "EOF": throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); case groupBegin: nested++; break; case groupEnd: nested--; break; } lastToken = nextToken; str += lastToken.text; this.consume(); } this.expect(groupEnd); this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a regex-delimited group: the largest sequence of tokens * whose concatenated strings match `regex`. Returns the string * formed by the tokens plus some position information. */ ; _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) { var outerMode = this.mode; this.mode = "text"; var firstToken = this.fetch(); var lastToken = firstToken; var str = ""; var nextToken; while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) { lastToken = nextToken; str += lastToken.text; this.consume(); } if (str === "") { throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); } this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a color description. */ ; _proto.parseColorGroup = function parseColorGroup(optional) { var res = this.parseStringGroup("color", optional); if (!res) { return null; } var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); if (!match) { throw new src_ParseError("Invalid color: '" + res.text + "'", res); } var color = match[0]; if (/^[0-9a-f]{6}$/i.test(color)) { // We allow a 6-digit HTML color spec without a leading "#". // This follows the xcolor package's HTML color model. // Predefined color names are all missed by this RegEx pattern. color = "#" + color; } return { type: "color-token", mode: this.mode, color: color }; } /** * Parses a size specification, consisting of magnitude and unit. */ ; _proto.parseSizeGroup = function parseSizeGroup(optional) { var res; var isBlank = false; if (!optional && this.fetch().text !== "{") { res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); } else { res = this.parseStringGroup("size", optional); } if (!res) { return null; } if (!optional && res.text.length === 0) { // Because we've tested for what is !optional, this block won't // affect \kern, \hspace, etc. It will capture the mandatory arguments // to \genfrac and \above. res.text = "0pt"; // Enable \above{} isBlank = true; // This is here specifically for \genfrac } var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); if (!match) { throw new src_ParseError("Invalid size: '" + res.text + "'", res); } var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new src_ParseError("Invalid unit: '" + data.unit + "'", res); } return { type: "size", mode: this.mode, value: data, isBlank: isBlank }; } /** * Parses an URL, checking escaped letters and allowed protocols, * and setting the catcode of % as an active character (as in \hyperref). */ ; _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) { this.gullet.lexer.setCatcode("%", 13); // active character var res = this.parseStringGroup("url", optional, true); // get raw string this.gullet.lexer.setCatcode("%", 14); // comment character if (!res) { return null; } // hyperref package allows backslashes alone in href, but doesn't // generate valid links in such cases; we interpret this as // "undefined" behaviour, and keep them as-is. Some browser will // replace backslashes with forward slashes. var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); return { type: "url", mode: this.mode, url: url }; } /** * If `optional` is false or absent, this parses an ordinary group, * which is either a single nucleus (like "x") or an expression * in braces (like "{x+y}") or an implicit group, a group that starts * at the current position, and ends right before a higher explicit * group ends, or at EOF. * If `optional` is true, it parses either a bracket-delimited expression * (like "[x+y]") or returns null to indicate the absence of a * bracket-enclosed group. * If `mode` is present, switches to that mode while parsing the group, * and switches back after. */ ; _proto.parseGroup = function parseGroup(name, // For error reporting. optional, greediness, breakOnTokenText, mode, consumeSpaces) { // Switch to specified mode var outerMode = this.mode; if (mode) { this.switchMode(mode); } // Consume spaces if requested, crucially *after* we switch modes, // so that the next non-space token is parsed in the correct mode. if (consumeSpaces) { this.consumeSpaces(); } // Get first token var firstToken = this.fetch(); var text = firstToken.text; var result; // Try to parse an open brace or \begingroup if (optional ? text === "[" : text === "{" || text === "\\begingroup") { this.consume(); var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace this.gullet.beginGroup(); // If we get a brace, parse an expression var expression = this.parseExpression(false, groupEnd); var lastToken = this.fetch(); // Check that we got a matching closing brace this.expect(groupEnd); // End group namespace this.gullet.endGroup(); result = { type: "ordgroup", mode: this.mode, loc: SourceLocation.range(firstToken, lastToken), body: expression, // A group formed by \begingroup...\endgroup is a semi-simple group // which doesn't affect spacing in math mode, i.e., is transparent. // https://tex.stackexchange.com/questions/1930/when-should-one- // use-begingroup-instead-of-bgroup semisimple: text === "\\begingroup" || undefined }; } else if (optional) { // Return nothing for an optional group result = null; } else { // If there exists a function with this name, parse the function. // Otherwise, just return a nucleus result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { if (this.settings.throwOnError) { throw new src_ParseError("Undefined control sequence: " + text, firstToken); } result = this.formatUnsupportedCmd(text); this.consume(); } } // Switch mode back if (mode) { this.switchMode(outerMode); } return result; } /** * Form ligature-like combinations of characters for text mode. * This includes inputs like "--", "---", "``" and "''". * The result will simply replace multiple textord nodes with a single * character in each value by a single textord node having multiple * characters in its value. The representation is still ASCII source. * The group will be modified in place. */ ; _proto.formLigatures = function formLigatures(group) { var n = group.length - 1; for (var i = 0; i < n; ++i) { var a = group[i]; // $FlowFixMe: Not every node type has a `text` property. var v = a.text; if (v === "-" && group[i + 1].text === "-") { if (i + 1 < n && group[i + 2].text === "-") { group.splice(i, 3, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 2]), text: "---" }); n -= 2; } else { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: "--" }); n -= 1; } } if ((v === "'" || v === "`") && group[i + 1].text === v) { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: v + v }); n -= 1; } } } /** * Parse a single symbol out of the string. Here, we handle single character * symbols and special functions like \verb. */ ; _proto.parseSymbol = function parseSymbol() { var nucleus = this.fetch(); var text = nucleus.text; if (/^\\verb[^a-zA-Z]/.test(text)) { this.consume(); var arg = text.slice(5); var star = arg.charAt(0) === "*"; if (star) { arg = arg.slice(1); } // Lexer's tokenRegex is constructed to always have matching // first/last characters. if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { throw new src_ParseError("\\verb assertion failed --\n please report what input caused this bug"); } arg = arg.slice(1, -1); // remove first and last char return { type: "verb", mode: "text", body: arg, star: star }; } // At this point, we should have a symbol, possibly with accents. // First expand any accented base symbol according to unicodeSymbols. if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) { // This behavior is not strict (XeTeX-compatible) in math mode. if (this.settings.strict && this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } text = unicodeSymbols[text[0]] + text.substr(1); } // Strip off any combining characters var match = combiningDiacriticalMarksEndRegex.exec(text); if (match) { text = text.substring(0, match.index); if (text === 'i') { text = "\u0131"; // dotless i, in math and text mode } else if (text === 'j') { text = "\u0237"; // dotless j, in math and text mode } } // Recognize base symbol var symbol; if (src_symbols[this.mode][text]) { if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } var group = src_symbols[this.mode][text].group; var loc = SourceLocation.range(nucleus); var s; if (ATOMS.hasOwnProperty(group)) { // $FlowFixMe var family = group; s = { type: "atom", mode: this.mode, family: family, loc: loc, text: text }; } else { // $FlowFixMe s = { type: group, mode: this.mode, loc: loc, text: text }; } symbol = s; } else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^ if (this.settings.strict) { if (!supportedCodepoint(text.charCodeAt(0))) { this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus); } else if (this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus); } } // All nonmathematical Unicode characters are rendered as if they // are in text mode (wrapped in \text) because that's what it // takes to render them in LaTeX. Setting `mode: this.mode` is // another natural choice (the user requested math mode), but // this makes it more difficult for getCharacterMetrics() to // distinguish Unicode characters without metrics and those for // which we want to simulate the letter M. symbol = { type: "textord", mode: "text", loc: SourceLocation.range(nucleus), text: text }; } else { return null; // EOF, ^, _, {, }, etc. } this.consume(); // Transform combining characters into accents if (match) { for (var i = 0; i < match[0].length; i++) { var accent = match[0][i]; if (!unicodeAccents[accent]) { throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus); } var command = unicodeAccents[accent][this.mode]; if (!command) { throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus); } symbol = { type: "accent", mode: this.mode, loc: SourceLocation.range(nucleus), label: command, isStretchy: false, isShifty: true, base: symbol }; } } return symbol; }; return Parser; }(); Parser_Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; Parser_Parser.endOfGroup = { "[": "]", "{": "}", "\\begingroup": "\\endgroup" /** * Parses an "expression", which is a list of atoms. * * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This * happens when functions have higher precendence han infix * nodes in implicit parses. * * `breakOnTokenText`: The text of the token that the expression should end * with, or `null` if something else should end the * expression. */ }; Parser_Parser.SUPSUB_GREEDINESS = 1; // CONCATENATED MODULE: ./src/parseTree.js /** * Provides a single function for parsing an expression using a Parser * TODO(emily): Remove this */ /** * Parses an expression using a Parser, then returns the parsed result. */ var parseTree_parseTree = function parseTree(toParse, settings) { if (!(typeof toParse === 'string' || toParse instanceof String)) { throw new TypeError('KaTeX can only parse string typed expression'); } var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors delete parser.gullet.macros.current["\\df@tag"]; var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. // In this case, we separately parse the tag and wrap the tree. if (parser.gullet.macros.get("\\df@tag")) { if (!settings.displayMode) { throw new src_ParseError("\\tag works only in display equations"); } parser.gullet.feed("\\df@tag"); tree = [{ type: "tag", mode: "text", body: tree, tag: parser.parse() }]; } return tree; }; /* harmony default export */ var src_parseTree = (parseTree_parseTree); // CONCATENATED MODULE: ./katex.js /* eslint no-console:0 */ /** * This is the main entry point for KaTeX. Here, we expose functions for * rendering expressions either to DOM nodes or to markup strings. * * We also expose the ParseError class to check if errors thrown from KaTeX are * errors in the expression, or errors in javascript handling. */ /** * Parse and build an expression, and place that expression in the DOM node * given. */ var katex_render = function render(expression, baseNode, options) { baseNode.textContent = ""; var node = katex_renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and // disable rendering. if (typeof document !== "undefined") { if (document.compatMode !== "CSS1Compat") { typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); katex_render = function render() { throw new src_ParseError("KaTeX doesn't work in quirks mode."); }; } } /** * Parse and build an expression, and return the markup for that. */ var renderToString = function renderToString(expression, options) { var markup = katex_renderToDomTree(expression, options).toMarkup(); return markup; }; /** * Parse an expression and return the parse tree. */ var katex_generateParseTree = function generateParseTree(expression, options) { var settings = new Settings_Settings(options); return src_parseTree(expression, settings); }; /** * If the given error is a KaTeX ParseError and options.throwOnError is false, * renders the invalid LaTeX as a span with hover title giving the KaTeX * error message. Otherwise, simply throws the error. */ var katex_renderError = function renderError(error, expression, options) { if (options.throwOnError || !(error instanceof src_ParseError)) { throw error; } var node = buildCommon.makeSpan(["katex-error"], [new domTree_SymbolNode(expression)]); node.setAttribute("title", error.toString()); node.setAttribute("style", "color:" + options.errorColor); return node; }; /** * Generates and returns the katex build tree. This is used for advanced * use cases (like rendering to custom output). */ var katex_renderToDomTree = function renderToDomTree(expression, options) { var settings = new Settings_Settings(options); try { var tree = src_parseTree(expression, settings); return buildTree_buildTree(tree, expression, settings); } catch (error) { return katex_renderError(error, expression, settings); } }; /** * Generates and returns the katex build tree, with just HTML (no MathML). * This is used for advanced use cases (like rendering to custom output). */ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { var settings = new Settings_Settings(options); try { var tree = src_parseTree(expression, settings); return buildTree_buildHTMLTree(tree, expression, settings); } catch (error) { return katex_renderError(error, expression, settings); } }; /* harmony default export */ var katex_0 = ({ /** * Current KaTeX version */ version: "0.12.0", /** * Renders the given LaTeX into an HTML+MathML combination, and adds * it as a child to the specified DOM node. */ render: katex_render, /** * Renders the given LaTeX into an HTML+MathML combination string, * for sending to the client. */ renderToString: renderToString, /** * KaTeX error, usually during parsing. */ ParseError: src_ParseError, /** * Parses the given LaTeX into KaTeX's internal parse tree structure, * without rendering to HTML or MathML. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __parse: katex_generateParseTree, /** * Renders the given LaTeX into an HTML+MathML internal DOM tree * representation, without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToDomTree: katex_renderToDomTree, /** * Renders the given LaTeX into an HTML internal DOM tree representation, * without MathML and without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToHTMLTree: katex_renderToHTMLTree, /** * extends internal font metrics object with a new object * each key in the new object represents a font name */ __setFontMetrics: setFontMetrics, /** * adds a new symbol to builtin symbols table */ __defineSymbol: defineSymbol, /** * adds a new macro to builtin macro list */ __defineMacro: defineMacro, /** * Expose the dom tree node types, which can be useful for type checking nodes. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __domTree: { Span: domTree_Span, Anchor: domTree_Anchor, SymbolNode: domTree_SymbolNode, SvgNode: SvgNode, PathNode: domTree_PathNode, LineNode: LineNode } }); // CONCATENATED MODULE: ./katex.webpack.js /** * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2] * doesn't support CSS modules natively, a separate entry point is used and * it is not flowtyped. * * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef * [2] https://facebook.github.io/jest/docs/en/webpack.html */ /* harmony default export */ var katex_webpack = __webpack_exports__["default"] = (katex_0); /***/ }) /******/ ])["default"]; }); }); var immutable = extend$2; var hasOwnProperty = Object.prototype.hasOwnProperty; function extend$2() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target } var schema$1 = Schema$2; var proto$3 = Schema$2.prototype; proto$3.space = null; proto$3.normal = {}; proto$3.property = {}; function Schema$2(property, normal, space) { this.property = property; this.normal = normal; if (space) { this.space = space; } } var merge_1 = merge$1; function merge$1(definitions) { var length = definitions.length; var property = []; var normal = []; var index = -1; var info; var space; while (++index < length) { info = definitions[index]; property.push(info.property); normal.push(info.normal); space = info.space; } return new schema$1( immutable.apply(null, property), immutable.apply(null, normal), space ) } var normalize_1 = normalize; function normalize(value) { return value.toLowerCase() } var info$1 = Info; var proto$4 = Info.prototype; proto$4.space = null; proto$4.attribute = null; proto$4.property = null; proto$4.boolean = false; proto$4.booleanish = false; proto$4.overloadedBoolean = false; proto$4.number = false; proto$4.commaSeparated = false; proto$4.spaceSeparated = false; proto$4.commaOrSpaceSeparated = false; proto$4.mustUseProperty = false; proto$4.defined = false; function Info(property, attribute) { this.property = property; this.attribute = attribute; } var powers = 0; var boolean_1 = increment(); var booleanish = increment(); var overloadedBoolean = increment(); var number = increment(); var spaceSeparated = increment(); var commaSeparated = increment(); var commaOrSpaceSeparated = increment(); function increment() { return Math.pow(2, ++powers) } var types = { boolean: boolean_1, booleanish: booleanish, overloadedBoolean: overloadedBoolean, number: number, spaceSeparated: spaceSeparated, commaSeparated: commaSeparated, commaOrSpaceSeparated: commaOrSpaceSeparated }; var definedInfo = DefinedInfo; DefinedInfo.prototype = new info$1(); DefinedInfo.prototype.defined = true; var checks = [ 'boolean', 'booleanish', 'overloadedBoolean', 'number', 'commaSeparated', 'spaceSeparated', 'commaOrSpaceSeparated' ]; var checksLength = checks.length; function DefinedInfo(property, attribute, mask, space) { var index = -1; var check; mark$1(this, 'space', space); info$1.call(this, property, attribute); while (++index < checksLength) { check = checks[index]; mark$1(this, check, (mask & types[check]) === types[check]); } } function mark$1(values, key, value) { if (value) { values[key] = value; } } var create_1 = create$4; function create$4(definition) { var space = definition.space; var mustUseProperty = definition.mustUseProperty || []; var attributes = definition.attributes || {}; var props = definition.properties; var transform = definition.transform; var property = {}; var normal = {}; var prop; var info; for (prop in props) { info = new definedInfo( prop, transform(attributes, prop), props[prop], space ); if (mustUseProperty.indexOf(prop) !== -1) { info.mustUseProperty = true; } property[prop] = info; normal[normalize_1(prop)] = prop; normal[normalize_1(info.attribute)] = prop; } return new schema$1(property, normal, space) } var xlink = create_1({ space: 'xlink', transform: xlinkTransform, properties: { xLinkActuate: null, xLinkArcRole: null, xLinkHref: null, xLinkRole: null, xLinkShow: null, xLinkTitle: null, xLinkType: null } }); function xlinkTransform(_, prop) { return 'xlink:' + prop.slice(5).toLowerCase() } var xml = create_1({ space: 'xml', transform: xmlTransform, properties: { xmlLang: null, xmlBase: null, xmlSpace: null } }); function xmlTransform(_, prop) { return 'xml:' + prop.slice(3).toLowerCase() } var caseSensitiveTransform_1 = caseSensitiveTransform; function caseSensitiveTransform(attributes, attribute) { return attribute in attributes ? attributes[attribute] : attribute } var caseInsensitiveTransform_1 = caseInsensitiveTransform; function caseInsensitiveTransform(attributes, property) { return caseSensitiveTransform_1(attributes, property.toLowerCase()) } var xmlns = create_1({ space: 'xmlns', attributes: { xmlnsxlink: 'xmlns:xlink' }, transform: caseInsensitiveTransform_1, properties: { xmlns: null, xmlnsXLink: null } }); var booleanish$1 = types.booleanish; var number$1 = types.number; var spaceSeparated$1 = types.spaceSeparated; var aria = create_1({ transform: ariaTransform, properties: { ariaActiveDescendant: null, ariaAtomic: booleanish$1, ariaAutoComplete: null, ariaBusy: booleanish$1, ariaChecked: booleanish$1, ariaColCount: number$1, ariaColIndex: number$1, ariaColSpan: number$1, ariaControls: spaceSeparated$1, ariaCurrent: null, ariaDescribedBy: spaceSeparated$1, ariaDetails: null, ariaDisabled: booleanish$1, ariaDropEffect: spaceSeparated$1, ariaErrorMessage: null, ariaExpanded: booleanish$1, ariaFlowTo: spaceSeparated$1, ariaGrabbed: booleanish$1, ariaHasPopup: null, ariaHidden: booleanish$1, ariaInvalid: null, ariaKeyShortcuts: null, ariaLabel: null, ariaLabelledBy: spaceSeparated$1, ariaLevel: number$1, ariaLive: null, ariaModal: booleanish$1, ariaMultiLine: booleanish$1, ariaMultiSelectable: booleanish$1, ariaOrientation: null, ariaOwns: spaceSeparated$1, ariaPlaceholder: null, ariaPosInSet: number$1, ariaPressed: booleanish$1, ariaReadOnly: booleanish$1, ariaRelevant: null, ariaRequired: booleanish$1, ariaRoleDescription: spaceSeparated$1, ariaRowCount: number$1, ariaRowIndex: number$1, ariaRowSpan: number$1, ariaSelected: booleanish$1, ariaSetSize: number$1, ariaSort: null, ariaValueMax: number$1, ariaValueMin: number$1, ariaValueNow: number$1, ariaValueText: null, role: null } }); function ariaTransform(_, prop) { return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase() } var boolean = types.boolean; var number$2 = types.number; var spaceSeparated$2 = types.spaceSeparated; var commaSeparated$1 = types.commaSeparated; var commaOrSpaceSeparated$1 = types.commaOrSpaceSeparated; var svg = create_1({ space: 'svg', attributes: { accentHeight: 'accent-height', alignmentBaseline: 'alignment-baseline', arabicForm: 'arabic-form', baselineShift: 'baseline-shift', capHeight: 'cap-height', className: 'class', clipPath: 'clip-path', clipRule: 'clip-rule', colorInterpolation: 'color-interpolation', colorInterpolationFilters: 'color-interpolation-filters', colorProfile: 'color-profile', colorRendering: 'color-rendering', crossOrigin: 'crossorigin', dataType: 'datatype', dominantBaseline: 'dominant-baseline', enableBackground: 'enable-background', fillOpacity: 'fill-opacity', fillRule: 'fill-rule', floodColor: 'flood-color', floodOpacity: 'flood-opacity', fontFamily: 'font-family', fontSize: 'font-size', fontSizeAdjust: 'font-size-adjust', fontStretch: 'font-stretch', fontStyle: 'font-style', fontVariant: 'font-variant', fontWeight: 'font-weight', glyphName: 'glyph-name', glyphOrientationHorizontal: 'glyph-orientation-horizontal', glyphOrientationVertical: 'glyph-orientation-vertical', hrefLang: 'hreflang', horizAdvX: 'horiz-adv-x', horizOriginX: 'horiz-origin-x', horizOriginY: 'horiz-origin-y', imageRendering: 'image-rendering', letterSpacing: 'letter-spacing', lightingColor: 'lighting-color', markerEnd: 'marker-end', markerMid: 'marker-mid', markerStart: 'marker-start', navDown: 'nav-down', navDownLeft: 'nav-down-left', navDownRight: 'nav-down-right', navLeft: 'nav-left', navNext: 'nav-next', navPrev: 'nav-prev', navRight: 'nav-right', navUp: 'nav-up', navUpLeft: 'nav-up-left', navUpRight: 'nav-up-right', onAbort: 'onabort', onActivate: 'onactivate', onAfterPrint: 'onafterprint', onBeforePrint: 'onbeforeprint', onBegin: 'onbegin', onCancel: 'oncancel', onCanPlay: 'oncanplay', onCanPlayThrough: 'oncanplaythrough', onChange: 'onchange', onClick: 'onclick', onClose: 'onclose', onCopy: 'oncopy', onCueChange: 'oncuechange', onCut: 'oncut', onDblClick: 'ondblclick', onDrag: 'ondrag', onDragEnd: 'ondragend', onDragEnter: 'ondragenter', onDragExit: 'ondragexit', onDragLeave: 'ondragleave', onDragOver: 'ondragover', onDragStart: 'ondragstart', onDrop: 'ondrop', onDurationChange: 'ondurationchange', onEmptied: 'onemptied', onEnd: 'onend', onEnded: 'onended', onError: 'onerror', onFocus: 'onfocus', onFocusIn: 'onfocusin', onFocusOut: 'onfocusout', onHashChange: 'onhashchange', onInput: 'oninput', onInvalid: 'oninvalid', onKeyDown: 'onkeydown', onKeyPress: 'onkeypress', onKeyUp: 'onkeyup', onLoad: 'onload', onLoadedData: 'onloadeddata', onLoadedMetadata: 'onloadedmetadata', onLoadStart: 'onloadstart', onMessage: 'onmessage', onMouseDown: 'onmousedown', onMouseEnter: 'onmouseenter', onMouseLeave: 'onmouseleave', onMouseMove: 'onmousemove', onMouseOut: 'onmouseout', onMouseOver: 'onmouseover', onMouseUp: 'onmouseup', onMouseWheel: 'onmousewheel', onOffline: 'onoffline', onOnline: 'ononline', onPageHide: 'onpagehide', onPageShow: 'onpageshow', onPaste: 'onpaste', onPause: 'onpause', onPlay: 'onplay', onPlaying: 'onplaying', onPopState: 'onpopstate', onProgress: 'onprogress', onRateChange: 'onratechange', onRepeat: 'onrepeat', onReset: 'onreset', onResize: 'onresize', onScroll: 'onscroll', onSeeked: 'onseeked', onSeeking: 'onseeking', onSelect: 'onselect', onShow: 'onshow', onStalled: 'onstalled', onStorage: 'onstorage', onSubmit: 'onsubmit', onSuspend: 'onsuspend', onTimeUpdate: 'ontimeupdate', onToggle: 'ontoggle', onUnload: 'onunload', onVolumeChange: 'onvolumechange', onWaiting: 'onwaiting', onZoom: 'onzoom', overlinePosition: 'overline-position', overlineThickness: 'overline-thickness', paintOrder: 'paint-order', panose1: 'panose-1', pointerEvents: 'pointer-events', referrerPolicy: 'referrerpolicy', renderingIntent: 'rendering-intent', shapeRendering: 'shape-rendering', stopColor: 'stop-color', stopOpacity: 'stop-opacity', strikethroughPosition: 'strikethrough-position', strikethroughThickness: 'strikethrough-thickness', strokeDashArray: 'stroke-dasharray', strokeDashOffset: 'stroke-dashoffset', strokeLineCap: 'stroke-linecap', strokeLineJoin: 'stroke-linejoin', strokeMiterLimit: 'stroke-miterlimit', strokeOpacity: 'stroke-opacity', strokeWidth: 'stroke-width', tabIndex: 'tabindex', textAnchor: 'text-anchor', textDecoration: 'text-decoration', textRendering: 'text-rendering', typeOf: 'typeof', underlinePosition: 'underline-position', underlineThickness: 'underline-thickness', unicodeBidi: 'unicode-bidi', unicodeRange: 'unicode-range', unitsPerEm: 'units-per-em', vAlphabetic: 'v-alphabetic', vHanging: 'v-hanging', vIdeographic: 'v-ideographic', vMathematical: 'v-mathematical', vectorEffect: 'vector-effect', vertAdvY: 'vert-adv-y', vertOriginX: 'vert-origin-x', vertOriginY: 'vert-origin-y', wordSpacing: 'word-spacing', writingMode: 'writing-mode', xHeight: 'x-height', // These were camelcased in Tiny. Now lowercased in SVG 2 playbackOrder: 'playbackorder', timelineBegin: 'timelinebegin' }, transform: caseSensitiveTransform_1, properties: { about: commaOrSpaceSeparated$1, accentHeight: number$2, accumulate: null, additive: null, alignmentBaseline: null, alphabetic: number$2, amplitude: number$2, arabicForm: null, ascent: number$2, attributeName: null, attributeType: null, azimuth: number$2, bandwidth: null, baselineShift: null, baseFrequency: null, baseProfile: null, bbox: null, begin: null, bias: number$2, by: null, calcMode: null, capHeight: number$2, className: spaceSeparated$2, clip: null, clipPath: null, clipPathUnits: null, clipRule: null, color: null, colorInterpolation: null, colorInterpolationFilters: null, colorProfile: null, colorRendering: null, content: null, contentScriptType: null, contentStyleType: null, crossOrigin: null, cursor: null, cx: null, cy: null, d: null, dataType: null, defaultAction: null, descent: number$2, diffuseConstant: number$2, direction: null, display: null, dur: null, divisor: number$2, dominantBaseline: null, download: boolean, dx: null, dy: null, edgeMode: null, editable: null, elevation: number$2, enableBackground: null, end: null, event: null, exponent: number$2, externalResourcesRequired: null, fill: null, fillOpacity: number$2, fillRule: null, filter: null, filterRes: null, filterUnits: null, floodColor: null, floodOpacity: null, focusable: null, focusHighlight: null, fontFamily: null, fontSize: null, fontSizeAdjust: null, fontStretch: null, fontStyle: null, fontVariant: null, fontWeight: null, format: null, fr: null, from: null, fx: null, fy: null, g1: commaSeparated$1, g2: commaSeparated$1, glyphName: commaSeparated$1, glyphOrientationHorizontal: null, glyphOrientationVertical: null, glyphRef: null, gradientTransform: null, gradientUnits: null, handler: null, hanging: number$2, hatchContentUnits: null, hatchUnits: null, height: null, href: null, hrefLang: null, horizAdvX: number$2, horizOriginX: number$2, horizOriginY: number$2, id: null, ideographic: number$2, imageRendering: null, initialVisibility: null, in: null, in2: null, intercept: number$2, k: number$2, k1: number$2, k2: number$2, k3: number$2, k4: number$2, kernelMatrix: commaOrSpaceSeparated$1, kernelUnitLength: null, keyPoints: null, // SEMI_COLON_SEPARATED keySplines: null, // SEMI_COLON_SEPARATED keyTimes: null, // SEMI_COLON_SEPARATED kerning: null, lang: null, lengthAdjust: null, letterSpacing: null, lightingColor: null, limitingConeAngle: number$2, local: null, markerEnd: null, markerMid: null, markerStart: null, markerHeight: null, markerUnits: null, markerWidth: null, mask: null, maskContentUnits: null, maskUnits: null, mathematical: null, max: null, media: null, mediaCharacterEncoding: null, mediaContentEncodings: null, mediaSize: number$2, mediaTime: null, method: null, min: null, mode: null, name: null, navDown: null, navDownLeft: null, navDownRight: null, navLeft: null, navNext: null, navPrev: null, navRight: null, navUp: null, navUpLeft: null, navUpRight: null, numOctaves: null, observer: null, offset: null, onAbort: null, onActivate: null, onAfterPrint: null, onBeforePrint: null, onBegin: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnd: null, onEnded: null, onError: null, onFocus: null, onFocusIn: null, onFocusOut: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadStart: null, onMessage: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onMouseWheel: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRepeat: null, onReset: null, onResize: null, onScroll: null, onSeeked: null, onSeeking: null, onSelect: null, onShow: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnload: null, onVolumeChange: null, onWaiting: null, onZoom: null, opacity: null, operator: null, order: null, orient: null, orientation: null, origin: null, overflow: null, overlay: null, overlinePosition: number$2, overlineThickness: number$2, paintOrder: null, panose1: null, path: null, pathLength: number$2, patternContentUnits: null, patternTransform: null, patternUnits: null, phase: null, ping: spaceSeparated$2, pitch: null, playbackOrder: null, pointerEvents: null, points: null, pointsAtX: number$2, pointsAtY: number$2, pointsAtZ: number$2, preserveAlpha: null, preserveAspectRatio: null, primitiveUnits: null, propagate: null, property: commaOrSpaceSeparated$1, r: null, radius: null, referrerPolicy: null, refX: null, refY: null, rel: commaOrSpaceSeparated$1, rev: commaOrSpaceSeparated$1, renderingIntent: null, repeatCount: null, repeatDur: null, requiredExtensions: commaOrSpaceSeparated$1, requiredFeatures: commaOrSpaceSeparated$1, requiredFonts: commaOrSpaceSeparated$1, requiredFormats: commaOrSpaceSeparated$1, resource: null, restart: null, result: null, rotate: null, rx: null, ry: null, scale: null, seed: null, shapeRendering: null, side: null, slope: null, snapshotTime: null, specularConstant: number$2, specularExponent: number$2, spreadMethod: null, spacing: null, startOffset: null, stdDeviation: null, stemh: null, stemv: null, stitchTiles: null, stopColor: null, stopOpacity: null, strikethroughPosition: number$2, strikethroughThickness: number$2, string: null, stroke: null, strokeDashArray: commaOrSpaceSeparated$1, strokeDashOffset: null, strokeLineCap: null, strokeLineJoin: null, strokeMiterLimit: number$2, strokeOpacity: number$2, strokeWidth: null, style: null, surfaceScale: number$2, syncBehavior: null, syncBehaviorDefault: null, syncMaster: null, syncTolerance: null, syncToleranceDefault: null, systemLanguage: commaOrSpaceSeparated$1, tabIndex: number$2, tableValues: null, target: null, targetX: number$2, targetY: number$2, textAnchor: null, textDecoration: null, textRendering: null, textLength: null, timelineBegin: null, title: null, transformBehavior: null, type: null, typeOf: commaOrSpaceSeparated$1, to: null, transform: null, u1: null, u2: null, underlinePosition: number$2, underlineThickness: number$2, unicode: null, unicodeBidi: null, unicodeRange: null, unitsPerEm: number$2, values: null, vAlphabetic: number$2, vMathematical: number$2, vectorEffect: null, vHanging: number$2, vIdeographic: number$2, version: null, vertAdvY: number$2, vertOriginX: number$2, vertOriginY: number$2, viewBox: null, viewTarget: null, visibility: null, width: null, widths: null, wordSpacing: null, writingMode: null, x: null, x1: null, x2: null, xChannelSelector: null, xHeight: number$2, y: null, y1: null, y2: null, yChannelSelector: null, z: null, zoomAndPan: null } }); var svg_1 = merge_1([xml, xlink, xmlns, aria, svg]); var caseSensitive = [ "altGlyph", "altGlyphDef", "altGlyphItem", "animateColor", "animateMotion", "animateTransform", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "glyphRef", "linearGradient", "radialGradient", "solidColor", "textArea", "textPath" ]; var data = 'data'; var find_1 = find; var valid = /^data[-\w.:]+$/i; var dash$2 = /-[a-z]/g; var cap$1 = /[A-Z]/g; function find(schema, value) { var normal = normalize_1(value); var prop = value; var Type = info$1; if (normal in schema.normal) { return schema.property[schema.normal[normal]] } if (normal.length > 4 && normal.slice(0, 4) === data && valid.test(value)) { // Attribute or property. if (value.charAt(4) === '-') { prop = datasetToProperty(value); } else { value = datasetToAttribute(value); } Type = definedInfo; } return new Type(prop, value) } function datasetToProperty(attribute) { var value = attribute.slice(5).replace(dash$2, camelcase); return data + value.charAt(0).toUpperCase() + value.slice(1) } function datasetToAttribute(property) { var value = property.slice(4); if (dash$2.test(value)) { return property } value = value.replace(cap$1, kebab); if (value.charAt(0) !== '-') { value = '-' + value; } return data + value } function kebab($0) { return '-' + $0.toLowerCase() } function camelcase($0) { return $0.charAt(1).toUpperCase() } var hastUtilParseSelector = parse$4; var search$1 = /[#.]/g; // Create a hast element from a simple CSS selector. function parse$4(selector, defaultTagName) { var value = selector || ''; var name = defaultTagName || 'div'; var props = {}; var start = 0; var subvalue; var previous; var match; while (start < value.length) { search$1.lastIndex = start; match = search$1.exec(value); subvalue = value.slice(start, match ? match.index : value.length); if (subvalue) { if (!previous) { name = subvalue; } else if (previous === '#') { props.id = subvalue; } else if (props.className) { props.className.push(subvalue); } else { props.className = [subvalue]; } start += subvalue.length; } if (match) { previous = match[0]; start++; } } return {type: 'element', tagName: name, properties: props, children: []} } var parse_1 = parse$5; var stringify_1$1 = stringify$2; var empty$1 = ''; var space$1 = ' '; var whiteSpace = /[ \t\n\r\f]+/g; function parse$5(value) { var input = String(value || empty$1).trim(); return input === empty$1 ? [] : input.split(whiteSpace) } function stringify$2(values) { return values.join(space$1).trim() } var spaceSeparatedTokens = { parse: parse_1, stringify: stringify_1$1 }; var parse_1$1 = parse$6; var stringify_1$2 = stringify$3; var comma$1 = ','; var space$2 = ' '; var empty$2 = ''; // Parse comma-separated tokens to an array. function parse$6(value) { var values = []; var input = String(value || empty$2); var index = input.indexOf(comma$1); var lastIndex = 0; var end = false; var val; while (!end) { if (index === -1) { index = input.length; end = true; } val = input.slice(lastIndex, index).trim(); if (val || !end) { values.push(val); } lastIndex = index + 1; index = input.indexOf(comma$1, lastIndex); } return values } // Compile an array to comma-separated tokens. // `options.padLeft` (default: `true`) pads a space left of each token, and // `options.padRight` (default: `false`) pads a space to the right of each token. function stringify$3(values, options) { var settings = options || {}; var left = settings.padLeft === false ? empty$2 : space$2; var right = settings.padRight ? space$2 : empty$2; // Ensure the last empty entry is seen. if (values[values.length - 1] === empty$2) { values = values.concat(empty$2); } return values.join(right + comma$1 + left).trim() } var commaSeparatedTokens = { parse: parse_1$1, stringify: stringify_1$2 }; var spaces = spaceSeparatedTokens.parse; var commas = commaSeparatedTokens.parse; var factory_1 = factory$1; var own$7 = {}.hasOwnProperty; function factory$1(schema, defaultTagName, caseSensitive) { var adjust = caseSensitive ? createAdjustMap(caseSensitive) : null; return h // Hyperscript compatible DSL for creating virtual hast trees. function h(selector, properties) { var node = hastUtilParseSelector(selector, defaultTagName); var children = Array.prototype.slice.call(arguments, 2); var name = node.tagName.toLowerCase(); var property; node.tagName = adjust && own$7.call(adjust, name) ? adjust[name] : name; if (properties && isChildren(properties, node)) { children.unshift(properties); properties = null; } if (properties) { for (property in properties) { addProperty(node.properties, property, properties[property]); } } addChild(node.children, children); if (node.tagName === 'template') { node.content = {type: 'root', children: node.children}; node.children = []; } return node } function addProperty(properties, key, value) { var info; var property; var result; // Ignore nullish and NaN values. if (value === null || value === undefined || value !== value) { return } info = find_1(schema, key); property = info.property; result = value; // Handle list values. if (typeof result === 'string') { if (info.spaceSeparated) { result = spaces(result); } else if (info.commaSeparated) { result = commas(result); } else if (info.commaOrSpaceSeparated) { result = spaces(commas(result).join(' ')); } } // Accept `object` on style. if (property === 'style' && typeof value !== 'string') { result = style(result); } // Class-names (which can be added both on the `selector` and here). if (property === 'className' && properties.className) { result = properties.className.concat(result); } properties[property] = parsePrimitives(info, property, result); } } function isChildren(value, node) { return ( typeof value === 'string' || 'length' in value || isNode(node.tagName, value) ) } function isNode(tagName, value) { var type = value.type; if (tagName === 'input' || !type || typeof type !== 'string') { return false } if (typeof value.children === 'object' && 'length' in value.children) { return true } type = type.toLowerCase(); if (tagName === 'button') { return ( type !== 'menu' && type !== 'submit' && type !== 'reset' && type !== 'button' ) } return 'value' in value } function addChild(nodes, value) { var index; var length; if (typeof value === 'string' || typeof value === 'number') { nodes.push({type: 'text', value: String(value)}); return } if (typeof value === 'object' && 'length' in value) { index = -1; length = value.length; while (++index < length) { addChild(nodes, value[index]); } return } if (typeof value !== 'object' || !('type' in value)) { throw new Error('Expected node, nodes, or string, got `' + value + '`') } nodes.push(value); } // Parse a (list of) primitives. function parsePrimitives(info, name, value) { var index; var length; var result; if (typeof value !== 'object' || !('length' in value)) { return parsePrimitive(info, name, value) } length = value.length; index = -1; result = []; while (++index < length) { result[index] = parsePrimitive(info, name, value[index]); } return result } // Parse a single primitives. function parsePrimitive(info, name, value) { var result = value; if (info.number || info.positiveNumber) { if (!isNaN(result) && result !== '') { result = Number(result); } } else if (info.boolean || info.overloadedBoolean) { // Accept `boolean` and `string`. if ( typeof result === 'string' && (result === '' || normalize_1(value) === normalize_1(name)) ) { result = true; } } return result } function style(value) { var result = []; var key; for (key in value) { result.push([key, value[key]].join(': ')); } return result.join('; ') } function createAdjustMap(values) { var length = values.length; var index = -1; var result = {}; var value; while (++index < length) { value = values[index]; result[value.toLowerCase()] = value; } return result } var svg$1 = factory_1(svg_1, 'g', caseSensitive); svg$1.displayName = 'svg'; var svg_1$1 = svg$1; var boolean$1 = types.boolean; var overloadedBoolean$1 = types.overloadedBoolean; var booleanish$2 = types.booleanish; var number$3 = types.number; var spaceSeparated$3 = types.spaceSeparated; var commaSeparated$2 = types.commaSeparated; var html$2 = create_1({ space: 'html', attributes: { acceptcharset: 'accept-charset', classname: 'class', htmlfor: 'for', httpequiv: 'http-equiv' }, transform: caseInsensitiveTransform_1, mustUseProperty: ['checked', 'multiple', 'muted', 'selected'], properties: { // Standard Properties. abbr: null, accept: commaSeparated$2, acceptCharset: spaceSeparated$3, accessKey: spaceSeparated$3, action: null, allow: null, allowFullScreen: boolean$1, allowPaymentRequest: boolean$1, allowUserMedia: boolean$1, alt: null, as: null, async: boolean$1, autoCapitalize: null, autoComplete: spaceSeparated$3, autoFocus: boolean$1, autoPlay: boolean$1, capture: boolean$1, charSet: null, checked: boolean$1, cite: null, className: spaceSeparated$3, cols: number$3, colSpan: null, content: null, contentEditable: booleanish$2, controls: boolean$1, controlsList: spaceSeparated$3, coords: number$3 | commaSeparated$2, crossOrigin: null, data: null, dateTime: null, decoding: null, default: boolean$1, defer: boolean$1, dir: null, dirName: null, disabled: boolean$1, download: overloadedBoolean$1, draggable: booleanish$2, encType: null, enterKeyHint: null, form: null, formAction: null, formEncType: null, formMethod: null, formNoValidate: boolean$1, formTarget: null, headers: spaceSeparated$3, height: number$3, hidden: boolean$1, high: number$3, href: null, hrefLang: null, htmlFor: spaceSeparated$3, httpEquiv: spaceSeparated$3, id: null, imageSizes: null, imageSrcSet: commaSeparated$2, inputMode: null, integrity: null, is: null, isMap: boolean$1, itemId: null, itemProp: spaceSeparated$3, itemRef: spaceSeparated$3, itemScope: boolean$1, itemType: spaceSeparated$3, kind: null, label: null, lang: null, language: null, list: null, loading: null, loop: boolean$1, low: number$3, manifest: null, max: null, maxLength: number$3, media: null, method: null, min: null, minLength: number$3, multiple: boolean$1, muted: boolean$1, name: null, nonce: null, noModule: boolean$1, noValidate: boolean$1, onAbort: null, onAfterPrint: null, onAuxClick: null, onBeforePrint: null, onBeforeUnload: null, onBlur: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onContextMenu: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnded: null, onError: null, onFocus: null, onFormData: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLanguageChange: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadEnd: null, onLoadStart: null, onMessage: null, onMessageError: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRejectionHandled: null, onReset: null, onResize: null, onScroll: null, onSecurityPolicyViolation: null, onSeeked: null, onSeeking: null, onSelect: null, onSlotChange: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnhandledRejection: null, onUnload: null, onVolumeChange: null, onWaiting: null, onWheel: null, open: boolean$1, optimum: number$3, pattern: null, ping: spaceSeparated$3, placeholder: null, playsInline: boolean$1, poster: null, preload: null, readOnly: boolean$1, referrerPolicy: null, rel: spaceSeparated$3, required: boolean$1, reversed: boolean$1, rows: number$3, rowSpan: number$3, sandbox: spaceSeparated$3, scope: null, scoped: boolean$1, seamless: boolean$1, selected: boolean$1, shape: null, size: number$3, sizes: null, slot: null, span: number$3, spellCheck: booleanish$2, src: null, srcDoc: null, srcLang: null, srcSet: commaSeparated$2, start: number$3, step: null, style: null, tabIndex: number$3, target: null, title: null, translate: null, type: null, typeMustMatch: boolean$1, useMap: null, value: booleanish$2, width: number$3, wrap: null, // Legacy. // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis align: null, // Several. Use CSS `text-align` instead, aLink: null, // ``. Use CSS `a:active {color}` instead archive: spaceSeparated$3, // ``. List of URIs to archives axis: null, // `` and ``. Use `scope` on `` background: null, // ``. Use CSS `background-image` instead bgColor: null, // `` and table elements. Use CSS `background-color` instead border: number$3, // ``. Use CSS `border-width` instead, borderColor: null, // `
`. Use CSS `border-color` instead, bottomMargin: number$3, // `` cellPadding: null, // `
` cellSpacing: null, // `
` char: null, // Several table elements. When `align=char`, sets the character to align on charOff: null, // Several table elements. When `char`, offsets the alignment classId: null, // `` clear: null, // `
`. Use CSS `clear` instead code: null, // `` codeBase: null, // `` codeType: null, // `` color: null, // `` and `
`. Use CSS instead compact: boolean$1, // Lists. Use CSS to reduce space between items instead declare: boolean$1, // `` event: null, // `