UNPKG

kompendium

Version:

Documentation generator for Stencil components

2,130 lines (1,777 loc) 1.11 MB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const index$1 = require('./index-4264cbf1.js'); const _commonjsHelpers = require('./_commonjsHelpers-206db00d.js'); const markdownTypes = require('./markdown-types-265472a0.js'); var bail_1 = bail; function bail(err) { if (err) { throw err } } /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ var isBuffer$1 = 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$2 = 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$3 = [].slice; var wrap_1$1 = wrap$3; // Wrap `fn`. // Can be sync or async; return a promise, receive a completion handler, return // new values and errors. function wrap$3(fn, callback) { var invoked; return wrapped function wrapped() { var params = slice$3.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$1; var slice$2 = [].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$2.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$2.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$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$e = {}.hasOwnProperty; var unistUtilStringifyPosition = stringify$3; function stringify$3(value) { // Nothing. if (!value || typeof value !== 'object') { return '' } // Node. if (own$e.call(value, 'position') || own$e.call(value, 'type')) { return position$2(value.position) } // Position. if (own$e.call(value, 'start') || own$e.call(value, 'end')) { return position$2(value) } // Point. if (own$e.call(value, 'line') || own$e.call(value, 'column')) { return point$1(value) } // ? return '' } function point$1(point) { if (!point || typeof point !== 'object') { point = {}; } return index(point.line) + ':' + index(point.column) } function position$2(pos) { if (!pos || typeof pos !== 'object') { pos = {}; } return point$1(pos.start) + '-' + point$1(pos.end) } function index(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$5 = VMessage.prototype; proto$5.file = ''; proto$5.name = ''; proto$5.reason = ''; proto$5.message = ''; proto$5.stack = ''; proto$5.fatal = null; proto$5.column = null; proto$5.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 } const global$1 = (typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); // shim for using process in browser // based off https://github.com/defunctzombie/node-process/blob/master/browser.js function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } var cachedSetTimeout = defaultSetTimout; var cachedClearTimeout = defaultClearTimeout; if (typeof global$1.setTimeout === 'function') { cachedSetTimeout = setTimeout; } if (typeof global$1.clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } function nextTick(fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } } // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; var title = 'browser'; var platform = 'browser'; var browser = true; var env = {}; var argv = []; var version = ''; // empty string to avoid regexp issues var versions = {}; var release = {}; var config = {}; function noop$2() {} var on = noop$2; var addListener = noop$2; var once = noop$2; var off = noop$2; var removeListener = noop$2; var removeAllListeners = noop$2; var emit = noop$2; function binding(name) { throw new Error('process.binding is not supported'); } function cwd () { return '/' } function chdir (dir) { throw new Error('process.chdir is not supported'); }function umask() { return 0; } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js var performance = global$1.performance || {}; var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function(){ return (new Date()).getTime() }; // generate timestamp or delta // see http://nodejs.org/api/process.html#process_process_hrtime function hrtime(previousTimestamp){ var clocktime = performanceNow.call(performance)*1e-3; var seconds = Math.floor(clocktime); var nanoseconds = Math.floor((clocktime%1)*1e9); if (previousTimestamp) { seconds = seconds - previousTimestamp[0]; nanoseconds = nanoseconds - previousTimestamp[1]; if (nanoseconds<0) { seconds--; nanoseconds += 1e9; } } return [seconds,nanoseconds] } var startTime = new Date(); function uptime() { var currentTime = new Date(); var dif = currentTime - startTime; return dif / 1000; } var browser$1 = { nextTick: nextTick, title: title, browser: browser, env: env, argv: argv, version: version, versions: versions, on: on, addListener: addListener, once: once, off: off, removeListener: removeListener, removeAllListeners: removeAllListeners, emit: emit, binding: binding, cwd: cwd, chdir: chdir, umask: umask, hrtime: hrtime, platform: platform, release: release, config: config, uptime: uptime }; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // resolves . and .. elements in a path array with directory names there // must be no slashes, empty elements, or device names (c:\) in the array // (so also no leading and trailing slashes - it does not distinguish // relative and absolute paths) function normalizeArray(parts, allowAboveRoot) { // if the path tries to go above the root, `up` ends up > 0 var up = 0; for (var i = parts.length - 1; i >= 0; i--) { var last = parts[i]; if (last === '.') { parts.splice(i, 1); } else if (last === '..') { parts.splice(i, 1); up++; } else if (up) { parts.splice(i, 1); up--; } } // if the path is allowed to go above the root, restore leading ..s if (allowAboveRoot) { for (; up--; up) { parts.unshift('..'); } } return parts; } // Split a filename into [root, dir, basename, ext], unix version // 'root' is just a slash, or nothing. var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; var splitPath = function(filename) { return splitPathRe.exec(filename).slice(1); }; // path.resolve([from ...], to) // posix version function resolve() { var resolvedPath = '', resolvedAbsolute = false; for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { var path = (i >= 0) ? arguments[i] : '/'; // Skip empty and invalid entries if (typeof path !== 'string') { throw new TypeError('Arguments to path.resolve must be strings'); } else if (!path) { continue; } resolvedPath = path + '/' + resolvedPath; resolvedAbsolute = path.charAt(0) === '/'; } // At this point the path should be resolved to a full absolute path, but // handle relative paths to be safe (might happen when process.cwd() fails) // Normalize the path resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { return !!p; }), !resolvedAbsolute).join('/'); return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; } // path.normalize(path) // posix version function normalize$2(path) { var isPathAbsolute = isAbsolute(path), trailingSlash = substr(path, -1) === '/'; // Normalize the path path = normalizeArray(filter(path.split('/'), function(p) { return !!p; }), !isPathAbsolute).join('/'); if (!path && !isPathAbsolute) { path = '.'; } if (path && trailingSlash) { path += '/'; } return (isPathAbsolute ? '/' : '') + path; } // posix version function isAbsolute(path) { return path.charAt(0) === '/'; } // posix version function join() { var paths = Array.prototype.slice.call(arguments, 0); return normalize$2(filter(paths, function(p, index) { if (typeof p !== 'string') { throw new TypeError('Arguments to path.join must be strings'); } return p; }).join('/')); } // path.relative(from, to) // posix version function relative(from, to) { from = resolve(from).substr(1); to = resolve(to).substr(1); function trim(arr) { var start = 0; for (; start < arr.length; start++) { if (arr[start] !== '') break; } var end = arr.length - 1; for (; end >= 0; end--) { if (arr[end] !== '') break; } if (start > end) return []; return arr.slice(start, end - start + 1); } var fromParts = trim(from.split('/')); var toParts = trim(to.split('/')); var length = Math.min(fromParts.length, toParts.length); var samePartsLength = length; for (var i = 0; i < length; i++) { if (fromParts[i] !== toParts[i]) { samePartsLength = i; break; } } var outputParts = []; for (var i = samePartsLength; i < fromParts.length; i++) { outputParts.push('..'); } outputParts = outputParts.concat(toParts.slice(samePartsLength)); return outputParts.join('/'); } var sep = '/'; var delimiter = ':'; function dirname(path) { var result = splitPath(path), root = result[0], dir = result[1]; if (!root && !dir) { // No dirname whatsoever return '.'; } if (dir) { // It has a dirname, strip trailing slash dir = dir.substr(0, dir.length - 1); } return root + dir; } function basename(path, ext) { var f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows? if (ext && f.substr(-1 * ext.length) === ext) { f = f.substr(0, f.length - ext.length); } return f; } function extname(path) { return splitPath(path)[3]; } const path$1 = { extname: extname, basename: basename, dirname: dirname, sep: sep, delimiter: delimiter, relative: relative, join: join, isAbsolute: isAbsolute, normalize: normalize$2, resolve: resolve }; function filter (xs, f) { if (xs.filter) return xs.filter(f); var res = []; for (var i = 0; i < xs.length; i++) { if (f(xs[i], i, xs)) res.push(xs[i]); } return res; } // String.prototype.substr - negative index don't work in IE8 var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) { return str.substr(start, len) } : function (str, start, len) { if (start < 0) start = str.length + start; return str.substr(start, len); } ; const path$2 = /*#__PURE__*/Object.freeze({ __proto__: null, resolve: resolve, normalize: normalize$2, isAbsolute: isAbsolute, join: join, relative: relative, sep: sep, delimiter: delimiter, dirname: dirname, basename: basename, extname: extname, 'default': path$1 }); const path = /*@__PURE__*/_commonjsHelpers.getAugmentedNamespace(path$2); function replaceExt(npath, ext) { if (typeof npath !== 'string') { return npath; } if (npath.length === 0) { return npath; } var nFileName = path.basename(npath, path.extname(npath)) + ext; return path.join(path.dirname(npath), nFileName); } var replaceExt_1 = replaceExt; /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ var isBuffer = function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) }; var core$1 = VFile; var own$d = {}.hasOwnProperty; var proto$4 = 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$4.toString = toString; // Access full path (`~/index.min.js`). Object.defineProperty(proto$4, 'path', {get: getPath, set: setPath}); // Access parent path (`~`). Object.defineProperty(proto$4, 'dirname', {get: getDirname, set: setDirname}); // Access basename (`index.min.js`). Object.defineProperty(proto$4, 'basename', {get: getBasename, set: setBasename}); // Access extname (`.js`). Object.defineProperty(proto$4, 'extname', {get: getExtname, set: setExtname}); // Access stem (`index.min`). Object.defineProperty(proto$4, '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 = browser$1.cwd(); // Set path related properties in the correct order. index = -1; length = order.length; while (++index < length) { prop = order[index]; if (own$d.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.dirname(this.path) : undefined } function setDirname(dirname) { assertPath(this.path, 'dirname'); this.path = path.join(dirname || '', this.basename); } function getBasename() { return typeof this.path === 'string' ? path.basename(this.path) : undefined } function setBasename(basename) { assertNonEmpty(basename, 'basename'); assertPart(basename, 'basename'); this.path = path.join(this.dirname || '', basename); } function getExtname() { return typeof this.path === 'string' ? path.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.basename(this.path, this.extname) : undefined } function setStem(stem) { assertNonEmpty(stem, 'stem'); assertPart(stem, 'stem'); this.path = path.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.sep) !== -1) { throw new Error( '`' + name + '` cannot be a path: did not expect `' + path.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$3 = core$1.prototype; proto$3.message = message; proto$3.info = info$1; proto$3.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$1() { var message = this.message.apply(this, arguments); message.fatal = null; return message } // Expose a frozen processor. var unified_1$1 = unified$1().freeze(); var slice$1 = [].slice; var own$c = {}.hasOwnProperty; // Process pipeline. var pipeline$1 = trough_1() .use(pipelineParse$1) .use(pipelineRun$1) .use(pipelineStringify$1); function pipelineParse$1(p, ctx) { ctx.tree = p.parse(ctx.file); } function pipelineRun$1(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$1(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$1(result)) { file.contents = result; } else { file.result = result; } } // Function to create the first processor. function unified$1() { 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$1(); var length = attachers.length; var index = -1; while (++index < length) { destination.use.apply(null, attachers[index]); } destination.data(extend$2(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$1('data', frozen); namespace[key] = value; return processor } // Get `key`. return (own$c.call(namespace, key) && namespace[key]) || null } // Set space. if (key) { assertUnfrozen$1('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$1('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$2(namespace.settings || {}, settings); } return processor function addPreset(result) { addList(result.plugins); if (result.settings) { settings = extend$2(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$2(entry[1], value); } entry[1] = value; } else { attachers.push(slice$1.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$1('parse', Parser); if (newable$1(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$1(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$1('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$1('stringify', Compiler); assertNode$1(node); if (newable$1(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$1('process', processor.Parser); assertCompiler$1('process', processor.Compiler); if (!cb) { return new Promise(executor) } executor(null, cb); function executor(resolve, reject) { var file = vfile(doc); pipeline$1.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$1('processSync', processor.Parser); assertCompiler$1('processSync', processor.Compiler); file = vfile(doc); process(file, done); assertDone$1('processSync', 'process', complete); return file function done(err) { complete = true; bail_1(err); } } } // Check if `value` is a constructor. function newable$1(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$2(value.prototype) || name in value.prototype) ) } // Check if `value` is an object with keys. function keys$2(value) { var key; for (key in value) { return true } return false } // Assert a parser is available. function assertParser$1(name, Parser) { if (typeof Parser !== 'function') { throw new Error('Cannot `' + name + '` without `Parser`') } } // Assert a compiler is available. function assertCompiler$1(name, Compiler) { if (typeof Compiler !== 'function') { throw new Error('Cannot `' + name + '` without `Compiler`') } } // Assert the processor is not frozen. function assertUnfrozen$1(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$1(node) { if (!node || typeof node.type !== 'string') { throw new Error('Expected node, got `' + node + '`') } } // Assert that `complete` is `true`. function assertDone$1(name, asyncName, complete) { if (!complete) { throw new Error( '`' + name + '` finished async. Use `' + asyncName + '` instead' ) } } var immutable = extend$1; var hasOwnProperty$1 = Object.prototype.hasOwnProperty; function extend$1() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty$1.call(source, key)) { target[key] = source[key]; } } } return target } var inherits_browser = _commonjsHelpers.createCommonjsModule(function (module) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; } }; } }); var unherit_1 = unherit; // Create a custom constructor which can be modified without affecting the // original class. function unherit(Super) { var result; var key; var value; inherits_browser(Of, Super); inherits_browser(From, Of); // Clone values. result = Of.prototype; for (key in result) { value = result[key]; if (value && typeof value === 'object') { result[key] = 'concat' in value ? value.concat() : immutable(value); } } return Of // Constructor accepting a single argument, which itself is an `arguments` // object. function From(parameters) { return Super.apply(this, parameters) } // Constructor accepting variadic arguments. function Of() { if (!(this instanceof Of)) { return new From(arguments) } return Super.apply(this, arguments) } } var stateToggle = factory$8; // Construct a state `toggler`: a function which inverses `property` in context // based on its current value. // The by `toggler` returned function restores that value. function factory$8(key, state, ctx) { return enter function enter() { var context = ctx || this; var current = context[key]; context[key] = !state; return exit function exit() { context[key] = current; } } } var vfileLocation = factory$7; function factory$7(file) { var contents = indices(String(file)); return { toPosition: offsetToPositionFactory(contents), toOffset: positionToOffsetFactory(contents) } } // Factory to get the line and column-based `position` for `offset` in the bound // indices. function offsetToPositionFactory(indices) { return offsetToPosition // Get the line and column-based `position` for `offset` in the bound indices. function offsetToPosition(offset) { var index = -1; var length = indices.length; if (offset < 0) { return {} } while (++index < length) { if (indices[index] > offset) { return { line: index + 1, column: offset - (indices[index - 1] || 0) + 1, offset: offset } } } return {} } } // Factory to get the `offset` for a line and column-based `position` in the // bound indices. function positionToOffsetFactory(indices) { return positionToOffset // Get the `offset` for a line and column-based `position` in the bound // indices. function positionToOffset(position) { var line = position && position.line; var column = position && position.column; if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { return (indices[line - 2] || 0) + column - 1 || 0 } return -1 } } // Get indices of line-breaks in `value`. function indices(value) { var result = []; var index = value.indexOf('\n'); while (index !== -1) { result.push(index + 1); index = value.indexOf('\n', index + 1); } result.push(value.length + 1); return result } var _unescape = factory$6; var backslash$7 = '\\'; // Factory to de-escape a value, based on a list at `key` in `ctx`. function factory$6(ctx, key) { return unescape // De-escape a string using the expression at `key` in `ctx`. function unescape(value) { var previous = 0; var index = value.indexOf(backslash$7); var escape = ctx[key]; var queue = []; var character; while (index !== -1) { queue.push(value.slice(previous, index)); previous = index + 1; character = value.charAt(previous); // If the following character is not a valid escape, add the slash. if (!character || escape.indexOf(character) === -1) { queue.push(backslash$7); } index = value.indexOf(backslash$7, previous + 1); } queue.push(value.slice(previous)); return queue.join('') } } const AElig$1 = "Æ"; const AMP = "&"; const Aacute$1 = "Á"; const Acirc$1 = "Â"; const Agrave$1 = "À"; const Aring$1 = "Å"; const Atilde$1 = "Ã"; const Auml$1 = "Ä"; const COPY = "©"; const Ccedil$1 = "Ç"; const ETH$1 = "Ð"; const Eacute$1 = "É"; const Ecirc$1 = "Ê"; const Egrave$1 = "È"; const Euml$1 = "Ë"; const GT = ">"; const Iacute$1 = "Í"; const Icirc$1 = "Î"; const Igrave$1 = "Ì"; const Iuml$1 = "Ï"; const LT = "<"; const Ntilde$1 = "Ñ"; const Oacute$1 = "Ó"; const Ocirc$1 = "Ô"; const Ograve$1 = "Ò"; const Oslash$1 = "Ø"; const Otilde$1 = "Õ"; const Ouml$1 = "Ö"; const QUOT = "\""; const REG = "®"; const THORN$1 = "Þ"; const Uacute$1 = "Ú"; const Ucirc$1 = "Û"; const Ugrave$1 = "Ù"; const Uuml$1 = "Ü"; const Yacute$1 = "Ý"; const aacute$1 = "á"; const acirc$1 = "â"; const acute$1 = "´"; const aelig$1 = "æ"; const agrave$1 = "à"; const amp$1 = "&"; const aring$1 = "å"; const atilde$1 = "ã"; const auml$1 = "ä"; const brvbar$1 = "¦"; const ccedil$1 = "ç"; const cedil$1 = "¸"; const cent$1 = "¢"; const copy$1 = "©"; const curren$1 = "¤"; const deg$1 = "°"; const divide$1 = "÷"; const eacute$1 = "é"; const ecirc$1 = "ê"; const egrave$1 = "è"; const eth$1 = "ð"; const euml$1 = "ë"; const frac12$1 = "½"; const frac14$1 = "¼"; const frac34$1 = "¾"; const gt$1 = ">"; const iacute$1 = "í"; const icirc$1 = "î"; const iexcl$1 = "¡"; const igrave$1 = "ì"; const iquest$1 = "¿"; const iuml$1 = "ï"; const laquo$1 = "«"; const lt$1 = "<"; const macr$1 = "¯"; const micro$1 = "µ"; const middot$1 = "·"; const nbsp$1 = " "; const not$1 = "¬"; const ntilde$1 = "ñ"; const oacute$1 = "ó"; const ocirc$1 = "ô"; const ograve$1 = "ò"; const ordf$1 = "ª"; const ordm$1 = "º"; const oslash$1 = "ø"; const otilde$1 = "õ"; const ouml$1 = "ö"; const para$1 = "¶"; const plusmn$1 = "±"; const pound$1 = "£"; const quot$1 = "\""; const raquo$1 = "»"; const reg$1 = "®"; const sect$1 = "§"; const shy$1 = "­"; const sup1$1 = "¹"; const sup2$1 = "²"; const sup3$1 = "³"; const szlig$1 = "ß"; const thorn$1 = "þ"; const times$1 = "×"; const uacute$1 = "ú"; const ucirc$1 = "û"; const ugrave$1 = "ù"; const uml$1 = "¨"; const uuml$1 = "ü"; const yacute$1 = "ý"; const yen$1 = "¥"; const yuml$1 = "ÿ"; const legacy = { AElig: AElig$1, AMP: AMP, Aacute: Aacute$1, Acirc: Acirc$1, Agrave: Agrave$1, Aring: Aring$1, Atilde: Atilde$1, Auml: Auml$1, COPY: COPY, Ccedil: Ccedil$1, ETH: ETH$1, Eacute: Eacute$1, Ecirc: Ecirc$1, Egrave: Egrave$1, Euml: Euml$1, GT: GT, Iacute: Iacute$1, Icirc: Icirc$1, Igrave: Igrave$1, Iuml: Iuml$1, LT: LT, Ntilde: Ntilde$1, Oacute: Oacute$1, Ocirc: Ocirc$1, Ograve: Ograve$1, Oslash: Oslash$1, Otilde: Otilde$1, Ouml: Ouml$1, QUOT: QUOT, REG: REG, THORN: THORN$1, Uacute: Uacute$1, Ucirc: Ucirc$1, Ugrave: Ugrave$1, Uuml: Uuml$1, Yacute: Yacute$1, aacute: aacute$1, acirc: acirc$1, acute: acute$1, aelig: aelig$1, agrave: agrave$1, amp: amp$1, aring: aring$1, atilde: atilde$1, auml: auml$1, brvbar: brvbar$1, ccedil: ccedil$1, cedil: cedil$1, cent: cent$1, copy: copy$1, curren: curren$1, deg: deg$1, divide: divide$1, eacute: eacute$1, ecirc: ecirc$1, egrave: egrave$1, eth: eth$1, euml: euml$1, frac12: frac12$1, frac14: frac14$1, frac34: frac34$1, gt: gt$1, iacute: iacute$1, icirc: icirc$1, iexcl: iexcl$1, igrave: igrave$1, iquest: iquest$1, iuml: iuml$1, laquo: laquo$1, lt: lt$1, macr: macr$1, micro: micro$1, middot: middot$1, nbsp: nbsp$1, not: not$1, ntilde: ntilde$1, oacute: oacute$1, ocirc: ocirc$1, ograve: ograve$1, ordf: ordf$1, ordm: ordm$1, oslash: oslash$1, otilde: otilde$1, ouml: ouml$1, para: para$1, plusmn: plusmn$1, pound: pound$1, quot: quot$1, raquo: raquo$1, reg: reg$1, sect: sect$1, shy: shy$1, sup1: sup1$1, sup2: sup2$1, sup3: sup3$1, szlig: szlig$1, thorn: thorn$1, times: times$1, uacute: uacute$1, ucirc: ucirc$1, ugrave: ugrave$1, uml: uml$1, uuml: uuml$1, yacute: yacute$1, yen: yen$1, yuml: yuml$1 }; const invalid = { "0": "�", "128": "€", "130": "‚", "131": "ƒ", "132": "„", "133": "…", "134": "†", "135": "‡", "136": "ˆ", "137": "‰", "138": "Š", "139": "‹", "140": "Œ", "142": "Ž", "145": "‘", "146": "’", "147": "“", "148": "”", "149": "•", "150": "–", "151": "—", "152": "˜", "153": "™", "154": "š", "155": "›", "156": "œ", "158": "ž", "159": "Ÿ" }; var isDecimal = decimal$1; // Check if the given character code, or the character code at the first // character, is decimal. function decimal$1(character) { var code = typeof character === 'string' ? character.charCodeAt(0) : character; return code >= 48 && code <= 57 /* 0-9 */ } var isHexadecimal = hexadecimal; // Check if the given character code, or the character code at the first // character, is hexadecimal. function hexadecimal(character) { var code = typeof character === 'string' ? character.charCodeAt(0) : character; return ( (code >= 97 /* a */ && code <= 102) /* z */ || (code >= 65 /* A */ && code <= 70) /* Z */ || (code >= 48 /* A */ && code <= 57) /* Z */ ) } var isAlphabetical = alphabetical; // Check if the given character code, or the character code at the first // character, is alphabetical. function alphabetical(character) { var code = typeof character === 'string' ? character.charCodeAt(0) : character; return ( (code >= 97 && code <= 122) /* a-z */ || (code >= 65 && code <= 90) /* A-Z */ ) } var isAlphanumerical = alphanumerical; // Check if the given character code, or the character code at the first // character, is alphanumerical. function alphanumerical(character) { return isAlphabetical(character) || isDecimal(character) } /* eslint-env browser */ var el; var semicolon$2 = 59; // ';' var decodeEntity_browser = decodeEntity; function decodeEntity(characters) { var entity = '&' + characters + ';'; var char; el = el || document.createElement('i'); el.innerHTML = entity; char = el.textContent; // Some entities do not require the closing semicolon (`&not` - for instance), // which leads to situations where parsing the assumed entity of &notit; will